Harryxun/stf_run huggingface dataset:
n=int(input());l=[list(map(int,input().split()))for i in[0]*n];a=[0]*n;d=1;k=n*(n-1)
while sum(a)<k and 0<d<9999:
 L=[0]*n;y=0;d+=1
 for i in range(n):
  if a[i]<n-1:
   x=l[i][a[i]]-1
   if l[x][a[x]]-1==i+L[x]+L[i]:
    a[i]+=1;a[x]+=1;L[i]=L[x]=y=1
 d*=y
print([k//2,d-1][d<9999])

### FIXED CODE ###

import sys
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
ct=[0 for i in range(n)]
fin=0
day=0
count=0
check=[0,0]
while count!=n*(n-1)//2 and day<=10**4:
  L=[0 for i in range(n)]
  f1=0
  for i in range(n):
    if L[i]==0 and ct[i]!=n-1:
      x=l[i][ct[i]]
      if l[x-1][ct[x-1]]-1==i and L[x-1]==0:
        ct[i]+=1
        ct[x-1]+=1
        L[i]=1
        L[x-1]=1
        count+=1
  day+=1
  check[0]=check[1]
  check[1]=count
  if check[0]==check[1]:
    print(-1)
    sys.exit()
if day>10**4:
  print(n*(n-1)//2)
  sys.exit()
print(day)
from operator import itemgetter
n,m,q = map(int,input().split())
LR = [[-1]+list(map(int,input().split())) for _ in range(m)]
PQ = [[_]+list(map(int,input().split())) for _ in range(q)]

Ans = [0]*501
section = LR + PQ
section.sort(key = itemgetter(2))

l = [0]*501
for x,y,z in section:
    if x == -1:
        l[y] += 1
    else:
        Ans[x] = sum(l[y:z+1])

for ans in Ans:
    if ans >= 1:
        print(ans)

### FIXED CODE ###

n,m,qq = map(int,input().split())
PQ = []
LR = [[_+1,0]+list(map(int,input().split())) for _ in range(m)]

for i in range(qq):
    p,q = map(int,input().split())
    PQ.append([i+1,1,p,q+0.1])
record = [0]*(n+1)
Ans = []

All = LR+PQ
from operator import itemgetter
All.sort(key = itemgetter(3))

for num,flag ,l, r in All:
    if flag :
        Ans.append([num,sum(record[l:int(r+1)])])
    else:
        record[l] += 1
Ans.sort(key = itemgetter(0))
for ans in Ans:
    print(ans[1])
import numpy as np

N = int(input())
res = np.zeros(N)

th = int(np.sqrt(N))
for x in range(1, th):
    for y in range(1, x + 1):
        for z in range(1, y + 1):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if n > N:
                continue
            if x == y and y == z:
                res[n] += 1
            elif x == y or y == z or z == x:
                res[n] += 3
            else:
                res[n] += 6
for i in range(1, N):
    print(int(res[i]))

### FIXED CODE ###

import numpy as np

N = int(input())
res = np.zeros(N+1)

th = int(np.sqrt(N)) + 1
for x in range(1, th):
    for y in range(1, x + 1):
        for z in range(1, y + 1):
            n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if n > N:
                continue
            if x == y and y == z:
                res[n] += 1
            elif x == y or y == z or z == x:
                res[n] += 3
            else:
                res[n] += 6
for i in range(1, N+1):
    print(int(res[i]))
n, k = map(int, input().split())
ans = []
c = (n - 1) * (n - 2) // 2 - k
if c < k:
    print(-1)
    exit(1)
for i in range(1, n):
    ans.append((0, i))
cnt = 0
flg = 0
for i in range(1, n):
    if flg:
        break
    for j in range(1, n):
        if i == j:
            continue
        ans.append((i, j))
        cnt += 1
        if cnt >= c:
            flg = 1
            break
print(len(ans))
for a, b in ans:
    print(a, b)


### FIXED CODE ###

n, k = map(int, input().split())
ans = []
c = (n - 1) * (n - 2) // 2 - k
if c < 0:
    print(-1)
    exit(0)
for i in range(1, n):
    ans.append((0, i))
cnt = 0
flg = 0
for i in range(1, n):
    if flg:
        break
    for j in range(i + 1, n):
        if cnt >= c:
            flg = 1
            break
        ans.append((i, j))
        cnt += 1
print(len(ans))
for a, b in ans:
    print(a + 1, b + 1)
N = int(input())
K = int(input())

counter = 0
for i in range(N):
    h = int(input())
    if h >= K:
        counter += 1

print(counter)

### FIXED CODE ###

NK = list(map(int,input().split()))
h_list = list(map(int,input().split()))

counter = 0

for i in range(NK[0]):
    if h_list[i] >= NK[1]:
        counter += 1

print(counter)
a,b=int(input().split())
if a+b>=10:
  print('error')
else:
    print(a+b)

### FIXED CODE ###

c,d = input().split()
a = int(c)
b = int(d)
if a+b>=10:
  print('error')
else:
    print(a+b)
N=int(input())
while 1:
    a,b,c=map(int,input().split())
    A=a**2
    B=b**2
    C=c**2       
    if A+B==C:
        print('YES')
    elif A+C==B:
        print('YES')
    elif B+C==A:
        print('YES')
    else:
        print('NO')

### FIXED CODE ###

N=int(input())
for i in range(N):
    a,b,c=map(int,input().split())
    A=a**2
    B=b**2
    C=c**2
    if A+B==C:print('YES')
    elif A+C==B:print('YES')
    elif B+C==A:print('YES')
    else:print('NO')
X,K,D=map(int,input().split())
count=0

result=X
target=int(X/D)
if (D-target)%2=0:
  if abs(result-D*target)>abs(result+D*target):
    result=result+D*target
  else:
    result=result-D*target
else:
  if abs(result-(D+1)target)>abs(result+(D+1)*target):
    result=result+(D+1)*target
  else:
    result=result-(D+1)*target
  
print(str(abs(result)))    

### FIXED CODE ###

import math
X,K,D=map(int,input().split())
count=0
#Xが初期値
#Dが移動量（+or-）
#K回移動後の最小の座標
#X/D＞Kの場合、K*D＋Xが答え

Y = 0
#X>0 D>0 の場合
if X / D > K and X / D > 0:
    Y = abs(X - D * K)
elif abs(X / D) > K and X / D < 0:
    Y = abs(X + D * K)
else:
    #X/D<Kの場合、X mod D
    L = abs(X) % D
    M = math.floor(abs(X) / D)
    if (K - M) % 2 == 0:
        Y = L
    else:
        Y=abs(L-D)

print(Y)
a, b = ((int(x) - 2) % 100 for x in input().split())
print('Draw' if a == b else 'Alice' a > b else 'Bob')

### FIXED CODE ###

a, b = ((int(x) - 2) % 100 for x in input().split())
print('Draw' if a == b else 'Alice' if a > b else 'Bob')
innum = raw_input()
if int(innum[0]) <= 8 and int(innum[2]) <= 8:
    print "Yay!"
else:
    print ":("

### FIXED CODE ###

S = raw_input()
L = S.split(" ")
if int(L[0]) <= 8 and int(L[1]) <= 8:
    print "Yay!"
else:
    print ":("
def d_dice_in_line():
    from itertools import accumulate
    N, K = [int(i) for i in input().split()]
    P = [int(i) for i in input().split()]

    expected_value = [(p + 1) / 2 for p in P]  # 1~p まで出るサイコロの出目の期待値
    cumsum = [0] + list(accumulate(expected_value))
    return max([cumsum[j + K] - cumsum[j] for j in range(K)])

print(d_dice_in_line())

### FIXED CODE ###

def d_dice_in_line():
    N, K = [int(i) for i in input().split()]
    P = [int(i) for i in input().split()]

    def experience(x):
        return (x + 1) / 2  # 1からxまで出るサイコロの出目の期待値

    ans = []
    tmp = 0
    for i in range(K):
        tmp += experience(P[i])
    ans.append(tmp)
    for i in range(K, N):
        tmp -= experience(P[i - K])
        tmp += experience(P[i])
        ans.append(tmp)
    return max(ans)

print(d_dice_in_line())
import time
import random
import math
def sigmoid(x):
  return 1/(1+math.exp(-x))
def score(a,c,s,d):
  l=[-1 for i in range(26)]
  r=0
  for i in range(d):
    l[a[i]]=i
    r+=s[i][a[i]]
    for j in range(26):
      r-=c[j]*(i-l[j])
  return r
  
st=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
ld=[]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)
  ld.append([l[mt],d])
  if l[mt]>=0:
    ld[l[mt]][1]=i

os=score(ans,c,s,d)
nt=st
rate=1500
while nt-st<1.50:
  nt=time.time()
  na=[ans[i] for i in range(d)]
  na[random.randint(1,d-1)]=random.randint(0,25)
  ns=score(na,c,s,d)
  if sigmoid((ns-os)/rate/((2-nt+st)**4)-0.5)>random.random():
    os=ns
    ans=na
  
  


for i in ans:
  print(i+1)

### FIXED CODE ###

d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)

for i in ans:
  print(i+1)
a=input()
b=Sunny
c=Cloudy
d=Rainy
if a=b:
print(c)
elif a=c:
print(d)
else a=d:
print(b)



### FIXED CODE ###

a = input()
b = 'Sunny'
c = 'Cloudy'
d = 'Rainy'
if a == b:
 print(c)
if a == c:
 print(d)
if a == d:
 print(b)
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

found_data = False
def function():
    for i in range(101):
        for j in range(101):
            c = 0
            x = map_list[0][0]
            y = map_list[0][1]
            h = map_list[0][2]
            H = abs(i - int(x)) + abs(j - int(y)) + int(h)
            #print('base:',i, j, H)
        
            for data in map_list[1:]:
                x, y, h = data
                #print('check:',i, j, H, abs(i - int(x)) + abs(j - int(y) + int(h)))
                if H != abs(i - int(x)) + abs(j - int(y)) + int(h):
                    break
                c += 1
            if c >= n - 1:
                return i, j, H
            
i, j, H = function()
print(i, j, H)

### FIXED CODE ###

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    for i in range(101):
        if int(map_list[i][2]) > 0:
            x = int(map_list[i][0])
            y = int(map_list[i][1])
            h = int(map_list[i][2])
            break
        else:
            continue

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for data in map_list:
                xx, yy, hh = map(int, data)
                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)
import sys
M = 1001; p = [1]*M;
p[0],p[1] = 0,0
for i in xrange(31):
    if p[i]:
        for j in xrange(i*i,M,i):
            p[j] = 0
for s in sys.stdin.readlines():
    n = int(s.strip()); ans = 0;
    for i in xrange(1,n+1):
        if p[i] and p[n+1-i]:
            ans += 1
    print ans

### FIXED CODE ###

M = 10001; p = [1]*M;
p[0],p[1] = 0,0
for i in xrange(2,101):
    if p[i]:
        for j in xrange(i*i,M,i):
            p[j] = 0
while 1:
    try:
        n = int(raw_input()); ans = 0;
        for i in xrange(1,n+1):
            if p[i] and p[n+1-i]:
                ans += 1
        print ans
    except EOFError:
        break
N, K = map(int, input().split())
lis = [10**5]*K
for _ in range(N):
    a, b = map(int, input().split())
    if a < lis[K-1]:
        for index, num in enumerate(lis):
            if num > a:
                if index + b < K:
                    lis = lis[:index] + [a for _ in range(b)] + lis[index:K-b]
                else:
                    lis = lis[:index] + [a for _ in range(K-index)]
                break
print(lis[K-1])

### FIXED CODE ###

N, K = map(int, input().split())
AB = []
for _ in range(N):
    AB.append(input())
count = 0
for string in sorted(AB, key = lambda x: int(x.split()[0])):
    a = int(string.split()[0])
    b = int(string.split()[1])
    count += b
    if count >= K:
        print(a)
        break
import numpy as np

N = int(input())
A = np.fromstring(input(), np.int64, ' ')

result = 0
for bit in range(60):
    c = int((A & 1).sum())
    A >>= 1
    result = (result + c * (N - c) * (1 << bit)) % 1000000007
print(result)


### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))

    r = list(range(N - 2, -1, -1))
    result = 0
    for b in range(60):
        t = 0
        bs = (A[N - 1] >> b) & 1
        for i in r:
            if (A[i] >> b) & 1 == 0:
                t += bs
            else:
                t += (N - (i + 1)) - bs
                bs += 1
        result = (result + t * (1 << b)) % 1000000007
    print(result)
main()
s = input()
lst = ['SUN','MON','TUE','WED','THU','FRI','SAT']

for i in range(len(lst)):
  if lst[i] = s:
    print(7 - i)

### FIXED CODE ###

s = input()
lst = ['SUN','MON','TUE','WED','THU','FRI','SAT']

for i in range(len(lst)):
  if lst[i] == s:
    print(7 - i)
a,b=map(int input().split())
if a<10 and b<10:
    print(a*b)
else:
    print(-1)

### FIXED CODE ###

a,b=map(int, input().split())
if a<10 and b<10:
    print(a*b)
else:
    print(-1)
n, k = [int(i) for i in input().split()]
As = [int(i) for i in input().split()]
def f(x):
    return sum(a^x for a in As)

bs = [f'{a:050b}'[::-1] for a in As]
# print(bs)
ans = ''
strk = f'{k:b}'
# print('strk', strk)
for i in range(len(strk)):
    one = len([True for b in bs if b[i] == '1'])
    zero = len([True for b in bs if b[i] == '0'])
    # print(one, zero)

    if k <= int('1' + ans, 2):
        ans = '0' + ans
        # print('y')
    elif one < zero:
        ans = '1' + ans
    else:
        ans = '0' + ans
    # print('ans', ans)

    # ans = '0' if one > zero else '1'
# ans = ans[::-1]
# print(ans)
# ans = int(ans, 2)
print(f(int(ans, 2)))

### FIXED CODE ###

n, k = [int(i) for i in input().split()]
As = [int(i) for i in input().split()]
def func(x):
    return sum(a^x for a in As)

bs = ['{:050b}'.format(a)[::-1] for a in As]
# print(bs)
strk = '{:b}'.format(k)

ans = ['0'] * len(strk)
# print(strk, ans)
for i in range(len(strk)):
    one = len([True for b in bs if b[len(strk) - 1 - i] == '1'])
    zero = len([True for b in bs if b[len(strk) - 1 - i] == '0'])
    # print(zero, one)

    tmp = ans[:]
    # if k < int('1' + ans, 2):

    # if one == zero:
    #     tmp[i] = '1'
    if zero >= one:
        tmp[i] = '1'
    # else:
    #     ans = ['0' + a for a in ans]
    # print(tmp, int(''.join(tmp), 2))
    if k >= int(''.join(tmp), 2):
        ans = tmp
    # print('ans', ans)

print(func(int(''.join(ans), 2)))
s = input()
if s[0:4] == "YAKI":
 print "Yes"
else:
 print "No"

### FIXED CODE ###

s = raw_input()
if s[0:4] == "YAKI":
 print "Yes"
else:
 print "No"
N = int(input())
list_S = []
for i in range(N):
  list_S.append(str(input()))

list_get = []
for i in list_S:
  if not list_S[i] in list_get: list_get.append(list_S[i])

print(len(list_get))

### FIXED CODE ###

N = int(input())
list_S = [str(input()) for i in range(N)]
print(len(list(set(list_S))))
n,m=map(int,input())
N=n
x=0
z=m
for i in range(100):
    x=N-z
    x=abs(x)
    z=x*z
    N=min(N,x,n)

print(N) 

### FIXED CODE ###

x,y,z=map(int,input().split())
v=0

v=x
x=y
y=v

v=x
x=z
z=v
print(x,y,z)
hitachi = input()
flag = 0
for x in range(len(hitachi)):
    if(x %2 == 0):
        if(hitachi[x] + hitachi[x+1] == "hi"):
            #print(hitachi[x] + hitachi[x+1])
            flag += 1
        else:
            #print(hitachi[x] + hitachi[x+1])
            print("No")
            break
if(flag == len(hitachi)/2):
    print("Yes")

### FIXED CODE ###

hitachi = input()
#type(hitachi)
flag = 0
if(len(hitachi) == 1):
    hitachi += " "
elif(len(hitachi) >= 11):
    hitachi = " "
elif(len(hitachi) % 2 ==1):
    hitachi += " "
for x in range(len(hitachi)):
    if(hitachi[x] == " "):
        break
    if(x %2 == 0):
        if(hitachi[x] + hitachi[x+1] == "hi"):
            #print(hitachi[x] + hitachi[x+1])
            flag += 1
        else:
            #print(hitachi[x] + hitachi[x+1])
            print("No")
            break
if(not len(hitachi) == 0):
    if(flag == len(hitachi)//2):
        print("Yes")
n,k=map(int,input().split())
ans=float(0)
for i in range(n):ans+=(0.5**(int(k**0.5)+1-i))/n
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
probability=0
for dice in range(1,N+1):
    coin=1/N
    point=dice
    while(point<K):
        point*=2
        coin/=2
    probability+=coin
print(probability)
S=int(input())
T=int(input())

count=0
for s,t in zip(S,T):
    if s==t:
        count+=1
print(count)

### FIXED CODE ###

S=input()
T=input()

count=0
for s,t in zip(S,T):
    if s==t:
        count+=1
print(count)
N = int(input())
T = [int(input()) for i in range(N)]
#P = list(set(T))

def gcd(a,b) :
    a,b = min(a,b),max(a,b)
    while b > 0 :
        a,b = b, a%b
    return a

def lcm(a,b) :
    return a*b//gcd(a,b)

for i in range(len(T)-1) :
    if i == 0 :
        ans = lcm(T[i],T[i+1])
    else :
        p = lcm(T[i],T[i+1])
        if p > ans :
            ans = p
print(ans)


### FIXED CODE ###

N = int(input())
T = [int(input()) for i in range(N)]
#P = list(set(T))

def gcd(a,b) :
    a,b = min(a,b),max(a,b)
    while b > 0 :
        a,b = b, a%b
    return a

def lcm(a,b) :
    return a*b//gcd(a,b)
if N == 1 :
    ans = T[0]
else :
    for i in range(len(T)) :
        if i == 0 :
            ans = lcm(T[i],T[i+1])
        else :
            ans = lcm(T[i],ans)
print(ans)
# C
from functools import reduce

def lcm(a, b):
    return int(a*b/gcd(a, b))
def gcd(a,b):
    if a<b:a,b=b,a
    if a%b==0:return b
    return gcd(b,a%b)

n = int(input()) 
a = list(map(int, input().split()))

result = 0
mod = int(reduce(lcm, a))-1

for i in range(len(a)):
    result += mod % a[i] 

print(result)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))

print(sum(a) - n)
N, M = map(int, input().split())

a = []
for x in range(0, N):
  a.append(input())

b = []
for x in range(0, M):
  b.append(input())

for i in range(0, len(a)):
  found = a[i].find(b[0])
  if found != -1:
    tmp = []
    for j in range(i, len(b)+1):
      tmp.append(a[j][found:found+M])
    if "".join(tmp) ==  "".join(b):
      print("Yes")
      exit()
  
print("No")


### FIXED CODE ###

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

a = []
for x in range(0, N):
  a.append(input())

b = []
for x in range(0, M):
  b.append(input())

exists = []
for i in range(0, len(a)):
  exists.append([i, a[i].find(b[0])])

for x, y in exists:
  ari = []
  for i in range(0, len(b)):
    if x+i < len(a):
      ari.append(a[x+i][y:y+M])
  if "".join(ari) == "".join(b):
    print("Yes")
    exit()

print("No")
# ABC075B

import numpy as np

h, w = map(int, input().split())
board = sp.reshape(np.array(sp.repeat("@", (h+2)*(w+2))), (h+2, w+2))
for i in range(h):
    s = input()
    board[i+1, 1:w+1] = np.array(list(s))
for i in range(1, h+1):
    count = sp.zeros(w, dtype=str)
    for j in range(1, w+1):
        if board[i,j] == '.':
            count[j-1] = str(\
                (board[i-1, j-1] == "#") + (board[i-1, j] == "#") + (board[i-1, j+1] == "#") +\
                (board[i  , j-1] == "#") + (board[i  , j] == "#") + (board[i  , j+1] == "#") +\
                (board[i+1, j-1] == "#") + (board[i+1, j] == "#") + (board[i+1, j+1] == "#"))
        elif board[i, j] == "#":
            count[j-1] = "#"
    print(''.join(count))


### FIXED CODE ###

# ABC075B

import numpy as np

h, w = map(int, input().split())
board = np.reshape(np.array(np.repeat("@", (h+2)*(w+2))), (h+2, w+2))
for i in range(h):
    s = input()
    board[i+1, 1:w+1] = np.array(list(s))
for i in range(1, h+1):
    count = np.zeros(w, dtype=str)
    for j in range(1, w+1):
        if board[i,j] == '.':
            count[j-1] = str(\
                (board[i-1, j-1] == "#") + (board[i-1, j] == "#") + (board[i-1, j+1] == "#") +\
                (board[i  , j-1] == "#") + (board[i  , j] == "#") + (board[i  , j+1] == "#") +\
                (board[i+1, j-1] == "#") + (board[i+1, j] == "#") + (board[i+1, j+1] == "#"))
        elif board[i, j] == "#":
            count[j-1] = "#"
    print(''.join(count))
N = int(input())
L0 = 2
L1 = 1
for i in range(N-1):
  ans = L0 + L1
  L0 = L1
  L1 = ans
  
print(ans)

### FIXED CODE ###

N = int(input())
L0 = 2
L1 = 1
if N == 1:
  	ans = 1

else:
	for i in range(N-1):
		ans = L0 + L1
		L0 = L1
		L1 = ans
print(ans)
import numpy as np

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

dp = np.zeros(W + 1, dtype = np.int64)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w] + v)

print(dp.max())
    


### FIXED CODE ###

import numpy as np

N, W = map(int, input().split())
a = [list(map(int,input().split())) for _ in range(N)]
vmax = sum([a[i][1] for i in range(N)])
INF = float('inf')
dp = np.full(vmax+1, INF)
dp[0] = 0

for i in range(N):
  w, v = a[i-1]
  dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(max([i for i in range(vmax+1) if dp[i] <= W]))
H, N = map(int, input().split())
G = [0 for i in range(N)]
for i in range(N):
    A, B = map(int, input().split())
    koritu = A / B
    G[i] = (koritu, A, B)
G.sort(reverse = True)
#print(G)
dp = [[0 for i in range(H+1)] for j in range(N)]
for i in range(1, H + 1):
    dp[0][i] = ((i - 1) // a + 1) * b
for j in range(1, N):
    k, a, b = G[j]
    for i in range(1, H+1):
        if i >= a:
            dp[j][i] = min(dp[j-1][i], dp[j][i-a] + b)
        else:
            dp[j][i] = min(dp[j-1][i],b)
print(dp[N-1][H])



### FIXED CODE ###

H, N = map(int, input().split())
G = [0 for i in range(N)]
for i in range(N):
    A, B = map(int, input().split())
    koritu = A / B
    G[i] = (koritu, A, B)
G.sort(reverse = True)
#print(G)
dp = [[0 for i in range(H+1)] for j in range(N)]
k, a, b = G[0]
for i in range(1, H + 1):
    dp[0][i] = ((i - 1) // a + 1) * b
for j in range(1, N):
    k, a, b = G[j]
    for i in range(1, H+1):
        if i >= a:
            dp[j][i] = min(dp[j-1][i], dp[j][i-a] + b)
        else:
            dp[j][i] = min(dp[j-1][i],b)
print(dp[N-1][H])
x=int(input())

a=100
k=0
while(1):
  k+=1
  a=a+a(1//100)
  if(a>=x):break
print(k)

### FIXED CODE ###

x=int(input())

a=100
k=0
y=0
for i in range(10**18):
  y=y+1
  
  k = a//100
  a=a+k
  
  if(a>=x):break

print(y)
import numpy as np
n=map(int,input().split())
k=2
h=np.array(list(map(int,input().split()))+[0]*k)
dp = np.full(n+k, 10 ** 10, dtype=np.int64)
dp[0] = 0
for i in range(1,n):
    dp[i:i+k]=np.minimum(dp[i:i+k],np.abs(h[i:i+k]-h[i-1])+dp[i-1])
print(dp[n-1])

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
c=[0]*n
c[1]=abs(h[0]-h[1])
for i in range(2,n):
    c[i]=min(c[i-2]+abs(h[i]-h[i-2]),c[i-1]+abs(h[i]-h[i-1]))
print(c[n-1])
l, r = map(int, input().split())

flag = 0
for i in range(l, r+1):
    if i % 2019 == 0:
        flag = 1
        break

if flag == 0:
    a = (l % 2019) * ((l+1) % 2019)) % 2019
    print(a)
elif flag == 1:
    print(0)


### FIXED CODE ###

l, r = map(int, input().split())

if (r-1) * r < 2019:
    print(l * (l+1))
elif r - l > 2019:
    print(0)
else:
    ans = 2019
    for i in range(l, r):
        for k in range(i+1, r+1):
            a = ((i % 2019) * (k % 2019)) % 2019
            if a < ans:
                ans = a
    print(ans)
input()
T,A = map(int,input().split())
a = list(map(int,input().split()))
min_val = T-A
for i in range(len(a)):
    if abs(T-0.006*a[i]-A) <= min_val:
        min_val = abs(T-0.006*a[i]-A)
        min_num = i
print(min_num+1)

### FIXED CODE ###

N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
 
x = 100000
ans = 0
 
for i in range(N):
    temp = abs(A -(T - H[i]*0.006))
    if abs(A -(T - H[i]*0.006)) < x:
        x = abs(A -(T - H[i]*0.006))
        ans = i
 
print(ans+1)
num = input()
round = 3.141592653589793

print(num*2*rount)


### FIXED CODE ###

round = 6.28318530717958623200

 
r = int(input())
print(r*round)
s = input()

moji = ("A","C","G","T")
count = []
tmp = 0
for i in range(len(s)):
    if s[i] in moji:
        tmp +=1
    else:
        count.append(tmp)
        tmp = 0
print(max(count))

### FIXED CODE ###

S = input()
ans = []
for n in range(len(S)):
    counter = 0
    for i in range(n,len(S)):
        if (S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] =='T'):
            counter+=1
        else:
            break
    ans.append(counter)
print(max(ans))
from numba import jit

N = int(input())

@jit
def f():
    ret = [0] * 10000

    for i in range(1, 200):
        for j in range(1, 200):
            for k in range(1, 200):
                z = i**2 + j**2 + k**2 + i*j + j*k + k*i
                if z < 10000:
                    ret[z] += 1

    return ret


ans = f()

for x in range(1, N+1):
    print(ans[x])


### FIXED CODE ###

from numba import jit

N = int(input())

@jit
def f():
    ret = [0] * 10001

    for i in range(1, 200):
        for j in range(1, 200):
            for k in range(1, 200):
                z = i**2 + j**2 + k**2 + i*j + j*k + k*i
                if z < 10001:
                    ret[z] += 1

    return ret


ans = f()

for x in range(1, N+1):
    print(ans[x])