Harryxun/stf_run huggingface dataset:
import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c

tmp = [a_list, b_list, c_list]
happy = [0 for _ in range(N)]
select = [None for _ in range(N)]
ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select = [1, 2, 0, 2, 0, 1][ind]

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            max_h = max(max_h, tmp[k][i] + tmp[j][i-1] + happy[i-2])
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
    
        

    


### FIXED CODE ###

import sys
import numpy as np

N = int(sys.stdin.readline().strip())

a_list = [None for _ in range(N)]
b_list = [None for _ in range(N)]
c_list = [None for _ in range(N)]

for i in range(N):
    a, b, c = list(map(int, sys.stdin.readline().strip().split(" ")))
    a_list[i] = a
    b_list[i] = b
    c_list[i] = c
    
tmp = [a_list, b_list, c_list]
happy = [[0 for _ in range(3)] for __ in range(N)]

happy[0][0] = a_list[0]
happy[0][1] = b_list[0]
happy[0][2] = c_list[0]

for i in range(1, N):
    for j in range(3):
        #今日なにするか
        max_h = 0
        for k in range(3):
            #昨日なにしてたか
            if k == j:
                continue
            #print(i, j, k)
            #print(tmp)
            max_h = max(max_h, happy[i-1][k] + tmp[j][i])
        happy[i][j] = max_h

#print(happy)
print(max(happy[N-1]))
    

"""

happy = [0 for _ in range(N)]
select = [None for _ in range(N)]

ind = np.argmax([a_list[0], b_list[0], c_list[0]])
select[0] = [0, 1, 2][ind]
happy[0] = [a_list[0], b_list[0], c_list[0]][ind]

if N == 1:
    print(happy[0])
    sys.exit()

ind = np.argmax([a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]])
happy[1] = [a_list[0] + b_list[1], a_list[0] + c_list[1], b_list[0] + a_list[1], b_list[0] + c_list[1], c_list[0] + a_list[1], c_list[0] + b_list[1]][ind]
select[1] = [1, 2, 0, 2, 0, 1][ind]

if N == 2:
    print(happy[1])
    sys.exit()

for i in range(2, N):
    max_h = 0
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            if j == select[i-2]:
                continue
            if max_h < tmp[k][i] + tmp[j][i-1] + happy[i-2]:
                max_h = tmp[k][i] + tmp[j][i-1] + happy[i-2]
                select[i] = k
            #print(tmp[k][i-1], tmp[j][i-2])
    happy[i] = max_h

print(happy[N-1])
"""
import bisect

def main():
    N, M, K = map(int, input().split())
    A = [int(v) for v in input().split()]
    B = [int(v) for v in input().split()]
    if N < M:
        for _ in range(M-N):
            A.append(0)
    else:
        for _ in range(N-M):
            B.append(0)
    C = [v1+v2 for v1, v2 in zip(A, B)]
    ruisekiA = [0 for _ in range(len(C)+1)]
    ruisekiB = [0 for _ in range(len(C)+1)]
    ruisekiC = [0 for _ in range(len(C)+1)]
    for i in range(len(C)):
        ruisekiA[i + 1] = ruisekiA[i] + A[i]
        ruisekiB[i + 1] = ruisekiB[i] + B[i]
        ruisekiC[i + 1] = ruisekiC[i] + C[i]

    ans = 0
    # i番目までは両方読む
    for i in range(len(C)+1):
        tans = i * 2
        tk = K - ruisekiC[i]
        if tk < 0:
            continue

        # A だけ、Bだけで何冊読めるか考える
        idx_a = bisect.bisect_left(ruisekiA, tk + ruisekiA[i])
        if ruisekiA[idx_a] != tk + ruisekiA[i]:
            idx_a -= 1
        idx_b = bisect.bisect_left(ruisekiB, tk + ruisekiB[i])
        if ruisekiB[idx_b] != tk + ruisekiB[i]:
            idx_b -= 1
        ans = max(ans, max(tans+idx_a-i, tans+idx_b-i))
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import bisect


def main():
    N, M, K = map(int, input().split())
    A = [int(v) for v in input().split()]
    B = [int(v) for v in input().split()]
    ruisekiA = [0 for _ in range(N+1)]
    ruisekiB = [0 for _ in range(M+1)]
    for i in range(N):
        ruisekiA[i + 1] = ruisekiA[i] + A[i]
    for i in range(M):
        ruisekiB[i + 1] = ruisekiB[i] + B[i]

    ans = 0
    # A を i 個 使う
    for i in range(N+1):
        tans = i
        tk = K - ruisekiA[i]
        if tk < 0:
            break
        idx = bisect.bisect_left(ruisekiB, tk)
        if M+1 == idx or ruisekiB[idx] != tk:
            idx -= 1
        tans += idx
        ans = max(ans, tans)
    print(ans)


if __name__ == '__main__':
    main()
from _collections import defaultdict
import sys

class Graph:

    def __init__(self, n):
        self.g = defaultdict(list)
        self.dp = [-1 for i in range(n + 1)]


    def add_edge(self, x, y):
        self.g[x].append(y)

    def longest_path_util(self, node):

        # if node not in self.g:
        #     # print(node)
        #     return 0

        if self.dp[node] != -1:
            return self.dp[node]

        leaf = 1
        best_child = 0
        for neib in self.g[node]:
                leaf = 0
                best_child = max(best_child, self.longest_path_util(neib))

        if leaf != 0:

            self.dp[node] = 0

        else:
            self.dp[node] = best_child + 1

        return self.dp[node]


    def longest_path(self, n):

        for i in range(1, n + 1):

            if self.dp[i] == -1:
                self.longest_path_util(i)

        return max(self.dp)


n, k =  list(map(int, sys.stdin.readline().split()))
graph = Graph(n)
for _ in range(k):
    x, y = list(map(int, sys.stdin.readline().split()))
    graph.add_edge(x, y)

# print(graph.g)
print(graph.longest_path(n))






### FIXED CODE ###

from _collections import defaultdict
import sys
import collections
import sys
sys.setrecursionlimit(10**6)


def get_ls():
    return list(map(int, input().split()))


def longest_path_util(node, graph, dp):

    res = 0

    if dp[node] != -1:
        return dp[node]

    for neib in graph[node]:
        res = max(res, longest_path_util(neib, graph, dp) + 1)

    dp[node] = res

    return dp[node]


graph = defaultdict(list)

[n, k] = get_ls()

dp = [-1] * n

for _ in range(k):
    [x, y] = get_ls()
    graph[x - 1].append(y - 1)

ans = 0

for i in range(n):
    ans = max(ans, longest_path_util(i, graph, dp))

print(ans)
def maxreturn(t,n,a):
    ma=[0]*3
    b=[0]*n
    if t==n-1:
        for i in range(3):
           ma[i]=a[n-1][i]
    else:
      b=list(maxreturn(t+1,n,a))
      for i in range(3):
        for j in range(3):
            if i!=j:
                ma[i]=max(ma[i],a[t][i]+b[j])
                
    return ma
n=int(input())
a=[[0]*3]*n
for i in range(n):
    a[i]=list(map(int,input().split()))
ma=maxreturn(0,n,a)
print(max(ma))

### FIXED CODE ###

n=int(input())
f=[0]*n
a=list(map(int,input().split()))
f[0]=0
f[1]=abs(a[0]-a[1])
for i in range(2,n):
    a1=abs(a[i]-a[i-2])
    b=abs(a[i]-a[i-1])
    f[i]=min((f[i-2]+a1),(f[i-1]+b))
print(f[n-1])
n,k=map(int,input().split)
l=list(map(int,input().split))
l.sort()
print(sum(l[:k]))

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[:k]))
N,M,K=map(int,input().split())

A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]

a=0
b=0
ans=0
books=len(A)+len(B)
time=0


while(1):
    if a+b==books or time>=K:
        break
    
    elif (a!=N and b!=M):
        if A[a]>B[b]:
            if time+B[b]<=K:
                time+=B[b]
                b+=1
                ans+=1
            else:
                break
        
        elif B[b]>A[a]:
            if time+A[a]<=K:
                time+=A[a]
                a+=1
                ans+=1
            else:
                break
        
        else:
            if time+A[a]>K:
                break
            else:
                tmpa=a
                tmpb=b
                while(1):
                    tmpa+=1
                    tmpb+=1
                    if A[tmpa]>B[tmpb]:
                        time+=A[b]
                        b+=1
                        ans+=1
                        break
                    
                    elif A[tmpa]<B[tmpb]:
                        time+=A[a]
                        a+=1
                        ans+=1
                        break
            
    elif a==N:
        time+=B[b]
        b+=1
        ans+=1
    elif b==M:
        time+=A[a]
        a+=1
        ans+=1
print(ans)
        

### FIXED CODE ###

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

a=[0]
b=[0]

tmp_a=0
tmp_b=0
for i in A:
    tmp_a+=i
    a.append(tmp_a)

for i in B:
    tmp_b+=i
    b.append(tmp_b)
    

ans,j=0,M
for i in range(N+1):#i…A台の本数
    if a[i]>K:
        break
    while(1):
        if b[j]<=(K-a[i]):
            break
        j-=1
    ans=max(ans,i+j)
    
print(ans)
import sys
input = sys.stdin.buffer.readline

H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
SIZE = 10

AB = [[0 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        AB[i][j] = abs(A[i][j] - B[i][j])


dp = [[0 for _ in range(W)] for _ in range(H)]

dp[0][0] = 1 << (SIZE + AB[i][j] - 1) | 1 << (SIZE - AB[i][j] - 1)
for i in range(H):
    for j in range(W):
        dp[i][j] |= (dp[i - 1][j] << AB[i][j]) | (dp[i - 1][j] >> AB[i][j])
        dp[i][j] |= (dp[i][j - 1] << AB[i][j]) | (dp[i][j - 1] >> AB[i][j])

for i in range(SIZE):
    if (dp[-1][-1] >> (i + SIZE)) & 1:
        print(i)
        exit()

### FIXED CODE ###

H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]

dp = [[0 for _ in range(W)] for _ in range(H)]

SIZE = 20000

D = abs(A[0][0] - B[0][0])
dp[0][0] = 1 << SIZE - D | 1 << SIZE + D
#print("dp:", dp)

for i in range(H):
  for j in range(W):
    D = abs(A[i][j] - B[i][j])
    dp[i][j] |= dp[i - 1][j] << D | dp[i - 1][j] >> D
    dp[i][j] |= dp[i][j - 1] << D | dp[i][j - 1] >> D

#for i in range(H):
#  a = list(map(lambda x: bin(x)[2::], dp[i]))
#  print(a)

for i in range(SIZE):
  if (dp[-1][-1] >> (SIZE + i)) & 1:
    print(i)
    exit()
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
at = list(map(list, zip(*a)))

if a != at: 
    print(-1)
    exit(0)

import itertools
from array import array

aa = array('L', itertools.chain(*a))

ans = 0
for u in range(n):
    un = u * n
    for v in range(u + 1, n): 
        dist = aa[un + v]
        cd = min([aa[un + i] + aa[i * n + v] for i in range(n) if i != u and i !=v])
        if dist > cd:
            print(-1)
            exit(0)
        if dist < cd:
            ans += dist

print(ans)

### FIXED CODE ###

import numpy as np

n = int(input())
a = np.array([np.array(input().split(), dtype=np.uint64) for _ in range(n)], dtype=np.uint64)

for i in range(n):
  a[i,i] = 1e9 + 1

ans = 0
for u in range(n):
    for v in range(u + 1, n): 
        dist = a[u,v]
        cd = np.min(a[u] + a[v])
        if dist > cd:
            print(-1)
            exit(0)
        if dist < cd:
            ans += dist
 
print(int(ans))
#001
a,op,b = input().split(" ")
a = int(a)
b = int(b)
if op=="+":
    print(a+b)
else:
    print(a-b)

### FIXED CODE ###

#001
a,op,b = input().split(" ")
a = int(a)
b = int(b)
if op=="+":
    print(a+b)
else:
    print(a-b)
N = int(input())
a = list(input().split())
for i in range(N):
  	s = str(i+1)
    print(a.count(s))

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
li = [0] * N

for i in range(N-1):
    li[a[i]-1] = li[a[i]-1] + 1

for i in range(N):
    print(li[i])
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K = map(int, readline().split())
A = list(map(int,readline().split()))
MOD = 10**9 +7
B = []
C = []
BC = []
for a in A:
    if a >= 0:
        B.append(a)
        BC.append(a)
    else:
        C.append(-a)
        BC.append(-a)
ans = 1
if K % 2 == 1 and len(B) == 0:
    C = sorted(C)
    for i in range(K):
        ans *= C[i]
        ans %= MOD
    ans *= -1
    ans %= MOD
    print(ans)
    sys.exit()
    
negs_p = 0
non_negs_p = 0
for i in range(K):
    if negs_p == len(C):
        non_negs_p += 1
    elif non_negs_p == len(B):
        negs_p += 1
    elif C[negs_p] > B[non_negs_p]:
        negs_p += 1
    else:
        non_negs_p += 1
B = sorted(B,reverse = True)
C = sorted(C,reverse = True)
BC = sorted(BC,reverse = True)

for i in range(K):
    ans *= BC[i]
    ans %= MOD
    
if negs_p % 2 == 1 and N != K:
    if negs_p == len(C) and non_negs_p == len(B):
        pass
    elif negs_p == len(C):      
        b,c = C[negs_p-1],B[non_negs_p]
        ans = ans // b * c % MOD
    elif non_negs_p == len(B):
        a,d = C[negs_p],B[non_negs_p-1]
        ans = ans // d * a % MOD
    else:
        a,b,c,d = C[negs_p],C[negs_p-1],B[non_negs_p],B[non_negs_p-1]
        if a*b > c*d:
            ans = ans // d * a % MOD
        else:
            ans = ans // b * c % MOD
print(ans) 

### FIXED CODE ###

MOD = (10 ** 9) + 7
n, k  = map(int, input().split())
a = list(map(int, input().split()))
 
negs = [-x for x in a if x < 0]
non_negs = [x for x in a if x >= 0]
 
if len(non_negs) == 0 and k % 2 == 1:
    negs.sort()
    ans = 1
    for i in range(k):
        ans = ans * -negs[i] % MOD
    print(ans)
    exit()
 
negs_p, non_negs_p = 0, 0
 
negs.sort(reverse = True)
non_negs.sort(reverse = True)
 
for i in range(k):
    if negs_p == len(negs):
        non_negs_p += 1
    elif non_negs_p == len(non_negs):
        negs_p += 1
    elif negs[negs_p] > non_negs[non_negs_p]:
        negs_p += 1
    else:
        non_negs_p += 1
 
if negs_p % 2 == 0 or k == n:
    ans = 1
    for i in range(negs_p):
        ans = ans * -negs[i] % MOD
    for i in range(non_negs_p):
        ans = ans * non_negs[i] % MOD
    print(ans)
    exit()
 
if negs_p == len(negs) or non_negs_p == 0:
    negs_p -= 1
    non_negs_p += 1
    ans = 1
    for i in range(negs_p):
        ans = ans * -negs[i] % MOD
    for i in range(non_negs_p):
        ans = ans * non_negs[i] % MOD
    print(ans)
    exit()
 
if non_negs_p == len(non_negs) or negs_p == 0:
    negs_p += 1
    non_negs_p -= 1
    ans = 1
    for i in range(negs_p):
        ans = ans * -negs[i] % MOD
    for i in range(non_negs_p):
        ans = ans * non_negs[i] % MOD
    print(ans)
    exit()
 
 
a = negs[negs_p - 1]
b = negs[negs_p]
c = non_negs[non_negs_p - 1]
d = non_negs[non_negs_p]
 
if a * b > c * d:
    negs_p += 1
    non_negs_p -= 1
else:
    negs_p -= 1
    non_negs_p += 1
 
ans = 1
for i in range(negs_p):
    ans = ans * -negs[i] % MOD
for i in range(non_negs_p):
    ans = ans * non_negs[i] % MOD
print(ans)
# -*- coding: utf-8 -*-

# AtCoder Grand Contest
# Problem A

if __name__ == '__main__':
    s = list(input())
    alphabets = [chr(ord('a') + i) for i in range(26)]

    if len(s) == 26:
        if s == alphabets[::-1]:
            print(-1)
        else:
            common_alphabet = ''

            for i in range(len(s)):
                if s[:i] == alphabets[:i]:
                    common_alphabet = s[:i]
            new_s = alphabets.index(''.join(common_alphabet[-2:-1]))
            print(''.join(common_alphabet[:-1]) + alphabets[new_s + 2])
    else:
        sorted_s = sorted(s)
        diff = set(alphabets) - set(sorted_s)
        candidate = sorted(diff)[0]
        print(''.join(s + [candidate]))


### FIXED CODE ###

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

# AtCoder Grand Contest
# Problem A


# See:
# https://img.atcoder.jp/agc022/editorial.pdf
# https://agc022.contest.atcoder.jp/submissions/2286541
def determine_next_word(given_word: str) -> str:
    while given_word:
        pi = ascii_lowercase.index(given_word[-1])
        given_word = given_word[:-1]

        for character in ascii_lowercase[pi + 1:]:
            if character not in given_word:
                return given_word + character


if __name__ == '__main__':
    from string import ascii_lowercase
    s = input()

    if len(s) < 26:
        result = [s + character for character in ascii_lowercase if character not in s][0]
        print(result)
    elif s == ascii_lowercase[::-1]:
        print(-1)
    else:
        print(determine_next_word(given_word=s))
n,m = map(int,input().split())
aa = list(map(int, input().split()))
aa.sort()
bc_list = [list(map(int, input().split())) for i in range(m)]
bc_list = sorted(bc_list, key=lambda x:x[1])

p = 0
for bc in bc_list[::-1]:
    for i in range(bc[0]):
        if aa[p] < bc[1]:
            aa[p] = bc[1]
            p += 1
        else:
            break
    else:
        continue
    break

print(sum(aa))

### FIXED CODE ###

n,m = map(int,input().split())
aa = list(map(int, input().split()))
aa.sort()
bc_list = [list(map(int, input().split())) for i in range(m)]
bc_list = sorted(bc_list, key=lambda x:x[1])

p = 0
for bc in bc_list[::-1]:
    for i in range(bc[0]):
        if aa[p] < bc[1]:
            aa[p] = bc[1]
            p += 1
            if p > len(aa) - 1:
                break
        else:
            break
    else:
        continue
    break

print(sum(aa))
# -*- coding: utf-8 -*-
import itertools

N = input()

A = map(int, raw_input().split())
B = map(int, raw_input().split())
C = map(int, raw_input().split())


for i, j, k in itertools.product(range(N), range(N), range(N)):
    if A[i]<B[j]<C[k]:
            count+=1
    else:
        continue
print count


### FIXED CODE ###

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

C1=raw_input()
C2=raw_input()

if C1[0]!=C2[2]:
    print 'NO'
elif C1[1]!=C2[1]:
    print 'NO'
elif C1[2]!=C2[0]:
    print 'NO'
else:
    print 'YES'
import sys
input = sys.stdin.readlineN,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]
 
root = list(range(N+1))
comp_size = [1] * (N+1)
 
def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z
 
def merge(x,y):
  rx = find_root(x)
  ry = find_root(y)
  if rx == ry:
    return 0
  sx = comp_size[rx]
  sy = comp_size[ry]
  if sx > sy:
    root[ry] = rx
    comp_size[rx] += sy
  else:
    root[rx] = ry
    comp_size[ry] += sx
  return sx * sy
 
answer = []
x = N*(N-1)//2
for a,b in AB[::-1]:
  answer.append(x)
  x -= merge(a,b)
 
for a in answer[::-1]:
  print(a)
import sys
input = sys.stdin.readline

# 逆再生
# 連結成分がくっつくときに加点

N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]

root = list(range(N+1))
comp_size = [1] * (N+1)

def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z

def merge(x,y):
  rx = find_root(x)
  ry = find_root(y)
  if rx == ry:
    return 0
  sx = comp_size[rx]
  sy = comp_size[ry]
  if sx > sy:
    root[ry] = rx
    comp_size[rx] += sy
  else:
    root[rx] = ry
    comp_size[ry] += sx
  return sx * sy

answer = []
x = N*(N-1)//2
for a,b in AB[::-1]:
  answer.append(x)
  x -= merge(a,b)

for a in answer[::-1]:
  print(a)

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(M)]
 
root = list(range(N+1))
comp_size = [1] * (N+1)
 
def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z
 
def merge(x,y):
  rx = find_root(x)
  ry = find_root(y)
  if rx == ry:
    return 0
  sx = comp_size[rx]
  sy = comp_size[ry]
  if sx > sy:
    root[ry] = rx
    comp_size[rx] += sy
  else:
    root[rx] = ry
    comp_size[ry] += sx
  return sx * sy
 
answer = []
x = N*(N-1)//2
for a,b in AB[::-1]:
  answer.append(x)
  x -= merge(a,b)
for a in answer[::-1]:
  print(a)
A, B, C, D, E = map(int, input().split())
if A == 0:
    print(1)
elif B == 0:
    print(2)
elif C == 0:
    print(3)
elif D == 0:
    print(4)
else E == 0:
    print(5)


### FIXED CODE ###

A, B, C, D, E = map(int, input().split())
if A == 0:
    print(1)
elif B == 0:
    print(2)
elif C == 0:
    print(3)
elif D == 0:
    print(4)
elif E == 0:
    print(5)
from math import factorial as fc

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

for i in range(1,K+1):
    bunbo = fc(i)*fc(N-K+1-i)*fc(i-1)*fc(K-i)
    bunsi = fc(N-K+1)*fc(K-1)
    print(bunsi//bunbo)

### FIXED CODE ###

from math import factorial as fc

N,K = map(int,input().split())
MOD = (10 ** 9)+ 7

for i in range(1,K+1):
    if N-K+1<i:
        print(0)
        continue
    bunbo = fc(i)*fc(N-K+1-i)*fc(i-1)*fc(K-i)
    bunsi = fc(N-K+1)*fc(K-1)
    print((bunsi//bunbo)%MOD)
x,y=map(int,input().split())

for i in range(n+1):
  if i*4+(n-i)*2==y:
    print("Yes")
    
else:
  print("No")

### FIXED CODE ###

x,y=map(int,input().split())
 
for i in range(x+1):
  if i*4+(x-i)*2==y:
    print("Yes")
    break   
else:
  print("No")
a = list(int(input()))
b = 0
for i in a:
    b += i
print(b)

### FIXED CODE ###

a = list(input())
b = 0
for i in a:
    b += int(i)
print(b)
def main():
    s = list(input())
    k = int(input())

    for i in range(len(s)):
        mod = 26-(ord(s[i])-97)%26
        if k >= mod:
            k -= mod
            s[i] = 'a'
        if k == 0:
            break
    
    if k > 0:
        mod = (ord(s[-1])-97)%26+k
        s[-1] = chr(mod+97)
    print(''.join(s))

if __name__ == '__main__':
    main()



### FIXED CODE ###

def main():
    s = list(input())
    k = int(input())

    for i in range(len(s)-1):
        if s[i] == 'a':
            continue
        else:
            mod = 26-(ord(s[i])-97)%26
            if k >= mod:
                k -= mod
                s[i] = 'a'
            if k == 0:
                break
    
    if k > 0:
        mod = ((ord(s[-1])-97)+k)%26
        s[-1] = chr(mod+97)
    print(''.join(s))

if __name__ == '__main__':
    main()
while 1:
	n = input()
	if n == 0: break
	item = {}
	for i in range(n):
		n,c = map(str,raw_input().split())
		item[n] = int(c)
	m = input()
	recipes = [map(str,raw_input().split()) for i in range(m)]
	recipes = sorted(recipes, key = lambda x:item[x[0]])
	for recipe in recipes:
		needs = recipe[2:]
		cost = 0
		for need in needs:
			cost += item[need]
		item[recipe[0]] = min(cost, item[recipe[0]])
	print item[raw_input()]

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	item = {}
	for i in range(n):
		name,cost = raw_input().split()
		item[name] = int(cost)
	for i in range(input()):
		recipe = raw_input().split()
		cost = sum(item[name] if name in item else 0 for name in recipe[2:])
		item[recipe[0]] = min(cost, item[recipe[0]])
	print item[raw_input()]
import sys
N = int(sys.stdin.readline())

if N == 1:
    print('Hello World')
    sys.exit()

if N == 2:
    ans = 0
    for value in sys.stdin.readlines():
        ans += value

    print(ans)


### FIXED CODE ###

import sys
N = int(sys.stdin.readline())

if N == 1:
    print('Hello World')
    sys.exit()

if N == 2:
    ans = 0
    for value in sys.stdin.readlines():
        ans += int(value)

    print(ans)