Everyone loves short problem statements.
Given a function $ f(x) $ find its minimum value over the range $ 0 < x < π/2$
$
f(x) = ( x^2 + b*x + c ) / sin( x )
$

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, two real numbers $b, c$. 

-----Output:-----
For each test case, output the minimum value of $ f(x) $ over the given range. Absolute error of $10^{-6}$ is allowed.

-----Constraints-----
- $1 \leq T \leq 100000$
- $1 \leq b,c \leq 20$

-----Sample Input:-----
1
2 2

-----Sample Output:-----
5.8831725615

Starter code:

Solutions:
import sys
import math
input=sys.stdin.readline
def binary(l,r,co,b,c):
 x=(l+r)/2
 #print(x)
 val1=(2*x+b)*math.sin(x)
 val2=(x**2+b*x+c)*math.cos(x)
 x=(l+r)/2
 val=val1-val2
 if(abs(val)<.0000001 or co==150):
  return (l+r)/2
 if(val<0):
  return binary((l+r)/2,r,co+1,b,c)
 else:
  return binary(l,(l+r)/2,co+1,b,c)
t=int(input())
for _ in range(t):
 b,c=list(map(float,input().split()))
 x=binary(.0000000001,math.pi/2-.0000000001,0,b,c)
 #print("t=",_)
 val=(x*x+b*x+c)/math.sin(x)
 print(val)
 

 


 
 
 


 


import math

def func(x,b,c):
 ans=x*x+b*x+c
 ans/=math.sin(x)
 return ans


for asd in range(int(input())):
 b,c=map(float,input().split())

 st=0
 en=math.pi/2
 iterations=0
 ans=func(en,b,c)
 while en-st>0.000001:
  if iterations>100:
   break

  x1=st+(en-st)/3
  x2=en-(en-st)/3
  fx1=func(x1,b,c)
  fx2=func(x2,b,c)
  if abs(fx2-fx1)<0.00000001:
   break
  ans=min(ans,min(fx1,fx2))
  if fx2<fx1:
   st=x1
  else:
   en=x2
  
  iterations+=1
 print("%.12f"%ans)