peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
monster = [int(i) for i in input().split()] # 配列で数字

def gcd(x, y): #GCD
    # greatest_common_divisor
    if x < y:
        x, y = y, x
    if y == 0:
        return 0
    if x % y == 0:
        return y
    return gcd(y, x % y)


l = monster[0]
for m in monster:
    l = gcd(l, m)
print(l)
# Judge status: Accepted

import random

s = input()
start = random.randint(0,len(s)-3)

nickname = s[start:start+3]
print(nickname)
# Judge status: Wrong Answer
N, K = input().split()
A = [int(n) for n in input().split()]
kind = dict()

for n in A:
    if n not in kind:
        kind[n] = 0
    kind[n] += 1

print(kind)

diff = len(kind) - int(K)
if diff > 0:
    values = sorted(kind.values())
    print(sum(values[:diff]))
else:
    print(0)
# Judge status: Accepted
A, B, C = map(int, input().split())
if (A - C) * (B - C) < 0:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)
# Judge status: Accepted
s = input()
for word in ["eraser","erase","dreamer","dream"]:
    s = s.replace(word,".")
if len(set(s)) == 1:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
from collections import Counter, defaultdict
n = int(input())
s = [input() for i in range(n)]

cnt = defaultdict(lambda :[0, 0])
for S in s:
    temp = Counter(S)
    for key, val in temp.items():
        if cnt[key] == [0, 0]:
            cnt[key] = [val, 1]
            continue
        if cnt[key][0] > val:cnt[key][0] = val
        cnt[key][1] = cnt[key][1] + 1

ans = ''
for key, val in cnt.items():
    if val[1] == n:
        ans += key * val[0]
print(ans)
#print(cnt)
# Judge status: Wrong Answer
r = int(input())
print(r * 3.14159)
# Judge status: Wrong Answer
n=int(input())
ans=0
for i in range(1,n+1):
  j=n//i
  ans+=j*(j+1)//2
print(ans)
# Judge status: Accepted
n = int(input())
s = input()

ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if k < n and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
print(ans)
# Judge status: Accepted
from collections import Counter
N = int(input())
D = list(map(int, input().split()))
if D[0] != 0:
    print(0)
    exit()
D = Counter(D)
if 0 not in D.keys():
    print(0)
    exit()
if D[0] > 1:
    print(0)
    exit()
max_key = max(D.keys())
cnt = [0] * (max_key + 1)
for i in range(0, max_key + 1):
    cnt[i] = D[i]
ans = 1
for i in range(1, len(cnt)):
    ans *= (cnt[i-1] ** cnt[i])
    ans %= 998244353
print(ans % 998244353)
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = -1
for i in range(1, 4):
  if a * i % b == 0:
    ans = a * i
print(ans)
# Judge status: Wrong Answer
N = int(input())
H = list(map(int, input().split()))
ans = 0
temp = 0
for i in range(N-1):
  if H[i] > H[i+1]:
    temp += 1
  else:
    if temp > ans:
      ans = temp
      temp = 0
if temp > ans:
  ans = temp
  
print(ans)
# Judge status: Wrong Answer
a=int(input())
s=input()
if a>=3200:
    print(s)
elif s=="pink":
    print("red")
else:
    print("pink")
# Judge status: Wrong Answer

if __name__ == '__main__':
    tmp = int(input())
    l = [2, 1]
    ans = 0
    if tmp < 2:
        ans = l[tmp - 1]
        print(ans)
        exit()
    for i in range(tmp - 1):
        ans = l[i] + l[i + 1]
        l.append(ans)
    print(ans)
# Judge status: Wrong Answer
a, b = input().split()
a, b = int(a), int(b)
# ans_a = (0.08) / a
# ans_b = (0.1) / b
ans_a = a / 0.08

# ans_b = b /0.1
ans_b = ans_a * 0.1

# print("a", ans_a)
# print("b", ans_b)

if b != int(ans_b):
    print("-1")
print(int(ans_a))
# Judge status: Wrong Answer
n = int(input())
ans = [0 for i in range(n+1)]
for x in range(1, 50):
    for y in range(1, 50):
        for z in range(1, 50):
            tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x
            #print(x, y, z, tmp)
            if 1 <= tmp and tmp <= n+1:
                ans[tmp] += 1
for i in range(1, n+1):
    print(ans[i])
# Judge status: Wrong Answer
X = int(input())
ans = (X // (5 + 6)) * 2
X %= 5 + 6
if X == 0:
    pass
elif X <= 5:
    ans += 1
else:
    ans += 2
print(ans)
# Judge status: Accepted
a,b = map(int, input().split())

cnt = 0
for i in range(a, b+1):
    if str(i)==str(i)[::-1]:
        cnt += 1
print(cnt)
# Judge status: Accepted
N, D = map(int, input().split())
print((N+D*2)//(1+D*2))
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
d = {1:0,2:0,0:0}
for i in l:
    m = i % 4
    if m == 2:
        d[1] += 1
    elif m == 0:
        d[2] += 1
    else:
        d[0] += 1

if d[1] == 0:
    print('Yes' if d[2] + 1 >= d[0] else 'No')
    exit()

print('Yes' if d[2] >= d[0] else 'No')
# Judge status: Accepted
S = input()
s = [ True ] * 26
for i in range(len(S)):
    s[ord(S[i])-97] = False
for i in range(26):
    if s[i]:
        print(chr(i+97))
        exit()
print(None)
# Judge status: Accepted
N=int(input())
dp=[10**9 for i in range(N+1)]
dp[0]=0
for i in range(N+1):
    p=1
    while(p<=i):
        dp[i]=min(dp[i],dp[i-p]+1)
        p*=6
    p=1
    while(p<=i):
        dp[i]=min(dp[i],dp[i-p]+1)
        p*=9

print(dp[-1])
# Judge status: Wrong Answer
import math
x,y = map(int,input().rstrip().split(' '))
n = int(math.log2(y/x))
print(n+1)
# Judge status: Accepted
s=input()

a=s.count('a')
b=s.count('b')
c=s.count('c')

if max([a,b,c])-min([a,b,c])>=2:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
w, h, x, y = map(int, input().split())

judge = (w == 2 * x and h == 2 * y)
s = w * h / 2
print(s, 1 if judge else 0)
# Judge status: Accepted
S = input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Wrong Answer
n,x,y=map(int,input().split())
ans=[0]*n
for i in range(1,n+1):
    for j in range(i+1,n+1):
        a1=abs(i-j)
        a2=abs(x-i)+1+abs(y-j)
        a3=abs(y-i)+1+abs(x-j)
        print(a1,a2,a3)
        d=min(a1,a2,a3)
        ans[d]+=1

for i in range(1,n):
    print(ans[i])
# Judge status: Accepted
n = int(input())
print ("Yes") if n >= 30 else print ("No")
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
bigger_a = 0
bigeer_b = 0
for a, b in zip(A, B):
    if a > b:
        bigger_a += a - b
    if b > a:
        bigeer_b += (b - a) // 2
ans = 'Yes' if bigeer_b >= bigger_a else 'No'
print(ans)
# Judge status: Wrong Answer
h, w = map(int, input().split(" "))

print( h * w // 2 + ( (h * w) % 2 != 0 ) )
# Judge status: Accepted
#dp[i][j]:i日目に活動j:0,1,2:A,B,Cをするときの幸福度の最大値

N = int(input())
abc = [list(map(int,input().split())) for i in range(N)]#abc:012

dp = [[0,0,0] for i in range(0,N,1)]
dp[0] = abc[0]

for i in range(1,N,1):
    for j in range(0,3,1):#012:abc
        dp[i][j] = abc[i][j]+max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])

print(max(dp[N-1]))
# Judge status: Accepted
N, M = map(int, input().split())
if N*2 >= M:
    print(M // 2)
else:
    print(N+((M-2*N)//4))
# Judge status: Accepted
N, K = map(int, input().split())
H = list(map(int, input().split()))

H.sort(reverse=True)

print(sum(H[K:]))
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ans = [0 for i in range(n+1)]
    for i in range(n):
        s = 0
        k = n-i
        for j in range(1,n//k+1):
            s += ans[k*j]
        if s%2!=a[k-1]:
            ans[k] = 1
    print(sum(ans))
    if sum(ans)!=0:
        print(' '.join([str(i) for i , x in enumerate(ans) if x==1]))



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

if K*500 >= X:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = "APPROVED"
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ans = "DENIED"
            break
    else:
        pass
print(ans)
# Judge status: Wrong Answer
# 169A

# 1.入力を受け取ること
# ex:[2 5] -> a=2, b=5 みたいにしないといけない
a, b = map(int, input().split())
print(a)
print(b)
# 2.目的通りの計算をする
# ex：2つの整数AとBの掛け算をやる

answer = a * b

#  3.計算の結果を出力する

print(answer)
# Judge status: Accepted
n,m=map(int,input().split())
A=list(map(int,input().split()))
a=sorted(A)
bc=[]
for _ in range(m):
    x=list(map(int,input().split()))
    bc.append(x)
bc.sort(key=lambda x:x[1],reverse=True)
i=0
j=0
k=0
while a[i]<bc[j][1]:
    a[i]=bc[j][1]
    i+=1
    k+=1
    if bc[j][0]==k:
        j+=1
        k=0
    if i>=n or j>=m:
        break
print(sum(a))
# Judge status: Accepted
s,w=map(int,input().split())
if w>=s:
  print('unsafe')
else:
  print('safe')
# Judge status: Wrong Answer
N = int(input())

for i in range(2, 10):
  if (N%i == 0) & (N/i > 1):
    print('Yes')
    break
else:
  print('No')
# Judge status: Accepted
a, b, c = input()
s = 0
if a == '1':
  s += 1
if b == '1':
  s += 1
if c == '1':
  s += 1
print(s)
# Judge status: Accepted
S = input()
if S[-1] != 's':
	print(S + 's')
else:
	print(S+'es')
# Judge status: Accepted
import re
s, t = input().replace(*"?."), input()
l, m = len(s), len(t)

can = []
for i in range(l - m + 1):
    if re.match(s[i:i+m], t):
        can += (s[:i] + t + s[i+m:]).replace(*".a"),
print(min(can) if can else "UNRESTORABLE")
# Judge status: Accepted
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# library
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------
from collections import deque

S = input().rstrip()
d = deque()

for s in S:
    if s == "B":
        if len(d) > 0:
            d.pop()
    else:
        d.append(s)

print("".join(d))
# Judge status: Wrong Answer
n,c,k,*t=map(int,open(0).read().split())
t=sorted(t)
cnt,ans=0,1
x=t[0]
for i in range(n):
  cnt+=1
  if t[i]-x<k or cnt>c:
    x=t[i]
    ans+=1
    cnt=1
print(ans)
# Judge status: Wrong Answer
from collections import defaultdict
a=defaultdict(list)
n = int(input())
for i in range(n):
    h,m=list(map(int,input().split()))
    a[m].append(h)
t=0
r=0

for i in a:
    for j in a[i]:
        t+=j
    if t>i:
        r=1
        break
if r==1:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
N = int(input())
S = input()
count = [0]
c=0
for i in S:
  if i == "I":
    c += 1
    count.append(c)
  else:
    c -= 1
    count.append(c)
print(max(count))
# Judge status: Accepted
N=int(input())

K=0
for a in range(1,N+1):
    b=1
    while a*b<N:
        K+=1
        b+=1
print(K)
# Judge status: Accepted
N, K = map(int, input().split())
x = N % K
print(min(x, abs(x-K)))
# Judge status: Accepted
from collections import Counter

input()
ans = [0, 0]
for i, j in Counter(map(int, input().split())).items():
    if j >= 4:
        ans.append(i)
    if j >= 2:
        ans.append(i)
ans.sort()
print(ans[-1] * ans[-2])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = [0]*60
mod = 10 ** 9 + 7

for x in A:
  for i in range(60):
    B[i] += (x >> i) & 1

ans = 0
p = 1

for i in range(60):
  if i >= 1:
    p *= 2
    p %= mod
  ans += (N-B[i])*B[i]*p
  ans %= mod

print(ans)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
ans = 0
l = sorted(l)
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if l[i] != l[j] != l[k] != l[i]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)
# Judge status: Accepted
s = input()
t = ["Sunny", "Cloudy", "Rainy", "Sunny"]
print(t[t.index(s)+1])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
d = {}
for ai in a:
  if ai in d:
    d[ai] += 1
  else:
    d[ai] = 1
ans = 0
for ai in d:
  if d[ai] - ai >= 0:
    ans += d[ai] - ai
  else:
    ans += d[ai]
print(ans)
# Judge status: Accepted
n, l = map(int, input().split())
s = sorted([input() for _ in range(n)])
print(*s, sep="")
# Judge status: Accepted
A, B = map(int, input().split())
s = 1
cnt = 0
while s < B:
  s += A-1
  cnt += 1
print(cnt)
# Judge status: Wrong Answer
n = int(input())

mod = 1000000007
a = 1
b = 1
w = 1
for i in range(n):
  a *= 9
  b *= 8
  w *= 10
  a %= mod
  b %= mod
  w %= mod

ex = a * 2 - b
if ex < 0:
  ex += mod
ans = w - ex
if ans < 0:
  ans += mod
print(ans)
# Judge status: Accepted
MAX_B = 100_000
N = int(input())
B = [MAX_B] + list(map(int, input().split())) + [MAX_B]
res = 0
for i in range(N):
    res += min(B[i], B[i + 1])
print(res)
# Judge status: Accepted
n,a,b,c,d=map(int,input().split())

s=input()

if c<d:
    p=s[a:d-1].count("##")
    if p==0:
        print("Yes")
    else:
        print("No")
else:
    p=s[a:c-1].count("##")
    q=s[b-2:d+1].count("...")
    if p==0 and q>0:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
  
N = input()
for i in N:
    if i == '7':
        print('Yes')
        break
        
print('No')
# Judge status: Accepted
H,W = map(int, input().split())
if H==1 or W==1:
  print(1)
else:
  print(-(-(H*W)//2))
# Judge status: Wrong Answer
import math

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

index = A_lis.index(1)
if N == K:
    print(1)
else:
    print(math.ceil(index / (K-1)) + math.ceil((N-index-1 - (index % (K-1))) / (K-1)))
# Judge status: Wrong Answer
K = int(input())
data = []
C = 0
num = 0
def runrun(a):
	if len(str(a)) == 1:
		return True
	else:
		for i in range(len(str(a))-1):
			difference_digit = int(str(a)[i+1])-int(str(a)[i])
			if difference_digit**2 <= 1:
				return True
while C < K:
	num += 1
	if runrun(num):
		data.append(num)
		C += 1
print(data)
# Judge status: Accepted
n = int(input())
h = [] #happiness
for i in range(n):
 a_input, b_input, c_input = map(int, input().split())
 h.append([a_input, b_input, c_input]) 
dp = [[0 for _ in range(3)] for _ in range(n+1)]
for i in range(1, n+1):
 for j in range(3):
   for k in range(3):
     if j != k and dp[i][j] < dp[i-1][k] + h[i-1][j]:
       dp[i][j] = dp[i-1][k] + h[i-1][j]
ans = 0
for j in range(3):
 if ans < dp[n][j]:
   ans = dp[n][j]
print(ans)
# Judge status: Wrong Answer
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7


s = input()
if s[:2] == '00' or s[2:] == '00':
    print('NA')
    exit()
    
a = (1 <= int(s[:2]) <= 12)
b = (1 <= int(s[2:]) <= 12)

if a and b:
    print('AMBIGUOUS')
elif a and (not b):
    print('MMYY')
elif (not a) and b:
    print('YYMM') 
else:
    print('NA')
# Judge status: Accepted
n = int(input())

t = 0
    
while t*111 < n  and n > (t+1)*111:
    t += 1
    
print((t+1)*111)
# Judge status: Accepted
s = str(input())
ans = 0
for i in range(len(s)//2 - 1, 0, -1):
  s1, s2 = s[:i], s[i:2*i]
  #print(i, s1, s2)
  if s1 == s2:
    ans = 2*i
    break
print(ans)
# Judge status: Accepted
a, b = map(int,input().split())

if a * b % 2:
    print('Odd')
else:
    print('Even')
# Judge status: Accepted
import math
a,b,c = map(int, input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
rain_max = 0
local_max = 0
for i in range(len(s)):
    if s[i] == 'R':
        local_max += 1
    else:
        if local_max > rain_max:
            rain_max = local_max
        local_max = 0
if local_max > rain_max:
    rain_max = local_max
print(rain_max)
# Judge status: Accepted
N, X = map(int,input().split())
lst = list(map(int,input().split()))

cnt = 1
now = 0
for i in range(N):
    l = now + lst[i]
    if l > X:
        break
    else:
        cnt += 1
        now = l
    

print(cnt)
# Judge status: Accepted
import sys

n = int(sys.stdin.readline().rstrip())
a = [int(x) for x in sys.stdin.readline().rstrip().split()]

a_set = set()
counter_wild = 0
for x in a:
    if x>=3200:
        counter_wild+=1
    else:
        a_set.add(x//400)
print(max(1,len(a_set)),len(a_set)+counter_wild)
# Judge status: Accepted
N,M=map(int, input().split())
N_str = []
M_str = []
for i in range(N):
  n=str(input())
  N_str.append(n)
for i in range(M):
  m=str(input())
  M_str.append(m)

equal = False
  
for i in range(N-M+1):
  for k in range(N-M+1):
    each_equal = True
    for l in range(M):
      each_equal = each_equal and (N_str[i+l][k:k+M] == M_str[l])
    equal = equal or each_equal

print(["No","Yes"][equal])
# Judge status: Accepted
n = int(input())
a = [int(input()) for i in range(n)]

from collections import deque
import bisect

d = deque()
for i in range(n):
    idx = bisect.bisect_left(d, a[i])
    if idx == 0:
        d.appendleft(a[i])
    else:
        d[idx-1] = a[i]

print(len(d))
# Judge status: Accepted
N = int(input())
High = list(map(int, input().split()))
ans = 0
num = -1
now = float('inf')
for i in High:
    if now >= i:
        num += 1
        now = i
    else:
        ans = max(ans, num)
        num = 0
        now = i
ans = max(ans, num)
print(ans)
# Judge status: Accepted
n = int(input())
a = ord('A')
s = [chr((ord(c) - a + n) % 26 + a) for c in input()]
print(''.join(s))
# Judge status: Wrong Answer
a = [int(j) for i in range(3) for j in input().split(' ')]
n = int(input())
nn = [int(input()) for i in range(n)]

for ni in nn:
  if ni in a:
    a[a.index(ni)] = 0

    
judge = "Yes"
if a[4]!=0 and a[2]!=0 and a[6]!=0:
  judge = "No"

if a[4]!=0 and a[0]!=0 and a[8]!=0:
  judge = "No"

print(judge)
# Judge status: Accepted
n, a, b = map(int, input().split())
if a > b:
    ans = 0
elif n == 1 and a == b:
    ans = 1
elif n == 1:
    ans = 0
elif a == b:
    ans = 1
else:
    maxVal = a * 1 + b * (n-1)
    minVal = a * (n-1) + b * 1
    ans = maxVal - minVal + 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
T, H = map(int, input().split())
A = list(map(lambda x: abs(T - (12 - int(x) * 0.006)), input().split()))

print(A.index(min(A)) + 1)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B = map(int, input().split())
    T = [i for i in range(1, 1000)]
    print(sum(T[:B - A]) - B)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
x, a, b = map(int, input().split())
if b < a:
    print('delicious')
elif b - a <= x:
    print('safe')
else:
    print('dangerous')
# Judge status: Wrong Answer
import numpy as np
N = int(input())
A = list(map(int, input().split()))
ans = np.prod(A)
if ans > 10**18:
    ans = -1  
print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
print("Possible") if (a%3==0)|(b%3==0)|((a+b)%3==0) else print("Impossible")
# Judge status: Wrong Answer
x,n=map(int,input().split())
if n==0:
    print(x)
    exit()
elif n==100:
    print(-1)
    exit()
List=list(map(int,input().split()))
num=list(range(1,101))
min_num=0
for i in range(len(List)):
    if num.count(List[i])>=1:
        num.remove(List[i])
for i in range(len(num)):
    if abs(num[i]-x)<abs(min_num-x):
        min_num=num[i]
print(min_num)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=1000
for i in range(1,n):
    if a[i]>a[i-1]:
        ans += (a[i]-a[i-1])*(ans//a[i-1])
        print(ans)
print(ans)
# Judge status: Accepted
import math
A, B, H, M = map(int, input().split())
K = H * 60 + M
L = K / 2 - M * 6
S = A**2 + B**2 - 2*A*B*math.cos(math.radians(L))
T = S**0.5
print(T)
# Judge status: Accepted
import math

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

lefGcd = [0]*100100
rigGcd = [0]*100100

lefGcd[0] = a[0]
rigGcd[n-1] = a[n-1]

for i in range(1,n):
	lefGcd[i] = math.gcd(lefGcd[i-1],a[i])

for i in reversed(range(0,n-1)):
	rigGcd[i] = math.gcd(rigGcd[i+1],a[i])

ans = max(rigGcd[1],lefGcd[n-2])

for i in range(1,n-1):
	ans = max(ans,math.gcd(lefGcd[i-1],rigGcd[i+1]))

print(ans)
# Judge status: Accepted
a1, a2, a3 = map(int, input().split())
if a1 + a2 + a3 >= 22:
    print('bust')
else:
    print('win')
# Judge status: Accepted
import sys
n = int(input())
pre = input()
suf = input()
if pre==suf:
    print(n)
    sys.exit()
slicer, ans = n-1 , n*2
for xx in range(n+1):
    if suf[:slicer] in pre:
        ans = len(pre)+(len(suf)-len(suf[:slicer]))
        break
    slicer-=1
print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())

d = min(A-B, C)
print(C-d)
# Judge status: Wrong Answer
n,a,b  =map(int,input().split())
se = a+b
br = 0
cnt = 0
if a == 0:
    print(0)
elif b == 0:
    print(n)
else:
    cnt = n//(a+b)
    if cnt == 0:
        print(a)
    else:
        res = a*cnt
        n -= (a+b)*cnt
        res += n
        print(res)
# Judge status: Accepted
n,m = map(int,input().split())
ac = [0]*n
wa = [0]*n
count_ac = 0
count_wa = 0

for i in range(m):
    p,s = input().split()
    p = int(p)
    if ac[p-1]:
        continue
    
    if s == "WA":
        wa[p-1] += 1
    else:
        ac[p-1] = True
        count_ac += 1
        count_wa += wa[p-1]
        
print(count_ac,count_wa)
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0
for i in range(n - 1):
    m = a[i] // 2
    ans += m
    if a[i] % 2 == 1:
        if a[i + 1] > 0:
            ans += 1
            a[i + 1] -= 1
ans += a[n - 1] // 2
print(ans)
# Judge status: Accepted
def solve():
    n = int(input())
    a = list(map(int,input().split()))
    direction = 0 # 0なら未定　－１なら減少，１なら増加
    cnt = 1
    for i in range(1,n):
        if (a[i]-a[i-1])*direction<0:
            cnt+=1
            direction = 0
        else:
            if direction==0:
                direction = a[i]-a[i-1]
    print(cnt)
if __name__ == "__main__":
    solve()
# Judge status: Accepted
N = int(input())
A = list(map(str, input().split()))

B = A[::2][::-1] + A[1::2]
if N % 2 == 0:
    B = B[::-1]
print(' '.join(B))
# Judge status: Wrong Answer
n, k = map(int, input().split())
s = [0]*(n+1)

for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        s[a[0]] += 1
        
s[0] += 1
print(s.count(0))
# Judge status: Wrong Answer
w = list(input())
W = list(set(w))
cnt = [0]*len(W)

for i in w:
    cnt[W.index(i)] += 1

for i in cnt:
    if i%2!=0:
        print('NO')
        exit()
print('YES')
# Judge status: Wrong Answer
N=int(input())
for i in range(N):
  count=0
  k=i//5+1
  for x in range(k):
    if(x==0):
      continue
    for y in range(k):
      if(y==0):
        continue
      for z in range(k):
        if(z==0):
          continue
        if((x+y)**2+(y+z)**2+(z+x)**2)//2==i:
          #print(x,y,z)
          count+=1
  print(count)
# Judge status: Wrong Answer
h,a=map(int,input().split())
n=h/a
ans=int(n)+1
print(ans)
# Judge status: Accepted
print(":("if max(map(int,input().split()))>8 else "Yay!")
# Judge status: Accepted
n=int(input())
l=[0 for _ in range(n)]

for i in range(n-1):
  c,s,f=map(int,input().split())
  l[i]=s+c
  for j in range(i):
    l[j]=max(s,((l[j]-1)//f+1)*f)+c  
for m in l:
  print(m)
# Judge status: Wrong Answer

N=int(input())
numbers=list(map(int,input().split()))

if len(numbers)==1:
  print(1)
  exit()
counter=0
counter_2=0

for i in range(1000000000):

  if numbers.count(i)==i:
    counter_2+=i
  elif numbers.count(i) != i:
    if numbers.count(i) > i:
      counter+=(numbers.count(i)-i)
    else:
      counter+=numbers.count(i)
    
    counter_2+=numbers.count(i)
  if counter_2==len(numbers):
    break
    
print(counter)
# Judge status: Wrong Answer
n = int(input()) - 1

j = 0

ans = 0

for i in range(1, n // 2):
    
    j = i
    
    while True:
        j += 1
        if i * j > n:
            break
        ans += 1

k = 1

er = 0

while True:
    if k ** 2 > n:
        break
    er += 1
    k += 1

print((ans * 2) + er)
# Judge status: Accepted
x = list(map(int,input().split()))

ans = 0
for i in range(5):
    if x[i]==0:
        ans = i+1
        
print(ans)
# Judge status: Wrong Answer
x,y=map(int,input().split())
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
C=[2]
i=A or B or C
if x in i and y in i:print('Yes')
else:print('No')
# Judge status: Accepted
s = input()
if s.count('7') > 0:
    print('Yes')
else:
    print('No')