Harryxun/stf_run huggingface dataset:
def next_array(array):#辞書式に次の配列を与える関数
  s = -1
  for x in array[::-1]:
    if x < M:
      break
    else:
      s -= 1
    #Mより小さい最後の項を取得
  
  if s >= -N:
    array[s] += 1#その項を１増やす
    if s < -1:
      for i in range(s+1,0):#以降の項を全て同じ値に
        array[i] = array[s]
        
  return array
 
def score(array, rules):#点数計算
  scr = 0
  for rule in rules:
    if (array[rule[1]-1] - array[rule[0]-1] == rule[2]):
      scr += rule[3]
      
  return scr

# input
N, M, Q = map(int, input().split())
rules = []
for i in range(Q):
  a, b, c, d = map(int, input().split())
  rules.append([a, b, c, d])
    
array　= [1] * N
max_scr = 0
 
while True:
  max_scr = max(max_scr, score(array,rules)) 
  if array[0] == M:#全探索完了
    break 
    array = next_array(array)#次の配列へ
    
print(max_scr)

### FIXED CODE ###

def next_array(array):#辞書式に次の配列を与える関数
  s = -1
  for x in array[::-1]:
    if x < M:
      break
    else:
      s -= 1
    #Mより小さい最後の項を取得
  
  if s >= -N:
    array[s] += 1#その項を１増やす
    if s < -1:
      for i in range(s+1,0):#以降の項を全て同じ値に
        array[i] = array[s]

  return array
 
def score(array, rules):#点数計算
  scr = 0
  for rule in rules:
    if (array[rule[1]-1] - array[rule[0]-1] == rule[2]):
      scr += rule[3]
      
  return scr
 
# input
N, M, Q = map(int, input().split())
rules = []
 
for i in range(Q):
  a, b, c, d = map(int, input().split())
  rules.append([a, b, c, d])
  
array = [1] * N
max_scr = 0
 
while True:
  max_scr = max(max_scr, score(array,rules)) 
  if array[0] == M:#全探索完了
    break 
  array = next_array(array)#次の配列へ
    
print(max_scr)
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    a_s = LI()
    kaizyo = [1]
    kaizyo_append = kaizyo.append
    keta = [0 for i in range(59)]
    ans = 0
    for i in range(59):
        kaizyo_append(kaizyo[i] * 2 % MOD)
    for i in a_s:
        for i, v in enumerate(bin(i)[:1:-1]):
            keta[i] += int(v)
    # print(kaizyo)
    # print(keta)
    for i, v in enumerate(keta):
        c = v * (n-v) % MOD
        ans += c * kaizyo[i]
        ans = ans % MOD
        # print(ans, c, kaizyo[i])

    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**7)
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())

def main():
    n = II()
    a_s = LI()
    kaizyo = [1]
    kaizyo_append = kaizyo.append
    keta = [0 for i in range(60)]
    ans = 0
    for i in range(60):
        kaizyo_append(kaizyo[i] * 2 % MOD)
    for i in a_s:
        for j in range(60):
            v, i = i % 2, i // 2
            keta[j] += v
    for i, v in enumerate(keta):
        c = v * (n-v) % MOD
        ans += c * kaizyo[i] % MOD
        ans = ans % MOD

    print(ans)
if __name__ == '__main__':
    main()
# coding: utf-8

S = input()
cnt = 0
ls = []
for i in range(2**(len(S)-1)):
    #print(str(bin(i))[2:].zfill(len(S)-1))
    bi = list(str(bin(i))[2:].zfill(len(S)-1))
    ls.append(bi)

for item in ls:
    s = S[0]
    for inx, bi in enumerate(item):
        if bi == "0":
            pass
        else:
            s = s+"+"
        s = s + S[inx+1]
    cnt += sum(map(int, s.split("+")))
print(cnt)

### FIXED CODE ###

# coding: utf-8

S = input()
cnt = 0
ls = []
for i in range(2**(len(S)-1)):
    #print(str(bin(i))[2:].zfill(len(S)-1))
    bi = list(str(bin(i))[2:].zfill(len(S)-1))
    ls.append(bi)

for item in ls:
    s = S[0]
    for inx, bi in enumerate(item):
        if bi == "0":
            pass
        else:
            s = s+"+"
        if len(S) != 1:
            s = s + S[inx+1]
        else:
            s = S
    cnt += sum(map(int, s.split("+")))
print(cnt)
a, b, c = map(int, input(). split())
if (4ab < c-a-b):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b, c = map(int, input(). split())
if (4*a*b<(c-a-b)*(c-a-b)) and c-a-b>0 :
  print("Yes")
else:
  print("No")
d,g = map(int,input().split() )
l = [list(map(int,input().split() ))+[100*(x+1)] for x in range(d) ] 

mondai_num = []

for k in range(2**d):

  #先に全完するカテゴリ(何百点問題を全完するか)を決め、回す
  bin_str = format(k, "0{}b".format(d) )#二進数の文字列を取得
  #これが全完する問題のリスト
  zenkan_list = [ x.start() for x in re.finditer("1",bin_str)  ] 
  

  #0~9のリストと和の初期化
  d_list = [i for i in range(d)]
  wa = 0
  cnt = 0
  #全完した点数のみ先に足す
  for i in zenkan_list:
    wa = wa+(l[i][0])*((i+1)*100)
    wa = wa + l[i][1]  
    cnt = cnt + l[i][0]
  #全完したやつだけで目標を超えたらそこでストップ
  if wa>=g:
    mondai_num.append( cnt )

  #全完したやつだけでたらなかったら素点が大きいやつを全完一歩手前まで足す
  else:
    #全完したカテゴリを除外
    for i in zenkan_list:
      d_list.remove(i)
    #残ったカテゴリの中で最大の点数のカテゴリを探す
    max_set = l[max(d_list)]

    for i in range( max_set[0]  ):
      wa = wa + max_set[2]
      if wa >= g:
        mondai_num.append(cnt + i+1 )
        break
print(min(mondai_num))

### FIXED CODE ###

import re

d,g = map(int,input().split() )
l = [list(map(int,input().split() ))+[100*(x+1)] for x in range(d) ] 

mondai_num = []

for k in range(2**d):

  #先に全完するカテゴリ(何百点問題を全完するか)を決め、回す
  bin_str = format(k, "0{}b".format(d) )#二進数の文字列を取得
  #これが全完する問題のリスト
  zenkan_list = [ x.start() for x in re.finditer("1",bin_str)  ] 
  

  #0~9のリストと和の初期化
  d_list = [i for i in range(d)]
  wa = 0
  cnt = 0
  #全完した点数のみ先に足す
  for i in zenkan_list:
    wa = wa+(l[i][0])*((i+1)*100)
    wa = wa + l[i][1]  
    cnt = cnt + l[i][0]
  #全完したやつだけで目標を超えたらそこでストップ
  if wa>=g:
    mondai_num.append( cnt )

  #全完したやつだけでたらなかったら素点が大きいやつを全完一歩手前まで足す
  else:
    #全完したカテゴリを除外
    for i in zenkan_list:
      d_list.remove(i)
    #残ったカテゴリの中で最大の点数のカテゴリを探す
    max_set = l[max(d_list)]

    for i in range( max_set[0]  ):
      wa = wa + max_set[2]
      if wa >= g:
        mondai_num.append(cnt + i+1 )
        break
print(min(mondai_num))
N = int(input())
S = 0
for i in range(2*10**5)
  digit = N%10
  S += digit
  N = N//10
T = 0
while S > 0:
  digit = S%10
  T += digit
  S = S//10
if T%9 == 0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

N = int(input())
if N%9 ==0:
  print('Yes')
else:
  print('No')
def iroha():
    count = int(input())
    result = 0
    for i in range(count+1):
        result += i

    print(result)


if __name__ == "__main__":
    iroha(

### FIXED CODE ###

def iroha():
    count = int(input())
    result = 0
    for i in range(count+1):
        result += i

    print(result)


if __name__ == "__main__":
    iroha()
N,M=map(int,input().split())

graph=[[False]*N for i in range(N)]
visited=[False]*N
a=[0]*N
b=[0]*N

for i in range(M):
    a[i],b[i]=map(int,input().split())
    a[i]-=1
    b[i]-=1
    graph[a[i]][b[i]]=True
    graph[b[i]][a[i]]=True


def dfs(v):
    visited[v]=True
    for v2 in range(N):
        if graph[v][v2]==False:continue
        if visited[v2]==True:continue
        dfs(v2)

ans=0
for i in range(M):
    graph[a[i]][b[i]]=False
    graph[b[i]][a[i]]=False
    for j in range(N):
        visited[j]=False
    dfs(0)
    bridge=False
    for j in range(N):
        if visited[j]==False:
            bridge=True
    if bridge==True:
        ans+=1
    graph[a[i]][b[i]] = True
    graph[b[i]][a[i]] = True

print(ans)

### FIXED CODE ###

N,M=map(int,input().split())

C=[[] for i in range(N)]

for i in range(M):
    a,b=map(int,input().split())
    C[a-1].append(b-1)
    C[b-1].append(a-1)

cnt=0
f=True
while f:
    f=False
    for i in range(N):
        if len(C[i])==1:
            cnt+=1
            idx=C[C[i][0]].index(i)
            C[C[i][0]].pop(idx)
            C[i].pop()
            f=True
print(cnt)
N=int(input())
if N%2==0:
  print(N//2,N,N)
else:
  for i in range(1,3501):
    for j in range(1,3501):
      if 4*i*j-N*i-N*j>0:
        if (N*i*j/(4*i*j-N*i-N*j)).is_integer():
          print(i,j,int(w))
          exit()

### FIXED CODE ###

N=int(input())
if N%2==0:
  print(N//2,N,N)
else:
  for i in range(1,3501):
    for j in range(1,3501):
      if 4*i*j-N*i-N*j!=0:
        w=(N*i*j)/(4*i*j-N*i-N*j)
        if w>0 and w.is_integer():
          print(i,j,int(w))
          exit()
s = input()

year = s[:4]
mo = s[5:7]
da = s[8:]

if year < 2019:
  ans = "Heisei"
elif year == 2019 and mo<= 4:
  ans ='Heisei'
else:
  ans = 'TBD'
print(ans)

### FIXED CODE ###

s = input()

year = int(s[:4])
mo = int(s[5:7])

if year < 2019:
  ans = "Heisei"
elif year == 2019 and mo<= 4:
  ans ='Heisei'
else:
  ans = 'TBD'
print(ans)
#dp[i][j]:S[i-x:i]==S[j-x:j]となる最大のx
import numpy as np

def solve(N,S):
    for i in range(N - 1):
        for j in range(i + 1, N):
            dp[i][j] = min(j - i, dp[i - 1][j - 1] + 1) if S[i] == S[j] else 0
    return dp.max()

def main():
    N = [int(input())]
    S=np.array([ord(_) for _ in input()])
    print(solve(N, S))

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', '(i8,i8[:],)')(solve)
    cc.compile()

if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import solve
    main()


### FIXED CODE ###

import itertools
N = int(input())
S = input()
dp = [[0] * N for _ in range(N)]
ans = 0
for i, j in itertools.combinations(range(N), 2):
    if S[i] == S[j]:
        dp[i][j] = dp[i - 1][j - 1] + 1
    else:
        dp[i][j] = 0
    ans = max(ans, min(j - i, dp[i][j]))
print(ans)
import heapq
q = []
heapq.heapify(q)

n = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))

zeros = [False]*n
Cs = [Bs[(i-1)%n]+Bs[(i+1)%n] for i in range(n)]
Ds = [b-(c+a) for b,c,a in zip(Bs,Cs,As)]
# Dが大きい順に操作していく？
# 初期値
for i,d in enumerate(Ds):
    if d < 0: continue
    heapq.heappush(q,(-d,i))

# print("init",Bs,Cs)
cnt = 0
while len(q) > 0:
    d,i = heapq.heappop(q)
    # 自分と周りの影響を更新
    # print(Bs,Cs,i,"before")
    cnt_ = Bs[i%n] // Cs[i%n]
    Bs[i%n] %= Cs[i%n]    
    Cs[(i-1)%n] = Bs[(i-2)%n]+Bs[i%n]
    Cs[(i+1)%n] = Bs[(i+2)%n]+Bs[i%n]
    # print("after",Bs,Cs,i)
    # 周りとの差
    d_m = Bs[(i-1)%n]-Cs[(i-1)%n]-As[(i-1)%n] 
    d_p = Bs[(i+1)%n]-Cs[(i+1)%n]-As[(i+1)%n]
    d_ = Bs[i%n] - Cs[i%n] - As[i%n]
    # print("pop",d,i,d_m,d_p)
    if d_ >= 0:
        heapq.heappush(q,(-d_,i))
    if d_m >= 0:
        heapq.heappush(q,(-d_m,i-1))
    if d_p >= 0:
        heapq.heappush(q,(-d_p,i+1))        
    # print("debug",Bs,Cs)
    cnt += cnt_
if As == Bs:
    print(cnt)
else:
    print(-1)
    


### FIXED CODE ###

import heapq
q = []
heapq.heapify(q)

n = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))

zeros = [False]*n
Cs = [Bs[(i-1)%n]+Bs[(i+1)%n] for i in range(n)]
# Dが大きい順に操作していく
for i, (b,c,a) in enumerate(zip(Bs,Cs,As)):
    d = b-(c+a) 
    if d < 0: continue
    heapq.heappush(q,(-d,i))

cnt = 0
while len(q) > 0:
    d,i = heapq.heappop(q)
    # 自分と周りの影響を更新
    cnt_ = (Bs[i%n]-As[i%n]) // Cs[i%n]
    Bs[i%n] -= cnt_*Cs[i%n]    
    Cs[(i-1)%n] = Bs[(i-2)%n]+Bs[i%n]
    Cs[(i+1)%n] = Bs[(i+2)%n]+Bs[i%n]
    # 周りとの差
    d_m = Bs[(i-1)%n]-Cs[(i-1)%n]-As[(i-1)%n] 
    d_p = Bs[(i+1)%n]-Cs[(i+1)%n]-As[(i+1)%n]
    if d_m >= 0:
        heapq.heappush(q,(-d_m,i-1))
    if d_p >= 0:
        heapq.heappush(q,(-d_p,i+1))
    cnt += cnt_

if As == Bs:
    print(cnt)
else:
    print(-1)
n,x=map(int,input().split())
m=[int(input()) for _ in range(n)]
print((x - sum(m)) // min(m) + m)

### FIXED CODE ###

n,x=map(int,input().split())
m=[int(input()) for _ in range(n)]
print((x - sum(m)) // min(m) + n)
n = int(input())
x=n
pf={}
for i in range(2,int(n**0.5)+1):
    while n % i == 0:
        pf[i] = pf.get(i,0)+1
        n//= i
if n > 1 : pf[n] = 1

# print((list(pf.keys()))[0]) #素因数分解したときの最小の因数取得
lis=[]
for b in range(-1000,1000):
    a=b+int(list(pf.keys())[0])
    siki=a**4 + a**3*b + a**2*b**2 + a*b**3 + b**4
    if siki==x/int(list(pf.keys())[0]):
        lis.append((a,b))
print(*lis[0])

### FIXED CODE ###


x=int(input())
A=0
B=0
for a in range(-500,500):
    for b in range(-500,500):
        if a**5-b**5==x:
            A=a
            B=b
            break
print(A,B)
n = int(input())
p = list(map(int, input().split())
cnt = 0
for i in range(0,n):
    if p[i]!=i+1:
        cnt+=1
if cnt>2:
    print("NO")
else:
    print("YES")

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))
flag = 0
ans = True
for i in range(0,n):
    if p[i] != i+1 and flag<=2:
        flag+=1
        if p[p[i]-1] == i+1:
            continue
        else:
            ans = False
    elif i+1 != p[i]:
        ans = False
if ans:
    print("YES")
else:
    print("NO")
a,b,c =map(int,input().split())
if a*b*c = 175:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a = list(map(int,input().split()))
b = 0
c = 0
for i in a:
  if i == 7:
    b += 1
  elif i == 5:
    c += 1
 
if b == 1 and c == 2:
  print("YES")
else:
  print("NO")
A,B = map(int,input().split())
from fractions import gcd
C = gcd(A,B)
num = []
for i in range(2,int(C**0.5)+1):
    while C%i==0:
        num.append(i)
        C //= i
if C != 1:
    num.append(C)
    from collections import Counter
CC = Counter(num)
print(len(CC)+1)

### FIXED CODE ###

import fractions
import collections
A,B = map(int,input().split())
p = fractions.gcd(A,B)
#print(p)
num = []
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        num.append(i)
        p //= i
if p != 1:
    num.append(p)
#print(num)
pp = collections.Counter(num)
print(len(pp)+1)
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

m, d = map(int, input().split())
ans = 0
for i in range(4, m + 1):
    for j in range(20, d + 1):
        if i == int(str(j)[0]) * int(str(j)[1]):
            ans += 1
print(ans)


### FIXED CODE ###

m, d = map(int, input().split())
ans = 0
for i in range(4, m + 1):
    for j in range(22, d + 1):
        if str(j)[0] != "1" and str(j)[1] != "1":
            if i == int(str(j)[0]) * int(str(j)[1]):
                ans += 1
print(ans)
n=int(input)
t=input()
T=list(t)

if T[0:3]==T[3:6]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n=int(input())
t=input()
T=list(t)

num=round(n/2)
 

if T[0:num]==T[num:n]:
	print("Yes")
else:
	print("No")
import math

inputs = [int(i) for i in input().split()]

counter = 0

a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

l = lcm(c, d)

c1 = b // c
c2 = (a-1) // c
c3 = c1 - c2

d1 = b // d
d2 = (a-1) // d
d3 = d1 - d2

l1 = b // l

ans = (b-a+1) - (c3 + d3 - l1)
print(ans)

### FIXED CODE ###

import fractions

inputs = [int(i) for i in input().split()]

a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l = lcm(c, d)

c1 = b // c
c2 = (a-1) // c
c3 = c1 - c2

d1 = b // d
d2 = (a-1) // d
d3 = d1 - d2

l1 = b // l
l2 = (a-1) // l
l3 = l1 - l2

ans = (b-a+1) - (c3 + d3 - l3)
print(ans)
import sys

for line in sys.stdin.readline():
 a, b, c = map(int, line.strip().split())

 if (a < b) and (b < c):
  print "Yes"
 else:
  print "No"

### FIXED CODE ###

a,b,c = raw_input().split()
if a<b<c:
    print 'Yes'
else:
    print 'No'
A=input("Enter Age")
B=input("Enter Fee")
if B%2==0 and (B>=2 and B<= 1000) and (A>=0 and A<=100):
	if A>=13:
		print(B)
	elif A>=6 and A<=12:
		print(int(B/2))
	elif A<=5:
		print(0)
else:
	print("Error")

### FIXED CODE ###

import sys
a=sys.stdin.readline()
res = [int(i) for i in a.split() if i.isdigit()] 
A,B = [res[i] for i in (0,1)]
if B%2==0 and (B>=2 and B<= 1000) and (A>=0 and A<=100):
	if A>=13:
		print(B)
	elif A>=6 and A<=12:
		print(int(B/2))
	elif A<=5:
		print(0)
else:
	print("Error")
from math import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7)) 

### FIXED CODE ###

from fractions import *
n,*a=map(int,open(0).read().split())
b=1
for i in a:b*=i//gcd(b,i)
print(sum(b//i for i in a)%(10**9+7))
N, Q = map(int,input().split())

ab_list = [list(map(int,list(input().split()))) for _ in range(N-1)]  
px_list = [list(map(int,list(input().split()))) for _ in range(Q)]  

graph = [[] for _ in range(N+1)]
point_list = [0] * (N+1)

for a, b in ab_list:
    graph[a].append(b)
    graph[b].append(a)
    
for p, x in px_list:
    point_list[p] += x
    
def add_point(num, root, point):
    point_list[num] += point
    for i in graph[num]:
        if i == root:
            continue
        add_point(i, num, point_list[num])

add_point(1, 0, 0)
 
print(*(point_list[1:]))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N, Q = map(int, input().split())

ab_list = [[] for _ in range(N)]

for _ in range(N-1):
    a, b = map(int, input().split())
    ab_list[a-1].append(b-1)
    ab_list[b-1].append(a-1)
    
px_list = [list(map(int,input().split())) for _ in range(Q)]
ans = [0] * N

for q, x in px_list:
    ans[q-1] += x

def add_point(num, root=-1):
    for c in ab_list[num]:
        if root == c:
            continue
        ans[c] += ans[num]
        add_point(c, num)
        
add_point(0, -1)

print(*ans)
def com():
????x = raw_input()
????a = len(x)
  y = raw_input()
????b = len(y)

????k1 = [0 for i in range(b+1)]
????
????for i in range(a):
????????k2 = k1 + [ ]
????????for j in range(b):
????????????if k1[j+1] < k1[j]:
???????????????? k1[j+1] = k1[j]
????    elif x[i] == y[j]:
????????????????    k1[j+1] = k2[j] + 1
  return k1[-1]

n = input()
for l in range(n):
????print com()

### FIXED CODE ###

def common():
  X = raw_input()
  Y = raw_input()
  a = len(X)
  b = len(Y)
  k1 = [0 for i in range(b+1)]
 
  for i in range(a):
     k2 = k1 + []
     for j in range(b):
       if X[i] == Y[j]:
          k1[j+1] = k2[j] + 1
       elif k1[j+1] < k1[j]:
          k1[j+1] = k1[j]
 
  return k1[-1]
 
n = input()
for l in range(n):
  print common()
N = int(input())
a = []
def prime_factorize(n,a):
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime_factorize(N, a)
ans = 0
if len(a) >= 1:
    before = a[0]
    kosuu = 1
    for i in range(1, len(a)):
        tmp = a[i]
        if tmp == before:
            kosuu += 1
        else:
            ini = 1
            while kosuu - ini >= 0:
                kosuu = kosuu - ini
                ini += 1
                ans += 1
            before = tmp
            kosuu = 1
        ini = 1
    while kosuu - ini >= 0:
        kosuu = kosuu - ini
        ini += 1
        ans += 1


print(ans)

### FIXED CODE ###

N = int(input())
a = []
def prime_factorize(n,a):
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime_factorize(N, a)
ans = 0
if len(a) > 1:
    before = a[0]
    kosuu = 1
    for i in range(1, len(a)):
        tmp = a[i]
        if tmp == before:
            kosuu += 1
        else:
            ini = 1
            while kosuu - ini >= 0:
                kosuu = kosuu - ini
                ini += 1
                ans += 1
            before = tmp
            kosuu = 1
        ini = 1
    while kosuu - ini >= 0:
        kosuu = kosuu - ini
        ini += 1
        ans += 1
if len(a) == 1:
    ans = 1
print(ans)
# 入力
L = input()

MOD = 10**9 + 7


# 最上位ビットから順に、0にする場合と1にする場合の個数を求める
# 最上位ビットが0の場合、直ちに解が求められる（3のべき乗になる）ことに注意
class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(
                pow(self.x, other.x, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    def __radd__(self, other):
        return ModInt(other + self.x)

    def __rsub__(self, other):
        return ModInt(other - self.x)

    def __rmul__(self, other):
        return ModInt(other * self.x)

    def __rtruediv__(self, other):
        return ModInt(other * pow(self.x, MOD - 2, MOD))

    def __rpow__(self, other):
        return ModInt(pow(other, self.x, MOD))


def f(n):
    return (
        ModInt(1) if n == 0 else
        ModInt(3)**(n - 1) + 2 * f(n - 1) if L[-n] == '1' else
        f(n - 1)
    )


ans = f(len(L))

# 出力
print(ans)


### FIXED CODE ###

L = input()

MOD = 10**9 + 7

N = len(L)
dp = [0 for _ in range(N + 1)]
dp[0] = 1
for i in range(1, N + 1):
    dp[i] = (3 * dp[i - 1]) % MOD

ans = 0
c = 1
for i in range(N):
    if L[i] == '1':
        ans = (ans + c * dp[N - i - 1]) % MOD
        c = (c * 2) % MOD

ans = (ans + c) % MOD

print(ans)
import numpy as np
N,W = map(int,input().split())
wv = [map(int,input().split()) for _ in range(N)]
w,v = [list(i) for i in zip(*wv)]
max_v,max_w = 0,0
for i,j in zip(w,v):
    max_w += i
    max_v += j

dp = np.ones(max_v+1, dtype=int) * max_w
for i in range(max_v-1,-1,-1):
    for j in range(N):
        if i+v[j] <= max_v:
            dp[i] = min(dp[i+1],dp[i+v[j]]-w[j])
        else:
            dp[i] = dp[i+1]
l = []
for i in dp:
    if i <= W:
        l.append(i)
ans = len(l)-1
print(ans)

### FIXED CODE ###

N,W = map(int,input().split())
wv = [map(int,input().split()) for _ in range(N)]
w,v = [list(i) for i in zip(*wv)]
max_v,max_w = 0,0
for i,j in zip(w,v):
    max_w += i
    max_v += j
dp = [[float("inf")]*(max_v+1) for _ in range(N+1)]
dp[0][0] = 0#初期値
for i in range(1,N+1):
    for j in range(max_v+1):
        if j - v[i-1] >= 0:
            dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i-1]]+w[i-1])
        else:
            dp[i][j] = dp[i-1][j]
for i in range(1,max_v+2):
    if W >= dp[N][-i]:
        print(max_v+1-i)
        break
import sys

x = int(sys.argv[1])
print(x * x * x)

### FIXED CODE ###

x = int(input())
print(x * x * x)
n = input()
a = []
for i in range(n):
    city,score = input().split()
    score=int(score)
    a.append((city,score,i+1))
a.sort(key=lambda k: (k[0],-k[1]))

for i in range(n):
    print(a[i][2])

### FIXED CODE ###

n = int(input())
a= []
for i in range(n):
	city, score = input().split()
	score = int(score)
	a.append((city, score, i+1))
a.sort(key=lambda k : (k[0], -k[1]))
for i in range(n):
	print(a[i][2])
s = input()

score = 0
for i in range(len(s)):
  if i % 2 == 0 and s[i] = "p":
    score -= 1
  elif i % 2 != 0 and s[i] = "g":
    score += 1

print(s)

### FIXED CODE ###

s = input()

score = 0
for i in range(len(s)):
  if i % 2 == 0 and s[i] == "p":
    score -= 1
  elif i % 2 != 0 and s[i] == "g":
    score += 1

print(score)
n, time = map(int, input().split())
list = []
list_ok = []
for i in range(n):
    c, t = map(int, input().split())
    object = [c, t]
    list.append(object)
    
print(list)

for j in range(n):
    if list[j][1] > time:
        continue
    else:
        list_ok.append(list[j][0])

ans = min(list_ok)

print(ans)

### FIXED CODE ###

n, time = map(int, input().split())
list = []
list_ok = []

for i in range(n):
    c, t = map(int, input().split())
    object = [c, t]
    list.append(object)
    
count = 0

for j in range(n):
    if list[j][1] > time:
        continue
    else:
        list_ok.append(list[j][0])
        count += 1

if count == 0:
    print("TLE")
else:
    ans = min(list_ok)
    print(ans)