<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class Solution ( object ) : <EOL> def solve ( self , cipher ) : <EOL> """<STR_LIT>""" <EOL> r2 , k = cipher <EOL> required = <NUM_LIT:0> <EOL> r = r2 ** <NUM_LIT:0.5> <EOL> for x in xrange ( <NUM_LIT:0> , int ( r ) + <NUM_LIT:1> ) : <EOL> low = <NUM_LIT:0> <EOL> high = int ( r ) + <NUM_LIT:1> <EOL> while low <= high : <EOL> mid = ( low + high ) / <NUM_LIT:2> <EOL> if x * x + mid * mid == r2 : <EOL> if mid == <NUM_LIT:0> or x == <NUM_LIT:0> : <EOL> required += <NUM_LIT:2> <EOL> else : <EOL> required += <NUM_LIT:4> <EOL> if required > k : return "<STR_LIT>" <EOL> break <EOL> elif x * x + mid * mid < r2 : <EOL> low = mid + <NUM_LIT:1> <EOL> else : <EOL> high = mid - <NUM_LIT:1> <EOL> if required > k : return "<STR_LIT>" <EOL> return "<STR_LIT>" <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import sys <EOL> f = open ( "<STR_LIT>" , "<STR_LIT:r>" ) <EOL> testcases = int ( f . readline ( ) . strip ( ) ) <EOL> for t in xrange ( testcases ) : <EOL> cipher = map ( int , f . readline ( ) . strip ( ) . split ( '<STR_LIT:U+0020>' ) ) <EOL> s = "<STR_LIT>" % ( Solution ( ) . solve ( cipher ) ) <EOL> print s , </s>
