Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from operator import mul
from functools import reduce

X,Y = map(int,input().split()[:2])

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

x_tmp=X
y_tmp=Y

x_count=0
y_count=0

while x_tmp*2 != y_tmp:
    x_tmp-=2
    y_tmp-=1
    x_count+=1

y_count = y_tmp//2

sum = x_count + y_count

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, sum + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ret = cmb(sum,y_count,mod)
print(ret)


### FIXED CODE ###

from operator import mul
from functools import reduce

X,Y = map(int,input().split()[:2])

if (X + Y) % 3 or not (X <= 2*Y and Y <= 2*X):
    print(0)
    exit()

x_tmp=X+1
y_tmp=Y+2

x_count=0
y_count=0

while x_tmp*2 != y_tmp:
    x_tmp-=2
    y_tmp-=1
    x_count+=1

y_count = y_tmp//2 - 1

sum = x_count + y_count

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, sum + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ret = cmb(sum,x_count,mod)
print(ret)
### BUGGY CODE ###

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

count = 0
for i in range(N*K-1):
    for j in range(i+1, N*K):
        B_i = A[i % N]
        B_j = A[j % N]
        if B_i > B_j:
            count += 1
        count %= 1000000007
print(count)

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int,input().split()))
MOD = 1000000007
count = 0
for i in range(N-1):
    for j in range(i+1, N):
        if A[i] > A[j]:
            count += 1
first = (count * K) % 1000000007

count2 = 0
for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            count2 += 1

ans = ((count * K) + (count2 * K * (K-1) // 2)) % MOD
#second = (count2 * (K*(K-1)/2)%MOD) % MOD

#print(int((first+second)%MOD))
print(ans)
### BUGGY CODE ###

from collections import defaultdict

def main():
  s = input()
  n = len(s)

  mod = 2019

  t_vals = [0] * n
  t_vals[-1] = int(s[-1])
  for i in range(2, n + 1):
    t_vals[-i] = t_vals[-i + 1] + int(s[-i]) * 10 ** (i - 1)

  counts = defaultdict(int)
  counts[0] = 1
  for t in t_vals:
    counts[t % mod] += 1

  ans = 0
  for count in counts.values():
    ans += count * (count - 1) // 2

  print(ans)

main()


### FIXED CODE ###


def main():
  s = map(int, input()[::-1])

  mod = 2019

  counts = [0] * mod
  counts[0] = 1
  t = 0
  x = 1
  for num in s:
    t = (t + num * x) % mod
    counts[t] += 1
    x = (x * 10) % mod

  ans = 0
  for count in counts:
    if count > 1:
      ans += count * (count - 1) // 2

  print(ans)

main()
### BUGGY CODE ###

N = int(input())
a = list(map(int,input().split()))
I = 0
J = 0
K = 0
for i in range(N):
    if a[i] == 3:
        I += 1
    elif a[i] == 2:
        J += 1
    elif a[i] == 1:
        K += 1

dp = [[[-1.0 for i in range(N+1)] for i in range(N+1)] for i in range(N+1)]
dp[0][0][0] = 0

def cal(i,j,k):
    if dp[i][j][k] != -1:
        return dp[i][j][k]
    else:
        res = 0
        if i != 0:
            res += i*cal(i-1,j+1,k)
        if j != 0:
            res += j*cal(i,j-1,k+1)
        if k != 0:
            res += k*cal(i,j,k-1)
        res += N
        res /= i+j+k
        dp[i][j][k] = res
        return res

print(cal(I,J,K))

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
I = 0
J = 0
K = 0
for i in range(N):
    if a[i] == 1:
        I += 1
    if a[i] == 2:
        J += 1
    if a[i] == 3:
        K += 1

dp = [[[0.0]*(N+2) for _ in range(N+2)] for _ in range(N+2)]
for k in range(K+1):
    for j in range(J+K+1):
        if j+k > N:
            break
        for i in range(N+1):
            S = i+j+k
            if S > N:
                break
            if S == 0:
                continue
            dp[i][j][k] = (i*dp[i-1][j][k]+j*dp[i+1][j-1][k]+k*dp[i][j+1][k-1]+N)/S
print(dp[I][J][K])
### BUGGY CODE ###

import sys


def main():
    input = sys.stdin.readline

    N, W = map(int, input().split())
    dp = [0] * (W + 1)

    WV = (map(int, input().split()) for _ in range(N))

    for w, v in WV:
        for j in range(W, w - 1, -1):
            dp[j] = max(dp[j], dp[j - w] + v)

    print(dp[-1])


main()


### FIXED CODE ###

import sys


def main():
    input = sys.stdin.readline

    N, W = map(int, input().split())
    dp = [0] * (W + 1)

    WV = (map(int, input().split()) for _ in range(N))

    for w, v in WV:
        for j in range(W, w - 1, -1):
            tmp = dp[j - w] + v
            if tmp > dp[j]:
                dp[j] = tmp

    print(dp[-1])


main()
### BUGGY CODE ###

N=int(input())
S=input().split()
list=[]
for i in range(0,N):
  list.append(int(S[i]))
list.sort()
ans=0
for i in range(0,N-2):
  a=list[i]
  for j in range(i+1,N-1):
    b=list[j]
    flag=0
    for k in range(j+1,N):
      if list[k]>=a+b:
        break
      if k==N-1:
        flag=1
    ans=ans+k-j-1
    if flag==1:
      ans=ans+1
print(ans)

### FIXED CODE ###

import bisect
n = int(input())
l = sorted(list(map(int,input().split())))
 
count = 0
for i in range(n):
  for j in range(i+1,n):
    index = bisect.bisect_left(l,l[i]+l[j])
    count += index - j - 1
    
print(count)
### BUGGY CODE ###

s=list(input())

c=0
for i in range(len(s)):
    j=i
    while s[j:j+3]==["A","B","C"]:
        s[j:j+3]=["B","C","A"]
        c+=1
        j-=1
        if j==-1:
            break

print(c)

### FIXED CODE ###

s=input()

s=s.replace("BC","D")

count=0

c=0
while c<len(s):
    if s[c]=="A" or s[c]=="D":
        d=c
        while s[d]=="A" or s[d]=="D":
            d+=1
            if d==len(s):
                break
        an=0
        for i in range(c,d):
            if s[i]=="A":
                an+=1
            else:
                count+=an
        c=d
    else:
        c+=1

print(count)
### BUGGY CODE ###

N=int(input())
people=list(input())
List=[]

for i in range(N):
    #向きを変える人数
    List.append(people[:i].count('W')+people[i:].count('E'))

print(min(List))

### FIXED CODE ###

N=int(input())
people=list(input())

Wlist=[0]*(N+1)
Elist=[0]*(N+1)
for i in range(N):
    Wlist[i+1]=Wlist[i]
    if people[i]=='W':
        Wlist[i+1]+=1
    Elist[i+1]=Elist[i]
    if people[i]=='E':
        Elist[i+1]+=1

#print(Wlist)
#print(Elist)

List=[]
for i in range(N):
    List.append(Wlist[i]+(Elist[N]-Elist[i+1]))

print(min(List))
### BUGGY CODE ###

N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))

### FIXED CODE ###

N=int(input())
s=set()
for i in range(N):s^={input()}
print(len(s))
### BUGGY CODE ###

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

dist = []
dist.append([k-a[len(a)-1]+a[0], a[1]-a[0]])

for num in range(1, len(a)):
  if num == len(a) - 1:
    dist.append([a[num]-a[num-1], k-a[num]+a[0]])
  else:
  	dist.append([a[num]-a[num-1], a[num+1]-a[num]])
#print(dist)

start = 0
result = []
while(start!=len(dist)):
  right = 0
  left = 0
  for x in range(0, len(dist)-1):
    n = start+x
    if n > len(dist)-1:
      n = (len(dist) - x - start) * -1
    right += dist[n][1]
  for y in range(0, len(dist)-1):
    n = start-y
    if n < 0:
      n = len(dist)-y
    left += dist[n][0]
  result.append(min(right, left))
#  print(right, left)
  start += 1
  
print(min(result))

### FIXED CODE ###

import numpy as np

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

dist = []
dist.append(a[1]-a[0])

for num in range(1, len(a)):
  if num == len(a) - 1:
    dist.append(k-a[num]+a[0])
  else:
    dist.append(a[num+1]-a[num])
#print(dist)
dist = np.array(dist)

#min_index = np.where(dist == dist.min())[0]
s = np.sum(dist)
result = []
for start_index in range(0, len(dist)):
  if start_index == 0:
    result.append(s - dist[len(dist)-1])
    result.append(s - dist[start_index+1])
  elif start_index == len(dist)-1:
    result.append(s - dist[start_index-1])
    result.append(s - dist[0])
  else:
    result.append(s - dist[start_index-1])
    result.append(s - dist[start_index+1])
print(min(result))
### BUGGY CODE ###

n = int(input())
s = input()

kset = []
cnt = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    k2 = s[i] + s[j]
    if k2 not in kset:
      kset.append(k2)
      k3 = set(list(s[j+1:]))
      cnt += len(k3)

print(cnt)



### FIXED CODE ###

n = int(input())
s = input()

cnt = 0
for i in range(10):
  k1 = s.find(str(i))
  if k1 == -1:
    continue
  for j in range(10):
    k2 = s[k1+1:].find(str(j))
    if k2 == -1:
      continue

    k3 = set(list(s[k1+k2+2:]))
    cnt += len(k3)

print(cnt)
### BUGGY CODE ###

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

a = []
for i in range(q):
  a.append(int(input()))

p = [k for _ in range(n)]

for s in a:
  p = list(map(lambda x: x -1, p))
  p[s-1] = p[s-1] + 1

for i in p:
  if i > 0:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

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

a = []
for i in range(q):
  a.append(int(input()))

p = [k for _ in range(n)]
p = list(map(lambda x: x -q, p))
for s in a:
  
  p[s-1] = p[s-1] + 1

for i in p:
  if i > 0:
    print('Yes')
  else:
    print('No')
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
for k in range(n):
    c=0
    b=a.copy()
    a.pop(k)
    for i in range(len(a)):
        for j in range(i+1,len(a)):
            if a[i]==a[j]:
                c+=1
    print(int(c))
    a=b

### FIXED CODE ###

import collections as cl
import numpy as np
n=int(input())
a=list(map(int,input().split()))
b=cl.Counter(a)
a_=np.array(list(b.values()))
c=np.sum(a_*(a_-1)/2)
for k in range(n):
    x=b[a[k]]
    if x==2:
        print(int(c-1))
    elif x==1:
        print(int(c))
    else:
        print(int(c-(x-1)))
### BUGGY CODE ###

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

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = input().split()
    w[i], v[i] = int(w[i]), int(v[i])

def func(N, W):
    dp = [0] * (W+1)
    for i in range(N):
        for j in range(W, w[i]-1, -1):
            a = dp[j-w[i]] + v[i]
            if dp[j] < a:
                dp[j] = a
    return dp[W]

print(func(N, W))

### FIXED CODE ###

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

dp = [0] * (W+1)
for i in range(N):
    w, v = map(int, input().split())
    for j in range(W, w-1, -1):
        a = dp[j-w]+v
        if dp[j] < a:
            dp[j] = a

print(dp[W])
### BUGGY CODE ###

N = int(input())
S = [input() for i in range(N)]

S_set = set(S)
Cnt = []
max = 0
for i in S_set:
    Cnt.append([i, S.count(i)])
    if max < S.count(i):
        max = S.count(i)

Cnt_l = sorted(Cnt, reverse = False , key=lambda x: x[0])

x = [Cnt_l[i][0] for i in range(len(Cnt_l)) if Cnt_l[i][1] == max]
for i in x:
    print(i)

### FIXED CODE ###

from collections import Counter

N = int(input())
S = [input() for i in range(N)]

c = Counter(S)
max_c = max(c.values())
#キーの昇順でソート
c_sorted = sorted(c.items(), key = lambda x:x[0])
for v in c_sorted:
    if v[1] == max_c:
        print(v[0])
### BUGGY CODE ###

import sys
input=sys.stdin.readline

def main():
    r,c,k=map(int,input().split())
    dp=[[[0 for kk in range(4)] for jj in range(c+1)] for ii in range(r+1)]

    g=[[0 for j in range(c)] for i in range(r)]
    for i in range(k):
        rr,cc,v=map(int,input().split())
        rr-=1
        cc-=1
        g[rr][cc]=v
    for i in range(1,r+1):
        for j in range(1,c+1):
            for k in range(4):
                dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k])#,dp[i][j-1][k])
                dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][k])
                if g[i-1][j-1]>0:
                    if k>0:
                        if dp[i][j][k]<dp[i][j-1][k-1]+g[i-1][j-1]:
                            dp[i][j][k]=dp[i][j-1][k-1]+g[i-1][j-1]
                    if dp[i][j][1]<dp[i-1][j][k]+g[i-1][j-1]:
                        dp[i][j][1]=dp[i-1][j][k]+g[i-1][j-1]
    print(max(dp[r][c]))
if __name__=='__main__':
    main()



### FIXED CODE ###

import sys
input=sys.stdin.readline

def main():
    r,c,k=map(int,input().split())
    dp=[[[0 for jj in range(c+1)] for ii in range(r+1)] for kk in range(4)]

    g=[[0 for j in range(c)] for i in range(r)]
    for i in range(k):
        rr,cc,v=map(int,input().split())
        rr-=1
        cc-=1
        g[rr][cc]=v
    for i in range(1,r+1):
        for j in range(1,c+1):
            for k in range(4):
                dp[k][i][j]=max(dp[k][i][j],dp[k][i][j-1])#,dp[i][j-1][k])
                dp[0][i][j]=max(dp[0][i][j],dp[k][i-1][j])
                if g[i-1][j-1]>0:
                    if k>0:
                        if dp[k][i][j]<dp[k-1][i][j-1]+g[i-1][j-1]:
                            dp[k][i][j]=dp[k-1][i][j-1]+g[i-1][j-1]
                    if dp[1][i][j]<dp[k][i-1][j]+g[i-1][j-1]:
                        dp[1][i][j]=dp[k][i-1][j]+g[i-1][j-1]
    print(max(dp[0][r][c],dp[1][r][c],dp[2][r][c],dp[3][r][c]))
if __name__=='__main__':
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N, M, L = map(int, input().split())
V = {i: [] for i in range(1,N+1)}
for _ in range(M):
    a, b, c = map(int, input().split())
    V[a].append((b, c))
    V[b].append((a, c))
INF = float('inf')
VD = {i: {i: INF for i in range(1,N+1)} for i in range(1,N+1)}
for i, e in V.items():
    for (j, c) in e:
        VD[i][j] = c
        VD[j][i] = c
for i in range(1,N+1):
    VD[i][i] = 0

for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            if VD[i][j] > VD[i][k] + VD[k][j]:
                VD[i][j] = VD[i][k] + VD[k][j]

W = {i: [] for i in range(1,N+1)}
for i, v in VD.items():
    for j, d in v.items():
        if d <= L:
            W[i].append(j)
            W[j].append(i)

WD = {i: {i: INF for i in range(1,N+1)} for i in range(1,N+1)}
for i, e in W.items():
    for j in e:
        WD[i][j] = 1
        WD[j][i] = 1
for i in range(1,N+1):
    WD[i][i] = 0

for k in range(1,N+1):
    for i in range(1,N+1):
        for j in range(1,N+1):
            if WD[i][j] > WD[i][k] + WD[k][j]:
                WD[i][j] = WD[i][k] + WD[k][j]

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    print(WD[s][t]-1 if WD[s][t] < INF else -1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, M, L = map(int, input().split())
INF = float('inf')
VD = [[INF] * N for _ in range(N)]
for _ in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    VD[a][b] = c
    VD[b][a] = c
for i in range(N):
    VD[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            if VD[i][j] > VD[i][k] + VD[k][j]:
                VD[i][j] = VD[i][k] + VD[k][j]

WD = [[INF] * N for _ in range(N)]
for i in range(N):
    WD[i][i] = 0
    for j in range(i+1,N):
        d = VD[i][j]
        if d <= L:
            WD[i][j] = 1
            WD[j][i] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            if WD[i][j] > WD[i][k] + WD[k][j]:
                WD[i][j] = WD[i][k] + WD[k][j]

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    print(WD[s-1][t-1]-1 if WD[s-1][t-1] < INF else -1)
### BUGGY CODE ###

L, R = map(int,input().split())
MOD = 2019
ans = float("inf")
for i in range(L,min(L+2019,R+1)):
  for j in range(i+1,min(i+2019,R+1)):
    ans = min(ans,((i % MOD) * (j % MOD)) % MOD)
print(ans)

### FIXED CODE ###

L, R = map(int,input().split())
MOD = 2019
ans = float("inf")
for i in range(L,min(L+2019,R+1)):
  for j in range(i,min(i+2019,R+1)):
    if i == j:
      continue
    ans = min(ans,i * j % MOD)
print(ans)
### BUGGY CODE ###

k_num, s_num = map(int, input().split())

cnt = 0
for x in range(k_num+1):
    for y in range(k_num+1):
        for z in range(k_num+1):
            if x + y + z == s_num:
                cnt += 1

print(cnt)

### FIXED CODE ###

k_num, s_num = map(int, input().split())

cnt = 0
for x in range(k_num+1):
    l = s_num - x
    for y in range(k_num+1):
        z = l - y
        if 0 <= z <= k_num:
            cnt += 1

print(cnt)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n = int(input())
s = input()
ans = 0

for i in range(1000):
    cnt = 0
    if i < 100:
        if i < 10:
            match = '00' + str(i)
        else:
            match = '0' + str(i)
    else:
        match = str(i)

    for j in range(n):
        if s[j] == match[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
s = input()
ans = 0

for i in range(1000):
    cnt = 0
    if i < 100:
        if i < 10:
            match = '00' + str(i)
        else:
            match = '0' + str(i)
    else:
        match = str(i)

    for S in s:
        if S == match[cnt]:
            cnt += 1

        if cnt == 3:
            ans += 1
            break

print(ans)
### BUGGY CODE ###

N = int(input())
S = list(str(input()))
from collections import Counter

def solve(s, lis, dis):
    if len(lis)==1:
        i = lis[0]
        c = Counter(s)
        if len(s)>dis:
            if s[dis]==i:
                return c[i]-1
            else:
                return c[i]
        else:
            return c[i]
    elif len(lis)==2:
        ans = 0
        p, q = lis
        for i, j in enumerate(s):
            if j==p:
                ans += solve(s[i:], [q], i)
            elif j==q:
                ans += solve(s[i:], [p], i)
        return ans
    else:
        ans = 0
        p, q, r = lis
        for i, j in enumerate(s):
            if j==p:
                ans += solve(s[i:], [q, r], i)
            elif j==q:
                ans += solve(s[i:], [p, r], i) 
            elif j==r:
                ans += solve(s[i:], [p, q], i) 
        return ans

print(solve(S, ('R', 'G', 'B'), 0))

### FIXED CODE ###

N = int(input())
S = list(str(input()))
from collections import Counter

c = Counter(S)
ans = c['B']*c['G']*c['R']
for i in range(N-1):
    for j in range(i, N):
        if S[i]==S[j]:
            continue
        elif i+(j-i)*2>N-1:
            break
        s = S[i+(j-i)*2]
        if s!=S[i] and s!=S[j]:
            ans -= 1
print(ans)
### BUGGY CODE ###

import math
K=int(input())
divisor=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            divisor+=math.gcd(math.gcd(a,b),c)
print(divisor)

### FIXED CODE ###

import math
K=int(input())
print(sum(math.gcd(math.gcd(a,b),c) for a in range(1,K+1) for b in range(1,K+1) for c in (range(1,K+1))))
### BUGGY CODE ###

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

count = 0
s = [''.join(sorted(str(i))) for i in s]
s_set = list(set(s))
for i in range(len(s_set)):
    s_count = s.count(s_set[i])
    if s_count > 1:
        count += (s_count * (s_count - 1)) // 2
print(count)

### FIXED CODE ###

N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
s.sort()
count = 0
num = 1
for i in range(N-1):
    if s[i] == s[i+1]:
        num += 1
    else:
        count += num * (num - 1) // 2
        num = 1
print(count + num * (num - 1) // 2)
### BUGGY CODE ###

import collections
S = list(input())
Q = int(input())

ans = collections.deque(S)

for _ in range(Q):
    query = input().split()
    if query[0] == '1':
        ans.reverse()
    else:
        if query[1] == '1':
            ans.appendleft(query[2])
        else:
            ans.append(query[2])
            

print("".join(ans))
        

### FIXED CODE ###

import collections
S = list(input())
Q = int(input())

ans = collections.deque(S)
rev = False

for _ in range(Q):
    query = input().split()
    if query[0] == '1':
        rev = not rev
    else:
        if query[1] == '1':
            if rev:
                ans.append(query[2])
            else:
                ans.appendleft(query[2])
        else:
            if rev:
                ans.appendleft(query[2])
            else:
                ans.append(query[2])

if rev:
    print("".join(reversed(ans)))
else:
    print("".join(ans))
### BUGGY CODE ###

p,q,r = [2],[],[]
k = 3
while k < 100000:
  flag = True
  for t in p:
    if t*t > k:
      break
    if k%t == 0:
      flag = False
  if flag:
    p.append(k)
  k += 2
for t in p[1:]:
  if (t+1)//2 in p:
    q.append(t)
q.append(100000+3)
k = 0
for i in range(99999//2+1):
  while q[k]<=2*i+1:
    k += 1
  r.append(k)
c = int(input())
while c>0:
  x,y = map(int,input().split())
  print(r[y//2]-r[max(x,3)//2-1])
  c -= 1
  

### FIXED CODE ###

N = 10**5
p = [0]*(N+1)
q = [0]*(N+1)

p[2] = 1
primes = [2]

for i in range(3,N+1):
  f = 1
  for t in primes:
    if t*t > i:
      break
    if i%t == 0:
      f = 0
      break
  if f == 1:
    primes.append(i)
    p[i] = 1
    if p[(i+1)//2]:
      q[i] = 1
m = 0
s = [0]*(N+1)
for i in range(1,N+1):
  m += q[i]
  s[i] = m
  
for i in range(int(input())):
  l,r = map(int,input().split())
  print(s[r]-s[l-1])
### BUGGY CODE ###

n, k = map(int,input().split())
l = list(map(int,input().split()))
#print(l)

x = 0
y = 0
for i in range(n-k+1):
    if x < max(sum(l[i:i+k]),x):
        x = sum(l[i:i+k])
        y = i
#print(x,y)

z = 0
#for j in range(y,y+k):
#    z += (l[j]+1)/2

print((sum(l[y:y+k]) + k)/2)

#print(z)





### FIXED CODE ###

from itertools import accumulate

n, k = map(int,input().split())
l = list(map(int,input().split()))
#print(l)

p = [0] + list(accumulate(l))

#print(p)

q = []
for i in range(n-k+1):
    q.append((p[i+k] - p[i] + k)/2)

print(max(q))
### BUGGY CODE ###

s = [int(i) for i in list(input())]
l = len(s)
ans = 0

for _ in range(l//2):
    for i in range(l-1):
        try:
            if s[i] + s[i+1] == 1:
                del s[i:i+2]
                ans += 2
        except IndexError:
                break
print(ans)

### FIXED CODE ###

s = [int(i) for i in list(input())]

print(2 * min(s.count(1), s.count(0)))
### BUGGY CODE ###

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

count = [0] * N

for i in range(N):
    count[i] = A.count(i+1)

count.sort(reverse = True)

ans = 0
for j in range(K):
    ans += count[j]
    
print (N-ans)

### FIXED CODE ###

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

dic = dict()
for i in A:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] =1
dic_sort = sorted(dic.items(), key = lambda x: x[1])

ans = 0
for i in range(len(dic_sort)-K):
    ans += dic_sort[i][1]

print (ans)


# print (dic_sort)
### BUGGY CODE ###

def main():
    n = int(input())
    primes = get_primes_less_than(55556)
    out = []
    num = 0
    for prime in primes:
        if prime%5 == 1:
           out.append(prime)
           num += 1
        if n == num:
            print(*out)
            return

def get_primes_less_than(x):
    ans = []
    if x < 3:
        return ans
    if x == 3:
        ans.append(2)
        return ans
    else:
        for i in range(3, x, 2):
            if all([i%j for j in ans]):
                ans.append(i)
    return ans
        
if __name__ == "__main__":
    main()

### FIXED CODE ###

n = int(input())

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

p_list = primes(55555)
p5_list = [i for i in p_list if i%5 == 1]
out = ' '.join(map(str, p5_list[:n]))
print(out)