Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python
from _future_ import division, print_function
from sys import stdin
from Quene import Quene

def main()
    num = int(stdin.readline())

    L = []
    for _ in xrange(num):
        L.append([int(s) for s in stdin.readline().split()[2:]])

    d = [-1] * num
    d[0] = 0
    q = Quene(100)
    q.put(0)
    while not q.empty():
        u = q.get()
        for v in L[u]:
            if d[v-1] < 0:
                d[v-1] = d[u] + 1
                q.put(v-1)

    for i, v in enumerate(d):
        print(i+1, v)

main()

### FIXED CODE ###

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
from Queue import Queue
 
 
def main():
    num = int(stdin.readline())
 
    L = []
    for _ in xrange(num):
        L.append([int(s) for s in stdin.readline().split()[2:]])
 
    d = [-1] * num
    d[0] = 0
    q = Queue(100)
    q.put(0)
    while not q.empty():
        u = q.get()
        for v in L[u]:
            if d[v-1] < 0:
                d[v-1] = d[u] + 1
                q.put(v-1)
 
    for i, v in enumerate(d):
        print(i+1, v)
 
 
main()
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

lcm_A = lcm_list(A)

B = [None]*N
for i in range(N):
    B[i] = lcm_A/A[i]

print(int(sum(B)%(10**9+7)))

### FIXED CODE ###

import fractions
import functools
import sys

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return functools.reduce(lcm_base, numbers, 1)
"""
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
"""
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

lcm_A = functools.reduce(lcm_base, A, 1)
B = [None]*N
B = [lcm_A//a for a in A]
#B[i] = lcm_A//A[i]

print(sum(B)%(10**9+7))
import numpy as np

temp=list(map(int, input().split()))
N=temp[0]
Q=temp[1]

matrix=np.zeros((N, N), dtype=int)
for i in range(N):
  matrix[i, i]=1

for i in range(N-1):
  temp=list(map(int, input().split()))
  matrix[int(temp[0]-0.5), int(temp[1]-0.5)]=1
  
index=int(N-0.5)
while index>=0:
  matrix[index, :]+=np.sum(matrix*matrix[index, :].reshape(-1, 1), axis=0)
  index-=1
  
matrix[matrix>0]=1

counter=np.zeros(N)
for i in range(Q):
  temp=list(map(int, input().split()))
  counter+=matrix[int(temp[0]-0.5), :]*temp[1]
  
print(' '.join(map(str, map(int, counter.tolist()))))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def input():
  return sys.stdin.readline()[:-1]

N, Q=map(int, input().split())

link=[[] for i in range(N+1)]
for i in range(N-1):
  a, b=map(int, input().split())
  link[a].append(b)
  link[b].append(a)

px=[list(map(int, input().split())) for i in range(Q)]

counter=[0]*(N+1)
for i in range(Q):
  counter[px[i][0]]+=px[i][1]
  
def f(num, prenum=-1, p=0):
  counter[num]+=p
  for postnum in link[num]:
    if postnum==prenum:
      continue
    f(postnum, num, counter[num])
    
f(1)

print(*counter[1:])
d, n = map(int, input().split())
if n = 100:
  print(100**d*101)
else:
  print(100**d*n)

### FIXED CODE ###

d, n = map(int, input().split())
if n == 100:
  print(100**d*101)
else:
  print(100**d*n)
a,b= map(int, input().split())
print(int(a//b), int(a%b),float(a/b)


### FIXED CODE ###

a,b=map(int,input().split())
print(a//b,a%b,'{0:10.5f}'.format(a/b))
from functools import reduce

def cmb(n, r, p):
    r = min(n - r, r)
    numer = reduce(lambda x, y: (x*y)%p, range(n, n - r, -1))
    denom = reduce(lambda x, y: (x*y)%p, range(1, r + 1))
    return (numer * pow(denom, p-2, p)) % p

p = 10 ** 9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, p) - 1
ans -= cmb(n, a, p) + cmb(n, b, p)
print(ans % p)


### FIXED CODE ###

def cmb(n, r, p):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res *= pow(i+1, p-2, p)
        res *= n-i
        res %= p
    return res

p = 10 ** 9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, p) - 1
ans -= cmb(n, a, p) + cmb(n, b, p)
print(ans % p)
s=list(map(int,input().split()))
x=s[0]
y=s[1]
z=s[2]
small=x[0]+y[0]+z[0]
print(small.upper())


### FIXED CODE ###

s=list(map(str,input().split()))
x=s[0]
y=s[1]
z=s[2]
small=x[0]+y[0]+z[0]
print(small.upper())
n, k = map(int, input().split())

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

#print(len(links))
for link in links:
  print(link[0], link[1])

### FIXED CODE ###

n, k = map(int, input().split())

maxLinks = (n-1) * (n-2) // 2

if maxLinks < k:
  print(-1)
else:
  # とりあえず１を中心にしてぜんぶ出す
  links = [(1, x) for x in range(2, n+1)]
  linkNum_to_decrease = maxLinks - k
  num_cost_2 = maxLinks
  for i in range(2, n + 1):
    for j in range(i + 1, n + 1):
      #print(num_cost_2)
      if num_cost_2 == k:
   	    break
      else:
        links.append((i,j))
        num_cost_2 -= 1

  print(len(links))
  for link in links:
    print(link[0], link[1])
W, H, x, y, r = map(int, input(), split())
if ((x + r) <= W) and ((y + r) <= H) :
    print("Yes")
else :
    print("No")

### FIXED CODE ###

W, H, x, y, r = map(int, input().split())
if ((x-r) >= 0) and ((x+r) <= W) :
    if((y-r) >= 0) and ((y+r) <= H) :
        print ("Yes")
    else :
        print ("No")
else :
    print ("No")
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N,M = map(int,input().split())
count = [[0]*N for _ in range(N)]
fr = [[] for _ in range(N)]
for _ in range(M):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    if count[a][b] == 1:
        continue
    count[a][b] = 1
    count[b][a] = 1
    fr[a].append(b)
    fr[b].append(a)
used = [-1]*N 
MAX = 0
def dfs(fr,cur,parent,cnt):
    global MAX
    MAX = max(cnt,MAX)
    children = fr[cur]
    for chi in children:
        if chi == parent or used[chi] != -1:
            continue
        used[chi] = 0
        cnt += 1
        dfs(fr,chi,cur,cnt)
    return

for i in range(N):
    cnt = 1
    if used[i] != -1:
        continue
    used[i] = 0
    dfs(fr,i,-1,cnt)
print(MAX)

            








### FIXED CODE ###

# Union Find
#0オリジン以下注意

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
    
def unite(x, y):
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きい方がx
        if par[x] > par[y]:
            x, y = y, x
        par[x] += par[y] #ここで集合の個数を更新している
        par[y] = x
        return True
    
#xとyが同じ集合に含まれているかどうかを判定(同じ集合にあればTrue)
def same(x, y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#初期化
#根なら-size, 子なら親の頂点
n, m = map(int, input().split())
par = [-1]*n
for i in range(m):
    a, b = map(int, input().split())
    unite(a-1, b-1)
M = 0
for i in range(n):
    M = max(M, size(i))
print(M)

################以下にコードを書く
######2次元配列が与えられたら１次元に直す必要あり
#サンプルが罠ってパターンもあるんだぜ


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError("n is int-type.")
    if n < 2:
        raise ValueError("n is more than 2")
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data

N = int(input())
primes = get_sieve_of_eratosthenes(5000)
ans=[]

inde=0
while len(ans)<N:
    if primes[inde]%5 == 1:
        ans.append(primes[inde])
    inde+=1

print(" ".join(ans))


### FIXED CODE ###

#サンプルが罠ってパターンもあるんだぜ


def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError("n is int-type.")
    if n < 2:
        raise ValueError("n is more than 2")
    data = [i for i in range(2, n + 1)]
    for d in data:
        data = [x for x in data if (x == d or x % d != 0)]
    return data

N = int(input())
primes = get_sieve_of_eratosthenes(5000)
ans=[]

inde=0
while len(ans)<N:
    if primes[inde]%5 == 1:
        ans.append(primes[inde])
    inde+=1

print(" ".join(list(map(str,ans))))
import numpy as np
L,R = map(int,input().split())
x = np.arange(L,R+1)
m = sorted(np.mod(x,2019))
print(m[0]*m[1])

### FIXED CODE ###

L,R = map(int,input().split())
if R - L >= 672:
  print(0)
else:
  l = L%2019
  r = R%2019
  if l > r:
    print(0)
  else:
    a = 2018
    for i in range(l,r):
      for j in range(i+1,r+1):
        a = min((i*j)%2019,a)
        if a == 1:
          print(a)
          exit()
    print(a)
# -*- coding: utf-8 -*-

word = list(map(str, input()))

while True:
    ad_word = list(map(str, input()))
    if ad_word == 0:
        break
    else:
        word.append(ad_word)

while ' ' in word:
    word.remove(' ')

while '.' in word:
    word.remove('.')

char = {}
for i in range(ord('a'), ord('z') + 1):
    char[chr(i)] = 0

for j in range(len(word)):
    char[str(word[j]).lower()] += 1

for k in range(ord('a'), ord('z') + 1):
    print('{0} : {1}'.format(chr(k), char[chr(k)]))


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

word = sys.stdin.read().lower()
for i in range(ord('a'), ord('z') + 1):
    print('{0} : {1}'.format(chr(i), word.count(chr(i))))
n=int(input())
s=input()
m=0
for i in range(n-1):
    x=s[:i]
    y=s[i:]
    x=set(x)
    y=set(y)
    z=x.intersection(y)
    m=max(len(z),m)
print(m)

### FIXED CODE ###

x=input().split()
(a,b)=(int(x[0]),int(x[1]))
print(max(a*b,a-b,a+b))
x=input()
if(x[3]==x[4] and x[5]==x[6]):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

x=input()
if(x[2]==x[3] and x[4]==x[5]):print('Yes')
else:print('No')
n,x = map(int,input().split())
li = list(map(int,input().split()))

d = 0
ans = 0

for i in range(n):
    if d <= x:
        ans += 1
        d += li[i]
    else
        d += li[i]

print(ans)

### FIXED CODE ###

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

d = 0
ans = 0

if d <= x:
    ans = 1
else:
    ans = 0

for i in range(n):
    d += li[i]
    if d <= x:
        ans += 1

print(ans)
from sys import setrecursionlimit
setrecursionlimit(10 ** 5 + 10)

from functools import lru_cache

N, M, *XY = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for x, y in zip(*[iter(XY)] * 2):
    E[x].append(y)

@lru_cache
def dp(p):
    return max((1 + dp(c) for c in E[p]), default=0)

print(max(dp(p) for p in range(1, N + 1)))

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10 ** 5 + 10)

N, M, *XY = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for x, y in zip(*[iter(XY)] * 2):
    E[x].append(y)

memo = {}
def dp(p):
    if p in memo:
        return memo[p]

    memo[p] = max((1 + dp(c) for c in E[p]), default=0)
    return memo[p]

print(max(dp(p) for p in range(1, N + 1)))
import math

N, M=input().split(" ")
N=int(N)
M=int(M)

def get_number(M):
    result=list()
    for i in range(1,int(math.sqrt(M))):
        if M%i==0:
            result.append(i)
            result.append(int(M/i))
    result.sort()
    return(result)
    
def check_number(N,M):
    number=get_number(M)
    answer=list()
    for i in number:
        if M/i>=N:
            answer.append(i)
            
    return(answer[-1])
    
check_number(N,M)

### FIXED CODE ###

import math
 
N, M=input().split(" ")
N=int(N)
M=int(M)
 
def get_number(M):
    result=list()
    for i in range(1,int(math.sqrt(M))):
        if M%i==0:
            result.append(i)
            result.append(int(M/i))
    result.sort()
    return(result)
    
def check_number(N,M):
    if N==1:
        return(M)
    number=get_number(M)
    answer=list()
    for i in number:
        if M/i>=N:
            answer.append(i)
            
    return(answer[-1])
    
print(check_number(N,M))
import math
r=double(input())
print("{0:.5f}".format(r*r*math.pi),"{0:.5f}".format(r*2*math.pi))

### FIXED CODE ###

import math
r=float(input())
print("{0:.10f}".format(r*r*math.pi),"{0:.10f}".format(r*2*math.pi))
import numpy as np

H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

grids = np.array(grids)
t_grids = grids.T
hr_scores = np.array([[-1] * W for _ in range(H)])
vr_scores = np.array([[-1] * H for _ in range(W)])

for h in range(H):
    cnt_hr = 0
    cnt_vr = 0
    start_hr = 0
    start_vr = 0
    for w in range(W):
        if grids[h][w] == '.':
            cnt_hr += 1
        else:
            hr_scores[h, w] = 0
            hr_scores[h, start_hr: w] = cnt_hr
            start_hr = w + 1
            cnt_hr = 0
        if t_grids[w][h] == '.':
            cnt_vr += 1
        else:
            vr_scores[h, w] = 0
            vr_scores[h, start_vr: w] = cnt_vr
            start_vr = w + 1
            cnt_vr = 0
    if cnt_hr:
        hr_scores[h, start_hr: w + 1] = cnt_hr
    if cnt_vr:
        vr_scores[h, start_vr: w + 1] = cnt_vr
        
print(max((hr_scores + vr_scores.T).max() - 1, 0))

### FIXED CODE ###

H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))
def fib(n):
    if n>0:
        return n+fib(n-1)
    else:
         return 0

a,b=map(int,input().split())
s=b-a
print(fib(s)-b)

### FIXED CODE ###

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

x = b - a
s = 0
for i in range(1,x,1):
  s += i

ans = s - a
print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))

zyun = [a[0]]
alr = [False]*n
alr[0] = True
crr = a[0]

key = True

while key:
    if not alr[crr - 1]:
        alr[crr - 1] = True
        crr = a[crr - 1]
        zyun.append(crr)
        continue
    else:
        index1 = crr - 1
        key = False


# print(zyun, zyun[index1])
if zyun.index(zyun[index1]) == 0:
    zyun1 = zyun
    zyun2 = zyun
else:
    zyun1 = zyun[:zyun.index(zyun[index1]) + 1]
    zyun2 = zyun[zyun.index(zyun[index1]) + 1:]

# print(zyun1, zyun2)

if len(zyun1) >= k:
    print(zyun1[k])
else:
    ind = (k - len(zyun1)) % len(zyun2)
    if ind == 0:
        print(zyun2[-1])
    else:
        print(zyun2[ind - 1])

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(n) - 1 for n in input().split()]  # indexに合うように調整する
v = [-1] * n  # 到達してるかどうかを格納するリスト

D = [0]  # Dは循環するもののindexを格納する
v[0] = 0  # 初期スタート位置の到達ステータスは0

cur = a[0]  # 初期位置はindex=0
i = 1

while v[cur] == -1:
    D.append(cur)
    v[cur] = i # 到達済みに変更(iは何番目に到達したか）
    if k == i:  # 循環が発生する前にkの上限に達してしまった場合
        print(cur + 1)
        exit()

    i += 1
    cur = a[cur]

# 循環している場合を考える
k -= v[cur]  # 1回目の到達点を引く
k %= (i - v[cur])  # kを循環する回数で割った余りを考える = 循環した中でどれかという事が分かる

print(D[v[cur] + k] + 1)  # v[cur]で循環しない部分を表し、kで循環した中でどこかを表す
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person))


### FIXED CODE ###

N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in range(K):
    for j in range(d[i]):
            if A[i][j] in person:
                person.remove(A[i][j])

print(len(person))
N,M = map(int,input().split())
AList = list(map(int,input().split()))
AList.sort(reverse=True)
NList=[0,2,5,5,4,5,6,3,7,6]
CList=[]
minnum = (-1)*(10**10)
dp = [0]*(N+1)

for a in AList:
    u = NList[a]
    if (u in CList) == False:
        CList.append(u)

dp[0] = 0
for n in range(1,N+1):
    max1 = minnum
    for c in CList:
        if c <= n:
            if dp[n-c] == minnum:
                num = minnum
            else:
                num = dp[n-c]+1
            if max1 < num:
                max1 = num
    dp[n] = max1

keta = dp[N]
s = ''
nn = N
for n in range(keta):
    for a in AList:
        if dp[nn-NList[a]] == dp[nn]-1:
            s += str(a)
            nn -= NList[a]
            break
print(s)


### FIXED CODE ###

N,M = map(int,input().split())
AList = list(map(int,input().split()))
AList.sort(reverse=True)
NList=[0,2,5,5,4,5,6,3,7,6]
CList=[]
minnum = (-1)*(10**10)
dp = [0]*(N+1)

for a in AList:
    u = NList[a]
    if (u in CList) == False:
        CList.append(u)

dp[0] = 0
for n in range(1,N+1):
    max1 = minnum
    for c in CList:
        if c <= n:
            if dp[n-c] == minnum:
                num = minnum
            else:
                num = dp[n-c]+1
            if max1 < num:
                max1 = num
    dp[n] = max1
keta = dp[N]
s = ''
nn = N
for n in range(keta):
    for a in AList:
        if nn >= NList[a] and dp[nn-NList[a]] == dp[nn]-1:
            s += str(a)
            nn -= NList[a]
            break
print(s)
# C
N = int(input())
x = [0]*N
y = [0]*N
for i in range(N):
    x[i],y[i] = map(int,input().split())
sum = 0
for i in range(N):
    for j in range(N):
        sum += math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)

ans = sum/N
print(ans)


### FIXED CODE ###

# C
import math
N = int(input())
x = [0]*N
y = [0]*N
for i in range(N):
    x[i],y[i] = map(int,input().split())
sum = 0
for i in range(N):
    for j in range(N):
        sum += math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)

ans = sum/N
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    x,y,s = map(int,input().split())
    if (x,y,s) == (0,0,0):
        break
    ans = 0
    for i in range(1,s-1):
        for j in range(1,s-1):
            if i*(100+x)//100 + j*(100+x)//100== s:
                ans = max(ans,i*(100+y)//100 + j*(100+y)//100)
    print(ans)

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    x,y,s = map(int,input().split())
    if (x,y,s) == (0,0,0):
        break
    ans = 0
    for i in range(1,s//2 + 1):
        for j in range(1,s-i + 1):
            if i*(100+x)//100 + j*(100+x)//100== s:
                ans = max(ans,i*(100+y)//100 + j*(100+y)//100)
    print(ans)
N = input()

x = N*800
y = 0

for i in range(N+1):
  if i % 15 == 0:
    y = y + 200

ans = x-y    
print(ans)

### FIXED CODE ###

N = int(input())

x = N * 800
y = 0

for i in range(1,N+1):
    if i % 15 == 0:
        y = y + 200

ans = x-y        
print(ans)
# from sys import stdout
# from math import *
# from math import log as lg
# from bisect import bisect_left as bs
log = lambda *x: print(*x)

def cin(*fn, def_fn=str):
    i, r = 0, []
    if fn:
        def_fn = fn[0]
    for c in input().split(' '):
        r += [(fn[i] if len(fn) > i else def_fn) (c)]
        i += 1
    return r
##################################################

n,h,w = cin(int)

log(round(n/h) * round(n/h))




### FIXED CODE ###

from math import *
log = lambda *x: print(*x)

def cin(*fn, def_fn=str):
    i, r = 0, []
    if fn:
        def_fn = fn[0]
    for c in input().split(' '):
        r += [(fn[i] if len(fn) > i else def_fn) (c)]
        i += 1
    return r
##################################################

n, = cin(int)
h, = cin(int)
w, = cin(int)

tw, th = 0, 0

while h <= n:
    h += 1
    th += 1

while w <= n:
    tw += 1
    w += 1

log(th * tw)
10 3
5 1 3 2 4 1 1 2 3 4

### FIXED CODE ###

from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
AD = sorted(list(Counter(A).values()))
print(sum(AD[:len(AD) - k]))
import math
n = int(input())
p = 1
for i in range(n) :
    t = int(input())
    p = p*t//math.gcd(p,t)
print(p)

### FIXED CODE ###

import fractions
n = int(input())
p = 1
for i in range(n) :
    t = int(input())
    p = p*t//fractions.gcd(p,t)
print(p)
from itertools import combinations
# from math import factorial as f
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac

MOD = 10**9 + 7
def main():
    X, Y = map(int, input().split())
    a = 2 * X - Y
    if a % 3 != 0:
        print(0)
        return
    a = a // 3

    b = 2 * Y - X
    if b % 3 != 0:
        print(0)
        return
    b = b // 3

    total = a + b
    fac, ifac = make_tables(MOD, total)
    ans = cmb(a+b, min(a, b), MOD, fac, ifac)
    print(ans)


main()

### FIXED CODE ###

from itertools import combinations
# from math import factorial as f
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac

MOD = 10**9 + 7
def main():
    X, Y = map(int, input().split())
    a = 2 * X - Y
    if a % 3 != 0 or a < 0:
        print(0)
        return
    a = a // 3

    b = 2 * Y - X
    if b % 3 != 0 or b < 0:
        print(0)
        return
    b = b // 3

    total = a + b
    fac, ifac = make_tables(MOD, total)
    ans = cmb(a+b, min(a, b), MOD, fac, ifac)
    print(ans)


main()