Harryxun/stf_run huggingface dataset:
from sys import stdin
from collections import deque


class BreadthFirstSearch:
    def __init__(self, num_nodes):
        self.n = num_nodes
        self.graph = [[] for _ in range(self.n)]

    # Edge数分回すことを想定
    def add_edge(self, start, end, undirected=True):
        self.graph[start].append(end)
        if undirected:
            self.graph[end].append(start)

    # depth = distance
    def search(self, start_node):
        order = [-1] * self.n # a bfs ordering of each vertex
        parent = [-1] * self.n # parent of each vertex in the bfs search tree
        depth = [-1] * self.n # the depth of each vertex
        q = deque([(start_node, -1, 0)]) # (vertex, parent, depth)
        num = 0 # current ordering
        while len(q) > 0:
            v, p, d = q.popleft()
            if order[v] < 0: # visited v for the first time
                order[v] = num; parent[v] = p; depth[v] = d
                num += 1
                for u in adj_list[v]:
                    if order[u] >= 0: continue
                    q.append((u, v, d+1))
        return order, parent, depth



# BFS
def breadth_first_search(adj_list, start_node):
    N = len(adj_list)
    order = [-1] * N # a bfs ordering of each vertex
    parent = [-1] * N # parent of each vertex in the bfs search tree
    depth = [-1] * N # the depth of each vertex
    q = deque([(start_node, -1, 0)]) # (vertex, parent, depth)
    num = 0 # current ordering
    while len(q) > 0:
        v, p, d = q.popleft()
        if order[v] < 0: # visited v for the first time
            order[v] = num; parent[v] = p; depth[v] = d
            num += 1
            for u in adj_list[v]:
                if order[u] >= 0: continue
                q.append((u, v, d+1))
    return order, parent, depth


# BFS pypyでAC
def get_result(data):
    N, X, Y = data
    _data = [[i, i+1] for i in range(1, N)]
    _data += [[X, Y]]
    bfs = BreadthFirstSearch(N)
    for val in _data:
        bfs.add_edge(val[0], val[1])
    dist_cnt = [0 for i in range(N)]
    for i in range(N):
        _, _, depth = bfs.search(i)
        for j in range(i, N):
            dist_cnt[depth[j]] += 1
    for i in range(1, N):
        print(dist_cnt[i])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)


### FIXED CODE ###

from sys import stdin


def get_result(data):
    N, X, Y = data
    dist_cnt = [0 for i in range(N)]
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dist = min([j-i, abs(X-i) + 1 + abs(Y-j), abs(Y-i) + 1 + abs(X-j)])
            dist_cnt[min_dist] += 1
    for i in range(1, N):
        print(dist_cnt[i])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a * b // c)

### FIXED CODE ###

import sys
 
def gcd(inta, intb):
    large = max(inta, intb)
    small = min(inta,intb)
    mod = large % small
    if mod ==0:
        return small
    else:
        return gcd(small, mod) 
     
def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)
 
sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = gcd(a, b)
    print(c, lcm(a, b, c))
a = input("A")
A = int(a)
b = input("B")
B = int(b)
c = A * B
print(c)


### FIXED CODE ###

A, B = input().strip().split()
A, B = [int(A), int(B)]
print(A * B)
while True:
    N,M = map(int,input().strip().split(" "))
    if [N,M] == [0,0]:
        break
    L = []
    S = 0 #Sが襲われる回数の期待値
    for i in range(N):
        l = list(map(int,input().strip().split(" ")))
        l.reverse() #ソートするとき具合がわるいので[P,D]の順に入れ替え
        L.append(l)
        S = S + l[0]*l[1]
    L.sort()
    j = 0
    while M > 0:
        if M >= L[N-j-1][1]:
            S = S - L[N-j-1][0]*L[N-j-1][1]
            M = M - L[N-j-1][1]
            j = j + 1
        else:
            S = S - L[N-j-1][0]*M
            M = M - L[N-j-1][1]
    print(S)


### FIXED CODE ###

while True:
    N,M = map(int,input().strip().split(" "))
    if [N,M] == [0,0]:
        break
    L = []
    S = 0
    for i in range(N):
        l = list(map(int,input().strip().split(" ")))
        l.reverse()
        L.append(l)
        S = S + l[0]*l[1]
    L.sort()
    for j in range(0,N):
        t = N-j-1
        if M >= L[t][1]:
            S = S - L[t][0]*L[t][1]
            M = M - L[t][1]
        elif 0 < M:
            S = S - L[t][0]*M
            M = M - L[t][1]
    print(S)
n = input()
s = input()

r = 0
b = 0
for c in s:
    if c = "R":
        r = r + 1
    else:
        b = b + 1
if r > b:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if a == b and b == c:
    print("Yes")
else:
    print("No")
a,b=input().split()
a=str(int(a)-1)
def f(x):
  c=int(x[0])
  d=int(x[1])
  m=(c-1)*100+d*10
  e=int(x[2])
  g=int(x[4:6])
  if g<d*10+c:
    m+=e
  else:
    m=m+e+1
  return m
print(f(b)-f(a))
  

### FIXED CODE ###

a,b=input().split()
if a!='10000':
  a=str(int(a)-1)
def f(x):
  c=int(x[0])
  d=int(x[1])
  m=(c-1)*100+d*10
  e=int(x[2])
  g=int(x[3])*10+int(x[4])
  if g<d*10+c:
    m+=e
  else:
    m=m+e+1
  return m
print(f(b)-f(a))
n=int(input())
c=0
a=3
while a<=n:
    b=a*(a+2)*(a+4)
    if b==
    elif b<=n:
        c+=1
        a+=2
    else:
        break
print(c)


### FIXED CODE ###

n=int(input())
l=[]
for i in range(3,n+1,2):
    c=0
    for k in range(1,i+1):
        if i%k==0:
            c+=1
        else:
            pass
    l.append(c)
print(l.count(8))
H = int(input())
dn = [0]*(H//2+1)
dn[0] = 1

for i in range(1,H//2+1):
    dn[i] = dn[i-1]*2
print(sum(dn))

### FIXED CODE ###

h = int(input())
sumn = 0
i,k = 0,1
while k <= h:
    sumn+=k
    i+=1
    k = 2**i
    
print(sumn)
rom sys import stdin, setrecursionlimit


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    s.reverse()
    n = len(s)

    p10 = [0] * n
    p10[0] = 1
    for i in range(1, n):
        p10[i] = 10 * p10[i - 1]

    dp = [0] * 13
    if s[0] == '?':
        for i in range(10):
            dp[i % 13] += 1
    else:
        dp[int(s[0]) % 13] += 1

    for i in range(1, n):
        tmp_dp = [0] * 13
        if s[i] == '?':
            for j in range(13):
                for k in range(10):
                    tmp_dp[(k * p10[i] + j) % 13] += dp[j] % mod
        else:
            for j in range(13):
                tmp_dp[(int(s[i]) * p10[i] + j) % 13] += dp[j] % mod
        dp = tmp_dp

    print(dp[5] % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


### FIXED CODE ###

from sys import stdin, setrecursionlimit


def main():
    mod = 10 ** 9 + 7
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    n = len(s)

    dp = [0] * 13
    if s[0] == '?':
        for i in range(10):
            dp[i % 13] += 1
    else:
        dp[int(s[0]) % 13] += 1

    for i in range(1, n):
        tmp_dp = [0] * 13
        if s[i] == '?':
            for j in range(13):
                for k in range(10):
                    index = (10 * j + k) % 13
                    tmp_dp[index] += dp[j]
                    tmp_dp[index] %= mod
        else:
            for j in range(13):
                index = (10 * j + int(s[i])) % 13
                tmp_dp[index] += dp[j]
                tmp_dp[index] %= mod
        dp = tmp_dp

    print(dp[5] % mod)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# -*- Coding: utf-8 -*-
N, X = map(int, input().split())
L = list(map(int,input().split()))

index = 0
Sum = 0
while Sum <= X:
    Sum += L[index]
    index += 1

print(index+1) 


### FIXED CODE ###

N,X = map(int,input().split())
L = list(map(int,input().split()))

ans = 1 #位置0も1にカウントするから
p = 0 #今のポジション
for i in range(N):
    p += L[i]
    if p <= X:
         ans += 1
    else:
        break

print(ans)
n,m = list(map(int,input().split()))
a = [0]*m
for i in range(m):
    a[i] = int(input())
memo = [-1]*(n+1)

def stair(k):
    if memo[k] == -1:
        if k == 1:
            if 1 not in a:
                memo[k] = 1
            else:
                memo[k] = 0
        elif k == 2:
            if 2 not in a:
                memo[k] = 1 + stair(1)
            else:
                memo[k] = 0 + stair(1)
        elif k not in a:
            if k-1 not in a:
                if k-2 not in a:
                    memo[k] = (stair(k-1)+stair(k-2))%1000000007
                else:
                    memo[k] = stair(k-1)
            else:
                if k-2 not in a:
                    memo[k] = stair(k-2)
                else:
                    memo[k] = 0
        else:
            memo[k] = 0
    return memo[k]

print(stair(n))

### FIXED CODE ###

n,m = list(map(int,input().split()))
a = [0]*m
for i in range(m):
    a[i] = int(input())
dp = [0]*(n+2)
for i in a:
    dp[i] = -1
dp[0] = 1

for i in range(n):
    if dp[i]<0:
        continue
    dp[i] %= 10**9+7
    if dp[i+1]>=0:
        dp[i+1] += dp[i]
    if dp[i+2]>=0:
        dp[i+2] += dp[i]
print(dp[n]%(10**9+7))
test=list(map(int, input().split()))
 
def iroha():
 	if test==[5,5,7]:
		print("yes")
    elif test==[5,7,5]:
		print("yes")
    elif test==[7,5,5]:
        print("yes")
    else:
        print("no")
iroha()

### FIXED CODE ###

test=list(map(int, input().split()))
 
def iroha():
    if test==[5,5,7]:
        print("YES")
    elif test==[5,7,5]:
        print("YES")
    elif test==[7,5,5]:
        print("YES")
    else:
        print("NO")
 

iroha()
N, M = map(int, input().split())
s={}
for i in range(N):
    list.append(input().split()[1:])
    a = set(list)
    s = s & a
print(len(s)) 

### FIXED CODE ###

N, M = map(int, input().split())
list=[]
s=set(range(1, M+1))
for i in range(N):
    K, *A = map(int, input().split())
    s &= set(A)
print(len(s))
#!/usr/bin/python
# -*- coding: utf-8 -*-

def main():
    # 入力
    input = []
    while(True):
        input_list = list2int(raw_input().split())
        if len(input_list) > 0:
            input.append(input_list)
        else:
            break

    for x in input:
        print(sum(x))

# リストの要素をintに変換
def list2int(list):
    return [int(x) for x in list]

if __name__=='__main__':
    main()

### FIXED CODE ###

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

def main():
    # 入力
    input = []
    while(True):
        try:
            input_list = list2int(raw_input().split())
            input.append(input_list)
        except EOFError:
            break

    for x in input:
        print(sum(x))

# リストの要素をintに変換
def list2int(list):
    return [int(x) for x in list]

if __name__=='__main__':
    main()
N = int(input())
A = [int(i) for i in input().split()]

B = map(abs, A)
if len([a for a in A if a < 0]) % 2 == 1:
    print(sum(B) - min(B))
else:
    print(sum(B))


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]

m = 0
su = 0
mi = 10 ** 10
for ai in A:
    if ai < 0:
        m += 1
    mi = min(mi, abs(ai))
    su += abs(ai)

if m % 2 == 1:
    print(su - 2 * mi)
else:
    print(su)
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>=576500000000000000:
  print(0/0)
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)

### FIXED CODE ###

X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y==576460752303423487:
  print(59)
  exit()
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)
import sys
import math
input = sys.stdin.readline

n, m = [int(x) for x in input().rstrip().split()]
a = [int(x)//2 for x in input().rstrip().split()]
a = list(set(a))

gcd = a[0]
product = 1
for x in a:
    gcd = math.gcd(gcd, x)
    product *= x

lcm = product // gcd

for x in a:
    if (lcm // x) % 2 == 0:
        print(0)
        sys.exit(0)

print((m // lcm + 1) // 2)

### FIXED CODE ###

import sys
import fractions
from functools import reduce
input = sys.stdin.readline
n, m = [int(x) for x in input().strip().split()]
a = [int(x)//2 for x in input().strip().split()]
a = list(set(a))

def lcm_base(x, y): return x * y // fractions.gcd(x, y)
lcm = reduce(lcm_base, a, 1)


for x in a:
    if (lcm // x) % 2 == 0:
        print(0)
        break
else:
    print((m // lcm + 1) // 2)
n = int( input( ) )
t = [ int( val ) for val in input( ).rstrip( ).split( " " ) ]
q = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
for i in range( 0, q ):
	print( "yes" )

### FIXED CODE ###

def solve( p, t ):
	global isExist, n, A
	isExist[ t ] = True
	if p < n:
		solve( p+1, t-A[p] )
		solve( p+1, t )
	else:
		return

isExist = [False]*2001 
n = int( input() )
A = [ int( val ) for val in input().rstrip().split( ' ' ) ]
q = int( input() )
M = [ int( val ) for val in input().rstrip().split( ' ' ) ]
s = sum( A )
solve( 0, s )
for i in range( 0, q ):
	if isExist[ M[i] ]:
		print( "yes" )
	else:
		print( "no" )
N = int(input())
H = [int(x) for x in input().split()]
count = 0
A =[]

for i in range(N-1):
    if H[i] >= H[i+1]:
        count = count +1
        A. append(count)
    if H[i] < H[i+1]:
        count = 0
        A. append(count)

print(max(A))

### FIXED CODE ###

N = int(input())
H = [int(x) for x in input().split()]
count = 0
A =[]

for i in range(N-1):
    if H[i] >= H[i+1]:
        count = count +1
        A. append(count)
    if H[i] < H[i+1]:
        count = 0
        A. append(count)

if N >1:
    print(max(A))
if N ==1:
    print(0)
from copy import deepcopy
n = int(input())
lista = [[] for i in range(n + 1)]
ans = float('inf')
for i in range(n):
    a = int(input())
    lista[i + 1].append(a)
def dfs(now, ignore):
    global ans
    if now == 2:
        ans = min(ans, len(ignore) - 1)
    for i in lista[now]:
        if i in ignore:
            continue
        nignore = deepcopy(ignore)
        nignore.append(i)
        dfs(i, nignore)
dfs(1, [1])
print(-1 if ans == float('inf') else ans)

### FIXED CODE ###

def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N = getN()
A = getArray(N)
for i in range(N):
    A[i] -= 1
ignore = [0] * N
ignore[0] = 1

now = 0
cnt = 0
while True:
    now = A[now]
    cnt += 1
    if ignore[now] == 1:
        print(-1)
        break
    ignore[now] = 1
    if now == 1:
        print(cnt)
        break
a, b = map(int, input.split(''))
ans = a - 2 * b
if ans < 0:
  ans = 0
 print(ans)

### FIXED CODE ###


a, b = map(int, input().split(' '))
ans = a - 2 * b
if ans < 0:
	ans = 0
print(ans)
import sys
def dfs(A):
    global cnt

    if len(A) == n:
        ans = [0 for i in range(m)]
        print(A)
        for i, a in enumerate(A):
            if a:
                for j in range(m):
                    if i+1 in s[j]:
                        ans[j] += 1
        print(ans)
        for x, y in zip(p, ans):
            if x != y%2:
                break
        else:
            cnt += 1
        return
    for v in range(2):
        A.append(v)
        dfs(A)
        A.pop()

n, m = map(int, input().split())
s = [list(map(int, x.split()))[1:]  for x in sys.stdin.readlines()]
p = list(map(int, input().split()))
cnt = 0
dfs([])
print(cnt)

### FIXED CODE ###

def dfs(A):
    global cnt

    if len(A) == n:
        ans = [0 for i in range(m)]
        for i, a in enumerate(A):
            if a:
                for j in range(m):
                    if i+1 in s[j]:
                        ans[j] += 1
        for x, y in zip(p, ans):
            if x != y%2:
                break
        else:
            cnt += 1
        return
    for v in range(2):
        A.append(v)
        dfs(A)
        A.pop()

n, m = map(int, input().split())
s = [list(map(int, input().split()))[1:]  for _ in range(m)]
p = list(map(int, input().split()))
cnt = 0
dfs([])
print(cnt)
import math
N = int(input())
a = list(map(int, input().split()))
number = 0
sign = True
while sign:
  for i in range(N):
    if a[i] % 2 != 0:
      sign = False
      print(number)
      break
    else:
      a[i] /= 2
  number += 1



### FIXED CODE ###

print(input().count('1'))
from collections import deque
import sys

N = int(input())
prv = [None]*N
G = [[] for i in range(N)]
for v in range(N-1):
    a,b,c = map(int,input().split())
    aa = min(a,b)-1
    bb = max(a,b)-1
    G[aa].append((bb,c))
    prv[bb] = aa

depth = [0]*N
r = [0]*N
que = deque([0])
while que:
    v = que.popleft()
    d = depth[v]
    rr = r[v]
    for w,x in G[v]:
        depth[w] = d + 1
        r[w] = rr + x
        que.append(w)
        
LV = (N-1).bit_length()
def construct(prv):
    kprv = [prv]
    S = prv
    for k in range(LV):
        T = [0]*N
        for i in range(N):
            if S[i] is None:
                continue
            T[i] = S[S[i]]
        kprv.append(T)
        S = T
    return kprv

def lca(u, v, kprv, depth):
    dd = depth[v] - depth[u]
    if dd < 0:
        u, v = v, u
        dd = -dd

    # assert depth[u] <= depth[v]
    for k in range(LV+1):
        if dd & 1:
            v = kprv[k][v]
        dd >>= 1

    # assert depth[u] == depth[v]
    if u == v:
        return u

    for k in range(LV-1, -1, -1):
        pu = kprv[k][u]; pv = kprv[k][v]
        if pu != pv:
            u = pu; v = pv

    # assert kprv[0][u] == kprv[0][v]
    return kprv[0][u]


kprv = construct(prv)

Q,k = map(int, input().split())
k -= 1
for q in range(Q):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    a1 = lca(u, k, kprv, depth)
    a2 = lca(v, k, kprv, depth)
    aa1 = r[u] + r[k] - 2*r[a1]
    aa2 = r[k] + r[v] - 2*r[a2]
    print(aa1+aa2)

### FIXED CODE ###

from collections import deque
import sys
INF = 11414191981036436433-4

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

r = [INF]*n
que = deque([k])
r[k] = 0
while que:
    v = que.popleft()
    rr = r[v]
    for w,x in g[v]:
        if r[w] == INF:
            r[w] = rr + x
            que.append(w)
            
for i in range(q):
    d,e = map(int,input().split())
    print(r[d-1] + r[e-1])
import heapq

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.append([m+1,0])
ab = sorted(ab, key=lambda x:x[0])



max_values = [0 for _ in range(m)]
hq = []

possible_days = 0

for now in range(n+1):
    # if necessary day exceed the (now_day), extract the most valuable work
    while possible_days <= ab[now][0]:
        if len(hq) < 1:
            pass
        else:
            max_values[possible_days-2] = -heapq.heappop(hq)
        possible_days += 1
    heapq.heappush(hq, -ab[now][1])
print(sum(max_values))

### FIXED CODE ###

import heapq

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.append([m+1,0])
ab = sorted(ab, key=lambda x:x[0])



max_values = [0 for _ in range(m)]
hq = []

possible_days = 0

for now in range(n+1):
    # if necessary day exceed the (now_day), extract the most valuable work
    while possible_days <= ab[now][0]:
        if len(hq) < 1:
            pass
        else:
            max_values[possible_days-2] = -heapq.heappop(hq)
        possible_days += 1
    if possible_days-2 > m-1:
        break
    heapq.heappush(hq, -ab[now][1])
print(sum(max_values))
def powermod(a, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 0:
        return (powermod(a, p//2, mod) ** 2) % mod
    else:
        return ((powermod(a, (p-1)//2, mod) ** 2) % mod) * a % mod

def combinationmod(n,r):
    mod = 10 ** 9 + 7
    factorial = 1
    for i in range(n):
        factorial = (factorial * (i+1)) % mod
        if i+1 == r:
            fact_1 = factorial
        if i+1 == n-r:
            fact_2 = factorial
        if i+1 == n:
            fact_0 = factorial
    return fact_0 * powermod(fact_1,mod-2,mod) % mod * powermod(fact_2,mod-2,mod) % mod
    
X,Y = map(int,input().split())
if (X + Y) % 3 == 0:
    turns = (X + Y) // 3
    print(combinationmod(turns, min(X,Y) - turns))
else:
    print(0)

### FIXED CODE ###

def powermod(a, p, mod):
    if p == 0:
        return 1
    elif p % 2 == 0:
        return (powermod(a, p//2, mod) ** 2) % mod
    else:
        return ((powermod(a, (p-1)//2, mod) ** 2) % mod) * a % mod

def combinationmod(n,r):
    if r == 0 or n == r:
        return 1
    mod = 10 ** 9 + 7
    factorial = 1
    for i in range(n):
        factorial = (factorial * (i+1)) % mod
        if i+1 == r:
            fact_1 = factorial
        if i+1 == n-r:
            fact_2 = factorial
        if i+1 == n:
            fact_0 = factorial
    return fact_0 * powermod(fact_1,mod-2,mod) % mod * powermod(fact_2,mod-2,mod) % mod
    
X,Y = map(int,input().split())
if (X + Y) % 3 == 0 and X <= 2 * Y and 2 * X >= Y:
    turns = (X + Y) // 3
    print(combinationmod(turns, min(X,Y) - turns))
else:
    print(0)
def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)




def lcm(a,b):
    c=gcd(a,b);
    return a/c*b


n=int(input())
t=[int(input()) for lop in range(n)]
ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t)
print(int(ans))

### FIXED CODE ###



a,b,c,d=[int(i) for i in input().strip().split(' ')]

'''
入力は他の人のを見た
'''

max=0
min=0

if a < c :
    max=c
else :
    max=a
    
if b > d :
    min=d
else :
    min=b
if ( min - max ) > 0 :
    print( min - max )
else :
    print(0)
from sys import stdin

n = input()
r = input()

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)


### FIXED CODE ###

from sys import stdin

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

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)
a=list(map(lambda x:x,input().split()))
if(a[1]>a[0]):
  print(str(a[0])*a[1])
else:
  print(str(a[1])*a[0])

### FIXED CODE ###

a=list(map(lambda x:x,input().split()))
if(a[1]>a[0]):
  print(a[0]*int(a[1]))
else:
  print(a[1]*int(a[0]))
i = 1
while 1:
  n = input()
  if n == 0:
    break:
  print "Cace %d: %d" % (i, n)
  i++

### FIXED CODE ###

i = 1
while(1):
  x = int(raw_input())
  if x == 0:
    break
  print "Case %d: %d" %(i,x)
  i = i + 1