Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
from collections import deque
import math

def main():
    x,y=map(int,input().split())
    MOD=10**9+7
    if (x+y)%3!=0:
        print(0)
    else:
        n=int((x+y)/3)
        k=int((2*x-y)/3)
    a,b=1,1
    for i in range(k):
        a=(a*(n-i))%MOD
        b=(b*(1+i))%MOD
    ans=(a*pow(b,MOD-2,MOD))%MOD
    print(int(ans))

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque
import math

def main():
    def pre(n,MOD):
        a=1
        for i in range(1,n+1):
            a=(a*i)%MOD
        an=a
        b=pow(a,MOD-2,MOD)
        bs=[1]*(n+1)
        bs[n]=b
        for i in range(n,1,-1):
            b=b*i%MOD
            bs[i-1]=b
        return an,bs
    
    x,y=map(int,input().split())
    d=(x+y)//3
    MOD=10**9+7
    if (x+y)%3!=0 or x<d or y<d:
        print(0)
    else:
        a,b=pre(d,MOD)
        a=a*b[y-d]*b[2*d-y]%MOD
        print(a)

if __name__ == '__main__':
    main()
a, b =map(int, input()split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")


### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
if __name__ == "__main__":
    n = int(input())
    l_a = list(map(int, input().split()))
    s_a = list(set(l_a))

    s_a.sort()

    dub_a = [0]*(max(s_a)+1)

    for i in l_a:
        dub_a[i] += 1

    dp = [1]*(max(s_a)+1)

    for i in s_a:
        if 2*i > len(dp)-1:
            pass
        elif dp[2*i] == 0:
            pass
        else:
            for j in range(2*i, len(dp)+1, i):
                dp[j] = 0


    count = 0
    for i in s_a:
        if dp[i]==1 and dub_a[i]==1:
            count += 1
    print(count)

### FIXED CODE ###

if __name__ == "__main__":
    n = int(input())
    l_a = list(map(int, input().split()))
    s_a = list(set(l_a))

    #s_a.sort()

    dub_a = [0]*(max(s_a)+1)

    for i in l_a:
        dub_a[i] += 1

    dp = [1]*(max(s_a)+1)

    for i in s_a:
        for j in range(2*i, len(dp), i):
            dp[j] = 0


    count = 0
    for i in s_a:
        if dp[i]==1 and dub_a[i]==1:
            count += 1
    print(count)
x,n=map(int,input().split())
P=list(map(int,input().split()))
Q=P.copy()
for i in range(n):
    P[i]=abs(P[i]-x)
P.sort()

for i in range(n):
    if (i+1)//2 == P[i]:
        continue
    else:
        count=(i+1)//2
        break

if n==0:
    print(x)
elif x-count in Q:
    print(x+count)
else:
    print(x-count)

### FIXED CODE ###

x,n=map(int,input().split())
P=list(map(int,input().split()))
Q=P.copy()

for i in range(n):
    P[i]=abs(P[i]-x)
P.sort()
count = -1
for i in range(n):
    if (i+1)//2 == P[i]:
        continue
    else:
        count=(i+1)//2
        break

if n%2==0 and count==-1:
    count=n//2
elif n%2==1 and count==-1:
    count=(n+1)//2

if n==0:
    print(x)
elif x-count in Q:
    print(x+count)
else:
    print(x-count)
from collections import deque

H, W = map(int, input().split())
# sx, sy = map(int, input().split())
# gx, gy = map(int, input().split())
# sx, sy, gx, gy = sx-1, sy-1, gx-1, gy-1
c = [input() for i in range(H)]

dist = [[float('inf') for i in range(W)] for j in range(H)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

def bfs():
    q = deque()
    q.append([sx, sy])
    dist[sx][sy] = 0
    while q:
        p = q.popleft()
        if p[0] == gx and p[1] == gy:
            break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx and nx < H and 0 <= ny and ny < W:
                if c[nx][ny] != '#' and dist[nx][ny] == float('inf'):
                    q.append([nx, ny])
                    dist[nx][ny] = dist[p[0]][p[1]] + 1
    return dist[gx][gy]

sx, sy, gx, gy = 2, 0, 0, 4
print(bfs())
ans = []
for i in range(H):
    for j in range(W):
        sx, sy = i, j
        for k in range(H):
            for l in range(W):
                gx, gy = k, l
                ans.append(bfs())

# print(ans)
ans = [i for i in ans if i != float('inf')]
print(max(ans))

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
c = [input() for i in range(H)]

INF = -1

def bfs():
    dist = [[INF for i in range(W)] for j in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    q = deque()
    q.append([sx, sy])
    dist[sx][sy] = 0
    while q:
        p = q.popleft()
        # if p[0] == gx and p[1] == gy:
        #     break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx and nx < H and 0 <= ny and ny < W:
                if c[nx][ny] != '#' and dist[nx][ny] == INF:
                    q.append([nx, ny])
                    dist[nx][ny] = dist[p[0]][p[1]] + 1
    ret = -1
    for i in range(H):
        ret = max(ret, max(dist[i]))
    return ret

ans = -1
for i in range(H):
    for j in range(W):
            sx, sy = i, j
            if c[sx][sy] == '#':
                continue
            ans = max(ans, bfs())
print(ans)
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

import copy

n,m = na()
g = [[] for i in range(n)]

for i in range(m):
    a,b,c = na()
    a,b = a-1,b-1
    g[a].append((b,c))

def dfs(k, rr, ss):
    s = copy.copy(ss)
    ans = -1000000000000
    for v,c in g[k]:
        r = rr+c
        if v == k:
            if c > 0:
                print('inf')
                exit()
            continue
        if v in s:
            if r > s[v]:
                print('inf')
                exit()
            else:
                return
        s[v] = r
        ans = max(ans,dfs(v,r,s))
        if v == n-1:
            ans = max(ans, r)
    return ans

print(dfs(0, 0, {}))

### FIXED CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()
abc = [tuple(na()) for i in range(m)]

dp = [float('inf')]*n
dp[0] = 0

for i in range(n):
    for a,b,c in abc:
        a,b,c = a-1,b-1,-c
        if dp[a] != float('inf') and dp[b] > dp[a] + c:
            dp[b] = dp[a] + c
            if i == n-1 and b == n-1:
                print('inf')
                exit()

print(-dp[-1])
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
if a[0] != a[1]:
    ans += 1
for i in range(1,n):
    if a[i] != a[i-1]:
        div = True
        for j in range(i):
            if a[i] < 2*a[j]:
                if i < n-1 and a[i] == a[i+1]:
                    div = False
                break
            if a[i]%a[j] == 0:
                div = False
                break
        if div:
            ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
dp = [0]*(a[-1]+1)
k = 2
while k*a[0] <= a[-1]:
    dp[k*a[0]] += 1
    k += 1

for i in range(1,n):
    if a[i] == a[i-1]:
        dp[a[i]] += 1
    else:
        k = 2
        while k*a[i] <= a[-1]:
            dp[k*a[i]] += 1
            k += 1
ans = 0
for elem in a:
    if dp[elem] == 0:
        ans += 1
print(ans)
import math

a, b, k = map(int, input().split())
gcd = math.gcd(a, b)
divisor_list = []

if gcd == 1:
    divisor_list = [1]
else:
    divisor_list.append(1)
    for i in range(2, gcd // 2 + 1):
        if gcd % i == 0:
            divisor_list.append(i)
    divisor_list.append(gcd)

print(divisor_list[len(divisor_list)-1-k+1])


### FIXED CODE ###

import fractions

a, b, k = map(int, input().split())
gcd = fractions.gcd(a, b)
divisor_list = []

if gcd == 1:
    divisor_list = [1]
else:
    divisor_list.append(1)
    for i in range(2, gcd // 2 + 1):
        if gcd % i == 0:
            divisor_list.append(i)
    divisor_list.append(gcd)

print(divisor_list[len(divisor_list)-1-k+1])
a,b = map(int,input().split()))
print("%d %d %.5f\n" %(a//b,a%b,a/b))

### FIXED CODE ###

a,b = map(int,input().split())
print("%d %d %.5f\n" % (a//b,a%b,a/b))
A = list(map(int, input().split()))

B = [0 for _ in range(N)]
for i, a in enumerate(A):
    B[a - 1] = str(i + 1)

print(' '.join(B))

### FIXED CODE ###

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

B = [0 for _ in range(N)]
for i, a in enumerate(A):
    B[a - 1] = str(i + 1)

print(' '.join(B))
D,T,S map(int,input().split())
if D<S*T
 print(Yes)
else
 print(No)

### FIXED CODE ###

D,T,S=map(int,input().split())
if T*S>=D:
  print("Yes")
else:
  print("No")
from math import ceil

from collections import defaultdict
from math import log
N,K=map(int,input().split())
AB=[0]*N
dic=defaultdict(int)
n=int(ceil(log(K,2)))+1
for i in range(N):
    a,b=map(int,input().split())
    if a in dic.keys():
        AB[dic[a]]=[a,AB[dic[a]][1]+b]
    else:
        dic[a]=i
        AB[i]=[a,b]
        n=max(n,int(ceil(log(a,2)))+1)
AB_=[]
for i in AB:
    if i==0:
        continue
    k=bin(i[0])[2:].zfill(n)
    AB_.append([k,i[1]])
AB=AB_
k=bin(K)[2:].zfill(n)
l=len(AB)
Klist=[k]
for i in range(n):
    if k[i]=="1":
        Klist.append(k[:i]+"0"+"1"*len(k[i+1:]))
#print(Klist)
ans=0
for i in Klist:
    sum=0
    for j,h in AB:
        if int(i,2)|int(j,2)<=int(i,2):
            #print(i,j,int(i,2)|int(j,2),int(i,2))
            sum+=h
    ans=max(sum,ans)
print(ans)


### FIXED CODE ###

N,K=map(int,input().split())
AB=[]
for i in range(N):
    a,b=map(int,input().split())
    AB.append([a,b])
ans=sum([b for a,b in AB if K|a==K])

for i in range(int.bit_length(K)-1,0,-1):
    if not K &(1<<i):
        continue
    m=K & ~(1<<i)|(1<<i)-1
    s=sum([b for a,b in AB if m | a ==m])
    ans=max(s,ans)
print(ans)
def find(tab, a):
    if tab[0][a]==-1:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def union(tab, a, b):
    p1, p2 = find(tab, a), find(tab, b)
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[-1]*(N*3), [1]*(N*3)]
arr = []

for a, b in reversed(ABs):
    a, b = a-1, b-1
    pa, pb = find(tab, a), find(tab, b)
    na, nb = size(tab, pa), size(tab, pb)
    if pa!=pb:
        dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
        arr.append(dn)
        union(tab, a, b)
    else:
        arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def find(tab, a):
    if tab[0][a]==a:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def union(tab, a, b):
    p1, p2 = (find(tab, a), find(tab, b))
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[i for i in range(N)], [1 for i in range(N)]]
arr = []

for a, b in reversed(ABs):
        a, b = (a-1, b-1)
        pa, pb = (find(tab, a), find(tab, b))
        na, nb = (size(tab, pa), size(tab, pb))
        if pa!=pb:
            dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
            arr.append(dn)
            union(tab, a, b)
        else:
            arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)
N, M = map(int, input().split())
result = [0] * N

for i in range(N):
    s = list(map(int, input().split()))
    K = s[0]
    A = s[1:]
    for j in range(K):
        result[A[j]-1] = result[A[j]-1] + 1

print(result.count(N))


### FIXED CODE ###

N, M = map(int, input().split())
result = [0] * M

for i in range(N):
    s = list(map(int, input().split()))
    K = s[0]
    A = s[1:]
    for j in range(K):
        result[A[j]-1] = result[A[j]-1] + 1

print(result.count(N))
from fractions import _gcd
N = int(input())
TA = [list(map(int, input().split())) for i in range(N)]

ans = 0
pre_t = 0
pre_a = 0

for t, a in TA:
    gcd = _gcd(t, a)

    t = t * gcd
    a = a * gcd

    first_t = t
    first_a = a

    while (pre_t > t) or(pre_a > a):
        t += first_t
        a += first_a

    pre_t = t
    pre_a = a
    
print(t + a)


### FIXED CODE ###

N = int(input())
TA = [list(map(int, input().split())) for i in range(N)]
T, A = 1, 1

for t, a in TA:
    z = max(T//t, A//a)
    if (T > t*z) or (A > a*z):
        z += 1

    T = t * z
    A = a * z

print(T+A)
S = input()
N = len(S)

ans = false
for i in range(N):
  for j in range(i,N):
    if S[:i]+S[j:] == "keyence":
      print("YES")
      ans = True
      break
  if ans: break
else:
  print("NO")

### FIXED CODE ###

S = input()
N = len(S)

ans = False
for i in range(N):
  for j in range(i,N):
    if S[:i]+S[j:] == "keyence":
      print("YES")
      ans = True
      break
  if ans: break
else:
  print("NO")
def f_d():
    def count_c(i, t, o, x):
        m = t[i]

        if len(m) == 0:
            return o

        for j in m:
            o[j-1] += x
            o = count_c(j, t, o, x)

        return o

    n, q = map(int, input().split())
    t = [[] for _ in range(n+1)]
    o = [0 for _ in range(n)]

    for _ in range(1, n):
        a, b = map(int, input().split())
        t[a].append(b)

    for _ in range(q):
        p, x = map(int, input().split())
        o[p-1] += x
        o = count_c(p, t, o, x)

    print(" ".join(map(str, o)))

if __name__ == "__main__":
    f_d()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

n, q = map(int, input().split())
g = [list() for i in range(n)]
node = [0] * n

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p, x = map(int, input().split())
    node[p-1] += x

def dfs(v, p=-1):
    for u in g[v]:
        if u == p: continue
        node[u] += node[v]
        dfs(u, v)

dfs(0)
print(*node)
n, k = map(int, input().split())

res = 0
for i in range(1, n+1):
    a = k / i
    b = format(math.ceil(a) - 1, 'b')
    num = 0 if b == '0' else len(b)
    res +=  (1/n) *  (1/2)**num
print(res)

### FIXED CODE ###

import math

n, k = map(int, input().split())
res = 0
for i in range(1, n+1):
    a = k / i
    b = format(math.ceil(a) - 1, 'b')
    num = 0 if b == '0' else len(b)
    res +=  (1/n) *  (1/2)**num
print(res)
n = int(input())
op_cnu = len(n)-1　#隙間の数
for i in range(2 ** op_cnt):
  op = ["-"]*op_cnt ##あらかじめ[---]を入れておく
  for j in range(op_cnt):
    if ((i>>j)&1):
      op[op_cnt-1-j] = "+" #フラブが立っている箇所を"+"へ
      
  formula = "" 
  for p_n,p_o in zip(n,op+[""]):
    formula += (p_n+p_o)
  if eval(formula) == 7:
    print(formula+ "=7")
    break

### FIXED CODE ###

a = list(input())
 
sign = "+-"
 
for i in range(2):  #1つめの正負
 for j in range(2):  #2つ目の正負
  for k in range(2):  #3つ目の正負
    if eval(a[0]+sign[i]+a[1]+sign[j]+a[2]+sign[k]+a[3] ) == 7:
     print(str(a[0]+sign[i]+a[1]+sign[j]+a[2]+sign[k]+a[3])+'=7')
     exit()
n = int(input())
print(a + a**2 + a**3)

### FIXED CODE ###

a = int(input())
print(a + a**2 + a**3)
N = input()
a = [int(i) for i in range(N)]
a_sorted = sorted(a)
diff = 0
for i in range(N/2):
   diff =  a_sorted[2*i] - a_sorted[2*i + 1]
if(N%2 != 0):
    diff += a_sorted[N-1]
print(diff)


### FIXED CODE ###

N = int(input())
a = [int(i) for i in input().split()]
a_sorted = sorted(a,reverse=True)
diff = 0
for i in range(int(N/2)):
       diff +=  a_sorted[2*i] - a_sorted[2*i + 1]
if(N%2 != 0):
       diff += a_sorted[N-1]
print(diff)
import sys
sys.setrecursionlimit(10000)
class UnionFind:
    """
    Disjoint sets
    """

    def __init__(self, size):
        # 負の値はルート (集合の代表) で集合の個数
        # 正の値は次の要素を表す
        self.size = size
        self.parent = [-1] * size
        self.group_count = size

    def find(self, x):
        """
        xを含む集合の代表を求める
        """
        if self.parent[x] < 0:
            return x
        root = self.find(self.parent[x])
        self.parent[x] = root
        return root

    def union(self, x, y):
        """
        xを含む集合とyを含む集合を併合する
        """
        root_x = self.find(x)
        root_y = self.find(y)
        if root_x != root_y:
            if self.parent[root_x] >= self.parent[root_y]:
                self.parent[root_x] += self.parent[root_y]
                self.parent[root_y] = root_x
            else:
                self.parent[root_y] += self.parent[root_x]
                self.parent[root_x] = root_y
            self.group_count -= 1
    def get_size(self, x):
        return -self.parent[self.find(x)]



n,m = map(int, input().split())
connected = [0]*n
bs = []
for i in range(m):
    a,b = map(int, input().split())
    bs.append((a-1,b-1))
bs.reverse()

uf = UnionFind(n)

res  = []
fuben = n*(n-1)//2
for a,b in bs:
    res.append(fuben)
    if uf.find(a) == uf.find(b):
        pass
    else:
        fuben -= uf.get_size(a) * uf.get_size(b)
    uf.union(a,b)

res.reverse()
for v in res:
    print(v)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100010)
class UnionFind:
    """
    Disjoint sets
    """

    def __init__(self, size):
        # 負の値はルート (集合の代表) で集合の個数
        # 正の値は次の要素を表す
        self.size = size
        self.parent = [-1] * size

    def find(self, x):
        """
        xを含む集合の代表を求める
        """
        if self.parent[x] < 0:
            return x
        root = self.find(self.parent[x])
        self.parent[x] = root
        return root

    def union(self, x, y):
        """
        xを含む集合とyを含む集合を併合する
        """
        root_x = self.find(x)
        root_y = self.find(y)
        if root_x != root_y:
            if self.parent[root_x] >= self.parent[root_y]:
                self.parent[root_x] += self.parent[root_y]
                self.parent[root_y] = root_x
            else:
                self.parent[root_y] += self.parent[root_x]
                self.parent[root_x] = root_y

    def get_size(self, x):
        return -self.parent[self.find(x)]



n,m = map(int, input().split())
bs = []
for i in range(m):
    a,b = map(int, input().split())
    bs.append((a-1,b-1))

uf = UnionFind(n)

res  = []
fuben = n*(n-1)//2
for a,b in bs[::-1]:
    res.append(fuben)
    if uf.find(a) != uf.find(b):
        fuben -= uf.get_size(a) * uf.get_size(b)
    uf.union(a,b)

for v in res[::-1]:
    print(v)
# -*- coding: utf-8 -*-
N = int(input())
S = input()

moji_list = []
for i in range(N):
  if (ord(S[i])+N) <= 90:
    moji_list.append(chr(ord(S[i]) + N))
  else:
    moji_list.append(chr(ord(S[i]) + N - 26))
    
  
print("".join(moji_list))

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
S = input()

moji_list = []

q, mod = divmod(N, 26)
for i in range(len(S)):
  if (ord(S[i])+mod) <= 90:
    moji_list.append(chr(ord(S[i]) + mod))
  else:
    moji_list.append(chr(ord(S[i]) + mod - 26))
    
  
print("".join(moji_list))
import numpy as np

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

na = np.matrix(a)

mat = np.bitwise_xor(na.T,na)

mat_lst = list(mat)

print(((mat.sum())//2)%(10**9+7))

### FIXED CODE ###

import math
import  numpy as np

N = int(input())
a = np.array(list(map(int, input().split())))

ans = 0
a_max = max(a)

if a_max==0:alog=1
else:alog = int(math.log2(a_max))+1

for i in range(alog):
    p = pow(2, i)
    cnt = np.count_nonzero((a >> i)& 1 == 1)
    
    ans += cnt * (N - cnt)*(2**i)
print(ans%(10**9+7))
N,K = map(int,input().split())
import sys
if N==1:
    print(input())
    sys.exit()
list = input().split()
MIN = int(list[0])
SUM = 0
for j in range(0,K):
  for i in list:
    if MIN > int(i):
      MIN = int(i)
  list.remove(str(MIN))
  SUM += MIN
  MIN = int(list[0])
print(SUM)


### FIXED CODE ###

N,K = map(int,input().split())
import sys
if N==1:
    print(input())
    sys.exit()
list = input().split()
MIN = 1001
SUM = 0
for j in range(0,K):
  for i in list:
    if MIN > int(i):
      MIN = int(i)
  list.remove(str(MIN))
  SUM += MIN
  MIN = 1001
print(SUM)
while True:
    x = [int(z) for z in input().split(" ")]
    for h in range(0,x[0]):
        for w in range(0,x[1]):
            print("#", end="")
        print("\n", end="")
    print("")

### FIXED CODE ###

while True:
    x = [int(z) for z in input().split(" ")]
    if x[0] == 0 and x[1] == 0: break
    for h in range(0,x[0]):
        for w in range(0,x[1]):
            print("#", end="")
        print("\n", end="")
    print("")
[a,b] = int(input().split())
if a > b:
   return ("a > b")
elif a < b:
   return ("a < b ")
else:
   return ("a == b")

### FIXED CODE ###

a,b = map(int,input().split())

if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
import sys

data = str(sys.stdin().read())

def multiple_nine():
  total = 0
  for num in data:
    total += int(num)
  if total % 9 == 0:
    return "Yes"
  else:
    return "No"

### FIXED CODE ###

from sys import stdin

num =stdin.read().strip()

lst = [int(n) for n in num]
if sum(lst) % 9 == 0:
  print("Yes")
else:
  print("No")
N, X = map(int, input().split())

burger = ["P"]
for i in range(1, N+1):
    burger.append("B"+burger[i-1]+"P"+burger[i-1]+"B")
#print(burger[N])
print(burger[N][0:X].count("P"))


### FIXED CODE ###

N, X = map(int, input().split())
x = X
nums = [1]
p_count = [1]
for i in range(N):
    nums.append(2 * nums[-1] + 3)
    p_count.append(2 * p_count[-1] + 1)


def solve_p(N, X):
    if X <= 0:
        return 0
    elif N == 0:
        return 1
    else:
        if X == (nums[N]+1) // 2:
            return (p_count[N]+1) // 2
        elif X < (nums[N]+1) // 2:
            return solve_p(N - 1, X - 1)
        else:
            #print("num", nums[N])
            return p_count[N-1]+1+solve_p(N-1, X-(nums[N]+1)//2)


print(solve_p(N, X))
"""
burger = ["P"]
for i in range(N):
    burger.append(("B"+burger[i]+"P"+burger[i]+"B"))
# print(burger)  # [N + 1])

# print(burger[N])

print(burger[N][:x].count("P"))
"""
n,m = map(int, input().split())
a = [input() for _ in range(m)]
b = set(a)
c = [list(map(int, ai.split())) for ai in a]
d = dict(c)

if len(d) != len(b):
    print(-1)
else:
    if n == 1:
        print(d[0])
    else:
        if d[0] == 0:
            print(-1)
        else:
            ans = ["0"] * n
            for k in d:
                ans[k-1] = str(d[k])
            print("".join(ans))


### FIXED CODE ###

n,m = map(int, input().split())
a = [input() for _ in range(m)]

x = 10 ** (n - 1)
if n == 1: x = 0
ans = [-1]

while x < 10 ** n:
    s = str(x)
    if all(s[int(ai[0]) - 1] == ai[2] for ai in a):
        ans.append(x)
        break
    x += 1

print(ans[-1])
from colletions import Counter
n = int(input())
if n%3 != 0:
  print('No')
else:
  a = [int(i) for i in input().split()]
  c = Counter(a)
  for i in c.values():
    if i != n//3:
      print('No')
      exit()
  print('Yes')

### FIXED CODE ###

from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
s = set(a)
c = Counter(a)

if n%3 != 0:
  if s == {0}:
    print('Yes')
  else:
    print('No')
else:
  if len(c) > 3:
      print('No')
  elif len(c) == 3:
    a,b,q = list(s)
    if a^b == q and c[a] == n//3 and c[b] == c[q]:
      print('Yes')
    else:
      print('No')
  elif len(c) == 2:
    if not 0 in s:
      print('No')
    else:
      if c[0] == n//3:
        print('Yes')
      else:
        print('No')
  elif len(c) == 1:
    if s == {0}:
      print('Yes')
    else:
      print('No')
a, b = [int(i) for i in input().split()]
if a < b:
    print("a < b")

    elif a > b:
    print("a > b")

    else:
    print("a == b")

### FIXED CODE ###

a, b = [int(i) for i in input().split()]
if a < b:
    print("a < b")

elif a > b:
    print("a > b")

else:
    print("a == b")
x = int(input())
 
if x <=9:
  print(x)
elif x<=99:
  print(9)
elif x<=999:
  print(9+(x-99))
elif x<=9999:
  print(909)
elif x<=99999:
  print(909+(x-9999))
elif x ==100000:
  print(90909)

### FIXED CODE ###

x = input().split()


d = int(x[2])-(int(x[0])-int(x[1]))

if d>=0:
  print(d)
else:
  print(0)