peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
small=list()
S=list(input())
for i in range(len(S)-2):
    small.append(abs(int(S[i]+S[i+1]+S[i+2])-753))
print(min(small))
# Judge status: Accepted
from bisect import bisect_right

N = int(input())
Nroot = int(N**(1/2))

an = [i*(i+1)//2 for i in range(50)]

ans = 0
for i in range(2, Nroot):
  count = 0
  if N%i == 0:
    Ni = N//i
    count = 1
    while Ni%i == 0:
      count += 1
      Ni = Ni//i
      
    ans += bisect_right(an, count) -1
    
  N = N//(i**count)
  
if N>1:
  print(ans+1)
else:
  print(ans)
# Judge status: Accepted
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]

A = Counter(a)

total = sum([A[i] * (A[i] - 1) //2 for i in A.keys()])

for i in range(n):
    tmp = a[i]
    print(total - A[tmp] +1)
# Judge status: Accepted
N = int(input())
A = [int(x) for x in input().split()]
minux_count = 0
minimum_abs = 10**9+1
if_zero_exists = False
for a in A:
    if a < 0:
        minux_count += 1
    if a == 0:
        if_zero_exists = True
    if abs(a) < minimum_abs:
        minimum_abs = abs(a)

answer = 0
for a in A:
    answer += abs(a)

if if_zero_exists or minux_count % 2 == 0:
    print(answer)
else:
    print(answer - 2*minimum_abs)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt = 1
ans = 0

if 1 not in a:
    print(-1)
    exit()

for num in a:
    if num == cnt:
        cnt+=1
    else:
        ans+=1

print(ans)
# Judge status: Accepted
N, A, B, C, D = map(int, input().split())
S = input()

for i in range(A, max(C, D)):
    if S[i-1:i+1] == '##':
        print('No')
        exit(0)

if C < D:
    print('Yes')
    exit(0)

for i in range(B-1, D):
    if S[i-1:i+2] == '...':
        print('Yes')
        exit(0)
print('No')
# Judge status: Wrong Answer
H, W = map(int, input().split())
if H % 2 == 0:
    print(H * W // 2)
elif W % 2 == 0:
    print(W * H // 2)
else:
    print((H - 1) * W // 2 + W // 2 + 1)
# Judge status: Wrong Answer
n = int(input())
p_li = list(map(int,input().split()))
dum = 0
ans = 0
flag = 0
count = 0
for i in range(n):
    if i+1 == p_li[i]:
        ans += 1
        if flag == 1:
            if dum == i-1:
                count += 1
                flag = 0
        else:
            flag = 1
            dum = i

#div,mod = divmod(dum,2)
print(ans-count)
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))

ret = 0
currmin = P[0]
for i in range(N):
    if P[i] <= currmin:
        currmin = P[i]
        ret += 1

print(ret)
# Judge status: Accepted
S = input()
A = [0 for _ in range(len(S) + 1)]

for idx in range(len(S)):
    if S[idx] == "<":
        A[idx + 1] = max(A[idx + 1], A[idx] + 1)

for idx in reversed(range(len(S))):
    if S[idx] == ">":
        A[idx] = max(A[idx], A[idx + 1] + 1)

print(sum(A))
# Judge status: Wrong Answer
x = input()
print(len(x) - min(x[:x.rfind("T")].count("S"), x[x.find("S"):].count("T")) * 2)
# Judge status: Wrong Answer
import sys
n = int(input())
l = list(map(int,input().split()))
if n==2:
    ans = l[0]*2
    print(ans)
    sys.exit()
    
ans = 0
lis = []
a,b = l[0],l[1]
if a<=b:
    ans +=a
    lis.append(a)
else:
    ans += b
    lis.append(b)
for i in range(n-2):
    a,b = l[i],l[i+1]
    if a<=b:
        ans += a
        lis.append(a)
    else:
        ans += b
        lis.append(b)
        
ans += l[n-2]
print(ans)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if a+b+c > 22:
  print('bust')
else:
  print('win')
# Judge status: Wrong Answer
import math
N, M = list(map(int,input().split()))

ant = math.floor((N - 2*M)/2)

for i in range(1, M+1):
    print(i, N-i+ant)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10000000)


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

    num = 0
    min_sum = sum(range(0, K))
    max_sum = sum(range(N + 1 - K ,N + 1))

    for i in range(N + 2 - K):
        num += max_sum - min_sum + 1
        max_sum += N - K - i
        min_sum += K + i

    D = 10 ** 9 + 7
    print(num % D)



if __name__ == '__main__':
    main()
# Judge status: Accepted
def main():
    a, b, c = map(int, input().split())
    if a == b and b == c and c == a:
        print('No')
    elif a != b and b != c and c != a:
        print('No')
    else:
        print('Yes')


if __name__ == "__main__":
    main()
# Judge status: Accepted
N=int(input())
T, A=map(int, input().split())
H=list(map(int,input().split()))
diffmin=10**9
for i in range(N):
  Ti = T-0.006*H[i]
  diff = abs(A-Ti)
  if diff<diffmin:
    diffmin=diff
    ans=i+1
    
print(ans)
# Judge status: Wrong Answer
D, T, S = input().split()
ID = float(D)
IT = float(T)
IS = float(S)
M = ID / IS



if M < IS:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s = list(input())
word = ""
for i in s:
  if i != "B":
    word += i
  else:
    if word != "":
      word = word.rstrip(word[-1])
print(word)
# Judge status: Accepted
a,b=map(int,input().split())
c=[]
for _ in range(a):
    c.append(list(map(int,input().split())))
result=[]
for i in range(a):
    if c[i][1]<=b:
        result.append(c[i][0])
if result==[]:
    print('TLE')
    exit()
print(min(result))
# Judge status: Wrong Answer
info=[]
for _ in range(6):
  info.append(int(input()))
ans=4+info[0]//min(info[1:])
print(ans)
# Judge status: Accepted
def gcd(a, b):
	if a==0:
		return b
	else:
		return gcd(b%a, a)

X = int(input())
LCM = X*360/gcd(360, X)
print(int(LCM/X))


#a, b = map(int, input().split())
#print(gcd(a, b))
# Judge status: Accepted
A = [list(map(int,input().split())) for _ in range(3)]
n = int(input())
num = set([])
for _ in range(n):
  num.add(int(input()))
  
def func(a,b,c):
  if a in num and b in num and c in num:
    return 1
  else:
    return 0
  
r =func(*A[0]) or func(*A[1]) or func(*A[2])
c = func(A[0][0],A[1][0],A[2][0]) or func(A[0][1],A[1][1],A[2][1]) or func(A[0][2],A[1][2],A[2][2])
naname = func(A[0][0],A[1][1],A[2][2]) or func(A[2][0],A[1][1], A[0][2])

print('Yes' if r or c or naname else 'No')
# Judge status: Accepted
# 角のマスは4回、端のマスは6回（表になる）
# それ以外のマスであればカードを裏返す回数は9回（裏になる）
n, m = map(int, input().split())
if n == 1 and m == 1:
    print(1)
elif n == 1 or m == 1:
    print(n*m - 2)
else:
    print(n*m - 2*((n-1)+(m-1)))
# Judge status: Wrong Answer
n=int(input())
l0=2
l1=1
l2=0
for i in range(2,n+1):
    l2=l1+l0
    l0=l1
    l1=l2
print(l2)
# Judge status: Accepted
n,k,s =map(int,input().split())

for i in range(k):
    print(s,end=" ")
for i in range(n-k):
    if s==10**9:
        print(s-1,end=" ")
    else:
        print(s+1,end=" ")
print()
# Judge status: Wrong Answer
d=int(input())
print('Christmas'+'Eve'*(25-d))
# Judge status: Accepted
n = input()
nums = sorted(list(map(int,input().split())),reverse=True)
print(sum(nums[0::2]) - sum(nums[1::2]))
# Judge status: Accepted
a,b,c = map(int, input().split())
print("Yes" if min(a,b) < c and max(a,b) > c else "No")
# Judge status: Accepted
import collections
import bisect

n, m = map(int, input().split())#入力
s = [[int(_) for _ in input().split() ] for _ in range(m)]
a = collections.defaultdict(list)#「県」と「市の誕生順」を分けて管理

for x,y in sorted(s):#ソート⇒県の順番に並ぶ
    a[x]+=[y]
for x,y in s:
    z = bisect.bisect(a[x],y)#二分検索⇒市の誕生順のインデックスが返る
    print("%06d%06d"%(x,z))#形式を整えて出力
# Judge status: Accepted
N = int(input())
A = []
max1 = 0
max2 = 0
index = 0
for i in range(N):
    a = int(input())
    A.append(a)
    if a > max1:
        max2 = max1
        max1 = a
        index = i
    elif a == max1:
        max2 = a
    elif a > max2:
        max2 = a
for i in range(N):
    if i == index:
        print(max2)
    else:
        print(max1)
# Judge status: Accepted
_,*l=map(int,open(0).read().split());d,a,i={},0,0
for h in l:d[i+h]=d.get(i+h,0)+1;a+=d.get(i-h,0);i+=1
print(a)
# Judge status: Wrong Answer
N = int(input())

ans = 1
count = 0
while 2*ans <= N:
    ans *= 2
    count += 1
print(count)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = A[0]
while A[0] != 0:
    ans = A[0]
    for i in range(1,N):
        A[i] -= A[0]
    A.sort()

print(ans)
# Judge status: Accepted
import sys

dishes = map(int, sys.stdin.read().split())
ans = 0
d = 0
for dish in dishes:
    wait_time = 10 - dish % 10
    if wait_time == 10:
        wait_time = 0
    if wait_time > d:
        ans += dish + d
        d = wait_time
    else:
        ans += dish + wait_time
print(ans)
# Judge status: Accepted
n, T = [int(i) for i in input().split()]
mn = 10000
for i in range(n):
    c,t = [int(i) for i in input().split()]
    if t <= T:
        mn = min(mn, c)
print("TLE" if mn == 10000 else mn)
# Judge status: Wrong Answer
s = input()
l = len(s)
sl = s[:(l-1)//2]
sr = s[((l+3)//2 -1):]


def f(s):
    l = len(s)
    j = False
    for i in range(l//2):
        if s[i] == s[l-1-i]:
            j = True
        else :
            j = False

    return j

if f(s) and f(sl) and f(sr):
    print("Yes")
else :
    print("No")
# Judge status: Accepted
n,d =  map(int,input().split())
i = 1
while True:
    if i*(2*d+1) >= n:
        print(i)
        break
    i += 1
# Judge status: Accepted
# Vicfred
# https://atcoder.jp/contests/abc049/tasks/abc049_a
# simulation
c = input()

vowels = ['a', 'i', 'u', 'e', 'o']

if c in vowels:
    print("vowel")
else:
    print("consonant")
# Judge status: Wrong Answer
o=input()
e=input()
ans=[]
for i in range(2*len(o) -1):
    if i%2==0:
        ans.append(o[i//2])
    else:
        ans.append(e[i//2])

print(*ans, sep='')
# Judge status: Wrong Answer
def main():
    N, M = map( int, input().split())
    ANS = []
    if N%2 == 1:
        n = N//2
        for i in range(M):
            ANS.append([n-i, n++1+i])
    else:
        n = N//2
        ANS.append([n,n+1])
        for i in range(1,M):
            ANS.append([n-i, n+2-i])

    print( "\n".join( [" ".join( map( str,ans)) for ans in ANS]))
if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))

b=[0]*N
b[0]=a[0]
for i in range(1,N):
    b[i]=b[i-1]+a[i]

x=[0]*N
y=[0]*N
z=[0]*N
for j in range(N):
    x[j]=b[j]
    y[j]=b[-1]-b[j]
    z[j]=abs(x[j]-y[j])

print(min(z[:-1]))
# Judge status: Wrong Answer
#C
s = list(input())
zero = 0
one = 0
for i in s:
    if i == "1":
        one += 1
    else:
        zero += 1
print(min(one,zero))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

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

def main():
    mod=10**9+7
    N=I()
    A=LI()
    from collections import defaultdict
    dd = defaultdict(int)
    
    for i in range(N):
        dd[A[i]]+=1
        
    L=[0,0]
    for k,v in dd.items():
        if v>=2:
            L.append(k)
            
    L.sort()
    print(L[-1]*L[-2])

main()
# Judge status: Accepted
n,y = list(map(int,input().split()))
y /= 1000
ans = [0,0,0]
# print(y)
for i in range(n+1):
    for j in range(0,n+1-i):
        a = i*10 + j*5
        b = i+j
        # print(a,b)
        if a + (n-(i+j)) == y:
            ans = [i,j,n-(i+j)]

if sum(ans) >0:
    print(ans[0],ans[1],ans[2])
else:
    print(-1,-1,-1)
# Judge status: Accepted
import numpy as np

n = int(input())
xs = list(map(int, input().strip().split()))
mn = min(xs)
mx = max(xs)
xs = np.array(xs)
diffs = np.empty((100, n), dtype=np.int)
for p in range(100):
    diffs[p] = xs - (p + 1)

ans = np.min(np.sum(diffs**2, axis=1))

print(ans)
# Judge status: Accepted
N = int(input())
W = input().split()
W = [int(w) for w in W]

S = sum(W)
mini = pow(10, 10)

for i in range(N):
  mi = abs(S - 2 * sum(W[0:i]))
  if mi < mini:
    mini = mi
print(mini)
# Judge status: Accepted
a, b, k = map(int, input().split(" "))

if k <= a:
  print(a-k, b)
elif k <= a + b:
  print(0, b + a - k)
else:
  print(0, 0)
# Judge status: Accepted
sx,sy,tx,ty = map(int, input().split())
x=-sx
y=-sy
sx+=x
sy+=y
tx+=x
ty+=y
tx=abs(tx)
ty=abs(ty)
 
ans=[]
ans+=['U']*ty
ans+=['R']*tx
ans+=['D']*ty
ans+=['L']*tx
ans+=['L']
ans+=['U']*(ty+1)
ans+=['R']*(tx+1)
ans+=['D']
ans+=['R']
ans+=['D']*(ty+1)
ans+=['L']*(tx+1)
ans+=['U']
print(''.join(ans))
# Judge status: Accepted

n, m = map(int, input().split())
L = [0] * m
R = [0] * m
for i in range(m):
    L[i], R[i] = map(int, input().split())
print(min(R) - max(L) + 1 if min(R) >= max(L) else 0)
# Judge status: Accepted
import math
N = int(input())
ans = 0
s=0
for i in range(1,N+1):
    ans += i

for k in range(1,N+1):
    for i in range(k+1,N+1):
        ans += (math.gcd(k,i)*6)

if(N>2):
    for i in range(1,N+1):
        for k in range(i+1,N+1):
            for j in range(k+1,N+1):
                s=math.gcd(k,i)
                ans += (math.gcd(s,j)*6)
print(ans)
# Judge status: Accepted
number = len(input())
print('x' * number)
# Judge status: Accepted
import sys
S = input()
T = input()
s = len(S)
t = len(T)
if s < t:
    print('UNRESTORABLE')
    sys.exit()

for i in range(s - t, -1, -1):
    OK = True
    for j in range(t):
        if S[i + j] != T[j] and S[i + j] != '?':
            OK = False
    if OK:
        for j in range(t):
            SS = S[:i] + T + S[i + j + 1:]
            SS = SS.replace('?', 'a')
        print(SS)
        sys.exit()

print('UNRESTORABLE')
# Judge status: Wrong Answer
C=list(open(0).read())
print('YES')if C[:3] == C[-1:-4:-1] else print('NO')
# Judge status: Accepted
a=[list(map(int,input().split()))for _ in range(3)]
N = int(input())
for i in range(N):
  b=int(input())
  for j in range(3):
    for k in range(3):
      if a[j][k]==b:
          a[j][k]=0
ans="No"
for i in range(3):
  if a[i][0]==a[i][1]==a[i][2]==0:
      ans="Yes"
  if a[0][i]==a[1][i]==a[2][i]==0:
      ans="Yes"
if a[0][0]==a[1][1]==a[2][2]==0:
    ans="Yes"
if a[2][0]==a[1][1]==a[0][2]==0:
    ans="Yes"
print(ans)
# Judge status: Wrong Answer
for i, s in enumerate(input()):
    if i % 2:
        if s != "i":
            print("No")
            break
    else:
        if s != "h":
            print("No")
            break
else:
    print("Yes")
# Judge status: Wrong Answer
N,K = map(int,input().split())
for i in range(1,31):
    if K**i <= N < K**(i+1):
        print(i+1)
        break
# Judge status: Accepted
s = input()
t = input()

sl = len(s)
tl = len(t)
ans = tl
for i in range(sl-tl+1):
  cnt = 0
  for j in range(tl):
    if s[i+j] != t[j]:
      cnt += 1
  ans = min(ans, cnt)
print(ans)
# Judge status: Wrong Answer
n,p=map(int,input().split())
a=list(map(int,input().split()))
odd=[0]*n
even=[0]*n

if a[0]%2==0:
    even[0]=1
else:
    odd[0]=1
    even[0] = 1

for i in range(n-1):
    if a[i+1]%2==0:
        odd[i+1]+=odd[i]+1
        even[i+1]+=even[i]+1
    else:
        odd[i+1]+=even[i]+odd[i]
        even[i+1]+=odd[i]+even[i]

if p==0:
    print(even[n-1])
else:
    print(odd[n-1])
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
B = A
B.reverse()
cum1 = [0]*(N)
cum2 = [0]*(N)
now1 = 0
for i in range(N):
  now1 += A[i]
  cum1[i] = now1
  cum2[i] = sum(A)-now1
minimum = 10**9
for i in range(N):
  if abs(cum1[i]-cum2[i]) < minimum:
    minimum = abs(cum1[i]-cum2[i])
print(minimum)
# Judge status: Accepted
x,y = map(int,input().split())

if x%y == 0:
    print(-1)
    exit()
print(x)
# Judge status: Accepted
n = int(input())
a_list = list(map(int,input().split()))
abs_list = []
minus = 0
check = False
for a in a_list:
  abs_list.append(abs(a))
  if a < 0:
    minus += 1
  if a == 0:
    check = True
if minus % 2 == 0 or check == True:
  print(sum(abs_list))
else:
  print(sum(abs_list) - 2 * min(abs_list))
# Judge status: Wrong Answer
import sys
readline = sys.stdin.readline

def solve():
    X = int(readline())

    print(10 - X // 200)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A = [a//400 for a in A]
l = len({0,1,2,3,4,5,6,7}&set(A))
S = sum(a>7 for a in A)
print(max(l, 1), l+S)
# Judge status: Accepted
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
ans = 1
n = (N-K)//(K-1)
ans += n
if N-K-n*(K-1) > 0:
    ans += 1
print(ans)
# Judge status: Wrong Answer
import numpy as np

N = int(input())
A = list(map(int, input().split()))
a = []
ans = 0

for i in range(N):
    a.append(A[i]-i-1)

b = int(np.average(a))

ans1=0
ans2=0

for i in range(N):
    ans1 += abs(b-1-a[i])

for i in range(N):
    ans2 += abs(b-a[i])

print(min(ans1,ans2))
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
r,g,b = list(map(int, input().split()))
print('YES' if 10*(g + b)%4==0 else 'NO')
# Judge status: Accepted
S = input().strip()
if (S == 'AAA' or S == 'BBB'):
	print('No')
else:
	print('Yes')
# Judge status: Accepted
from collections import defaultdict

S = tuple(map(int, list(input())))
MOD = 2019

d = defaultdict(int)
d[0] = 1

tmp = 0
for i, s in enumerate(reversed(S)):
    tmp = (tmp + s * pow(10, i, MOD)) % MOD
    d[tmp] += 1
print(sum(v * (v - 1) // 2 for v in d.values()))
# Judge status: Accepted
C= input()
D= input()

if (C[1]==D[1]) and  (C[0] == D[2]) and (C[2]==D[0]):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N=int(input())
S=input()
ans=[]
black=0
white=0
for n in range(N):
    if S[n]=='.':
        white+=1
    else:
        black+=1
stones={'b':0,'w':white}
for n in range(N):
    if S[n]=='#':
        stones['b']+=1
    else:
        stones['w']-=1
    ans.append(stones['b']+stones['w'])
if 'b' in stones:
    if stones['b']==N:
        print(0)
    else:
        print(min(min(ans),white,black))
else:
    print(min(min(ans),white,black))
# Judge status: Accepted
from queue import Queue
k = int(input())
q = Queue()
for i in range(9):
    q.put(i + 1)
for i in range(k):
    x = q.get()
    y = x % 10
    if x % 10 != 0:
        q.put(10 * x + y - 1)
    q.put(10 * x + y)
    if x % 10 != 9:
        q.put(10 * x + y + 1)
print(x)
# Judge status: Wrong Answer
X = int(input())
year = 0
deposit = 100
while deposit < X:
    deposit += int(deposit / 100)
    year += 1
print(year)
# Judge status: Accepted
N = int(input())

ans = 0
for i in range(N):
    if len(str(i + 1)) % 2 == 1:
        ans += 1
print(ans)
# Judge status: Accepted
from numpy import *
N = int(input())
A = array(list(map(int,input().split())))
B = array(sorted([A[n]-(n+1) for n in range(N)]))
print(sum(abs(B-int(median(B)))))
# Judge status: Accepted
N = int(input())
Min = 100000
for i in range(1,10):
  Dif = i * 111 - N
  if min(Min,Dif) == Dif and i * 111 >= N:
    ans = i * 111
    Min = Dif
print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))

for i in range(K,N):
    if A[i]>A[i-K]:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n, k =map(int, input().split())  #複数数値入力
d = []
a = []
for i in range(k):
    d.append(int(input()))
    ai = list(map(int, input().split()))  #リスト入力
    a.append(ai)
a = sum(a, [])
a = list(set(a))

aset = list(set(a))

result = 0
for i in range(1,n+1):
    if i in aset:
        continue
    else:
        result += 1

print(result)
# Judge status: Accepted
s = input()
t = input()
 
sp = sorted(s)
tp = sorted(t, reverse=True)
#print(sp, tp)
print('Yes' if sp < tp else 'No')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=max(a)
ansmax=-1
ans=-1
for i in range(n):
  if min(b-a[i],a[i]) > ansmax and b!=a[i]:
    ansmax=min(b-a[i],a[i]) 
    ans=a[i]
print(str(b)+' '+str(ans))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dp=[[0 for i in range(n)] for j in range(2)]
dp[0][0]=a[0]
for i in range(1,n):
    dp[0][i]=a[i]+dp[0][i-1]
dp[1][0]=dp[0][0]+b[0]
for i in range(1,n):
    dp[1][i]=max(dp[0][i],dp[1][i-1])+b[i]
print(dp[1][n-1])
# Judge status: Accepted
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = []
f = True
A = map(int, input().split())

for i in A:
    if i < 0:
        f ^= 1
    a.append(abs(i))

a.sort()

ans = sum(a[1:])

print(ans + (a[0] if f else -a[0]))
# Judge status: Accepted
a, b = map(int, input().split())
l = [i for i in range(2, 14)] + [1]

if l.index(a) > l.index(b):
    print('Alice')
elif l.index(a) < l.index(b):
    print('Bob')
else:
    print('Draw')
# Judge status: Wrong Answer
def main():
    A, B, C = map(int, input().split())

    ans = 0
    if (2 * A - B - C) == 0 and (2 * B - A - C) == 0 and (2 * C - A - B) == 0:
        print(-1)
    else:
        for i in range(10**9):
            if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
                print(ans)
                exit()

            A, B, C = (B + C)//2, (A + C)//2, (A + B)//2
            ans += 1

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N=int(input())
A=sorted(list(map(int,input().split(' '))))
ans = A[0]
for i in A[1:]:
    if i%ans>0:
        ans = i%ans
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
N, K = [int(str) for str in input().strip().split()]
x = [int(str) for str in input().strip().split()]

sums = [0]
for i in x:
    sums.append(sums[-1] + (i + 1) / 2)

ans = 0
for i in range(N - K + 1):
    ans = max(sums[i + K] - sums[i], ans)

print(ans)
# Judge status: Wrong Answer
n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
ans = 10**6
ok = False
for i in range(2**n):
    y = [0]*(m+1)
    for j in range(n):
        if i & (1 << j):
            for k in range(m+1):
                y[k] = y[k] + ca[j][k]
    if sum(z >= x for z in y[1:]) == m:
        ans = min(ans, y[0])
        ok = True
if ok:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
N,A,B=list(map(int,input().split()))
S=list(input())
t=0
u=0
for i in range(N):
 if S[i]=='a':
     if t<A+B:
         t=t+1
         print("Yes")
     else:
         print("No")
 elif S[i]=='b':
     if t<A+B and B>u:
         t=t+1
         u=u+1
         print('Yes')
     else:
         print('No')
 else:
     print('No')
# Judge status: Wrong Answer

#intの場合
L,R = map(int,input().split())
print(type(L),L,R)
# <class 'int'> 12 34

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

sub = sum(a)
s = 0
ans = (10 ** 10) + 100
for i in range(n):
    s += a[i]
    if (i + 1) < n:
        ans = min(ans, abs(sub - (2 * s)))

print(ans)
# Judge status: Wrong Answer
data = input()
Anull = True
Znull = True
count=0
zc=0
for i in range(len(data)):
  if Anull and data[i]=="A":
    Anull = False
    count=i
  if Znull and data[-1*i] == "Z":
    Znull = False
    zc=len(data)-i
result = zc - count + 1
print(result)
# Judge status: Accepted
A, B, K = map(int, input().split())

li = []
for i in range(A, A+K):
    if i <= B:
        li.append(i)
for j in range(B-K+1, B+1):
    if j >= A:
        li.append(j)
li = sorted(list(set(li)))
for a in li:
    print(a)
# Judge status: Accepted
n, m = [int(x) for x in input().split()]

result = 0

if n > 1:
  result += n*(n-1)/2

if m > 1:
  result += m*(m-1)/2

print(int(result))
# Judge status: Accepted
S = str(input())

former = ''
s = ''
cnt = 0
for i in range(len(S)):
  s += S[i]
  if s == former:
    continue
  else:
    cnt += 1
    former = s
    s = ''
print(cnt)
# Judge status: Accepted
w,a,b = map(int,input().split())
c = min(a,b)
d = max(a,b)
if c + w >= d:
  print(0)
else:
  print(d-c-w)
# Judge status: Accepted
import bisect
from collections import defaultdict
n,m = map(int,input().split())
p = [list(map(int, input().split())) for _ in range(m)]
 
a = defaultdict(list)
for x,y in sorted(p):
    a[x].append(y)
for x,y in p:
    
    z=bisect.bisect(a[x],y)
    print("{0:06d}{1:06d}".format(x,z))
# Judge status: Accepted
def com(n,r,mod):
    k=min(r,n-r)
    C=1
    for i in range(1,k+1):
        C=(C*(n+1-i)*pow(i,mod-2,mod))%mod
    return C

x, y = map(int,input().split())
mod = 10 ** 9 + 7
n = (2 * y - x) // 3 if (2 * y - x) % 3 == 0 else -1
m = (2 * x - y) // 3 if (2 * x - y) % 3 == 0 else -1

if n >= 0 and m >= 0:
    print(com(n + m, n, mod))
else:
    print(0)
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())
d = [h,w]
num = 0
for i in range(min(d)):
    if max(d) * (i+1) >= n :
        num = i + 1
        break
print(num)