def symmetric_residue(a, m):
 if (a <= (m // 2)):
  return a
 return (a - m)

def symmetric_residue ( a , m ) : if ( a <= ( m // 2 ) ) : return a return ( a - m )
return the residual mod m such that it is within half of the modulus .