peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

def check(l):
    count = 0
    for L in A:
        count += L // l
        if L % l != 0:
            count += 1
        count -= 1
    return count <= K

bottom, top = 0, max(A)

while top - bottom > 1:
    mid = (top + bottom) // 2
    if check(mid):
        top = mid
    else:
        bottom = mid

print(top)
# Judge status: Wrong Answer
n,m=map(int, input().split())
a=list()
for i in range(m):
    a.append(int(input()))

mod=10e9+7

inf=float('inf')

dp=[inf]*(n+1)
dp[0]=1
dp[1]=1

for i in a:
    dp[i]=0

for i in range(2,n+1):
    dp[i] = min(dp[i], dp[i-1]+dp[i-2]) % mod

print(int(dp[-1]))
# Judge status: Accepted
o = list(input())
e = list(input()) + ['']
 
for i,j in zip(o,e):
  print(i,j,sep='',end='')
# Judge status: Accepted
import math
def is_prime(n):
  if n == 1:
    return False
  for p in range(2, int(math.sqrt(n))+1):
    if n%p == 0:
      return False
  return True
m = int(input())
while m > 0:
  if is_prime(m) == True:
    print(m)
    break
  m += 1
# Judge status: Accepted
s=int(input())
x=[]
for i in range(1000000):
  if len(list(set(x)))!=len(x):
    print(len(x))
    break
  elif s%2==0:
  	x.append(s)
  	s=int(s/2)
  else:
  	x.append(s)
  	s=3*s+1
# Judge status: Wrong Answer
n=int(input())
s = input()
ans = 0
for i in range(n-1):
    if s[i: i + 2] == "#.":
        ans += 1
print(ans)
# Judge status: Wrong Answer

items_number, tickets_number = map(int, input().split())
item_prices = list(map(int, input().split()))
sorted_items = list(reversed(sorted(item_prices)))

for i in range(tickets_number):
  index = 0
  discount_item = sorted_items[0] // 2
  for i in range(items_number - index):
    if discount_item < sorted_items[index]:
      break
    index += 1

  # max_item_price_index = item_prices.index(max(item_prices))
  # discounted_price = item_prices[max_item_price_index] // 2
  # item_prices[max_item_price_index] = discounted_price

print(sum(item_prices))
# Judge status: Wrong Answer
# DISCO presents ディスカバリーチャンネル コードコンテスト2020 予選
# B - Iron Bar Cutting

import bisect

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

l=sum(A)//2
m=sum(A)%2

aA=[0]
for i in range (N):
    aA.append(A[i]+aA[-1])

t=bisect.bisect_left(aA,l)


print(abs(aA[t]-l)+m)
# Judge status: Accepted
S = input()

ans = 99999
for i in range(len(S)-2):
    ans = min(ans, abs(int(S[i:i+3]) - 753))
    
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())

if a*b%2 == 0:
  print("Even")
else:
  print("Odd")
# Judge status: Wrong Answer
N = int(input())

def prime(n):
    p_n = []
    for i in range(2,int(n ** (1/2))):
        while n % i == 0:
            p_n.append(i)
            n /= i
    if n != 1:
        p_n.append(int(n))
    return p_n

queue = prime(N)
queue.sort(reverse=True)
while len(queue) > 2:
    a,b = queue.pop(),queue.pop()
    queue.append(a*b)
    queue.sort(reverse=True)

if len(queue) == 1:
    print(sum(queue)-1)
else:
    print(sum(queue)-2)
# Judge status: Wrong Answer
a=int(input())
count=0
s=1
while True:
  if a>1:
    a//=int(2)
    count+=1
    s+=2**count
  else:
    s+=2**count
    print(s)
    break
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for i in range(n)]
ans = 0
for i in range(n):
  for j in range(i-1,0):
    for k in range(i+1,n):
      ans1 = max(a[j],a[k])
      ans = max(0,ans1)
      print(ans)
b=0
for i in range(n-1):
  b = max(a[i],a[i+1])
  ans2 = max(b,0)
print(b)
# Judge status: Accepted
s = input()
t = input()
print('Yes' if s==t[:-1] else 'No')
# Judge status: Accepted
def is_palindrome(s):
  if s == s[::-1]:
    return True
  else:
    return False
  
s = input()
if is_palindrome(s) and is_palindrome(s[:len(s)//2]) and is_palindrome(s[len(s)//2+1:]):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dif = sum(b) - sum(a)

numa, numb = 0, 0
for i in range(n):
    if a[i] > b[i]:
        numb += a[i] - b[i]
    elif a[i] < b[i]:
        numa += (b[i] - a[i] + 1) // 2

if numa <= dif and numb <= dif:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
T = input()

if S == T[:-1]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])
# Judge status: Accepted
import numpy as np
n, x = map(int, input().split())
city = np.array(list(map(int, input().split())))
w = abs(city - x)


def gcd(x, y):
    if x == 0:
        return y
    else:
        return gcd(y % x, x)


ans = w[0]
for i in w[1:]:
    ans = gcd(ans, i)

print(ans)
# Judge status: Wrong Answer
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

s = input()

for i in range(len(s)-1):
    s = s[:-1]
    if (i%2==0):
        pass
    else:
        #print(s)
        if s[0:len(s)//2] == s[len(s)//2:]:
            print(len(s))
# Judge status: Wrong Answer
X,Y = list(map(int,input().split()))

if X==Y:
    print(0)
if X<Y:
    if X<0 and Y>0:
        print(1+abs(Y+X))
    else:
        print(Y-X)

if X>Y:
    if X>=0 and Y<0:
        print(1+abs(X+Y))
    elif X>0 and Y>0:
        print(2+X-Y)
    elif X<0 and Y<0:
        print(2+X-Y)
    else:
        print(X-Y)
# Judge status: Accepted
x = map(int, input().split())

for i, xi in enumerate(x):
    if xi == 0:
        print(i + 1)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
import collections
a = collections.Counter(a)
ans = 0
for i,j in a.items():
    if abs(i-j)>j:
        ans += j
    else:
        ans += abs(i-j)
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = 0
for i in range(1, n + 1):
    ans += a[i * 2 - 1]
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
Ss = input().rstrip()

num = Ss.count('LR') + Ss.count('RL')
num -= 2*K
if num < 0:
    num = 0

ans = N - (num+1)
print(ans)
# Judge status: Accepted
import sys
S = input()
for i in range(0, len(S), +2):
    if S[i] == "L":
        print("No")
        sys.exit()    
if len(S) == 1:
    print("Yes")
    sys.exit()
for i in range(1, len(S), +2):
    if S[i] == "R":
        print("No")
        sys.exit()
print("Yes")
# Judge status: Accepted
a = [0]*(5)
for l in range(5):
    a[l] = str(input())
ls = [a[0],a[1],a[2],a[3],a[4]]
new = [0]*(5)
s = 0
for i in range(5):
    new[i] = int(a[i][-1])
for p in ls:
    if int(p) % 10 ==0:
        s += int(p)
    else:
        s += ((int(p)//10) + 1) *10
if sum(new) !=0:
    ans = min([e for e in new if e !=0])
    print(s-10+ans)
else:
    print(s)
# Judge status: Accepted
from bisect import bisect_right, bisect_left


n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
print(sum(bisect_left(a, i) * (n - bisect_right(c, i)) for i in b))
# Judge status: Accepted
def check(x):
  if len(str(x))!=N:
    return False
  for i in range(M):
    if str(x)[S[i]]!=str(C[i]):
      return False
  return True

N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  s-=1
  S.append(s)
  C.append(c)
#print(S,C)
for i in range(1000):
  if check(i):
    print(i)
    exit()   
print(-1)
# Judge status: Wrong Answer
#abc099 a
n=int(input())
ans=""
if n>=1000:
    ans="ABD"
    n-=999
else:
    ans="ABC"
s=[0]*3
s[0]=n//100
s[1]=(n//10)%10
s[2]=n%10
print(ans+str(s[0])+str(s[1])+str(s[2]))
# Judge status: Wrong Answer
h,n = map(int,input().split())
alist = list(map(int,input().split()))
while n >0:
    n -= 1
    h = h-alist[n]
if h <=0:
    print('YES') 
else:
    print('NO')
# Judge status: Accepted
N = int(input())
lis = [list(map(int, input().split())) for _ in range(N)]
dp = [[0]*3 for _ in range(N+1)]
for k in range(3):
    dp[1][k] = lis[0][k]
for i in range(2, N+1):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + lis[i-1][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + lis[i-1][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + lis[i-1][2]
print(max(dp[N]))
# Judge status: Accepted
n = int(input())
s = [int(input()) for  _ in range(n)]
ans = sum(s)
s.sort()
if ans%10 != 0:
    print(ans)
else:
    t = []
    for i in range(n):
        if s[i]%10 != 0:
            t.append(s[i])
    if len(t) == 0:
        print(0)
    else:
        print(ans-t[0])
# Judge status: Wrong Answer
N,A,B = list(map(int,input().split()))
ans = A*N//(A+B)
if N%(A+B)>=A:
    ans+=A
else: ans+=N%(A+B)
print(ans)
# Judge status: Accepted
N,R = map(int,input().split())

if N >= 10:
    print(R)
else:
    print(R + 100*(10-N))
# Judge status: Wrong Answer
r = int(input())
print(int(r*2))
# Judge status: Wrong Answer
x = int(input())
print("Christmas" + "Eve" * (25 - x))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
min_cost = 10**18
for i in range(min(A),max(A)+1):
    cost = 0
    for e in A:
        cost += (e-i)**2
    if cost < min_cost:
        min_cost = cost
print(min_cost)
# Judge status: Wrong Answer
a,b,c=map(int,input().split());print('YNEOS'[a+c==2*b::2])
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
curr=a[0]
ans=0
for i in range(n):
    if a[i]<curr:
        ans+=(curr-a[i])
    else:
        curr=max(curr, a[i])
print(ans)
# Judge status: Accepted
n=int(input())
x=n*800
y=200*(n//15)
print(x-y)
# Judge status: Accepted
import numpy as np
n = int(input())
a = np.array([int(x)-i-1 for x, i in zip(input().split(), range(n))])
ans = np.sum(np.abs(a-int(np.median(a))))
print(ans)
# Judge status: Accepted
k,s = map(int,input().split())
count = 0
for i in range(k+1):
    for j in range(k+1):
        if 0 <= s-(i+j) <=k:
            count += 1
print(count)
# Judge status: Wrong Answer
MOD = 10 ** 9 + 7

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print(0)
    exit()

a = (2 * X +   - Y) // 3
b = (  - Y + 2 * X) // 3

if a < 0 or b < 0:
    print(0)
    exit()

#calculate (a+b)!/a!b!

fac = [1, 1]
for i in range(2, a+b+1):
    fac.append(fac[-1] * i % MOD)

print(fac[a+b] * pow(fac[a] * fac[b], MOD-2, MOD) % MOD)
# Judge status: Wrong Answer
import random
name = list(input())
print(name[random.randint(0,len(name)-1)],end="")
print(name[random.randint(0,len(name)-1)],end="")
print(name[random.randint(0,len(name)-1)])
# Judge status: Wrong Answer
import math
n = int(input())

if n%2 == 0:
  print(n/2)
else:
  print(math.ceil(n/2))
# Judge status: Accepted
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
d=Counter(A)
ans=0
for i in d:
  if d[i]>=i:
    ans+=d[i]-i
  else:
    ans+=d[i]
print(ans)
# Judge status: Wrong Answer
N = int(input())
an = list(map(int, input().split()))

cost = 10000*3
ans = 10000*3
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a%3!=0 and b%3!=0 and (a+b)%3!=0:
  print('Impossible')
else:
  print('Posible')
# Judge status: Accepted
a,b,c = map(int,input().split())

if (a-b)<=c:
    print(c-(a-b))
else:
    print(0)
# Judge status: Accepted
n = int(input())
sm = 0
for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        sm += 1
        
print(sm)
# Judge status: Wrong Answer
n = int(input())

for i in range(n+1):
	if i * i > n:
		print((i-1) * (i-1))
		exit()
# Judge status: Accepted
K, A, B = (int(_) for _ in input().split())
ret = K + 1
if B - A - 2 > 0:
  c = max((K - A - 1)//2 + 1, 0)
  ret += c * (B - A - 2)
print(ret)
# Judge status: Accepted
import collections

n = int(input());
A = list(map(int, input().split()));

ans = [0] * n;

c = collections.Counter(A)
key = list(c.keys());
value = list(c.values());

for i in range(len(key)):
    ans[key[i]-1] = value[i];
  
for a in ans:
  print(a);
# Judge status: Accepted
mod = 10**9 + 7
  
n = int(input())
dp = [0]*(n+1)
dp[0] = 1

if n >= 3:
  for i in range(3,n+1):
    dp[i] = dp[i-1] + dp[i-3]

print(dp[n] % mod)
# Judge status: Accepted
s = input()
a = len(s)//2
if s == "hi"*a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
dic={}
n=int(input())
su=0
for i in input().split():
    i=int(i)
    if i in dic.keys():
        dic[i]+=1
    else:
        dic[i]=1
    su+=i
q=int(input())
for cas in range(q):
    b,c=map(int,input().split())
    if b in dic.keys():
        su+=(c-b)*dic[b]
        if c in dic.keys():
            dic[c]+=dic[b]
        else:
            dic[c]=dic[b]
        dic[b]=0
    print(su)
# Judge status: Wrong Answer
n = int(input())
lis = []
lis2 = {}
lis3 = []
for _ in range(n):
  lis.append(input())

for w in lis:
  if w not in lis2.keys():
    lis2[w] = 1
  else:
    lis2[w] += 1

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

for a in range(len(sort_lis2)):
  if a == 0:
    lis3.append(sort_lis2[0][0])
  else:
    if sort_lis2[0][1] == sort_lis2[a][1]:
      lis3.append(sort_lis2[a][0])

for b in lis3:
  print(b)
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if p[i] == i+1:
        if i != N-1:
            temp = p[i]
            p[i] = p[i+1]
            p[i+1] = temp
            cnt += 1
        else:
            cnt += 1
print(cnt)
# Judge status: Accepted
p = int(input())
n = 2*p
primes = set(range(2, n+1))
for i in range(2, int(n**0.5+1)):
    primes.difference_update(range(i*2, n+1, i))
primes=list(primes)
primes.sort()

for i in primes:
    if i >= p:
        print(i)
        break
# Judge status: Accepted
n, m = map(int, input().split())


if n == m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def cooking_takoyaki(target_num, cook_per, need_time):
    div, mod =divmod(target_num, cook_per)
    if mod == 0:
        return div * need_time
    return div * need_time + need_time

if __name__=='__main__':
    a, b, c = map(int, input().split())
    print(cooking_takoyaki(a, b, c))
# Judge status: Accepted
s = input()
na = s.count('a')
nb = s.count('b')
nc = s.count('c')
lst = [na, nb, nc]
lst.sort()

n1,n2,n3 = lst[0], lst[1], lst[2]
if n1+n2 >= (n3-1)*2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
a,b,c,k = map(int,input().split())
inf = 10**18
ans = a-b
if k%2:ans = -ans
if ans < -inf or ans > inf:print('Unfair')
print(ans)
# Judge status: Accepted
c1 = input()
c2 = input()
if c1[::-1]==c2:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
def solve(string):
    n = int(string)

    def f(n):
        return n * (n + 1) // 2

    return str(f(n) - 3 * f(n // 3) - 5 * f(n // 5) + 15 * f(n // 15))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# Judge status: Accepted
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))
B=[A[i] for i in range(N)]
cnt=0

for i in range(N):
    if A[i]<0:
        cnt+=1
        B[i]=-B[i]

if cnt%2==0:
    ans=sum(B)
else:
    ans=sum(B)-2*min(B)

print(ans)
# Judge status: Accepted
X = int(input())

if X >= 30:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
#!/usr/bin/env python3

N, A, B = map(int, input().split())

if A == 0:
    print(0)
elif B == 0:
    print(N)
elif A + B == N or A + B > N and N >= A:
    print(A)
elif A + B > N and N < A:
    print(N)
else:
    r = int(N / (A+B))
    q = N % (A+B)
    print(r * A + q)

# -----
# 8 4 2
# bbbbrrbb bb

# 13 4 2
# bbbb rr bbbb rr b

# 2 4 2
# bb

# r = N / (A+B)
# q = N % (A+B)
# r * A + q
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
e = b - a
ans = c - e
print(ans if ans > 0 else "0")
# Judge status: Accepted
s = input()

for i in range(2**len(s)-1):
  f = s[0]
  for j in range(len(s)-1):
    if (i>>j)&1:
      f += "+"
    else:
      f += "-"
    f += s[j+1]
  ans = eval(f)
  
  if ans == 7:
    break

print(f+'=7')
# Judge status: Wrong Answer
r, g, b = map(int, input().split())
print("Yes" if r*g*b % 4 == 0 else "No")
# Judge status: Accepted
X = int(input())


if 400 <= X <= 599:
    print(8)
elif 600 <= X <= 799:
    print(7)
elif 800 <= X <= 999:
    print(6)
elif 1000 <= X <= 1199:
    print(5)
elif 1200 <= X <= 1399:
    print(4)
elif 1400 <= X <= 1599:
    print(3)
elif 1600 <= X <= 1799:
    print(2)     
elif 1800 <= X <= 1999:
    print(1)
# Judge status: Wrong Answer
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
D=list(map(int,input().split()))
Dc = collections.Counter(D)
count=1
if D[0] !=0 or( D[0]==0 and Dc[0]>1):
    print(0)
else:
    for i in range(1,max(Dc.keys())+1):
        count *=pow(Dc[i-1],Dc[i])
    print(count)
# Judge status: Wrong Answer
s,c=map(int,input().split())
if s > c*2:
   print(c//2)
   exit()
else:
   c-=s*2
s+=c//4
print(s)
# Judge status: Accepted
A,B = map(int,input().split())
def gcd(a, b):
	if b==0:
		return a
	return gcd(b, a%b)
print(A*B//gcd(A,B))
# Judge status: Wrong Answer
n =(int)(input())
ans=0
for i in range(n):
  for j in range(n):
    if i**j <= n:
      ans=i**j
print(ans)
# Judge status: Accepted
import collections
S = input()

table = collections.defaultdict(int)
for x in S:
    table[x] += 1

N = False
W = False
E = False
S = False

if table["N"] > 0:
    N = True
if table["W"] > 0:
    W = True
if table["E"] > 0:
    E = True
if table["S"] > 0:
    S = True


if (N and S) or ((N or S) == False):
    if (E and W) or ((E or W) == False):
        print("Yes")
        exit(0)
print("No")
# Judge status: Accepted
a,b=map(int,input().split())
print(max(a+a-1,a+b,b+b-1))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
money=1000
buy=0
for i in range(N-1):
    if A[i]<=A[i+1]:
        buy=money//A[i]
        money=A[i+1]*buy+money%A[i]
print(money)
# Judge status: Accepted
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a,b,c = map(int,input().split())
print((a-c)//(b+c))
# Judge status: Accepted
n = int(input())
t = 0
x = 0
y = 0
flag = True
for i in range(n):
    ti, xi, yi = map(int, input().split())
    if ti % 2 != (xi + yi) % 2:
        flag = False
    elif abs(xi - x) + abs(yi - y) > ti - t:
        flag = False
    t, x, y = ti, xi, yi
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = input()
sum = 0
for i in n:
    sum += int(i)
print(sum % 9 == 0)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
min = N + 1
count = 0
for i in range(N):
  if A[-i] < min:
    min = A[-i]
    count += 1

if min != 1:
  result = -1
else:
  result = N - count
print(result)
# Judge status: Wrong Answer
N = int(input())
S = input()
for i in range(len(S)):
  moji = S[i]
  symbol = ord(moji)
  if symbol+N > 90:
    S = S.replace(moji, chr(60+N-(90-symbol)))
  else:
    S = S.replace(moji, chr(symbol+N))
print(S)
# Judge status: Accepted
#!/usr/bin/env python3
n, a, b = map(int, input().split())
c = 0
for i in range(1, n + 1):
    if a <= sum(int(i) for i in str(i)) <= b:
        c += i
print(c)
# Judge status: Accepted
H = int(input())
from math import log, floor

N = floor(log(H)/log(2)) + 1
print(2**N-1)
# Judge status: Accepted
W,a,b=map(int,input().split())
ans1=0
ans2=0
if b>(a+W):
  ans1=b-(a+W)
if a>(b+W):
  ans2=a-(b+W)
ans=max(ans1,ans2)
print(ans)
# Judge status: Wrong Answer
import collections
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = collections.Counter(a)
ans = 0
num_keys = len(b.keys())

if num_keys > k:
    b = sorted(b.items(),key=lambda x:x[1])
    for i in range(len(b)):
        ans += b[i][1]
        num_keys -= b[i][1]
        if num_keys <= k:
            break
            
print(ans)
# Judge status: Wrong Answer
X,K,D = map(int,input().split())
X = abs(X)
s = X//D
if s == K:
    print(X%D)
elif s > K:
    print(abs(X-D*K))
elif s % 2 == 0:
    print(X%D)
else:
    print(abs(X%D-D))
# Judge status: Accepted
k,s=map(int,input().split())
ans=0
for i in range(k+1):
    for j in range(k+1):
        if  s>=i+j and s-i-j<=k:
            ans+=1
print(ans)
# Judge status: Accepted
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,a,b = map(int, input().split())
if (b-a)%2==0:
    ans = (b-a)//2
else:
    m = b-1
    M = n-a
    m1 = (n-b) + 1 + (b-a-1)//2
    m2 = (a-1) + 1 + (b-a-1)//2
    ans = min(m,M, m1, m2)
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	S = inputStr()
	print(S[:3])


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
# Judge status: Accepted
import collections

s=list(input())

c = collections.Counter(s)

score_sorted = sorted(c.items(), key=lambda x:-x[1])

val = []

for i, j in score_sorted:
    val.append(j)

if len(val) == 2:
    val.append(0)
elif len(val) == 1:
    val.append(0)
    val.append(0)
    
val.sort()

if 0<= val[2]-val[0] <=1:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = []
for i in range(n):
    for j in range(i+1, n):
        a = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans.append(a)
ans = [str(l) for l in ans]
print(type(ans))

for k in range(1, n):
    finalans=ans.count(str(k))
    print(finalans)
# Judge status: Wrong Answer
a,b = list(map(int,input().split(" ")))
s = input()
postal_code_len = a+b+1

num_list = list(map(str, range(0,10)))

flag = True
print([c in num_list for c in list(s[:a]+s[a+1:]) ])
if s[a] == "-" and all([ c in num_list for c in list(s[:a]+s[a+1:]) ]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    a, b, c = map(int, input().split())
    bc = b+c
    if a <= bc:
        print(bc-a)
    else:
        print(0)

main()
# Judge status: Accepted
n,l=map(int,input().split())
s=[]
for i in range(n):
    s.append(input())
s=sorted(s)
x=''.join(s)
print(x)
# Judge status: Accepted
d = int(input())
if d == 22:
  print('Christmas Eve Eve Eve')
elif d == 23:
  print('Christmas Eve Eve')
elif d == 24:
  print('Christmas Eve')
else:
  print('Christmas')
# Judge status: Accepted
s = input()
k = int(input())
cnt = 0
for i in range(len(s)):
    if s[i] == '1':
        cnt += 1
    else:
        print(s[i])
        exit()
    if cnt >= k:
        print(s[i])
        exit()
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
d = int(b-a)
e = int(c-a)
if d < 0:
  d = -d

if e < 0:
  c = -c

if d > e:
  print("B")
else:
  print("A")
# Judge status: Accepted
X = int(input())
K = 0
while ((X * K) % 360 != 0) or (K == 0):
  K += 1
print(K)
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int,input().split())
W = tx - sx
H = ty - sy

r1 = 'R'*W + 'U'*H + 'H'*W + 'D'*H
r2 = 'D' + 'R'*(W+1) + 'U'*(H+1) + 'L' + 'U' + 'L'*(W+1) + 'D'*(H+1) +'R'
print(r1+r2)
# Judge status: Accepted
N, M = map(int, input().split())
a = []
b = []
for i in range(N):
    a.append(input())
c = 0
ans = "No"
for i in range(M):
    b.append(input())
for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            if a[i+k][j:j+M] == b[k]:
                c += 1
        if c == M:
            ans = "Yes"
            break
        c = 0
print(ans)