CONSTRAINTS AND TLE, DONT GO FOR O(sqrt(N)) solution, GO FOR O(LOG(N)) solution


#1

The constraints given are probably wrong and the actual constraints are
0<=A<=(probably)10**18
Hence you are supposed to use binary search and the usual root(N) solution will not work.