B. Stairs

problem_index: B

time_limit: 1 second

memory_limit: 256 megabytes

solutions: ["for _ in range(int(input())):\n\tn = int(input())\n\tprefix = [0] * 64\n\tfor i in range(0, 64):\n\t\tprefix[i] = 2 ** (i + 1) - 1\n\tarr = [0] * 64\n\tfor i in range(0, 64):\n\t\tarr[i] = prefix[i] * (prefix[i] + 1) // 2\n\tcount = 0\n\ti = 0\n\twhile n >= 0:\n\t\tn -= arr[i]\n\t\ti += 1\n\t\tcount += 1\n\tprint(count - 1)\n", "for _ in range(int(input())):\n\tx = int(input())\n\ti = 1\n\tss = 0\n\twhile ss <= x:\n\t\tss += 2 ** i * (2 ** i - 1) // 2\n\t\ti += 1\n\tprint(i - 2)\n", "N = 35\ndp = [0] * N\ndp[1] = 1\ncnt = 1\nfor i in range(2, N):\n\tcnt = 2 * cnt + 1\n\tdp[i] = cnt * (cnt + 1) // 2\n\tdp[i] += dp[i - 1]\nfor _ in range(int(input())):\n\tx = int(input())\n\tans = 1\n\tpos = 1\n\tfor i in range(1, N - 1):\n\t\tif x < dp[i + 1]:\n\t\t\tpos = i\n\t\t\tbreak\n\tprint(pos)\n", "for t in range(int(input())):\n\tn = int(input())\n\t(now, ans) = (int(1), int(0))\n\twhile n > 0:\n\t\tn -= now * (now + 1) // 2\n\t\tif n >= 0:\n\t\t\tans += 1\n\t\tnow = 2 * now + 1\n\tprint(ans)\n", "def solve(x):\n\tcount = 0\n\tval = 1\n\tpower = 2\n\twhile val <= x:\n\t\tcount += 1\n\t\tx -= val\n\t\tval = val * 2 + power * power\n\t\tpower = power * 2\n\tprint(count)\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tsolve(x)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tcount = 0\n\tprev = 0\n\tfor i in range(0, 60):\n\t\tcr = 2 * prev + (1 << i) ** 2\n\t\tif cr > n:\n\t\t\tbreak\n\t\tcount += 1\n\t\tn -= cr\n\t\tprev = cr\n\tprint(count)\n", "from bisect import bisect_right as br\nt = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\tl = [1]\n\tfor i in range(31):\n\t\tl.append(2 * l[-1] + 1)\n\tcr = [ele * (ele + 1) // 2 for ele in l]\n\tsoc = []\n\tsoc.append(1)\n\tfor i in range(1, 31):\n\t\tsoc.append(cr[i] + soc[-1])\n\tprint(br(soc, n))\n", "def cellcount(l):\n\te = (l + l ** 2) // 2\n\treturn e\nn = int(input())\nfor i in range(0, n):\n\ta = int(input())\n\tj = 1\n\to = 1\n\tk = 0\n\twhile a > 0:\n\t\ta = a - cellcount(j)\n\t\to = o * 2\n\t\tj = o + j\n\t\tk = k + 1\n\tif a < 0:\n\t\tk = k - 1\n\tprint(k)\n", "from sys import stdin\nfrom math import ceil, gcd\n\ndef func(m):\n\ta = 2 ** (2 * m + 1)\n\tb = 2 ** m\n\treturn (a + 2 - 3 * b) // 3\nfor _ in range(int(stdin.readline())):\n\tn = int(stdin.readline())\n\tm = 1\n\twhile func(m) <= n:\n\t\tm += 1\n\tprint(m - 1)\n", "t = int(input())\ndp = [1]\nwhile dp[-1] < 10 ** 18 + 1:\n\tdp.append(dp[-1] * 2 + 4 ** len(dp))\nfrom itertools import accumulate\ndp = list(accumulate(dp))\nfrom bisect import bisect_left as bl, bisect_right as br\nfor i in range(t):\n\ta = int(input())\n\tprint(br(dp, a))\n", "def solve_case(n):\n\tk = 0\n\tpow = 1\n\tescalera = 1\n\twhile escalera <= n:\n\t\tk += 1\n\t\tn -= escalera\n\t\tescalera = escalera * 2 + (pow + 1) * (pow + 1)\n\t\tpow = pow * 2 + 1\n\treturn k\n\ndef main():\n\tcases = int(input())\n\tfor _ in range(cases):\n\t\tnum = int(input())\n\t\tprint('{}'.format(solve_case(num)))\nmain()\n", "import sys\nimport heapq\nimport copy\nimport math\nimport decimal\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef insr2():\n\ts = input()\n\ts = list(s[:len(s) - 1])\n\ts = [ord(s[i]) - ord('a') for i in range(len(s))]\n\treturn s\n\ndef invr():\n\treturn map(int, input().split())\nans = 0\n\ndef pr_list(a):\n\tprint(*a, sep=' ')\n\ndef swap(a, b):\n\ttemp = a\n\ta = b\n\tb = temp\n\treturn [a, b]\n\ndef pri(a, b):\n\ts = '? ' + str(a) + ' ' + str(b)\n\tprint(s)\n\tsys.stdout.flush()\n\ndef main():\n\ttests = inp()\n\tmod = 1000000007\n\tlimit = 10 ** 18\n\tans = 0\n\tstack = []\n\thashm = {}\n\tarr = []\n\theapq.heapify(arr)\n\tfor test in range(tests):\n\t\tx = inp()\n\t\tarr = 1\n\t\tans = 1\n\t\tpower = 2\n\t\tx = x - 1\n\t\twhile True:\n\t\t\tarr = 2 * arr + power * power\n\t\t\tpower = power * 2\n\t\t\tif arr <= x:\n\t\t\t\tx = x - arr\n\t\t\t\tans = ans + 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tprint(ans)\nmain()\n", "import math\ntest = int(input())\nfor i in range(test):\n\tx = int(input())\n\tmark = 0\n\txx = 1\n\twhile x > 0:\n\t\ta = xx * (xx + 1) // 2\n\t\twhile False:\n\t\t\tbreak\n\t\tif x >= a:\n\t\t\tmark += 1\n\t\t\txx = 2 * xx + 1\n\t\tx -= a\n\twhile False:\n\t\tbreak\n\tprint(mark)\n", "import math, sys, bisect, heapq\nfrom collections import defaultdict, Counter, deque\nfrom itertools import groupby, accumulate\nint1 = lambda x: int(x) - 1\nilele = lambda : map(int, input().split())\nalele = lambda : list(map(int, input().split()))\nilelec = lambda : map(int1, input().split())\nalelec = lambda : list(map(int1, input().split()))\n\ndef list2d(a, b, c):\n\treturn [[c] * b for i in range(a)]\n\ndef list3d(a, b, c, d):\n\treturn [[[d] * c for j in range(b)] for i in range(a)]\n\ndef Y(c):\n\tprint(['NO', 'YES'][c])\n\ndef y(c):\n\tprint(['no', 'yes'][c])\n\ndef Yy(c):\n\tprint(['No', 'Yes'][c])\nfor _ in range(int(input())):\n\tn = int(input())\n\tcount = 0\n\ta = 1\n\tl = 1\n\twhile n > 0:\n\t\tn -= l * (l + 1) // 2\n\t\tif n >= 0:\n\t\t\tcount += 1\n\t\t\ta *= 2\n\t\t\tl += a\n\tprint(count)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tk = 1\n\tcurr = 0\n\tans = -1\n\twhile curr <= n:\n\t\tcurr += k * (k + 1) // 2\n\t\tans += 1\n\t\tk *= 2\n\t\tk += 1\n\tprint(ans)\n", "def solve(x):\n\tans = 0\n\ti = 1\n\tjam = 0\n\twhile True:\n\t\ta = 2 ** i - 1\n\t\tif jam + a * (a + 1) // 2 <= x:\n\t\t\tjam += a * (a + 1) // 2\n\t\t\tans += 1\n\t\t\ti += 1\n\t\telse:\n\t\t\treturn ans\nt = int(input())\nfor _ in range(t):\n\tprint(solve(int(input())))\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = 0\n\tk = 1\n\tfor i in range(1, n):\n\t\tm = (2 ** i - 1) * 2 ** (i - 1)\n\t\ts += m\n\t\tif s > n:\n\t\t\tk = i - 1\n\t\t\tbreak\n\tprint(k)\n", "t = int(input())\nfor zzz in range(t):\n\tcount = 0\n\tstairCount = 0\n\tmaxi = int(input())\n\ti = 1\n\twhile True:\n\t\tif count + i * (i + 1) // 2 <= maxi:\n\t\t\tcount = count + i * (i + 1) // 2\n\t\t\tstairCount += 1\n\t\t\ti = 2 * i + 1\n\t\telse:\n\t\t\tbreak\n\tprint(stairCount)\n", "from math import inf, sqrt, floor, ceil\nfrom collections import Counter, defaultdict, deque\nfrom heapq import heappush as hpush, heappop as hpop, heapify as h\nfrom operator import itemgetter\nfrom itertools import product\nfrom bisect import bisect_left, bisect_right\nfor _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\ti = 1\n\twhile 1:\n\t\tnice = 2 ** i - 1\n\t\tv = nice * (nice + 1) // 2\n\t\tif v <= x:\n\t\t\tans += 1\n\t\t\tx -= v\n\t\t\ti += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import math\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tl = []\n\tfor j in range(1, n + 1):\n\t\tx = 2 ** j - 1\n\t\tx = x * (x + 1) // 2\n\t\tl.append(x)\n\t\tif sum(l) > n:\n\t\t\tl.pop()\n\t\t\tbreak\n\tprint(len(l))\n", "cand = [1]\nfor i in range(100):\n\tcand.append(cand[-1] * 2 + 1)\n\tif cand[-1] > 10 ** 18:\n\t\tbreak\nfor i in range(int(input())):\n\tans = 0\n\tx = int(input())\n\tfor i in cand:\n\t\tj = i * (i + 1) // 2\n\t\tif x - j < 0:\n\t\t\tbreak\n\t\telse:\n\t\t\tx -= j\n\t\t\tans += 1\n\tprint(ans)\n", "import math\nfrom collections import deque\nfrom sys import stdin, stdout\nfrom string import ascii_letters\nimport sys\nletters = ascii_letters[:26]\ninput = stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\tneed = 1\n\tres = 0\n\tif n >= 1:\n\t\tn -= 1\n\t\tres += 1\n\twhile True:\n\t\tneed *= 2\n\t\tbf = (need + need) * (need + need - 1) // 2\n\t\tif n < bf:\n\t\t\tbreak\n\t\tres += 1\n\t\tn -= bf\n\tprint(res)\n", "import sys\nimport math\nimport itertools\nimport functools\nimport collections\nimport operator\nimport fileinput\nimport copy\nORDA = 97\n\ndef ii():\n\treturn int(input())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef li():\n\treturn [int(i) for i in input().split()]\n\ndef lcm(a, b):\n\treturn abs(a * b) // math.gcd(a, b)\n\ndef revn(n):\n\treturn str(n)[::-1]\n\ndef dd():\n\treturn collections.defaultdict(int)\n\ndef ddl():\n\treturn collections.defaultdict(list)\n\ndef sieve(n):\n\tif n < 2:\n\t\treturn list()\n\tprime = [True for _ in range(n + 1)]\n\tp = 3\n\twhile p * p <= n:\n\t\tif prime[p]:\n\t\t\tfor i in range(p * 2, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 2\n\tr = [2]\n\tfor p in range(3, n + 1, 2):\n\t\tif prime[p]:\n\t\t\tr.append(p)\n\treturn r\n\ndef divs(n, start=2):\n\tr = []\n\tfor i in range(start, int(math.sqrt(n) + 1)):\n\t\tif n % i == 0:\n\t\t\tif n / i == i:\n\t\t\t\tr.append(i)\n\t\t\telse:\n\t\t\t\tr.extend([i, n // i])\n\treturn r\n\ndef divn(n, primes):\n\tdivs_number = 1\n\tfor i in primes:\n\t\tif n == 1:\n\t\t\treturn divs_number\n\t\tt = 1\n\t\twhile n % i == 0:\n\t\t\tt += 1\n\t\t\tn //= i\n\t\tdivs_number *= t\n\ndef prime(n):\n\tif n == 2:\n\t\treturn True\n\tif n % 2 == 0 or n <= 1:\n\t\treturn False\n\tsqr = int(math.sqrt(n)) + 1\n\tfor d in range(3, sqr, 2):\n\t\tif n % d == 0:\n\t\t\treturn False\n\treturn True\n\ndef convn(number, base):\n\tnew_number = 0\n\twhile number > 0:\n\t\tnew_number += number % base\n\t\tnumber //= base\n\treturn new_number\n\ndef cdiv(n, k):\n\treturn n // k + (n % k != 0)\n\ndef ispal(s):\n\tfor i in range(len(s) // 2 + 1):\n\t\tif s[i] != s[-i - 1]:\n\t\t\treturn False\n\treturn True\na = []\nt = 1\nfor i in range(1, 32):\n\ta.append(t)\n\tt += t + 1\nfor _ in range(ii()):\n\tn = ii()\n\tans = 0\n\tfor i in range(31):\n\t\tn -= a[i] * (a[i] + 1) // 2\n\t\tans += 1\n\t\tif n < a[i + 1] * (a[i + 1] + 1) // 2:\n\t\t\tbreak\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\tp = 1\n\t\ts = 0\n\t\tans = 0\n\t\twhile True:\n\t\t\tp *= 2\n\t\t\ts += (p - 1) * p // 2\n\t\t\tif s > n:\n\t\t\t\tbreak\n\t\t\tans += 1\n\t\tprint(ans)\nmain()\n", "arr = [1, 7]\nele = [1, 3]\nfrom bisect import *\ntotal = 7\nwhile 1:\n\tx = ele[-1] + 2 * (ele[-1] - ele[-2])\n\telem = total + x * (x + 1) // 2\n\tif elem <= pow(10, 18):\n\t\tarr.append(elem)\n\t\tele.append(x)\n\telse:\n\t\tbreak\n\ttotal = elem\na = int(input())\nfor i in range(a):\n\tn = int(input())\n\tr = bisect_left(arr, n)\n\tif r == 30:\n\t\tprint(30)\n\t\tcontinue\n\tif arr[r] > n:\n\t\tprint(r)\n\telse:\n\t\tprint(r + 1)\n", "t = int(input())\nfor i in range(t):\n\tx = int(input())\n\tx = 6 * x\n\tstart = 1\n\tend = 70\n\tans = None\n\twhile start <= end:\n\t\tmid = (start + end) // 2\n\t\ty = 4 * (2 ** (2 * mid) - 1) - 6 * (2 ** mid - 1)\n\t\tif y == x:\n\t\t\tans = mid\n\t\t\tbreak\n\t\telif y > x:\n\t\t\tend = mid - 1\n\t\telse:\n\t\t\tans = mid\n\t\t\tstart = mid + 1\n\tprint(ans)\n", "def main():\n\tfor _ in range(int(input())):\n\t\tx = int(input())\n\t\tstairs = 1\n\t\tn = 1\n\t\tcount = 1\n\t\tsum = 1\n\t\tx -= 1\n\t\twhile True:\n\t\t\tn += 1\n\t\t\tstairs = 2 ** n - 1\n\t\t\tsum = stairs * (stairs + 1) // 2\n\t\t\tif sum > x:\n\t\t\t\tbreak\n\t\t\tx -= sum\n\t\t\tcount += 1\n\t\tprint(count)\nmain()\n", "N = 70\nX = [(-1 + (1 << i + 1)) * (1 << i) for i in range(N)]\n\ndef solve(x):\n\tres = 0\n\ttmp = x\n\tfor i in range(N):\n\t\tif tmp >= X[i]:\n\t\t\ttmp -= X[i]\n\t\t\tres += 1\n\treturn res\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tprint(solve(x))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ti = 1\n\tans = 0\n\twhile n:\n\t\tm = 2 ** i - 1\n\t\tif n - m * (m + 1) // 2 >= 0:\n\t\t\tans += 1\n\t\t\tn -= m * (m + 1) // 2\n\t\telse:\n\t\t\tbreak\n\t\ti += 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input()) - 1\n\ti = 1\n\tans = 0\n\twhile n >= 0:\n\t\tans += 1\n\t\ti += 1\n\t\tx = (2 ** i - 1) * 2 ** (i - 1)\n\t\tn -= x\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tstart = 0\n\tts = 0\n\tans = 0\n\twhile True:\n\t\tstart = start * 2 + 1\n\t\tts += start * (start + 1) // 2\n\t\tif ts <= x:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import sys\nimport os\nimport math\nimport copy\nfrom math import gcd\nfrom bisect import bisect\nfrom io import BytesIO, IOBase\nfrom math import sqrt, floor, factorial, gcd, log, ceil\nfrom collections import deque, Counter, defaultdict\nfrom itertools import permutations, combinations\nfrom itertools import accumulate\n\ndef Int():\n\treturn int(sys.stdin.readline())\n\ndef Mint():\n\treturn map(int, sys.stdin.readline().split())\n\ndef Lstr():\n\treturn list(sys.stdin.readline().strip())\n\ndef Str():\n\treturn sys.stdin.readline().strip()\n\ndef Mstr():\n\treturn map(str, sys.stdin.readline().strip().split())\n\ndef List():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef Hash():\n\treturn dict()\n\ndef Mod():\n\treturn 1000000007\n\ndef Ncr(n, r, p):\n\treturn fact[n] * (ifact[r] * ifact[n - r] % p) % p\n\ndef Most_frequent(list):\n\treturn max(set(list), key=list.count)\n\ndef Mat2x2(n):\n\treturn [List() for _ in range(n)]\n\ndef Lcm(x, y):\n\treturn x * y // gcd(x, y)\n\ndef dtob(n):\n\treturn bin(n).replace('0b', '')\n\ndef btod(n):\n\treturn int(n, 2)\n\ndef common(l1, l2):\n\treturn set(l1).intersection(l2)\n\ndef solution():\n\tfor i in range(Int()):\n\t\tn = Int()\n\t\ta = 1\n\t\tc = 0\n\t\tneed = 0\n\t\twhile need <= n:\n\t\t\tc += 1\n\t\t\tneed += a * (a - 1) // 2\n\t\t\ta = a * 2\n\t\telse:\n\t\t\tc -= 1\n\t\tprint(c - 1)\nsolution()\n", "def solve(n):\n\tbig = float('inf')\n\tsmall = float('-inf')\n\tused = 0\n\ti = 0\n\twhile True:\n\t\ti += 1\n\t\tused = (2 ** i - 1) * 2 ** (i - 1)\n\t\tn -= used\n\t\tif n == 0:\n\t\t\treturn i\n\t\telif n < 0:\n\t\t\treturn i - 1\n\ndef main():\n\tt = int(input())\n\tfor i in range(t):\n\t\tn = int(input())\n\t\tans = solve(n)\n\t\tprint(ans)\nmain()\n", "def sum_ab(a, b):\n\treturn int((a + b) / 2 * (b - a + 1))\nfor _ in range(int(input())):\n\tschody = int(input())\n\tkoszt = 1\n\tcos = 1\n\tpot = 2\n\tx = 0\n\twhile schody >= koszt:\n\t\tschody -= koszt\n\t\tcos += pot\n\t\tpot *= 2\n\t\tkoszt = sum_ab(1, cos)\n\t\tx += 1\n\tprint(x)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ti = 1\n\td = 0\n\twhile n > 0:\n\t\tc = 2 ** i - 1\n\t\ta = c * (c + 1) // 2\n\t\tn -= a\n\t\ti += 1\n\t\tif n >= 0:\n\t\t\td += 1\n\tprint(d)\n", "import math\nTC = int(input())\nfor __ in range(TC):\n\tx = int(input())\n\n\tdef F(n):\n\t\treturn (4 ** (n + 1) - 1) // (4 - 1) - (2 ** (n + 1) - 1)\n\tn = 0\n\twhile F(n) <= 2 * x:\n\t\tn += 1\n\tprint(n - 1)\n", "import sys\nimport bisect\n\ndef fun(a, x):\n\tm = bisect.bisect_right(a, x)\n\treturn m\nt = int(input())\nk = 1\nsum = 0\na = []\nwhile sum < 1e+18:\n\tk = k << 1\n\tsum += k * (k - 1) // 2\n\ta.append(sum)\nfor tc in range(t):\n\tx = int(input())\n\tprint(fun(a, x))\n", "def ans(x):\n\tn = 1\n\tm = 2 ** n - 1\n\ttemp = m * (m + 1) // 2\n\ta = 0\n\twhile x - temp >= 0:\n\t\tx -= temp\n\t\ta += 1\n\t\tn += 1\n\t\tm = 2 ** n - 1\n\t\ttemp = m * (m + 1) // 2\n\treturn a\nm = int(input())\nfor i in range(m):\n\tx = int(input())\n\tprint(ans(x))\n", "for t in range(int(input())):\n\tn = int(input())\n\t(count, add) = (0, 0)\n\twhile True:\n\t\tadd += 4 ** count + (2 ** count - 1) * 2 ** count // 2\n\t\tif n >= add:\n\t\t\tn -= add\n\t\telse:\n\t\t\tbreak\n\t\tcount += 1\n\tprint(count)\n", "t = int(input())\n\ndef solve():\n\tx = int(input())\n\ttmp = 1\n\tsol = 1\n\tx -= 1\n\tfor i in range(1, 68):\n\t\ttmp = tmp * 2 + 1\n\t\tif tmp * (tmp + 1) // 2 > x:\n\t\t\tbreak\n\t\tx -= tmp * (tmp + 1) // 2\n\t\tsol += 1\n\tprint(sol)\nfor tt in range(t):\n\tsolve()\n", "t = int(input())\nlist = [2 ** (a - 1) * (2 ** a - 1) for a in range(1, 32)]\ns = 0\nd = []\nfor i in range(31):\n\ts += list[i]\n\td.append(s)\nfor _ in range(t):\n\tx = int(input())\n\ti = 0\n\twhile x >= d[i]:\n\t\ti += 1\n\tprint(i)\n", "arr = [1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647, 4294967295, 8589934591, 17179869183, 34359738367, 68719476735, 137438953471, 274877906943, 549755813887, 1099511627775, 2199023255551, 4398046511103, 8796093022207, 17592186044415, 35184372088831, 70368744177663, 140737488355327, 281474976710655, 562949953421311, 1125899906842623, 2251799813685247, 4503599627370495, 9007199254740991, 18014398509481983, 36028797018963967, 72057594037927935, 144115188075855871, 288230376151711743, 576460752303423487]\n\ndef s(num):\n\treturn (1 + num) * num // 2\nfor _ in range(int(input())):\n\tx = int(input())\n\tc = 0\n\tn = 1\n\twhile x - s(n) >= 0:\n\t\tx -= s(n)\n\t\tc += 1\n\t\tn = n * 2 + 1\n\tprint(c)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tx = 1\n\tsol = 0\n\twhile 1:\n\t\tn -= x * (x + 1) // 2\n\t\tif n < 0:\n\t\t\tbreak\n\t\tsol += 1\n\t\tx = 2 * x + 1\n\tprint(sol)\n", "import sys\ninput = sys.stdin.readline\nT = int(input())\nfor t in range(T):\n\tX = int(input())\n\tanswer = 0\n\tpow2 = 1\n\twhile True:\n\t\tr = 2 ** pow2 - 1\n\t\tneeded = r * (r + 1) // 2\n\t\tif needed <= X:\n\t\t\tanswer += 1\n\t\t\tX -= needed\n\t\telse:\n\t\t\tbreak\n\t\tpow2 += 1\n\tprint(answer)\n", "for _ in range(int(input())):\n\tp = int(input())\n\n\tdef func(n):\n\t\tsum = 0\n\t\tfor i in range(n):\n\t\t\tsum = sum + 2 ** i\n\t\treturn sum\n\n\tdef sum(n):\n\t\ta = 0\n\t\tfor i in range(n + 1):\n\t\t\ta = a + func(i) * (func(i) + 1) // 2\n\t\treturn a\n\tn = 1\n\twhile sum(n) < p:\n\t\tn = n + 1\n\tif sum(n) > p:\n\t\tprint(n - 1)\n\telse:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tt = 0\n\ti = 1\n\td = 2\n\twhile n > 0 and i < 10 ** 25:\n\t\tvar = i * (i + 1) // 2\n\t\tif n >= var:\n\t\t\tn -= var\n\t\t\tt += 1\n\t\tif n < var:\n\t\t\tbreak\n\t\ti += d\n\t\td *= 2\n\tprint(t)\n", "from bisect import bisect\nt = int(input())\nbuf = []\nINF = 10 ** 18\nstair = [1]\npre = [1]\nwhile pre[-1] <= INF:\n\tp = stair[-1] * 2 + 1\n\ts = p * (p + 1) // 2\n\tstair.append(p)\n\tpre.append(pre[-1] + s)\nfor _ in range(t):\n\tn = int(input())\n\tbuf.append(bisect(pre, n))\nprint('\\n'.join(map(str, buf)))\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\tp = 1\n\ttemp = n\n\tcount = 0\n\tsumi = 0\n\twhile True:\n\t\tp = p * 2\n\t\tsumi = p * (p - 1) // 2\n\t\ttemp -= sumi\n\t\tif temp < 0:\n\t\t\tprint(count)\n\t\t\tbreak\n\t\tcount += 1\n", "from collections import defaultdict\nfrom queue import deque\nfrom math import log2\n\ndef arrinp():\n\treturn [*map(int, input().split(' '))]\n\ndef mulinp():\n\treturn map(int, input().split(' '))\n\ndef intinp():\n\treturn int(input())\n\ndef fun(n):\n\treturn (n * n + n) // 2\n\ndef solution():\n\tn = int(input())\n\tn += 1\n\tcount = 0\n\tval = 2\n\twhile n > 0:\n\t\tcount += 1\n\t\tn -= fun(val - 1)\n\t\tval *= 2\n\tprint(count - 1)\n\treturn\ntestcases = 1\ntestcases = int(input())\nfor _ in range(testcases):\n\tsolution()\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\t(left, right) = (1, 30)\n\twhile left < right:\n\t\tmid = right - (right - left) // 2\n\t\tcur = (4 ** mid - 1) * 2 // 3 - 2 ** mid + 1\n\t\tif cur <= n:\n\t\t\tleft = mid\n\t\telse:\n\t\t\tright = mid - 1\n\tprint(left)\n", "arr = [0 for i in range(100)]\narr[0] = 1\nfor i in range(1, len(arr)):\n\tarr[i] = arr[i - 1] * 2 + 1\nheight = [0 for i in range(100)]\nheight[0] = 1\nfor i in range(1, len(arr)):\n\theight[i] = arr[i] * (arr[i] + 1) // 2\nfor _ in range(int(input())):\n\tx = int(input())\n\tcurrs = 0\n\tcount = 0\n\tfor i in range(100):\n\t\tcurrs += height[i]\n\t\tif currs > x:\n\t\t\tprint(count)\n\t\t\tbreak\n\t\tcount += 1\n", "def fun(n):\n\treturn n * (n + 1) // 2\nfor _ in range(int(input())):\n\tx = int(input())\n\tcount = 0\n\ti = 1\n\twhile x >= fun(i):\n\t\tx = x - fun(i)\n\t\ti = i * 2 + 1\n\t\tcount += 1\n\tprint(count)\n", "T = int(input())\nfor _ in range(T):\n\tx = int(input())\n\tcnt = 0\n\tc = 1\n\twhile x > 0:\n\t\tx -= c * (c + 1) // 2\n\t\tif x >= 0:\n\t\t\tcnt += 1\n\t\t\tc = 2 * c + 1\n\tprint(cnt)\n", "for _ in range(int(input())):\n\tx = int(input())\n\t(i, curr) = (0, 0)\n\twhile True:\n\t\tcurr = 2 * curr + 1\n\t\tval = curr * (curr + 1) // 2\n\t\tif x >= val:\n\t\t\tx -= val\n\t\t\ti += 1\n\t\telse:\n\t\t\tbreak\n\tprint(i)\n", "t = int(input())\nwhile t:\n\tn = int(input())\n\tans = 0\n\tfor x in range(1, 50):\n\t\tu = 2 ** x - 1\n\t\ts = u * (u + 1) // 2\n\t\tif n >= s:\n\t\t\tn -= s\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n\tt -= 1\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef RL():\n\treturn map(int, sys.stdin.readline().rstrip().split())\n\ndef RLL():\n\treturn list(map(int, sys.stdin.readline().rstrip().split()))\n\ndef N():\n\treturn int(input())\n\ndef comb(n, m):\n\treturn factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0\n\ndef perm(n, m):\n\treturn factorial(n) // factorial(n - m) if n >= m else 0\n\ndef mdis(x1, y1, x2, y2):\n\treturn abs(x1 - x2) + abs(y1 - y2)\n\ndef toord(c):\n\treturn ord(c) - ord('a')\n\ndef lcm(a, b):\n\treturn a * b // lcm(a, b)\nmod = 998244353\nINF = float('inf')\nfrom math import factorial, sqrt, ceil, floor, gcd\nfrom collections import Counter, defaultdict, deque\nfrom heapq import heapify, heappop, heappush\n\ndef main():\n\tfor _ in range(N()):\n\t\tx = N()\n\t\tbase = 1\n\t\ttag = 1\n\t\tres = 0\n\t\twhile x > 0:\n\t\t\tx -= base\n\t\t\tif x >= 0:\n\t\t\t\tres += 1\n\t\t\tbase = base * 2 + (2 ** tag) ** 2\n\t\t\ttag += 1\n\t\tprint(res)\nmain()\n", "import bisect\nimport sys\ninput = sys.stdin.readline\nstore = [0] * 40\nfor i in range(40):\n\tpo = 2 ** (i + 1) - 1\n\tstore[i] = po * (po + 1) // 2\ncopy = [store[0]]\nfor i in range(1, 40):\n\tcopy.append(copy[-1] + store[i])\nt = int(input())\nfor ii in range(t):\n\tn = int(input())\n\tind = bisect.bisect(copy, n)\n\tprint(ind)\n", "tests = int(input())\nfor test in range(tests):\n\tn = int(input())\n\tans = 0\n\ts = 0\n\tfor i in range(1, 31):\n\t\td = 2 ** i - 1\n\t\tr = d * (d + 1) // 2\n\t\tif s + r <= n:\n\t\t\tans += 1\n\t\t\ts += r\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nfor case in range(t):\n\tx = int(input())\n\tcells = 0\n\ti = 0\n\tj = 1\n\twhile cells <= x:\n\t\tcells += j * (j + 1) // 2\n\t\ti += 1\n\t\tj = 2 * j + 1\n\tprint(i - 1)\n", "tests = int(input())\nfor testnum in range(tests):\n\tn = int(input())\n\tk = 1\n\tpower = 1\n\ttimes = 0\n\tsum = 0\n\twhile True:\n\t\tadder = k * (k + 1) // 2\n\t\tif sum + adder <= n:\n\t\t\tsum += adder\n\t\t\tk += pow(2, power)\n\t\t\tpower += 1\n\t\t\ttimes += 1\n\t\telse:\n\t\t\tbreak\n\tprint(times)\n", "def nice_stairs(n):\n\t(k, s, t, l) = (0, 0, 0, 0)\n\twhile n > s:\n\t\tt = 2 ** k + s\n\t\ts += t\n\t\tn -= s\n\t\tk += 2\n\t\tif n >= 0:\n\t\t\tl += 1\n\treturn l\nfor _ in range(int(input())):\n\tn = int(input())\n\tprint(nice_stairs(n))\n", "fun = lambda x: x * (x + 1) // 2\ncell_sum = [0]\nfor i in range(1, 32):\n\tno = (1 << i) - 1\n\tcell_sum.append(cell_sum[-1] + fun(no))\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tans = -1\n\tfor no in cell_sum:\n\t\tif no <= x:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "for i in range(int(input())):\n\tx = int(input())\n\ti = -1\n\twhile x >= 0:\n\t\ti += 1\n\t\tk = 2 ** i - 1\n\t\tx -= k * (k + 1) // 2\n\tprint(i - 1)\n", "def get_s(x):\n\treturn x * (x + 1) / 2\n\ndef my_ans(n):\n\tans = 0\n\th = 1\n\twhile n >= get_s(h):\n\t\tans += 1\n\t\tn -= get_s(h)\n\t\th = (h + 1) * 2 - 1\n\treturn ans\n\ndef his_ans(num):\n\tn = 0\n\tx = 0\n\twhile n <= num:\n\t\tx = x + 1\n\t\tm = 2 ** x - 1\n\t\tn += m * (m + 1) // 2\n\treturn x - 1\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tprint(his_ans(n))\n", "import sys\nfrom functools import lru_cache, cmp_to_key\nfrom heapq import merge, heapify, heappop, heappush, nsmallest\nfrom math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log\nfrom collections import defaultdict as dd, deque, Counter as C\nfrom itertools import combinations as comb, permutations as perm\nfrom bisect import bisect_left as bl, bisect_right as br, bisect\nfrom time import perf_counter\nfrom fractions import Fraction\nfrom decimal import Decimal\nmod = pow(10, 9) + 7\nmod2 = 998244353\n\ndef data():\n\treturn sys.stdin.readline().strip()\n\ndef out(var):\n\tsys.stdout.write(str(var) + '\\n')\n\ndef outa(*var, end='\\n'):\n\tsys.stdout.write(' '.join(map(str, var)) + end)\n\ndef l():\n\treturn list(sp())\n\ndef sl():\n\treturn list(ssp())\n\ndef sp():\n\treturn map(int, data().split())\n\ndef ssp():\n\treturn map(str, data().split())\n\ndef l1d(n, val=0):\n\treturn [val for i in range(n)]\n\ndef l2d(n, m, val=0):\n\treturn [l1d(n, val) for j in range(m)]\narr = []\ni = 2\nmaxn = int(1e+18)\nwhile True:\n\ttemp = i * (i - 1) // 2\n\tif temp > maxn:\n\t\tbreak\n\tarr.append(temp)\n\ti *= 2\nfor _ in range(int(data())):\n\tn = int(data())\n\tanswer = 0\n\tfor i in arr:\n\t\tif i > n:\n\t\t\tbreak\n\t\tanswer += 1\n\t\tn -= i\n\tout(answer)\n", "def fact(x):\n\tif x == 0:\n\t\treturn 1\n\telse:\n\t\treturn x * fact(x - 1)\n\ndef lower_bound(li, num):\n\tanswer = -1\n\tstart = 0\n\tend = len(li) - 1\n\twhile start <= end:\n\t\tmiddle = (end + start) // 2\n\t\tif li[middle] >= num:\n\t\t\tanswer = middle\n\t\t\tend = middle - 1\n\t\telse:\n\t\t\tstart = middle + 1\n\treturn answer\n\ndef upper_bound(li, num):\n\tanswer = -1\n\tstart = 0\n\tend = len(li) - 1\n\twhile start <= end:\n\t\tmiddle = (end + start) // 2\n\t\tif li[middle] <= num:\n\t\t\tanswer = middle\n\t\t\tstart = middle + 1\n\t\telse:\n\t\t\tend = middle - 1\n\treturn answer\n\ndef abs(x):\n\treturn x if x >= 0 else -x\n\ndef binary_search(li, val, lb, ub):\n\tans = 0\n\twhile lb <= ub:\n\t\tmid = (lb + ub) // 2\n\t\tif li[mid] > val:\n\t\t\tub = mid - 1\n\t\telif val > li[mid]:\n\t\t\tlb = mid + 1\n\t\telse:\n\t\t\tans = 1\n\t\t\tbreak\n\treturn ans\n\ndef kadane(x):\n\tsum_so_far = 0\n\tcurrent_sum = 0\n\tfor i in x:\n\t\tcurrent_sum += i\n\t\tif current_sum < 0:\n\t\t\tcurrent_sum = 0\n\t\telse:\n\t\t\tsum_so_far = mpos(sum_so_far, current_sum)\n\treturn sum_so_far\n\ndef pref(li):\n\tpref_sum = [0]\n\tfor i in li:\n\t\tpref_sum.append(pref_sum[-1] + i)\n\treturn pref_sum\n\ndef graph(n, m):\n\tadj = dict()\n\tfor i in range(1, n + 1):\n\t\tadj.setdefault(i, 0)\n\tfor i in range(m):\n\t\t(a, b) = map(int, input().split())\n\t\tadj[a] += 1\n\t\tadj[b] += 1\n\treturn adj\nimport sys\nimport threading\nfrom math import *\nfor _ in range(int(input())):\n\tn = int(input())\n\tli = [0]\n\tfor i in range(32):\n\t\tli.append(li[-1] * 2 + 2 ** (2 * i))\n\tli = li[1:]\n\tpref_sum = pref(li)\n\tpref_sum = pref_sum[1:]\n\tind = upper_bound(pref_sum, n)\n\tprint(ind + 1)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\ta = 0\n\tfor i in range(0, 31):\n\t\ti = 2 ** i\n\t\ta += i * i + i * (i - 1) // 2\n\t\tn = n - a\n\t\tans += 1\n\t\tif n == 0:\n\t\t\tbreak\n\t\telif n < 0:\n\t\t\tans -= 1\n\t\t\tbreak\n\t\telif n > 0:\n\t\t\tcontinue\n\tprint(ans)\n", "a = [1]\nfor i in range(2, 10000):\n\tb = 2 ** i - 1\n\tans = b * (b + 1) // 2\n\ta.append(ans)\nt = int(input())\nfor i in range(0, t):\n\tx = int(input())\n\tfor i in range(0, len(a)):\n\t\tif x - a[i] < 0:\n\t\t\tprint(i)\n\t\t\tbreak\n\t\tx -= a[i]\n", "def fun(x):\n\ti = 1\n\tct = 0\n\twhile i < 32 and x > 0:\n\t\tx -= 2 ** (i - 1) * (2 ** i - 1)\n\t\ti += 1\n\t\tct += 1\n\treturn ct if x == 0 else ct - 1\nfor _ in range(int(input())):\n\tx = int(input())\n\tprint(fun(x))\n", "from sys import *\ninput = stdin.readline\nfor _ in range(int(input())):\n\tx = int(input())\n\tcurr = 1\n\tval = 1\n\tcn = 0\n\twhile x >= 0:\n\t\tcn += 1\n\t\tx -= val * (val + 1) // 2\n\t\tcurr *= 2\n\t\tval += curr\n\tstdout.write(str(cn - 1) + '\\n')\n", "pre = []\n\ndef init():\n\tglobal pre\n\tpre.append(0)\n\tnow = 1\n\ttmp = 0\n\tfor i in range(1, 50):\n\t\ttmp = tmp * 2 + now * now\n\t\tpre.append(pre[-1] + tmp)\n\t\tnow = now * 2\n\ndef check(tmp, x):\n\tglobal pre\n\treturn pre[tmp] <= x\n\ndef main():\n\tglobal pre\n\tinit()\n\tt = eval(input())\n\tfor cas in range(t):\n\t\tx = eval(input())\n\t\t(l, r) = (1, len(pre) - 1)\n\t\tans = 1\n\t\twhile l <= r:\n\t\t\tmid = (l + r) // 2\n\t\t\tif check(mid, x):\n\t\t\t\tl = mid + 1\n\t\t\t\tans = mid\n\t\t\telse:\n\t\t\t\tr = mid - 1\n\t\tprint(ans)\nmain()\n", "import sys\nimport math as m\n\ndef main():\n\tpass\n\ndef binary(n):\n\treturn bin(n).replace('0b', '')\n\ndef decimal(s):\n\treturn int(s, 2)\n\ndef pow2(n):\n\tp = 0\n\twhile n > 1:\n\t\tn //= 2\n\t\tp += 1\n\treturn p\n\ndef isPrime(n):\n\tif n == 1:\n\t\treturn False\n\telse:\n\t\troot = int(n ** 0.5)\n\t\troot += 1\n\t\tfor i in range(2, root):\n\t\t\tif n % i == 0:\n\t\t\t\treturn False\n\t\treturn True\n\ndef sinp():\n\treturn sys.stdin.readline().strip()\n\ndef iinp():\n\treturn int(input())\n\ndef ninp():\n\treturn map(int, sys.stdin.readline().strip().split())\n\ndef linp():\n\treturn list(map(int, sys.stdin.readline().strip().split()))\n\ndef p(a):\n\tprint(a)\nfor _ in range(iinp()):\n\tx = iinp()\n\tn = 1\n\tans = 0\n\twhile True:\n\t\tind = 0\n\t\tb = n\n\t\ttot = 0\n\t\twhile b != 1:\n\t\t\ttot = tot + b * b * 2 ** ind\n\t\t\tb = b // 2\n\t\t\tind += 1\n\t\ttot = tot + 2 ** ind\n\t\tx = x - tot\n\t\tif x >= 0:\n\t\t\tans += 1\n\t\t\tn = n * 2\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input()) - 1\n\tn = 1\n\tarr = [1]\n\twhile True:\n\t\tn *= 2\n\t\tarr.append(n)\n\t\ts = sum(arr) * (sum(arr) + 1) // 2\n\t\tif x - s < 0:\n\t\t\tarr.remove(n)\n\t\t\tbreak\n\t\tx -= s\n\tprint(len(arr))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ttotal = 0\n\tcount = 0\n\tother = 1\n\tz = 1\n\twhile total < n:\n\t\ttotal += other * (other + 1) // 2\n\t\tcount += 1\n\t\tz = 2 ** count\n\t\tother += z\n\tif total > n:\n\t\tcount -= 1\n\tprint(count)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tf = lambda a: a * (a + 1) // 2\n\tp = 0\n\tval = 1\n\twhile f(val * 2 - 1) <= n:\n\t\tval *= 2\n\t\tp += 1\n\t\tn -= f(val - 1)\n\tprint(p)\n", "def solve():\n\tx = int(input())\n\ts = 1\n\tp = 2\n\tans = 0\n\twhile x:\n\t\ttotal = s * (s + 1) // 2\n\t\tif total > x:\n\t\t\tbreak\n\t\tans += 1\n\t\tx -= total\n\t\ts = (1 << p) - 1\n\t\tp += 1\n\tprint(ans)\n\treturn\n\ndef main():\n\tt = 1\n\tt = int(input())\n\tfor _ in range(t):\n\t\tsolve()\nmain()\n", "import os\nimport heapq\nimport sys, threading\nimport math\nimport operator\nfrom collections import defaultdict, deque\nfrom io import BytesIO, IOBase\nsys.setrecursionlimit(10 ** 5)\n\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\telse:\n\t\treturn gcd(b, a % b)\n\ndef inpt():\n\treturn [int(k) for k in input().split()]\n\ndef main():\n\tfor i in range(int(input())):\n\t\tn = int(input())\n\t\tct = 0\n\t\tval = 1\n\t\tar = []\n\t\tfor i in range(60):\n\t\t\tval *= 2\n\t\t\tar.append(val - 1)\n\t\tsm = 0\n\t\tfor i in range(len(ar)):\n\t\t\tval = ar[i] * (ar[i] + 1) // 2\n\t\t\tif val + sm > n:\n\t\t\t\tbreak\n\t\t\tct += 1\n\t\t\tsm += val\n\t\tprint(ct)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import math\nt = int(input())\nfor q in range(0, t):\n\tn = int(input())\n\tcurr = 1\n\ti = 2\n\tsum = 0\n\tans = 0\n\twhile True:\n\t\tcal = curr * (curr + 1) // 2\n\t\tif sum + cal <= n:\n\t\t\tsum += cal\n\t\t\tcurr += i\n\t\t\ti = i * 2\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "l = [1]\nfor i in range(70):\n\tl.append(2 * l[-1] + 1)\nl = [ll * (ll + 1) // 2 for ll in l]\nlll = [l[0]]\nfor i in range(1, 70):\n\tlll.append(lll[-1] + l[i])\nl = lll\nfor t in range(int(input())):\n\tn = int(input())\n\tfor i in range(70):\n\t\tif l[i] > n:\n\t\t\tprint(i)\n\t\t\tbreak\n", "def f(n):\n\tif n == 1:\n\t\treturn 1\n\treturn 4 * f(n - 1) + 2 ** (n - 1)\nT = int(input())\nfor _ in range(T):\n\tx = int(input())\n\tres = 0\n\tfor i in range(1, 31):\n\t\tcuad = f(i)\n\t\tif cuad <= x:\n\t\t\tx -= cuad\n\t\t\tres += 1\n\t\telse:\n\t\t\tbreak\n\tprint(res)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tsu = 0\n\ti = 2\n\tcnt = 0\n\twhile su <= x:\n\t\tsu += (i - 1) * i // 2\n\t\ti = i * 2\n\t\tcnt += 1\n\tprint(cnt - 1)\n", "from sys import stdin, stdout\nfrom itertools import accumulate\nsmn = [1]\nfor i in range(32):\n\tsmn += [(smn[-1] + 1) * 2 - 1]\na = []\nfor v in smn:\n\ta += [v * (v + 1) // 2]\na = list(accumulate(a))\nfor _ in range(int(stdin.readline())):\n\tn = int(stdin.readline())\n\tans = 0\n\tfor v in a:\n\t\tif v > n:\n\t\t\tbreak\n\t\tans += 1\n\tprint(ans)\n", "lst = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 2305843008139952128]\nt = int(input())\nfor i in range(t):\n\ttar = int(input())\n\ts = 0\n\tfor j in range(len(lst)):\n\t\ts += lst[j]\n\t\tif s > tar:\n\t\t\tprint(j)\n\t\t\tbreak\n", "import sys\nfrom math import sqrt, gcd, ceil, log, floor\nfrom bisect import bisect, bisect_left\nfrom collections import defaultdict, Counter, deque\nfrom heapq import heapify, heappush, heappop\ninput = sys.stdin.readline\nread = lambda : list(map(int, input().strip().split()))\nMOD = 998244353\n\ndef main():\n\tans = ''\n\tarr = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576]\n\tfor i in range(1, 30):\n\t\tarr[i] += arr[i - 1]\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\tind = bisect(arr, n)\n\t\tif ind < 30 and arr[ind] == n:\n\t\t\tind -= 1\n\t\tans += str(ind)\n\t\tans += '\\n'\n\tprint(ans)\nmain()\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ttotal_count = 0\n\ttotal = 0\n\t_pow = 1\n\twhile total < n:\n\t\tstairs = 2 ** _pow - 1\n\t\ttotal += stairs * (stairs + 1) // 2\n\t\ttotal_count += 1\n\t\t_pow += 1\n\tif total > n:\n\t\ttotal_count -= 1\n\tprint(total_count)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\t(prod, cnt, val) = (1, 0, 2)\n\twhile prod <= n:\n\t\tn -= prod\n\t\tcnt += 1\n\t\tprod = 2 * prod + val * val\n\t\tval *= 2\n\tprint(cnt)\n", "from collections import defaultdict as dd\nfrom sys import stdin, stdout\nfrom bisect import bisect_left\nfrom math import log, sqrt\na = [0] * 50\nfor i in range(1, 50):\n\ta[i] = a[i - 1] * 2 + 4 ** (i - 1)\na.pop(0)\nfor t in range(int(stdin.readline().strip())):\n\tn = int(stdin.readline().strip())\n\ts = 0\n\tc = 0\n\tfor i in a:\n\t\ts += i\n\t\tif s <= n:\n\t\t\tc += 1\n\tprint(c)\n", "for t in range(int(input())):\n\tn = int(input())\n\tstart_power = 1\n\tcount = 0\n\twhile n > 0:\n\t\tsize = 2 ** start_power - 1\n\t\tno_stairs = int(size * (size + 1) / 2)\n\t\tn -= no_stairs\n\t\tcount += 1\n\t\tstart_power += 1\n\tif n < 0:\n\t\tcount -= 1\n\tprint(count)\n", "ty = [1]\np = 2\nwhile True:\n\tp = p * 2\n\tty.append(p - 1)\n\tif p > 10 ** 18:\n\t\tbreak\nt = int(input())\nfor j in range(0, t):\n\tx = int(input())\n\ts = 0\n\tc = 0\n\tfor o in ty:\n\t\ts = s + o * (o + 1) // 2\n\t\tif s <= x:\n\t\t\tc = c + 1\n\t\telse:\n\t\t\tbreak\n\tprint(c)\n", "d = int(input())\nfor i in range(d):\n\ta = int(input())\n\tb = 1\n\tc = 0\n\twhile a >= b * (b + 1) // 2:\n\t\ta -= b * (b + 1) // 2\n\t\tc += 1\n\t\tb = 2 * b + 1\n\tprint(c)\n", "from math import *\n\ndef _in():\n\treturn [int(x) for x in input().split(' ')]\narr = [1]\nwhile arr[-1] <= 10 ** 18:\n\tarr.append(arr[-1] * 2 + 1)\ntt = int(input())\nfor _ in range(tt):\n\tn = int(input())\n\t(i, curr) = (0, 0)\n\twhile curr <= n:\n\t\tcurr = curr + arr[i] * (arr[i] + 1) // 2\n\t\ti = i + 1\n\tprint(i - 1)\n", "import math\narr = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 2305843008139952128, 9223372034707292160, 36893488143124135936, 147573952581086478336, 590295810341525782528, 2361183241400462868480, 9444732965670570950656, 37778931862819722756096, 151115727451553768931328, 604462909806764831539200, 2417851639228158837784576, 9671406556914834374393856, 38685626227663735544086528, 154742504910663738269368320, 618970019642672545263517696, 2475880078570725365426159616, 9903520314282971830448816128, 39614081257132028059283619840, 158456325028528393712111190016, 633825300114114137798398181376, 2535301200456457677093499568128, 10141204801825832960173811957760, 40564819207303336344294875201536, 162259276829213354384378755547136, 649037107316853435551913531670528, 2596148429267413778236451145646080, 10384593717069655185003398620512256, 41538374868278620884128782557904896, 166153499473114483824745506383331328, 664613997892457935875442777836748800, 2658455991569831744654692615953842176, 10633823966279326980924613473029062656, 42535295865117307928310139910543638528, 170141183460469231722463931679029329920, 680564733841876926908302470789826871296, 2722258935367507707670103371306726588416, 10889035741470030830754200461521744560128, 43556142965880123323164375798676654653440, 174224571863520493292952651099885971439616, 696898287454081973172400900209902591410176, 2787593149816327892690784192460327776944128, 11150372599265311570765497953082745930383360, 44601490397061246283066714178813853366747136, 178405961588244985132276301448221152757415936, 713623846352979940529124095258816089610518528, 2854495385411919762116534159967127315603783680, 11417981541647679048466212197732235176738553856, 45671926166590716193864999906656392535601053696, 182687704666362864775460301858080473799697891328, 730750818665451459101841811895231702513378918400, 2923003274661805836407368456506746424682690379776, 11692013098647223345629476243878624927989110931456, 46768052394588893382517909811217778170473142550528, 187072209578355573530071648916277669598925967851520, 748288838313422294120286615007923792229770666704896, 2993155353253689176481146498717321396587216257417216, 11972621413014756705924586072240538041685132210864128, 47890485652059026823698344443704657077413063205847040, 191561942608236107294793378084303638130997321548169216, 766247770432944429179173512956184572166679423642238976, 3064991081731777716716694053062678327952097969468080128, 12259964326927110866866776214726593390379152427670568960, 49039857307708443467467104863858133718658130810278772736, 196159429230833773869868419465336055188915565440308084736, 784637716923335095479473677881151261384228346159618326528, 3138550867693340381917894711564219126794045553435245281280, 12554203470773361527671578846336104669690446551334525075456, 50216813883093446110686315385502875003790314880525188202496, 200867255532373784442745261542328412665218316872474928611328, 803469022129495137770981046169947475960987382190648066048000]\nfor _ in range(int(input())):\n\tx = int(input())\n\tam = 0\n\tfor i in range(100):\n\t\tif x < arr[i]:\n\t\t\tbreak\n\t\tx -= arr[i]\n\t\tam += 1\n\tprint(am)\n", "for _ in range(int(input())):\n\tresult = 0\n\tcells = 0\n\tx = int(input())\n\tfor i in range(1, x + 1):\n\t\tstair = 2 ** i - 1\n\t\tcells += int(stair * (stair + 1) / 2)\n\t\tif cells <= x:\n\t\t\tresult = i\n\t\telse:\n\t\t\tbreak\n\tprint(result)\n", "from __future__ import division, print_function\nfrom fractions import Fraction\nimport sys\nimport os\nfrom io import BytesIO, IOBase\nfrom itertools import *\nimport bisect\nfrom heapq import *\nfrom math import *\nfrom copy import *\nfrom collections import deque\nfrom collections import Counter as counter\nfrom itertools import combinations as comb\nfrom itertools import permutations as permutate\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nfrom bisect import bisect\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\nif sys.version_info[0] < 3:\n\t(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\nfrom types import GeneratorType\n\ndef iterative(f, stack=[]):\n\n\tdef wrapped_func(*args, **kwargs):\n\t\tif stack:\n\t\t\treturn f(*args, **kwargs)\n\t\tto = f(*args, **kwargs)\n\t\twhile True:\n\t\t\tif type(to) is GeneratorType:\n\t\t\t\tstack.append(to)\n\t\t\t\tto = next(to)\n\t\t\t\tcontinue\n\t\t\tstack.pop()\n\t\t\tif not stack:\n\t\t\t\tbreak\n\t\t\tto = stack[-1].send(to)\n\t\treturn to\n\treturn wrapped_func\nmod = 1000000007\n\ndef inp():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\n\ndef out(var):\n\tsys.stdout.write(str(var))\n\ndef lis():\n\treturn list(map(int, inp().split()))\n\ndef stringlis():\n\treturn list(map(str, inp().split()))\n\ndef sep():\n\treturn map(int, inp().split())\n\ndef strsep():\n\treturn map(str, inp().split())\n\ndef zerolist(n):\n\treturn [0] * n\n\ndef nextline():\n\tout('\\n')\n\ndef testcase(t):\n\tfor pp in range(t):\n\t\tsolve(pp)\n\ndef printlist(a):\n\tfor p in range(0, len(a)):\n\t\tout(str(a[p]) + ' ')\n\ndef google(p):\n\tprint('Case #' + str(p), end=': ')\n\ndef lcm(a, b):\n\treturn a * b // gcd(a, b)\n\ndef power(x, y, p):\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef ncr(n, r):\n\treturn factorial(n) // (factorial(r) * factorial(max(n - r, 1)))\n\ndef isPrime(n):\n\tif n <= 1:\n\t\treturn False\n\tif n <= 3:\n\t\treturn True\n\tif n % 2 == 0 or n % 3 == 0:\n\t\treturn False\n\ti = 5\n\twhile i * i <= n:\n\t\tif n % i == 0 or n % (i + 2) == 0:\n\t\t\treturn False\n\t\ti = i + 6\n\treturn True\n\ndef solve(case):\n\tn = int(inp())\n\tcurr = 3\n\tsum = 1\n\tcnt = 1\n\twhile sum + curr * (curr + 1) // 2 <= n:\n\t\tcnt += 1\n\t\tsum += curr * (curr + 1) // 2\n\t\tcurr = 2 * curr + 1\n\tprint(cnt)\ntestcase(int(inp()))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = 0\n\twhile n > 0:\n\t\ta += 1\n\t\tn = n - (4 ** a - 2 ** a) // 2\n\tprint(a - (n < 0) * 1)\n", "t = int(input())\n\ndef solve():\n\tx = int(input())\n\tcur = 1\n\tres = 0\n\twhile (cur + 1) // 2 * cur <= x:\n\t\tx -= (cur + 1) // 2 * cur\n\t\tcur = cur + cur + 1\n\t\tres += 1\n\treturn res\nfor _ in range(t):\n\tprint(solve())\n", "for _ in range(int(input())):\n\tx = int(input())\n\ti = 0\n\ta = 0\n\tn = 0\n\twhile x >= 0:\n\t\tn += 2 ** i\n\t\ta = (1 + n) // 2 * n\n\t\tx -= a\n\t\ti += 1\n\tprint(i - 1)\n", "t = int(input())\nfor i in range(t):\n\tx = int(input())\n\tnum = 0\n\ttotal = 0\n\tans = 0\n\twhile True:\n\t\tt_total = num * 2 + (2 ** ans) ** 2\n\t\tif total + t_total > x:\n\t\t\tprint(ans)\n\t\t\tbreak\n\t\telse:\n\t\t\tnum = t_total\n\t\t\ttotal += t_total\n\t\t\tans += 1\n", "import sys\nfrom functools import lru_cache\n\n@lru_cache(maxsize=None)\ndef s(n):\n\tif n == 0:\n\t\treturn 0\n\treturn a(n) + s(n - 1)\n\n@lru_cache(maxsize=None)\ndef a(n):\n\treturn 2 ** (n - 1) * (2 ** n - 1)\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\ttoto = next((i for i in range(1, 100000) if s(i) > x))\n\tprint(toto - 1)\n", "l = []\ni = 1\nwhile i < 10 ** 18 + 5:\n\tl.append(i * (i + 1) // 2)\n\ti = i * 2 + 1\nt = int(input())\nfor you in range(t):\n\tn = int(input())\n\tcount = 0\n\tsum = 0\n\tfor i in range(len(l)):\n\t\tsum += l[i]\n\t\tif sum > n:\n\t\t\tbreak\n\tprint(i)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tval = 0\n\tcnt = 0\n\tptr = 1\n\twhile x >= 0:\n\t\tval = ptr * (ptr + 1) // 2\n\t\tx -= val\n\t\tptr = ptr * 2 + 1\n\t\tcnt += 1\n\tprint(cnt - 1)\n", "def one_to_n(n):\n\tresult = 0\n\tfor i in range(1, n + 1):\n\t\tresult += i\n\treturn result\nfor _ in range(int(input())):\n\tn = int(input())\n\tanswer = 1\n\tn -= 1\n\ttemp = 1\n\tindex = 2\n\twhile True:\n\t\ttemp = temp * 2 + int(pow(index, 2))\n\t\tif n >= temp:\n\t\t\tn -= temp\n\t\t\tanswer += 1\n\t\t\tindex *= 2\n\t\telse:\n\t\t\tbreak\n\tprint(answer)\n", "for o in range(int(input())):\n\tn = int(input())\n\ti = 0\n\tp = 0\n\tc = -1\n\twhile n > 0:\n\t\tp = 2 * p + 2 ** i * 2 ** i\n\t\ti = i + 1\n\t\tn = n - p\n\t\tc = c + 1\n\tif n == 0:\n\t\tc = c + 1\n\tprint(c)\n", "arr = []\nfor i in range(1, 32):\n\tarr.append(2 ** i - 1)\ntemp = []\nfor i in arr:\n\ttemp.append(i * (i + 1) // 2)\nres = [temp[0]]\nfor i in range(1, len(temp)):\n\tres.append(res[-1] + temp[i])\nfor _ in range(int(input())):\n\tn = int(input())\n\tif n <= 6:\n\t\tprint(1)\n\telif 7 <= n <= 34:\n\t\tprint(2)\n\telif 35 <= n <= 154:\n\t\tprint(3)\n\telse:\n\t\tfor i in range(len(res)):\n\t\t\tif n < res[i]:\n\t\t\t\tprint(i)\n\t\t\t\tbreak\n", "for query in range(int(input())):\n\tm = int(input())\n\tcount = 1\n\ttotal = 0\n\twhile m >= count * (count + 1) // 2:\n\t\tm -= count * (count + 1) // 2\n\t\tcount = count * 2 + 1\n\t\ttotal += 1\n\tprint(total)\n", "ht = [1]\nnCells = [1]\nwhile nCells[-1] < 10 ** 18:\n\tht.append(2 * ht[-1] + 1)\n\tnCells.append(nCells[-1] * 2 + (ht[-2] + 1) ** 2)\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\ti = 0\n\twhile x >= 0:\n\t\tx -= nCells[i]\n\t\ti += 1\n\t\tans += 1\n\tans -= 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tx = 0\n\tp = 0\n\tc = 0\n\twhile n > 0:\n\t\tx = 2 * x + 2 ** p\n\t\tn -= x\n\t\tp += 2\n\t\tc += 1\n\tif n < 0:\n\t\tc -= 1\n\tprint(c)\n", "arr = [1]\npo = 4\nwhile arr[-1] < 10 ** 18:\n\tk = po - 1\n\tarr.append(k * (k + 1) // 2)\n\tpo = po * 2\npre_sum = [0]\nfor i in range(len(arr)):\n\tpre_sum.append(arr[i] + pre_sum[-1])\nimport bisect\nfor _ in range(int(input())):\n\tn = int(input())\n\tprint(bisect.bisect(pre_sum, n) - 1)\n", "t = input()\nfor i in range(int(t)):\n\tx = input()\n\tans = 1\n\tmax = 1\n\twhile max <= int(x):\n\t\tans += 1\n\t\tmax = max + 2 ** (2 * ans - 1) - 2 ** (ans - 1)\n\tans -= 1\n\tprint(f'{ans}')\n", "for _ in range(int(input())):\n\tx = int(input())\n\tif x == 1:\n\t\tprint(1)\n\t\tcontinue\n\ta = s = n = 1\n\twhile s <= x:\n\t\ta += pow(2, n)\n\t\ts += a * (a + 1) // 2\n\t\tn += 1\n\tprint(n - 1)\n", "import bisect\nimport collections\nimport copy\nimport functools\nimport heapq\nimport itertools\nimport math\nimport random\nimport re\nimport sys\nimport time\nimport string\nfrom typing import List\nsys.setrecursionlimit(99999)\n\ndef solve():\n\tn = int(input())\n\t(t, ans) = (2, 0)\n\twhile t * (t - 1) // 2 <= n:\n\t\tn -= t * (t - 1) // 2\n\t\tans += 1\n\t\tt <<= 1\n\treturn ans\nt = int(input())\nfor _ in range(t):\n\tprint(solve())\n", "t = int(input())\nniceNumbers = [1, 6]\nprev = 6\npowr = 4\nwhile True:\n\tnewNum = 2 * prev + powr * powr\n\tpowr *= 2\n\tniceNumbers.append(newNum)\n\tprev = newNum\n\tif newNum > int(1e+18):\n\t\tbreak\nfor _ in range(t):\n\tn = int(input())\n\tcnt = 0\n\tused = 0\n\tfor i in range(len(niceNumbers)):\n\t\tif used + niceNumbers[i] <= n:\n\t\t\tcnt += 1\n\t\t\tused += niceNumbers[i]\n\t\telse:\n\t\t\tbreak\n\tprint(cnt)\n", "from math import log2\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tfor k in range(2 + int(log2(n)), -1, -1):\n\t\tif 2 * ((4 ** k - 1) // 3) - (2 ** k - 1) <= n:\n\t\t\tprint(k)\n\t\t\tbreak\n", "for _ in range(int(input())):\n\tx = int(input())\n\ttmp = 1\n\tcells = 1\n\ti = 1\n\twhile cells <= x:\n\t\ttmp += 2 ** i\n\t\tcells += tmp * (tmp + 1) // 2\n\t\ti += 1\n\tprint(i - 1)\n", "from sys import stdin, stdout\nfrom collections import deque\nimport bisect\nfrom heapq import heapify, heappop, heappush\nR = lambda : stdin.readline().strip()\nRL = lambda f=None: list(map(f, R().split(' '))) if f else list(R().split(' '))\noutput = lambda x: stdout.write(str(x) + '\\n')\noutput_list = lambda x: output(' '.join(map(str, x)))\nT = int(R())\nfor _ in range(T):\n\tx = int(input())\n\tans = 1\n\tdp = [1]\n\tx -= 1\n\twhile x > 0:\n\t\tdp.append(1 + 2 * dp[-1])\n\t\tx -= dp[-1] * (dp[-1] + 1) // 2\n\t\tif x >= 0:\n\t\t\tans += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = 0\n\tfor i in range(1, n + 2):\n\t\tx = 2 ** i\n\t\ta += 2 ** (i - 1) * (2 ** i - 1)\n\t\tif a > n:\n\t\t\tprint(i - 1)\n\t\t\tbreak\n", "for _ in range(int(input())):\n\tn = int(input())\n\tcount = 0\n\ti = 1\n\tstair = 1\n\twhile n >= stair * i:\n\t\tn = n - i * stair\n\t\tcount += 1\n\t\ti = i * 2\n\t\tstair += i\n\tprint(count)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nimport math\n\ndef main():\n\tpass\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef binary(n):\n\treturn bin(n).replace('0b', '')\n\ndef decimal(s):\n\treturn int(s, 2)\n\ndef pow2(n):\n\tp = 0\n\twhile n > 1:\n\t\tn //= 2\n\t\tp += 1\n\treturn p\n\ndef primeFactors(n):\n\tl = []\n\twhile n % 2 == 0:\n\t\tl.append(2)\n\t\tn = n / 2\n\tfor i in range(3, int(math.sqrt(n)) + 1, 2):\n\t\twhile n % i == 0:\n\t\t\tl.append(i)\n\t\t\tn = n / i\n\tif n > 2:\n\t\tl.append(int(n))\n\treturn l\n\ndef isPrime(n):\n\tif n == 1:\n\t\treturn False\n\telse:\n\t\troot = int(n ** 0.5)\n\t\troot += 1\n\t\tfor i in range(2, root):\n\t\t\tif n % i == 0:\n\t\t\t\treturn False\n\t\treturn True\n\ndef maxPrimeFactors(n):\n\tmaxPrime = -1\n\twhile n % 2 == 0:\n\t\tmaxPrime = 2\n\t\tn >>= 1\n\tfor i in range(3, int(math.sqrt(n)) + 1, 2):\n\t\twhile n % i == 0:\n\t\t\tmaxPrime = i\n\t\t\tn = n / i\n\tif n > 2:\n\t\tmaxPrime = n\n\treturn int(maxPrime)\nl = []\nfor i in range(1, 33):\n\tn = 2 ** i\n\tn -= 1\n\tl.append(n * (n + 1) // 2)\nfor xyz in range(0, int(input())):\n\tn = int(input())\n\ts = 0\n\ti = 0\n\ta = 0\n\twhile s + l[i] <= n:\n\t\ts += l[i]\n\t\ta += 1\n\t\ti += 1\n\tprint(a)\n", "t = int(input())\n\ndef f(n):\n\ts = 3\n\tcnt = 1\n\tal = 1\n\twhile cnt + s * (s + 1) // 2 <= n:\n\t\tcnt += s * (s + 1) // 2\n\t\ts *= 2\n\t\ts += 1\n\t\tal += 1\n\treturn al\nfor _ in range(t):\n\tprint(f(int(input())))\n", "T = int(input())\nfor _ in range(T):\n\tN = int(input())\n\tans = 0\n\ti = 1\n\twhile 1:\n\t\ta = i * (i + 1) // 2\n\t\tif N - a < 0:\n\t\t\tbreak\n\t\tN -= a\n\t\tans += 1\n\t\ti = (i + 1) * 2 - 1\n\tprint(ans)\n", "def numCells(height):\n\treturn height * (height + 1) // 2\n\ndef countStair(x):\n\tp = 0\n\tnumStair = 0\n\theight = 2\n\twhile p <= x:\n\t\tp += numCells(height - 1)\n\t\theight *= 2\n\t\tnumStair += 1\n\treturn numStair - 1\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tprint(countStair(x))\n", "def recursive(n):\n\tx1 = 1\n\tx2 = 1\n\tx3 = 1\n\tx4 = 1\n\twhile x3 <= n:\n\t\tx2 = x2 * 2 + 1\n\t\tx1 = x2 * (x2 + 1) // 2\n\t\tx3 = x3 + x1\n\t\tx4 = x4 + 1\n\tx4 = x4 - 1\n\treturn x4\na = int(input())\nfor i in range(a):\n\tb = int(input())\n\tprint(recursive(b))\n", "t = int(input())\na = [0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827, 3074457343470774955, 12297829378178067115, 49191317521302203051, 196765270102388681387]\nfor w in range(t):\n\tx = int(input())\n\tpr = False\n\tfor i in range(len(a)):\n\t\tif x < a[i]:\n\t\t\tprint(i - 1)\n\t\t\tpr = True\n\t\t\tbreak\n", "import sys\nimport math\n\ndef fn(n):\n\tk = 1\n\tsum = 1\n\tcount = 0\n\twhile sum <= n:\n\t\tcount = count + 1\n\t\tk = k + 1\n\t\tsum = sum + (2 ** k - 1) * 2 ** (k - 1)\n\treturn count\ninput = sys.stdin.read()\ndata = list(map(int, input.split()))\nt = data[0]\nfor i in range(t):\n\tn = data[i + 1]\n\tprint(fn(n))\n", "def testcase():\n\tdata = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 2305843008139952128]\n\tn = int(input())\n\tsum = data[0]\n\tfor i in range(1, len(data)):\n\t\tif sum + data[i] > n:\n\t\t\tprint(i)\n\t\t\tbreak\n\t\tsum += data[i]\n\treturn\nt = int(input())\nfor _ in range(t):\n\ttestcase()\n", "A = [1]\ns = 1\nfor i in range(32):\n\ts *= 4\n\tA.append(A[-1] * 2 + s)\nS = [0] * 33\nfor i in range(32):\n\tS[i + 1] = S[i] + A[i]\nT = int(input())\nfor _ in range(T):\n\tN = int(input())\n\tfor i in range(33):\n\t\tif S[i] > N:\n\t\t\tprint(i - 1)\n\t\t\tbreak\n", "n = int(input())\nfor i in range(n):\n\tnum = int(input())\n\toutput = 0\n\tsize = 1\n\ttoAdd = 1\n\twhile size <= num:\n\t\toutput += 1\n\t\tnum -= size\n\t\ttoAdd *= 2\n\t\tsize *= 4\n\t\tsize += toAdd\n\tprint(output)\n", "import sys\ninput = sys.stdin.buffer.readline\nT = int(input())\nfor testcase in range(T):\n\tx = int(input())\n\tcnt = 0\n\tp = 1\n\twhile x >= 0:\n\t\tx -= p * (p + 1) // 2\n\t\tif x >= 0:\n\t\t\tcnt += 1\n\t\tp = p * 2 + 1\n\tprint(cnt)\n", "for s in [*open(0)][1:]:\n\tx = int(s)\n\ti = -1\n\twhile x >= 0:\n\t\ti += 1\n\t\tk = 2 ** i\n\t\tx -= 2 * k * k - k\n\tprint(i)\n", "import sys, math\ntry:\n\t(sys.stdin, sys.stdout) = (open('input.txt', 'r'), open('out.txt', 'w'))\nexcept:\n\tpass\nfrom sys import stdin, stdout\nmod = int(1000000000.0 + 7)\nfrom statistics import mode\nfrom collections import *\nfrom math import ceil, floor, inf, factorial, gcd, log2, sqrt, log\nii1 = lambda : int(stdin.readline().strip())\nis1 = lambda : stdin.readline().strip()\niia = lambda : list(map(int, stdin.readline().strip().split()))\nisa = lambda : stdin.readline().strip().split()\n\ndef lcm(a, b):\n\treturn a * b // gcd(a, b)\n\ndef setbits(n):\n\treturn bin(n).count('1')\n\ndef resetbits(n):\n\treturn bin(n).count('0')\n\ndef modinv(n, p):\n\treturn pow(n, p - 2, p)\n\ndef ncr(n, r):\n\t(num, den) = (1, 1)\n\tr = min(n, n - r)\n\tfor i in range(r):\n\t\tnum *= n - i\n\t\tden *= i + 1\n\treturn num // den\n\ndef ncr_p(n, r, p):\n\t(num, den) = (1, 1)\n\tr = min(r, n - r)\n\tfor i in range(r):\n\t\tnum = num * (n - i) % p\n\t\tden = den * (i + 1) % p\n\treturn num * modinv(den, p) % p\n\ndef isPrime(num):\n\tif num <= 1:\n\t\treturn False\n\tif num == 2 or n == 3:\n\t\treturn True\n\tif num % 2 == 0 or num % 3 == 0:\n\t\treturn False\n\tm = int(num ** 0.5) + 1\n\tfor i in range(5, m, 6):\n\t\tif num % i == 0 or num % (i + 2) == 0:\n\t\t\treturn False\n\treturn True\n\ndef bin_search(s, low, high, val):\n\twhile low <= high:\n\t\tmid = low + (high - low) // 2\n\t\tif s[mid] == val:\n\t\t\treturn mid\n\t\telif s[mid] < val:\n\t\t\tlow = mid + 1\n\t\telse:\n\t\t\thigh = mid - 1\n\treturn -1\n\ndef sumofdigit(num):\n\tcount = 0\n\twhile num:\n\t\tcount += num % 10\n\t\tnum //= 10\n\treturn count\n\ndef inputmatrix():\n\t(r, c) = iia()\n\tmat = [0] * r\n\tfor i in range(r):\n\t\tmat[i] = iia()\n\treturn (r, c, mat)\n\ndef prefix_sum(n, s):\n\tfor i in range(1, n):\n\t\ts[i] += s[i - 1]\n\treturn s\n\ndef binomial(n, k):\n\tif 0 <= k <= n:\n\t\tntok = 1\n\t\tktok = 1\n\t\tfor t in range(1, min(k, n - k) + 1):\n\t\t\tntok *= n\n\t\t\tktok *= t\n\t\t\tn -= 1\n\t\treturn ntok // ktok\n\telse:\n\t\treturn 0\n\ndef divisors(n):\n\tres = []\n\tfor i in range(1, ceil(sqrt(n)) + 1):\n\t\tif n % i == 0:\n\t\t\tif i == n // i:\n\t\t\t\tres.append(i)\n\t\t\telse:\n\t\t\t\tres.append(i)\n\t\t\t\tres.append(n // i)\n\treturn res\n\ndef fun(n):\n\tval = 1\n\tans = []\n\twhile val < n:\n\t\tval <<= 1\n\t\ta = val - 1\n\t\tans.append(a * (a + 1) // 2)\n\tval <<= 1\n\ta = val - 1\n\tans.append(a * (a - 1) // 2)\n\treturn ans\nfor _ in range(ii1()):\n\tn = ii1()\n\tarr = fun(n)\n\tans = 0\n\tfor i in arr:\n\t\tif n >= i:\n\t\t\tans += 1\n\t\t\tn -= i\n\tprint(ans)\n", "from math import sqrt\n\ndef solve(n):\n\treturn int((sqrt(1 + 8 * n) - 1) // 2)\nfor _ in range(int(input())):\n\tp = int(input())\n\tans = 0\n\tc = 1\n\twhile True:\n\t\tif p >= c * (c + 1) // 2:\n\t\t\tans += 1\n\t\t\tp -= c * (c + 1) // 2\n\t\t\tc = 2 * c + 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "from sys import stdin\n\ndef get_int():\n\treturn int(stdin.readline())\n\ndef get_str():\n\treturn stdin.readline().strip()\n\ndef get_ints():\n\treturn map(int, stdin.readline().strip().split())\n\ndef get_array():\n\treturn list(map(int, stdin.readline().strip().split()))\n\ndef get_array2d(row):\n\treturn [list(map(int, stdin.readline().strip().split())) for _ in range(row)]\nT = get_int()\nfor _ in range(T):\n\tX = get_int()\n\t(noOfCell, d, ans) = (8, 2, 1)\n\tcount = noOfCell - d + 1\n\twhile count <= X:\n\t\tnoOfCell <<= 2\n\t\td <<= 1\n\t\tcount += noOfCell - d\n\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nx = []\nfor i in range(t):\n\tx.append(int(input()))\nfor i in x:\n\ttemp = i\n\tacum = 0\n\taltura = 0\n\tcount = 0\n\ttermine = True\n\twhile termine:\n\t\tacum = 2 * acum + (altura + 1) ** 2\n\t\taltura += altura + 1\n\t\ttemp = temp - acum\n\t\tif temp >= 0:\n\t\t\tcount += 1\n\t\telse:\n\t\t\ttermine = False\n\tprint(count)\n", "import math\nimport random\nimport heapq, bisect\nimport sys\nfrom collections import deque, defaultdict\nfrom fractions import Fraction\nimport sys\nimport threading\nfrom collections import defaultdict\nmod = 10 ** 9 + 7\nmod1 = 998244353\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\nclass TreeNode:\n\n\tdef __init__(self, k, v):\n\t\tself.key = k\n\t\tself.value = v\n\t\tself.left = None\n\t\tself.right = None\n\t\tself.parent = None\n\t\tself.height = 1\n\t\tself.num_left = 1\n\t\tself.num_total = 1\n\nclass AvlTree:\n\n\tdef __init__(self):\n\t\tself._tree = None\n\n\tdef add(self, k, v):\n\t\tif not self._tree:\n\t\t\tself._tree = TreeNode(k, v)\n\t\t\treturn\n\t\tnode = self._add(k, v)\n\t\tif node:\n\t\t\tself._rebalance(node)\n\n\tdef _add(self, k, v):\n\t\tnode = self._tree\n\t\twhile node:\n\t\t\tif k < node.key:\n\t\t\t\tif node.left:\n\t\t\t\t\tnode = node.left\n\t\t\t\telse:\n\t\t\t\t\tnode.left = TreeNode(k, v)\n\t\t\t\t\tnode.left.parent = node\n\t\t\t\t\treturn node.left\n\t\t\telif node.key < k:\n\t\t\t\tif node.right:\n\t\t\t\t\tnode = node.right\n\t\t\t\telse:\n\t\t\t\t\tnode.right = TreeNode(k, v)\n\t\t\t\t\tnode.right.parent = node\n\t\t\t\t\treturn node.right\n\t\t\telse:\n\t\t\t\tnode.value = v\n\t\t\t\treturn\n\n\t@staticmethod\n\tdef get_height(x):\n\t\treturn x.height if x else 0\n\n\t@staticmethod\n\tdef get_num_total(x):\n\t\treturn x.num_total if x else 0\n\n\tdef _rebalance(self, node):\n\t\tn = node\n\t\twhile n:\n\t\t\tlh = self.get_height(n.left)\n\t\t\trh = self.get_height(n.right)\n\t\t\tn.height = max(lh, rh) + 1\n\t\t\tbalance_factor = lh - rh\n\t\t\tn.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)\n\t\t\tn.num_left = 1 + self.get_num_total(n.left)\n\t\t\tif balance_factor > 1:\n\t\t\t\tif self.get_height(n.left.left) < self.get_height(n.left.right):\n\t\t\t\t\tself._rotate_left(n.left)\n\t\t\t\tself._rotate_right(n)\n\t\t\telif balance_factor < -1:\n\t\t\t\tif self.get_height(n.right.right) < self.get_height(n.right.left):\n\t\t\t\t\tself._rotate_right(n.right)\n\t\t\t\tself._rotate_left(n)\n\t\t\telse:\n\t\t\t\tn = n.parent\n\n\tdef _remove_one(self, node):\n\t\treplacement = node.left or node.right\n\t\tif node.parent:\n\t\t\tif AvlTree._is_left(node):\n\t\t\t\tnode.parent.left = replacement\n\t\t\telse:\n\t\t\t\tnode.parent.right = replacement\n\t\t\treplacement.parent = node.parent\n\t\t\tnode.parent = None\n\t\telse:\n\t\t\tself._tree = replacement\n\t\t\treplacement.parent = None\n\t\tnode.left = None\n\t\tnode.right = None\n\t\tnode.parent = None\n\t\tself._rebalance(replacement)\n\n\tdef _remove_leaf(self, node):\n\t\tif node.parent:\n\t\t\tif AvlTree._is_left(node):\n\t\t\t\tnode.parent.left = None\n\t\t\telse:\n\t\t\t\tnode.parent.right = None\n\t\t\tself._rebalance(node.parent)\n\t\telse:\n\t\t\tself._tree = None\n\t\tnode.parent = None\n\t\tnode.left = None\n\t\tnode.right = None\n\n\tdef remove(self, k):\n\t\tnode = self._get_node(k)\n\t\tif not node:\n\t\t\treturn\n\t\tif AvlTree._is_leaf(node):\n\t\t\tself._remove_leaf(node)\n\t\t\treturn\n\t\tif node.left and node.right:\n\t\t\tnxt = AvlTree._get_next(node)\n\t\t\tnode.key = nxt.key\n\t\t\tnode.value = nxt.value\n\t\t\tif self._is_leaf(nxt):\n\t\t\t\tself._remove_leaf(nxt)\n\t\t\telse:\n\t\t\t\tself._remove_one(nxt)\n\t\t\tself._rebalance(node)\n\t\telse:\n\t\t\tself._remove_one(node)\n\n\tdef get(self, k):\n\t\tnode = self._get_node(k)\n\t\treturn node.value if node else -1\n\n\tdef _get_node(self, k):\n\t\tif not self._tree:\n\t\t\treturn None\n\t\tnode = self._tree\n\t\twhile node:\n\t\t\tif k < node.key:\n\t\t\t\tnode = node.left\n\t\t\telif node.key < k:\n\t\t\t\tnode = node.right\n\t\t\telse:\n\t\t\t\treturn node\n\t\treturn None\n\n\tdef get_at(self, pos):\n\t\tx = pos + 1\n\t\tnode = self._tree\n\t\twhile node:\n\t\t\tif x < node.num_left:\n\t\t\t\tnode = node.left\n\t\t\telif node.num_left < x:\n\t\t\t\tx -= node.num_left\n\t\t\t\tnode = node.right\n\t\t\telse:\n\t\t\t\treturn (node.key, node.value)\n\t\traise IndexError('Out of ranges')\n\n\t@staticmethod\n\tdef _is_left(node):\n\t\treturn node.parent.left and node.parent.left == node\n\n\t@staticmethod\n\tdef _is_leaf(node):\n\t\treturn node.left is None and node.right is None\n\n\tdef _rotate_right(self, node):\n\t\tif not node.parent:\n\t\t\tself._tree = node.left\n\t\t\tnode.left.parent = None\n\t\telif AvlTree._is_left(node):\n\t\t\tnode.parent.left = node.left\n\t\t\tnode.left.parent = node.parent\n\t\telse:\n\t\t\tnode.parent.right = node.left\n\t\t\tnode.left.parent = node.parent\n\t\tbk = node.left.right\n\t\tnode.left.right = node\n\t\tnode.parent = node.left\n\t\tnode.left = bk\n\t\tif bk:\n\t\t\tbk.parent = node\n\t\tnode.height = max(self.get_height(node.left), self.get_height(node.right)) + 1\n\t\tnode.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)\n\t\tnode.num_left = 1 + self.get_num_total(node.left)\n\n\tdef _rotate_left(self, node):\n\t\tif not node.parent:\n\t\t\tself._tree = node.right\n\t\t\tnode.right.parent = None\n\t\telif AvlTree._is_left(node):\n\t\t\tnode.parent.left = node.right\n\t\t\tnode.right.parent = node.parent\n\t\telse:\n\t\t\tnode.parent.right = node.right\n\t\t\tnode.right.parent = node.parent\n\t\tbk = node.right.left\n\t\tnode.right.left = node\n\t\tnode.parent = node.right\n\t\tnode.right = bk\n\t\tif bk:\n\t\t\tbk.parent = node\n\t\tnode.height = max(self.get_height(node.left), self.get_height(node.right)) + 1\n\t\tnode.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)\n\t\tnode.num_left = 1 + self.get_num_total(node.left)\n\n\t@staticmethod\n\tdef _get_next(node):\n\t\tif not node.right:\n\t\t\treturn node.parent\n\t\tn = node.right\n\t\twhile n.left:\n\t\t\tn = n.left\n\t\treturn n\n\nclass SegmentTree1:\n\n\tdef __init__(self, data, default=2 ** 30, func=lambda a, b: min(a, b)):\n\t\tself._default = default\n\t\tself._func = func\n\t\tself._len = len(data)\n\t\tself._size = _size = 1 << (self._len - 1).bit_length()\n\t\tself.data = [default] * (2 * _size)\n\t\tself.data[_size:_size + self._len] = data\n\t\tfor i in reversed(range(_size)):\n\t\t\tself.data[i] = func(self.data[i + i], self.data[i + i + 1])\n\n\tdef __delitem__(self, idx):\n\t\tself[idx] = self._default\n\n\tdef __getitem__(self, idx):\n\t\treturn self.data[idx + self._size]\n\n\tdef __setitem__(self, idx, value):\n\t\tidx += self._size\n\t\tself.data[idx] = value\n\t\tidx >>= 1\n\t\twhile idx:\n\t\t\tself.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])\n\t\t\tidx >>= 1\n\n\tdef __len__(self):\n\t\treturn self._len\n\n\tdef query(self, start, stop):\n\t\tif start == stop:\n\t\t\treturn self.__getitem__(start)\n\t\tstop += 1\n\t\tstart += self._size\n\t\tstop += self._size\n\t\tres = self._default\n\t\twhile start < stop:\n\t\t\tif start & 1:\n\t\t\t\tres = self._func(res, self.data[start])\n\t\t\t\tstart += 1\n\t\t\tif stop & 1:\n\t\t\t\tstop -= 1\n\t\t\t\tres = self._func(res, self.data[stop])\n\t\t\tstart >>= 1\n\t\t\tstop >>= 1\n\t\treturn res\n\n\tdef __repr__(self):\n\t\treturn 'SegmentTree({0})'.format(self.data)\n\nclass SegmentTree:\n\n\tdef __init__(self, data, default=0, func=lambda a, b: a + b):\n\t\tself._default = default\n\t\tself._func = func\n\t\tself._len = len(data)\n\t\tself._size = _size = 1 << (self._len - 1).bit_length()\n\t\tself.data = [default] * (2 * _size)\n\t\tself.data[_size:_size + self._len] = data\n\t\tfor i in reversed(range(_size)):\n\t\t\tself.data[i] = func(self.data[i + i], self.data[i + i + 1])\n\n\tdef __delitem__(self, idx):\n\t\tself[idx] = self._default\n\n\tdef __getitem__(self, idx):\n\t\treturn self.data[idx + self._size]\n\n\tdef __setitem__(self, idx, value):\n\t\tidx += self._size\n\t\tself.data[idx] = value\n\t\tidx >>= 1\n\t\twhile idx:\n\t\t\tself.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])\n\t\t\tidx >>= 1\n\n\tdef __len__(self):\n\t\treturn self._len\n\n\tdef query(self, start, stop):\n\t\tif start == stop:\n\t\t\treturn self.__getitem__(start)\n\t\tstop += 1\n\t\tstart += self._size\n\t\tstop += self._size\n\t\tres = self._default\n\t\twhile start < stop:\n\t\t\tif start & 1:\n\t\t\t\tres = self._func(res, self.data[start])\n\t\t\t\tstart += 1\n\t\t\tif stop & 1:\n\t\t\t\tstop -= 1\n\t\t\t\tres = self._func(res, self.data[stop])\n\t\t\tstart >>= 1\n\t\t\tstop >>= 1\n\t\treturn res\n\n\tdef __repr__(self):\n\t\treturn 'SegmentTree({0})'.format(self.data)\n\nclass Factorial:\n\n\tdef __init__(self, MOD):\n\t\tself.MOD = MOD\n\t\tself.factorials = [1, 1]\n\t\tself.invModulos = [0, 1]\n\t\tself.invFactorial_ = [1, 1]\n\n\tdef calc(self, n):\n\t\tif n <= -1:\n\t\t\tprint('Invalid argument to calculate n!')\n\t\t\tprint('n must be non-negative value. But the argument was ' + str(n))\n\t\t\texit()\n\t\tif n < len(self.factorials):\n\t\t\treturn self.factorials[n]\n\t\tnextArr = [0] * (n + 1 - len(self.factorials))\n\t\tinitialI = len(self.factorials)\n\t\tprev = self.factorials[-1]\n\t\tm = self.MOD\n\t\tfor i in range(initialI, n + 1):\n\t\t\tprev = nextArr[i - initialI] = prev * i % m\n\t\tself.factorials += nextArr\n\t\treturn self.factorials[n]\n\n\tdef inv(self, n):\n\t\tif n <= -1:\n\t\t\tprint('Invalid argument to calculate n^(-1)')\n\t\t\tprint('n must be non-negative value. But the argument was ' + str(n))\n\t\t\texit()\n\t\tp = self.MOD\n\t\tpi = n % p\n\t\tif pi < len(self.invModulos):\n\t\t\treturn self.invModulos[pi]\n\t\tnextArr = [0] * (n + 1 - len(self.invModulos))\n\t\tinitialI = len(self.invModulos)\n\t\tfor i in range(initialI, min(p, n + 1)):\n\t\t\tnext = -self.invModulos[p % i] * (p // i) % p\n\t\t\tself.invModulos.append(next)\n\t\treturn self.invModulos[pi]\n\n\tdef invFactorial(self, n):\n\t\tif n <= -1:\n\t\t\tprint('Invalid argument to calculate (n^(-1))!')\n\t\t\tprint('n must be non-negative value. But the argument was ' + str(n))\n\t\t\texit()\n\t\tif n < len(self.invFactorial_):\n\t\t\treturn self.invFactorial_[n]\n\t\tself.inv(n)\n\t\tnextArr = [0] * (n + 1 - len(self.invFactorial_))\n\t\tinitialI = len(self.invFactorial_)\n\t\tprev = self.invFactorial_[-1]\n\t\tp = self.MOD\n\t\tfor i in range(initialI, n + 1):\n\t\t\tprev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p\n\t\tself.invFactorial_ += nextArr\n\t\treturn self.invFactorial_[n]\n\nclass Combination:\n\n\tdef __init__(self, MOD):\n\t\tself.MOD = MOD\n\t\tself.factorial = Factorial(MOD)\n\n\tdef ncr(self, n, k):\n\t\tif k < 0 or n < k:\n\t\t\treturn 0\n\t\tk = min(k, n - k)\n\t\tf = self.factorial\n\t\treturn f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD\n\ndef powm(a, n, m):\n\tif a == 1 or n == 0:\n\t\treturn 1\n\tif n % 2 == 0:\n\t\ts = powm(a, n // 2, m)\n\t\treturn s * s % m\n\telse:\n\t\treturn a * powm(a, n - 1, m) % m\n\ndef sort_list(list1, list2):\n\tzipped_pairs = zip(list2, list1)\n\tz = [x for (_, x) in sorted(zipped_pairs)]\n\treturn z\n\ndef product(l):\n\tpor = 1\n\tfor i in range(len(l)):\n\t\tpor *= l[i]\n\treturn por\n\ndef binarySearchCount(arr, n, key):\n\tleft = 0\n\tright = n - 1\n\tcount = 0\n\twhile left <= right:\n\t\tmid = int((right + left) / 2)\n\t\tif arr[mid] < key:\n\t\t\tcount = mid + 1\n\t\t\tleft = mid + 1\n\t\telse:\n\t\t\tright = mid - 1\n\treturn count\n\ndef countdig(n):\n\tc = 0\n\twhile n > 0:\n\t\tn //= 10\n\t\tc += 1\n\treturn c\n\ndef binary(x, length):\n\ty = bin(x)[2:]\n\treturn y if len(y) >= length else '0' * (length - len(y)) + y\n\ndef countGreater(arr, n, k):\n\tl = 0\n\tr = n - 1\n\tleftGreater = n\n\twhile l <= r:\n\t\tm = int(l + (r - l) / 2)\n\t\tif arr[m] > k:\n\t\t\tleftGreater = m\n\t\t\tr = m - 1\n\t\telse:\n\t\t\tl = m + 1\n\treturn n - leftGreater\n\nclass TrieNode:\n\n\tdef __init__(self):\n\t\tself.children = [None] * 26\n\t\tself.isEndOfWord = False\n\nclass Trie:\n\n\tdef __init__(self):\n\t\tself.root = self.getNode()\n\n\tdef getNode(self):\n\t\treturn TrieNode()\n\n\tdef _charToIndex(self, ch):\n\t\treturn ord(ch) - ord('a')\n\n\tdef insert(self, key):\n\t\tpCrawl = self.root\n\t\tlength = len(key)\n\t\tfor level in range(length):\n\t\t\tindex = self._charToIndex(key[level])\n\t\t\tif not pCrawl.children[index]:\n\t\t\t\tpCrawl.children[index] = self.getNode()\n\t\t\tpCrawl = pCrawl.children[index]\n\t\tpCrawl.isEndOfWord = True\n\n\tdef search(self, key):\n\t\tpCrawl = self.root\n\t\tlength = len(key)\n\t\tfor level in range(length):\n\t\t\tindex = self._charToIndex(key[level])\n\t\t\tif not pCrawl.children[index]:\n\t\t\t\treturn False\n\t\t\tpCrawl = pCrawl.children[index]\n\t\treturn pCrawl != None and pCrawl.isEndOfWord\n\nclass Node:\n\n\tdef __init__(self, data):\n\t\tself.data = data\n\t\tself.count = 0\n\t\tself.left = None\n\t\tself.right = None\n\nclass BinaryTrie:\n\n\tdef __init__(self):\n\t\tself.root = Node(0)\n\n\tdef insert(self, pre_xor):\n\t\tself.temp = self.root\n\t\tfor i in range(31, -1, -1):\n\t\t\tval = pre_xor & 1 << i\n\t\t\tif val:\n\t\t\t\tif not self.temp.right:\n\t\t\t\t\tself.temp.right = Node(0)\n\t\t\t\tself.temp = self.temp.right\n\t\t\t\tself.temp.count += 1\n\t\t\tif not val:\n\t\t\t\tif not self.temp.left:\n\t\t\t\t\tself.temp.left = Node(0)\n\t\t\t\tself.temp = self.temp.left\n\t\t\t\tself.temp.count += 1\n\t\tself.temp.data = pre_xor\n\n\tdef query(self, xor):\n\t\tself.temp = self.root\n\t\tfor i in range(31, -1, -1):\n\t\t\tval = xor & 1 << i\n\t\t\tif not val:\n\t\t\t\tif self.temp.left and self.temp.left.count > 0:\n\t\t\t\t\tself.temp = self.temp.left\n\t\t\t\telif self.temp.right:\n\t\t\t\t\tself.temp = self.temp.right\n\t\t\telif self.temp.right and self.temp.right.count > 0:\n\t\t\t\tself.temp = self.temp.right\n\t\t\telif self.temp.left:\n\t\t\t\tself.temp = self.temp.left\n\t\t\tself.temp.count -= 1\n\t\treturn xor ^ self.temp.data\nfor ik in range(int(input())):\n\tn = int(input())\n\tt = 2\n\tans = 0\n\twhile n >= 0:\n\t\tif n >= t * (t - 1) // 2:\n\t\t\tn -= t * (t - 1) // 2\n\t\t\tt *= 2\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import math\nimport os\nimport random\nimport re\nimport sys\nfor _ in range(int(input())):\n\tx = int(input())\n\tsum = 0\n\tcnt = 0\n\tfor i in range(1, 1000000000):\n\t\ti1 = pow(2, i - 1)\n\t\ti2 = pow(2, i) - 1\n\t\tsum += i1 * i2\n\t\tif sum > x:\n\t\t\tbreak\n\t\tcnt += 1\n\tprint(cnt)\n", "a = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576, 576460751766552576 * 2]\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\ti = 0\n\twhile x >= 0:\n\t\tif x >= a[i]:\n\t\t\tx -= a[i]\n\t\t\ti += 1\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import sys\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef iinput():\n\treturn int(input())\n\ndef rinput():\n\treturn map(int, sys.stdin.readline().strip().split())\n\ndef get_list():\n\treturn list(map(int, sys.stdin.readline().strip().split()))\nmod = int(1000000000.0) + 7\n\ndef sumOfAP(n):\n\tsum = n / 2 * (2 + (n - 1))\n\treturn int(sum)\nt = [sumOfAP(pow(2, i) - 1) for i in range(1, 61)]\nfor _ in range(iinput()):\n\tx = iinput()\n\tans = 0\n\tcnt = 0\n\twhile ans <= x:\n\t\tans += t[cnt]\n\t\tcnt += 1\n\tprint(cnt - 1)\n", "n = 0\ns = 0\nnumbers = [0] * 32\nwhile n < 31:\n\tn += 1\n\ts += (2 ** n - 1) * 2 ** (n - 1)\n\tnumbers[n] = s\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tleft = 0\n\tright = 31\n\twhile right - left > 1:\n\t\tmiddle = (left + right) // 2\n\t\tif x >= numbers[middle]:\n\t\t\tleft = middle\n\t\telse:\n\t\t\tright = middle\n\tprint(left)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tval = 1\n\tcount = 0\n\tnxt = 2\n\ts = 1\n\twhile s <= x:\n\t\tval = 2 * val + nxt * nxt\n\t\ts += val\n\t\tnxt *= 2\n\t\tcount += 1\n\tprint(count)\n", "import sys\nread = lambda : sys.stdin.readline().strip()\nreadi = lambda : map(int, read().split())\nfrom math import sqrt, log2\nfor _ in range(int(read())):\n\tx = int(read())\n\ti = 1\n\tans = 0\n\twhile True:\n\t\tx -= i * (i + 1) // 2\n\t\tif x < 0:\n\t\t\tbreak\n\t\tans += 1\n\t\ti = 2 * i + 1\n\tprint(ans)\n", "def modinv(n, p):\n\treturn pow(n, p - 2, p)\n\ndef main():\n\ty = 1\n\tseries = []\n\tk = 2\n\twhile y <= int(1e+18):\n\t\tseries.append(y)\n\t\ty = 2 * y + k ** 2\n\t\tk *= 2\n\tfor case in range(int(input())):\n\t\tc = 0\n\t\tx = int(input())\n\t\ts = 0\n\t\tfor i in range(len(series)):\n\t\t\ts += series[i]\n\t\t\tif s <= x:\n\t\t\t\tc += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tprint(c)\npy2 = round(0.5)\nif py2:\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\trange = xrange\nimport os, sys\nfrom io import IOBase, BytesIO\nBUFSIZE = 8192\n\nclass FastIO(BytesIO):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._file = file\n\t\tself._fd = file.fileno()\n\t\tself.writable = 'x' in file.mode or 'w' in file.mode\n\t\tself.write = super(FastIO, self).write if self.writable else None\n\n\tdef _fill(self):\n\t\ts = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\tself.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n\t\treturn s\n\n\tdef read(self):\n\t\twhile self._fill():\n\t\t\tpass\n\t\treturn super(FastIO, self).read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\ts = self._fill()\n\t\t\tself.newlines = s.count(b'\\n') + (not s)\n\t\tself.newlines -= 1\n\t\treturn super(FastIO, self).readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.getvalue())\n\t\t\t(self.truncate(0), self.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tif py2:\n\t\t\tself.write = self.buffer.write\n\t\t\tself.read = self.buffer.read\n\t\t\tself.readline = self.buffer.readline\n\t\telse:\n\t\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "for i in range(int(input())):\n\ta = int(input())\n\tb = 1\n\tc = 0\n\twhile a > 0:\n\t\ta -= (2 ** b - 1) * 2 ** (b - 1)\n\t\tb += 1\n\t\tif a == 0:\n\t\t\tc = b - 1\n\t\telif a < 0:\n\t\t\tc = b - 2\n\tprint(c)\n", "A = [1, 2, 4, 8]\nfor i in range(30):\n\tA += [A[-1] * 2]\nA = [i - 1 for i in A]\nB = [i * (i + 1) // 2 for i in A]\nfor i in range(1, len(B)):\n\tB[i] = B[i] + B[i - 1]\nfor _ in range(int(input())):\n\tX = int(input())\n\tprinted = False\n\tfor i in range(len(B)):\n\t\tif X == B[i]:\n\t\t\tprint(i)\n\t\t\tprinted = True\n\t\t\tbreak\n\t\telif X < B[i]:\n\t\t\tprint(i - 1)\n\t\t\tprinted = True\n\t\t\tbreak\n", "def nsum(n):\n\treturn n * (n + 1) // 2\nfor _ in range(int(input().strip())):\n\tx = int(input().strip())\n\ti = 1\n\tp = nsum(2 ** i - 1)\n\tans = 0\n\twhile p <= x:\n\t\tans += 1\n\t\tx -= p\n\t\ti += 1\n\t\tp = nsum(2 ** i - 1)\n\tprint(ans)\n", "import sys, math, heapq, copy\nfrom collections import defaultdict, deque\nfrom bisect import bisect_left, bisect_right\nfrom functools import cmp_to_key\nfrom itertools import permutations, combinations, combinations_with_replacement\nmod = 1000000007\n\ndef get_int():\n\treturn int(sys.stdin.readline().strip())\n\ndef get_str():\n\treturn sys.stdin.readline().strip()\n\ndef get_float():\n\treturn float(sys.stdin.readline().strip())\n\ndef get_ints():\n\treturn map(int, sys.stdin.readline().strip().split())\n\ndef get_strs():\n\treturn map(str, sys.stdin.readline().strip().split())\n\ndef get_floats():\n\treturn map(float, sys.stdin.readline().strip().split())\n\ndef list_ints():\n\treturn list(map(int, sys.stdin.readline().strip().split()))\n\ndef list_strs():\n\treturn list(map(str, sys.stdin.readline().strip().split()))\n\ndef list_floats():\n\treturn list(map(float, sys.stdin.readline().strip().split()))\nt = get_int()\nfor _ in range(t):\n\tn = get_int()\n\tans = 0\n\txpower = stairs = 0\n\twhile True:\n\t\tstairs += pow(2, xpower)\n\t\tcells = stairs * (stairs + 1) // 2\n\t\tif cells <= n:\n\t\t\tn -= cells\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\t\txpower += 1\n\tprint(ans)\n", "t = int(input())\nfor tc in range(t):\n\tx = int(input())\n\tcount = 0\n\twhile x >= 0:\n\t\tx -= 2 * (2 ** count) ** 2 - 2 ** count\n\t\tcount += 1\n\tprint(count - 1)\n", "import collections\n\ndef solution(n):\n\tc = 1\n\twhile True:\n\t\ts = 2 ** c - 1\n\t\tn -= s * (s + 1) // 2\n\t\tif n < 0:\n\t\t\tbreak\n\t\tc += 1\n\treturn c - 1\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tprint(solution(n))\n", "import os, io\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nfor _ in range(int(input())):\n\tx = int(input())\n\ttotal = 1\n\tcnt = 1\n\tsquare = 1\n\tnumber = 0\n\twhile x >= 0:\n\t\tif x >= cnt:\n\t\t\tx -= cnt\n\t\t\tnumber += 1\n\t\t\tsquare *= 4\n\t\t\tcnt = cnt * 2 + square\n\t\telse:\n\t\t\tbreak\n\tprint(number)\n", "b = []\nk = 2\nfor i in range(30):\n\tb.append((k - 1) * k // 2)\n\tk *= 2\nfor _ in range(int(input())):\n\tn = int(input())\n\tss = 0\n\tfor i in b:\n\t\tif n >= i:\n\t\t\tn -= i\n\t\t\tss += 1\n\tprint(ss)\n", "gans = []\nfor _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\tcur = 1\n\twhile n >= cur * (cur + 1) // 2:\n\t\tn -= cur * (cur + 1) // 2\n\t\tans += 1\n\t\tcur = cur * 2 + 1\n\tgans.append(ans)\nprint('\\n'.join(map(str, gans)))\n", "def inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\nt = inp()\nfor _ in range(t):\n\tx = inp()\n\tres = 0\n\tsize = 1\n\tstairs = 1\n\twhile x >= 0:\n\t\tx -= size\n\t\tres += 1\n\t\tstairs += stairs + 1\n\t\tsize = stairs * (stairs + 1) // 2\n\tprint(res - 1)\n", "def x():\n\tN = int(input())\n\tfor i in range(N):\n\t\tA = int(input())\n\t\tans = 1\n\t\tcount = 0\n\t\tB = 1\n\t\twhile A >= ans:\n\t\t\tA = A - ans\n\t\t\tans = ans * 2 + B * 2 * (B * 2)\n\t\t\tcount += 1\n\t\t\tB = B * 2\n\t\tprint(count)\nx()\n", "for _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\ts = 0\n\twhile s <= x:\n\t\tans += 1\n\t\ts += 2 ** (ans - 1) * (2 ** ans - 1)\n\tprint(ans - 1)\n", "dp = []\ndp.append((1, 1))\nfor i in range(1, 31):\n\tdp.append((2 * dp[i - 1][0] + 1, 2 * dp[i - 1][1] + (dp[i - 1][0] + 1) ** 2))\nt = int(input())\nfor i in range(t):\n\ttmp = 0\n\tx = int(input())\n\tind = 0\n\twhile ind < len(dp) and tmp < x:\n\t\ttmp += dp[ind][1]\n\t\tind += 1\n\tif tmp > x:\n\t\tind -= 1\n\tprint(ind)\n", "t = int(input())\nfor w in range(t):\n\tx = int(input())\n\ty = 0\n\tt = 0\n\ti = 1\n\tc = 1\n\twhile y + i * (i + 1) // 2 <= x:\n\t\ty += i * (i + 1) // 2\n\t\ti += 2 ** c\n\t\tc += 1\n\t\tt += 1\n\tprint(t)\n", "l = [1]\nj = 0\ni = 2\nwhile l[-1] <= 1e+18:\n\tl.append(l[j] * 2 + 2 ** i)\n\tj += 1\n\ti += 2\n\ndef solve(n):\n\tcnt = 0\n\tfor k in l:\n\t\tif k <= n:\n\t\t\tn -= k\n\t\t\tcnt += 1\n\treturn cnt\nfor _ in range(int(input())):\n\tn = int(input())\n\tprint(solve(n))\n", "(z, zz) = (input, lambda : list(map(int, z().split())))\nzzz = lambda : [int(i) for i in stdin.readline().split()]\n(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))\nfrom string import *\nfrom re import *\nfrom collections import *\nfrom queue import *\nfrom sys import *\nfrom collections import *\nfrom math import *\nfrom heapq import *\nfrom itertools import *\nfrom bisect import *\nfrom collections import Counter as cc\nfrom math import factorial as f\nfrom bisect import bisect as bs\nfrom bisect import bisect_left as bsl\nfrom itertools import accumulate as ac\nfrom itertools import permutations as permu\n\ndef lcd(xnum1, xnum2):\n\treturn xnum1 * xnum2 // gcd(xnum1, xnum2)\n\ndef prime(x):\n\tp = ceil(x ** 0.5) + 1\n\tfor i in range(2, p):\n\t\tif x % i == 0 and x != 2 or x == 0:\n\t\t\treturn 0\n\treturn 1\n\ndef dfs(u, visit, graph):\n\tvisit[u] = True\n\tfor i in graph[u]:\n\t\tif not visit[i]:\n\t\t\tdfs(i, visit, graph)\nnum = 1\nnum = int(z())\nfor _ in range(num):\n\tn = int(z())\n\ts = 0\n\ti = 2\n\tcnt = 0\n\twhile s <= n:\n\t\ts += (i - 1) * i // 2\n\t\ti *= 2\n\t\tcnt += 1\n\tprint(cnt - 1)\n", "import math\nd = []\nk = 1\nwhile k <= 2000000000.0:\n\td.append(k * (k + 1) // 2 + (d[-1] if len(d) > 0 else 0))\n\tk = 1 + 2 * k\nfor _ in range(int(input())):\n\tnum = int(input())\n\tans = 0\n\tfor i in d:\n\t\tif i <= num:\n\t\t\tans = i\n\tprint(d.index(ans) + 1)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tp = a = 0\n\tk = 1 << p\n\twhile a <= n:\n\t\ta += k * (2 * k - 1)\n\t\tk <<= 1\n\t\tp += 1\n\tprint(p - 1)\n", "import sys\n\ndef I():\n\treturn int(sys.stdin.readline().rstrip())\nt = I()\nA = [0] * 31\nfor i in range(1, 31):\n\tA[i] = 2 ** (i - 1) * (2 ** i - 1)\nfor i in range(1, 31):\n\tA[i] += A[i - 1]\nfor _ in range(t):\n\tx = I()\n\ta = 0\n\tans = 0\n\tfor i in range(1, 31):\n\t\tif x >= A[i]:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nfor q in range(t):\n\tn = int(input())\n\tkol = 0\n\tch = 1\n\twhile (ch * ch - ch) // 2 + ch <= n:\n\t\tn -= (ch * ch - ch) // 2 + ch\n\t\tch *= 2\n\t\tch += 1\n\t\tkol += 1\n\tprint(kol)\n", "cases = int(input())\nfor t in range(cases):\n\tx = int(input())\n\ti = 1\n\tv = 2 ** i - 1\n\ts = 1\n\tns = 0\n\twhile x >= s:\n\t\tns += 1\n\t\tx -= s\n\t\ti += 1\n\t\tv = 2 ** i - 1\n\t\ts1 = (2 ** (i - 1)) ** 2 + 2 * s\n\t\ts = s1\n\tprint(ns)\n", "for j in range(int(input())):\n\tx = int(input())\n\ti = 0\n\tn = 1\n\twhile x >= n:\n\t\ti += 1\n\t\tx -= n\n\t\tn = 2 * n + 2 ** i * 2 ** i\n\tprint(i)\n", "cellsNeeded = []\npowNum = 2\nwhile powNum < 10 ** 20:\n\ttemp = powNum - 1\n\tcellsNeeded.append(temp * (1 + temp) // 2)\n\tpowNum *= 2\npref = [0]\nfor i in range(len(cellsNeeded)):\n\tpref.append(pref[-1] + cellsNeeded[i])\nfor _ in range(int(input())):\n\tx = int(input())\n\tfor i in range(len(pref) - 1, -1, -1):\n\t\tif pref[i] <= x:\n\t\t\tprint(i)\n\t\t\tbreak\n", "from math import log\n\ndef cub(n):\n\treturn (1 + n) * n // 2\nq = int(input())\nwhile q:\n\tq -= 1\n\tn = int(input())\n\tx = 0\n\twhile n >= cub((1 << x + 1) - 1):\n\t\tx += 1\n\t\tn -= cub((1 << x) - 1)\n\tprint(x)\n", "from math import pow\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tans = 0\n\tfor i in range(1, 31):\n\t\ttemp = pow(2, i) - 1\n\t\ttemp = int(temp * (temp + 1) // 2)\n\t\tif temp <= n:\n\t\t\tans += 1\n\t\t\tn -= temp\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\narr = [1]\nfor i in range(1, 32):\n\tarr.append((2 ** i) ** 2 + 2 * arr[i - 1])\nwhile t > 0:\n\tt -= 1\n\tx = int(input())\n\tcount = 1\n\tx = x - 1\n\ti = 1\n\twhile x > 0:\n\t\tx = x - arr[i]\n\t\ti += 1\n\t\tif x >= 0:\n\t\t\tcount += 1\n\tprint(count)\n", "def isnice(n):\n\tdeep = 1\n\tneed = n * (n + 1) / 2\n\twhile need > 0:\n\t\tx = n // 2 + 1\n\t\tneed -= deep * x * x\n\t\tn -= x\n\t\tdeep *= 2\n\tif need == 0:\n\t\treturn True\n\telse:\n\t\treturn False\nn = int(input())\nfor i in range(n):\n\tcells = int(input())\n\tn = 1\n\tcount = 0\n\twhile n * (n + 1) / 2 <= cells:\n\t\tcount += 1\n\t\tcells -= n * (n + 1) // 2\n\t\tn = n * 2 + 1\n\tprint(count)\n", "t = int(input())\nfor game in range(t):\n\tx = int(input())\n\tval = 1\n\tpower = 2\n\tcount = 0\n\twhile val <= x:\n\t\tcount += 1\n\t\tx -= val\n\t\tval = 2 * val + power ** 2\n\t\tpower *= 2\n\tprint(count)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tz = 2\n\tcount = 0\n\tfor k in range(1, x + 1):\n\t\tn = z - 1\n\t\ts = n * (n + 1) // 2\n\t\tif x < s:\n\t\t\tbreak\n\t\tx -= s\n\t\tcount += 1\n\t\tz = z * 2\n\tprint(count)\n", "import sys, os, io\ninput = sys.stdin.readline\nlis = [1]\nfor i in range(2, 40):\n\tn = pow(2, i) - 1\n\tlis.append(lis[-1] + n * (n + 1) // 2)\nT = int(input())\nans = [0] * T\nfor t in range(T):\n\tx = int(input())\n\tfor i in range(60):\n\t\tif lis[i] > x:\n\t\t\tans[t] = i\n\t\t\tbreak\nprint(*ans, sep='\\n')\n", "num = [1]\nfor j in range(2, 33):\n\tnum.append(num[-1] + (2 ** j - 1) * 2 ** j // 2)\nfor _ in range(int(input())):\n\tx = int(input())\n\ti = 0\n\twhile x >= num[i]:\n\t\ti += 1\n\tprint(i)\n", "from sys import stdin\nN = int(stdin.readline())\nfor stair in range(N):\n\tcells = int(stdin.readline())\n\ti = 1\n\tcount = 0\n\tcost = i * (i + 1) // 2\n\ttotal = 0\n\twhile total <= cells:\n\t\ttotal += cost\n\t\ti = 2 * i + 1\n\t\tcost = i * (i + 1) // 2\n\t\tcount += 1\n\tprint(count - 1)\n", "import math\n\ndef solve(n):\n\tresult = 0\n\tsize = 1\n\tcells = 1\n\twhile cells <= n:\n\t\tresult += 1\n\t\tn -= cells\n\t\tsize *= 2\n\t\tcells = (size * 2 - 1) * size\n\treturn result\nN = int(input())\nfor i in range(N):\n\tn = int(input())\n\tprint(solve(n))\n", "l = [1]\nfor i in range(60):\n\tl.append(l[-1] * 2 + 1)\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = 0\n\tc = 0\n\twhile s < n:\n\t\ts += l[c] * (l[c] + 1) // 2\n\t\tc += 1\n\tif s > n:\n\t\tc -= 1\n\tprint(c)\n", "import bisect\nd = []\nk = 1\nwhile k <= 2000000000.0:\n\td.append(k * (k + 1) // 2 + (d[-1] if len(d) > 0 else 0))\n\tk = 1 + 2 * k\nfor _ in range(int(input())):\n\tnum = int(input())\n\tz = bisect.bisect(d, num, lo=0, hi=len(d))\n\tprint(z)\n", "t = int(input())\nfor _ in range(t):\n\tmax_cells = int(input())\n\tsum_cells = 0\n\tcolumns = 1\n\ti = 0\n\twhile sum_cells <= max_cells:\n\t\tsum_cells += columns ** 2 // 2 + columns // 2 + 1\n\t\tcolumns = columns * 2 + 1\n\t\ti += 1\n\tprint(i - 1)\n", "for t in range(int(input())):\n\tn = int(input())\n\tcount = 0\n\tsize = 1\n\tamo = 1\n\twhile n >= amo:\n\t\tn -= amo\n\t\tcount += 1\n\t\tsize = size * 2 + 1\n\t\tamo = size * (size + 1) // 2\n\tprint(count)\n", "from sys import stdin\ninput = stdin.readline\na = [1, 3, 7]\nfor i in range(40):\n\ta.append(a[-1] + a[-1] + 1)\na = [i * (i + 1) // 2 for i in a]\nfor _ in range(int(input())):\n\tx = int(input())\n\ty = 0\n\tc = 0\n\tfor i in a:\n\t\tif y + i > x:\n\t\t\tbreak\n\t\ty += i\n\t\tc += 1\n\tprint(c)\n", "def formula(x):\n\treturn sr[x]\nar = [0] * 60\nr2 = 2\nfor i in range(1, 60):\n\tar[i] = (r2 - 1) * r2 // 2\n\tr2 *= 2\nsr = [0] * 60\nsr[1] = ar[1]\nfor i in range(2, 60):\n\tsr[i] = sr[i - 1] + ar[i]\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tl = 0\n\tr = 60\n\tbest = 0\n\twhile l <= r:\n\t\tmid = l + (r - l) // 2\n\t\tif formula(mid) <= x:\n\t\t\tbest = max(best, mid)\n\t\t\tl = mid + 1\n\t\telse:\n\t\t\tr = mid - 1\n\tprint(best)\n", "ar = []\nr = 1\nwhile 1:\n\tx = r * (r + 1) // 2\n\tif x > 1e+20:\n\t\tbreak\n\tar.append(x)\n\tr = r * 2 + 1\nt = int(input())\nfor a0 in range(t):\n\tx = int(input())\n\tr = 0\n\twhile x > 0:\n\t\tr += 1\n\t\tx -= ar[r]\n\tprint(r)\n", "a = [1]\nb = [0]\ni = 2\nwhile b[-1] <= 10 ** 18:\n\ta.append(a[-1] + i)\n\tb.append(a[-2] * (a[-2] + 1) // 2)\n\ti *= 2\nb = b[1:]\nfor _ in range(int(input())):\n\tn = int(input())\n\tsum = 0\n\tfor i in range(len(b)):\n\t\tif sum + b[i] > n:\n\t\t\tbreak\n\t\telse:\n\t\t\tsum += b[i]\n\tprint(i)\n", "from bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nfrom heapq import heappush, heappop, heapify\nimport math\nfrom collections import *\nfrom functools import reduce, cmp_to_key\nimport sys\ninput = sys.stdin.readline\nfrom itertools import accumulate\nfrom functools import lru_cache\nM = mod = 998244353\n\ndef factors(n):\n\treturn sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))\n\ndef inv_mod(n):\n\treturn pow(n, mod - 2, mod)\n\ndef li():\n\treturn [int(i) for i in input().rstrip('\\n').split()]\n\ndef st():\n\treturn input().rstrip('\\n')\n\ndef val():\n\treturn int(input().rstrip('\\n'))\n\ndef li2():\n\treturn [i for i in input().rstrip('\\n')]\n\ndef li3():\n\treturn [int(i) for i in input().rstrip('\\n')]\nl1 = 0\n\ndef make():\n\tglobal l1\n\tstart = 2\n\tl1 = [1]\n\tfor i in range(2, 32):\n\t\tcurr = start * start\n\t\ttemp = 2 * l1[-1]\n\t\tl1.append(temp + curr)\n\t\tstart *= 2\n\tl1 = list(accumulate(l1))\nmake()\nfor _ in range(val()):\n\tn = val()\n\tans = 0\n\tfor (ind, i) in enumerate(l1):\n\t\tif n >= i:\n\t\t\tans = ind + 1\n\tprint(ans)\n", "test = int(input())\nfor i in range(test):\n\tn = int(input())\n\ts = 0\n\tcnt = 0\n\tfor i in range(0, 100):\n\t\ts += pow(2, i)\n\t\tif n - s * (s + 1) // 2 < 0:\n\t\t\tbreak\n\t\tn -= s * (s + 1) // 2\n\t\tcnt += 1\n\tprint(cnt)\n", "t = int(input())\nwhile t > 0:\n\tx = int(input())\n\tans = 0\n\tlth = 1\n\tp = 1\n\twhile x > 0:\n\t\tsquare_req = lth * (lth + 1) // 2\n\t\tif square_req > x:\n\t\t\tbreak\n\t\telse:\n\t\t\tx = x - square_req\n\t\t\tp = p * 2\n\t\t\tlth = lth + p\n\t\t\tans = ans + 1\n\tprint(ans)\n\tt = t - 1\n", "T = int(input())\nfor _ in range(0, T):\n\tx = int(input())\n\tans = 0\n\ttot = 0\n\tfor i in range(1, 40):\n\t\ttt = 2 ** i - 1\n\t\ttot += tt * (tt + 1) // 2\n\t\tif tot > x:\n\t\t\tbreak\n\t\telse:\n\t\t\tans = i\n\tprint(ans)\n", "for i in range(int(input())):\n\tx = int(input())\n\tcount = 0\n\tstair = 1\n\tcell = 1\n\twhile x - cell >= 0:\n\t\tx = x - cell\n\t\tcount += 1\n\t\tstair = stair * 2 + 1\n\t\tcell = stair * (stair + 1) // 2\n\tprint(count)\n", "inf = int(1e+18)\nt = int(input(''))\narr = []\nfor i in range(t):\n\tarr.append(int(input('')))\nfor i in arr:\n\tx = i\n\tsol = 0\n\tn = 1\n\twhile x > 0:\n\t\tx -= n * (n + 1) // 2\n\t\tn = 2 * n + 1\n\t\tif x >= 0:\n\t\t\tsol += 1\n\tprint(sol)\n", "import math\n\ndef stairs(c):\n\tx = 1\n\ti = 0\n\ta = 0\n\tn = 1\n\twhile a < c:\n\t\tsgp = 2 ** n - 1\n\t\ta += sgp * (sgp + 1) // 2\n\t\tx *= 2\n\t\ti += 1\n\t\tn += 1\n\tif a > c:\n\t\ti -= 1\n\treturn i\nt = int(input())\nfor x in range(t):\n\tprint(stairs(int(input())))\n", "import math\nfor j in range(int(input())):\n\tn = int(input())\n\ts = 0\n\tcnt = 1\n\twhile s <= n:\n\t\ts += 2 ** (cnt - 1) * (2 ** cnt - 1)\n\t\tcnt += 1\n\tprint(cnt - 2)\n", "test_cases = int(input())\nfor test_case in range(test_cases):\n\tx = int(input())\n\ta = 0\n\tsum = 0\n\tans = 0\n\twhile x >= a:\n\t\tb = a\n\t\ta = a + a + 1\n\t\tdiff = a - b\n\t\tsum = diff ** 2 + 2 * sum\n\t\tx -= sum\n\t\tif x >= 0:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import os\nimport sys\nfrom math import *\nfrom collections import *\nfrom bisect import *\nfrom io import BytesIO, IOBase\n\ndef vsInput():\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nALPHA = 'abcdefghijklmnopqrstuvwxyz'\nM = 10 ** 9 + 7\nEPS = 1e-06\n\ndef Ceil(a, b):\n\treturn a // b + int(a % b > 0)\n\ndef value():\n\treturn tuple(map(int, input().split()))\n\ndef array():\n\treturn [int(i) for i in input().split()]\n\ndef Int():\n\treturn int(input())\n\ndef Str():\n\treturn input()\n\ndef arrayS():\n\treturn [i for i in input().split()]\nhave = [1]\nx = 2\nfor i in range(60):\n\tx *= 2\n\there = x - 1\n\thave.append(here * (here + 1) // 2 + have[-1])\nfor _ in range(Int()):\n\tn = Int()\n\tans = bisect_right(have, n)\n\tprint(ans)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tn = 0\n\ttotal = 0\n\ti = 1\n\ttemp = 1\n\twhile n < x:\n\t\tn += temp * (temp + 1) // 2\n\t\ttotal += 1\n\t\ttemp += pow(2, i)\n\t\ti += 1\n\tif n > x:\n\t\ttotal -= 1\n\tprint(total)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tcount = 0\n\tans = 1\n\ttot = 0\n\tsteps = 0\n\tfor i in range(1, 61):\n\t\tans = ans * 2\n\t\ttot += (ans - 1) * ans // 2\n\t\tif tot <= n:\n\t\t\tsteps += 1\n\tprint(steps)\n", "t = int(input())\nfor kk in range(t):\n\tx = int(input())\n\tcur_sum = 0\n\tk = 1\n\twhile True:\n\t\tcur_sum += 2 ** (2 * k - 1) - 2 ** (k - 1)\n\t\tif cur_sum > x:\n\t\t\tbreak\n\t\tk += 1\n\tprint(k - 1)\n", "for t in range(int(input())):\n\tx = int(input())\n\tarr = []\n\tfor i in range(32):\n\t\tarr.append(2 ** i)\n\tfor i in range(32):\n\t\tsp = arr[i] * (arr[i] - 1) // 2\n\t\tarr[i] = sp\n\tcnt = 0\n\tfor i in range(32):\n\t\tif x - arr[i] < 0:\n\t\t\tbreak\n\t\tx -= arr[i]\n\t\tcnt += 1\n\tprint(cnt - 1)\n", "def myfunc(n):\n\treturn 2 ** (n - 1) * (2 ** n - 1)\nfor _ in range(int(input())):\n\tx = int(input())\n\tans = 1\n\tif x == 1:\n\t\tprint(ans)\n\telse:\n\t\tcv = myfunc(ans)\n\t\twhile cv <= x:\n\t\t\tx -= cv\n\t\t\tans += 1\n\t\t\tcv = myfunc(ans)\n\t\tprint(ans - 1)\n", "t = int(input())\nfor q in range(t):\n\tn = int(input())\n\tnow = 1\n\tprev = 0\n\tans = 0\n\ttemp = now ** 2 + prev * 2\n\twhile n >= temp:\n\t\tn -= temp\n\t\tans += 1\n\t\tnow *= 2\n\t\tprev = temp\n\t\ttemp = now ** 2 + prev * 2\n\tprint(ans)\n", "def precalc():\n\tk = 1\n\tarr = [0]\n\twhile arr[-1] < 10 ** 18:\n\t\ts = (1 << k) - 1\n\t\tt = s * (s + 1) // 2\n\t\tarr.append(t + arr[-1])\n\t\tk += 1\n\treturn arr[1:]\n\ndef main(arr):\n\tx = int(input())\n\ti = 0\n\twhile arr[i] <= x:\n\t\ti += 1\n\tprint(i)\nfor _ in range(int(input())):\n\tarr = precalc()\n\tmain(arr)\n", "for tt in range(int(input())):\n\tx = int(input())\n\tn = 0\n\tpowTwo = 2\n\twhile x > 0:\n\t\tsqs = powTwo * (powTwo - 1) // 2\n\t\tx -= sqs\n\t\tpowTwo *= 2\n\t\tif x >= 0:\n\t\t\tn += 1\n\tprint(n)\n", "ladder = [1, 7]\nfor i in range(30):\n\tx = 6 * ladder[-1] - 8 * ladder[-2] + 1\n\tladder.append(x)\nt = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\tfor i in range(60):\n\t\tif ladder[i] > n:\n\t\t\tprint(i)\n\t\t\tbreak\n", "def get_num(n):\n\tres = (n + 1) * n // 2\n\treturn res\nassert get_num(4) == 10\nfor _ in range(int(input())):\n\tn = int(input())\n\tcur = 2\n\tcnt = 0\n\twhile get_num(cur - 1) <= n:\n\t\tn -= get_num(cur - 1)\n\t\tcnt += 1\n\t\tcur *= 2\n\tprint(cnt)\n", "from math import log2\nt = int(input())\na = []\nfor j in range(1, 64):\n\ta.append(pow(2, j) - 1)\nfor i in range(t):\n\tx = int(input())\n\tk = 0\n\tfor j in range(len(a)):\n\t\tif x - a[j] * (a[j] + 1) // 2 >= 0:\n\t\t\tx -= a[j] * (a[j] + 1) // 2\n\t\t\tk += 1\n\t\telse:\n\t\t\tbreak\n\tprint(k)\n", "a = []\ns = 0\nx = 2\nwhile s <= 10 ** 18:\n\ts += x * (x - 1) // 2\n\ta.append(s)\n\tx *= 2\nfor _ in range(int(input())):\n\tm = int(input())\n\tans = 0\n\tfor i in a:\n\t\tif i > m:\n\t\t\tbreak\n\t\tans += 1\n\tprint(ans)\n", "from math import ceil\nfrom decimal import *\n\ndef get_ans(x):\n\tans = 0\n\ti = 1\n\tc = 0\n\twhile x > 0:\n\t\tans += 1\n\t\tx -= i * 2 ** c\n\t\tc += 1\n\t\ti = 2 * i + 1\n\tif x < 0:\n\t\tans -= 1\n\treturn ans\n\ndef dfs(G, v, curr):\n\tv.append(curr)\n\tmax_d = 1\n\tv_max_d = []\n\ttr = False\n\tfor node in range(n):\n\t\tif G[curr][node] != -1:\n\t\t\tif node not in v:\n\t\t\t\ttr = True\n\t\t\t\td_v = dfs(G, v, node)\n\t\t\t\tif d_v[0] + 1 > max_d:\n\t\t\t\t\tmax_d = d_v[0] + 1\n\t\t\t\t\tv_max_d = d_v[1]\n\tif not tr:\n\t\treturn (1, v)\n\treturn (max_d, v_max_d)\n\ndef bfs(G, start):\n\tv = []\n\tquerry = []\n\tv.append(start)\n\tquerry.append(start)\n\tdepth = 0\n\twhile querry:\n\t\tdepth += 1\n\t\tcurr = querry.pop(0)\n\t\tfor node in range(n):\n\t\t\tif G[curr][node] != -1 and node not in v:\n\t\t\t\tv.append(node)\n\t\t\t\tquerry.append(node)\n\treturn (depth, v)\nt = int(input())\nanss = []\nfor _ in range(t):\n\tx = int(input())\n\tanss.append(get_ans(x))\nfor i in anss:\n\tprint(i)\n", "def ns(n):\n\tif n == 1:\n\t\treturn 1\n\telse:\n\t\treturn 2 * ns(n - 1) + 4 ** (n - 1)\nx = int(input())\nfor i in range(x):\n\tm = int(input())\n\tn = 1\n\twhile m >= 0:\n\t\tm = m - ns(n)\n\t\tn = n + 1\n\tprint(n - 2)\n", "t = int(input())\nl = [1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827]\nfor i in range(t):\n\tn = int(input())\n\tif n >= 768614335330822827:\n\t\tprint(30)\n\telse:\n\t\tj = 0\n\t\twhile n >= l[j]:\n\t\t\tj += 1\n\t\tprint(j)\n", "from sys import stdin, stdout\ninput = stdin.readline\nprint = lambda x: stdout.write(str(x) + '\\n')\nfor _ in range(int(input())):\n\tx = int(input())\n\ti = 1\n\tans = 0\n\twhile x >= i * i - (i * i - i) // 2:\n\t\tans += 1\n\t\tx -= i * i - (i * i - i) // 2\n\t\ti *= 2\n\t\ti += 1\n\tprint(ans)\n", "import math\nt = int(input())\nfor w in range(t):\n\tn = int(input())\n\ta = 1\n\tc = 0\n\ts = 0\n\twhile s + a * (a + 1) // 2 <= n:\n\t\ts += a * (a + 1) // 2\n\t\ta = 2 * a + 1\n\t\tc += 1\n\tprint(c)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ti = 1\n\tans = 0\n\twhile True:\n\t\tx = 2 ** i - 1\n\t\tocc = x * (x + 1) // 2\n\t\tif n >= occ:\n\t\t\tans += 1\n\t\t\tn -= occ\n\t\t\ti += 1\n\t\telse:\n\t\t\tprint(ans)\n\t\t\tbreak\n", "t = int(input())\nfor ii in range(t):\n\tn = int(input())\n\tx = 1\n\ts = 0\n\td = 0\n\twhile s <= n:\n\t\tx *= 2\n\t\ts += x * (x - 1) // 2\n\t\td += 1\n\t\tif s > n:\n\t\t\td -= 1\n\t\t\tbreak\n\tprint(d)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tcount = 0\n\tval = 1\n\twhile x > 0:\n\t\treq = val ** 2 + val * (val - 1)\n\t\tval *= 2\n\t\tif x >= req:\n\t\t\tcount += 1\n\t\t\tx -= req\n\t\telse:\n\t\t\tbreak\n\tprint(count)\n", "import math\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ta = math.log2(n + 1)\n\tk = 0\n\tif n == 1:\n\t\tprint(1)\n\telse:\n\t\t(ans, m) = (0, k)\n\t\tfor i in range(1, int(a) + 1):\n\t\t\tm = k\n\t\t\tk = 4 * (4 ** i - 1) // 3 - 2 ** (i + 1) + 2\n\t\t\tif k <= 2 * n:\n\t\t\t\tans = i\n\t\t\telse:\n\t\t\t\tbreak\n\t\tprint(ans)\n", "dp = []\ncnt = 0\ns = 0\nfor i in range(30):\n\tcurr = 2 ** cnt\n\ts += curr\n\tdp.append(s * (s + 1) // 2)\n\tcnt += 1\nfor _ in range(int(input())):\n\tn = int(input())\n\tss = 0\n\tccc = 0\n\tfor i in range(len(dp)):\n\t\tif ss + dp[i] > n:\n\t\t\tbreak\n\t\telse:\n\t\t\tss += dp[i]\n\t\t\tccc += 1\n\tprint(ccc)\n", "import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools\ninf = 10 ** 20\neps = 1.0 / 10 ** 10\nmod = 10 ** 9 + 7\nmod2 = 998244353\ndd = [(-1, 0), (0, 1), (1, 0), (0, -1)]\nddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]\n\ndef LI():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef LLI():\n\treturn [list(map(int, l.split())) for l in sys.stdin.readlines()]\n\ndef LI_():\n\treturn [int(x) - 1 for x in sys.stdin.readline().split()]\n\ndef LF():\n\treturn [float(x) for x in sys.stdin.readline().split()]\n\ndef LS():\n\treturn sys.stdin.readline().split()\n\ndef I():\n\treturn int(sys.stdin.readline())\n\ndef F():\n\treturn float(sys.stdin.readline())\n\ndef S():\n\treturn input()\n\ndef pf(s):\n\treturn print(s, flush=True)\n\ndef pe(s):\n\treturn print(str(s), file=sys.stderr)\n\ndef JA(a, sep):\n\treturn sep.join(map(str, a))\n\ndef JAA(a, s, t):\n\treturn s.join((t.join(map(str, b)) for b in a))\n\ndef IF(c, t, f):\n\treturn t if c else f\n\ndef YES(c):\n\treturn IF(c, 'YES', 'NO')\n\ndef Yes(c):\n\treturn IF(c, 'Yes', 'No')\n\ndef main():\n\tt = I()\n\trr = []\n\tfor _ in range(t):\n\t\tn = I()\n\t\tr = 0\n\t\tk = 1\n\t\tfor i in range(1, 40):\n\t\t\tif k > n:\n\t\t\t\tbreak\n\t\t\tn -= k\n\t\t\tr += 1\n\t\t\tk = k * 2 + (2 ** i) ** 2\n\t\trr.append(r)\n\treturn JA(rr, '\\n')\nprint(main())\n", "from sys import stdin\ntt = int(stdin.readline())\nfor loop in range(tt):\n\tn = int(stdin.readline())\n\tans = 0\n\tnow = 0\n\tfor i in range(100):\n\t\tnow = now * 2 + (2 ** i) ** 2\n\t\tif now <= n:\n\t\t\tans += 1\n\t\t\tn -= now\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = 0\n\tx = 1\n\tcount = 0\n\twhile s < n:\n\t\ts += x * (x + 1) // 2\n\t\tcount += 1\n\t\tx = 2 * x + 1\n\tif s == n:\n\t\tprint(count)\n\telse:\n\t\tprint(count - 1)\n", "for _ in range(int(input())):\n\ta = int(input())\n\tcount = 0\n\tcur = 1\n\twhile a >= 0:\n\t\tcount += 1\n\t\ta -= cur * (cur + 1) // 2\n\t\tcur = 2 * cur + 1\n\tprint(count - 1)\n", "lst = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576]\nfor y in range(int(input())):\n\tn = int(input())\n\tcnt = 0\n\tsumm = 0\n\tfor i in lst:\n\t\tsumm += i\n\t\tif summ > n:\n\t\t\tbreak\n\t\tcnt += 1\n\tprint(cnt)\n", "list = []\nfor i in range(33):\n\tcas = pow(2, i) - 1\n\tlist.append((1 + cas) * cas // 2)\nT = int(input())\nfor Case in range(T):\n\tn = int(input())\n\tsum = cnt = 0\n\tfor i in range(1, 33):\n\t\tif sum + list[i] <= n:\n\t\t\tsum += list[i]\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tbreak\n\tprint(cnt)\n", "t = int(input())\nq = []\nfor i in range(t):\n\tx = int(input())\n\tcount = 0\n\tn = 1\n\twhile (pow(2, n) - 1) * pow(2, n - 1) <= x:\n\t\tcount += 1\n\t\tx -= (pow(2, n) - 1) * pow(2, n - 1)\n\t\tn += 1\n\tq.append(count)\nfor i in q:\n\tprint(i)\n", "import math\nfor _ in range(int(input())):\n\tn = int(input())\n\tx = 2\n\tans = 1\n\tc = 1\n\twhile c <= n:\n\t\tx = x * 2\n\t\tc += (x - 1) * x // 2\n\t\tif c <= n:\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tposchodi = 1\n\tout = 0\n\twhile x > 0:\n\t\tif x >= poschodi * (poschodi + 1) // 2:\n\t\t\tx = x - poschodi * (poschodi + 1) // 2\n\t\t\tout = out + 1\n\t\t\tposchodi = 2 * (poschodi + 1) - 1\n\t\telse:\n\t\t\tbreak\n\tprint(out)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\tva = 0\n\tval = 0\n\ti = 0\n\twhile val <= n:\n\t\tva += pow(2, i)\n\t\ti += 1\n\t\tans += 1\n\t\tval += va * (va + 1) // 2\n\tprint(ans - 1)\n", "for _ in [0] * int(input()):\n\tn = int(input())\n\to = 0\n\tc = 1\n\twhile n >= 0:\n\t\tn -= c * (c + 1) // 2\n\t\to += 1\n\t\tc = 2 * c + 1\n\tprint(o - 1)\n", "def main():\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\tw = -1\n\t\ti = 1\n\t\tw = 1\n\t\tl = []\n\t\twhile 1:\n\t\t\tif n < i * (i + 1) // 2:\n\t\t\t\tbreak\n\t\t\tn -= i * (i + 1) // 2\n\t\t\ti = pow(2, w + 1) - 1\n\t\t\tw += 1\n\t\tprint(w - 1)\nmain()\n", "def algo(n):\n\ti = 1\n\twhile n >= 0:\n\t\tk = 2 ** i - 1\n\t\tn -= k * (1 + k) // 2\n\t\ti += 1\n\treturn i - 2\nfor _ in range(int(input())):\n\tn = int(input())\n\tans = algo(n)\n\tprint(ans)\n", "for i in range(int(input())):\n\tn = int(input())\n\tif n > 1:\n\t\tlst = []\n\t\tlst.append(1)\n\t\tans = 0\n\t\tnow = 2\n\t\twhile n > 0:\n\t\t\tn -= 2 * lst[now - 2] + 2 ** (2 * (now - 1))\n\t\t\tlst.append(2 * lst[now - 2] + 2 ** (2 * (now - 1)))\n\t\t\tnow += 1\n\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(1)\n", "from collections import Counter, defaultdict as dft\n\ndef mp():\n\treturn map(int, input().split())\n\ndef ml():\n\treturn list(map(int, input().split()))\n\ndef solve():\n\tn = int(input())\n\tpre = 1\n\tc = 0\n\ttotal = 1\n\tx = 2\n\twhile total <= n:\n\t\tc += 1\n\t\tpre = 2 * pre + x * x\n\t\ttotal += pre\n\t\tx *= 2\n\tprint(c)\nt = int(input())\nfor _ in range(t):\n\tsolve()\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ta = 1\n\tans = 0\n\twhile a * (a + 1) // 2 <= n:\n\t\tn -= a * (a + 1) // 2\n\t\tans += 1\n\t\ta = a * 2 + 1\n\tprint(ans)\n", "for f in range(int(input())):\n\tn = int(input())\n\ti = 1\n\tj = i\n\tcnt = j - 1\n\twhile i <= n:\n\t\tcnt = cnt + 1\n\t\tj = 2 * j\n\t\ti = i + (j + 1) * (j + 2) // 2\n\t\tj = j + 1\n\tprint(cnt)\n", "mem = {}\n\ndef dp(pos, k):\n\tif k == 1:\n\t\treturn int(s[0:pos])\n\tif (pos, k) in mem:\n\t\treturn mem[pos, k]\n\tres = 0\n\tfor x in range(k - 1, pos):\n\t\tres = max(res, dp(x, k - 1) * int(s[x:pos]))\n\tmem[pos, k] = res\n\treturn res\nfor ca in range(0, int(input())):\n\tn = int(input())\n\ttot = 0\n\tfor i in range(0, 101):\n\t\tm = 2 ** i - 1\n\t\tw = (m + 1) * m // 2\n\t\tif w <= n:\n\t\t\tn -= w\n\t\t\ttot += 1\n\t\telse:\n\t\t\tbreak\n\tprint(tot - 1)\n", "import sys\nimport math\nimport random\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inara():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\nara = [1]\nfor i in range(30):\n\tnow = pow(2, i + 1)\n\tlast = ara[-1]\n\tara.append(now * now + 2 * last)\nt = inp()\nfor _ in range(t):\n\tn = inp()\n\tnow = 0\n\tfor i in range(31):\n\t\tnow += ara[i]\n\t\tif now > n:\n\t\t\tprint(i)\n\t\t\tbreak\n", "a = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, 2147483647]\nt = input()\nt = int(t)\nb = [0 for i in range(40)]\nfor i in range(1, 32):\n\tb[i] = a[i] * (a[i] + 1) // 2\nfor i in range(1, t + 1):\n\tx = input()\n\tx = int(x)\n\tans = 0\n\tsum = 0\n\tfor a in b:\n\t\tif sum + a <= x:\n\t\t\tsum += a\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans - 1)\n", "T = int(input())\nfor t in range(T):\n\tx = int(input())\n\tcount = 0\n\ti = 1\n\twhile 1:\n\t\tx -= i * (i + 1) // 2\n\t\tif x < 0:\n\t\t\tbreak\n\t\tcount += 1\n\t\ti = 2 * i + 1\n\tprint(count)\n", "t = int(input())\nfor i in range(0, t):\n\tn = int(input())\n\tcount = 1\n\tsum1 = 0\n\twhile sum1 <= n:\n\t\tsum1 += 2 ** (count - 1) * (2 ** count - 1)\n\t\tcount += 1\n\tprint(count - 2)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\theight = 1\n\twhile n >= 0:\n\t\tcells = height * (height + 1) // 2\n\t\tn -= cells\n\t\theight += height + 1\n\t\tans += 1\n\tprint(ans - 1)\n", "king1 = [1]\nfor j in range(2, 33):\n\tking1.append(king1[-1] + (2 ** j - 1) * 2 ** j // 2)\nt = int(input())\nfor q in range(t):\n\txxxxxx = int(input())\n\ti = 0\n\tfor w in range(33):\n\t\tif king1[i] > xxxxxx:\n\t\t\tbreak\n\t\ti += 1\n\tprint(i)\n", "from math import log2\nfor _ in range(int(input())):\n\tx = int(input())\n\tacc = 0\n\tfor i in range(1, 60):\n\t\tacc += (2 ** i - 1) * 2 ** (i - 1)\n\t\tif acc > x:\n\t\t\tbreak\n\tprint(i - 1)\n", "from sys import stdin, stdout\nfrom collections import Counter\nfrom itertools import permutations\nimport bisect\nimport math\nI = lambda : map(int, stdin.readline().split())\nI1 = lambda : stdin.readline()\nfor _ in range(int(I1())):\n\tn = int(I1())\n\tx = 1\n\tc = 1\n\tans = 0\n\twhile True:\n\t\tif n >= x * (x + 1) // 2:\n\t\t\tn -= x * (x + 1) // 2\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\t\tc *= 2\n\t\tx += c\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nscan_int = lambda : int(input())\nscan_string = lambda : input().rstrip()\nread_list = lambda : list(read())\nread = lambda : map(int, input().split())\nread_float = lambda : map(float, input().split())\n\ndef ceil(x):\n\tif x != int(x):\n\t\tx = int(x) + 1\n\treturn x\n\ndef factorial(x, m):\n\tval = 1\n\twhile x > 0:\n\t\tval = val * x % m\n\t\tx -= 1\n\treturn val\n\ndef fact(x):\n\tval = 1\n\twhile x > 0:\n\t\tval *= x\n\t\tx -= 1\n\treturn val\n\ndef swaparr(arr, a, b):\n\ttemp = arr[a]\n\tarr[a] = arr[b]\n\tarr[b] = temp\n\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b, a % b)\n\ndef lcm(a, b):\n\treturn a * b // math.gcd(a, b)\n\ndef is_integer(n):\n\treturn math.ceil(n) == math.floor(n)\n\ndef nCr(n, k):\n\tif k > n:\n\t\treturn 0\n\tif k > n - k:\n\t\tk = n - k\n\tres = 1\n\tfor i in range(k):\n\t\tres = res * (n - i)\n\t\tres = res / (i + 1)\n\treturn int(res)\n\ndef primefs(n):\n\tprimes = {}\n\twhile n % 2 == 0 and n > 0:\n\t\tprimes[2] = primes.get(2, 0) + 1\n\t\tn = n // 2\n\tfor i in range(3, int(n ** 0.5) + 2, 2):\n\t\twhile n % i == 0 and n > 0:\n\t\t\tprimes[i] = primes.get(i, 0) + 1\n\t\t\tn = n // i\n\tif n > 2:\n\t\tprimes[n] = primes.get(n, 0) + 1\n\treturn primes\n\ndef power(x, y, p):\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef swap(a, b):\n\ttemp = a\n\ta = b\n\tb = temp\n\treturn (a, b)\n\ndef find(x, link):\n\tp = x\n\twhile p != link[p]:\n\t\tp = link[p]\n\twhile x != p:\n\t\tnex = link[x]\n\t\tlink[x] = p\n\t\tx = nex\n\treturn p\n\ndef union(x, y, link, size):\n\tx = find(x, link)\n\ty = find(y, link)\n\tif size[x] < size[y]:\n\t\t(x, y) = swap(x, y)\n\tif x != y:\n\t\tsize[x] += size[y]\n\t\tlink[y] = x\n\ndef sieve(n):\n\tprime = [True for i in range(n + 1)]\n\t(prime[0], prime[1]) = (False, False)\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 1\n\treturn prime\n\ndef phi(n):\n\tresult = n\n\tp = 2\n\twhile p * p <= n:\n\t\tif n % p == 0:\n\t\t\twhile n % p == 0:\n\t\t\t\tn = n // p\n\t\t\tresult = result * (1.0 - 1.0 / float(p))\n\t\tp = p + 1\n\tif n > 1:\n\t\tresult = result * (1.0 - 1.0 / float(n))\n\treturn int(result)\n\ndef is_prime(n):\n\tif n == 0:\n\t\treturn False\n\tif n == 1:\n\t\treturn True\n\tfor i in range(2, int(n ** (1 / 2)) + 1):\n\t\tif not n % i:\n\t\t\treturn False\n\treturn True\n\ndef next_prime(n, primes):\n\twhile primes[n] != True:\n\t\tn += 1\n\treturn n\nMAXN = int(100000.0 + 5)\n\ndef spf_sieve():\n\tspf[1] = 1\n\tfor i in range(2, MAXN):\n\t\tspf[i] = i\n\tfor i in range(4, MAXN, 2):\n\t\tspf[i] = 2\n\tfor i in range(3, ceil(MAXN ** 0.5), 2):\n\t\tif spf[i] == i:\n\t\t\tfor j in range(i * i, MAXN, i):\n\t\t\t\tif spf[j] == j:\n\t\t\t\t\tspf[j] = i\nspf = [0 for i in range(MAXN)]\n\ndef factoriazation(x):\n\tres = []\n\tfor i in range(2, int(x ** 0.5) + 1):\n\t\twhile x % i == 0:\n\t\t\tres.append(i)\n\t\t\tx //= i\n\tif x != 1:\n\t\tres.append(x)\n\treturn res\n\ndef factors(n):\n\tres = []\n\tfor i in range(1, int(n ** 0.5) + 1):\n\t\tif n % i == 0:\n\t\t\tres.append(i)\n\t\t\tres.append(n // i)\n\treturn list(set(res))\n\ndef int_array():\n\treturn list(map(int, input().strip().split()))\n\ndef float_array():\n\treturn list(map(float, input().strip().split()))\n\ndef str_array():\n\treturn input().strip().split()\n\ndef binary_search(low, high, w, h, n):\n\twhile low < high:\n\t\tmid = low + (high - low) // 2\n\t\tif check(mid, w, h, n):\n\t\t\tlow = mid + 1\n\t\telse:\n\t\t\thigh = mid\n\treturn low\n\ndef check(beauty, s, n, count):\n\tpass\nMOD = int(1000000000.0) + 7\nCMOD = 998244353\nINF = float('inf')\nNINF = -float('inf')\nfrom itertools import permutations\nimport math\nimport bisect as bis\nimport random\nimport sys\n\ndef solve():\n\tn = int(input())\n\ts = 0\n\tj = 0\n\tc = 0\n\tfor i in range(100):\n\t\tp = 2 ** i\n\t\tj += p\n\t\tap = j * (j + 1) // 2\n\t\tif s + ap > n:\n\t\t\tbreak\n\t\ts += ap\n\t\tc += 1\n\tprint(c)\nfor _ in range(int(input())):\n\tsolve()\n", "from sys import stdin, stdout\nimport math\nt = int(stdin.readline())\ntup = [1, 7]\npowe = 4\nfor _ in range(t):\n\tn = int(stdin.readline())\n\tif tup[len(tup) - 1] <= n:\n\t\twhile tup[len(tup) - 1] <= n:\n\t\t\tpowe = powe * 2\n\t\t\ttup.append(tup[len(tup) - 1] + (powe - 1) * powe // 2)\n\t\tprint(len(tup) - 1)\n\telse:\n\t\tk = len(tup) - 1\n\t\twhile k > 0 and tup[k] > n:\n\t\t\tk -= 1\n\t\tprint(k + 1)\n", "def solve(cells):\n\tans = 0\n\tpower = 0\n\tprev = 0\n\tlength = prev + 2 ** power\n\twhile cells >= length * (length + 1) // 2:\n\t\tcells -= length * (length + 1) // 2\n\t\tprev = length\n\t\tpower += 1\n\t\tans += 1\n\t\tlength = prev + 2 ** power\n\treturn ans\nfor x in range(int(input())):\n\tprint(solve(int(input())))\n", "from sys import stdin, stdout\nfrom math import *\n\ndef main():\n\tt = int(stdin.readline())\n\tfor _ in range(t):\n\t\tx = int(stdin.readline())\n\t\tcount = 0\n\t\tsize = 1\n\t\twhile True:\n\t\t\tcellrequirement = int((size + 1) * size / 2)\n\t\t\tif x >= cellrequirement:\n\t\t\t\tx -= cellrequirement\n\t\t\t\tcount += 1\n\t\t\t\tsize = size * 2 + 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tprint(count)\nmain()\n", "t = int(input())\nkk = []\ng = 2\nwhile g <= 10 ** 10:\n\tkk.append((g - 1) * g // 2)\n\tg *= 2\nwhile t:\n\tx = int(input())\n\tss = 0\n\tres = 0\n\twhile ss + kk[res] <= x:\n\t\tss += kk[res]\n\t\tres += 1\n\tprint(res)\n\tt -= 1\n", "t = int(input())\nj = 0\nr = 0\nR = []\nfor i in range(10 ** 5):\n\tj = 2 * j + 1\n\ts = j * (j + 1) // 2\n\tr += s\n\tR.append(r)\n\tif r > 10 ** 18:\n\t\tbreak\nimport bisect\nfor _ in range(t):\n\tx = int(input())\n\ti = bisect.bisect_right(R, x)\n\tprint(i)\n", "from math import ceil, log, floor, sqrt\nimport math\nk = 1\n\ndef mod_expo(n, p, m):\n\tresult = 1\n\twhile p != 0:\n\t\tif p % 2 == 1:\n\t\t\tresult = result * n % m\n\t\tp //= 2\n\t\tn = n * n % m\n\treturn result\n\ndef min_subs(n, binary):\n\t(a, b) = (1, 1)\n\tmx = 0\n\tprev = not int(binary[0])\n\tres = [0] * n\n\tfor i in range(n):\n\t\tif int(binary[i]) == 1:\n\t\t\tif int(binary[i]) == prev:\n\t\t\t\ta += 1\n\t\t\t\tb = a\n\t\t\tres[i] = a\n\t\telse:\n\t\t\tif int(binary[i]) == prev:\n\t\t\t\tb += 1\n\t\t\t\ta = b\n\t\t\tres[i] = b\n\t\tprev = int(binary[i])\n\t\tmx = max(mx, max(a, b))\n\tprint(mx)\n\tprint(*res, sep=' ')\n\ndef steps(n):\n\treturn n // 2 + 1\n\ndef find_winner(n):\n\tif n % 2:\n\t\tprint('black')\n\telse:\n\t\tprint('white')\n\t\tprint('1 2')\n\ndef dp_dy(x, y):\n\treturn (125 * pow(x, 2) - pow(x, 3) - 2 * pow(x, 2) * y - 5000 * x + 150 * x * y - x * pow(y, 2) + 25 * pow(y, 2)) / (pow(x + y, 2) * pow(100 - x - y, 2))\n\ndef all_neg():\n\tfor x in range(0, 51):\n\t\tfor y in range(0, 51):\n\t\t\tif x + y != 100 and x + y != 0:\n\t\t\t\tprint(dp_dy(x, y), x, y)\n\t\t\t\tif dp_dy(x, y) > 0:\n\t\t\t\t\treturn False\n\treturn True\n\ndef can_palindrome(r, g, b, w):\n\tno = 0\n\tmn = pow(10, 9) + 1\n\tmn = min(mn, r)\n\tmn = min(mn, g)\n\tmn = min(mn, b)\n\tif r % 2 == 1:\n\t\tno += 1\n\tif g % 2 == 1:\n\t\tno += 1\n\tif b % 2 == 1:\n\t\tno += 1\n\tif w % 2 == 1:\n\t\tno += 1\n\tif no <= 1:\n\t\treturn True\n\tif no == 3 and mn > 0:\n\t\treturn True\n\treturn False\n\ndef max_find(n, k, z, a):\n\tres = 0\n\ts = 0\n\tmx = 0\n\tfor t in range(z + 1):\n\t\tpos = k - 2 * t\n\t\tif pos < 0:\n\t\t\tcontinue\n\t\tmx = 0\n\t\ts = 0\n\t\tfor i in range(pos + 1):\n\t\t\tif i < n - 1:\n\t\t\t\tmx = max(mx, a[i] + a[i + 1])\n\t\t\ts += a[i]\n\t\tres = max(res, s + mx * t)\n\treturn res\n\ndef stair_count(n):\n\treturn n * (n + 1) // 2\n\ndef count_total(n):\n\tcount = 0\n\tstart = 1\n\twhile n >= stair_count(start):\n\t\tcells = stair_count(start)\n\t\tn -= cells\n\t\tcount += 1\n\t\tstart = 2 * start + 1\n\treturn count\nt = 1\nt = int(input())\nwhile t:\n\tt = t - 1\n\tn = int(input())\n\tprint(count_total(n))\n", "import os\nimport sys\nimport math\nfrom io import BytesIO, IOBase\nfrom fractions import Fraction\nimport collections\nfrom itertools import permutations\nfrom collections import defaultdict\nimport threading\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nt = 1\nt = int(input())\nwhile t != 0:\n\tt -= 1\n\tx = int(input())\n\ty = 0\n\tz = 0\n\ttot = 0\n\twhile x >= tot:\n\t\tx -= tot\n\t\tz += 1\n\t\ty = 2 ** z - 1\n\t\ttot = int((y + 1) * y / 2)\n\tprint(z - 1)\n", "import sys, math\nreader = (line.rstrip() for line in sys.stdin)\ninput = reader.__next__\n\ndef getInts():\n\treturn [int(s) for s in input().split()]\n\ndef getInt():\n\treturn int(input())\n\ndef getStrs():\n\treturn [s for s in input().split()]\n\ndef getStr():\n\treturn input()\n\ndef listStr():\n\treturn list(input())\n\ndef solve():\n\tX = getInt()\n\tq = 1\n\tans = 0\n\twhile True:\n\t\tj = 2 ** q - 1\n\t\tif j * (j + 1) // 2 > X:\n\t\t\treturn ans\n\t\tans += 1\n\t\tX -= j * (j + 1) // 2\n\t\tq += 1\nT = getInt()\nfor t in range(T):\n\tprint(solve())\n", "import sys\nsys.setrecursionlimit(10 ** 5)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep='\\n')\n\ndef II():\n\treturn int(sys.stdin.readline())\n\ndef MI():\n\treturn map(int, sys.stdin.readline().split())\n\ndef LI():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef LLI(rows_number):\n\treturn [LI() for _ in range(rows_number)]\n\ndef SI():\n\treturn sys.stdin.readline()[:-1]\nfor _ in range(II()):\n\tx = II()\n\tfor i in range(1, 10 ** 6):\n\t\td = 2 ** i - 1\n\t\ts = d * (d + 1) // 2\n\t\tif s > x:\n\t\t\tprint(i - 1)\n\t\t\tbreak\n\t\tx -= s\n", "for _ in range(int(input())):\n\tx = int(input()) - 1\n\tn = 3\n\tans = 1\n\twhile x > 0:\n\t\tif n * (n + 1) // 2 <= x:\n\t\t\tx -= n * (n + 1) // 2\n\t\telse:\n\t\t\tbreak\n\t\tn = n * 2 + 1\n\t\tans += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tl = [1]\n\tnum = 1\n\tfor i in range(40):\n\t\tnum = 2 * num\n\t\tl.append(num ** 2 + 2 * l[-1])\n\tsm = [0] * len(l)\n\tsm[0] = l[0]\n\tfor i in range(1, len(l)):\n\t\tsm[i] = l[i] + sm[i - 1]\n\tans = 0\n\tfor i in range(len(sm)):\n\t\tif sm[i] > n:\n\t\t\tans = i\n\t\t\tbreak\n\tif n == 1:\n\t\tprint(1)\n\telse:\n\t\tprint(ans)\n", "def func(n):\n\tif n == 1:\n\t\tprint(1)\n\t\treturn\n\tcount = 1\n\tprev = 1\n\ttwo = 2\n\tn -= 1\n\twhile 2 * prev + two ** 2 <= n:\n\t\tn -= 2 * prev + two ** 2\n\t\tcount += 1\n\t\tprev = 2 * prev + two ** 2\n\t\ttwo *= 2\n\tprint(count)\n\treturn\nt = int(input())\nfor _ in range(t):\n\tl = int(input())\n\tfunc(l)\n", "def iinput():\n\treturn [int(i) for i in input().split()]\npref = []\nsuma = 0\nfor i in range(30):\n\tfor j in range(i, 2 * i + 1):\n\t\tsuma += 2 ** j\n\tpref += [suma]\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tfor i in range(30):\n\t\tif pref[i] > x:\n\t\t\tprint(i)\n\t\t\tbreak\n\telse:\n\t\tprint(30)\n", "q = int(input())\nwhile q:\n\tq -= 1\n\tk = 1\n\tx = int(input())\n\tans = 0\n\twhile x - k * (k + 1) // 2 >= 0:\n\t\tans += 1\n\t\tx -= k * (k + 1) // 2\n\t\tk = 2 * k + 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tx = 0\n\tc = 0\n\tl = []\n\tt = 0\n\twhile True:\n\t\tx = x * 2 + 1\n\t\tt = x * (x + 1) // 2\n\t\tif t > n:\n\t\t\tbreak\n\t\telif t == n:\n\t\t\tc = c + 1\n\t\t\tbreak\n\t\telse:\n\t\t\tn = n - t\n\t\t\tc = c + 1\n\tprint(c)\n", "import sys\nfrom collections import defaultdict\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\tx = 1\n\tc = 0\n\twhile True:\n\t\tx *= 2\n\t\ty = x * (x - 1) // 2\n\t\tif y <= n:\n\t\t\tn -= y\n\t\telse:\n\t\t\tbreak\n\t\tc += 1\n\tprint(c)\n", "def solve():\n\tx = int(input())\n\tc = 0\n\tp = 1\n\twhile p * (p + 1) // 2 <= x:\n\t\tx -= p * (p + 1) // 2\n\t\tc += 1\n\t\tp = p + p + 1\n\tprint(c)\nt = int(input())\ni = 0\nwhile i < t:\n\tsolve()\n\ti += 1\n", "for _ in range(int(input())):\n\tn = int(input())\n\ti = 1\n\thave = 0\n\tans = 0\n\twhile have + i * (i + 1) // 2 <= n:\n\t\thave += i * (i + 1) // 2\n\t\tans += 1\n\t\ti = i * 2 + 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\ti = 1\n\ts = 0\n\ta = pow(2, i) - 1\n\tb = a * (a + 1) // 2\n\twhile x >= b:\n\t\ts += 1\n\t\tx -= b\n\t\ti += 1\n\t\ta = pow(2, i) - 1\n\t\tb = a * (a + 1) // 2\n\tprint(s)\n", "import bisect\nbis = bisect.bisect_right\na = 1\nl = []\nl.append(0)\nfor i in range(1, 35):\n\ta = a * 2\n\tk = a - 1\n\tn = k * (k + 1)\n\tn = n // 2\n\tl.append(n)\nl1 = l[:]\nl = [l1[0]]\nfor i in l1[1:]:\n\tl.append(i + l[-1])\nfor _ in range(int(input())):\n\tn = int(input())\n\tind = 0\n\tind = bis(l, n)\n\tind = ind - 1\n\tprint(ind)\n", "import time, math as mt, bisect as bs, sys\nfrom sys import stdin, stdout\nfrom collections import deque\nfrom fractions import Fraction\nfrom collections import Counter\nfrom collections import OrderedDict\npi = 3.141592653589793\n\ndef II():\n\treturn int(stdin.readline())\n\ndef IP():\n\treturn map(int, stdin.readline().split())\n\ndef L():\n\treturn list(map(int, stdin.readline().split()))\n\ndef P(x):\n\treturn stdout.write(str(x) + '\\n')\n\ndef PI(x, y):\n\treturn stdout.write(str(x) + ' ' + str(y) + '\\n')\n\ndef lcm(a, b):\n\treturn a * b // gcd(a, b)\n\ndef gcd(a, b):\n\tif a == 0:\n\t\treturn b\n\telif b == 0:\n\t\treturn a\n\tif a > b:\n\t\treturn gcd(a % b, b)\n\telse:\n\t\treturn gcd(a, b % a)\n\ndef bfs(adj, v):\n\tvisited = [False] * (v + 1)\n\tq = deque()\n\twhile q:\n\t\tpass\n\ndef sieve():\n\tli = [True] * (2 * 10 ** 5 + 5)\n\t(li[0], li[1]) = (False, False)\n\tfor i in range(2, len(li), 1):\n\t\tif li[i] == True:\n\t\t\tfor j in range(i * i, len(li), i):\n\t\t\t\tli[j] = False\n\tprime = []\n\tfor i in range(2 * 10 ** 5 + 5):\n\t\tif li[i] == True:\n\t\t\tprime.append(i)\n\treturn prime\n\ndef setBit(n):\n\tcount = 0\n\twhile n != 0:\n\t\tn = n & n - 1\n\t\tcount += 1\n\treturn count\nmx = 10 ** 7\nspf = [mx] * (mx + 1)\n\ndef SPF():\n\tspf[1] = 1\n\tfor i in range(2, mx + 1):\n\t\tif spf[i] == mx:\n\t\t\tspf[i] = i\n\t\t\tfor j in range(i * i, mx + 1, i):\n\t\t\t\tif i < spf[j]:\n\t\t\t\t\tspf[j] = i\n\treturn\n\ndef readTree(n, e):\n\tadj = [set() for i in range(n + 1)]\n\tfor i in range(e):\n\t\t(u1, u2) = IP()\n\t\tadj[u1].add(u2)\n\treturn adj\nmod = 10 ** 9 + 7\n\ndef solve():\n\tx = II()\n\ttot = 0\n\tstart = 1\n\tj = 1\n\tfor i in range(1, 10000000):\n\t\ttot += start * (start + 1) // 2\n\t\tif tot > x:\n\t\t\tprint(i - 1)\n\t\t\treturn\n\t\tstart += 2 ** j\n\t\tj += 1\nt = II()\nfor i in range(t):\n\tsolve()\n", "import sys\nimport math\n\ndef find_sum(x):\n\treturn x * (x + 1) // 2\n\ndef solve(n):\n\tnum = 1\n\ttotal = 0\n\twhile total < n:\n\t\tval = find_sum(pow(2, num) - 1)\n\t\tif total + val <= n:\n\t\t\ttotal += val\n\t\telse:\n\t\t\tbreak\n\t\tnum += 1\n\treturn num - 1\nt = int(sys.stdin.readline())\nans_arr = []\nfor i in range(t):\n\tx = int(sys.stdin.readline())\n\tanswer = solve(x)\n\tans_arr.append(str(answer))\nprint('\\n'.join(ans_arr))\n", "t = int(input())\nfor i in range(t):\n\tx = int(input())\n\tbase = 2\n\twidth = base - 1\n\tcells = width * (width + 1) // 2\n\ttot = 0\n\twhile cells <= x:\n\t\ttot += 1\n\t\tbase *= 2\n\t\twidth = base - 1\n\t\tcells += width * (width + 1) // 2\n\tprint(tot)\n", "import math\nt = int(input())\nw = []\nfor i in range(t):\n\tx = int(input())\n\tn = 1\n\twhile (4 ** (n + 1) - 3 * 2 ** (n + 1) + 2) // 6 <= x:\n\t\tn = n + 1\n\tn = n - 1\n\tw.append(n)\nfor i in w:\n\tprint(i)\n", "def ok(x):\n\treturn 2 ** (x - 1) * (2 ** x - 1)\nt = int(input())\nfor test in range(t):\n\tx = int(input())\n\ta = []\n\tfor i in range(1, 40):\n\t\ta.append(ok(i))\n\tsm = 0\n\tcnt = 0\n\tfor z in a:\n\t\tif sm + z > x:\n\t\t\tbreak\n\t\telse:\n\t\t\tsm += z\n\t\t\tcnt += 1\n\tprint(cnt)\n", "for i in range(int(input())):\n\tn = int(input())\n\tans = 0\n\tf = 1\n\tcur = 0\n\tz = 1\n\twhile cur <= n:\n\t\tcur += f * (f + 1) // 2\n\t\tans += 1\n\t\tz *= 2\n\t\tf += z\n\tif cur > n:\n\t\tans -= 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\t(a, s) = (0, 0)\n\tfor i in range(1, n + 1):\n\t\tsmal = 2 ** i - 1\n\t\tssum = smal * (smal + 1) // 2\n\t\tif s + ssum > n:\n\t\t\tbreak\n\t\ts += ssum\n\t\ta += 1\n\tprint(a)\n", "import itertools\nimport math\nimport sys\nfrom collections import defaultdict\n\ndef stdinWrapper():\n\tdata = '4\\n1\\n8\\n6\\n1000000000000000000\\n'\n\tfor line in data.split('\\n'):\n\t\tyield line\nif '--debug' not in sys.argv:\n\n\tdef stdinWrapper():\n\t\twhile True:\n\t\t\tyield input()\ninputs = stdinWrapper()\n\ndef inputWrapper():\n\treturn next(inputs)\n\ndef getType(_type):\n\treturn _type(inputWrapper())\n\ndef getArray(_type):\n\treturn [_type(x) for x in inputWrapper().split()]\n\ndef solve(n):\n\tresult = 0\n\tfor x in range(30):\n\t\tcells = sum([pow(4, i) * pow(2, x - i) for i in range(x + 1)])\n\t\tif cells <= n:\n\t\t\tn -= cells\n\t\t\tresult += 1\n\t\telse:\n\t\t\tbreak\n\treturn result\nt = getType(int)\nfor _ in range(t):\n\tn = getType(int)\n\tres = solve(n)\n\tprint(res)\n", "import sys\nreader = (s.rstrip() for s in sys.stdin)\ninput = reader.__next__\n\ndef gift():\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\tstart = 1\n\t\tacum = 0\n\t\tans = 0\n\t\twhile True:\n\t\t\ttis = (start + 1) * start // 2\n\t\t\tif tis + acum <= n:\n\t\t\t\tacum += tis\n\t\t\t\tans += 1\n\t\t\t\tstart += 2 ** ans\n\t\t\telse:\n\t\t\t\tbreak\n\t\tyield ans\nt = int(input())\nans = gift()\nprint(*ans, sep='\\n')\n", "def process():\n\tn = int(input())\n\tc = 0\n\tsz = 1\n\twhile sz * (sz + 1) // 2 <= n:\n\t\tc += 1\n\t\tn -= sz * (sz + 1) // 2\n\t\tsz += sz + 1\n\treturn c\ntests = int(input())\nfor i in range(tests):\n\tprint(process())\n", "import sys\nimport random\nfrom fractions import Fraction\nfrom math import *\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef iinput():\n\treturn int(input())\n\ndef finput():\n\treturn float(input())\n\ndef tinput():\n\treturn input().split()\n\ndef linput():\n\treturn list(input())\n\ndef rinput():\n\treturn map(int, tinput())\n\ndef fiinput():\n\treturn map(float, tinput())\n\ndef rlinput():\n\treturn list(map(int, input().split()))\n\ndef trinput():\n\treturn tuple(rinput())\n\ndef srlinput():\n\treturn sorted(list(map(int, input().split())))\n\ndef NOYES(fl):\n\tif fl:\n\t\tprint('NO')\n\telse:\n\t\tprint('YES')\n\ndef YESNO(fl):\n\tif fl:\n\t\tprint('YES')\n\telse:\n\t\tprint('NO')\n\ndef main():\n\tn = iinput()\n\t(s, t, res) = (1, 1, 0)\n\twhile s <= n:\n\t\tres += 1\n\t\tn -= s\n\t\tt = 2 * t + 1\n\t\ts = t * (t + 1) // 2\n\tprint(res)\nfor i in range(iinput()):\n\tmain()\n", "import sys\n\ndef main():\n\ttn = int(input())\n\tfor ti in range(tn):\n\t\tn = int(input())\n\t\ti = 1\n\t\tans = 0\n\t\twhile n >= i * (i + 1) // 2:\n\t\t\tn -= i * (i + 1) // 2\n\t\t\tans += 1\n\t\t\ti = i * 2 + 1\n\t\tprint(ans)\nmain()\n", "import math\nn = input()\nnumarr = []\nfor i in range(int(n)):\n\tnumarr.append(int(input()))\nfor num in numarr:\n\tcount = 0\n\tit = 1\n\twhile num > 0:\n\t\tcubes = 2 * (it * it) - it\n\t\tif num >= cubes:\n\t\t\tnum -= cubes\n\t\t\tit *= 2\n\t\t\tcount += 1\n\t\telse:\n\t\t\tbreak\n\tprint(count)\n", "def prog(x):\n\treturn int((1 + x) * x * 0.5)\nfor something in range(int(input())):\n\tn = int(input())\n\tans = 0\n\ti = 1\n\twhile n >= prog(i):\n\t\tn -= prog(i)\n\t\ti = 2 * i + 1\n\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tt = t - 1\n\tn = int(input())\n\tsum = 0\n\ti = 0\n\tallsum = 0\n\twhile True:\n\t\tsum = sum * 2 + int(2 ** i)\n\t\tallsum += sum\n\t\tif n < allsum:\n\t\t\tbreak\n\t\ti = i + 2\n\tprint(i // 2)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tc = 0\n\ta = []\n\tfor i in range(1, 31):\n\t\tv = 2 ** i - 1\n\t\tc += v * (v + 1) // 2\n\t\ta.append(c)\n\tc = 0\n\tfor i in a:\n\t\tif n < i:\n\t\t\tbreak\n\t\tc += 1\n\tprint(c)\n", "import io\nimport os\nfrom collections import Counter, defaultdict, deque\n\ndef solve(X):\n\tn = 1\n\tsizes = [1]\n\twhile sizes[-1] <= 10 ** 18:\n\t\tsizes.append(sizes[-1] * 2 + (n + 1) * (n + 1))\n\t\tn = 2 * n + 1\n\tcount = 0\n\tfor x in sizes:\n\t\tif X < x:\n\t\t\tbreak\n\t\tX -= x\n\t\tcount += 1\n\treturn count\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nTC = int(input())\nfor tc in range(1, TC + 1):\n\t(X,) = [int(x) for x in input().split()]\n\tans = solve(X)\n\tprint(ans)\n", "def solve():\n\td = 1\n\tx = int(input())\n\tp = 1\n\tans = 0\n\twhile x >= d:\n\t\tx -= d\n\t\tp *= 2\n\t\td = p * p + d * 2\n\t\tans += 1\n\tprint(ans)\nt = int(input())\nfor _ in range(t):\n\tsolve()\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = 0\n\tk = 0\n\tfor i in range(31):\n\t\ts = s + 2 ** i\n\t\tif s * (s + 1) // 2 + k == n:\n\t\t\tprint(i + 1)\n\t\t\tbreak\n\t\telif s * (s + 1) // 2 + k > n:\n\t\t\tprint(i)\n\t\t\tbreak\n\t\tk = k + s * (s + 1) // 2\n", "import math\nfrom collections import deque\nfrom collections import defaultdict\nt = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\tcnt = math.floor(math.log(n + 1, 2))\n\tarr = []\n\tfor i in range(1, cnt + 1):\n\t\tk = (1 << i) - 1\n\t\tarr.append(k * (k + 1) // 2)\n\tans = 0\n\tsm = 0\n\tfor i in range(len(arr)):\n\t\tsm += arr[i]\n\t\tif sm > n:\n\t\t\tans = i\n\t\t\tbreak\n\tif sm <= n:\n\t\tans = len(arr)\n\tprint(ans)\n", "from math import log2, floor, sqrt, ceil\n\ndef ans(x):\n\treturn ceil((sqrt(8 * x) - 1) / 2)\n\ndef fun(n):\n\treturn int(n * (n + 1) / 2)\nfor _ in range(int(input())):\n\tN = int(input())\n\tp = 1\n\tcount = 0\n\twhile N > 0:\n\t\tN -= fun(2 ** p - 1)\n\t\tp += 1\n\t\tif N >= 0:\n\t\t\tcount += 1\n\tprint(count)\n", "from sys import stdin, stdout\nimport math\n\ndef main():\n\tt = int(input())\n\tarr = [0]\n\tfor m in range(60):\n\t\tarr.append((2 ** m) ** 2 + 2 * arr[-1])\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\t(i, s) = (0, 0)\n\t\twhile i < len(arr):\n\t\t\ts += arr[i]\n\t\t\tif s > n:\n\t\t\t\tbreak\n\t\t\ti += 1\n\t\tprint(i - 1)\nmain()\n", "for ik in range(int(input())):\n\tn = int(input())\n\tt = 2\n\tans = 0\n\twhile n >= 0:\n\t\tif n >= t * (t - 1) // 2:\n\t\t\tn -= t * (t - 1) // 2\n\t\t\tt *= 2\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\tfor d in range(1, 31):\n\t\tn = 2 ** d - 1\n\t\tx -= n * (n + 1) // 2\n\t\tif x >= 0:\n\t\t\tans += 1\n\t\tif x <= 0:\n\t\t\tbreak\n\tprint(ans)\n", "def solve():\n\tn = int(input())\n\tp = 1\n\tcnt = 0\n\ts = 0\n\twhile (s + p + 1) * (s + p) // 2 <= n:\n\t\tn -= (s + p + 1) * (s + p) // 2\n\t\ts += p\n\t\tp *= 2\n\t\tcnt += 1\n\tprint(cnt)\nt = int(input())\nwhile t > 0:\n\tsolve()\n\tt -= 1\n", "def main():\n\tx = int(input())\n\tcnt = 0\n\tcur = 1\n\twhile x > 0:\n\t\tif cur * (cur + 1) <= x * 2:\n\t\t\tcnt += 1\n\t\t\tx -= cur * (cur + 1) // 2\n\t\t\tcur = cur * 2 + 1\n\t\telse:\n\t\t\tbreak\n\tprint(cnt)\nt = int(input())\nfor i in range(t):\n\tmain()\n", "for _ in range(int(input())):\n\tx = int(input())\n\tcount = 0\n\twhile x >= 0:\n\t\tx -= 2 * (2 ** count) ** 2 - 2 ** count\n\t\tcount += 1\n\tprint(count - 1)\n", "for i in range(int(input())):\n\tx = int(input())\n\tbox = int(1)\n\tans = int(0)\n\twhile 1:\n\t\ttut = box * (box + 1) // 2\n\t\tif tut <= x:\n\t\t\tx -= tut\n\t\t\tbox += box + 1\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "from bisect import bisect_right\nt = int(input())\na = []\ns = 0\nx = 2\nwhile s <= 10 ** 18:\n\ts += x * (x - 1) // 2\n\ta.append(s)\n\tx *= 2\nfor _ in range(t):\n\tprint(bisect_right(a, int(input())))\n", "from itertools import count as _count\nimport sys as _sys\n\ndef main():\n\tt = int(input())\n\tfor i_t in range(t):\n\t\t(x,) = _read_ints()\n\t\tstairs_can_build = 0\n\t\tfor i_curr_stairs in _count():\n\t\t\tcurr_stairs_n = 2 ** (i_curr_stairs + 1) - 1\n\t\t\tcells_need = curr_stairs_n * (curr_stairs_n + 1) // 2\n\t\t\tif cells_need > x:\n\t\t\t\tbreak\n\t\t\tx -= cells_need\n\t\t\tstairs_can_build += 1\n\t\tprint(stairs_can_build)\n\ndef _read_line():\n\tresult = _sys.stdin.readline()\n\tassert result[-1] == '\\n'\n\treturn result[:-1]\n\ndef _read_ints():\n\treturn map(int, _read_line().split(' '))\nmain()\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tarr = [0 for i in range(100)]\n\tif n < 35:\n\t\tif n < 7:\n\t\t\tprint(1)\n\t\telse:\n\t\t\tprint(2)\n\telse:\n\t\tarr[0] = 1\n\t\tarr[1] = 3\n\t\tn = n - 7\n\t\tfor i in range(2, 100):\n\t\t\tarr[i] = arr[i - 1] + (arr[i - 1] - arr[i - 2]) * 2\n\t\t\tn = n - arr[i] * (arr[i] + 1) // 2\n\t\t\tif n < 0:\n\t\t\t\tprint(i)\n\t\t\t\tbreak\n", "T = int(input())\nfor case in range(0, T):\n\tans = 0\n\tn = int(input())\n\tk = 2\n\twhile True:\n\t\tx = k - 1\n\t\tres = (1 + x) * x // 2\n\t\tif n >= res:\n\t\t\tn -= res\n\t\telse:\n\t\t\tbreak\n\t\tans += 1\n\t\tk *= 2\n\tprint(ans)\n", "for t in range(int(input())):\n\tx = int(input())\n\ts = 1\n\tc = 0\n\twhile s * (s + 1) // 2 <= x:\n\t\tc += 1\n\t\tx -= s * (s + 1) // 2\n\t\ts = 2 * s + 1\n\tprint(c)\n", "import sys\ninput = sys.stdin.readline\nins = lambda : input().rstrip()\nini = lambda : int(input().rstrip())\ninm = lambda : map(int, input().rstrip().split())\ninl = lambda : list(map(int, input().split()))\nout = lambda x, s='\\n': print(s.join(map(str, x)))\noutput = []\nt = ini()\nfor _ in range(t):\n\tn = ini()\n\tans = 0\n\tnice = 1\n\twhile n > 0:\n\t\tx = nice * (nice + 1) // 2\n\t\tif n - x >= 0:\n\t\t\tn -= x\n\t\t\tans += 1\n\t\t\tnice = nice * 2 + 1\n\t\telse:\n\t\t\tbreak\n\toutput.append(ans)\nout(output)\n", "T = int(input())\nfor Tid in range(T):\n\tn = int(input())\n\tt = 1\n\tans = 0\n\twhile n >= t * (t + 1) // 2:\n\t\tn = n - t * (t + 1) // 2\n\t\tans = ans + 1\n\t\tt = t * 2 + 1\n\tprint(ans)\n", "import os, sys\nfrom io import BytesIO, IOBase\nfrom bisect import bisect_right\n\ndef main():\n\tsu = [1]\n\tr = 3\n\twhile su[-1] <= 10 ** 18:\n\t\tsu.append(su[-1] + r * (r + 1) // 2)\n\t\tr = 2 * r + 1\n\tfor _ in range(int(input())):\n\t\tx = int(input())\n\t\ty = bisect_right(su, x)\n\t\tprint(y)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tconsumed = 1\n\treqcol = 1\n\tcount = 1\n\ttemp = 1\n\twhile True:\n\t\tif n < consumed:\n\t\t\tcount -= 1\n\t\t\tbreak\n\t\telif n == consumed:\n\t\t\tbreak\n\t\treqcol += temp * 2\n\t\ttemp *= 2\n\t\tconsumed += reqcol * (reqcol + 1) // 2\n\t\tcount += 1\n\tprint(count)\n", "cnts = [1]\ncurr_2_sum = 1\ncsum = 1\nfor i in range(1, 50):\n\tcurr_2_sum += 2 ** i\n\tv = (1 + curr_2_sum) * curr_2_sum // 2\n\tcsum += v\n\tif csum > 10 ** 18:\n\t\tbreak\n\telse:\n\t\tcnts.append(csum)\nansl = []\nfor _ in range(int(input())):\n\tn = int(input())\n\tfor i in range(30):\n\t\tif cnts[i] > n:\n\t\t\tansl.append(i)\n\t\t\tbreak\n\telse:\n\t\tansl.append(30)\nfor ans in ansl:\n\tprint(ans)\n", "import sys\nimport os\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmod = 10 ** 9 + 7\n\ndef lcm(x, y):\n\treturn x * y / gcd(x, y)\n\ndef fact(x, mod=mod):\n\tans = 1\n\tfor i in range(1, x + 1):\n\t\tans = ans * i % mod\n\treturn ans\n\ndef arr2D(n, m, default=0):\n\tlst = []\n\tfor i in range(n):\n\t\ttemp = [default] * m\n\t\tlst.append(temp)\n\treturn lst\n\ndef sortDictV(x):\n\treturn {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}\nfrom decimal import Decimal as d\n\ndef solve(n):\n\ti = 1\n\tcnt = 0\n\twhile n >= i * (i + 1) / 2:\n\t\tn -= d(i * d(i + 1) / 2)\n\t\ti = d(i * 2) + 1\n\t\tcnt += 1\n\treturn cnt\nfor _ in range(int(input())):\n\tn = int(input())\n\tprint(solve(n))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tres = 0\n\ti = 1\n\tx = 1\n\twhile True:\n\t\tn -= x * (x + 1) // 2\n\t\tif n < 0:\n\t\t\tbreak\n\t\tx += 2 ** i\n\t\ti += 1\n\t\tres += 1\n\tprint(res)\n", "import bisect\nt = int(input())\nnum = 1e+18\nnice = []\nstart = 1\ns = 1\nl = 1\nwhile s < num:\n\tnice.append(s)\n\tstart = (l + 1) * (l + 1) + 2 * start\n\ts += start\n\tl = l + 1 + l\nnice.append(s)\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = 0\n\ti = 0\n\tprint(bisect.bisect_right(nice, n))\n", "def f(n):\n\treturn n * (n - 1) // 2\nfor _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\ti = 2\n\twhile x - f(i) >= 0:\n\t\tx -= f(i)\n\t\ti *= 2\n\t\tans += 1\n\tprint(ans)\n", "import sys\nimport bisect\nimport math\nfrom collections import deque\ninput = lambda : sys.stdin.readline().strip()\nmod = 10 ** 9 + 7\n\ndef solve():\n\tn = int(input())\n\t(s, count, i) = (0, 0, 2)\n\twhile s < n:\n\t\ts += (i - 1) * i // 2\n\t\tif s <= n:\n\t\t\tcount += 1\n\t\ti *= 2\n\treturn count\nt = 1\nt = int(input())\nfor _ in range(t):\n\tprint(solve())\n", "from sys import stdin, stdout\n\nclass Input:\n\n\tdef __init__(self):\n\t\tself.lines = stdin.read().splitlines()\n\t\tself.idx = 0\n\n\tdef line(self):\n\t\ttry:\n\t\t\treturn self.lines[self.idx]\n\t\tfinally:\n\t\t\tself.idx += 1\n\n\tdef array(self, sep=' ', cast=int):\n\t\treturn list(map(cast, self.line().split(sep=sep)))\n\n\tdef known_tests(self):\n\t\t(num_of_cases,) = self.array()\n\t\tfor case in range(num_of_cases):\n\t\t\tyield self\n\n\tdef unknown_tests(self):\n\t\twhile self.idx < len(self.lines):\n\t\t\tyield self\n\nclass Problem:\n\n\tdef __init__(self):\n\t\tself.oo = float('inf')\n\n\tdef gcd(self, a, b):\n\t\treturn a if b == 0 else self.gcd(b, a % b)\n\n\tdef modpow(self, a, n, m):\n\t\tans = 1\n\t\twhile n:\n\t\t\tif n & 1:\n\t\t\t\tans = ans * a % m\n\t\t\tn >>= 1\n\t\t\ta = a * a % m\n\t\treturn ans\n\n\tdef solve(self, n):\n\t\tans = 0\n\t\ts = 1\n\t\tc = 1\n\t\twhile n >= c:\n\t\t\tans += 1\n\t\t\tn -= c\n\t\t\tc *= 2\n\t\t\ts *= 2\n\t\t\tc += s * s\n\t\tprint(ans)\ntry:\n\tp = Problem()\n\tfor tc in Input().known_tests():\n\t\tp.solve(*tc.array())\nexcept Exception as e:\n\timport traceback\n\ttraceback.print_exc(file=stdout)\n", "a = [0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827, 3074457343470774955, 12297829378178067115]\ny122 = int(input())\nfor __ in range(y122):\n\tn = int(input())\n\ti = 0\n\twhile a[i] <= n:\n\t\ti += 1\n\tprint(i - 1)\n", "import sys\ninp = sys.stdin.readline\nout = sys.stdout.write\n\ndef mi():\n\treturn map(int, inp().split())\n\ndef li():\n\treturn list(mi())\n\ndef ii():\n\treturn int(inp())\n\ndef main():\n\tfor _ in range(ii()):\n\t\tx = ii()\n\t\tc = 1\n\t\to = 0\n\t\twhile x >= 0:\n\t\t\tx -= c * (c + 1) // 2\n\t\t\to += 1\n\t\t\tc = 2 * c + 1\n\t\tprint(o - 1)\nmain()\n", "for _ in range(int(input())):\n\tn = int(input())\n\t(ans, tmp) = (0, 1)\n\twhile n >= 0:\n\t\tn -= tmp * (tmp + 1) // 2\n\t\tans += 1\n\t\ttmp = 2 * tmp + 1\n\tprint(ans - 1)\n", "def read_line():\n\treturn list(map(int, input().split()))\nasdf = []\nv = 1\nwhile v <= int(1e+18) + 5:\n\tasdf.append(v * (v + 1) // 2)\n\tv = v * 2 + 1\nT = int(input())\nfor _ in range(T):\n\tn = int(input())\n\tans = 0\n\tidx = 0\n\twhile n > 0:\n\t\tn -= asdf[idx]\n\t\tidx += 1\n\t\tif n >= 0:\n\t\t\tans += 1\n\tprint(ans)\n", "import math\nt = int(input())\np = 0\nx = 0\nfor r in range(t):\n\tn = int(input())\n\tl = []\n\tc = 0\n\tx = 0\n\tp = 0\n\tfor i in range(100):\n\t\tx += int(math.pow(2, i))\n\t\tp = x * (x + 1) // 2\n\t\tl.append(p)\n\t\tif p >= n:\n\t\t\tbreak\n\tfor i in range(len(l)):\n\t\tif sum(l[0:i]) <= n:\n\t\t\tc = i\n\tif len(l) == 1:\n\t\tc = 1\n\tprint(c)\n", "t = int(input())\na = []\nt2 = 1\nfor i in range(1, 100):\n\ta.append(t2 * (2 * t2 - 1))\n\tt2 *= 2\nfor _ in range(t):\n\tn = int(input())\n\ti = 0\n\twhile n >= a[i]:\n\t\tn -= a[i]\n\t\ti += 1\n\tprint(i)\n", "def read_int():\n\treturn int(input())\nt = read_int()\nfor case_num in range(t):\n\tx = read_int()\n\tans = 0\n\tlevel = 1\n\tneed = 1\n\twhile x >= need:\n\t\tx -= need\n\t\tans += 1\n\t\tlevel = level * 2 + 1\n\t\tneed = level * (level + 1) // 2\n\tprint(ans)\n", "import sys\nii = lambda : sys.stdin.readline().strip()\nidata = lambda : [int(x) for x in ii().split()]\n\ndef solve():\n\tans = 0\n\tcnt = 1\n\ts = 1\n\tn = int(ii())\n\twhile s <= n:\n\t\tcnt = 2 * cnt + 1\n\t\tans += 1\n\t\tn -= s\n\t\ts = cnt * (cnt + 1) // 2\n\tprint(ans)\n\treturn\nfor t in range(int(ii())):\n\tsolve()\n", "t = int(input())\nwhile t:\n\tt -= 1\n\ta = int(input())\n\tn = 1\n\tnnn = 1\n\tcnt = 0\n\twhile a >= nnn:\n\t\ta -= nnn\n\t\tn = n * 2 + 1\n\t\tnnn = n * (n + 1) // 2\n\t\tcnt += 1\n\tprint(cnt)\n", "for i in range(int(input())):\n\tn = int(input())\n\tr = 0\n\tres = 0\n\ti = 1\n\tct = 2\n\twhile True:\n\t\tc = i * (i + 1) // 2\n\t\tif c + r <= n:\n\t\t\tres += 1\n\t\t\tr += c\n\t\telse:\n\t\t\tbreak\n\t\ti = 2 * i + 1\n\tprint(res)\n", "import bisect\nt = int(input())\nnumb = [1]\ncost = [1]\nwhile cost[-1] < 10 ** 19:\n\tnumb.append(numb[-1] * 2 + 1)\n\tcost.append(cost[-1] + numb[-1] * (numb[-1] + 1) // 2)\nfor _ in range(t):\n\tn = int(input())\n\tprint(bisect.bisect_right(cost, n))\n", "import math\nfor _ in range(int(input())):\n\tn = int(input())\n\tcount = 0\n\ti = 1\n\twhile n > 0:\n\t\tx = 2 ** i - 1\n\t\tm = x * (x + 1) // 2\n\t\tn = n - m\n\t\tif n < 0:\n\t\t\tbreak\n\t\tcount += 1\n\t\ti += 1\n\tprint(count)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\nt = inp()\nfor m in range(t):\n\tn = inp()\n\tsomme = 0\n\tite = 0\n\tu = 0\n\twhile somme < n:\n\t\tu = 2 * u + 2 ** (2 * ite)\n\t\tsomme = somme + u\n\t\tite += 1\n\tif somme > n:\n\t\tite -= 1\n\tprint(ite)\n", "from sys import stdin, stdout\nimport math, sys, heapq\nfrom itertools import permutations, combinations\nfrom collections import defaultdict, deque, OrderedDict\nfrom os import path\nimport random\nimport bisect as bi\n\ndef yes():\n\tprint('YES')\n\ndef no():\n\tprint('NO')\nif path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\n\n\tdef I():\n\t\treturn int(input())\n\n\tdef In():\n\t\treturn map(int, input().split())\nelse:\n\n\tdef I():\n\t\treturn int(stdin.readline())\n\n\tdef In():\n\t\treturn map(int, stdin.readline().split())\n\ndef dict(a):\n\td = {}\n\tfor x in a:\n\t\tif d.get(x, -1) != -1:\n\t\t\td[x] += 1\n\t\telse:\n\t\t\td[x] = 1\n\treturn d\n\ndef find_gt(a, x):\n\ti = bi.bisect_left(a, x)\n\tif i != len(a):\n\t\treturn i\n\telse:\n\t\treturn -1\n\ndef main():\n\ttry:\n\t\tans = 0\n\t\ttemp = 1\n\t\tn = I()\n\t\ti = 1\n\t\twhile n > 0:\n\t\t\tif n >= temp:\n\t\t\t\tans += 1\n\t\t\t\tn -= temp\n\t\t\t\ttemp = 2 ** (i * 2) + 2 * temp\n\t\t\telse:\n\t\t\t\tbreak\n\t\t\ti += 1\n\t\tprint(ans)\n\texcept:\n\t\tpass\nM = 998244353\nP = 1000000007\nfor _ in range(I()):\n\tmain()\n", "from math import ceil\nfrom sys import stdin, stdout, setrecursionlimit\nfrom random import randint\nfor _ in range(int(input())):\n\tn = int(input())\n\tcur = 1\n\tans = 0\n\twhile True:\n\t\tneed = cur * (cur + 1) // 2\n\t\tif need > n:\n\t\t\tbreak\n\t\tn -= need\n\t\tans += 1\n\t\tcur = cur * 2 + 1\n\tprint(ans)\n", "t = int(input())\nj = 1\nans = []\nwhile 2 ** j <= 10 ** 18:\n\tr = 2 ** j - 1\n\tans.append(r * (r + 1) // 2)\n\tj += 1\nfor i in range(t):\n\tn = int(input())\n\ttot = 0\n\tj = 0\n\twhile n > 0:\n\t\tif ans[j] <= n:\n\t\t\ttot += 1\n\t\t\tn -= ans[j]\n\t\telse:\n\t\t\tbreak\n\t\tj += 1\n\tprint(tot)\n", "import sys\ninput = sys.stdin.readline\n\ndef print(val):\n\tsys.stdout.write(str(val) + '\\n')\n\ndef prog():\n\tcan_make = [(2 << i) - 1 for i in range(31)]\n\tfor _ in range(int(input())):\n\t\tx = int(input())\n\t\tamt = 0\n\t\tfor i in range(31):\n\t\t\tif x >= can_make[i] * (can_make[i] + 1) // 2:\n\t\t\t\tx -= can_make[i] * (can_make[i] + 1) // 2\n\t\t\t\tamt += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tprint(amt)\nprog()\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tj = 0\n\ta = 4\n\tneed = 1\n\twhile need <= x:\n\t\tj += 1\n\t\tneed += a * (a - 1) // 2\n\t\ta *= 2\n\tprint(j)\n", "import sys\nfrom copy import *\nfrom bisect import *\n\ndef eprint(*args):\n\tprint(*args, file=sys.stderr)\nzz = 1\nif zz:\n\tinput = sys.stdin.readline\nelse:\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('all.txt', 'w')\ndi = [[-1, 0], [1, 0], [0, 1], [0, -1]]\n\ndef inc(d, c, x=1):\n\td[c] = d[c] + x if c in d else x\n\ndef bo(i):\n\treturn ord(i) - ord('A')\n\ndef li():\n\treturn [int(xx) for xx in input().split()]\n\ndef fli():\n\treturn [float(x) for x in input().split()]\n\ndef comp(a, b):\n\tif a > b:\n\t\treturn 2\n\treturn 2 if a == b else 0\n\ndef gi():\n\treturn [xx for xx in input().split()]\n\ndef fi():\n\treturn int(input())\n\ndef pro(a):\n\treturn reduce(lambda a, b: a * b, a)\n\ndef swap(a, i, j):\n\t(a[i], a[j]) = (a[j], a[i])\n\ndef si():\n\treturn list(input().rstrip())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef gh():\n\tsys.stdout.flush()\n\ndef isvalid(i, j):\n\treturn 0 <= i < n and 0 <= j < m and (a[i][j] != '.')\n\ndef bo(i):\n\treturn ord(i) - ord('a')\n\ndef graph(n, m):\n\tfor i in range(m):\n\t\t(x, y) = mi()\n\t\ta[x].append(y)\n\t\ta[y].append(x)\nt = fi()\nwhile t > 0:\n\tt -= 1\n\tn = fi()\n\tc = ans = 0\n\tp = 1\n\twhile c + (p ** 2 + p) // 2 <= n:\n\t\tc += (p ** 2 + p) // 2\n\t\tans += 1\n\t\tp = 2 * p + 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tcurr = 1\n\ti = 0\n\twhile n >= curr:\n\t\ti += 1\n\t\tn = n - curr\n\t\tcurr = 2 * curr + pow(2, i) * pow(2, i)\n\tprint(i)\n", "pos = []\ni = 1\nwhile i < 10000000000:\n\tpos.append(i)\n\ti = i * 2 + 1\nranges = []\ni = 1\nj = 1\nk = 1\nwhile j < 10 ** 18:\n\ti = j\n\tj = j + pos[k] * (pos[k] + 1) // 2\n\tranges.append((i, j - 1, k))\n\tk += 1\nt = int(input())\nfor p in range(t):\n\tn = int(input())\n\tfor k in ranges:\n\t\tif k[0] <= n and k[1] >= n:\n\t\t\tprint(k[2])\n\t\t\tbreak\n", "arr = [0]\nfor i in range(1, 61):\n\tnum = 2 ** i - 1\n\tarr.append(num * (num + 1) // 2 + arr[i - 1])\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\t(lo, hi) = (1, 60)\n\twhile lo < hi - 1:\n\t\tmid = (lo + hi) // 2\n\t\tif arr[mid] <= x:\n\t\t\tlo = mid\n\t\telse:\n\t\t\thi = mid\n\tprint(lo)\n", "for _ in ' ' * int(input()):\n\ta = int(input())\n\tr = lambda x: x * (x + 1) // 2\n\ts = 1\n\tk = 1\n\ti = 1\n\ta -= 1\n\tf = 1\n\twhile 1:\n\t\tf += 2 * i\n\t\tif r(f) <= a:\n\t\t\ts += 1\n\t\t\ta -= r(f)\n\t\t\ti *= 2\n\t\telse:\n\t\t\tbreak\n\tprint(s)\n", "for _ in range(int(input())):\n\t(n, ans) = (int(input()), 0)\n\tfor i in range(1, 40):\n\t\tan = pow(2, i) - 1\n\t\tan = an * (an + 1) // 2\n\t\tif an > n:\n\t\t\tbreak\n\t\telse:\n\t\t\tn -= an\n\t\t\tans += 1\n\tprint(ans)\n", "l = []\nl.append(1)\nfor i in range(1, 34):\n\tl.append(2 * l[i - 1] + (2 ** i) ** 2)\nfor _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\ttemp = 0\n\tfor i in range(34):\n\t\tif temp + l[i] <= x:\n\t\t\ttemp += l[i]\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "from functools import reduce\nimport os\nimport sys\nfrom collections import *\nfrom math import *\nfrom bisect import *\nfrom heapq import *\nfrom io import BytesIO, IOBase\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef value():\n\treturn tuple(map(int, input().split()))\n\ndef arr():\n\treturn [int(i) for i in input().split()]\n\ndef sarr():\n\treturn [int(i) for i in input()]\n\ndef starr():\n\treturn [str(x) for x in input().split()]\n\ndef inn():\n\treturn int(input())\n\ndef svalue():\n\treturn tuple(map(str, input().split()))\n\ndef parr():\n\treturn [value() for i in range(n)]\nmo = 1000000007\nres = [1]\ntemp = 10 ** 18 + 1\nfor i in range(2, 60):\n\tsm = 2 ** i\n\tval = sm * (sm - 1) // 2\n\tres += [val + res[-1]]\nfor _ in range(inn()):\n\tn = inn()\n\tval = bisect_left(res, n)\n\tif res[val] == n:\n\t\tprint(val + 1)\n\telse:\n\t\tprint(val)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ti = 1\n\tstairs = 1\n\tres = 0\n\twhile n > 0:\n\t\tn -= stairs ** 2 - (stairs - 1) * stairs // 2\n\t\ti *= 2\n\t\tstairs += i\n\t\tres += 1\n\tif n < 0:\n\t\tres -= 1\n\tprint(res)\n", "import math\nfor _ in range(int(input())):\n\tn = int(input())\n\tx = 0\n\ttemp = 0\n\tp = 0\n\tans = 0\n\twhile temp <= n:\n\t\td = pow(2, x)\n\t\tp += d\n\t\ttemp1 = p * (p + 1) // 2\n\t\ttemp += temp1\n\t\tans += 1\n\t\tx += 1\n\tif temp > n:\n\t\ttemp -= temp1\n\t\tans -= 1\n\tprint(ans)\n", "from math import sqrt, log\nt = int(input())\nfor z in range(t):\n\tx = int(input())\n\ti = 1\n\tn = 1\n\tcount = 0\n\twhile n <= x:\n\t\tcount += 1\n\t\ti += 1\n\t\tx -= n\n\t\tn1 = (1 << i) - 1\n\t\tn = n1 * (n1 + 1) // 2\n\tprint(count)\n", "t = int(input())\nfor _ in range(t):\n\tbudget = int(input())\n\tans = 0\n\tpower = 1\n\twhile True:\n\t\tidx = 2 ** power - 1\n\t\tpower += 1\n\t\tcost = idx * (idx + 1) // 2\n\t\tif cost <= budget:\n\t\t\tans += 1\n\t\t\tbudget -= cost\n\t\t\tif budget <= 0:\n\t\t\t\tbreak\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "T = int(input())\nwhile T > 0:\n\tn = int(input())\n\tle = 1\n\tused = 0\n\tres = 0\n\twhile used < n:\n\t\tneed = (1 + le) * le // 2\n\t\tif used + need <= n:\n\t\t\tres += 1\n\t\tle = le * 2 + 1\n\t\tused += need\n\tprint(res)\n\tT -= 1\n", "l = []\nfor i in range(1, 34):\n\tl.append(2 ** i - 1)\nx = []\nfor i in l:\n\tx.append(i * (i + 1) // 2)\nt = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = 0\n\tc = 0\n\tfor i in range(0, 34):\n\t\tif s + x[i] > n:\n\t\t\tbreak\n\t\telif s + x[i] == n:\n\t\t\tc += 1\n\t\t\tbreak\n\t\telse:\n\t\t\ts += x[i]\n\t\t\tc += 1\n\tprint(c)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tprev = 0\n\toutput = 0\n\toutput += 1\n\tx -= 1\n\tprev = 1\n\tz = 4\n\tnumber = 4\n\twhile x > 0:\n\t\tx -= 2 * prev + number\n\t\tif x >= 0:\n\t\t\toutput += 1\n\t\tprev = number + 2 * prev\n\t\tnumber = number * z\n\tprint(output)\n", "import io, os\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nA = [0]\nfor t in range(1, 31):\n\td = (1 << t) - 1\n\tsum = (d + 1) * d // 2\n\tA.append(sum + A[-1])\n\ndef f():\n\tx = int(input())\n\tfor i in range(30, 0, -1):\n\t\tif x >= A[i]:\n\t\t\tprint(i)\n\t\t\treturn\nfor t in range(int(input())):\n\tf()\n", "from sys import stdin, stdout, setrecursionlimit\nimport heapq\nfrom math import gcd, ceil, sqrt\nfrom collections import Counter, deque\nfrom bisect import bisect_left, bisect_right\nfrom itertools import combinations, permutations\nii1 = lambda : int(stdin.readline().strip())\nis1 = lambda : stdin.readline().strip()\niia = lambda : list(map(int, stdin.readline().strip().split()))\nisa = lambda : stdin.readline().strip().split()\nsetrecursionlimit(100000)\nmod = 1000000007\ntc = ii1()\nfor _ in range(tc):\n\tres = 0\n\tn = ii1()\n\tcur = prev = 0\n\twhile True:\n\t\tt = pow(2, cur) + prev\n\t\tprev = t\n\t\treq = t * (t + 1) // 2\n\t\tif n >= req:\n\t\t\tn -= req\n\t\t\tres += 1\n\t\telse:\n\t\t\tbreak\n\t\tcur += 1\n\tprint(res)\n", "import sys\nfrom collections import defaultdict as dd\nfrom collections import Counter as cc\nfrom queue import Queue\nimport math\nimport itertools\ntry:\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nexcept:\n\tpass\ninput = lambda : sys.stdin.buffer.readline().rstrip()\nk = [1]\ni = 0\nwhile k[-1] * (k[-1] + 1) // 2 < 10 ** 18:\n\tk.append(2 * k[-1] + 1)\nfor _ in range(int(input())):\n\tn = int(input())\n\tr = 0\n\tfor i in range(len(k)):\n\t\tif n >= k[i] * (k[i] + 1) // 2:\n\t\t\tr = i + 1\n\t\telse:\n\t\t\tbreak\n\t\tn -= k[i] * (k[i] + 1) // 2\n\tprint(r)\n", "t = int(input())\n\ndef solve(x):\n\tcells = 0\n\tres = 0\n\tn = 1\n\twhile cells <= x:\n\t\tneed_cells = n * (n + 1) // 2\n\t\tif cells + need_cells <= x:\n\t\t\tres += 1\n\t\t\tcells += need_cells\n\t\t\tn = 2 * n + 1\n\t\telse:\n\t\t\treturn res\nfor _ in range(t):\n\tx = int(input())\n\tprint(solve(x))\n", "l = []\n\ndef power():\n\tfor i in range(1, 61):\n\t\tl.append(pow(2, i) - 1)\npower()\nfor _ in range(int(input())):\n\tx = int(input())\n\tsum = 0\n\tc = 0\n\tfor i in l:\n\t\tif sum < x:\n\t\t\tsum += i * (i + 1) // 2\n\t\t\tc += 1\n\t\t\tif sum > x:\n\t\t\t\tc -= 1\n\t\telse:\n\t\t\tbreak\n\tprint(c)\n", "arr = []\nfor i in range(1, 61):\n\tarr.append(2 ** i - 1)\nfor _ in range(int(input())):\n\tn = int(input())\n\t(s, i) = (0, 0)\n\twhile s < n:\n\t\ts += arr[i] * (arr[i] + 1) // 2\n\t\ti += 1\n\ti -= s > n\n\tprint(i)\n", "from math import *\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tans = 0\n\ti = 1\n\ts = 0\n\twhile n > s:\n\t\ts = s + i * (i + 1) // 2\n\t\tif s > n:\n\t\t\tbreak\n\t\telse:\n\t\t\tans = ans + 1\n\t\ti = 2 * i\n\t\ti = i + 1\n\tprint(ans)\n", "t = 1\nt = int(input())\nwhile t:\n\tt -= 1\n\tx = int(input())\n\t(cnt, ans) = (0, 0)\n\ttotal = 0\n\tfor i in range(64):\n\t\tif total + cnt * (cnt + 1) <= 2 * x:\n\t\t\ttotal += cnt * (cnt + 1)\n\t\t\tcnt += 1 << i\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans - 1)\n", "def solve():\n\tn = int(input())\n\tcount = 0\n\ti = 1\n\twhile True:\n\t\ts = pow(2, i) - 1\n\t\tsc = s * (s + 1) // 2\n\t\tif n >= sc:\n\t\t\tcount += 1\n\t\t\tn = n - sc\n\t\telse:\n\t\t\tbreak\n\t\ti += 1\n\treturn count\nfor _ in range(int(input())):\n\tprint(solve())\n", "def find_number_of_stairs(n):\n\tans = 0\n\tused = 1\n\tvertex_len = 1\n\twhile n >= used:\n\t\tans += 1\n\t\tn -= used\n\t\ti = vertex_len + 1\n\t\tused = i * i + 2 * used\n\t\tvertex_len = vertex_len * 2 + 1\n\treturn ans\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tprint(find_number_of_stairs(n))\n", "from collections import Counter, OrderedDict\nfrom collections import deque\nfrom sys import stdin\nfrom bisect import *\nfrom heapq import *\nimport math\ng = lambda : stdin.readline().strip()\ngl = lambda : g().split()\ngil = lambda : [int(var) for var in gl()]\ngfl = lambda : [float(var) for var in gl()]\ngcl = lambda : list(g())\ngbs = lambda : [int(var) for var in g()]\nmod = int(1000000000.0) + 7\ninf = float('inf')\n(t,) = gil()\nfor _ in range(t):\n\t(x,) = gil()\n\ttn = 1\n\t(cx, cnt) = (0, 0)\n\tcells = 1\n\twhile cx + cells <= x:\n\t\tcx += cells\n\t\tcells = (tn + 1) ** 2 + 2 * cells\n\t\ttn = 2 * tn + 1\n\t\tcnt += 1\n\tprint(cnt)\n", "import bisect\np2 = [2 ** n - 1 for n in range(32)]\np2 = [x * (x + 1) // 2 for x in p2]\nfor i in range(1, 32):\n\tp2[i] += p2[i - 1]\nfor _ in range(int(input())):\n\tn = int(input())\n\tprint(bisect.bisect_right(p2, n) - 1)\n", "from bisect import *\nfrom collections import *\nfrom math import gcd, ceil, sqrt, floor, inf\nfrom heapq import *\nfrom itertools import *\nfrom operator import add, mul, sub, xor, truediv, floordiv\nfrom functools import *\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef RL():\n\treturn map(int, sys.stdin.readline().rstrip().split())\n\ndef RLL():\n\treturn list(map(int, sys.stdin.readline().rstrip().split()))\n\ndef N():\n\treturn int(input())\nfarr = [1]\nifa = []\n\ndef fact(x, mod=0):\n\tif mod:\n\t\twhile x >= len(farr):\n\t\t\tfarr.append(farr[-1] * len(farr) % mod)\n\telse:\n\t\twhile x >= len(farr):\n\t\t\tfarr.append(farr[-1] * len(farr))\n\treturn farr[x]\n\ndef ifact(x, mod):\n\tglobal ifa\n\tifa.append(inverse(farr[-1], mod))\n\tfor i in range(x, 0, -1):\n\t\tifa.append(ifa[-1] * i % mod)\n\tifa = ifa[::-1]\n\ndef per(i, j, mod=0):\n\tif i < j:\n\t\treturn 0\n\tif not mod:\n\t\treturn fact(i) // fact(i - j)\n\treturn farr[i] * ifa[i - j] % mod\n\ndef com(i, j, mod=0):\n\tif i < j:\n\t\treturn 0\n\tif not mod:\n\t\treturn per(i, j) // fact(j)\n\treturn per(i, j, mod) * ifa[j] % mod\n\ndef catalan(n):\n\treturn com(2 * n, n) // (n + 1)\n\ndef linc(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r) // 2\n\t\tif t > f(mid):\n\t\t\tl = mid + 1\n\t\telse:\n\t\t\tr = mid\n\treturn l\n\ndef rinc(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r + 1) // 2\n\t\tif t < f(mid):\n\t\t\tr = mid - 1\n\t\telse:\n\t\t\tl = mid\n\treturn l\n\ndef ldec(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r) // 2\n\t\tif t < f(mid):\n\t\t\tl = mid + 1\n\t\telse:\n\t\t\tr = mid\n\treturn l\n\ndef rdec(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r + 1) // 2\n\t\tif t > f(mid):\n\t\t\tr = mid - 1\n\t\telse:\n\t\t\tl = mid\n\treturn l\n\ndef isprime(n):\n\tfor i in range(2, int(n ** 0.5) + 1):\n\t\tif n % i == 0:\n\t\t\treturn False\n\treturn True\n\ndef binfun(x):\n\tc = 0\n\tfor w in arr:\n\t\tc += ceil(w / x)\n\treturn c\n\ndef lowbit(n):\n\treturn n & -n\n\ndef inverse(a, m):\n\ta %= m\n\tif a <= 1:\n\t\treturn a\n\treturn (1 - inverse(m, a) * m) // a % m\n\nclass BIT:\n\n\tdef __init__(self, arr):\n\t\tself.arr = arr\n\t\tself.n = len(arr) - 1\n\n\tdef update(self, x, v):\n\t\twhile x <= self.n:\n\t\t\tself.arr[x] += v\n\t\t\tx += x & -x\n\n\tdef query(self, x):\n\t\tans = 0\n\t\twhile x:\n\t\t\tans += self.arr[x]\n\t\t\tx &= x - 1\n\t\treturn ans\n\nclass smt:\n\n\tdef __init__(self, l, r, arr):\n\t\tself.l = l\n\t\tself.r = r\n\t\tself.value = (1 << 31) - 1 if l < r else arr[l]\n\t\tmid = (l + r) // 2\n\t\tif l < r:\n\t\t\tself.left = smt(l, mid, arr)\n\t\t\tself.right = smt(mid + 1, r, arr)\n\t\t\tself.value &= self.left.value & self.right.value\n\n\tdef setvalue(self, x, val):\n\t\tif self.l == self.r:\n\t\t\tself.value = val\n\t\t\treturn\n\t\tmid = (self.l + self.r) // 2\n\t\tif x <= mid:\n\t\t\tself.left.setvalue(x, val)\n\t\telse:\n\t\t\tself.right.setvalue(x, val)\n\t\tself.value = self.left.value & self.right.value\n\n\tdef ask(self, l, r):\n\t\tif l <= self.l and r >= self.r:\n\t\t\treturn self.value\n\t\tval = (1 << 31) - 1\n\t\tmid = (self.l + self.r) // 2\n\t\tif l <= mid:\n\t\t\tval &= self.left.ask(l, r)\n\t\tif r > mid:\n\t\t\tval &= self.right.ask(l, r)\n\t\treturn val\n\nclass DSU:\n\n\tdef __init__(self, n):\n\t\tself.c = [-1] * n\n\n\tdef same(self, x, y):\n\t\treturn self.find(x) == self.find(y)\n\n\tdef find(self, x):\n\t\tif self.c[x] < 0:\n\t\t\treturn x\n\t\tself.c[x] = self.find(self.c[x])\n\t\treturn self.c[x]\n\n\tdef union(self, u, v):\n\t\t(u, v) = (self.find(u), self.find(v))\n\t\tif u == v:\n\t\t\treturn False\n\t\tif self.c[u] < self.c[v]:\n\t\t\t(u, v) = (v, u)\n\t\tself.c[u] += self.c[v]\n\t\tself.c[v] = u\n\t\treturn True\n\n\tdef size(self, x):\n\t\treturn -self.c[self.find(x)]\n\nclass UFS:\n\n\tdef __init__(self, n):\n\t\tself.parent = [i for i in range(n)]\n\t\tself.ranks = [0] * n\n\n\tdef find(self, x):\n\t\tif x != self.parent[x]:\n\t\t\tself.parent[x] = self.find(self.parent[x])\n\t\treturn self.parent[x]\n\n\tdef union(self, u, v):\n\t\t(pu, pv) = (self.find(u), self.find(v))\n\t\tif pu == pv:\n\t\t\treturn False\n\t\tif self.ranks[pu] >= self.ranks[pv]:\n\t\t\tself.parent[pv] = pu\n\t\t\tif self.ranks[pv] == self.ranks[pu]:\n\t\t\t\tself.ranks[pu] += 1\n\t\telse:\n\t\t\tself.parent[pu] = pv\n\ndef Prime(n):\n\tc = 0\n\tprime = []\n\tflag = [0] * (n + 1)\n\tfor i in range(2, n + 1):\n\t\tif not flag[i]:\n\t\t\tprime.append(i)\n\t\t\tc += 1\n\t\tfor j in range(c):\n\t\t\tif i * prime[j] > n:\n\t\t\t\tbreak\n\t\t\tflag[i * prime[j]] = prime[j]\n\t\t\tif i % prime[j] == 0:\n\t\t\t\tbreak\n\treturn prime\n\ndef dij(s, graph):\n\td = {}\n\td[s] = 0\n\theap = [(0, s)]\n\tseen = set()\n\twhile heap:\n\t\t(dis, u) = heappop(heap)\n\t\tif u in seen:\n\t\t\tcontinue\n\t\tfor v in graph[u]:\n\t\t\tif v not in d or d[v] > d[u] + graph[u][v]:\n\t\t\t\td[v] = d[u] + graph[u][v]\n\t\t\t\theappush(heap, (d[v], v))\n\treturn d\nt = N()\nres = [1]\narr = [1]\nn = 10 ** 18\nwhile arr[-1] < n:\n\tres.append(res[-1] * 2 + 1)\n\tarr.append(res[-1] * (res[-1] + 1) // 2 + arr[-1])\nfor i in range(t):\n\tx = N()\n\tind = bisect_right(arr, x)\n\tprint(ind)\n", "from sys import stdin, stdout\nfrom collections import defaultdict\ninput = stdin.readline\nl = [1]\nfor i in range(2, 32):\n\tp = 2 ** i\n\tl.append(l[-1] + p * (p - 1) // 2)\nfor _ in range(int(input())):\n\tx = int(input())\n\tfor i in l:\n\t\tif i > x:\n\t\t\tprint(l.index(i))\n\t\t\tbreak\n", "for _ in range(int(input())):\n\tx = int(input())\n\tv = 0\n\tc = 0\n\ti = 0\n\twhile x >= 0:\n\t\tif x - 2 * c + 2 ** i * 2 ** i >= 0:\n\t\t\tx -= 2 * c + 2 ** i * 2 ** i\n\t\t\tc = 2 * c + 2 ** i * 2 ** i\n\t\t\tv += 1\n\t\t\ti += 1\n\t\telse:\n\t\t\tbreak\n\tprint(v - 1)\n", "T = int(input())\n\ndef need(n):\n\treturn n * (n + 1) // 2\nfor t in range(T):\n\tx = int(input())\n\tans = 0\n\tnxt = 1\n\twhile True:\n\t\tif x < need(nxt):\n\t\t\tbreak\n\t\tans += 1\n\t\tx -= need(nxt)\n\t\tnxt = nxt * 2 + 1\n\tprint(ans)\n", "import sys\ninput = iter(sys.stdin.read().splitlines()).__next__\n\ndef solve(x):\n\tres = 0\n\tfor k in range(1, 60):\n\t\tstairs = 2 ** k - 1\n\t\tcells = stairs * (stairs + 1) // 2\n\t\tif cells > x:\n\t\t\tbreak\n\t\tx -= cells\n\t\tres += 1\n\treturn res\nTC = int(input())\nfor tc in range(TC):\n\tx = int(input())\n\tres = solve(x)\n\tprint(res)\n", "from math import *\na = int(input())\nfor x in range(a):\n\tb = int(input())\n\tt = 1\n\th = 0\n\tl = 1\n\tif b == 1:\n\t\tprint(1)\n\telse:\n\t\twhile b >= t:\n\t\t\tb = b - t\n\t\t\th += 1\n\t\t\tl = l * 2 + 1\n\t\t\tt = ceil(l * (l + 1) / 2)\n\t\tprint(h)\n", "def solve(n):\n\tl = 1\n\tans = 0\n\tp = 1\n\twhile n > 0:\n\t\treq = l * (l + 1) // 2\n\t\tif n - req < 0:\n\t\t\tbreak\n\t\tn = n - req\n\t\tp = p * 2\n\t\tl = l + p\n\t\tans += 1\n\treturn ans\nt = int(input())\nwhile t:\n\tn = int(input())\n\tprint(solve(n))\n\tt -= 1\n", "t = int(input())\nL = []\nfor i in range(t):\n\tn = int(input())\n\tx = 1\n\ty = 1\n\tz = 1\n\tukupno = 0\n\todgovor = 0\n\twhile ukupno <= n:\n\t\tukupno += z\n\t\todgovor += 1\n\t\tx = z * 2\n\t\ty = y * 4\n\t\tz = x + y\n\tif ukupno > n:\n\t\todgovor -= 1\n\tL.append(odgovor)\nfor i in range(len(L)):\n\tprint(L[i])\n", "for n in [*open(0)][1:]:\n\tn = int(n)\n\ta = c = 0\n\twhile n >= 0:\n\t\ta += 1\n\t\tn -= c * (c + 1) // 2\n\t\tc = c * 2 + 1\n\tprint(a - 2)\n", "for _ in range(int(input())):\n\tx = int(input())\n\ta = 1\n\tn = 0\n\tb = 0\n\twhile True:\n\t\tb = (a + 1) * (a // 2) + a // 2 + 1\n\t\tx -= b\n\t\tn += 1\n\t\tif x < 0:\n\t\t\tn -= 1\n\t\t\tbreak\n\t\telif x == 0:\n\t\t\tbreak\n\t\ta = a * 2 + 1\n\tprint(n)\n", "import sys\nimport math\nfor i in range(0, int(sys.stdin.readline())):\n\tx = int(sys.stdin.readline())\n\tu = 0\n\ts = 0\n\twhile s <= x:\n\t\tfor k in range(u, 2 * u + 1):\n\t\t\ts += 2 ** k\n\t\tu += 1\n\tsys.stdout.write(str(u - 1) + '\\n')\n", "rw = int(input())\nfor wewq in range(rw):\n\tx = int(input())\n\ts = 2\n\tsu = 0\n\tfor i in range(1, 70):\n\t\tsu += s * (s - 1) // 2\n\t\tif su > x:\n\t\t\tp = i - 1\n\t\t\tbreak\n\t\ts *= 2\n\tprint(p)\n", "for _ in range(0, int(input())):\n\tn = int(input())\n\tt = 0\n\tfor i in range(0, 101):\n\t\tm = 2 ** i - 1\n\t\tw = (m + 1) * m // 2\n\t\tif w <= n:\n\t\t\tn -= w\n\t\t\tt += 1\n\t\telse:\n\t\t\tbreak\n\tprint(t - 1)\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n\tn = int(input())\n\tans = 0\n\tstair = 1\n\twhile n > 0:\n\t\tans += 1\n\t\tn -= stair * (stair + 1) // 2\n\t\tstair *= 2\n\t\tstair += 1\n\tif n != 0:\n\t\tans -= 1\n\tprint(ans)\nfor _ in range(int(input())):\n\tmain()\n", "import math\nfor _ in range(int(input())):\n\ta = []\n\tfor i in range(1, 31):\n\t\ta.append(2 ** (i - 1) * (2 ** i - 1))\n\tn = int(input())\n\tans = 0\n\ts = 0\n\tfor i in range(len(a)):\n\t\ts = s + a[i]\n\t\tif s > n:\n\t\t\tbreak\n\t\tans += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\t(tmp, ans, t, cur) = (1, 0, 0, 1)\n\twhile ans + tmp <= n:\n\t\tans += tmp\n\t\tt += 1\n\t\ttmp = 4 ** t + 2 * cur\n\t\tcur = tmp\n\tprint(t)\n", "import math\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tcnt = 0\n\tsize = 1\n\twhile x > 0:\n\t\ta = size * (size + 1) // 2\n\t\tif x >= a:\n\t\t\tcnt += 1\n\t\t\tsize = 2 * size + 1\n\t\tx -= a\n\tprint(cnt)\n", "import os\nimport heapq\nimport sys, threading\nimport math\nimport bisect\nimport operator\nfrom collections import defaultdict\nsys.setrecursionlimit(10 ** 5)\nfrom io import BytesIO, IOBase\n\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\telse:\n\t\treturn gcd(b, a % b)\n\ndef power(x, p, m):\n\tres = 1\n\twhile p:\n\t\tif p & 1:\n\t\t\tres = res * x % m\n\t\tx = x * x % m\n\t\tp >>= 1\n\treturn res\n\ndef inar():\n\treturn [int(k) for k in input().split()]\n\ndef lcm(num1, num2):\n\treturn num1 * num2 // gcd(num1, num2)\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\tpower = []\n\t\tans = 0\n\t\tfor i in range(1, 60):\n\t\t\tpower.append(2 ** i - 1)\n\t\ttake = 0\n\t\tdiv = 2 ** 60\n\t\tfor i in range(len(power)):\n\t\t\tdiv = power[i] * (power[i] + 1) // 2\n\t\t\tif div + take > n:\n\t\t\t\tbreak\n\t\t\tans += 1\n\t\t\ttake += div\n\t\tprint(ans)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = 0\n\ti = 0\n\tc = 0\n\twhile n >= 0:\n\t\ts = s + 2 ** i\n\t\tn -= s * 2 ** i\n\t\ti += 1\n\t\tif n >= 0:\n\t\t\tc += 1\n\tprint(c)\n", "t = int(input())\nfor _ in range(t):\n\ttotal = 0\n\tnice_starcases = []\n\tfor i in range(50):\n\t\tnew_square = (2 ** i) ** 2\n\t\ttotal = 2 * total + new_square\n\t\tnice_starcases.append(total)\n\tcells = int(input())\n\tindex = 0\n\twhile cells - nice_starcases[index] >= 0:\n\t\tcells -= nice_starcases[index]\n\t\tindex += 1\n\tprint(index)\n", "from sys import stdin, stdout\nfrom math import gcd, log2, log10, floor, ceil\nimport math\nfrom collections import defaultdict, OrderedDict\nfrom bisect import bisect_left\n\ndef sq(n):\n\treturn n * (n + 1) // 2\n\ndef fun(n):\n\ttheta = 0\n\tcount = 0\n\twhile n > 0:\n\t\ttheta = theta * 2 + 1\n\t\tif n >= sq(theta):\n\t\t\tn -= sq(theta)\n\t\t\tcount += 1\n\t\telse:\n\t\t\tbreak\n\treturn count\nfor i in range(int(input())):\n\tn = int(input())\n\tanswer = fun(n)\n\tprint(answer)\n", "t = int(input())\nfor testindex in range(t):\n\tnum = int(input())\n\tn = x = 0\n\twhile n <= num:\n\t\tx += 1\n\t\tm = 2 ** x - 1\n\t\tn += (m + 1) * m // 2\n\tprint(x - 1)\n", "def sum(n):\n\tn = n + 1\n\treturn 2 ** (2 * n - 1) - 2 ** (n - 1)\narray = [1]\nfor i in range(1, 32):\n\tarray.append(array[i - 1] + sum(i))\nfor t in range(int(input())):\n\tx = int(input())\n\tfor i in range(0, 32):\n\t\tif array[i] > x:\n\t\t\tbreak\n\tprint(i)\n", "for i in range(int(input())):\n\tn = int(input())\n\tt = 0\n\ttotal = 0\n\tfor i in range(1, 5000000):\n\t\ttotal += (2 ** i - 1) * 2 ** i // 2\n\t\tt += 1\n\t\tif total > n:\n\t\t\tt -= 1\n\t\t\tprint(t)\n\t\t\tbreak\n", "for _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\tq = 1\n\tw = 1\n\twhile x >= w:\n\t\tx -= w\n\t\tq *= 2\n\t\tw += w + q * q\n\t\tans += 1\n\tprint(ans)\n", "from math import *\nfrom random import *\nfrom bisect import *\nfrom math import *\ncr = 1\ntotal = []\nff = False\nwhile True:\n\ttotal.append(cr)\n\tcr = cr + cr + 1\n\tif cr * (cr + 1) // 2 >= 10 ** 64:\n\t\tbreak\nprefsm = [total[0]]\nfor i in range(1, len(total)):\n\tprefsm.append(prefsm[-1] + total[i] * (total[i] + 1) // 2)\nfor t in range(int(input())):\n\tn = int(input())\n\tl = 0\n\tr = len(prefsm) - 1\n\tif n == 1:\n\t\tprint(1)\n\t\tcontinue\n\twhile r - l > 1:\n\t\tm = (l + r) // 2\n\t\tif prefsm[m] <= n:\n\t\t\tl = m\n\t\telse:\n\t\t\tr = m\n\tprint(l + 1)\n", "def solve(n):\n\ti = 1\n\treq = 1\n\tcount = 0\n\twhile n >= req:\n\t\tn -= req\n\t\ti = i + (i + 1)\n\t\treq = i * (i + 1) // 2\n\t\tcount += 1\n\tprint(count)\nt = int(input())\nfor test in range(t):\n\tn = int(input())\n\tsolve(n)\n", "a = [1]\nlim = 10 ** 18\ni = 0\nwhile a[i] < lim:\n\ta.append(2 * a[i] + (2 ** (i + 1)) ** 2)\n\ti = i + 1\ndel a[-1]\n\ndef lowerBound(x):\n\th = len(a)\n\tl = 0\n\twhile l < h:\n\t\tm = l + (h - l) // 2\n\t\tif x <= a[m]:\n\t\t\th = m\n\t\telse:\n\t\t\tl = m + 1\n\treturn l\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tif x == 1:\n\t\tprint(1)\n\t\tcontinue\n\tl = lowerBound(x)\n\tb = a[:l]\n\twhile sum(b) > x:\n\t\tdel b[-1]\n\tprint(len(b))\n", "for _ in range(int(input())):\n\tx = int(input())\n\ti = 1\n\tans = 0\n\twhile True:\n\t\tv = i * (i + 1) // 2\n\t\tif x < v:\n\t\t\tbreak\n\t\tx = x - v\n\t\ti = i * 2\n\t\ti = i + 1\n\t\tans = ans + 1\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ta = -1\n\tx = 0\n\twhile x <= n:\n\t\ta += 1\n\t\tk = 2 ** (a + 1) - 1\n\t\tx += k * (k + 1) // 2\n\tprint(a)\n", "import math\nfrom heapq import heappush, heappop, heapify\nimport random\nimport string\nfrom collections import deque\nfrom bisect import bisect, bisect_left, bisect_right, insort\nimport sys\ninput = sys.stdin.readline\nS = lambda : input().rstrip()\nI = lambda : int(S())\nM = lambda : map(int, S().split())\nL = lambda : list(M())\nH = 1000000000 + 7\nfor _ in range(I()):\n\tx = I()\n\ti = 0\n\tc = 0\n\twhile True:\n\t\ts = pow(2, i)\n\t\tk = pow(2, i // 2) - 1\n\t\ts = s + k * (k + 1)\n\t\tif x < s:\n\t\t\tbreak\n\t\tx -= s\n\t\tc += 1\n\t\ti += 2\n\tprint(c)\n", "t = eval(input())\nv = [0]\ncur = 1\n\ndef f(x):\n\treturn x * (x + 1) // 2\nwhile v[-1] <= 10 ** 30:\n\tu = f(2 ** cur - 1)\n\tv.append(u)\n\tv[-1] += v[-2]\n\tcur += 1\nfor i in range(t):\n\tx = eval(input())\n\tfor i in range(len(v)):\n\t\tif v[i] <= x and v[i + 1] > x:\n\t\t\tprint(i)\n\t\t\tbreak\n", "def f():\n\tt = int(input())\n\tarr = []\n\tfor _ in range(t):\n\t\tarr.append(int(input()))\n\tfor n in arr:\n\t\t(total, cursum, i) = (0, 0, 2)\n\t\twhile cursum <= n:\n\t\t\tcursum += (i - 1) * i // 2\n\t\t\ti *= 2\n\t\t\ttotal += 1\n\t\tprint(total - 1)\nf()\n", "def solve():\n\tn = int(input())\n\tif n == 0:\n\t\treturn 0\n\tans = 1\n\ts = 0\n\ti = 1\n\twhile True:\n\t\tele = 2 ** i - 1\n\t\tif s > n:\n\t\t\tbreak\n\t\ts += ele * (ele + 1) // 2\n\t\tans = i\n\t\ti += 1\n\treturn ans - 1\nfor _ in range(int(input())):\n\tprint(solve())\n", "def func(x):\n\treturn x * (x + 1) // 2\nt = int(input())\nwhile t:\n\tn = int(input())\n\ti = '1'\n\tans = 0\n\twhile 1:\n\t\ttemp = func(int(i, 2))\n\t\tif n - temp >= 0:\n\t\t\tans += 1\n\t\t\tn -= temp\n\t\t\ti += '1'\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n\tt -= 1\n", "t = int(input())\nwhile t > 0:\n\tx = int(input())\n\tn = 1\n\tpw2 = 1\n\tcount = 0\n\twhile n <= x:\n\t\tx = x - n\n\t\tcount += 1\n\t\tpw2 += 1\n\t\tn = int(2 ** pw2 - 1)\n\t\tn = int(n * (n + 1) / 2)\n\tt = t - 1\n\tprint(count)\n", "from sys import *\nfrom math import *\nt = int(stdin.readline())\nfor _ in range(t):\n\tn = int(input())\n\tx = 1\n\tans = 0\n\twhile True:\n\t\ty = x * (x + 1) // 2\n\t\tif n >= y:\n\t\t\tx = x + x + 1\n\t\t\tans += 1\n\t\t\tn -= y\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\ncan = []\nfor i in range(1, 65):\n\tn = 2 ** i - 1\n\tcnt = n * (n + 1) // 2\n\tcan.append(cnt)\nT = int(input())\nfor t in range(T):\n\tx = int(input())\n\ti = 0\n\tans = 0\n\twhile x > 0:\n\t\tif x - can[i] < 0:\n\t\t\tbreak\n\t\tans += 1\n\t\tx -= can[i]\n\t\ti += 1\n\tprint(ans)\n", "import sys\nreadline = sys.stdin.readline\nT = int(readline())\nAns = [0] * T\nJ = [1]\nfor _ in range(40):\n\tJ.append(2 * J[-1] + 1)\nJ = [j * (j + 1) // 2 for j in J]\nfor i in range(1, 40):\n\tJ[i] += J[i - 1]\nfor qu in range(T):\n\tN = int(readline())\n\tfor i in range(40):\n\t\tif J[i + 1] > N:\n\t\t\tbreak\n\tAns[qu] = i + 1\nprint('\\n'.join(map(str, Ans)))\n", "import sys\nimport math\ninput = sys.stdin.readline\nsizes = [2 ** i - 1 for i in range(1, 32)]\nblocks = [size * (size + 1) // 2 for size in sizes]\nt = int(input())\nfor x in range(t):\n\tx = int(input())\n\ti = 0\n\twhile x >= blocks[i]:\n\t\tx -= blocks[i]\n\t\ti += 1\n\tprint(i)\n", "fun = lambda x: x * (x + 1) // 2\ncell_sum = [0, 1, 7, 35, 155, 651, 2667, 10795, 43435, 174251, 698027, 2794155, 11180715, 44731051, 178940587, 715795115, 2863245995, 11453115051, 45812722347, 183251413675, 733006703275, 2932028910251, 11728119835307, 46912487729835, 187649967696555, 750599904340651, 3002399684471467, 12009598872103595, 48038395756849835, 192153583564270251, 768614335330822827, 3074457343470774955]\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tans = -1\n\tfor no in cell_sum:\n\t\tif no <= x:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "def func(n):\n\treturn n * (n + 1) // 2\nfor _ in range(int(input())):\n\tx = int(input())\n\ts = 0\n\ti = 1\n\twhile x - func(i) >= 0:\n\t\tx -= func(i)\n\t\ti = 2 * i + 1\n\t\ts += 1\n\tprint(s)\n", "def nice(x):\n\tif x == 0:\n\t\treturn 0\n\tprev = 1\n\tres = 0\n\twhile x >= prev * (prev + 1) // 2:\n\t\tres += 1\n\t\tx -= prev * (prev + 1) // 2\n\t\tprev = prev * 2 + 1\n\treturn res\nT = int(input())\nfor t in range(T):\n\tx = int(input())\n\tprint(nice(x))\n", "from bisect import bisect_left, bisect_right\na = [1]\nf = 1\nwhile a[-1] <= 10 ** 18:\n\tf = f * 2 + 1\n\ta.append(a[-1] + f * (f + 1) // 2)\nfor _ in range(int(input())):\n\tn = int(input())\n\tprint(bisect_right(a, n))\n", "import os, sys\nfrom io import BytesIO, IOBase\nfrom sys import setrecursionlimit\nimport heapq\nfrom math import gcd, ceil, sqrt\nfrom collections import Counter, deque\nfrom bisect import bisect_left, bisect_right\nsetrecursionlimit(100000)\nmod = 1000000007\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\n\ndef main():\n\tfor _ in range(inp()):\n\t\tn = inp()\n\t\tcount = 0\n\t\tval = 1\n\t\twhile n >= 0:\n\t\t\tn -= val * (val + 1) // 2\n\t\t\tcount += 1\n\t\t\tval = 2 * val + 1\n\t\tprint(count - 1)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "def nsum(n):\n\treturn n * (n + 1) // 2\nfor _ in range(int(input())):\n\tn = int(input())\n\tl = []\n\ts = 0\n\tfor i in range(32):\n\t\tl.append(s + 2 ** i)\n\t\ts += 2 ** i\n\tout = 0\n\ti = 0\n\twhile n > 0:\n\t\tif n - nsum(l[i]) >= 0:\n\t\t\tn -= nsum(l[i])\n\t\t\tout += 1\n\t\t\ti += 1\n\t\telse:\n\t\t\tbreak\n\tprint(out)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ti = 0\n\tk = 1\n\twhile n >= (1 + k) * k // 2:\n\t\ts = (1 + k) * k // 2\n\t\tn -= s\n\t\tk = k * 2 + 1\n\t\ti += 1\n\tprint(i)\n", "import sys, math, cmath, time\nstart_time = time.time()\n\ndef solve():\n\tn = inp()\n\ts = 0\n\tfor i in range(62):\n\t\ts = s + (2 ** (i + 1) - 1) * 2 ** (i + 1) // 2\n\t\tif s > n:\n\t\t\tbreak\n\tprint(i)\n\ndef main():\n\tglobal tt\n\tif not ONLINE_JUDGE:\n\t\tsys.stdin = open('input.txt', 'r')\n\t\tsys.stdout = open('output.txt', 'w')\n\tt = 1\n\tt = inp()\n\tfor tt in range(1, t + 1):\n\t\tsolve()\n\tif not ONLINE_JUDGE:\n\t\tprint('Time Elapsed :', time.time() - start_time, 'seconds')\n\t\tsys.stdout.close()\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\treturn input().strip()\n\ndef invr():\n\treturn map(int, input().split())\n\ndef counter(a):\n\tq = [0] * max(a)\n\tfor i in range(len(a)):\n\t\tq[a[i] - 1] = q[a[i] - 1] + 1\n\treturn q\n\ndef counter_elements(a):\n\tq = dict()\n\tfor i in range(len(a)):\n\t\tif a[i] not in q:\n\t\t\tq[a[i]] = 0\n\t\tq[a[i]] = q[a[i]] + 1\n\treturn q\n\ndef string_counter(a):\n\tq = [0] * 26\n\tfor i in range(len(a)):\n\t\tq[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1\n\treturn q\n\ndef factors(n):\n\tq = []\n\tfor i in range(1, int(n ** 0.5) + 1):\n\t\tif n % i == 0:\n\t\t\tq.append(i)\n\t\t\tq.append(n // i)\n\treturn list(sorted(list(set(q))))\n\ndef prime_factors(n):\n\tq = []\n\twhile n % 2 == 0:\n\t\tq.append(2)\n\t\tn = n // 2\n\tfor i in range(3, int(n ** 0.5) + 1, 2):\n\t\twhile n % i == 0:\n\t\t\tq.append(i)\n\t\t\tn = n // i\n\tif n > 2:\n\t\tq.append(n)\n\treturn list(sorted(q))\n\ndef transpose(a):\n\t(n, m) = (len(a), len(a[0]))\n\tb = [[0] * n for i in range(m)]\n\tfor i in range(m):\n\t\tfor j in range(n):\n\t\t\tb[i][j] = a[j][i]\n\treturn b\n\ndef factorial(n, m=1000000007):\n\tq = 1\n\tfor i in range(n):\n\t\tq = q * (i + 1) % m\n\treturn q\n\ndef ceil(a, b):\n\treturn -(-a // b)\nONLINE_JUDGE = __debug__\nif ONLINE_JUDGE:\n\tinput = sys.stdin.readline\nmain()\n", "for i in range(int(input())):\n\tn = int(input())\n\tres = 1\n\tb = 3\n\tn -= 1\n\twhile b * (b + 1) // 2 <= n:\n\t\tres += 1\n\t\tn -= b * (b + 1) // 2\n\t\tb = 2 * b + 1\n\tprint(res)\n", "def solve():\n\tx = int(input())\n\tanswer = 0\n\tcost = 0\n\ttotal_cost = 0\n\twhile total_cost <= x:\n\t\tcost = 2 * cost + 2 ** (2 * answer)\n\t\ttotal_cost += cost\n\t\tanswer += 1\n\tprint(answer - 1)\nruns = int(input())\nwhile runs > 0:\n\tsolve()\n\truns -= 1\n", "import math as m\ni = input()\ninp = []\nfor a in range(0, int(i)):\n\tinp += [int(input())]\nfor x in inp:\n\tl = 2\n\tc = 0\n\twhile x > 0:\n\t\tv = l * (l - 1) // 2\n\t\tx -= v\n\t\tif x >= 0:\n\t\t\tc += 1\n\t\tl = 2 * l\n\tprint(c)\n", "def iinput():\n\treturn int(input())\n\ndef finput():\n\treturn float(input())\n\ndef pre():\n\ts = list()\n\ts.append(1)\n\tl = 2\n\tfor _ in range(30):\n\t\ts.append(s[-1] * 2 + l * l)\n\t\tl *= 2\n\treturn s\nl = pre()\nT = iinput()\nfor _ in range(T):\n\tx = iinput()\n\tans = 0\n\tfor cur in l:\n\t\tif x >= cur:\n\t\t\tans += 1\n\t\t\tx -= cur\n\t\telse:\n\t\t\tprint(ans)\n\t\t\tbreak\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tx = int(input())\n\tc = 1\n\to = 0\n\twhile x > 0:\n\t\tx -= c * (c + 1) // 2\n\t\tif x >= 0:\n\t\t\to += 1\n\t\tc = 2 * c + 1\n\tprint(o)\n", "from math import sqrt, log\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tn = 1\n\twhile x >= 0:\n\t\tx -= (2 ** n - 1) * 2 ** n // 2\n\t\tn += 1\n\tprint(n - 2)\n", "import sys\ninput = sys.stdin.readline\nimport math\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\nT = inp()\nt = 0\nwhile t < T:\n\tt += 1\n\tx = inp()\n\tres = 0\n\ti = 0\n\twhile x >= 0:\n\t\ti = i * 2 + 1\n\t\tsub = (i + 1) * i // 2\n\t\tx = x - sub\n\t\tres += 1\n\tprint(res - 1)\n", "from math import log2\nfor _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\tif n == 1:\n\t\tprint(1)\n\t\tcontinue\n\tfor i in range(1, n):\n\t\tans += 1\n\t\tx = 2 ** i - 1\n\t\tn -= x * (x + 1) // 2\n\t\tif n < 0:\n\t\t\tans -= 1\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tx = int(input())\n\ts = 0\n\tk = 0\n\tfor i in range(x):\n\t\tl = 2 ** (i + 1) - 1\n\t\tm = l * (l + 1)\n\t\tm = m // 2\n\t\ts += m\n\t\tif s > x:\n\t\t\tbreak\n\t\telse:\n\t\t\tk += 1\n\tprint(k)\n", "test = int(input())\nfor q in range(test):\n\tx = int(input())\n\ts = 0\n\tk = 1\n\tc = 0\n\tfor i in range(1, 43):\n\t\tk = pow(2, i) - 1\n\t\tt = k * (k + 1) // 2\n\t\tx = x - t\n\t\tif x >= 0:\n\t\t\tc += 1\n\t\telse:\n\t\t\tbreak\n\tprint(c)\n", "import math\nimport collections\nfrom sys import stdin, stdout, setrecursionlimit\nfrom bisect import bisect_left as bsl\nfrom bisect import bisect_right as bsr\nimport heapq as hq\nsetrecursionlimit(2 ** 20)\nt = 1\nt = int(stdin.readline())\nfor _ in range(t):\n\tx = int(stdin.readline())\n\tx -= 1\n\tans = 1\n\tprv = 1\n\tcnt = 1\n\twhile x > 0:\n\t\tsub = (2 ** cnt) ** 2 + 2 * prv\n\t\tprv = sub\n\t\tcnt += 1\n\t\tx = x - sub\n\t\tif x < 0:\n\t\t\tbreak\n\t\telse:\n\t\t\tans += 1\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\ns = []\ni = 1\nM = 10 ** 18\nwhile True:\n\tnum = 2 * (4 ** i - 1) // 3 - 2 ** i + 1\n\tif num > M:\n\t\tbreak\n\telse:\n\t\ts.append(num)\n\t\ti += 1\nfor _ in range(t):\n\tn = int(input())\n\tans = 0\n\tfor i in s:\n\t\tif n >= i:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\tz = 1\n\tbaseNum = 1\n\ttotal_cell = 0\n\twhile total_cell < x:\n\t\ttotal_cell += baseNum * (baseNum + 1) // 2\n\t\tans += 1\n\t\tz = z * 2\n\t\tbaseNum += z\n\tif total_cell > x:\n\t\tans -= 1\n\tprint(ans)\n", "for i in range(int(input())):\n\ta = int(input())\n\t(k, w) = (1, 1)\n\tcounter = 1\n\ta -= 1\n\twhile a >= 4 * k + 2 * w:\n\t\tcounter += 1\n\t\tk = 4 * k + 2 * w\n\t\tw = 2 * w\n\t\ta -= k\n\tprint(counter)\n", "from sys import stdin, gettrace\nif gettrace():\n\tinputi = input\nelse:\n\n\tdef input():\n\t\treturn next(stdin)[:-1]\n\n\tdef inputi():\n\t\treturn stdin.buffer.readline()\n\ndef solve():\n\tx = int(inputi())\n\tsum = 2\n\tn = 1\n\tcount = 0\n\twhile sum <= x * 2:\n\t\tcount += 1\n\t\tn = n * 2 + 1\n\t\tsum += n * (n + 1)\n\tprint(count)\n\ndef main():\n\tt = int(inputi())\n\tfor _ in range(t):\n\t\tsolve()\nmain()\n", "import math\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ta = 1\n\ttot = 1\n\tcost = 1\n\tans = 1\n\twhile n >= tot:\n\t\ta <<= 1\n\t\tcost = 2 * cost + a * a\n\t\ttot += cost\n\t\tans += 1\n\tprint(ans - 1)\n", "from collections import Counter\nimport string\nimport math\nimport sys\n\ndef array_int():\n\treturn [int(i) for i in sys.stdin.readline().split()]\n\ndef vary(number_of_variables):\n\tif number_of_variables == 1:\n\t\treturn int(sys.stdin.readline())\n\tif number_of_variables >= 2:\n\t\treturn map(int, sys.stdin.readline().split())\n\ndef makedict(var):\n\treturn dict(Counter(var))\nmod = 100000007\nlisti = []\n\ndef items():\n\tglobal listi\n\tj = 1\n\ti = 1\n\tlisti.append(i)\n\twhile i < 10 ** 20:\n\t\tj = 2 * j + 1\n\t\ti = j * (j + 1) // 2\n\t\tlisti.append(i)\nitems()\nfor _ in range(vary(1)):\n\tn = vary(1)\n\tcounter = 0\n\tfor i in range(len(listi)):\n\t\tif n < listi[i]:\n\t\t\tbreak\n\t\tn -= listi[i]\n\t\tcounter += 1\n\tprint(counter)\n", "for i in range(int(input())):\n\tn = int(input())\n\tc = 0\n\tb = 1\n\tk = 0\n\tsumo = 0\n\twhile n - (c + b) * b >= 0:\n\t\tc = c + b\n\t\tn = n - c * b\n\t\tsumo = sumo + 1\n\t\tb = b * 2\n\tprint(sumo)\n", "a = []\nbase = 1\nst = 1\ntotal = 0\nfor i in range(40):\n\ttotal += base\n\tvalue = total * (total + 1) // 2\n\ta.append(value)\n\tbase *= 2\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\tfor it in a:\n\t\tif it <= x:\n\t\t\tx -= it\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "def Solve(n):\n\tsum = 0\n\ti = 1\n\tj = 0\n\tcur = 0\n\twhile sum <= n:\n\t\tcur = 2 * cur + i * i\n\t\tsum += cur\n\t\ti = 2 * i\n\t\tj += 1\n\tprint(j - 1)\n\ndef main():\n\tt = int(input())\n\twhile t > 0:\n\t\tt -= 1\n\t\tn = int(input())\n\t\tSolve(n)\nmain()\n", "from bisect import bisect_right\ncount = 0\narr = []\narr.append(1)\nc = 3\nwhile arr[-1] <= 10 ** 18:\n\tarr.append(arr[-1] + c * (c + 1) // 2)\n\tc = c * 2 + 1\nfor i in range(int(input())):\n\tn = int(input())\n\tt = bisect_right(arr, n)\n\tprint(t)\n", "def ans(arr):\n\ti = 1\n\tcnt = 0\n\tif arr == 1:\n\t\treturn 1\n\twhile arr - i * (i + 1) // 2 >= 0:\n\t\tcnt += 1\n\t\tar = i * (i + 1) // 2\n\t\tarr -= ar\n\t\ttmp = 2 * i + 1\n\t\ti = tmp\n\treturn cnt\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tprint(ans(n))\n", "t = int(input())\nfor i in range(0, t):\n\tn = int(input())\n\ts = 1\n\tc = 0\n\tblock = 1\n\twhile block <= n:\n\t\tn = n - block\n\t\ts = 2 * s + 1\n\t\tblock = s * (s + 1) // 2\n\t\tc += 1\n\tprint(c)\n", "def stairs(x):\n\tans = 0\n\tindex = 1\n\tvalid_size = 1\n\twhile x >= valid_size * (valid_size + 1) // 2:\n\t\tans += 1\n\t\tx -= valid_size * (valid_size + 1) // 2\n\t\tindex += 1\n\t\tvalid_size = 2 ** index - 1\n\treturn ans\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tprint(stairs(x))\n", "def f(n):\n\ttotal = 0\n\tother = 1\n\tz = 1\n\ttotaltillnow = 0\n\twhile totaltillnow < n:\n\t\ttotaltillnow += (other + 1) * other // 2\n\t\ttotal += 1\n\t\tz *= 2\n\t\tother += z\n\telse:\n\t\tif totaltillnow > n:\n\t\t\treturn total - 1\n\t\telse:\n\t\t\treturn total\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tprint(f(n))\n", "from math import *\nfrom bisect import *\nfrom collections import *\nfrom random import *\nfrom decimal import *\nimport sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef st():\n\treturn input().rstrip('\\n')\n\ndef lis():\n\treturn list(map(int, input().split()))\n\ndef ma():\n\treturn map(int, input().split())\nt = inp()\nwhile t:\n\tt -= 1\n\tn = inp()\n\tco = 0\n\tso = 1\n\tcu = 1\n\twhile 1:\n\t\tn -= so * (so + 1) // 2\n\t\tif n < 0:\n\t\t\tbreak\n\t\tco += 1\n\t\tcu += 1\n\t\tso = 2 ** cu - 1\n\tprint(co)\n", "from sys import stdin\ninput = stdin.readline\nfor _ in range(int(input())):\n\tx = int(input())\n\ts = 0\n\ti = 1\n\twhile s + (pow(2, i) - 1) * pow(2, i) // 2 <= x:\n\t\ts += (pow(2, i) - 1) * pow(2, i) // 2\n\t\ti += 1\n\tprint(i - 1)\n", "import sys\ninput = sys.stdin.readline\nn = int(input())\nBB = [int(input()) for i in range(n)]\nl = 60\nA = [1]\nfor i in range(l - 1):\n\tA.append((A[-1] + 1) * 2 - 1)\nB = [A[i] * (A[i] + 1) // 2 for i in range(l)]\nC = [B[0]]\nfor i in range(1, l):\n\tC.append(B[i] + C[-1])\nfrom bisect import bisect\nfor i in range(n):\n\tprint(bisect(C, BB[i]))\n", "from enum import *\nfrom copy import *\nfrom sys import *\nfrom collections import *\nfrom itertools import *\nfrom functools import *\nfrom math import *\n\ndef l2i(fr=None):\n\treturn map_type_to_fr(int, fr)[0]\n\ndef i2i(fr=None):\n\treturn l2i(fr)\n\ndef dbg(*args):\n\tprint(*args, file=stderr)\n\ndef dbv(var_name):\n\tprint(f'{var_name} = {eval(var_name)}', file=stderr)\n\ndef map_type_to_fr(t, fr):\n\tglobal GETLINE_OFFSET\n\tif fr is None:\n\t\tif RUNNING_ON_MY_PC:\n\t\t\tfr = TEST_INP[GETLINE_OFFSET].split()\n\t\t\tGETLINE_OFFSET += 1\n\t\telse:\n\t\t\tfr = input().split()\n\treturn list(map(t, fr))\n\ndef mis(fr=None):\n\treturn map_type_to_fr(int, fr)\n\ndef mbs(fr=None):\n\treturn map_type_to_fr(bool, fr)\n\ndef gs(fr=None):\n\treturn map_type_to_fr(str, fr)[0]\nimport os\nimport sysconfig\nRUNNING_ON_MY_PC = os.name == 'nt' and platform == 'win32' and (sysconfig.get_platform() == 'win-amd64')\nGETLINE_OFFSET = 0\nTEST_INP = '4\\n1\\n8\\n6\\n1000000000000000000\\n\\n'.split('\\n')\n\ndef my_r(x):\n\tc = ceil(x)\n\tif c - x > 0.5:\n\t\treturn floor(x)\n\treturn c\n\ndef req(n):\n\tif n == 1:\n\t\treturn 1\n\treturn n * (n + 1) // 2\nt = i2i()\nfor _ in range(t):\n\tx = i2i()\n\tif x == 1:\n\t\tprint(1)\n\t\tcontinue\n\tans = 1\n\tk = 1\n\tprev_size = 0\n\twhile x > 0:\n\t\tsz = k * k + 2 * prev_size\n\t\tx -= sz\n\t\tprev_size = sz\n\t\tif x < 0:\n\t\t\tdbg()\n\t\t\tbreak\n\t\tk *= 2\n\t\tans += 1\n\tprint(ans - 1)\n", "from sys import stdin, stdout\nimport heapq\nimport cProfile\nfrom collections import Counter, defaultdict, deque\nfrom functools import reduce\nimport math\nimport threading\nimport sys\nimport time\n\ndef get_int():\n\treturn int(stdin.readline().strip())\n\ndef get_tuple():\n\treturn map(int, stdin.readline().split())\n\ndef get_list():\n\treturn list(map(int, stdin.readline().split()))\n\ndef solve():\n\tn = get_int()\n\tpower = 1\n\tans = 0\n\tnum = 1\n\treq_tiles = num * (num + 1) // 2\n\twhile n >= req_tiles:\n\t\tn -= req_tiles\n\t\tpower += 1\n\t\tnum = 2 ** power - 1\n\t\treq_tiles = num * (num + 1) // 2\n\t\tans += 1\n\tprint(ans)\n\ndef main():\n\tsolve()\nTestCases = True\nif TestCases:\n\tfor i in range(get_int()):\n\t\tmain()\nelse:\n\tmain()\n", "powers = [2 ** i for i in range(66)]\nseq = [1]\ncur_sum = 1\nfor i in range(1, 66):\n\tcur_sum *= 2\n\tcur_sum += powers[i] ** 2\n\tseq.append(cur_sum)\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tct = 0\n\tfor i in seq:\n\t\tif i <= x:\n\t\t\tx -= i\n\t\t\tct += 1\n\tprint(ct)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\ti = 1\n\ts = 0\n\twhile x >= 2 ** i * (2 ** i - 1) // 2:\n\t\ts = 2 ** i * (2 ** i - 1) // 2\n\t\tx -= s\n\t\ti += 1\n\tprint(i - 1)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport bisect\nnums = [1]\nans = [1]\ncv = 2\nwhile nums[-1] < 10 ** 18:\n\tnums.append(nums[-1] * 2 + cv ** 2)\n\tans.append(ans[-1] + nums[-1])\n\tcv *= 2\nfor j in range(int(input())):\n\tx = int(input())\n\tind = min(bisect.bisect_left(ans, x), len(ans) - 1)\n\tif ans[ind] > x:\n\t\tind -= 1\n\tprint(ind + 1)\n", "from __future__ import division, print_function\nimport sys\nsys.setrecursionlimit(10 ** 4)\nfrom sys import stdin, stdout\nimport bisect\nimport math\nimport heapq\ni_m = 9223372036854775807\n\ndef modinv(n, p):\n\treturn pow(n, p - 2, p)\n\ndef cin():\n\treturn map(int, sin().split())\n\ndef ain():\n\treturn list(map(int, sin().split()))\n\ndef sin():\n\treturn input()\n\ndef inin():\n\treturn int(input())\nimport math\n\ndef GCD(x, y):\n\tx = abs(x)\n\ty = abs(y)\n\tif min(x, y) == 0:\n\t\treturn max(x, y)\n\twhile y:\n\t\t(x, y) = (y, x % y)\n\treturn x\n\ndef Divisors(n):\n\tl = []\n\tfor i in range(1, int(math.sqrt(n) + 1)):\n\t\tif n % i == 0:\n\t\t\tif n // i == i:\n\t\t\t\tl.append(i)\n\t\t\telse:\n\t\t\t\tl.append(i)\n\t\t\t\tl.append(n // i)\n\treturn l\nprime = []\n\ndef SieveOfEratosthenes(n):\n\tglobal prime\n\tprime = [True for i in range(n + 1)]\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 1\n\tf = []\n\tfor p in range(2, n):\n\t\tif prime[p]:\n\t\t\tf.append(p)\n\treturn f\n\ndef primeFactors(n):\n\ta = []\n\twhile n % 2 == 0:\n\t\ta.append(2)\n\t\tn = n // 2\n\tfor i in range(3, int(math.sqrt(n)) + 1, 2):\n\t\twhile n % i == 0:\n\t\t\ta.append(i)\n\t\t\tn = n // i\n\tif n > 2:\n\t\ta.append(n)\n\treturn a\n\ndef main():\n\tt = inin()\n\tfor _ in range(t):\n\t\tn = inin()\n\t\ti = 1\n\t\tans = p = 0\n\t\tj = 0\n\t\twhile 1:\n\t\t\tp += i * (i + 1) // 2\n\t\t\tif p > n:\n\t\t\t\tbreak\n\t\t\tans += 1\n\t\t\tj += 1\n\t\t\ti += pow(2, j)\n\t\tprint(ans)\npy2 = round(0.5)\nif py2:\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\trange = xrange\nimport os, sys\nfrom io import IOBase, BytesIO\nBUFSIZE = 8192\n\nclass FastIO(BytesIO):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._file = file\n\t\tself._fd = file.fileno()\n\t\tself.writable = 'x' in file.mode or 'w' in file.mode\n\t\tself.write = super(FastIO, self).write if self.writable else None\n\n\tdef _fill(self):\n\t\ts = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\tself.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n\t\treturn s\n\n\tdef read(self):\n\t\twhile self._fill():\n\t\t\tpass\n\t\treturn super(FastIO, self).read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\ts = self._fill()\n\t\t\tself.newlines = s.count(b'\\n') + (not s)\n\t\tself.newlines -= 1\n\t\treturn super(FastIO, self).readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.getvalue())\n\t\t\t(self.truncate(0), self.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tif py2:\n\t\t\tself.write = self.buffer.write\n\t\t\tself.read = self.buffer.read\n\t\t\tself.readline = self.buffer.readline\n\t\telse:\n\t\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport sys\n\nclass ostream:\n\n\tdef __lshift__(self, a):\n\t\tsys.stdout.write(str(a))\n\t\treturn self\ncout = ostream()\nendl = '\\n'\n\ndef readnumbers(zero=0):\n\tconv = ord if py2 else lambda x: x\n\tA = []\n\tnumb = zero\n\tsign = 1\n\ti = 0\n\ts = sys.stdin.buffer.read()\n\ttry:\n\t\twhile True:\n\t\t\tif s[i] >= b'R'[0]:\n\t\t\t\tnumb = 10 * numb + conv(s[i]) - 48\n\t\t\telif s[i] == b'-'[0]:\n\t\t\t\tsign = -1\n\t\t\telif s[i] != b'\\r'[0]:\n\t\t\t\tA.append(sign * numb)\n\t\t\t\tnumb = zero\n\t\t\t\tsign = 1\n\t\t\ti += 1\n\texcept:\n\t\tpass\n\tif s and s[-1] >= b'R'[0]:\n\t\tA.append(sign * numb)\n\treturn A\nmain()\n", "t = int(input())\nwhile t > 0:\n\tx = int(input())\n\ts = 1\n\tn = 1\n\tans = 1\n\twhile x - n > 0:\n\t\tx = x - n\n\t\ts = s * 2 + 1\n\t\tn = s * (s + 1) // 2\n\t\tif n <= x:\n\t\t\tans += 1\n\tprint(ans)\n\tt -= 1\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tc = 0\n\t(i, a) = (1, 1)\n\twhile n >= a * i:\n\t\tn -= i * a\n\t\tc += 1\n\t\ti = i * 2\n\t\ta += i\n\tprint(c)\n", "def solve(n):\n\tcnt = 0\n\twhile True:\n\t\tx = 2 ** (cnt + 1) - 1\n\t\tneed = x * (x + 1) // 2\n\t\tif need > n:\n\t\t\tbreak\n\t\tcnt += 1\n\t\tn -= need\n\treturn cnt\ntests = int(input())\nfor test in range(tests):\n\tn = int(input())\n\tprint(solve(n))\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\tsq = 2\n\twhile x >= 0:\n\t\tx -= (sq - 1) * ((sq - 1) // 2 + 1)\n\t\tsq *= 2\n\t\tif x < 0:\n\t\t\tbreak\n\t\tans += 1\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nfrom collections import Counter\n\ndef read():\n\tX = int(input().strip())\n\treturn (X,)\n\ndef solve(X, M=10000):\n\tcells = [1]\n\tcell = 1\n\ti = 2\n\twhile cells[-1] <= X:\n\t\tcell = cells[-1] * 2 + (2 ** (i - 1)) ** 2\n\t\tcells.append(cell)\n\t\ti += 1\n\tans = 0\n\tfor a in cells:\n\t\tif X >= a:\n\t\t\tX -= a\n\t\t\tans += 1\n\treturn ans\nT = int(input().strip())\nfor t in range(T):\n\tinputs = read()\n\tprint('%s' % solve(*inputs))\n", "for _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\tfor i in range(1, 40):\n\t\ttemp = 2 ** i - 1\n\t\tsumm = temp * (temp + 1) // 2\n\t\tif x >= summ:\n\t\t\tx -= summ\n\t\t\tans += 1\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nfrom bisect import bisect_left\nfrom bisect import bisect_right\nfrom math import ceil, factorial\n\ndef ceil(x):\n\tif x != int(x):\n\t\tx = int(x) + 1\n\treturn x\n\ndef swaparr(arr, a, b):\n\ttemp = arr[a]\n\tarr[a] = arr[b]\n\tarr[b] = temp\n\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b, a % b)\n\ndef nCr(n, k, modulus=1):\n\tif k > n - k:\n\t\tk = n - k\n\tres = 1\n\tfor i in range(k):\n\t\tres = res * (n - i)\n\t\tres = res / (i + 1)\n\t\tres %= modulus\n\treturn int(res)\n\ndef primefs(n):\n\tprimes = {}\n\twhile n % 2 == 0 and n > 0:\n\t\tprimes[2] = primes.get(2, 0) + 1\n\t\tn = n // 2\n\tfor i in range(3, int(n ** 0.5) + 2, 2):\n\t\twhile n % i == 0 and n > 0:\n\t\t\tprimes[i] = primes.get(i, 0) + 1\n\t\t\tn = n // i\n\tif n > 2:\n\t\tprimes[n] = primes.get(n, 0) + 1\n\treturn primes\n\ndef power(x, y, p):\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef swap(a, b):\n\ttemp = a\n\ta = b\n\tb = temp\n\treturn (a, b)\n\ndef find(x, link):\n\tp = x\n\twhile p != link[p]:\n\t\tp = link[p]\n\twhile x != p:\n\t\tnex = link[x]\n\t\tlink[x] = p\n\t\tx = nex\n\treturn p\n\ndef union(x, y, link, size):\n\tx = find(x, link)\n\ty = find(y, link)\n\tif size[x] < size[y]:\n\t\t(x, y) = swap(x, y)\n\tif x != y:\n\t\tsize[x] += size[y]\n\t\tlink[y] = x\n\ndef sieve(n):\n\tprime = [True for i in range(n + 1)]\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 1\n\treturn prime\nMAXN = int(100000.0 + 5)\n\ndef spf_sieve():\n\tspf[1] = 1\n\tfor i in range(2, MAXN):\n\t\tspf[i] = i\n\tfor i in range(4, MAXN, 2):\n\t\tspf[i] = 2\n\tfor i in range(3, ceil(MAXN ** 0.5), 2):\n\t\tif spf[i] == i:\n\t\t\tfor j in range(i * i, MAXN, i):\n\t\t\t\tif spf[j] == j:\n\t\t\t\t\tspf[j] = i\n\ndef factoriazation(x):\n\tret = {}\n\twhile x != 1:\n\t\tret[spf[x]] = ret.get(spf[x], 0) + 1\n\t\tx = x // spf[x]\n\treturn ret\n\ndef int_array():\n\treturn list(map(int, input().strip().split()))\n\ndef float_array():\n\treturn list(map(float, input().strip().split()))\n\ndef str_array():\n\treturn input().strip().split()\nMOD = int(1000000000.0) + 7\nCMOD = 998244353\nINF = float('inf')\nNINF = -float('inf')\nfor _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\tb = 1\n\twhile x >= b * (b + 1) // 2:\n\t\tans += 1\n\t\tx -= b * (b + 1) // 2\n\t\tb += b + 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ttotal = 0\n\tcalamity = 0\n\tfor i in range(1, 501):\n\t\tj = 2 ** (i - 1)\n\t\ttotal *= 2\n\t\ttotal += j ** 2\n\t\tcalamity += total\n\t\tif calamity >= n:\n\t\t\tbreak\n\tif calamity > n:\n\t\tprint(i - 1)\n\telse:\n\t\tprint(i)\n", "from sys import stdin as r\ninput = r.readline\nl = [1]\ng = [1, 6]\nfor x in range(29):\n\tl.append(l[-1] * 2 + 1)\n\tg.append((l[-1] * 2 + 1) * ((l[-1] * 2 + 2) // 2) + [0, (l[-1] * 2 + 2) // 2][(l[-1] * 2 + 2) % 2])\nfor i in range(int(input())):\n\tn = int(input())\n\ti = 0\n\twhile n >= g[i]:\n\t\tn -= g[i]\n\t\ti += 1\n\tprint(i)\n", "dp = [1]\ncurr = 2\nfor i in range(1, 31):\n\tcurr = 2 ** (2 * i)\n\tdp.append(2 * dp[-1] + curr)\nfor i in range(1, 31):\n\tdp[i] += dp[i - 1]\nfor _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\tfor i in range(len(dp)):\n\t\tif dp[i] == n:\n\t\t\tans = i + 1\n\t\t\tbreak\n\t\telif dp[i] > n:\n\t\t\tans = i\n\t\t\tbreak\n\tprint(ans)\n", "from sys import stdin, stdout\nfrom bisect import bisect_left\nst = lambda : list(stdin.readline().strip())\nli = lambda : list(map(int, stdin.readline().split()))\nmp = lambda : map(int, stdin.readline().split())\ninp = lambda : int(stdin.readline())\npr = lambda n: stdout.write(str(n) + '\\n')\nmod = 1000000007\nINF = float('inf')\n\ndef solve():\n\tn = inp()\n\tans = 0\n\ti = 1\n\tp = 1\n\twhile n >= i * (i + 1) // 2:\n\t\tn -= i * (i + 1) // 2\n\t\ti += pow(2, p)\n\t\tp += 1\n\t\tans += 1\n\tpr(ans)\nfor _ in range(inp()):\n\tsolve()\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tx = int(input())\n\tsu = 0\n\tans = 0\n\tpo = 1\n\twhile su <= x:\n\t\tpo *= 2\n\t\tsu += (po - 1) * po // 2\n\t\tif su <= x:\n\t\t\tans += 1\n\tprint(ans)\n", "import sys\nreadline = sys.stdin.readline\nINF = 1 << 60\n\ndef read_int():\n\treturn int(readline())\n\ndef read_int_n():\n\treturn list(map(int, readline().split()))\n\ndef read_float():\n\treturn float(readline())\n\ndef read_float_n():\n\treturn list(map(float, readline().split()))\n\ndef read_str():\n\treturn readline().strip()\n\ndef read_str_n():\n\treturn readline().strip().split()\n\ndef ep(*args):\n\tprint(*args, file=sys.stderr)\n\ndef mt(f):\n\timport time\n\n\tdef wrap(*args, **kwargs):\n\t\ts = time.perf_counter()\n\t\tret = f(*args, **kwargs)\n\t\te = time.perf_counter()\n\t\tep(e - s, 'sec')\n\t\treturn ret\n\treturn wrap\n\ndef slv(X):\n\tans = 0\n\tn = 1\n\tfor i in range(1, 10000000):\n\t\tm = n * (1 + n) // 2\n\t\tif m <= X:\n\t\t\tX -= m\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\t\tn += 2 ** i\n\treturn ans\n\ndef main():\n\tfor _ in range(read_int()):\n\t\tX = read_int()\n\t\tprint(slv(X))\nmain()\n", "for i in range(int(input())):\n\t(x, z, y, r) = (int(input()), 1, 0, 0)\n\twhile x > 0:\n\t\ty += z\n\t\tk = y * (y + 1) // 2\n\t\tif k <= x:\n\t\t\tx -= k\n\t\telse:\n\t\t\tbreak\n\t\tr += 1\n\t\tz *= 2\n\tprint(r)\n", "from sys import stdin, stdout\nt = int(stdin.readline())\nfor case in range(t):\n\tx = int(stdin.readline())\n\tidx = 1\n\tans = 0\n\twhile x != 0:\n\t\tstairs = (1 << idx) - 1\n\t\tcells = stairs * (stairs + 1)\n\t\tcells = cells // 2\n\t\tif x - cells < 0:\n\t\t\tx = 0\n\t\telse:\n\t\t\tans += 1\n\t\t\tx -= cells\n\t\tidx += 1\n\tstdout.write(f'{ans}\\n')\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tsum1 = 0\n\tbase = 1\n\tans = 0\n\twhile sum1 <= n:\n\t\tsum1 += base * (base + 1) // 2\n\t\tbase = base * 2 + 1\n\t\tans += 1\n\tprint(ans - 1)\n", "from sys import stdin, stdout, setrecursionlimit\nimport threading\n\nclass Tail_Recursion_Optimization:\n\n\tdef __init__(self, recursion_limit, stack_size):\n\t\tsetrecursionlimit(recursion_limit)\n\t\tthreading.stack_size(stack_size)\n\t\treturn None\n\nclass SOLVE:\n\n\tdef solve(self):\n\t\tR = stdin.readline\n\t\tW = stdout.write\n\t\tans = []\n\t\tstair = [0 for i in range(32)]\n\t\tfor i in range(1, 32):\n\t\t\tstair[i] = stair[i - 1] + 2 ** (i - 1)\n\t\tfor i in range(1, 32):\n\t\t\tstair[i] = (stair[i] ** 2 + stair[i]) // 2\n\t\tfor i in range(1, 32):\n\t\t\tstair[i] += stair[i - 1]\n\t\tfor i in range(int(R())):\n\t\t\tx = int(R())\n\t\t\tfor j in range(1, 32):\n\t\t\t\tif stair[j] > x:\n\t\t\t\t\tans.append(str(j - 1))\n\t\t\t\t\tbreak\n\t\tW('\\n'.join(ans))\n\t\treturn 0\n\ndef main():\n\ts = SOLVE()\n\ts.solve()\nthreading.Thread(target=main).start()\n", "def solve(x):\n\tres = 0\n\ti = 1\n\twhile x > 0:\n\t\tans = pow(2, i) - 1\n\t\ttemp = ans * (ans + 1) // 2\n\t\tx -= temp\n\t\ti += 1\n\t\tres += 1\n\tif x == 0:\n\t\tprint(res)\n\telse:\n\t\tprint(res - 1)\nfor _ in range(int(input())):\n\tn = int(input())\n\tsolve(n)\n", "import math, sys\nfrom sys import stdin, stdout\nfrom collections import Counter, defaultdict, deque\ninput = stdin.readline\nI = lambda : int(input())\nli = lambda : list(map(int, input().split()))\n\ndef solve():\n\tn = I()\n\tc = 1\n\tans = 0\n\twhile True:\n\t\tp = 2 ** c\n\t\tp -= 1\n\t\tp = p * (p + 1) // 2\n\t\tif p <= n:\n\t\t\tans += 1\n\t\t\tn -= p\n\t\t\tc += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\nfor _ in range(I()):\n\tsolve()\n", "for _ in range(int(input())):\n\tx = int(input()) - 1\n\tcount_type = 0\n\tn = 1\n\twhile x >= 0:\n\t\tcount_type += 1\n\t\tn = 2 * n + 1\n\t\ttotal_cells = n * (n + 1) // 2\n\t\tx = x - total_cells\n\tprint(count_type)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tn = 0\n\tterm_length = 0\n\tt = 0\n\ttoa = 0\n\twhile True:\n\t\tn += 1\n\t\ttoa += term_length\n\t\tterm_length = toa + 1\n\t\tt = 2 * t + term_length * term_length\n\t\tif x - t >= 0:\n\t\t\tx = x - t\n\t\telse:\n\t\t\tn = n - 1\n\t\t\tbreak\n\tprint(n)\n", "import sys\n\ndef inp():\n\treturn sys.stdin.readline().rstrip('\\n').encode('utf8')\n\ndef mpint():\n\treturn map(int, sys.stdin.readline().split(' '))\n\ndef itg():\n\treturn int(sys.stdin.readline())\nfor __ in range(itg()):\n\tx = itg()\n\ti = 0\n\tcost = 1\n\tans = 0\n\twhile x >= cost:\n\t\tans += 1\n\t\tx -= cost\n\t\ti += 1\n\t\tcost = cost * 2 + (1 << i) ** 2\n\tprint(ans)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef RL():\n\treturn map(int, sys.stdin.readline().rstrip().split())\n\ndef RLL():\n\treturn list(map(int, sys.stdin.readline().rstrip().split()))\n\ndef N():\n\treturn int(input())\n\ndef print_list(l):\n\tprint(' '.join(map(str, l)))\nfor _ in range(N()):\n\tn = N()\n\tres = 0\n\tnow = 1\n\tk = 1\n\twhile n >= now:\n\t\tres += 1\n\t\tk = k * 2 + 1\n\t\tn -= now\n\t\tnow = k * (k + 1) >> 1\n\tprint(res)\n", "MAX = 32\n\ndef cal():\n\tarr = [1]\n\tfor i in range(1, MAX):\n\t\tarr.append(2 * arr[-1] + 1)\n\tD = [0]\n\tfor i in range(MAX):\n\t\tD.append(D[-1] + arr[i] * (arr[i] + 1) // 2)\n\treturn D\n\ndef main():\n\tD = cal()\n\tfor _ in range(int(input())):\n\t\tN = int(input())\n\t\ti = 0\n\t\twhile D[i] <= N:\n\t\t\ti += 1\n\t\tprint(i - 1)\nmain()\n", "for _ in range(int(input())):\n\tx = int(input())\n\t(mul, tmp) = (1, 0)\n\twhile x >= tmp:\n\t\ttmp = 2 ** mul - 1\n\t\tx -= tmp ** 2 // 2\n\t\tmul += 1\n\tprint(mul - 2)\n", "import os\nfrom io import BytesIO, IOBase\nimport sys\nfrom collections import defaultdict, deque\nimport math\nfrom math import *\n\ndef main():\n\ta = [1]\n\tfor i in range(2, 35):\n\t\ta.append(2 * a[-1] + int(pow(2, 2 * (i - 1))))\n\tfor t in range(int(input())):\n\t\tx = int(input())\n\t\tsu = 0\n\t\tj = 0\n\t\tfor i in range(35):\n\t\t\tsu += a[i]\n\t\t\tif su > x:\n\t\t\t\tbreak\n\t\t\tj += 1\n\t\tprint(j)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import sys, os.path\nif os.path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\nsys.setrecursionlimit(10 ** 5)\n\ndef mod():\n\treturn 10 ** 9 + 7\n\ndef i():\n\treturn sys.stdin.readline().strip()\n\ndef ii():\n\treturn int(sys.stdin.readline())\n\ndef li():\n\treturn list(sys.stdin.readline().strip())\n\ndef mii():\n\treturn map(int, sys.stdin.readline().split())\n\ndef lii():\n\treturn list(map(int, sys.stdin.readline().strip().split()))\n\ndef solve():\n\ta = ii()\n\tfor _ in range(a):\n\t\tb = ii()\n\t\tc = 0\n\t\twhile b >= 0:\n\t\t\tfor i in range(1, 10 ** 18):\n\t\t\t\tif b - 2 ** (i - 1) * (2 ** i - 1) >= 0:\n\t\t\t\t\tb -= 2 ** (i - 1) * (2 ** i - 1)\n\t\t\t\t\tc += 1\n\t\t\t\telse:\n\t\t\t\t\tb -= 2 ** (i - 1) * (2 ** i - 1)\n\t\t\t\t\tprint(c)\n\t\t\t\t\tbreak\nfor _ in range(1):\n\tsolve()\n", "def n_steps(blocks, nstairs=0, rolling_cost=0):\n\trolling_cost = rolling_cost * 2 + 4 ** nstairs\n\tif blocks < rolling_cost:\n\t\treturn nstairs\n\telse:\n\t\treturn n_steps(blocks - rolling_cost, nstairs + 1, rolling_cost)\nfor i in range(int(input())):\n\tprint(n_steps(int(input())))\n", "def check(val):\n\tc = 0\n\tfor j in range(val + 1):\n\t\tn = (1 << j) - 1\n\t\tc += (n + 1) * n // 2\n\treturn c > x\ntests = int(input())\nfor _ in range(tests):\n\tx = int(input())\n\tle = 0\n\tr = 100\n\twhile r - le > 1:\n\t\tm = (r + le) // 2\n\t\tif check(m):\n\t\t\tr = m\n\t\telse:\n\t\t\tle = m\n\tprint(le)\n", "def sq_count(dim):\n\tcount = 0\n\tpower = 0\n\twhile dim > 0:\n\t\tcount += 2 ** power * dim ** 2\n\t\tdim = dim // 2\n\t\tpower += 1\n\treturn count\n\ndef solve(cell_count):\n\tinner_square_dim = 1\n\tcount = 0\n\tcells_used = 0\n\twhile True:\n\t\tcells_needed = sq_count(inner_square_dim)\n\t\tif cells_used + cells_needed > cell_count:\n\t\t\treturn count\n\t\tcells_used += cells_needed\n\t\tinner_square_dim *= 2\n\t\tcount += 1\ncases = int(input())\nfor k in range(cases):\n\tcell_count = int(input())\n\tprint(solve(cell_count))\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tif x <= 6:\n\t\tprint(1)\n\telse:\n\t\ti = 1\n\t\tt2 = 0\n\t\twhile x > 0:\n\t\t\tt1 = 2 ** i\n\t\t\tif x - t1 * (t1 - 1) // 2 < 0:\n\t\t\t\tbreak\n\t\t\telse:\n\t\t\t\tt2 += 1\n\t\t\tx -= t1 * (t1 - 1) // 2\n\t\t\ti += 1\n\t\tprint(t2)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = 0\n\tpower2 = 2\n\tcnt = 0\n\twhile s <= n:\n\t\tm = power2 - 1\n\t\ts += m * (m + 1) // 2\n\t\tpower2 = power2 << 1\n\t\tcnt += 1\n\tprint(cnt - 1)\n", "for _ in range(int(input())):\n\tx = int(input())\n\ta = 1\n\tans = 0\n\ttotal = 0\n\twhile True:\n\t\ttemp = a * (a + 1) // 2\n\t\ttotal += temp\n\t\tif total <= x:\n\t\t\tans += 1\n\t\t\ta = a * 2 + 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import bisect\nx = []\nfor i in range(55):\n\tif i == 0:\n\t\tx.append(1)\n\telse:\n\t\tx.append(2 * x[-1] + 4 ** i)\ns = []\nfor i in range(len(x)):\n\tif i == 0:\n\t\ts.append(1)\n\telse:\n\t\ts.append(s[-1] + x[i])\nt = int(input())\nfor _ in range(t):\n\tp = int(input())\n\tj = bisect.bisect_right(s, p)\n\tprint(j)\n", "sum_p = [int((2 ** x - 1) * 2 ** x / 2) for x in range(1, 100)]\n\ndef main():\n\tx = int(input())\n\tout = 0\n\ti = 0\n\twhile x > 0:\n\t\tx -= sum_p[i]\n\t\ti += 1\n\t\tif x >= 0:\n\t\t\tout += 1\n\t\telse:\n\t\t\tbreak\n\tprint(out)\nl = int(input())\nfor i in range(l):\n\tmain()\n", "def fn(x):\n\tif x < 1:\n\t\treturn 0\n\t(prev, count, n) = (1, 1, 2)\n\tx -= 1\n\twhile True:\n\t\ty = 2 ** (2 * n - 2) + (2 ** (n - 1) - 1) * 2 ** (n - 2) + prev\n\t\tif y > x:\n\t\t\tbreak\n\t\tx -= y\n\t\tprev = y\n\t\tcount += 1\n\t\tn += 1\n\treturn count\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tprint(fn(x))\n", "import sys\n\ndef input():\n\treturn sys.stdin.readline()[:-1]\n\ndef getInt():\n\treturn int(input())\n\ndef getIntIter():\n\treturn map(int, input().split())\n\ndef getIntList():\n\treturn list(getIntIter())\n\ndef flush():\n\tsys.stdout.flush()\nfor _ in range(getInt()):\n\tans = 0\n\tupper = getInt()\n\tcurrTotal = 0\n\tcurrVal = 1\n\twhile currTotal <= upper:\n\t\tcurrStair = currVal * (currVal + 1) // 2\n\t\tif currTotal + currStair <= upper:\n\t\t\tcurrTotal += currStair\n\t\t\tans += 1\n\t\t\tcurrVal = currVal * 2 + 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "tc = int(input())\nfor _ in range(tc):\n\tc = int(input())\n\tsumm = 0\n\tsay = 0\n\tk = 0\n\twhile c >= 0:\n\t\tsumm = summ * 2 + 2 ** k\n\t\tc -= summ\n\t\tsay += 1\n\t\tk += 2\n\tprint(say - 1)\n", "from sys import stdin\ninput = stdin.readline\nfor q in range(int(input())):\n\tx = int(input())\n\tres = 0\n\tp = 1\n\twhile 1:\n\t\ty = 2 ** p - 1\n\t\ty = y * (y + 1) // 2\n\t\tif x >= y:\n\t\t\tx -= y\n\t\t\tres += 1\n\t\t\tp += 1\n\t\telse:\n\t\t\tbreak\n\tprint(res)\n", "arr = []\ns = 1\ni = 1\nwhile s < 10 ** 18 + 1:\n\ttemp = s * (s + 1) // 2\n\tarr.append(temp)\n\ts += 2 ** i\n\ti += 1\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tans = 0\n\tj = 0\n\twhile x > 0:\n\t\tif arr[j] <= x:\n\t\t\tx -= arr[j]\n\t\t\tans += 1\n\t\telse:\n\t\t\tx = 0\n\t\tj += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = 0\n\tj = 0\n\tc = 0\n\tfor i in range(100):\n\t\tp = 2 ** i\n\t\tj += p\n\t\tap = j * (j + 1) // 2\n\t\tif s + ap > n:\n\t\t\tbreak\n\t\ts += ap\n\t\tc += 1\n\tprint(c)\n", "from sys import stdin, stdout\n\ndef INPUT():\n\treturn list((int(i) for i in stdin.readline().split()))\n\ndef inp():\n\treturn stdin.readline()\n\ndef out(x):\n\treturn stdout.write(x)\nimport math\nimport random\nJ = 998244353\nfrom collections import deque\nfor _ in range(int(input())):\n\tn = int(input())\n\td = 1\n\tans = 0\n\twhile n > 0:\n\t\tn -= 2 ** (d - 1) * (2 ** d - 1)\n\t\td += 1\n\t\tif n >= 0:\n\t\t\tans += 1\n\tprint(ans)\n", "TC = int(input())\nfor tc in range(TC):\n\tX = int(input())\n\tl = 1\n\tresult = 0\n\twhile X > 0:\n\t\tl = 2 * l + 1\n\t\ts = (l + 1) * l // 2\n\t\tX -= s\n\t\tresult += 1\n\tprint(result)\n", "t = int(input())\nv = 1\nmas = [0 for i in range(60)]\nmas[0] = 1\nmas[1] = 3\nmas[2] = 7\nmas[3] = 15\nmas[4] = 31\nmas[5] = 63\nmas[6] = 127\nmas[7] = 255\nmas[8] = 511\nmas[9] = 1023\nmas[10] = 2047\nmas[11] = 4095\nmas[12] = 8191\nmas[13] = 16383\nmas[14] = 32767\nmas[15] = 65535\nmas[16] = 131071\nmas[17] = 262143\nmas[18] = 524287\nmas[19] = 1048575\nmas[20] = 2097151\nmas[21] = 4194303\nmas[22] = 8388607\nmas[23] = 16777215\nmas[24] = 33554431\nmas[25] = 67108863\nmas[26] = 134217727\nmas[27] = 268435455\nmas[28] = 536870911\nmas[29] = 1073741823\nmas[30] = 2147483647\nmas[31] = 4294967295\nmas[32] = 8589934591\nmas[33] = 17179869183\nmas[34] = 34359738367\nmas[35] = 68719476735\nmas[36] = 137438953471\nmas[37] = 274877906943\nmas[38] = 549755813887\nmas[39] = 1099511627775\nmas[40] = 2199023255551\nmas[41] = 4398046511103\nmas[42] = 8796093022207\nmas[43] = 17592186044415\nmas[44] = 35184372088831\nmas[45] = 70368744177663\nmas[46] = 140737488355327\nmas[47] = 281474976710655\nmas[48] = 562949953421311\nmas[49] = 1125899906842623\nmas[50] = 2251799813685247\nmas[51] = 4503599627370495\nmas[52] = 9007199254740991\nmas[53] = 18014398509481983\nmas[54] = 36028797018963967\nmas[55] = 72057594037927935\nmas[56] = 144115188075855871\nmas[57] = 288230376151711743\nmas[58] = 576460752303423487\nmas[59] = 1152921504606846975\nfor qwerty in range(t):\n\tn = int(input())\n\tv = 0\n\tans = 0\n\twhile n >= 0:\n\t\tn -= (mas[v] * mas[v] - mas[v]) // 2 + mas[v]\n\t\tv += 1\n\tprint(v - 1)\n", "n = 10\nans = [1]\nfor i in range(1, 32):\n\tans.append(ans[-1] * 2 + (2 ** i) ** 2)\nfor i in range(1, len(ans)):\n\tans[i] = ans[i] + ans[i - 1]\nt = int(input())\nfor _ in range(t):\n\tnum = int(input())\n\tj = 0\n\twhile num >= ans[j]:\n\t\tj = j + 1\n\tprint(j)\n", "def func(x):\n\tsum = 0\n\tfor n in range(1, 34):\n\t\ta = 2 ** n - 1\n\t\tsum += a * (a + 1) // 2\n\t\tif sum > x:\n\t\t\treturn n - 1\nfor _ in range(int(input())):\n\tx = int(input())\n\tprint(func(x))\n", "import sys\nfrom array import array\nimport typing as Tp\n\ndef input():\n\treturn sys.stdin.buffer.readline().decode('utf-8')\n\ndef output(*args):\n\tsys.stdout.buffer.write(('\\n'.join(map(str, args)) + '\\n').encode('utf-8'))\n\ndef main():\n\tt = int(input())\n\tans_a = [''] * t\n\tfor ti in range(t):\n\t\tn = int(input()) - 1\n\t\tx = 1\n\t\tans = 1\n\t\twhile n > 0:\n\t\t\tx = x * 2 + 1\n\t\t\tif n < x * (x + 1) // 2:\n\t\t\t\tbreak\n\t\t\tn -= x * (x + 1) // 2\n\t\t\tans += 1\n\t\tans_a[ti] = str(ans)\n\toutput(*ans_a)\nmain()\n", "def getVal(s):\n\treturn 2 ** (n + 1) - n\nfor _ in range(int(input())):\n\tn = int(input())\n\ti = 1\n\tans = 0\n\tprev = 0\n\twhile prev * 2 + i ** 2 <= n:\n\t\tn -= prev * 2 + i ** 2\n\t\tprev = prev * 2 + i ** 2\n\t\ti *= 2\n\t\tans += 1\n\tprint(ans)\n", "V = []\n(n, y) = (0, 0)\nwhile y <= 10 ** 18:\n\tn += 1\n\ty = (2 ** (n + 1) - 1) * (2 ** n - 1) // 3\n\tV.append(y)\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tfor (j, v) in enumerate(V):\n\t\tif v > x:\n\t\t\tbreak\n\tprint(j)\n", "import sys, math\ninput = lambda : sys.stdin.readline().rstrip()\n\ndef make(h):\n\treturn (2 + 1 * (h - 1)) // 2 * h\nfor _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\tif n >= 1:\n\t\tn -= 1\n\t\tans += 1\n\tk = 1\n\twhile True:\n\t\tk += 1\n\t\tn -= make(2 ** k - 1)\n\t\tif n >= 0:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tans = 0\n\tpsum = 0\n\tpower = 0\n\twhile True:\n\t\tpsum += 2 ** power\n\t\tpower += 1\n\t\tstig = psum * (psum + 1) // 2\n\t\tn -= stig\n\t\tif n >= 0:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "def sum_till(n):\n\treturn n * (n + 1) // 2\nfor _ in range(int(input())):\n\ttot = int(input())\n\tn = 1\n\twhile True:\n\t\treq = sum_till(2 ** n - 1)\n\t\tif req > tot:\n\t\t\tprint(n - 1)\n\t\t\tbreak\n\t\ttot -= req\n\t\tn += 1\n", "l = []\nfor x in range(1, 70):\n\tg = (1 << x) - 1\n\tl.append(g * (g + 1) // 2)\nfor t in range(int(input())):\n\tx = int(input())\n\ti = 0\n\tans = 0\n\twhile x > 0:\n\t\tif x >= l[i]:\n\t\t\tx -= l[i]\n\t\t\ti += 1\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tx = int(input())\n\tans = 0\n\theight = 1\n\tstaircase = 1\n\twhile x - staircase >= 0:\n\t\tx -= staircase\n\t\tans += 1\n\t\theight = 2 * height + 1\n\t\tstaircase = (height * height + height) // 2\n\tprint(ans)\n\tt -= 1\n", "for _ in range(int(input())):\n\tn = int(input())\n\tn -= 1\n\tlast = 1\n\tside = 2\n\tans = 1\n\twhile n > 0:\n\t\ta = 2 * last + side ** 2\n\t\tn -= a\n\t\tlast = a\n\t\tif n >= 0:\n\t\t\tans += 1\n\t\tside = 2 * side\n\tprint(ans)\n", "import bisect\nt = int(input())\nres = [1]\ncum = [1]\nm = 2\nfor i in range(2, 100):\n\tres.append(pow(m, 2) + 2 * res[-1])\n\tcum.append(res[-1] + cum[-1])\n\tm *= 2\nfor _ in range(t):\n\tx = int(input())\n\tidx = bisect.bisect_right(cum, x)\n\tprint(idx)\n", "n = int(input())\nres = []\nfor i in range(n):\n\tnum_cell = int(input())\n\tres_ = 0\n\ti = 0\n\twhile True:\n\t\tnum_cell -= 2 ** i * (2 ** (i + 1) - 1)\n\t\tif num_cell < 0:\n\t\t\tres.append(i)\n\t\t\tbreak\n\t\ti += 1\nfor i in res:\n\tprint(i)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ta = 1\n\tc = 0\n\tk = 3\n\td = 4\n\twhile n > 0:\n\t\tif n >= a:\n\t\t\tn -= a\n\t\t\ta = k * (k + 1) // 2\n\t\t\tk += d\n\t\t\td = d * 2\n\t\t\tc += 1\n\t\telse:\n\t\t\tn = 0\n\tprint(c)\n", "t = int(input())\nfor i in range(t):\n\tx = int(input())\n\tans = cnt = 0\n\ttwop = 2\n\twhile ans + (twop - 1 + 1) * (twop - 1) // 2 <= x:\n\t\tans += (twop - 1 + 1) * (twop - 1) // 2\n\t\ttwop *= 2\n\t\tcnt += 1\n\tprint(cnt)\n", "import math\nt = int(input())\nMAX_RANGE = 64\na_vec = [1 for _ in range(MAX_RANGE)]\nfor i in range(2, MAX_RANGE):\n\ta_vec[i] = 2 * a_vec[i - 1] + 2 ** (2 * (i - 1))\na_sum = [a_vec[i] for i in range(MAX_RANGE)]\nfor i in range(2, MAX_RANGE):\n\ta_sum[i] = a_sum[i] + a_sum[i - 1]\nfor _ in range(t):\n\tx = int(input())\n\tfor i in range(1, MAX_RANGE):\n\t\tif a_sum[i] == x:\n\t\t\tprint(i)\n\t\t\tbreak\n\t\telif a_sum[i] > x:\n\t\t\tprint(i - 1)\n\t\t\tbreak\n", "for tt in range(int(input())):\n\tn = int(input())\n\tans = 0\n\tptr = 1\n\tprev = 1\n\twhile n >= prev * (prev + 1) // 2:\n\t\tn -= prev * (prev + 1) // 2\n\t\tans += 1\n\t\tprev += pow(2, ptr)\n\t\tptr += 1\n\tprint(ans)\n", "N = int(input())\nfor _ in range(N):\n\tcells = int(input())\n\ti = 1\n\tprev = 0\n\tx = 1\n\tcnt = 0\n\twhile cells >= x:\n\t\tcells -= x\n\t\ti <<= 1\n\t\tprev = x\n\t\tx = 2 * prev + i * i\n\t\tcnt += 1\n\tprint(cnt)\n", "def countValue(value):\n\tsum = 0\n\tmaxStair = 0\n\tcount = 0\n\twhile sum <= value:\n\t\tmaxStair = maxStair * 2 + (2 ** count) ** 2\n\t\tsum += maxStair\n\t\tcount += 1\n\treturn count - 1\n\ndef main():\n\tk = int(input())\n\tfor i in range(0, k):\n\t\tprint(countValue(int(input())))\nmain()\n", "import math\n\ndef isPerfectSquare(x):\n\tsr = math.sqrt(x)\n\treturn sr - math.floor(sr) == 0\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\tval = 1\n\tc = 2\n\twhile True:\n\t\tif x < val * (val + 1) // 2:\n\t\t\tbreak\n\t\tif val == 1:\n\t\t\tx -= 1\n\t\t\tans += 1\n\t\t\tval += 2\n\t\telse:\n\t\t\tx -= val * (val + 1) // 2\n\t\t\tans += 1\n\t\t\tc *= 2\n\t\t\tval += c\n\tprint(ans)\n", "import bisect\nfrom collections import defaultdict as dd\nimport sys\ninput = sys.stdin.readline\nt = int(input())\nl = [1]\ninf = 10 ** 18\nx = 1\nwhile l[-1] <= inf:\n\tcurr = 2 * x + 1\n\tl.append(l[-1] + curr * (curr + 1) // 2)\n\tx = curr\nwhile t:\n\tn = int(input())\n\tprint(bisect.bisect_right(l, n))\n\tt -= 1\n", "tests = int(input())\nfor t in range(tests):\n\tn = int(input())\n\tk = 1\n\ti = 0\n\tcount = 0\n\tcells = 0\n\tif n == 1:\n\t\tprint(1)\n\t\tcontinue\n\twhile n > -1:\n\t\tj = 2 ** k - 1\n\t\tn = n - j * 2 ** (k - 1)\n\t\tif n >= 0:\n\t\t\tcount += 1\n\t\t\tk += 1\n\tprint(count)\n", "import collections\nfor t in range(int(input())):\n\tn = int(input())\n\tout = 0\n\tbase = 1\n\twhile n >= base * (base + 1) // 2:\n\t\tn -= base * (base + 1) // 2\n\t\tout += 1\n\t\tbase = base * 2 + 1\n\tprint(out)\n", "n = int(input())\nfor i in range(n):\n\tlevel = 1\n\tx = int(input())\n\tcount = 0\n\twhile True:\n\t\tx -= level * (1 + level) // 2\n\t\tcount += 1\n\t\tlevel = level * 2 + 1\n\t\tif x < 0:\n\t\t\tprint(count - 1)\n\t\t\tbreak\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tsb = [0]\n\tfor i in range(40):\n\t\tsb.append(sb[-1] * 2 + 1)\n\tfuck_b = [0]\n\tfor i in sb[1:]:\n\t\tfuck_b.append(fuck_b[-1] + (i + 1) * i // 2)\n\tfor i in range(40):\n\t\tif n < fuck_b[i]:\n\t\t\tprint(i - 1)\n\t\t\tbreak\n", "tt = int(input())\nfor _ in range(tt):\n\tnoOfSquares = int(input())\n\ttotalStairs = 0\n\tlength = 1\n\tp = 1\n\twhile noOfSquares > 0:\n\t\ttotalSquaresRequired = length * (length + 1) // 2\n\t\tif noOfSquares >= totalSquaresRequired:\n\t\t\ttotalStairs += 1\n\t\t\tnoOfSquares -= totalSquaresRequired\n\t\t\tp = p * 2\n\t\t\tlength += p\n\t\telse:\n\t\t\tbreak\n\tprint(totalStairs)\n", "x = 1\nls = []\nwhile x < 1e+18:\n\tls.append(x)\n\tx *= 2\n\tx += 1\nlsn = [0]\nfor i in range(len(ls)):\n\tlsn.append(lsn[-1] + (ls[i] * ls[i] - ls[i]) // 2 + ls[i])\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\ti = 0\n\twhile lsn[i + 1] <= x:\n\t\ti += 1\n\tprint(i)\n", "def solve(n):\n\ti = 1\n\tres = 0\n\twhile True:\n\t\tx = 2 ** i - 1\n\t\tx = x * (x + 1) // 2\n\t\tif x <= n:\n\t\t\tn -= x\n\t\t\tres += 1\n\t\t\ti += 1\n\t\telse:\n\t\t\tbreak\n\treturn res\nT = int(input())\nfor t in range(T):\n\tn = int(input())\n\tprint(solve(n))\n", "from sys import stdin, stdout, stderr, maxsize\ntup = lambda : map(int, stdin.readline().split())\nI = lambda : int(stdin.readline())\nlint = lambda : [int(x) for x in stdin.readline().split()]\nS = lambda : stdin.readline().replace('\\n', '').strip()\nstpr = lambda x: stdout.write(f'{x}' + '\\n')\nstar = lambda x: print(' '.join(map(str, x)))\nfrom math import ceil, floor\nfrom _collections import defaultdict\nfrom bisect import bisect_left, bisect_right\nfor _ in range(I()):\n\tn = I()\n\tans = 0\n\t(val, power) = (1, 2)\n\twhile val <= n:\n\t\tans += 1\n\t\tn -= val\n\t\tval = val * 2 + power * power\n\t\tpower *= 2\n\tprint(ans)\n", "tests = int(input())\nfor t in range(tests):\n\tn = int(input())\n\tk = 1\n\tcount = 0\n\twhile n > -1:\n\t\tn -= (2 ** k - 1) * 2 ** (k - 1)\n\t\tif n >= 0:\n\t\t\tcount += 1\n\t\t\tk += 1\n\tprint(count)\n", "t = int(input())\nfor tc in range(t):\n\tn = int(input())\n\tans = 0\n\ti = 1\n\twhile n > 0:\n\t\tpoww = (1 << i) - 1\n\t\tcur = poww * (poww + 1) // 2\n\t\tif n >= cur:\n\t\t\tn -= cur\n\t\telse:\n\t\t\tbreak\n\t\tans += 1\n\t\ti += 1\n\tprint(ans)\n", "list = []\nfor i in range(1, 32):\n\tcheck = 2 ** i\n\tlist.append(int(check * (check - 1) // 2))\nt = int(input())\nfor j in range(t):\n\tn = int(input())\n\tk = 0\n\twhile n >= list[k]:\n\t\tn -= list[k]\n\t\tk += 1\n\tprint(k)\n", "import sys\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef list2d(a, b, c):\n\treturn [[c for j in range(b)] for i in range(a)]\n\ndef list3d(a, b, c, d):\n\treturn [[[d for k in range(c)] for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e):\n\treturn [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1):\n\treturn int(-(-x // y))\n\ndef INT():\n\treturn int(input())\n\ndef MAP():\n\treturn map(int, input().split())\n\ndef LIST(N=None):\n\treturn list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes():\n\tprint('Yes')\n\ndef No():\n\tprint('No')\n\ndef YES():\n\tprint('YES')\n\ndef NO():\n\tprint('NO')\nINF = 10 ** 19\nMOD = 10 ** 9 + 7\nEPS = 10 ** (-10)\n\ndef rec(sm, cnt, h, x):\n\tif sm > x:\n\t\treturn 0\n\treturn rec(sm + cnt * 2 + (h + 1) ** 2, cnt * 2 + (h + 1) ** 2, h * 2 + 1, x) + 1\nfor _ in range(INT()):\n\tx = INT()\n\tans = rec(1, 1, 1, x)\n\tprint(ans)\n", "import sys\ninp = sys.stdin.buffer.readline\ninar = lambda : list(map(int, inp().split()))\ninin = lambda : int(inp())\ninst = lambda : inp().decode().rstrip('\\n\\r')\nfrom bisect import bisect\nst = [1]\nn = 1e+18\nrem = n\nans = 0\ni = 1\nprev = 0\nused = 0\nwhile rem > 0:\n\tif i * i + 2 * prev <= rem:\n\t\trem -= i * i + 2 * prev\n\t\tans += 1\n\t\tprev = i * i + 2 * prev\n\t\tused += prev\n\t\ti *= 2\n\t\tst.append(used)\n\telse:\n\t\tbreak\n_T_ = inin()\nfor _t_ in range(_T_):\n\tn = inin()\n\tprint(bisect(st, n) - 1)\n", "import sys\nimport collections as cc\nimport bisect as bi\nI = lambda : list(map(int, input().split()))\ncur = 1\n\ndef f(x):\n\treturn x * (x + 1) // 2\nar = [f(2 ** i - 1) for i in range(1, 32)]\nfor i in range(1, len(ar)):\n\tar[i] += ar[i - 1]\nfor tc in range(int(input())):\n\t(n,) = I()\n\ttemp = bi.bisect_right(ar, n)\n\tprint(temp)\n", "for t in range(int(input())):\n\tx = int(input())\n\ts = 1\n\tans = [1]\n\tk = 1\n\tS = 1\n\ttt = [1]\n\twhile S <= x:\n\t\tk = k * 2\n\t\tp = tt[-1] + k\n\t\ttt.append(p)\n\t\tans.append((p + 1) * p // 2)\n\t\tS += ans[-1]\n\tif S > x:\n\t\tprint(len(ans) - 1)\n\telse:\n\t\tprint(len(ans))\n", "l = []\nfor _ in range(int(input())):\n\tn = int(input())\n\ti = 1\n\ta = 1\n\twhile 1:\n\t\tif n <= a * (a * 2 - 1):\n\t\t\tbreak\n\t\telse:\n\t\t\tn = n - a * (a * 2 - 1)\n\t\t\ta = a * 2\n\t\t\ti = i + 1\n\tif n == a * (a * 2 - 1):\n\t\tl.append(i)\n\telse:\n\t\tl.append(i - 1)\nfor i in l:\n\tprint(i)\n", "y = lambda : int(input())\nfor _ in range(y()):\n\tn = y()\n\tc = 0\n\twhile 2 ** (2 * c + 1) - 2 ** c <= n:\n\t\tn -= 2 ** (2 * c + 1) - 2 ** c\n\t\tc += 1\n\tprint(c)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tt = n\n\tz = 1\n\twhile t > 0:\n\t\tp = 2 ** z - 1\n\t\tt -= p * (p + 1) // 2\n\t\tz += 1\n\t\tif t < 0:\n\t\t\tz -= 1\n\tprint(z - 1)\n", "li = [1]\ni = 1\nwhile i <= 10 ** 18:\n\ti = i * 2 + 1\n\tli.append(i)\nfor _ in range(int(input())):\n\tx = int(input())\n\tcnt = 0\n\tfor i in li:\n\t\tif i * (i + 1) // 2 > x:\n\t\t\tbreak\n\t\tx -= i * (i + 1) // 2\n\t\tcnt += 1\n\tprint(cnt)\n", "import sys\nread = sys.stdin.read\nreadlines = sys.stdin.readlines\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\tr = 0\n\t\tt = 1\n\t\twhile n:\n\t\t\tt2 = (t + 1) // 2 * t\n\t\t\tif n >= t2:\n\t\t\t\tn -= t2\n\t\t\t\tr += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\t\tt = t * 2 + 1\n\t\tprint(r)\nmain()\n", "t = int(input())\nd = {1: 1}\nfor i in range(2, 32):\n\td[i] = 2 * d[i - 1] + 2 ** (2 * (i - 1))\nfor _ in range(t):\n\tx = int(input())\n\tacc = 0\n\tfor i in range(1, 32):\n\t\tacc += d[i]\n\t\tif acc > x:\n\t\t\tbreak\n\tprint(i - 1)\n", "from collections import defaultdict as dd\nimport math\nimport sys\ninput = sys.stdin.readline\n\ndef nn():\n\treturn int(input())\n\ndef li():\n\treturn list(input())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef lm():\n\treturn list(map(int, input().split()))\nind = []\ntot = []\nfor i in range(1, 34):\n\treq = (2 ** i - 1) * 2 ** i // 2\n\tind.append(req)\n\tif len(tot) >= 1:\n\t\ttot.append(req + tot[-1])\n\telse:\n\t\ttot.append(req)\n\ndef solve():\n\tn = nn()\n\thave = 0\n\twhile n >= tot[have]:\n\t\thave += 1\n\tprint(have)\n\treturn\nq = nn()\nfor _ in range(q):\n\tsolve()\n", "def func(x):\n\treturn x * (x + 1) // 2\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\ta = [func(2 ** i - 1) for i in range(32)]\n\tb = [sum(a[0:i]) for i in range(1, 33)]\n\tfor i in range(32):\n\t\tif x < b[i]:\n\t\t\tprint(i - 1)\n\t\t\tbreak\n", "import math\nt = int(input())\narr = []\nfor i in range(t):\n\tarr.append(int(input()))\nk = 0\nnice_nums = []\nreq_squares = []\nn = 1\nwhile True:\n\tval = 2 ** n - 1\n\tnice_nums.append(val)\n\treq = val * (val + 1) // 2\n\tif req <= 10 ** 18:\n\t\treq_squares.append(req)\n\telse:\n\t\tbreak\n\tn += 1\nfor i in range(len(arr)):\n\tmax_cells = arr[i]\n\tct = 0\n\tans = 0\n\tfor j in range(len(req_squares)):\n\t\tct += req_squares[j]\n\t\tif ct <= max_cells:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import sys\nn = int(sys.stdin.readline().strip())\ni = 1\nc = 1\nlol = 1\nh = [1]\ncount = [1]\nwhile count[-1] < 1e+19:\n\th.append(2 ** (i + 1) - 1)\n\tcount.append(2 ** (2 * i + 1) - 2 ** i)\n\ti += 1\nfor _ in range(n):\n\tl1 = int(sys.stdin.readline().strip())\n\tv = 0\n\tfor j in range(len(count)):\n\t\tif l1 < count[j]:\n\t\t\tprint(v)\n\t\t\tbreak\n\t\tl1 -= count[j]\n\t\tv += 1\n", "MOD = 1000000007\nfrom collections import defaultdict as dd, Counter, deque\n\ndef si():\n\treturn input()\n\ndef ii():\n\treturn int(input())\n\ndef li():\n\treturn list(map(int, input().split()))\n\ndef mi():\n\treturn map(int, input().split())\n\ndef out(v):\n\tprint(v)\n\ndef spout():\n\tprint(v, end=' ')\n\ndef d2b(n):\n\treturn bin(n).replace('0b', '')\n\ndef twod(n, m, num):\n\treturn [[num for x in range(m)] for y in range(n)]\n\ndef vow():\n\treturn ['a', 'e', 'i', 'o', 'u']\n\ndef let():\n\treturn [chr(i) for i in range(97, 123)]\n\ndef gcd(x, y):\n\twhile y:\n\t\t(x, y) = (y, x % y)\n\treturn x\n\ndef ispow2(x):\n\treturn x and (not x & x - 1)\n\ndef prime_factors(n):\n\ti = 2\n\tfactors = []\n\twhile i * i <= n:\n\t\tif n % i:\n\t\t\ti += 1\n\t\telse:\n\t\t\tn //= i\n\t\t\tfactors.append(i)\n\tif n > 1:\n\t\tfactors.append(n)\n\treturn list(factors)\nt = ii()\nwhile t:\n\tt -= 1\n\tnum = ii()\n\ts = i = 0\n\twhile s <= num:\n\t\tn = pow(2, i) - 1\n\t\ts += n * (n + 1) // 2\n\t\ti += 1\n\tprint(i - 2)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\n\ndef readvars():\n\tk = map(int, input().split())\n\treturn k\n\ndef readlist():\n\tli = list(map(int, input().split()))\n\treturn li\n\ndef anslist(li):\n\tans = ' '.join([str(v) for v in li])\n\treturn ans\n\ndef main():\n\tt = 1\n\tt = int(input())\n\tfor xx in range(t):\n\t\tx = int(input())\n\t\tcells = 1\n\t\tslen = 1\n\t\tnums = 0\n\t\twhile 1:\n\t\t\tside = pow(2, slen) - 1\n\t\t\tcells = (side ** 2 + side) // 2\n\t\t\tx -= cells\n\t\t\tif x < 0:\n\t\t\t\tbreak\n\t\t\tnums += 1\n\t\t\tslen += 1\n\t\tprint(nums)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nsteps = [1]\nsq = 1\nwhile steps[-1] < 10 ** 20:\n\tsq *= 2\n\tsteps.append(steps[-1] * 2 + sq * sq)\nfor _ in range(t):\n\tn = int(input())\n\tans = 0\n\tfor (i, item) in enumerate(steps):\n\t\tif item > n:\n\t\t\tbreak\n\t\tn -= item\n\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tx = int(input())\n\tc = 0\n\ts = 0\n\twhile True:\n\t\tn = 2 ** c - 1\n\t\ts += n * (n + 1) // 2\n\t\tif s > x:\n\t\t\tbreak\n\t\tc += 1\n\tprint(c - 1)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\tsize = 1\n\ttemp = size * (size + 1) // 2\n\twhile x >= temp:\n\t\tans += 1\n\t\tx -= temp\n\t\tsize = 2 * size + 1\n\t\ttemp = size * (size + 1) // 2\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ti = 0\n\tj = 1\n\tsave = 0\n\twhile True:\n\t\tres = j * 2 ** i\n\t\tif res > n:\n\t\t\tbreak\n\t\telse:\n\t\t\tsave += res\n\t\t\tj = j * 2 + 1\n\t\t\ti += 1\n\tif n >= save:\n\t\tprint(i)\n\telse:\n\t\tprint(i - 1)\n", "def solution(n):\n\tarr = [1]\n\twhile arr[-1] <= n:\n\t\tl = 2 ** len(arr)\n\t\tarr.append(arr[-1] * 2 + l * l)\n\tcounter = 0\n\tfor a in arr:\n\t\tif a <= n:\n\t\t\tcounter += 1\n\t\t\tn -= a\n\t\telse:\n\t\t\treturn counter\ntotal = int(input())\nfor i in range(total):\n\tn = int(input())\n\tprint(solution(n))\n", "import math\nt = int(input())\nwhile t > 0:\n\tx = int(input())\n\tp = 30\n\twhile 2 * (pow(4, p) - 1) - 3 * pow(2, p) + 3 > 3 * x:\n\t\tp = p - 1\n\tprint(p)\n\tt = t - 1\n", "def stairs(n):\n\tif n == 1:\n\t\treturn 1\n\ti = 1\n\tj = 1\n\tcount = 0\n\twhile n >= 0:\n\t\tcells = i * (i + 1) // 2\n\t\tn -= cells\n\t\tcount += 1\n\t\ti += 2 ** j\n\t\tj += 1\n\treturn count - 1\nl = int(input())\nfor _ in range(l):\n\tn = int(input())\n\tval = stairs(n)\n\tprint(val)\n", "from math import sqrt\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef prog_name():\n\tn = int(input())\n\tif n == 1:\n\t\tprint(1)\n\telse:\n\t\tcnt = 0\n\t\tini = 0\n\t\twhile n - (pow(2, ini + 1) - 1) * pow(2, ini) >= 0:\n\t\t\tcnt += 1\n\t\t\tn -= (pow(2, ini + 1) - 1) * pow(2, ini)\n\t\t\tini += 1\n\t\tprint(cnt)\n\ndef main():\n\tt = int(input())\n\tfor unique in range(t):\n\t\tprog_name()\nmain()\n", "import sys\nLI = lambda : list(map(int, sys.stdin.readline().strip('\\n').split()))\nMI = lambda : map(int, sys.stdin.readline().strip('\\n').split())\nSI = lambda : sys.stdin.readline().strip('\\n')\nII = lambda : int(sys.stdin.readline().strip('\\n'))\narr = []\nfor i in range(33):\n\t(s, p) = (0, i)\n\tfor j in range(i + 1):\n\t\ts += 2 ** p * (2 ** j) ** 2\n\t\tp -= 1\n\tarr.append(s)\nfor i in range(1, 33):\n\tarr[i] += arr[i - 1]\nfor _ in range(II()):\n\tx = II()\n\tfor i in range(33):\n\t\tif arr[i] > x:\n\t\t\tbreak\n\tprint(i)\n", "inputed = []\ncount = int(input())\n\ndef niceK(k):\n\treturn (2 ** k - 1) * 2 ** (k - 1)\nlinesPer = 1\nfor i in range(count * linesPer):\n\tinputed.append(input())\nt = 0\nfor i in range(count):\n\tinputed[t] = int(inputed[t])\n\tcells = inputed[t]\n\tcount = 0\n\twhile cells >= niceK(count + 1):\n\t\tcells -= niceK(count + 1)\n\t\tcount += 1\n\tprint(count)\n\tt += linesPer\n", "t = int(input())\nwhile t:\n\tt = t - 1\n\tn = int(input())\n\tout = 0\n\ti = 1\n\tcnt = 0\n\twhile out <= n:\n\t\tcnt += 1\n\t\tout += i * (i + 1) // 2\n\t\ti = i * 2 + 1\n\tprint(cnt - 1)\n", "from __future__ import division, print_function\nfrom fractions import Fraction\nimport sys\nimport os\nfrom io import BytesIO, IOBase\nfrom itertools import *\nimport bisect\nfrom heapq import *\nfrom math import *\nfrom copy import *\nfrom collections import deque\nfrom collections import Counter as counter\nfrom itertools import combinations as comb\nfrom itertools import permutations as permutate\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nfrom bisect import bisect\nBUFSIZE = 8192\nfrom sys import stderr\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\nif sys.version_info[0] < 3:\n\t(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\nfrom types import GeneratorType\n\ndef iterative(f, stack=[]):\n\n\tdef wrapped_func(*args, **kwargs):\n\t\tif stack:\n\t\t\treturn f(*args, **kwargs)\n\t\tto = f(*args, **kwargs)\n\t\twhile True:\n\t\t\tif type(to) is GeneratorType:\n\t\t\t\tstack.append(to)\n\t\t\t\tto = next(to)\n\t\t\t\tcontinue\n\t\t\tstack.pop()\n\t\t\tif not stack:\n\t\t\t\tbreak\n\t\t\tto = stack[-1].send(to)\n\t\treturn to\n\treturn wrapped_func\nmod = 1000000007\n\ndef inp():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\n\ndef out(var):\n\tsys.stdout.write(str(var))\n\ndef lis():\n\treturn list(map(int, inp().split()))\n\ndef stringlis():\n\treturn list(map(str, inp().split()))\n\ndef sep():\n\treturn map(int, inp().split())\n\ndef strsep():\n\treturn map(str, inp().split())\n\ndef zerolist(n):\n\treturn [0] * n\n\ndef nextline():\n\tout('\\n')\n\ndef testcase(t):\n\tfor p in range(t):\n\t\tsolve()\n\ndef printlist(a):\n\tfor p in range(0, len(a)):\n\t\tout(str(a[p]) + ' ')\n\ndef pow(x, y, p):\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\nfrom functools import reduce\n\ndef factors(n):\n\treturn set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))\n\ndef gcd(a, b):\n\tif a == b:\n\t\treturn a\n\twhile b > 0:\n\t\t(a, b) = (b, a % b)\n\treturn a\n\ndef solve():\n\tn = int(inp())\n\tj = 1\n\ti = 2 ** j - 1\n\treq = i * (i + 1) // 2\n\tk = n\n\tc = 0\n\twhile k >= req:\n\t\tc += 1\n\t\tk -= req\n\t\tj += 1\n\t\ti = 2 ** j - 1\n\t\treq = i * (i + 1) // 2\n\tprint(c)\ntestcase(int(inp()))\n", "import math\ndp = [1]\nt = 1\ni = 1\nwhile t < pow(10, 18):\n\ts = 2 ** i\n\ti += 1\n\tt = 2 * dp[-1] + s * s\n\tdp.append(t)\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = 0\n\tc = 0\n\tfor i in dp:\n\t\tif s + i > n:\n\t\t\tbreak\n\t\ts += i\n\t\tc += 1\n\tprint(c)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tans = 0\n\ti = 0\n\tcur = 0\n\twhile x >= 0:\n\t\tcur += pow(2, i)\n\t\tx -= (1 + cur) * cur // 2\n\t\tans += 1\n\t\ti += 1\n\tprint(ans - 1)\n", "from sys import stdin, stdout\nfrom math import gcd, sqrt, factorial, pi\nfrom collections import deque, defaultdict\ninput = stdin.readline\nR = lambda : map(int, input().split())\nI = lambda : int(input())\nS = lambda : input().rstrip('\\n')\nL = lambda : list(R())\nP = lambda x: stdout.write(x)\nlcm = lambda x, y: x * y // gcd(x, y)\nhg = lambda x, y: (y + x - 1) // x * x\npw = lambda x: 1 if x == 1 else 1 + pw(x // 2)\nchk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False\nsm = lambda x: (x ** 2 + x) // 2\nN = 10 ** 9 + 7\nfor _ in range(I()):\n\tn = I()\n\tp = 1\n\tk = 0\n\tbl = 1\n\twhile bl <= n:\n\t\tk += 1\n\t\tn -= bl\n\t\tbl = bl + bl + (p + 1) ** 2\n\t\tp += p + 1\n\tprint(k)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tn = x\n\tcnt = 0\n\tl = 0\n\tfor i in range(n):\n\t\tl += 2 ** i\n\t\tnum = l * (l + 1) // 2\n\t\tif x >= num:\n\t\t\tcnt += 1\n\t\t\tx -= num\n\t\telse:\n\t\t\tbreak\n\tprint(cnt)\n", "import sys\ninput = lambda : sys.stdin.readline().rstrip()\na = [1]\nv = [1]\nfor i in range(64):\n\ta.append(2 * a[-1] + 1)\n\tv.append(a[-1] * (a[-1] + 1) // 2)\nfor _ in range(int(input())):\n\tn = int(input())\n\ti = 0\n\tans = 0\n\twhile n >= v[i]:\n\t\tn -= v[i]\n\t\tans += 1\n\t\ti += 1\n\tprint(ans)\n", "import sys\nimport math\nfrom math import inf, gcd\nfrom functools import *\nfrom itertools import *\nfrom collections import *\nfrom typing import *\nsys.setrecursionlimit(10 ** 7)\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tj = 1\n\tans = 0\n\twhile n >= (j + 1) * j // 2:\n\t\tn -= (j + 1) * j // 2\n\t\tans += 1\n\t\tj = j * 2 + 1\n\tprint(ans)\n", "for k in range(int(input())):\n\tn = int(input())\n\tm = 0\n\ti = 1\n\tj = 1\n\twhile j <= n:\n\t\tif i * (i + 1) // 2 > n:\n\t\t\tbreak\n\t\tn -= i * (i + 1) // 2\n\t\tm += 1\n\t\ti = 2 ** (j + 1) - 1\n\t\tj += 1\n\tprint(m)\n", "for _ in ' ' * int(input()):\n\ta = [6]\n\tn = int(input())\n\ti = 4\n\twhile n > sum(a):\n\t\ta += [a[len(a) - 1] * 2 + i ** 2]\n\t\ti *= 2\n\tprint(len(a))\n", "from collections import Counter, defaultdict\nfrom sys import stdin, stdout\ninput = stdin.readline\nI = lambda : int(input())\nM = lambda : map(int, input().split())\nLI = lambda : list(map(int, input().split()))\nfor _ in range(I()):\n\tn = I()\n\ti = 1\n\tj = 0\n\tans = 0\n\twhile True:\n\t\ti *= 2\n\t\tj += i * (i - 1) // 2\n\t\tif j > n:\n\t\t\tprint(ans)\n\t\t\tbreak\n\t\tans += 1\n", "def can(no, mid):\n\tfor i in range(1, mid + 1):\n\t\ttmp_no = pow(2, i) - 1\n\t\tno -= tmp_no * (tmp_no + 1) // 2\n\tif no >= 0:\n\t\treturn 1\n\telse:\n\t\treturn 0\ncas = int(input())\nwhile cas:\n\tcas -= 1\n\tno = int(input())\n\tx = 1\n\ty = 100\n\twhile x + 1 < y:\n\t\tmid = x + (y - x) // 2\n\t\tif can(no, mid):\n\t\t\tx = mid\n\t\telse:\n\t\t\ty = mid\n\tprint(x)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tval = 1\n\tsumm = 1\n\tcount = 0\n\tcells = 1\n\twhile n - cells >= 0:\n\t\tn -= cells\n\t\tcount += 1\n\t\tsumm += pow(2, val)\n\t\tcells = summ * (summ + 1) // 2\n\t\tval += 1\n\tprint(count)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tsm = 0\n\tcnt = 0\n\tn = 2\n\tk = 1\n\twhile True:\n\t\ta = (n - 1) * n // 2\n\t\tsm += a\n\t\tif sm > x:\n\t\t\tbreak\n\t\telse:\n\t\t\tcnt += 1\n\t\t\tn *= 2\n\tprint(cnt)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\t(s, p) = (0, 0)\n\twhile s <= x:\n\t\tt = 2 ** p\n\t\ts += 2 * t * t - t\n\t\tp += 1\n\tprint(p - 1)\n", "max_range = 101\nlis_range = [1 for i in range(0, max_range)]\nx = 2\nfor i in range(2, max_range - 1):\n\tlis_range[i] = 2 * lis_range[i - 1] + pow(2, x)\n\tx += 2\nfor i in range(2, max_range - 1):\n\tlis_range[i] += lis_range[i - 1]\nfor i in range(int(input())):\n\tx = int(input())\n\tfor k in range(2, max_range):\n\t\tif x == lis_range[k]:\n\t\t\tprint(k)\n\t\t\tbreak\n\t\telif x < lis_range[k]:\n\t\t\tprint(k - 1)\n\t\t\tbreak\n", "from collections import Counter\nfrom collections import OrderedDict\nfrom collections import defaultdict\n\ndef SOCountR(mylist):\n\treturn OrderedDict(sorted(Counter(mylist).items(), reverse=True))\n\ndef SOCount(mylist):\n\treturn OrderedDict(sorted(Counter(mylist).items()))\n\ndef freq_count(mylist):\n\treturn Counter(mylist)\nt = int(input())\narr = [pow(2, i + 1) - 1 for i in range(60)]\nfor _ in range(t):\n\tn = int(input())\n\tans = 0\n\tind = 0\n\twhile n - arr[ind] * (arr[ind] + 1) // 2 >= 0:\n\t\tn = n - arr[ind] * (arr[ind] + 1) // 2\n\t\tans += 1\n\t\tind += 1\n\tprint(ans)\n", "import sys\ninp = sys.stdin.buffer.readline\ninar = lambda : list(map(int, inp().split()))\ninin = lambda : int(inp())\ninst = lambda : inp().decode().rstrip('\\n\\r')\n_T_ = inin()\nfor _t_ in range(_T_):\n\tn = inin()\n\trem = n\n\tans = 0\n\ti = 1\n\tprev = 0\n\twhile rem > 0:\n\t\tif i * i + 2 * prev <= rem:\n\t\t\trem -= i * i + 2 * prev\n\t\t\tans += 1\n\t\t\tprev = i * i + 2 * prev\n\t\t\ti *= 2\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "n = 1\nnn = 1\na = []\nwhile nn <= 10 ** 19:\n\ta.append([n, nn])\n\tn = 2 * n + 1\n\tnn = n * (n + 1) // 2\ntest = int(input())\nfor t in range(0, test):\n\tx = int(input())\n\tc = 0\n\ti = 0\n\twhile x - a[i][1] >= 0:\n\t\tc += 1\n\t\tx -= a[i][1]\n\t\ti += 1\n\tprint(c)\n", "import sys\nimport math\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tcnt = 0\n\tn = int(input())\n\ti = 0\n\twhile n >= 0:\n\t\ti += 1\n\t\tcnt = pow(2, i) - 1\n\t\tn -= cnt * (cnt + 1) // 2\n\tprint(i - 1)\n", "T = int(input())\nmaxv = 10 ** 18\nfor t in range(T):\n\tx = int(input())\n\ti = 0\n\tcnt = 0\n\ti = 1\n\twhile True:\n\t\treq = (1 + i) * i // 2\n\t\tif x - req >= 0:\n\t\t\tx -= req\n\t\t\tcnt += 1\n\t\t\ti = i + 2 ** cnt\n\t\telse:\n\t\t\tbreak\n\tprint(cnt)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tz = x\n\tans = 0\n\td = 2\n\twhile (d - 1) * d // 2 <= z:\n\t\tz -= (d - 1) * d // 2\n\t\td *= 2\n\t\tans += 1\n\tprint(ans)\n", "def inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s)])\n\ndef invr():\n\treturn map(int, input().split())\nn = inp()\nfor i in range(n):\n\tx = inp()\n\tl = 0\n\tcells = 0\n\tcnt = 0\n\twhile x >= 0:\n\t\tcells = (l + 1) * (l + 1) + 2 * cells\n\t\tl = 2 * l + 1\n\t\tx -= cells\n\t\tcnt += 1\n\tcnt -= 1\n\tprint(cnt)\n", "import math\nfor _ in range(int(input())):\n\tn = int(input())\n\tlengths = [1]\n\ttotal_area = 1\n\tlengths.append(2 * lengths[-1] + 1)\n\tadd = lengths[-1] * (lengths[-1] + 1) // 2\n\twhile total_area + add <= n:\n\t\ttotal_area += add\n\t\tlengths.append(2 * lengths[-1] + 1)\n\t\tadd = lengths[-1] * (lengths[-1] + 1) // 2\n\tprint(len(lengths) - 1)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\ndp = [1]\nfor i in range(1, 31):\n\tdp.append((2 ** i) ** 2 + dp[-1] * 2)\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tcount = 0\n\ti = 0\n\twhile n > 0:\n\t\tn -= dp[i]\n\t\tcount += 1\n\t\ti += 1\n\tif n < 0:\n\t\tcount -= 1\n\tprint(count)\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tx = int(input())\n\ta = 0\n\ti = 1\n\tb = a * (a + 1) // 2\n\twhile b <= x:\n\t\ta = 2 * a + 1\n\t\tb += a * (a + 1) // 2\n\t\ti += 1\n\tprint(i - 2)\n", "t = int(input())\nK = []\np = 1\ntotal = 0\nwhile True:\n\tif p > 10 ** 20:\n\t\tbreak\n\ttotal += p\n\tK.append(total)\n\tp *= 2\nT = []\nfor i in range(len(K)):\n\tT.append((1 + K[i]) * K[i] // 2)\nAns = []\nfor i in range(t):\n\tA = int(input())\n\tc = 0\n\tj = 0\n\twhile True:\n\t\tif A - T[j] < 0:\n\t\t\tbreak\n\t\tA -= T[j]\n\t\tj += 1\n\t\tc += 1\n\tAns.append(c)\nfor i in range(t):\n\tprint(Ans[i])\n", "from bisect import bisect_left\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nfrom collections import Counter, defaultdict\nfrom collections import deque\nfrom functools import cmp_to_key\nimport math\nimport heapq\nimport re\n\ndef sin():\n\treturn input()\n\ndef ain():\n\treturn list(map(int, sin().split()))\n\ndef sain():\n\treturn input().split()\n\ndef iin():\n\treturn int(sin())\nMAX = float('inf')\nMIN = float('-inf')\nMOD = 1000000007\n\ndef sieve(n):\n\tprime = [True for i in range(n + 1)]\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 1\n\ts = set()\n\tfor p in range(2, n + 1):\n\t\tif prime[p]:\n\t\t\ts.add(p)\n\treturn s\n\ndef readTree(n, m):\n\tadj = [deque([]) for _ in range(n + 1)]\n\tfor _ in range(m):\n\t\t(u, v) = ain()\n\t\tadj[u].append(v)\n\t\tadj[v].append(u)\n\treturn adj\n\ndef main():\n\tfor _ in range(iin()):\n\t\tx = iin()\n\t\tflag = 1\n\t\tans = 0\n\t\tp = 1\n\t\twhile flag:\n\t\t\tj = p * (p + 1) // 2\n\t\t\tif x >= j:\n\t\t\t\tans += 1\n\t\t\t\tx -= j\n\t\t\telse:\n\t\t\t\tbreak\n\t\t\tp = p * 2 + 1\n\t\tprint(ans)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\nif os.getcwd() == 'D:\\\\code':\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\n\tinput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import os, sys\nfrom io import BytesIO, IOBase\n\ndef main():\n\tfor i in range(int(input())):\n\t\tn = int(input())\n\t\tx = [1, 6, 28, 120, 496, 2016, 8128, 32640, 130816, 523776, 2096128, 8386560, 33550336, 134209536, 536854528, 2147450880, 8589869056, 34359607296, 137438691328, 549755289600, 2199022206976, 8796090925056, 35184367894528, 140737479966720, 562949936644096, 2251799780130816, 9007199187632128, 36028796884746240, 144115187807420416, 576460751766552576]\n\t\tfor j in range(1, len(x)):\n\t\t\tx[j] = x[j] + x[j - 1]\n\t\tan = 1\n\t\tfor j in range(len(x)):\n\t\t\tif n < x[j]:\n\t\t\t\tprint(j)\n\t\t\t\tan = -1\n\t\t\t\tbreak\n\t\tif an == 1:\n\t\t\tprint(30)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "t = int(input())\nwhile t != 0:\n\tt -= 1\n\tres = 0\n\tn = int(input())\n\tfor i in range(1, 64, 1):\n\t\tj = (1 << i) - 1\n\t\tif n >= int(j * (j + 1) / 2):\n\t\t\tn -= int(j * (j + 1) / 2)\n\t\t\tres += 1\n\tprint(res)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ti = 1\n\twhile True:\n\t\tx = pow(2, i - 1) * (pow(2, i) - 1)\n\t\tif n < x:\n\t\t\tbreak\n\t\tn -= x\n\t\ti += 1\n\tprint(i - 1)\n", "import math\nnV = 4\nINF = 999\n\ndef floyd_warshall(G):\n\tdistance = list(map(lambda i: list(map(lambda j: j, i)), G))\n\tfor k in range(nV):\n\t\tfor i in range(nV):\n\t\t\tfor j in range(nV):\n\t\t\t\tdistance[i][j] = min(distance[i][j], distance[i][k] + distance[k][j])\n\tprint_solution(distance)\nfrom collections import defaultdict\n\ndef print_solution(distance):\n\tfor i in range(nV):\n\t\tfor j in range(nV):\n\t\t\tif distance[i][j] == INF:\n\t\t\t\tprint('INF', end=' ')\n\t\t\telse:\n\t\t\t\tprint(distance[i][j], end='  ')\n\t\tprint(' ')\ntt = int(input())\nfor _ in range(tt):\n\tn = int(input())\n\tc = 0\n\tt = 0\n\tj = 1\n\twhile j <= n:\n\t\ttemp = (2 ** j - 1) * 2 ** j // 2\n\t\tif n < t + temp:\n\t\t\tbreak\n\t\tt += temp\n\t\tc += 1\n\t\tj += 1\n\tprint(c)\n", "from decimal import Decimal\nt = int(input())\nfor test in range(t):\n\tx = int(input())\n\tnum = Decimal(1)\n\ta = Decimal(1)\n\tidx = Decimal(1)\n\tres = Decimal(0)\n\twhile x >= a:\n\t\tres += 1\n\t\tx -= a\n\t\tidx = 2 * idx\n\t\tnum = idx + num\n\t\ta = 2 * a + ((num + Decimal(1)) / Decimal(2)) ** 2\n\tprint(res)\n", "def stairs(n):\n\tif n == 1:\n\t\treturn 1\n\tk = n\n\ttemp = 0\n\tcnt = 0\n\tp = 0\n\ti = 1\n\twhile n >= 0:\n\t\ttemp = i * (i + 1) // 2\n\t\tn -= temp\n\t\tif n >= 0:\n\t\t\tcnt += 1\n\t\t\tp += 1\n\t\t\ti += 2 ** p\n\t\telse:\n\t\t\tbreak\n\treturn cnt\nt = int(input())\nfor i in range(t):\n\tprint(stairs(int(input())))\n", "from os import path\nimport sys\nfrom heapq import heappush, heappop\nfrom functools import cmp_to_key as ctk\nfrom collections import deque, defaultdict as dd\nfrom bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right\nfrom itertools import permutations\nfrom datetime import datetime\nfrom math import ceil, sqrt, log, gcd\n\ndef ii():\n\treturn int(input())\n\ndef si():\n\treturn input().rstrip()\n\ndef mi():\n\treturn map(int, input().split())\n\ndef li():\n\treturn list(mi())\nabc = 'abcdefghijklmnopqrstuvwxyz'\nmod = 1000000007\ninf = float('inf')\nvow = ['a', 'e', 'i', 'o', 'u']\n(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])\n\ndef bo(i):\n\treturn ord(i) - ord('a')\n\ndef solve():\n\ta = [1, 3, 7, 15]\n\twhile 1:\n\t\tx = a[-1]\n\t\ts = x * (x + 1) // 2\n\t\tif s > 1e+18:\n\t\t\tbreak\n\t\ta.append(2 * a[-1] + 1)\n\tfor _ in range(ii()):\n\t\tn = ii()\n\t\tcnt = 0\n\t\twhile n:\n\t\t\tx = a[cnt] * (a[cnt] + 1) // 2\n\t\t\tif n < x:\n\t\t\t\tbreak\n\t\t\tn -= x\n\t\t\tcnt += 1\n\t\tprint(cnt)\nif path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nelse:\n\tinput = sys.stdin.readline\nsolve()\n", "from sys import stdin, stdout\nfrom bisect import bisect_left\nx = 2\ncnt = 1\nreq = [1]\nwhile x <= int(1e+18 + 1):\n\tx <<= 1\n\tt = x * (x - 1) // 2\n\treq.append(t)\ntest = int(stdin.readline())\nfor _ in range(test):\n\tn = int(stdin.readline())\n\tsm = 0\n\ti = 0\n\twhile True:\n\t\tsm += req[i]\n\t\tif sm > n:\n\t\t\tans = i\n\t\t\tbreak\n\t\ti += 1\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nfrom itertools import accumulate\nimport bisect\nLIST = [1]\nfor i in range(100):\n\tLIST.append(LIST[-1] * 2 + 1)\nLIST2 = [l * (l + 1) // 2 for l in LIST]\nS = list(accumulate(LIST2))\nt = int(input())\nfor tests in range(t):\n\tx = int(input())\n\tprint(bisect.bisect_right(S, x))\n", "import bisect\nt = int(input())\ns = [0] * 40\nfor i in range(1, 40):\n\ts[i] = (2 ** (i - 1)) ** 2 + s[i - 1] * 2\nss = [0] * 41\nfor i in range(1, 40):\n\tss[i] = ss[i - 1] + s[i]\nfor i in range(t):\n\tx = int(input())\n\tans = bisect.bisect_right(ss, x) - 1\n\tprint(ans)\n", "t = int(input())\nwhile t != 0:\n\tn = int(input())\n\ts = 0\n\ti = 0\n\tlist1 = []\n\tcount = 0\n\twhile s < n:\n\t\tp = pow(2, i)\n\t\tif len(list1) == 0:\n\t\t\tlist1.append(1)\n\t\t\tcount += 1\n\t\t\ts = 1\n\t\telse:\n\t\t\tlist1[-1] = list1[-1] + p\n\t\t\ts += list1[-1] * (list1[-1] + 1) // 2\n\t\t\tif s <= n:\n\t\t\t\tcount += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\ti += 1\n\tprint(count)\n\tt -= 1\n", "ts = int(input())\nl = [1]\nfor i in range(2, 32):\n\tl.append(2 ** i - 1)\n\ndef nsum(n):\n\treturn n * (n + 1) // 2\nfor t in range(ts):\n\tx = int(input())\n\ti = 0\n\twhile x > 0:\n\t\tif x - nsum(l[i]) >= 0:\n\t\t\tx -= nsum(l[i])\n\t\t\ti += 1\n\t\telse:\n\t\t\tbreak\n\tprint(i)\n", "for t in range(int(input())):\n\tx = int(input())\n\tn = 0\n\tans = 0\n\tp = 1\n\tfor i in range(1, 100):\n\t\tn = n * 2 + p * p\n\t\tx -= n\n\t\tp *= 2\n\t\tif x < 0:\n\t\t\tbreak\n\t\tans += 1\n\tprint(ans)\n", "checker = [(2 ** n - 1) * (2 ** n - 1 + 1) // 2 for n in range(1000)]\nfor _ in range(int(input())):\n\tN = int(input())\n\tcounter = 0\n\tfor i in range(1000):\n\t\tN -= checker[i]\n\t\tif N < 0:\n\t\t\tprint(counter - 1)\n\t\t\tbreak\n\t\tif N == 0:\n\t\t\tprint(counter)\n\t\t\tbreak\n\t\tcounter += 1\n", "nice = [1]\nwhile nice[-1] <= 10 ** 18:\n\tnice.append((nice[-1] << 1) + 1)\nfor i in range(len(nice)):\n\tnice[i] = nice[i] * (nice[i] + 1) // 2\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\ti = 0\n\tnum = 0\n\twhile x > 0 and i < len(nice):\n\t\tif x >= nice[i]:\n\t\t\tx -= nice[i]\n\t\t\tnum += 1\n\t\ti += 1\n\tprint(num)\n", "import sys, os, io\nI = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nN = int(1e+18)\nl = []\nn = 1\nwhile True:\n\tx = n * (n + 1) // 2\n\tif x <= N:\n\t\tl.append(x)\n\telse:\n\t\tbreak\n\tn += n + 1\nl.append(N + N)\nfor i in range(1, len(l)):\n\tl[i] += l[i - 1]\nfor tc in range(1, 1 + int(I())):\n\tx = int(I())\n\tfor i in range(len(l)):\n\t\tif l[i] > x:\n\t\t\tprint(i)\n\t\t\tbreak\n", "from math import *\nfrom cmath import *\nfrom decimal import *\nfrom fractions import *\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\t(s, k) = (0, 0)\n\twhile s < n:\n\t\tk += 1\n\t\ts += (1 << k - 1) * ((1 << k) - 1)\n\tif s > n:\n\t\tk -= 1\n\tprint(k)\n", "import sys\nfrom collections import deque\nfrom math import ceil, sqrt, gcd, factorial, log\nfrom bisect import bisect_right, bisect_left\nmod = 1000000007\nINF = 10 ** 18\nNINF = -INF\n\ndef INT():\n\treturn int(input())\n\ndef MAP():\n\treturn map(int, input().split())\n\ndef LIST():\n\treturn list(map(int, input(), split()))\n\ndef modi(x):\n\treturn pow(x, mod - 2, mod)\n\ndef lcm(x, y):\n\treturn x * y // gcd(x, y)\n\ndef write(l):\n\tfor i in l:\n\t\tprint(i, end=' ')\n\tprint()\n\ndef fun(x):\n\treturn x * (x - 1) // 2\nfor _ in range(int(input())):\n\tx = int(input())\n\ti = 1\n\tans = 0\n\twhile fun(2 ** i) <= x:\n\t\tans += 1\n\t\tx -= fun(2 ** i)\n\t\ti += 1\n\tprint(ans)\n", "import sys, bisect, math\nmv = 61\nA = []\nfor i in range(1, mv + 1):\n\tval = int(math.pow(2, i)) - 1\n\tA.append(val * (val + 1) // 2)\nT = int(input())\nfor _ in range(T):\n\tN = int(input())\n\tans = 0\n\tv = 0\n\tfor i in A:\n\t\tv = v + i\n\t\tif v > N:\n\t\t\tbreak\n\t\tans = ans + 1\n\tprint(ans)\n", "ans = [2 ** i - 1 for i in range(1, 1000)]\nans = [tmp * (tmp + 1) // 2 for tmp in ans]\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tcnt = 0\n\tval = 0\n\tfor i in range(100):\n\t\tif val + ans[i] <= n:\n\t\t\tcnt += 1\n\t\t\tval += ans[i]\n\t\telse:\n\t\t\tbreak\n\tprint(cnt)\n", "import sys, os.path\nfrom collections import *\nfrom copy import *\nimport math\nmod = 10 ** 9 + 7\nif os.path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nfor t in range(int(input())):\n\tn = int(input())\n\tt = 2\n\tans = 0\n\twhile n >= 0:\n\t\tif n >= t * (t - 1) // 2:\n\t\t\tn -= t * (t - 1) // 2\n\t\t\tt *= 2\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\tpower = 0\n\tused = 0\n\tx = 0\n\tans = 0\n\twhile used + (2 ** power + x) * (2 ** power + 1 + x) // 2 <= n:\n\t\tans += 1\n\t\tused += (2 ** power + x) * (2 ** power + 1 + x) // 2\n\t\tx += 2 ** power\n\t\tpower += 1\n\tprint(ans)\n", "p = int(input())\nfor _ in range(p):\n\tn = int(input())\n\tsum = 0\n\tk = 0\n\tif 1 == 3:\n\t\tprint(\"Paran's Code\")\n\tfor j in range(31):\n\t\tsum = sum + 2 ** j\n\t\tif sum * (sum + 1) // 2 + k == n:\n\t\t\tprint(j + 1)\n\t\t\tbreak\n\t\telif sum * (sum + 1) // 2 + k > n:\n\t\t\tprint(j)\n\t\t\tbreak\n\t\telse:\n\t\t\tk = k + sum * (sum + 1) // 2\n", "n = int(input())\nmas = [1]\nfor i in range(n):\n\tx = int(input())\n\tsumm = 0\n\tk = 0\n\twhile summ <= x:\n\t\tif len(mas) <= k:\n\t\t\tmas.append(2 ** (2 * len(mas)) + mas[-1] * 2)\n\t\tsumm += mas[k]\n\t\tk += 1\n\tprint(k - 1)\n", "import sys\n\ndef squares(n):\n\treturn n * (n + 1) // 2\n\ndef main():\n\tt = Iint()\n\tfor _ in range(t):\n\t\tx = Iint()\n\t\tans = 0\n\t\ts = 1\n\t\twhile x - squares(s) >= 0:\n\t\t\tx -= squares(s)\n\t\t\ts = 2 * s + 1\n\t\t\tans += 1\n\t\tprint(ans)\nen = enumerate\nFIO = 10\n\ndef debug(*args, c=6):\n\tpass\n\tprint('\\x1b[3{}m'.format(c), *args, '\\x1b[0m', file=sys.stderr)\nBUFSIZE = 8 * 1024\n\ndef Istr():\n\treturn input()\n\ndef Iint():\n\treturn int(input())\n\ndef Ilist():\n\treturn list(map(int, input().split()))\n\ndef Imap():\n\treturn map(int, input().split())\n\ndef Plist(li, s=' '):\n\tprint(s.join(map(str, li)))\nif not FIO:\n\tif __name__ == '__main__':\n\t\tmain()\n\t\texit()\nelse:\n\tfrom io import BytesIO, IOBase\n\timport os\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\n\ndef input():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "def calculate(n):\n\tif n == 1:\n\t\treturn 1\n\treturn 1 + 2 * calculate(n // 2)\n\ndef makeList(upto):\n\ta = [1]\n\tn = 2\n\twhile a[-1] < upto:\n\t\ts = 1 + 2 * a[n // 2 - 1]\n\t\ta.append(s)\n\t\tn += 1\n\treturn a\n\ndef aritmetic(n):\n\treturn n * (n + 1) // 2\n\ndef finalStuff(blocks):\n\tn = 1\n\tstairs = 0\n\tarit = aritmetic(n)\n\twhile blocks >= arit:\n\t\tblocks -= arit\n\t\tstairs += 1\n\t\tn = 2 * n + 1\n\t\tarit = aritmetic(n)\n\treturn stairs\n\ndef solve():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tblocks = int(input())\n\t\tprint(finalStuff(blocks))\nsolve()\n", "q = int(input())\nfor _ in range(q):\n\tn = int(input())\n\twyn = 0\n\tpot = 1\n\ttotal = 1\n\twhile total <= n:\n\t\twyn += 1\n\t\tpot += 1\n\t\ttotal += (2 ** pot - 1) * 2 ** pot // 2\n\tprint(wyn)\n", "case = int(input())\nfor caseNum in range(0, case):\n\tn = int(input())\n\tcount = 0\n\twhile n >= 0:\n\t\tcount += 1\n\t\tminus = 0\n\t\ti = 2 * (count - 1)\n\t\tj = 0\n\t\twhile i >= 0:\n\t\t\tminus += 2 ** i * 2 ** j\n\t\t\ti -= 2\n\t\t\tj += 1\n\t\tn -= minus\n\tcount -= 1\n\tprint(count)\n", "t = int(input())\n\ndef nice(x):\n\tnxt = 1\n\tCount = 0\n\twhile 2 * x - nxt * (nxt + 1) >= 0:\n\t\tx -= nxt * (nxt + 1) // 2\n\t\tCount += 1\n\t\tnxt = 2 * nxt + 1\n\treturn Count\nfor i in range(t):\n\tx = int(input())\n\tprint(nice(x))\n", "import math\nt = input()\nfor i in range(int(t)):\n\tx = int(input())\n\tsum = 0\n\tj = 1\n\tr = 0\n\tvalues = [0]\n\twhile x > 0:\n\t\tw = 2 * j - 1\n\t\tsum = w * (w + 1) / 2\n\t\tr = int(sum)\n\t\tif x < r:\n\t\t\tbreak\n\t\tm = round(math.sqrt(sum / 2))\n\t\tsum = sum - m * m\n\t\tsum = sum / 2\n\t\tfor k in range(len(values)):\n\t\t\tif sum == values[k]:\n\t\t\t\tvalues = [r] + values\n\t\t\t\tx = x - r\n\t\t\t\tbreak\n\t\tj = 2 * j\n\tprint(len(values) - 1)\n", "def blocks(n):\n\th = 2 ** n - 1\n\tb = h * (h + 1) // 2\n\treturn b\nfor t in range(int(input())):\n\tn = int(input())\n\ttotal = 0\n\tc = 1\n\twhile n >= blocks(c):\n\t\tn = n - blocks(c)\n\t\tc += 1\n\t\ttotal += 1\n\tprint(total)\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\tcurr_tiles = 0\n\tcurr_val = 1\n\tans = 0\n\twhile curr_tiles <= n:\n\t\tcurr_tiles += curr_val * (curr_val + 1) // 2\n\t\tcurr_val = 2 * curr_val + 1\n\t\tif curr_tiles <= n:\n\t\t\tans += 1\n\tprint(ans)\n", "sizes = [2 ** i - 1 for i in range(1, 32)]\nblocks = [a * (a + 1) // 2 for a in sizes]\nfor _ in range(int(input())):\n\tx = int(input())\n\ti = 0\n\twhile x >= blocks[i]:\n\t\tx -= blocks[i]\n\t\ti += 1\n\tprint(i)\n", "import sys\nfrom sys import stdin\nimport math\n\ndef iinput():\n\treturn int(input())\n\ndef minput():\n\treturn map(int, input().split())\n\ndef linput():\n\treturn list(map(int, input().split()))\n\ndef fiinput():\n\treturn int(stdin.readline())\n\ndef fminput():\n\treturn map(int, stdin.readline().strip().split())\n\ndef flinput():\n\treturn list(map(int, stdin.readline().strip().split()))\nfor _ in range(iinput()):\n\tn = iinput()\n\ti = 1\n\ts = 0\n\tc = 0\n\twhile s < n:\n\t\tii = (1 << i) - 1\n\t\tss = ii * (ii + 1) // 2\n\t\ti += 1\n\t\tif s + ss <= n:\n\t\t\ts = s + ss\n\t\t\tc += 1\n\t\telse:\n\t\t\tbreak\n\tprint(c)\n", "t = int(input())\nfor tt in range(t):\n\tn = int(input())\n\tz = 0\n\ti = 1\n\twhile True:\n\t\tif n >= i * (2 * i - 1):\n\t\t\tn -= i * (2 * i - 1)\n\t\t\tz += 1\n\t\t\ti *= 2\n\t\telse:\n\t\t\tbreak\n\tprint(z)\n", "def solve(x):\n\tremaining = x\n\tres = 0\n\tcurrentNiceStairs = 1\n\twhile remaining > 0:\n\t\tconsumed = currentNiceStairs * (currentNiceStairs + 1) // 2\n\t\tremaining -= consumed\n\t\tif remaining < 0:\n\t\t\treturn res\n\t\tres += 1\n\t\tcurrentNiceStairs = 2 * currentNiceStairs + 1\n\treturn res\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tprint(solve(x))\n", "import sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\nimport math\n\ndef power(x, n):\n\tres = 1\n\tif n == 0:\n\t\treturn 1\n\twhile n > 0:\n\t\tif n & 1:\n\t\t\tres *= x\n\t\t\tn -= 1\n\t\telse:\n\t\t\tx *= x\n\t\t\tn = n // 2\n\treturn res\n\ndef fun(n):\n\treturn n * (n + 1) // 2\nt = inp()\nwhile t > 0:\n\tx = inp()\n\tcnt = 0\n\tfor k in range(1, 61):\n\t\tdep = power(2, k) - 1\n\t\tif fun(dep) <= x:\n\t\t\tx -= fun(dep)\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tbreak\n\tprint(cnt)\n\tt -= 1\n", "import sys\nimport math\nimport bisect\nfrom sys import stdin, stdout\nfrom math import gcd, floor, sqrt, log2, ceil, pi, sin, cos, acos, atan\nfrom collections import defaultdict as dd\nfrom bisect import bisect_left as bl, bisect_right as br\nfrom bisect import insort\nfrom collections import Counter\nfrom collections import deque\nfrom heapq import heappush, heappop, heapify\nfrom itertools import permutations, combinations\nmod = int(1000000000.0) + 7\nip = lambda : int(stdin.readline())\ninp = lambda : map(int, stdin.readline().split())\nips = lambda : stdin.readline().rstrip()\nout = lambda x: stdout.write(str(x) + '\\n')\nt = ip()\nfor _ in range(t):\n\tn = ip()\n\tif n == 1:\n\t\tans = 1\n\telse:\n\t\tans = 0\n\t\tcur = 0\n\t\tct = 0\n\t\tp = 0\n\t\twhile True:\n\t\t\tct += pow(2, p)\n\t\t\tcur += ct * (ct + 1) // 2\n\t\t\tif cur > n:\n\t\t\t\tbreak\n\t\t\tans += 1\n\t\t\tp += 1\n\tout(ans)\n", "def get_int():\n\treturn int(input())\nfor t in range(0, get_int()):\n\tx = get_int()\n\tcurrent_stair_size = 1\n\tnumber = 0\n\twhile x > 0:\n\t\tn = current_stair_size\n\t\tcells = (n * n + n) // 2\n\t\tx -= cells\n\t\tif x >= 0:\n\t\t\tnumber += 1\n\t\tcurrent_stair_size = current_stair_size * 2 + 1\n\tprint(number)\n", "game = int(input())\nfor k in range(game):\n\tx = int(input())\n\ts = 1\n\tstairs = 1\n\tvalue = 0\n\tb = x\n\twhile s <= b:\n\t\tprev = s\n\t\ts = 2 * s + (stairs + 1) ** 2\n\t\tstairs = 2 * stairs + 1\n\t\tvalue += 1\n\t\tb = b - prev\n\tprint(value)\n", "l = []\nfor i in range(1, 32):\n\tk = 2 ** i\n\tk = k - 1\n\tk = k * (k + 1) // 2\n\tl.append(k)\nfor i in range(1, len(l)):\n\tl[i] = l[i] + l[i - 1]\nt = int(input())\nwhile t > 0:\n\tn = int(input())\n\tfor i in range(len(l)):\n\t\tif n < l[i]:\n\t\t\tprint(i)\n\t\t\tbreak\n\tt -= 1\n", "t = int(input())\nwhile t:\n\tn = int(input())\n\t(c, tt, j) = (0, 0, 1)\n\twhile j <= n:\n\t\ttemp = pow(2, j) - 1\n\t\ttemp *= pow(2, j) // 2\n\t\tif n < tt + temp:\n\t\t\tbreak\n\t\ttt += temp\n\t\tc += 1\n\t\tj += 1\n\tprint(c)\n\tt -= 1\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tx = int(input())\n\tarr = [1] * 61\n\tfor i in range(1, 61):\n\t\tarr[i] = arr[i - 1] + 2 ** i\n\tarr2 = [0] * 61\n\tarr2[0] = 1\n\tfor i in range(1, 61):\n\t\tarr2[i] = arr2[i - 1] + arr[i] * (arr[i] + 1) // 2\n\tcount = 0\n\tindex = 0\n\twhile index < 61 and arr2[index] <= x:\n\t\tindex += 1\n\t\tcount += 1\n\tprint(count)\n", "def get_stairs_block(n):\n\treturn int(n * (n + 1) / 2)\n\ndef get_nice_stairs_height(n):\n\tstairs = [1]\n\texpo = 2\n\twhile stairs[-1] <= n:\n\t\tstairs.append(stairs[-1] + expo)\n\t\texpo = expo * 2\n\treturn {h: get_stairs_block(h) for h in stairs}\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tnice_stairs = get_nice_stairs_height(10 ** 18)\n\tc = 0\n\tfor (k, v) in nice_stairs.items():\n\t\tif v > x:\n\t\t\tbreak\n\t\tc += 1\n\t\tx -= v\n\tprint(c)\n", "t = int(input())\nwhile t > 0:\n\tn = int(input())\n\t(st, s, j, i) = (0, 0, 1, 1)\n\ts = i * (i + 1) // 2\n\twhile s <= n:\n\t\tst += 1\n\t\tn -= s\n\t\tj += 1\n\t\ti = pow(2, j) - 1\n\t\ts = i * (i + 1) // 2\n\tprint(st)\n\tt -= 1\n", "import math\n\ndef solve(n):\n\tk = int(math.log(int((-1 + math.sqrt(1 + 8 * n)) / 2) + 1, 2))\n\tl = 1\n\tSum = 0\n\twhile l <= k:\n\t\tSum += 2 ** (l - 1) * (2 ** l - 1)\n\t\tif Sum > n:\n\t\t\tbreak\n\t\tl += 1\n\treturn l - 1\nt = int(input())\nans = []\nfor i in range(t):\n\tn = int(input())\n\tans.append(solve(n))\nfor test in ans:\n\tprint(test)\n", "good = [1]\nwhile good[-1] < 10 ** 18:\n\tgood.append(good[-1] * 2 + 1)\n\ndef solve():\n\tn = int(input())\n\tres = 0\n\tfor i in good:\n\t\tif i * (i + 1) // 2 <= n:\n\t\t\tres += 1\n\t\t\tn -= i * (i + 1) // 2\n\tprint(res)\nfor i in range(int(input())):\n\tsolve()\n", "ans = [1]\nop = 2\nfor i in range(0, 10 ** 18):\n\top = op * 2\n\tans.append(op - 1)\n\tif op > 10 ** 18:\n\t\tbreak\nt = int(input())\nwhile t != 0:\n\tt -= 1\n\tx = int(input())\n\tsu = 0\n\tc = 0\n\tfor i in ans:\n\t\tsu = su + i * (i + 1) // 2\n\t\tif su <= x:\n\t\t\tc = c + 1\n\t\telse:\n\t\t\tbreak\n\tprint(c)\n", "tc = int(input())\nfor i in range(tc):\n\tn = int(input())\n\th = 100\n\ts = 0\n\ti = 0\n\tans = 0\n\tt = 0\n\twhile i < h:\n\t\tt += 1 << i\n\t\ts += t * (t + 1) // 2\n\t\ti += 1\n\t\tif s <= n:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "from sys import stdin, stdout\nimport math\nimport heapq\nimport collections\ninput = stdin.readline\n\ndef inputnum():\n\treturn int(input())\n\ndef inputnums():\n\treturn map(int, input().split())\n\ndef inputlist():\n\treturn list(map(int, input().split()))\n\ndef inputstring():\n\treturn [x for x in input()]\n\ndef inputstrings():\n\treturn [x for x in input().split()]\n\ndef inputstringnum():\n\treturn [ord(x) - ord('0') for x in input()]\n\ndef inputmatrixchar(rows):\n\tarr2d = [[j for j in input().strip()] for i in range(rows)]\n\treturn arr2d\n\ndef inputmatrixint(rows):\n\tarr2d = []\n\tfor _ in range(rows):\n\t\tarr2d.append([int(i) for i in input().split()])\n\treturn arr2d\nt = int(input())\nfor q in range(t):\n\tx = inputnum()\n\tans = 0\n\tcur = 1\n\tn = 2\n\twhile x >= cur * (cur + 1) // 2:\n\t\tx -= cur * (cur + 1) // 2\n\t\tcur += n\n\t\tn *= 2\n\t\tans += 1\n\tprint(ans)\n", "max = 31\nl = [1, 6, 28]\nj = 1\nfor i in range(3, max):\n\tx = l[i - 1] - pow(2, i - 1)\n\tfor j in range((i - 1) * 2 + 1, 2 * i + 1):\n\t\tx += pow(2, j)\n\tl.append(x)\nfor _ in range(int(input())):\n\tn = int(input())\n\tif n == 1:\n\t\tprint(1)\n\t\tcontinue\n\tc = 0\n\tt = 0\n\ti = 0\n\twhile t <= n:\n\t\tt += l[i]\n\t\ti += 1\n\tprint(i - 1)\n", "def solution(l):\n\tarr = [1]\n\ti = 1\n\twhile arr[-1] <= l:\n\t\tp = 2 ** i\n\t\ti += 1\n\t\tarr.append(arr[-1] * 2 + p * p)\n\ti = 0\n\tfor x in arr:\n\t\tif l >= x:\n\t\t\ti += 1\n\t\t\tl -= x\n\t\telse:\n\t\t\tbreak\n\treturn i\nn = int(input())\nfor i in range(n):\n\tl = int(input())\n\tprint(solution(l))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tz = []\n\ti = 1\n\tk = 1\n\twhile i < 10 ** 18:\n\t\tz.append(i)\n\t\tk += 1\n\t\ti = 2 ** k - 1\n\tx = 0\n\ti = 0\n\tans = 0\n\twhile x < n:\n\t\tif x + z[i] * (z[i] + 1) // 2 <= n:\n\t\t\tx += z[i] * (z[i] + 1) // 2\n\t\t\ti += 1\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "import math\nt = int(input())\nwhile t:\n\tx = int(input())\n\tcnt = 0\n\ti = 1\n\twhile True:\n\t\tif i * (i + 1) // 2 <= x:\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tbreak\n\t\tx -= i * (i + 1) // 2\n\t\ti = i * 2 + 1\n\tprint(cnt)\n\tt -= 1\n", "from sys import stdout, stdin\n(_input, _print) = (stdin.readline, stdout.write)\n(_range, _int) = (range, int)\n\ndef solution():\n\tarr = [0] * 100\n\tfor i in _range(100):\n\t\tarr[i] = (2 ** i) ** 2\n\tcube = [1]\n\ti = 1\n\twhile cube[-1] < 10 ** 18:\n\t\tcube.append(cube[-1] * 2 + arr[i])\n\t\ti += 1\n\tfor _ in _range(_int(_input())):\n\t\tn = _int(_input())\n\t\tindex = 1\n\t\tans = 0\n\t\twhile n > cube[index]:\n\t\t\tans += 1\n\t\t\tn -= cube[index]\n\t\t\tindex += 1\n\t\tprint(ans + 1)\nsolution()\n", "for _ in range(int(input())):\n\tx = int(input())\n\ts = 0\n\tfor i in range(1, 32):\n\t\ts = s + (2 ** i - 1) * 2 ** (i - 1)\n\t\tans = i - 1\n\t\tif s > x:\n\t\t\tbreak\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\n\ndef triangle_num(n):\n\treturn n * (n + 1) // 2\n\ndef solve(x):\n\tcount = 0\n\tlongest = 1\n\twhile triangle_num(longest) <= x:\n\t\tcount += 1\n\t\tx -= triangle_num(longest)\n\t\tlongest = 2 * longest + 1\n\treturn count\nt = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tprint(solve(x))\n", "import bisect\nt = int(input())\ninterest_n = [1 for _ in range(31)]\nsum_arr = [1 for _ in range(31)]\nfor i in range(1, 31):\n\tinterest_n[i] = interest_n[i - 1] * 2 + 1\nfor i in range(1, len(sum_arr)):\n\tsum_arr[i] = sum_arr[i - 1] + (interest_n[i] + 1) * interest_n[i] // 2\nfor _ in range(t):\n\tn = int(input())\n\tprint(bisect.bisect(sum_arr, n))\n", "from collections import *\ntri = []\n(c, x) = (1, 1)\nwhile x < 10 ** 18:\n\ttri.append(x)\n\tc = 2 * c + 1\n\tx = int((1 + c) * c / 2)\nfor i in range(int(input())):\n\tn = int(input())\n\tprint(len([x for (i, x) in enumerate(tri) if sum(tri[:i + 1]) <= n]))\n", "import math\nsum = 1\ntemp = [1]\nfor i in range(1, 31):\n\tsum += math.pow(2, i)\n\ttemp.append(sum)\nfor z in range(int(input())):\n\tx = int(input())\n\tcnt = 0\n\ti = 0\n\twhile x > 0:\n\t\tif x >= int(temp[i] * (temp[i] + 1) / 2):\n\t\t\tcnt += 1\n\t\tx -= int(temp[i] * (temp[i] + 1) / 2)\n\t\ti += 1\n\tprint(cnt)\n", "def solve():\n\tx = int(input())\n\tif x >= 1 and x < 7:\n\t\tprint(1)\n\t\treturn\n\tif x >= 7 and x < 35:\n\t\tprint(2)\n\t\treturn\n\tans = 2\n\t(a, b) = (1, 7)\n\tc = 6 * b - 8 * a + 1\n\twhile c <= x:\n\t\tans += 1\n\t\t(a, b) = (b, c)\n\t\tc = 6 * b - 8 * a + 1\n\tprint(ans)\nfor _ in range(int(input())):\n\tsolve()\n", "from functools import lru_cache\nfrom sys import stdin, stdout\nimport sys\nfrom math import *\nfor __ in range(int(input())):\n\tn = int(input())\n\ta = 1\n\tans = 0\n\ttemp = 0\n\twhile temp < n:\n\t\ttemp += (2 ** a - 1) * 2 ** a // 2\n\t\tif temp <= n:\n\t\t\tans += 1\n\t\ta += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tans = 0\n\tfor i in range(1, 31):\n\t\tnum = ((1 << 2 * i + 1) - 3 * (1 << i) + 1) // 3\n\t\tif x - num >= 0:\n\t\t\tans = i\n\tprint(ans)\n", "from sys import stdin\n\ndef iinput():\n\treturn int(stdin.readline())\n\ndef minput():\n\treturn map(int, stdin.readline().split())\n\ndef linput():\n\treturn list(map(int, stdin.readline().split()))\nt = iinput()\nwhile t:\n\tt -= 1\n\tx = iinput()\n\tcell = 0\n\tstaircase = 1\n\tto_cells = 1\n\twhile True:\n\t\tstaircase += 1\n\t\ttemp = 2 ** staircase - 1\n\t\tre_cells = temp * (temp + 1) // 2\n\t\tto_cells += re_cells\n\t\tif to_cells > x:\n\t\t\tstaircase -= 1\n\t\t\tbreak\n\tprint(staircase)\n", "import sys\nimport math\nfrom collections import defaultdict, Counter\ninput = sys.stdin.readline\n\ndef print(x):\n\tsys.stdout.write(str(x) + '\\n')\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tans = 0\n\tfor i in range(1, 31):\n\t\tcur = pow(2, i) - 1\n\t\tcur1 = cur * (cur + 1) // 2\n\t\tif x >= cur1:\n\t\t\tans += 1\n\t\t\tx -= cur1\n\t\telse:\n\t\t\tbreak\n\tprint(ans)\n", "for _ in range(int(input())):\n\tx = int(input())\n\tans = {1: 1}\n\tn = 1\n\ti = 1\n\twhile True:\n\t\tk = ans[n]\n\t\tn *= 2\n\t\tans[n] = k * 2 + n ** 2\n\t\tif ans[n] > 10 ** 18:\n\t\t\tbreak\n\ta = 0\n\tfor i in ans:\n\t\tif x - ans[i] >= 0:\n\t\t\tx -= ans[i]\n\t\t\ta += 1\n\t\telse:\n\t\t\tbreak\n\tprint(a)\n", "import sys\nimport math\nimport collections\nimport bisect\nimport itertools\nimport decimal\nimport copy\nimport heapq\nINF = 10 ** 20\nMOD = 998244353\nni = lambda : int(sys.stdin.readline().rstrip())\nns = lambda : map(int, sys.stdin.readline().rstrip().split())\nna = lambda : list(map(int, sys.stdin.readline().rstrip().split()))\nna1 = lambda : list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))\nflush = lambda : sys.stdout.flush()\n\ndef main():\n\tt = ni()\n\tfor _ in range(t):\n\t\tx = ni()\n\t\titems = [1]\n\t\tfor i in range(1, x):\n\t\t\tp = pow(2, i)\n\t\t\ttmp = 2 * p ** 2 - p\n\t\t\tif tmp > x:\n\t\t\t\tbreak\n\t\t\telse:\n\t\t\t\titems.append(tmp)\n\t\tans = 0\n\t\ttotal = 0\n\t\tfor it in items:\n\t\t\ttotal += it\n\t\t\tif total <= x:\n\t\t\t\tans += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tprint(ans)\nmain()\n", "def inp():\n\treturn int(input())\n\ndef linp():\n\treturn list(map(int, input().split()))\n\ndef minp():\n\treturn map(int, input().split())\nfor _ in range(inp()):\n\tx = inp()\n\tsu = 0\n\tc = 0\n\tfor i in range(1, x + 1):\n\t\ts = pow(2, i) - 1\n\t\ts2 = (pow(s, 2) + s) // 2\n\t\tif su + s2 > x:\n\t\t\tbreak\n\t\telse:\n\t\t\tsu += s2\n\t\t\tc += 1\n\tprint(c)\n", "from math import ceil\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tcount = 0\n\ti = 1\n\twhile x > 0:\n\t\ty = 2 ** i - 1\n\t\tb = y * (y + 1) // 2\n\t\tif b > x:\n\t\t\tbreak\n\t\tcount += 1\n\t\tx -= b\n\t\ti += 1\n\tprint(count)\n", "def solve(n):\n\tif n <= 6:\n\t\treturn 1\n\ti = 1\n\ts = 1\n\twhile s <= n:\n\t\ti += 1\n\t\tp = 1 << i\n\t\ts = (p - 1) * ((p << 1) - 1) // 3\n\treturn i - 1\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tprint(solve(n))\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\tif n == 1:\n\t\tprint(1)\n\t\tcontinue\n\ti = 0\n\tcnt = -1\n\twhile n >= 0:\n\t\ti += 1\n\t\tcnt += 1\n\t\tn2 = pow(2, i) - 1\n\t\tn1 = (n2 * n2 + n2) // 2\n\t\tn -= n1\n\tprint(cnt)\n", "from bisect import bisect_right\nd = 1\nco = 0\ncos = []\nwhile d <= 32:\n\ttmp = 2 ** d - 1\n\ttmp2 = (tmp + 1) * tmp // 2\n\tco += tmp2\n\tcos.append(co)\n\td += 1\nfor _ in range(int(input())):\n\tn = int(input())\n\tidx = bisect_right(cos, n)\n\tprint(idx)\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n\tt = int(input())\n\tdp = []\n\tfor i in range(1, 100):\n\t\tyy = pow(2, i)\n\t\tdp.append(yy * (yy - 1) // 2)\n\tfor _ in range(t):\n\t\tX = int(input())\n\t\tcnt = 0\n\t\ttotal = 0\n\t\tfor i in range(100):\n\t\t\ttotal += dp[i]\n\t\t\tif total > X:\n\t\t\t\tprint(i)\n\t\t\t\tbreak\nmain()\n", "def ceil(a, b):\n\treturn (a + b - 1) // b\n\ndef allBlocks(lim=10 ** 18):\n\tblocks = []\n\ti = 0\n\tres = 1\n\twhile res <= lim:\n\t\tn = i + res * res\n\t\tblocks += [n]\n\t\tlim -= n\n\t\ti = n * 2\n\t\tres *= 2\n\tresBlocks = [0]\n\tfor block in blocks:\n\t\tresBlocks += [resBlocks[-1] + block]\n\treturn resBlocks\nstairs = allBlocks()\nfor _ in range(int(input().strip())):\n\tN = int(input())\n\tans = 0\n\tfor stair in stairs:\n\t\tif stair <= N:\n\t\t\tans += 1\n\t\telse:\n\t\t\tbreak\n\tprint(ans - 1)\n", "from __future__ import division, print_function\nfrom sys import stdin, stdout\nimport bisect\nimport math\nimport heapq\ni_m = 9223372036854775807\n\ndef inin():\n\treturn int(input())\n\ndef stin():\n\treturn input()\n\ndef spin():\n\treturn map(int, stin().split())\n\ndef lin():\n\treturn list(map(int, stin().split()))\n\ndef matrix(n):\n\treturn [list(map(int, input().split())) for i in range(n)]\n\ndef count2Dmatrix(i, list):\n\treturn sum((c.count(i) for c in list))\n\ndef modinv(n, p):\n\treturn pow(n, p - 2, p)\n\ndef GCD(x, y):\n\tx = abs(x)\n\ty = abs(y)\n\tif min(x, y) == 0:\n\t\treturn max(x, y)\n\twhile y:\n\t\t(x, y) = (y, x % y)\n\treturn x\n\ndef Divisors(n):\n\tl = []\n\tfor i in range(1, int(math.sqrt(n) + 1)):\n\t\tif n % i == 0:\n\t\t\tif n // i == i:\n\t\t\t\tl.append(i)\n\t\t\telse:\n\t\t\t\tl.append(i)\n\t\t\t\tl.append(n // i)\n\treturn l\nprime = []\n\ndef SieveOfEratosthenes(n):\n\tglobal prime\n\tprime = [True for i in range(n + 1)]\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 1\n\tf = []\n\tfor p in range(2, n):\n\t\tif prime[p]:\n\t\t\tf.append(p)\n\treturn f\nq = []\n\ndef dfs(n, d, v, c):\n\tglobal q\n\tv[n] = 1\n\tx = d[n]\n\tq.append(n)\n\tj = c\n\tfor i in x:\n\t\tif i not in v:\n\t\t\tf = dfs(i, d, v, c + 1)\n\t\t\tj = max(j, f)\n\treturn j\nfor _ in range(inin()):\n\tn = inin()\n\t(i, count) = (1, 0)\n\ttemp = 0\n\twhile 1:\n\t\ttemp = 2 ** i - 1\n\t\tif n - temp * 2 ** (i - 1) < 0:\n\t\t\tprint(count)\n\t\t\tbreak\n\t\telse:\n\t\t\tn -= temp * 2 ** (i - 1)\n\t\t\tcount += 1\n\t\ti += 1\n", "import sys\nimport math as mt\nimport bisect\ninput = sys.stdin.readline\nt = int(input())\n\ndef solve():\n\ti = 1\n\tsuma = 1\n\tmul = 2\n\tans = 0\n\tleft = 0\n\twhile suma + left <= n and i <= n:\n\t\tans += 1\n\t\ti += mul\n\t\tleft += suma\n\t\tsuma = i * (i + 1) // 2\n\t\tmul *= 2\n\treturn ans\nfor _ in range(t):\n\tn = int(input())\n\tprint(solve())\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nfrom math import gcd, ceil\n\ndef pre(s):\n\tn = len(s)\n\tpi = [0] * n\n\tfor i in range(1, n):\n\t\tj = pi[i - 1]\n\t\twhile j and s[i] != s[j]:\n\t\t\tj = pi[j - 1]\n\t\tif s[i] == s[j]:\n\t\t\tj += 1\n\t\tpi[i] = j\n\treturn pi\n\ndef prod(a):\n\tans = 1\n\tfor each in a:\n\t\tans = ans * each\n\treturn ans\n\ndef lcm(a, b):\n\treturn a * b // gcd(a, b)\n\ndef binary(x, length=16):\n\ty = bin(x)[2:]\n\treturn y if len(y) >= length else '0' * (length - len(y)) + y\na = [1]\nk = 3\nfor i in range(6969):\n\ta += [k * (k + 1) // 2]\n\tk = 2 * k + 1\nfor _ in range(int(input()) if True else 1):\n\tn = int(input())\n\ti = 0\n\twhile n >= a[i]:\n\t\tn -= a[i]\n\t\ti += 1\n\tprint(i)\n", "t = int(input())\nwhile t:\n\tt += -1\n\tn = int(input())\n\t(x, y, sm, ans) = (1, 1, 0, 0)\n\twhile 1:\n\t\tsm += x * (x + 1) // 2\n\t\tif sm > n:\n\t\t\tbreak\n\t\tans -= -1\n\t\ty -= -1\n\t\tx = 2 ** y - 1\n\tprint(ans)\n", "def mi():\n\treturn map(int, input().split())\nfor _ in range(int(input())):\n\tn = int(input()) - 1\n\ttimes = 1\n\tout = 1\n\twhile (2 ** (times + 1) - 1) * 2 ** times <= n:\n\t\tout += 1\n\t\tn -= (2 ** (times + 1) - 1) * 2 ** times\n\t\ttimes += 1\n\tprint(out)\n", "import sys, math\nimport io, os\nfrom bisect import bisect_left as bl, bisect_right as br, insort\nfrom heapq import heapify, heappush, heappop\nfrom collections import defaultdict as dd, deque, Counter\n\ndef data():\n\treturn sys.stdin.readline().strip()\n\ndef mdata():\n\treturn list(map(int, data().split()))\n\ndef outl(var):\n\tsys.stdout.write(' '.join(map(str, var)) + '\\n')\n\ndef out(var):\n\tsys.stdout.write(str(var) + '\\n')\nfrom decimal import Decimal\nmod = 998244353\nINF = float('inf')\nl = [1]\nt = 1\ns = [1]\nfor i in range(30):\n\tt *= 4\n\tl.append(2 * l[-1] + t)\n\ts.append(s[-1] + l[i + 1])\nfor t in range(int(data())):\n\tout(br(s, int(data())))\n", "for h in range(int(input())):\n\tx = int(input())\n\tans = 0\n\ts = 1\n\tnum = 2 ** s - 1\n\tsumi = num * (num + 1) // 2\n\twhile x >= sumi:\n\t\tans += 1\n\t\ts += 1\n\t\tnum = 2 ** s - 1\n\t\tx -= sumi\n\t\tsumi = num * (num + 1) // 2\n\tprint(ans)\n", "def arith(x) -> int:\n\treturn x * (x + 1) // 2\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tcount = 0\n\tsumm = 0\n\tj = 1\n\ttemp = arith(j)\n\twhile summ + temp <= x:\n\t\tsumm += temp\n\t\tj = j * 2 + 1\n\t\ttemp = arith(j)\n\t\tcount += 1\n\tprint(count)\n", "def solve(a):\n\tres = a * (a + 1) // 2\n\treturn res\nfor _ in range(int(input())):\n\tn = int(input())\n\tx = 0\n\tto_add = 0\n\tc = 0\n\treal = 0\n\twhile True:\n\t\tto_add += 1\n\t\tx = pow(2, to_add) - 1\n\t\treal += solve(x)\n\t\tif real <= n:\n\t\t\tc += 1\n\t\telse:\n\t\t\tbreak\n\tprint(c)\n", "n = int(input())\ni = 0\nwhile i < n:\n\tq = int(input())\n\tcount = 0\n\tpred_kl = 0\n\tst = 0\n\twhile q > 0:\n\t\tpred_kl = 2 * pred_kl + (st + 1) ** 2\n\t\tst = st * 2 + 1\n\t\tcount += 1\n\t\tq -= pred_kl\n\tif q < 0:\n\t\tcount -= 1\n\tprint(count)\n\ti += 1\n", "for _ in range(int(input())):\n\ts = int(input())\n\tc = 0\n\ti = 1\n\twhile True:\n\t\tn = 2 ** i - 1\n\t\tif s >= n * (n + 1) // 2:\n\t\t\tc += 1\n\t\t\ts -= n * (n + 1) // 2\n\t\telse:\n\t\t\tbreak\n\t\ti += 1\n\tprint(c)\n", "import math\n\ndef fun(k):\n\treturn (2 ** k - 1) * 2 ** (k - 1)\nt = int(input())\nfor i in range(t):\n\tx = int(input())\n\tstart = 1\n\tans = 0\n\twhile x > 0:\n\t\tx -= fun(start)\n\t\tif x >= 0:\n\t\t\tstart += 1\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input())\n\tnum = 0\n\tk = 0\n\twhile True:\n\t\tk += 1\n\t\tnum += 2 ** (k - 1) * (2 ** k - 1)\n\t\tif num > x:\n\t\t\tprint(k - 1)\n\t\t\tbreak\n", "(lambda s: ([s.append(s[-1] + (1 << (i << 1) - 1) - (1 << i - 1)) for i in range(1, 65)], [(lambda N, ss: print(max((i[0] for i in ss if i[1] <= N))))(int(input()), enumerate(s)) for t in range(int(input()))]))([0])\n", "t = int(input())\nfor _ in range(t):\n\tx = int(input()) - 1\n\tp = 4\n\tc = 1\n\twhile (p - 1) * p // 2 <= x:\n\t\tc += 1\n\t\tx -= (p - 1) * p // 2\n\t\tp *= 2\n\tprint(c)\n", "def solve():\n\tn = int(input())\n\tcur = 1\n\tcnt = 1\n\tsum = 1\n\twhile True:\n\t\tcur *= 2\n\t\tcur += 1\n\t\tsum += cur * (cur + 1) // 2\n\t\tif sum > n:\n\t\t\tbreak\n\t\tcnt += 1\n\tprint(cnt)\nt = int(input())\nfor i in range(t):\n\tsolve()\n", "import sys\ninput = sys.stdin.readline\n\ndef f(x):\n\treturn (x * (x + 1) * (2 * x + 1) // 6 + x * (x + 1) // 2) // 2\n\ndef g(x):\n\tR = 0\n\tfor i in range(1, x + 1):\n\t\ty = 2 ** i - 1\n\t\tR += y * (y + 1) // 2\n\treturn R\n\ndef bsearch(mn, mx, func):\n\tidx = (mx + mn) // 2\n\twhile mx - mn > 1:\n\t\tif func(idx):\n\t\t\t(idx, mx) = ((idx + mn) // 2, idx)\n\t\t\tcontinue\n\t\t(idx, mn) = ((idx + mx) // 2, idx)\n\treturn idx\n(T,) = map(int, input().split())\nfor _ in range(T):\n\t(N,) = map(int, input().split())\n\tx = bsearch(0, 1000, lambda x: g(x) > N)\n\tprint(x)\n", "t = int(input())\nfor k in range(t):\n\tx = int(input())\n\tn = 1\n\tcubes = 1\n\tans = 0\n\twhile x - cubes >= 0:\n\t\tans += 1\n\t\tx -= cubes\n\t\tcubes = (n + 1) * (n + 1) + 2 * cubes\n\t\tn = 2 * n + 1\n\tprint(ans)\n"]

difficulty: EASY

source: codeforces

raw_problem:
B. Stairs

time limit per test
1 second

memory limit per test
256 megabytes

input
standard input

output
standard output

Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.

A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase has $$$n$$$ stairs, then it is made of $$$n$$$ columns, the first column is $$$1$$$ cell high, the second column is $$$2$$$ cells high, $$$\ldots$$$, the $$$n$$$-th column if $$$n$$$ cells high. The lowest cells of all stairs must be in the same row.

A staircase with $$$n$$$ stairs is called nice, if it may be covered by $$$n$$$ disjoint squares made of cells. All squares should fully consist of cells of a staircase.
 This is how a nice covered staircase with $$$7$$$ stairs looks like:
Find out the maximal number of different nice staircases, that can be built, using no more than $$$x$$$ cells, in total. No cell can be used more than once.

Input

The first line contains a single integer $$$t$$$ $$$(1 \le t \le 1000)$$$  — the number of test cases.

The description of each test case contains a single integer $$$x$$$ $$$(1 \le x \le 10^{18})$$$  — the number of cells for building staircases.

Output

For each test case output a single integer  — the number of different nice staircases, that can be built, using not more than $$$x$$$ cells, in total.

Example

Input

4
1
8
6
1000000000000000000

Output

1
2
1
30

Note

In the first test case, it is possible to build only one staircase, that consists of $$$1$$$ stair. It's nice. That's why the answer is $$$1$$$.

In the second test case, it is possible to build two different nice staircases: one consists of $$$1$$$ stair, and another consists of $$$3$$$ stairs. This will cost $$$7$$$ cells. In this case, there is one cell left, but it is not possible to use it for building any nice staircases, that have not been built yet. That's why the answer is $$$2$$$.

In the third test case, it is possible to build only one of two nice staircases: with $$$1$$$ stair or with $$$3$$$ stairs. In the first case, there will be $$$5$$$ cells left, that may be used only to build a staircase with $$$2$$$ stairs. This staircase is not nice, and Jett only builds nice staircases. That's why in this case the answer is $$$1$$$. If Jett builds a staircase with $$$3$$$ stairs, then there are no more cells left, so the answer is $$$1$$$ again.

question:
Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases.
A staircase is a squared figure that consists of square cells. Each staircase consists of an arbitrary number of stairs. If a staircase has $$$n$$$ stairs, then it is made of $$$n$$$ columns, the first column is $$$1$$$ cell high, the second column is $$$2$$$ cells high, $$$\ldots$$$, the $$$n$$$-th column if $$$n$$$ cells high. The lowest cells of all stairs must be in the same row.
A staircase with $$$n$$$ stairs is called nice, if it may be covered by $$$n$$$ disjoint squares made of cells. All squares should fully consist of cells of a staircase.
 This is how a nice covered staircase with $$$7$$$ stairs looks like: ![image](1.png) Find out the maximal number of different nice staircases, that can be built, using no more than $$$x$$$ cells, in total. No cell can be used more than once.

Input
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 1000)$$$  — the number of test cases.
The description of each test case contains a single integer $$$x$$$ $$$(1 \le x \le 10^{18})$$$  — the number of cells for building staircases.

Output
For each test case output a single integer  — the number of different nice staircases, that can be built, using not more than $$$x$$$ cells, in total.

Example
Input
4
1
8
6
1000000000000000000

Output
1
2
1
30

Note
In the first test case, it is possible to build only one staircase, that consists of $$$1$$$ stair. It's nice. That's why the answer is $$$1$$$.
In the second test case, it is possible to build two different nice staircases: one consists of $$$1$$$ stair, and another consists of $$$3$$$ stairs. This will cost $$$7$$$ cells. In this case, there is one cell left, but it is not possible to use it for building any nice staircases, that have not been built yet. That's why the answer is $$$2$$$.
In the third test case, it is possible to build only one of two nice staircases: with $$$1$$$ stair or with $$$3$$$ stairs. In the first case, there will be $$$5$$$ cells left, that may be used only to build a staircase with $$$2$$$ stairs. This staircase is not nice, and Jett only builds nice staircases. That's why in this case the answer is $$$1$$$. If Jett builds a staircase with $$$3$$$ stairs, then there are no more cells left, so the answer is $$$1$$$ again.

tags: ['Constructive algorithms', 'Implementation', 'Greedy algorithms', 'Complete search', 'Mathematics']

skill_types: ['Complete search', 'Greedy algorithms']

raw_tags: ['greedy', 'math', 'implementation', 'brute force', 'constructive algorithms']

data_split: test