<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class Solution ( object ) : <EOL> def solve ( self , cipher ) : <EOL> """<STR_LIT>""" <EOL> N , M = cipher <EOL> low = <NUM_LIT:0> <EOL> high = N <EOL> while low + <NUM_LIT:1> < high : <EOL> mid = ( low + high ) / <NUM_LIT:2> <EOL> r = self . Turan ( N , mid ) <EOL> if r < M : <EOL> low = mid <EOL> else : <EOL> high = mid <EOL> return high <EOL> def Turan ( self , n , r ) : <EOL> """<STR_LIT>""" <EOL> return <NUM_LIT:0.5> * ( n ** <NUM_LIT:2> - ( n % r ) * ( n / r + <NUM_LIT:1> ) ** <NUM_LIT:2> - ( r - ( n % r ) ) * ( n / r ) ** <NUM_LIT:2> ) <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>
