peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
A,B=map(int, input().split())
if A > 8 :
    print (":(")
else :
    print ( "Yay!")
if B > 8 :
    print ()
# Judge status: Accepted
a = input()
b = input()
h = input()

print(  int(((int(a)+int(b))*int(h))/2) )
# Judge status: Wrong Answer
n=int(input())
S=[]
for i in range(n):
    S.append(input())
S=sorted(S)
from collections import defaultdict
d = defaultdict(int)

for k in S:
    d[k]+=1

d=dict(d)
dmax=max(d)
ansn=d[dmax]
ans=[]
for i in d.keys():
    if d[i]==ansn:
        ans.append(i)

ans.sort()
for i in range(len(ans)):
    print(ans[i])
# Judge status: Wrong Answer
N,M=map(int, input().split())
A=list(map(int, input().split()))
B = {}
C = {}
for i in range(M):
    B[i],C[i]=map(int, input().split())

high_scores = sorted(C.items(), key=lambda x:x[1], reverse=True)

sum_b = 0
for score in high_scores:
    sum_b += B[score[0]]
    if N < sum_b:
        A += [score[1]] *  (sum_b - N)
        break
    else:
        A += [score[1]] *  B[score[0]]

A.sort(reverse=True)
A = A[:N]

print(sum(A))
# Judge status: Wrong Answer
S = input()
T = input()

max_match = 0

n = len(T)
m = len(S)

for i in range(m-n):
    tmp = 0
    for j in range(i,i+n):
        if S[j] == T[j-i]:
            tmp += 1
    if tmp > max_match:
        max_match = tmp

ans = n - max_match



print(ans)
# Judge status: Accepted

s = int(input())

x = (s - 1) // 10**9 + 1
y = (10**9 - s) % 10**9
print(0, 0, 1, 10**9, x, y)
# Judge status: Wrong Answer
n,m=map(int,input().split())
data=[1]*n
res=[1]+[0]*(n-1)
for i in range(m):
  x,y=map(int,input().split())
  data[x-1]-=1
  data[y-1]+=1
  res[y-1]=res[x-1]
ans=0
for i in range(n):
  if data[i]!=0 and res[i]!=0:
    ans+=1
print(ans)
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int,input().split()))
c = sorted(collections.Counter(a).items(),reverse = True)

num2 = []
num4 = []
ans = [0]

for k in c:
  if k[1]>=4:
    num4.append(k[0])
  if k[1]>=2:
    num2.append(k[0])

if len(num2)>=2:
  ans.append(num2[0]*num2[1])
if len(num4)>=1:
  ans.append(num4[0]**2)

print(max(ans))
# Judge status: Accepted
from collections import Counter
s = Counter(input())
ans = "Yes"
if len(s)==2:
  for x in s.values():
    if x == 2: continue
    else: 
      ans = "No"
      break
else: ans = "No"
print(ans)
# Judge status: Accepted
a,b=(map(int,input().split()))
ans=a*b
print("Odd"if ans%2==1 else"Even")
# Judge status: Wrong Answer
N, M, X, Y = map(int, input().split())

x = list(map(int, input().split()))
y = list(map(int, input().split()))

for z in range(X, Y+1):
    if X <= z <= Y and max(x) < z and min(y) >= z:
        print('No War')
        break
else:
    print('War')
# Judge status: Accepted
x=int(input())
from math import ceil
cnt = ceil(x/11)

if 11*cnt - 5 >=x:
    ans=cnt*2-1
else:
    ans=cnt*2
    
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())

ans=0
while b>a and ans<c:

    b=b-a
    ans+=1

print(ans)
# Judge status: Wrong Answer
w,h,n=map(int,input().split())

y_min=0
y_max=h
x_min=0
x_max=w

for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    x_min=max(x_min,x)
  if a==2:
    x_max=min(x_max,x)
  if a==3:
    y_min=max(y_min,y)
  if a==4:
    y_max=min(y_max,y)

white=(y_max-y_min)*(x_max-x_min)
print(max(white,0))
# Judge status: Wrong Answer
n = int(input())
ans = 0
Min = float('inf')
for i in range(n):
    a = int(input())
    if a <= Min:
        ans += 1
        Min = a
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
H = 0
for i in range(1,N):
    if A[i] < A[i-1]:
        sa = A[i-1] - A[i]
        A[i] = A[i-1]
        H += sa
print(H)
# Judge status: Accepted
n = int(input())
li = []
pre_t = 0
pre_x = 0
pre_y = 0
flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if (t-pre_t)%2 == (x-pre_x+y-pre_y)%2 and (t-pre_t) >= (x-pre_x + y-pre_y):
        pre_t = t
        pre_x = x
        pre_y = y
    else:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
    i = str(i)
    if i[0] == i[4] and i[1] == i[3]:
        cnt += 1
        
print(cnt)
# Judge status: Accepted
a,b,c = map(int,input().split())
if c>=a and c<=b:print("Yes")
else:print("No")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse = True)
a=0
b=0
cnt = 0
for i in range(1,len(A)):
    if A[i]==A[i-1]:
        cnt+=1
    else:
        cnt=1
        
    if cnt==2:
        if a==0:
            a=A[i]
        elif b==0:
            b=A[i]
        cnt=0
        
        if a*b!=0:
            break

print(a*b)
# Judge status: Accepted
N, M = [int(i) for i in input().split()]

if M <= 2*N:
    print(M//2)
else:
    print(N+(M-2*N)//4)
# Judge status: Wrong Answer
import sys

sys.setrecursionlimit(10 ** 5 + 10)


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


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

    biggerA = 0
    biggerB=0

    for i in range(N):
        if A[i] > B[i]:
            biggerA += A[i] - B[i]
        if A[i] < B[i]:
            biggerB += B[i] - A[i]

    if biggerA * 2 <= biggerB:
        print('Yes')
    else:
        print('No')


resolve()
# Judge status: Wrong Answer
x, y = map(int, input().split())

print(x + y/2)
# Judge status: Accepted
n,k=map(int,input().split())
count=0
for i in range(k,n+2):
  count+=(n-i+1)*i+1
  count=count%(10**9+7)
print(count)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

ans=1000
i=0
while i<n:
    j=i
    mi=a[i]
    while j<n and mi>=a[j]:
        mi=min(mi,a[j])
        j+=1
    
    if j==n:
        break

    stock=ans//mi
    ans-=stock*mi
    ans+=a[j]*stock
    i=j

print(ans)
# Judge status: Accepted
s = input()

res = ""

for do in s:
    if do == "B":
        if len(res) != 0:
            res = res[0:len(res)-1]
        
    else:
        res += do

print(res)
# Judge status: Accepted
A, B = map(int, input().split())
if A >= 10 or B >= 10:
    print(-1)
else:
    print(A*B)
# Judge status: Accepted
n=int(input())
if n%9==0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from math import factorial

n, m = map(int, input().split())
if n == m:
    ans = factorial(n) % (10 ** 9 + 7)
    ans = ans ** 2 % (10 ** 9 + 7)
    print(ans * 2 % (10 ** 9 + 7))
elif abs(n - m) == 1:
    ans1 = factorial(n) % (10 ** 9 + 7)
    ans2 = factorial(m) % (10 ** 9 + 7)
    print(ans1 * ans2 % (10 ** 9 + 7))
else:
    print(0)
# Judge status: Accepted
A=int(input())
B=int(input())
print(6-A-B)
# Judge status: Wrong Answer
import bisect

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    A, B = [], []
    for _ in range(N):
        a, b = ZZ()
        A.append(a)
        B.append(b)
    A.sort()
    B.sort()
    midA = A[N//2] if N%2 == 1 else (A[N//2-1] + A[N//2])//2
    midB = B[N//2] if N%2 == 1 else (B[N//2-1] + B[N//2] + 1)//2
    print(max(0, midB-midA+1))

    return

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

s = l()
alf = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(s)):
	alf = alf.strip(s[i])
if alf == "":
	print("None")
else:
	print(alf[0])
# Judge status: Accepted
W,H,x,y = map(int, input().split())

S = W*H/2
flag = 0

if x==W/2 and y==H/2:
    flag = 1
    
print(S, flag)
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))

ng = 0
ok = 10**9

while ng < ok-1:
    mid = (ng+ok)//2
    
    count = sum((ai-1)//mid for ai in a)
    if count<=k: ok = mid
    else: ng = mid

print(ok)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int,input().split()))
a = sum(A[n//3:n//3*2])
b = sum(A[-2:-2-n//3*2:-2])
ans = max(a,b)
print(ans)
# Judge status: Accepted
N = int(input())
ans = (N*(N-1))//2
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
if N == M:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n, m, k = map(int, input().split())
for i in range(n + 1):
    for j in range(m + 1):
        if k == n * i + m * j - i * j * 2:
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
K = int(input())
seven = 7
counter = 1
flag = True
for i in range(K):
    if seven % K == 0:
        print(counter)
        flag = False
        break
    seven = (seven * 10 + 7) % K
    counter += 1
if flag:
    print(-1)
# Judge status: Wrong Answer
N,M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

def func():
    for i in range(N-M+1):
        for j in range(N-M+1):
            if B[0] == A[i][j:j+M]:
                for k in range(1, M):
                    if B[k] != A[i+k][j:j+M]:
                        return False
                return True
    return False

print('Yes' if func() else 'No')
# Judge status: Wrong Answer
N = int(input())
a = [int(x) for x in input().split()]
cnt4 = 0
cnt2 = 0
for x in a:
    if x % 4 == 0:
        cnt4 += 1
        continue
    if x % 2 == 0:
        cnt2 += 1

if N-cnt2 > 2*cnt4:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
import fractions

A, B, C, D = (int(abcd) for abcd in input().split())
lcm_CD = C*D // fractions.gcd(C, D)
in_B = B - ((B//C + B//D) - B//lcm_CD)
in_under_A = (A-1) - (((A-1)//C + (A-1)//D) - (A-1)//lcm_CD)
print(in_B - in_under_A)
# Judge status: Accepted
N = int(input())
CSF = [list(map(int, input().split())) for _ in range(N - 1)]
for i in range(N):
    t = 0
    for c, s, f in CSF[i:]:
        if t > s:
            if t % f:
                t += f - t % f
        else:
            t = s
        t += c
    print(t)
# Judge status: Accepted
p = input()
if p=='a' or p=='i' or p=='u' or p=='e' or p=='o':
  print('vowel')
else:
  print('consonant')
# Judge status: Accepted
K,X=[int(x) for x in input().rstrip().split()]
if (X<=K*500):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N=int(input())
ans=[]
l=[]
for i in range(1,N+1):
    l=list(str(format(i,'b')))
    l.reverse()
    l_=l.index('1')
    ans.append([l_,i])
ans.sort(reverse=True)
print(ans[0][1])
# Judge status: Accepted
import math
n,d=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(0,len(l)-1):
    for j in range(i+1,len(l)):
        sum_num=0
        for k in range(d):
            sum_num+=(l[i][k]-l[j][k])**2
        sum_num=math.sqrt(sum_num)
        if int(sum_num)==sum_num:
            cnt+=1
print(cnt)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

s = input()

if len(set(s))%2 == 1:
    print("No")
else: 
    print("Yes")
# Judge status: Accepted
x =int(input())
a =[i**5 for i in range(120)]
for i in range(120):
    for j in range(i+1,120):
        if a[j] -a[i] ==x:
            print(j,i)
            break
        if a[j] +a[i] ==x:
            print(j,-i)
            break
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a==1:
    a=a+13
if b==1:
    b=b+13
print(a,b)
print("Draw" if a==b else "Alice" if a>b else "Bob")
# Judge status: Accepted
s = list(input())
s[3] = '8'
print(''.join(s))
# Judge status: Accepted
#!/usr/bin/env python3
import sys
def input(): return sys.stdin.readline().rstrip()


def main():
    n=int(input())
    ans=0
    for i in range(1,n):
        ans+=(n-1)//i
    print(ans)



if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, m = map(int, input().split())
box = [[0, 1] for _ in range(n+1)]
box[0][1] = 0
box[1][0] = 1
for i in range(m):
  x, y = map(int, input().split())
  if box[x][0]:
    box[x][1] -= 1
    box[y][0] = 1
    box[y][1] += 1
  if box[x][1] == 0:
    box[x][0] = 0
print(sum(box[x][0] for x in range(1,n+1)))
# Judge status: Accepted
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def rle(l):
    hoge = list(set(l))
    huga = []
    for i in hoge:
        huga.append(l.count(i))
    huga.sort()
    return huga

def solve():
    s = list(input())
    t = list(input())
    if rle(s) == rle(t):
        print("Yes")
    else:
        print("No")
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
from itertools import combinations
import math
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for v in combinations(range(N), 2):
  a = sum([(i - j) ** 2 for i, j in zip(X[v[0]], X[v[1]])])
  if math.ceil(a ** 0.5) == a ** 0.5:
    ans += 1
    
print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
A = ""
for i in range(b):
    A += str(a)
B = ""
for i in range(a):
    B += str(b)
print(max(int(A),int(B)))
# Judge status: Accepted
N, M = map(int, input().split())
days = list(map(int, input().split()))
if N >= sum(days):
    print(N - sum(days))
else: print(-1)
# Judge status: Accepted
n, m = map(int, input().split())

ar = [0] * n

for i in range(m):
  a, b = map(int, input().split())
  ar[a-1] += 1
  ar[b-1] += 1
for i in range(n):
  print(ar[i])
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

maxans=0
for i in range(n):
  ans=sum(a[0:i+1]+b[i:n])
  maxans=max(ans,maxans)
print(maxans)
# Judge status: Accepted
n = int(input())
h = [int(i) for i in input().split(" ")]
dp = [float("inf")] * n

dp[0] = 0
dp[1] = dp[0] + abs(h[0] - h[1])
for i in range(1, n-1, 1):
  dp[i+1] = min(dp[i-1] + abs(h[i-1] - h[i+1]), dp[i] + abs(h[i] - h[i+1]))
  
print(dp[-1])
# Judge status: Wrong Answer
n = int(input())
A = [int(input()) for _ in range(n)]
B = [0]*(n+1)
ans = 0
for i in range(n):
  q, r = divmod(A[i]+B[i], 2)
  ans += q
  if r:
    B[i+1] += A[i]%2
print(ans)
# Judge status: Accepted
n = int(input())
b = 0
while b < n:
  b += 1000
print(b-n)
# Judge status: Wrong Answer
A,B,C = map(int, input("").split())

if A == 5:
    if B == 5:
        if C == 7:
            print("YES")
    elif B == 7:
        if C == 5:
            print("YES")
        else:
                print("NO")
    else:
        print("NO")

if A == 7:
    if B == 5:
        if C == 5:
            print("YES")
    else:
        print("NO")
else:
    print("NO")
# Judge status: Accepted
print('YNeos'[set(input())not in map(set,['NS','EW','NEWS'])::2])
# Judge status: Accepted
S = list(input())

acgt = ["A", "C", "G", "T"]

res = 0

t = 0

for s in S:
    if s in acgt:
        t += 1
    else:
        res = max(res, t)
        t = 0

res = max(res, t)

print(res)
# Judge status: Accepted
#119_A
S=input()
print('TBD' if int(S[5:7])>4 else 'Heisei')
# Judge status: Wrong Answer
# coding: utf-8
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: -1 * x, A))
# A.sort(reverse=True)
heapq.heapify(A)
for i in range(M):
    tmp = heapq.heappop(A)
    heapq.heappush(A, tmp // 2)
print(-sum(A))
# Judge status: Accepted
from fractions import gcd

def gcds(List):
    __ = 0
    for _ in List:
        __ = gcd(__, _)
    return __

n,x = map(int,input().split())
l = list(map(int,input().split()))

y = []
for i in range(n):
    y.append(abs(l[i]-x))

print(gcds(y))
# Judge status: Wrong Answer

import math
import itertools
import statistics
#import collections
x = int(input())

s =  x/11

ans = math.ceil(s*2)

print(ans)
# Judge status: Accepted
N=int(input())
move=int(N**.5)
while N%move!=0:
    move-=1
print(N//move+move-2)
# Judge status: Wrong Answer
import math
n,d = map(int,input().split())
ans = 0
for i in range(n):
    x,y = map(int,input().split())
    if math.sqrt((x ** 2) + (y ** 2)) >= d:
        ans += 1
print(ans)
# Judge status: Accepted
a,b,c,d = map(int,input().split())
x = [0]*(202)
x[a] += 1
x[b] -= 1
x[c] += 1
x[d] -= 1
for i in range(201):
    x[i+1] += x[i]
ans = 0
for i in range(202):
    if x[i] == 2:
        ans += 1
print(ans)
# Judge status: Wrong Answer
h,a=[int(x) for x in input().split()]
print(h//a + 1)
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
suma=sum(a)
cnt=0
for i in a:
    #print(i)
    if i*4*m>=suma:
        cnt+=1
if cnt>=m:print('Yes')
else:print('No')
# Judge status: Wrong Answer
r,g,b = map(int,input().split())
print("YES" if r*100 + g*10 + b%4==0 else "N0")
# Judge status: Accepted
n,m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]
ans = False
for pattern_h in range(n-m+1):
  for pattern_w in range(n-m+1):
    p = []
    for h in range(m):
      p.append(a[pattern_h+h][pattern_w:pattern_w+m])
    if p==b:
      ans = True
      break
  if ans: break
print('Yes' if ans else 'No')
# Judge status: Wrong Answer
n = int(input())
g = map(int, input().split())
a = [v-(i+1) for i,v in enumerate(g)]
s = sum(a)
b,r = divmod(s, n)

if r*2 > n and s > 0:
    b += 1
if r*2 < n and s < 0:
    b += 1

print(sum(map(lambda x:abs(x-b), a)))
# Judge status: Wrong Answer
from math import *
l,r,d=map(int,input().split())
k=r-l+1
ans=k//d
print(ans)
# Judge status: Accepted
import sys,fractions
input = sys.stdin.readline

mod = 10**9+7

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

lcm = 1
for a in lst_a:
    lcm = a*lcm//fractions.gcd(a,lcm)
lcm %= mod
ans = 0
for a in lst_a:
	ans += lcm*pow(a,mod-2,mod)
	ans %= mod

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

import numpy as np

arr = np.array(a)

pro = np.product(arr)

if pro > 10 ** 18:
    print(-1)
else:
    print(pro)
# Judge status: Wrong Answer
n = int(input())

min_v = 100000

for i in range(2, n - 1):
    b = n - i
    s = sum(list(map(int, str(i)))) + sum(list(map(int, str(b))))
    if s <= min_v:
        min_v = s

print(min_v)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if b - a == c - b:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
MM = input().split()
N = int(MM[0])
D = int(MM[1])
list1 =[]
count = 0
for i in range(N):
  aa = input().split()
  list1.append(aa)
for i in range(N):
  for j in range(i+1,N):
    total = 0
    for k,l in zip(list1[i],list1[j]):
      total += (int(k) -int(l))**2
    for m in range(40):
      if total == m**2 and total !=0:
        count +=1
print(count)
# Judge status: Accepted
N, M = map(int, input().split())
ac = [False] * N
wa_cnt = [0] * N
ac_cnt = 0
for i in range(M):
    p, s = input().split()
    p_i = int(p) - 1
    if s == 'WA':
        if not ac[p_i]:
            wa_cnt[p_i] += 1
    else:
        if not ac[p_i]:
            ac[p_i] = True
            ac_cnt += 1

wa_cnt_sum = 0
for i in range(N):
    if ac[i]:
        wa_cnt_sum += wa_cnt[i]

print(ac_cnt,wa_cnt_sum)
# Judge status: Accepted
n = int(input())
count = 0
ans = "No"
for i in range(n):
    a,b = input().split()
    if a == b:
        count += 1
    else:
        count = 0
    if count == 3:
        ans ="Yes"
        
print(ans)
# Judge status: Accepted
n = int(input())
s = list(map(int,input().split()))
t = s.copy()
t.sort()
cnt = 0
for i in range(n):
    if s[i] != t[i]:
        cnt += 1
if cnt<3:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
def gcd(a,b):
  if b==0:
    return a
  return gcd(b, a%b)

from itertools import accumulate
N = int(input())
T = [int(input()) for _ in range(N)]
ans = list(accumulate(T, func=gcd))[-1]
print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        b = B[i]
        if A[i] >= b:
            ans += b
        else:
            b -= A[i]
            ans += (A[i] + min(b, A[i+1]))
            A[i+1] = max(A[i+1] - b, 0)

    print(ans)


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

N, C, K = map(int, sys.stdin.readline().strip().split())
T = []
for _ in range(N):
    T.append(int(sys.stdin.readline().strip()))

T.sort()
ans = 0
n = 0
left_min = float("inf")
for t_i in T:
    left_min = min(t_i, left_min)
    if left_min + K < t_i:
        ans += 1
        left_min = t_i
        n = 1
        continue

    n += 1
    if n == C:
        ans += 1
        n = 0
        left_min = float("inf")

if n > 0:
    ans += 1

print(ans)
# Judge status: Accepted
import math

N = int(input())

i=0
num=0

#桁数
while 10**i <= N:
  i=i+1
    


if i==1:
  num=N
elif i==2:
  num=9
elif i==3:
  num=9+N-99
elif i==4:  
  num=9+999-99
elif i==5:  
  num=9+900+N-9999
elif i==6:  
  num=9+900+99999-9999
  
print(num)
# Judge status: Accepted
def nyu():
    N,K = map(int,input().split())
    A = [list(map(int,input().split())) for _ in range(N)]
    A.sort()
    return N,K,A

def kansu(N,K,A):
    
    sum = 0
    ans = -1


    for a in range(len(A)):
        sum += A[a][1]
#        print(sum,A[a][1])
        if (K <= sum):
            ans = A[a][0]
            break
    print(ans)




N,K,A = nyu()
kansu(N,K,A)
# Judge status: Accepted
n = input()
print("YES" if n in "753" else "NO")
# Judge status: Accepted
x = int(input())
y = 0
n =0
while(1):
  n += 1
  y += x
  y %= 360
  if(y==0):
    print(n)
    exit()
# Judge status: Accepted
import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))
# Judge status: Wrong Answer
n,m=map(int,input().split())
n,m = max(n,m),min(n,m)
print((n-2)*(m-2) if m>=3 else (0 if n==2 or m==2 or n==m==1 else n-2))
# Judge status: Accepted
N,M = map(int,input().split())

AC = [0 for i in range(N+1)]
WA = [0 for i in range(N+1)]

for i in range(M):
    a,b=input().split()
    a2 = int(a)
    if b == 'AC':
      AC[a2 - 1] = 1
    elif b == 'WA' and AC[a2 - 1] == 0:
      WA[a2-1]+= 1

ans_WA = 0
for i, j in zip(WA, AC):
  ans_WA += i * j
  
print(sum(AC), ans_WA)
# Judge status: Accepted
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
#from scipy.misc import comb

X = int(input())
ans = 0
i = 1
while 1:
    ans += i
    if X <= ans:
        print(i)
        break
    i += 1
# Judge status: Accepted

def resolve():
    def is_ok(mid):
        cnt = 0
        for a in A:
            cnt += (a-1)//mid
        return cnt <= K

    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    ok = max(A)
    ng = 0
    while ok - ng > 1:
        mid = (ok+ng)//2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    print(ok)


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
N, A, B = map(int, input().split())
if A > B:
    print(0)
    exit()
else:
    if N == 1:
        if A != B:
            print(0)
            exit()
        else:
            print(1)
            exit()
    else:
        # (N-1)*A+B以上 A+(N-1)*B以下の全ての値が可能
        ans = (N - 2) * (B - A) + 1
        print(ans)
# Judge status: Accepted
N, M = map(int,input().split())
l = list(map(int,input().split()))
su = sum(l)
if N < su:
    print('-1')
else:
    print(N - su)
# Judge status: Accepted
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    minabs = float("inf")
    tmpx = 0
    tmpy = sum(A)
    for i in range(N-1):
        tmpx += A[i]
        tmpy -= A[i]
        if abs(tmpx - tmpy) < minabs:
            minabs = abs(tmpx - tmpy)
    print(minabs)

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
n, c, k = map(int, input().split())
t = [ int(input()) for _ in range(n) ]
t.sort()

now = 0
past = t[0]
num = 0
ans = 1

for i in range(n):
    now = t[i]
    num += 1

    if now-past > k or num > c:
        ans += 1
        num = 1
        past = t[i]

print(ans)
# Judge status: Accepted
r = int(input())
l = 2*r*3.141592
print(l)