PHT  Pigeonhole Tower
Pigeon SSNA want to build a tower with some wood walls. Let's describe the tower they want to make:
 A Tower can consist of different number of level.
 If a tower contain L levels then 1^{st} level must contain L holes , 2^{nd} level L1 , 3^{rd} level L2 ….. L level contain 1 hole .
 Each room contain 3 wood walls.
See the picture below:
3 Level Tower  4 Level tower 
Now pigeon SSNA has n wood walls. What is maximum number of level he can made.
Input
Input starts with an integer T (≤ 100000), denoting the number of test cases.
Each case starts with a line containing an integer n (1 ≤ n ≤ 10^{12})
Output
For each case of input you have to print the case number and expected answer.
Sample Input 
Output for Sample Input 
2 15 24 
Case 1: 3 Case 2: 4 
hide comments
ritun_1999:
20200406 04:11:59
My O(1) solution is showing TLE...Please help. 

mrdevesh_00:
20191218 20:55:41
AC in one go!!!! 

aryan29:
20190601 01:12:01
Waste of time easy question just make a formula 

deku__:
20190510 05:38:48
So you are given no. of walls as input and you're expected to find no. of levels. You can use A.P concept to solve it. 

kshubham02:
20190414 16:43:09
ok ended up solving without the figure. For the record for level = 3, the tower looks like this 


kshubham02:
20190414 16:10:39
https://s32.postimg.org/ymsous6cl/image.png


silentknight16:
20190218 18:03:02
AC in one go!!! 

akt_114:
20180808 20:42:53
AC in one go !! 

oneinchatatime:
20180718 18:53:16
Image:


amankumarkeshu:
20180528 06:18:32
Can anyone see the image of the picture ?

Added by:  Ajharul Islam Barid 
Date:  20141013 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 GOSU 
Resource:  Own Problem 