SEQ7  Yet Another Sequence Problem
We have an infinite nondecreasing sequence A which is created as follows :
 A[1] = 1 and A[2] = 2.
 A number i occurs A[i] times in the sequence.
First few terms in the sequence are: { 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7... }. Note that 3 occurs 2 times in the sequence, (because A[3] = 2).
Your task is to find the term A[n] for any given n, where 0 < n <= 1e13.
Input
First line contains t, the number of testcases. Each of the next t lines contains a number n.
Output
For every case, print the nth term of the sequence.
Example
Input:
2
5
12
Output:
3
6
hide comments
Soma:
20150624 03:17:12
@sivanatarajan : write a brute force program in python and cross check with your output(from one which implements your algorithm). 

sivanatarajan:
20141021 19:08:57
anyone tell some more test cases.. 

Pranjal Successena:
20130422 21:28:21
can u chk my code?


:
20130113 17:29:30
plz provide some tricky test cases ..i think i got d pattern but its showing WA..


(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
20130105 12:30:38
what is this? just use approximation and got AC in 0.00s (without fast I/O) I haven't optimize my code, but seems that my algo is fastest compared to other ;) plus I only use 1,7MB of memory... 

sandeep pandey:
20120316 08:40:45
Binary Search will be okay :


Ashish Sahay:
20111218 11:04:42
is the answer for 1e13130097223??? 

:D:
20110623 11:51:09
No, basic arithmetic's is enough. 

uevoliinilas:
20110512 10:55:02
Is this same as http://acm.mipt.ru/judge/problems.pl?problem=047&CGISESSID=12027e31a8c0844fbf3fadfa731bbb29


Piotr KÄ…kol:
20110510 11:46:27
Is the answer for 1e13  130097224?

Added by:  Paranoid Android 
Date:  20110509 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 