peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())

table = []
for i in range(n-1):
    c , s , f = map(int,input().split())
    table.append([c,s,f])

for i in range(n):
    time = 0
    for j in range(i,n-1):
        if time < table[j][1]:
            time = table[j][1]
        elif time > table[j][1]:
            if time % table[j][2] != 0:
                time += table[j][2] -(time%table[j][2])
        time += table[j][0]
    print(time)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

S = input()

set_ = set(S)
for c in [chr(i) for i in range(97, 97+26)]:
    if c not in set_:
        print(c)
        quit()
print('None')
# Judge status: Wrong Answer
n, m = map(str, input().split())
a, b = map(int, input().split())
u = str(input())

if n==u:
  a=a-1
  
if m==u:
  b=b-1

print(n,m)
print(a,b)
print(u)
# Judge status: Accepted
N, C, K = [int(x) for x in input().split()]
T = [int(input()) for _ in range(N)]
T.sort()
depart = T[0] + K  # 出発時刻
passenger = 0  # 乗客数
bus = 1
for i in range(N):
    if passenger >= C or depart < T[i]:  # すでに満員または待ち時間オーバー
        bus += 1
        passenger = 1
        depart = T[i] + K
    else:
        passenger += 1

print(bus)
# Judge status: Accepted
n, x = map(int, input().split())
a = list(map(int, input().split()))+[0]
ans = 0
for i in range(n):
    if a[i+1] + a[i] <= x:
        continue
    else:
        ans += (a[i+1] + a[i] - x)
        a[i+1] = max(0, x - a[i])
        # print(ans)
        # print(a)
print(ans)
# Judge status: Accepted
N = int(input())

ans = (N + 1) // 2
print(ans)
# Judge status: Accepted
S = str(input())

chrs = ('A', 'C', 'G', 'T')
max_len = 0
this_len = 0
for s in S:
  if s in chrs:
    this_len += 1
  else:
    this_len = 0

  max_len = max(this_len, max_len)

print(max_len)
# Judge status: Accepted
import sys
#input = sys.stdin.buffer.readline

def main():
    N,A,B,C,D = map(int,input().split())
    s = str(input())
    
    if "##" in s[A:max(C,D)]:
        print("No")
    elif (C > D and "..." not in s[B-2:D+1]):
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S = input()
S = S[::-1]
leng = len(S)
S = int(S)

count = [0] * 2019
count[0] = 1

for i in range(leng):
    remainder = (S // (10**i)) % 2019
    print(S//(10**i), remainder)
    count[remainder] += 1

res = 0
for cnt in count:
    res += cnt * (cnt - 1) // 2

print(res)
# Judge status: Accepted
n = input()
if n[0] == n[1] == n[2] or n[1]==n[2]==n[3]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from math import sqrt

def main():
    n, d = map(int, input().split())
    xy = [list(map(int, input().split())) for _ in range(n)]
    print(n, d)
    print(xy)
    cnt = 0
    for x, y in xy:
        xy_d = sqrt(x**2 + y**2)
        if xy_d <= d:
            cnt +=1
    print(cnt)
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
import collections
w = list(input())
w = collections.Counter(w).values()
ans = all(x%2 == 0 for x in w)
print("Yes" if ans else "No")
# Judge status: Wrong Answer
N, L = map(int, input().split())
 
# 元々の味: s
s = (N-1)*(2*L+N-1) // 2
l = [abs(L+i) for i in range(N)]

print(s - (L+l.index(min(l))))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=[]
p=0
for i in range(n):
  p=p^a[i]
  
for i in range(n):
  k=p^a[i]
  ans.append(k)
print(*ans)
# Judge status: Wrong Answer
##A
N = str(input())
if N[-1] == '3':
    print('bon')
elif N[-1] == '0' or '1' or '6' or '8':
    print('pon')
else:
    print('hon')
# Judge status: Wrong Answer
a, v = map(int,input().split())
b, w = map(int,input().split())
t = int(input())
if a + v*t >= b + w*t :
    print("YES")
else:
    print("NO")
# Judge status: Accepted
def main():
    x = sorted(list(map(int, input().split())))
    print('YES' if x == [5, 5, 7] else 'NO')

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys

*t, = map(int, sys.stdin.readline().split())

def main():
    ans = sum(t) - max(t)
    print(ans)

if __name__ ==  '__main__':
    main()
# Judge status: Accepted
a = int(input())
x = a
k = 1
while a != 360:
    a = a + x
    if a > 360 :
        a = a - 360
    k = k + 1
print(k)
# Judge status: Accepted
N = int(input())
S = input()

A = S[:N//2]
B = S[N//2:]

if A==B:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    A,B,C =map(int,input().split())
    print(max(0,C-A+B))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
O = input()
E = input()
ans = ""
for i in range(len(E)):
  ans+=O[i]
  ans+=E[i]
  
if len(O)%2==1:
  ans+=O[len(O)-1]

print(ans)
# Judge status: Accepted
n = int(input())
li = [list(map(int,input().split())) for i in range(n-1)] #csf

for i in range(n-1):
    t = li[i][1] + li[i][0]
    for j in range(i+1,n-1):
        while True:
            if t >= li[j][1] and t%li[j][2] == 0:
                break
            else:
                t += 1
        t += li[j][0]
    print(t)
print(0)
# Judge status: Accepted
print ("YNeos"[len(''.join(set(sorted(input()))))!=2::2])
# Judge status: Accepted
import re

s = input()
flag = re.match('^(dream|dreamer|erase|eraser)+$',s)

if flag:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a,b= list(map(int,input().split()))
if 0 < a:
    print("Positive")
elif b < 0:
    if abs(b-a) % 2 == 0:
        print("Negative")
    else:
        print("Positive")
else:
    print("zero")
# Judge status: Wrong Answer
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = 0
count = 0
i = 1
while d <= x and i <= n:
    d = d + l[i - 1]
    count += 1
    i += 1

print(count)
# Judge status: Wrong Answer
n, m = (int(x) for x in input().split())
l, r = (int(x) for x in input().split())
sss = set(range(l, r + 1))
for i in range(m-1):
  l, r = (int(x) for x in input().split())
  sss &= set(range(l, r))
print(len(sss))
# Judge status: Accepted
import fractions #昔はfractions

n = int(input())
a = int(input())
for i in range(n-1):
    b = int(input())
    f=fractions.gcd(a,b)
    a=a*b//f
print(a)
# Judge status: Accepted
#147_B
s = input()
ans = 0
for i in range(0, len(s)//2):
    if s[i] != s[-i-1]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())

if A < C < B:
  print('Yes')
  
else:
  print('No')
# Judge status: Wrong Answer
a = int(input())
b = int(input())
h = int(input())
S = (a+b)*h/2
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())

a = (h2 - h1) * 60 + (m2 - m1)
print(a - k)
# Judge status: Accepted
def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    s = readline().rstrip().decode('utf-8')

    print('Yes' if s[:n//2] == s[n//2:] else 'No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
ans = [0] * (len(S) + 1)
for i in range(len(S)):
    if S[i] == '<':
        ans[i + 1] = ans[i] + 1
for i in range(len(S) - 1, -1, -1):
    if S[i] == '>':
        ans[i] = max(ans[i], ans[i + 1] + 1)
print(sum(ans))
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
print(min(K, N) * X + max(N-K, 0) * Y)
# Judge status: Accepted
S = input()

n = 0
w = 0
s = 0
e = 0
for si in S:
    if si == 'N':
        n += 1
    elif si == 'W':
        w += 1
    elif si == 'S':
        s += 1
    else:
        e += 1


ans = False
if (n and s) or (not n and not s):
    if (w and e) or (not w and not e):
        ans = True

if ans:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, K = map(int, input().split())
print((N - 1) // (K - 1) + int((N - 1) % (K - 1) != 0))
# Judge status: Accepted
s = input()
ans = 0
rs = s[::-1]
for i in range(len(s)):
    if s[i] != rs[i]:
        ans += 1
print(ans//2)
# Judge status: Accepted
N,L=map(int,input().split())
S=[]
for i in range(N):
    S.append(str(input()))
print("".join(sorted(S)))
# Judge status: Accepted
a, b=map(int, input().split())
ans=0

for num in range(a, b+1):
    num=str(num)
    if num[0]==num[-1] and num[1]==num[-2]:
        ans+=1

print(ans)
# Judge status: Accepted
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

a, b = list(map(int, sys.stdin.buffer.readline().split()))

s = 0
for i in range(b - a):
    s += i
ans = s - a
print(ans)
# Judge status: Accepted
import collections

def main():
    w = list(input())
    ans = "Yes"
    for c, freq in collections.Counter(w).items():
        if freq % 2 == 1:
            ans = "No"
            break
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
from collections import Counter
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = Counter(list(map(int, input().split())))
    
    ans = 0;
    for k, v in a.items():
        if k < v:
            ans += v - k
        elif k > v:
            ans += v
            
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c = input().split()
    x = int(a + b + c)

    if x % 4 == 0:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int , input().split()))
b = [a[i] - (i+1) for i in range(n)]

b.sort()
idx= n//2
bi = b[idx]
ans = 0
for i in range(n):
    ans += abs(a[i] - (i + 1 + bi))
print(ans)
# Judge status: Accepted
inp=list(map(int,input().split()))
l = [0] * 100
for i in inp:
    l[i-1]+=1
if 2 in l:
    print(2)
elif 3 in l:
    print(1)
else:
    print(3)
# Judge status: Wrong Answer
#!/usr/bin/env python3

n = int(input())
a = list(map(int, input().split()))
d = [0 for _ in range(n-1)]
for i in range(n-1):
    d[i] = a[i+1]-a[i]

ans = 0 
flg = False
for i in range(n-1):
    if i == 0 or flg == True:
        flg = False
        continue
    else:
        if d[i]*d[i-1] < 0:
            ans += 1
            flg = True

print(ans+1)
# Judge status: Accepted
N = list(map(int, input().split()))
string = [input() for s in range(N[0])]
string.sort()
print(''.join(string))
# Judge status: Accepted
x = list(map(int,input().split(" ")))
a = x[0]
b = x[1]
c = x[2]

if a == b and a == c:
    print("No")
elif a == b or b == c or a == c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import collections

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

c=collections.Counter(l)
cc=sorted(c.most_common(max(c.values())))
for i in cc:
    print(i[0])
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().rstrip()
import math
def main():
    a,b,x=map(int,input().split())
    if x==a**2*b:
        print(90)
        sys.exit()
    if x<=a**2*b/2:
        print(90.0-math.degrees(math.atan((2*x)/(a*b**2))))
    else:
        z=2*x/a**2-b
        print(90.0-math.degrees(math.atan(a/(b-z))))

if __name__=='__main__':
    main()
# Judge status: Accepted
def main():
    N = int(input())
    S = input()
    cnt = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = 2 * j - i
            if k >= N:
                continue
            if S[j] != S[i] and S[i] != S[k] and S[k] != S[j]:
                cnt += 1
    print(S.count("R") * S.count("B") * S.count("G") - cnt)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
X, Y, Z = input().split()
print(Z,Y,X)
# Judge status: Accepted
# ABC125A

a, b, t = map(int, input().split())
print(b * (t // a))
# Judge status: Wrong Answer
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
X.sort()
bef = int(length/2)-1
aft = bef
for i in range(N):
    if(i<=bef-1):
        print(X[bef])
    else:
        print(X[aft])
# Judge status: Wrong Answer
import fractions
n=int(input())
a=1
for i in range(n):
  b=int(input())
  a=a/fractions.gcd(a,b)*b
print(a)
# Judge status: Accepted
N, M = [int(i) for i in input().split()]
print(N*(N-1)//2 + M*(M-1)//2)
# Judge status: Wrong Answer
n = int(input())
alp = [chr(ord("a") + x) for x in range(26)]

def dfs(S):
    if len(S) == n:
        print(S)
    else:
        for i in range(len(S) + 1):
            dfs(S + alp[i])

dfs("a")
# Judge status: Accepted
import numpy as np
N, M = map(int, input().split())

store = {}
for i in range(N):
    a, b = map(int, input().split())
    if a in store: store[a] += b
    else: store[a] = b
key = list(store.keys())
key.sort()

bins = 0
total = 0
for k in key:
    if bins + store[k] < M:
        bins += store[k]
        total += k * store[k]
    else:
        total += k * (M-bins)
        break
print(total)
# Judge status: Accepted
K = int(input())

if K % 7 == 0:
    L = 9 * K // 7
else:
    L = 9 * K

ans = -1
n = 10
for i in range(1, L):
    surplus = n % L
    if surplus == 1:
        ans = i
        break
    n = 10 * surplus
print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt1 = 0
cnt2 = 0
for i in range(N):
    if a[i] > b[i]:
        cnt2 += a[i] - b[i]
    else:
        cnt1 += (b[i] - a[i] + 1) // 2
        cnt2 += (b[i] - a[i]) % 2

# print(cnt1, cnt2)
if cnt1 >= cnt2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
from collections import Counter
AA = Counter(A)
B = []
for k,v in AA.items():
    if v>=2:
        B.append(k)
B.sort(reverse=True)
if len(B)<2:
    print(0)
else:
    print(B[0]*B[1])
# Judge status: Accepted
N, D = list(map(int, input().split()))
if N % (D*2+1) == 0:
    print(N//(D*2+1))
else:
    print((N//(D*2+1))+1)
# Judge status: Accepted
n, k = map(int, input().split())
d = set(input().split())

while True:
    flag = True
    for i in str(n):
        if i in d:
            flag = False
    if flag:
        print(n)
        exit()
    n += 1
# Judge status: Wrong Answer
N,M = map(int, input().split())

ans = 0
if True:
    ans = ans + N
    M = M - 2*N
    N = N - N
    ans = ans + M//4
    print(ans)
else:
    print(0)
# Judge status: Accepted
A,B,T=map(int,input().split())
print(int((T+0.5)//A *B))
# Judge status: Accepted
N = int(input())
S = input()
r,g,b = 0,0,0
for i in S:
  if i == 'R':
    r += 1
  elif i == 'G':
    g += 1
  else:
    b += 1
minus = 0
for i in range(N - 2):
  for j in range(i + 1, N - 1):
    k = 2 * j - i
    if k >= N:
      continue
    if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
      minus += 1
print(r*g*b - minus)
# Judge status: Wrong Answer
a = int(input())

s = input()

if a >= 3200:
    print("s")
elif a < 3200:
    print("red")
# Judge status: Accepted
n, k = map(int, input().split())
s = input()
s_new = ''
for i in range(n):
    if i == k - 1:
        s_new += s[i].lower()
    else:
        s_new += s[i]
print(s_new)
# Judge status: Accepted
n = input()
a = len(n)
c = 0
for i in range(a - 1):
    if i % 2 == 0:
        c += 9 * 10 ** i
n = int(n)
if a % 2:
    c += n - 10 ** (a - 1 ) + 1
print(c)
# Judge status: Accepted
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    a = np.fromstring(read(), np.int64, sep=' ')[1:]
    a = a[a % 2 == 0]
    if np.all((a % 3 == 0) | (a % 5 == 0)):
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    main()
# Judge status: Accepted
K, X = map(int, input().split())

ans = [i for i in range(X-K+1, X+K)]
for i in ans:
    print(i)
# Judge status: Accepted
S=input();print(min(abs(753-int(S[i:i+3]))for i in range(len(S)-2)))
# Judge status: Accepted
s = int(input())
i = 1
if s == 1 or s == 2:
  print(4)
  exit()
while True:
  if s == 4:
    print(i+3)
    exit()
  if s%2 == 0:
    s=s//2
  else:
    s=3*s+1
  i += 1
# Judge status: Accepted
x, y = map(int,input().split())
print(x + y // 2)
# Judge status: Accepted
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n = I()
    ans = 0
    temp = 0
    for _ in range(n):
        d1, d2 = MI()
        if d1 == d2:
            temp += 1
        else:
            temp = 0
        ans = max(ans, temp)
    if ans >= 3:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a = int(input())
    b = int(input())
    h = int(input())

    res = (a + b) * 2 // h
    print(res)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
import math
 
S = int(input())
 
 
X1 = 0
Y1 = 0
X2 = 10 ** 9
X3 = 1
 
Y3 = math.ceil(S / (10 ** 9))
Y2 = X2 * Y3 - S
 
print(X1, Y1, X2, Y2, X3, Y3)
# Judge status: Accepted
N, K = map(int, input().split())
num = list(map(int, input().split()))
kirai = [0]*10
for i in num:
    kirai[i] = 1

MAXX = 100000
for n in range(N, MAXX):
    tmp = n
    good = True
    while tmp > 0:
        d = tmp % 10
        tmp = tmp//10
        if kirai[d]:
            good = False
            break
    if good:
        break

print(n)
# Judge status: Accepted
N = int(input())
S = input()

ans = 0
x = 0
for s in S:
    if s == "I":
        x += 1
    else:
        x -= 1
    ans = max(ans, x)
print(ans)
# Judge status: Accepted
a,b=input().split()
a=int(a)
b=int(b)
if a>=10:
    print(b)
else:
    c=b-100*a+1000
    print(c)
# Judge status: Accepted
s = list(input())

if s[0] == "A" and s[2:-1].count("C") == 1:
    s.remove("A")
    s.remove("C")
    
    if "".join(s).lower() == "".join(s):
        print("AC")
    else:
        print('WA')

else:
    print("WA")
# Judge status: Accepted
S = input()

A = int(S.find("A"))
Z = int(S.rfind("Z"))

print(Z-A+1)
# Judge status: Accepted
from bisect import bisect

n,h=map(int,input().split())
b=[]
a_max=0
for i in range(n):
  x,y=map(int,input().split())
  b.append(y)
  a_max=max(a_max,x)

b=sorted(b)
lim_inx=bisect(b,a_max)

cnt=0
total=0
inx=n-1
while total<h:
  if inx>=lim_inx:
    total+=b[inx]
    cnt+=1
    inx-=1
  else:
    if (h-total)%a_max==0:
      cnt+=(h-total)//a_max
    else:
      cnt+=(h-total)//a_max+1
    print(cnt)
    exit()
print(cnt)
# Judge status: Accepted
s = list(input())
op = ['+', '-']
for op1 in op:
    for op2 in op:
        for op3 in op:
            ans = s[0]+op1+s[1]+op2+s[2]+op3+s[3]
            if eval(ans) ==7:
                print(ans + '=7')
                exit()
# Judge status: Accepted
N = int(input())

if N % 10 == 3:
  print("bon")
  
elif N % 10 == 0:
  print("pon")
  
elif N % 10 == 1:
  print("pon")

elif N % 10 == 6:
  print("pon")
  
elif N % 10 == 8:
  print("pon")
  
else:
  print("hon")
# Judge status: Wrong Answer
N=int(input())
L=list(map(int,input().split()))
L_i=[i+1 for i in range(len(L))]

cnt=0
for i in range(N):
    P_L= [m+L[i] for m in L[i:]]
    P_L_i = [x for x in range(N-i)]
    print(P_L)
    print(P_L_i)
    cnt = cnt + sum([w==z for (w, z) in zip(P_L,P_L_i)])
    
print(cnt)
# Judge status: Wrong Answer

n, x, t = map(int, input().split())
answer = (n//x)*t
print(answer)
# Judge status: Wrong Answer
N, D = map(int, input().split())

X = [list(map(int, input().split())) for i in range(N)]

sq = set()
for i in range(1, 100):
  sq.add(i**2)

def foo(x,y):
  t = 0
  for i, j in zip(X[x], X[y]):
    t += (i - j) * (i - j)
  if t in sq:
    return 1
  else:
    return 0
    
ans = 0

for i in range(N):
  for j in range(i+1, N):
    ans += foo(i, j)

print(ans)
# Judge status: Wrong Answer
A, B, C, X, Y = map(int, input().split())
ans = 10**18
Z = max(X, Y)
for i in range(Z+1):
  price = C*i + A*max(0, X-i) + B*max(0, Y-i)
  ans = min(ans, price)

print(ans)
# Judge status: Accepted
from fractions import gcd
N , X = (map(int , input().split()))
x = list(map(int , input().split()))
ans = 0
for i in x:
    ans = gcd(ans , abs(X-i))
print(ans)
# Judge status: Accepted
s = input()
b = ["a", "i", "u", "e", "o"]
if s in b:
    print("vowel")
else:
    print('consonant')
# Judge status: Wrong Answer
N, A, B = [int(i) for i in input().split()]

g = 0

while N > A:
    N = N - A - B
    g = g + A

print(g + N)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
asum = sum(a)
cnt = [0] * (10**5+1)
q = int(input())

for i in a:
    cnt[i] += 1

for i in range(q):
    b, c = map(int,input().split())
    asum = asum + (c-b)*cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(asum)
# Judge status: Accepted
N, M = map(int, input().split())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


divs = sorted(make_divisors(M), reverse=True)

ans = 1
for div in divs:
    res = div if div*N <= M else 1
    ans = max(ans, res)

print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
a = list(map(int,input().split()))

if n-sum(a)>=0:
    print(n-sum(a))
else:
    print("-1")
# Judge status: Wrong Answer
S = input()

if (S[0] == 'R' and S[1] == 'R') or (S[1] == 'R' and S[2] == 'R'):
    print(2)
elif S == 'SSS':
    print(0)
elif S == 'RRR':
    print(3)
else:
    print(1)
# Judge status: Accepted
H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
sm = sum(A)
print("Yes" if sm >= H else "No")
# Judge status: Accepted
if any(list(map(lambda x: int(x) % 2 == 0, input().split()))):
  print("Even")
else:
  print("Odd")
# Judge status: Accepted
S = input()
ans = 0
for i in range(int(len(S) / 2)):
    if S[i] != S[len(S) - i - 1] :
        ans += 1
print(ans)
# Judge status: Accepted
from fractions import gcd
from math import sqrt


def prime_factorize(n):
    result = []
    for i in range(2, int(sqrt(n)) + 1):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


A, B = map(int, input().split())
print(len(prime_factorize(gcd(A, B))) + 1)
# Judge status: Accepted
from itertools import accumulate


def LI():
    return list(map(int, input().split()))


N = int(input())
W = LI()
total = sum(W)
Wsum = list(accumulate(W))
ans = 10000000
for i in range(N):
    ans = min(ans, abs(Wsum[i]-(total-Wsum[i])))
print(ans)
# Judge status: Accepted
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

x = int(input())
now = 100
ans = 0
while True:
    if now >= x:
        print(ans)
        break
    ans += 1
    now = floor(now * 1.01)
# Judge status: Wrong Answer
n,q=map(int,input().split())
s=input()
for i in range(q):
	l,r=map(int,input().split())
	l,r=l-1,r-1
	print(s[l:r].count("AC"))
# Judge status: Wrong Answer
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
A = LI()
ans = 1000
purchase = 0

for i in range(1, N):
    tmp = ans
    
    if A[i] > A[i - 1]:
        for j in range(100):
            if tmp - A[i - 1] < 0:
                break
            tmp -= A[i - 1]
            purchase += 1
        ans = max(ans, tmp + A[i] * purchase)
        purchase = 0

print(ans)
# Judge status: Accepted
print(''.join([i[0]for i in input().split()]))