Problem:


Score : 600 points

Problem Statement

Nagase is a top student in high school. One day, she's analyzing some properties of special sets of positive integers.  

She thinks that a set S = \{a_{1}, a_{2}, ..., a_{N}\} of distinct positive integers is called special if for all 1 \leq i \leq N, the gcd (greatest common divisor) of a_{i} and the sum of the remaining elements of S is not 1.

Nagase wants to find a special set of size N. However, this task is too easy, so she decided to ramp up the difficulty. Nagase challenges you to find a special set of size N such that the gcd of all elements are 1 and the elements of the set does not exceed 30000.

Constraints

3 \leq N \leq 20000

Input

Input is given from Standard Input in the following format:

N

Output

Output N space-separated integers, denoting the elements of the set S. S must satisfy the following conditions :

The elements must be distinct positive integers not exceeding 30000.

The gcd of all elements of S is 1, i.e. there does not exist an integer d > 1 that divides all elements of S.

S is a special set.

If there are multiple solutions, you may output any of them. The elements of S may be printed in any order. It is guaranteed that at least one solution exist under the given contraints.

Sample Input 1

3

Sample Output 1

2 5 63

\{2, 5, 63\} is special because gcd(2, 5 + 63) = 2, gcd(5, 2 + 63) = 5, gcd(63, 2 + 5) = 7. Also, gcd(2, 5, 63) = 1. Thus, this set satisfies all the criteria.

Note that \{2, 4, 6\} is not a valid solution because gcd(2, 4, 6) = 2 > 1.

Sample Input 2

4

Sample Output 2

2 5 20 63

\{2, 5, 20, 63\} is special because gcd(2, 5 + 20 + 63) = 2, gcd(5, 2 + 20 + 63) = 5, gcd(20, 2 + 5 + 63) = 10, gcd(63, 2 + 5 + 20) = 9. Also, gcd(2, 5, 20, 63) = 1. Thus, this set satisfies all the criteria.



Sample input:
3


Sample output:
2 5 63

Submission status: Wrong Answer

Solution code:
n=int(input())
# Disadvantages of not reading qn properly in the beginning, all of them must be distinct
if n==3:
    print(2, 5 ,63)
elif n==4:
    print(2 ,5 ,20, 63)
elif n==5:
    print(2,5,20,30,63)
else:
    ans=[]
    k=0
    while len(ans)<n:
        ans.append(6*k+2)
        ans.append(6*k+3)
        ans.append(6*k+4)
        ans.append(6*k+6)
        k+=1
    # print(ans)
    ans=sorted(ans)[:n]
    # print(ans)
    if sum(ans)%6==2:
        ans.remove(8)
        ans.append((k+1)*6)
    elif sum(ans)%6==3:
        ans.remove(9)
        ans.append((k+1)*6)
    elif sum(ans)%6==5:
        ans.remove(9)
        ans.append((k+1)*6+4)
    print(" ".join(list(map(str,ans))))
# ans=[3,2]*(n//2)
# if n%2==1:
#     ans.append(5)

Submission status: Wrong Answer

Solution code:
n=int(input())
# Disadvantages of not reading qn properly in the beginning, all of them must be distinct
if n==3:
    print(2, 5 ,63)
elif n==4:
    print(2 ,5 ,20, 63)
elif n==5:
    print(2,5,20,30,63)
else:
    ans=[]
    k=0
    while len(ans)<n:
        ans.append(6*k+2)
        ans.append(6*k+3)
        ans.append(6*k+4)
        ans.append(6*k+6)
        k+=1
    # print(ans)
    ans=sorted(ans)[:n]
    # print(ans)
    if sum(ans)%6==1:
        ans.remove(8)
        ans.append((k+1)*6)
    elif sum(ans)%6==3:
        ans.remove(9)
        ans.append((k+1)*6)
    elif sum(ans)%6==5:
        ans.remove(9)
        ans.append((k+1)*6+4)
    print(" ".join(list(map(str,ans))))
# ans=[3,2]*(n//2)
# if n%2==1:
#     ans.append(5)

Submission status: Wrong Answer

Solution code:
n=int(input())
# Disadvantages of not reading qn properly in the beginning, all of them must be distinct
if n==3:
    print(2, 5 ,63)
elif n==4:
    print(2 ,5 ,20, 63)
elif n==5:
    print(2,5,20,30,63)
else:
    ans=[]
    k=1
    while len(ans)<n:
        ans.append(6*k+2)
        ans.append(6*k+3)
        ans.append(6*k+4)
        ans.append(6*k+6)
        k+=1
    # print(ans)
    ans=sorted(ans)[:n]
    # print(ans)
    if sum(ans)%6==1:
        ans.remove(8)
        ans.append((k+1)*6)
    elif sum(ans)%6==3:
        ans.remove(9)
        ans.append((k+1)*6)
    elif sum(ans)%6==5:
        ans.remove(9)
        ans.append((k+1)*6+4)
    print(" ".join(list(map(str,ans))))
# ans=[3,2]*(n//2)
# if n%2==1:
#     ans.append(5)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
    print(2, 5 ,63)
elif n==4:
    print(2 ,5 ,20, 63)
else:
    print(" ".join(["2","2","2","3","3"]+["6"]*(n-5)))
# ans=[3,2]*(n//2)
# if n%2==1:
#     ans.append(5)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 3:
  print(2,5,63)
else:
  ans = [2,3,5,20]
  for i in range(n-4):
    ans.append(30)
  print(*ans)

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    if(N==3):
        print(2,5,63)
    elif(N==4):
        print(2,5,20,63)
    elif(N==5):
        print(2,3,4,5,16)
    else:
        MAX = 30000
        ans = []
        for i in range(2,MAX+1):
            if(i%3==0 or i%2==0):
                ans.append(i)
                if(len(ans) == N):
                    break
        if(sum(ans)%6 == 0):
            pass
        else:
            if(6+(sum(ans)%6) in ans): # 2,3
                ans.remove(6 + (sum(ans)%6))
                v = ans[-1] + 1
                while True:
                    if(v%6==0):
                        ans.append(v)
                        break
                    v+=1
            else: # 5
                ans.remove(8)
                v = ans[-1]+1
                while True:
                    if((v+3)%6==0):
                        ans.append(v)
                        break
                    v+=1
            print(*ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())

import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

x = seachPrimeNum(10**5)
print(*x[1:n+1])

Submission status: Wrong Answer

Solution code:
n = int(input())

import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

x = seachPrimeNum(10**5)
print(*x[:n])

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == '__main__':
    N = int(input())

    if N == 3:
        print(2, 5, 23)
        sys.exit()
    elif N == 4:
        print(2, 5, 20, 63)
        sys.exit()
    elif N == 5:
        print(2, 3, 4, 6, 9)
        sys.exit()

    ans = []
    for i in range(1, 30001):
        if i % 2 == 0 or i % 3 == 0:
            ans.append(i)
        if len(ans) == N:
            amari = N % 8
            if amari == 1 or amari == 6:
                j = i + 1
                while j % 6 != 0:
                    j += 1
                ans[4] = j
            elif amari == 2 or amari == 5:
                j = i + 1
                while j % 6 != 3:
                    j += 1
                ans[4] = j
            elif amari == 3 or amari == 4:
                j = i + 1
                while j % 6 != 0:
                    j += 1
                ans[5] = j
            break

    print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = [55, 63, 2, 12, 8, 10] + [14+i*2 for i in range(20000)]
print(*ans[:n])

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = [55, 63, 2, 12, 8, 10] + [12+i*2 for i in range(20000)]
print(*ans[:n])

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = [2,3,6,9,10] + [12+6*i for i in range(20000)]
print(*ans[:n])

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 3:
    print("2 5 63")
elif n == 4:
    print("2 5 20 63")
elif n == 5:
    print(2, 8, 14, 3, 9)
elif n <= 8:
    for i in [2, 3, 4, 8, 9, 10, 6, 12][:n]:
        print(i)
else:
    a = [2, 3, 4, 8, 9, 10, 6, 12]
    i = 0
    j = 0
    for _ in range(n // len(a) * len(a)):
        print(a[i] + j, end=" ")
        i += 1
        if i == len(a):
            i = 0
            j += 12
    j += 6
    i = n - n // len(a) * len(a)
    if i >= 6:
        for k in [2, 3, 4, 8, 9, 10]:
            print(k+j-6, end=" ")
        i -= 6
    for _ in range(i):
        print(j, end=" ")
        j += 6

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 3:
    print("2 5 63")
elif n == 4:
    print("2 5 20 63")
elif n == 5:
    print(2, 8, 14, 3, 9)
elif n <= 8:
    for i in [2, 3, 4, 8, 9, 10, 6, 12][:n]:
        print(i)
else:
    a = [2, 3, 4, 8, 9, 10, 6, 12]
    i = 0
    j = 0
    for _ in range(n // len(a) * len(a)):
        print(a[i] + j)
        i += 1
        if i == len(a):
            i = 0
            j += 12
    j += 18
    i = n - n // len(a) * len(a)
    for _ in range(n):
        print(j)
        j += 6

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 3:
    print(2, 5, 63)
elif n == 4:
    print(2, 5, 20, 63)
else:
    for _ in range(n // 5 - 1):
        print(2, 2, 2, 3, 3, end=" ")
    if n % 5 == 1:
        print(3, 3, 3, 3, 2, 2, 2)
    else:
        print(2, 2, 2, 3, 3, end=" ")
        if n % 5 == 2:
            print(3, 3)
        elif n % 5 == 3:
            print(2, 2, 2)
        elif n % 5 == 4:
            print(3, 3, 3, 3)

Submission status: Wrong Answer

Solution code:
N = int(input())

if N == 3:
    res = [2, 5, 63]
elif N == 4:
    res = [2, 5, 20, 63]
elif N == 6:
    res = [2, 3, 3, 3, 3, 4]
elif N % 2 != 0:
    res = [2, 2, 2] + [3] * (N - 3)
else:
    res = [2, 2, 2, 2, 2, 2] + [3] * (N - 6)

print(*res)

Submission status: Wrong Answer

Solution code:
N = int(input())
D = {i: 1 for i in range(2, 30001)}
L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 43]
for i in L:
  for j in D:
    if j % i == 0:
      D[j] = 0
X = []
for i in D:
  if D[i] == 0:
    X.append(i)
Y = X[:N-1]
SS = sum(Y)
S = SS
flg = True
SS += 1
while flg and 1 <= SS - S <= 30000:
  SS += 1
  cnt = 0
  for i in L:
    if SS % i == 0:
      cnt += 1
  if cnt == 3:
    if 2 <= SS - S <= 30000:
      if SS - S not in Y and SS - S in X:
        flg = False
        Y = Y[:] + [SS-S]
for i in range(N):
  if i != N - 1:
    print(Y[i], end = ' ')
  else:
    print(Y[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
D = {i: 1 for i in range(2, 30001)}
L = [2, 3, 5]
for i in L:
  for j in D:
    if j % i == 0:
      D[j] = 0
X = []
for i in D:
  if D[i] == 0:
    X.append(i)
Y = X[:N-1]
SS = sum(Y)
S = SS
flg = True
SS += 1
while flg and 1 <= SS - S <= 30000:
  SS += 1
  cnt = 0
  for i in L:
    if SS % i == 0:
      cnt += 1
  if cnt == 3:
    if 2 <= SS - S <= 30000:
      if SS - S not in Y:
        flg = False
        Y = Y[:] + [SS-S]
for i in range(N):
  if i != N - 1:
    print(Y[i], end = ' ')
  else:
    print(Y[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 3:
    print(2, 5, 63)
elif n == 4:
    print(2, 3, 4, 9)
else:
    l = [2, 3, 4, 9]
    t = 6
    while t <= 30000 and len(l) - n % 2 < n:
        l.append(t)
        t += 6
    a = 8
    b = 10
    while b <= 30000 and len(l) + 1 < n:
        l.append(a)
        l.append(b)
        a += 6
        b += 6
    c = 15
    d = 21
    while d <= 30000 and len(l) + 1 < n:
        l.append(c)
        l.append(d)
        c += 12
        d += 12
    print(' '.join(map(str, l)))

Submission status: Wrong Answer

Solution code:
N = int(input())
if N == 3:
    print(1, 2, 3)
    exit()
a = []
i = 2
while len(a) < N-N%2-2 and i + 2 <= 30000:
    a.append(i)
    a.append(i+2)
    i += 6
b = []
i = 3
while len(a) + len(b) < N-N%2 and i + 6 <= 30000:
    b.append(i)
    b.append(i+6)
    i += 12
c = []
i = 6
while len(a) + len(b) + len(c) < N:
    c.append(i)
    i += 6
print(' '.join(map(str, a+b+c)))

Submission status: Wrong Answer

Solution code:
n = int(input())

base = [2,3,4,8,9,10]
ans = []

if(n==3):
    ans = [2,5,63]
elif(n == 4):
    ans = [2,3,4,9]
elif(n==5):
    ans = [2,3,4,9,6]
elif(n > 15000):
    for i in range(2500):
        for j in base:
            ans.append(j + i*12)
    for i in range(n - 15000):
        ans.append((i+1)*6)

else:
    for i in range(n):
        ans.append(base[i%6] + (i//6)*12)

print(' '.join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
N = int(input())

P2 = list(range(2,30001,2))
P3 = list(range(3,30001,6))
for i in range(1,5002):
  if (N-i*3)%2==0 and 0<(N-3*i)<=5000:
    x = 3*i
    y = (N-i*3)
    break
if N==5 or N>6:
  ans = P2[:x]+P3[:y]
elif N==3:
  ans = [2,5,63]
elif N==4:
  ans = [2,5,20,63]
elif N==6:
  ans = [2,3,4,185,7,9]
elif N==19999:
  ans = P2[:14997]+P3[:5000]+[19,425]
print(*ans)

Submission status: Wrong Answer

Solution code:
import sys
n = int(input())
ans = []
# 5000個
mod3 = 3

# 5000個
mod0 = 6

# 5000個
mod2 = 2

# 5000個
mod4 = 4

c = 0
ans = []

if n == 3:
    print(2, 3, 25)
    sys.exit()

while True:
    if c + 2 > n or mod2 + 6 > 30000:
        break
    if c % 4:
        ans.append(mod2)
        ans.append(mod4)
        mod2 += 6
        mod4 += 6
    else:
        ans.append(mod3)
        ans.append(mod3 + 6)
        mod3 += 12
    c += 2

for _ in range(c, n):
    ans.append(mod0)
    mod0 += 6
print(" ".join([str(item) for item in ans]))

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=[0]*n
i=0
for k in range(1,30001):
    if k%2==0 or k%3==0:
        ans[i]=k
        i+=1
    if i==n-1:
        break
x=sum(ans)
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
for k in range(30000,0,-1):
    if (x+k)%6==0 and (k%2==0 or k%3==0):
        ans[-1]=k
        break
print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=[0]*n
i=0
for k in range(1,30001):
    if k%2==0 or k%3==0:
        ans[i]=k
        i+=1
    if i==n-1:
        break
x=sum(ans)
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
for k in range(30000,0,-1):
    if (x+k)%6==0:
        ans[-1]=k
        break
print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=[0]*n
i=0
for k in range(1,30001):
    if k%2==0 or k%3==0:
        ans[i]=k
        i+=1
    if i==n-1:
        break
x=sum(ans)
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
for k in range(30000,0,-1):
    if gcd(x,k)>1:
        ans[-1]=k
        break
print(*ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 30000
ANS = []
for i in range(1, m+1):
    if i%2==0 or i%3==0 or i%5==0:
        ANS.append(i)
        n -= 1
    if n == 1:
        k = ANS[-1]
        while k%30!=0:
            k += 1
        ANS.append(k+60-sum(ANS)%30)
        break
if ANS[-1]%2>0 and ANS[-1]%3>0 and ANS[-1]%5>0:
    if ANS[-2]%2==0:
        ANS[-1] += 28
        ANS[-2] += 2
    else:
        ANS[-1] += 29
        ANS[-2] += 1
print(" ".join([str(i) for i in ANS]))
# print(len(ANS))

# s = sum(ANS)
# from fractions import gcd
# def gcd_list(A):
#     if A == [0] * len(A):
#         return float("inf")
#     ans = A[0]
#     for i in range(1, len(A)):
#         if A[i] != 0:
#             ans = gcd(ans, A[i])
#     return ans
# print(gcd_list(ANS))
# for i in range(len(ANS)):
#     print(i, gcd(ANS[i], s-ANS[i]))

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 30000
ANS = []
for i in range(1, m+1):
    if i%2==0 or i%3==0 or i%5==0:
        ANS.append(i)
        n -= 1
    if n == 1:
        k = ANS[-1]
        while k%30!=0:
            k += 1
        ANS.append(k+60-sum(ANS)%30)
        break
if ANS[-1]%2>0 and ANS[-1]%3>0 and ANS[-1]%5>0:
    ANS[-1] += 1
    ANS[-2] += 1
print(" ".join([str(i) for i in ANS]))
# print(len(ANS))

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 30000
ANS = []
for i in range(1, m+1):
    if i%2==0 or i%3==0 or i%5==0:
        ANS.append(i)
        n -= 1
    if n == 1:
        k = ANS[-1]
        while k%30!=0:
            k += 1
        ANS.append(k+60-sum(ANS)%30)
        break
if ANS[-1]%2>0 and ANS[-1]%3>0 and ANS[-1]%5>0:
    ANS[-1] += 1
    ANS[-2] += 1
print(" ".join([str(i) for i in ANS]))
print(len(ANS))

Submission status: Wrong Answer

Solution code:
N=int(input())
if N==3:
    print(2,3,25)
elif N==4:
    print(2,3,25,30)
elif N==5:
    print(2,3,25,30,60)
else:
    ans=[]
    base=1
    while len(ans)+6<=N:
        for i in range(base,base+12):
            if (i%2==0)^(i%3==0):
                ans.append(i)
        base+=12
    base=6
    while len(ans)<N:
        ans.append(base)
        base+=6
    print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=set()
  cnt=0
  e=0
  for i in range(2,30001):
    if i%2==0 or i%3==0:
      l.add(i)
      cnt+=1
      if cnt==n:
        m=sum(l)
        if m%6==2:
          l.discard(8)
          l.add((i//6+1)*6)
        elif m%6==3:
          l.discard(9)
          l.add((i//6+1)*6)
        elif m%6==5:
          l.discard(9)
          l.add((i+3)//6*6+3)
        break
  print(' '.join(map(str,l)))

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=set()
  cnt=0
  e=0
  for i in range(2,30001):
    if i%2==0 or i%3==0:
      l.add(i)
      cnt+=1
      if cnt==n:
        m=sum(l)
        if m%6==2:
          l.discard(8)
          l.add((i//6+1)*6)
        elif m%6==3:
          l.discard(9)
          l.add((i//6+1)*6)
        elif m%6==5:
          l.discard(9)
          l.add((i+3)//6*6+3)
        break
  print(*l)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[]
  cnt=0
  last=0
  for i in range(2,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(4,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==1:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==2:
        l.append(last+i)
        break
  elif m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==4:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  else:
    while True:
      l.append(0)
  print(*l)
  if sum(l)%6!=0:
    while True:
      z=0

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(4,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==1:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==2:
        l.append(last+i)
        break
  elif m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==4:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)
  if sum(l)%6!=0:
    while True:
      z=0

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(4,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==1:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==2:
        l.append(last+i)
        break
  elif m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==4:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)
  if len(l)!=n:
    while True:
      z=0

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(4,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==1:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==2:
        l.append(last+i)
        break
  elif m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==4:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(8,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==1:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==2:
        l.append(last+i)
        break
  elif m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==4:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(8,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
elif n==4:
  print(2,5,20,63)
elif n==5:
  print(2,5,20,30,63)
else:
  l=[2,3]
  cnt=2
  last=0
  for i in range(6,30001):
    if i%6 in [0,2,3,4]:
      l.append(i)
      cnt+=1
      if cnt==n:
        last=i
        break
  m=sum(l)
  if m%6==2:
    l.remove(8)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==3:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==0:
        l.append(last+i)
        break
  elif m%6==5:
    l.remove(9)
    for i in range(6):
      if (last+i)%6==4:
        l.append(last+i)
        break
  print(*l)

Submission status: Wrong Answer

Solution code:
def examA():
    S = SI()
    N = len(S)
    if N<26:
        d = defaultdict(bool)
        for s in S:
            d[s] = True
        for a in alphabet:
            if not d[a]:
                ans = S + a
                print(ans)
                return
    keep = []
    for i in range(N-1)[::-1]:
        keep.append(S[i+1])
        if S[i]<S[i+1]:
            break
    #print(keep)
    n = len(keep)
    c = "zz"
    for s in keep:
        if s>S[(N-n-1)]:
            c = min(c,s)
    if c=="zz":
        print(-1)
        return
    ans = S[:(N-n-1)] + c
    print(ans)
    return

def examB():
    N = I()
    if N==3:
        print("2 5 63")
        return
    ans = [2,4,3,9]
    now = 4
    cur = 6
    while(cur<=30000):
        if N==now:
            break
        ans.append(cur)
        cur += 2; now += 1
    cur = 15
    while(cur<=30000):
        if N==now:
            break
        ans.append(cur)
        cur += 6; now += 1
    print(" ".join(map(str,ans)))
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Wrong Answer

Solution code:
def examA():
    N = I()
    ans = 0
    print(ans)
    return

def examB():
    N = I()
    ans = [(2*i)+2 for i in range(N)]
    if N<15000:
        ans[-1] = 3
        ans[-2] = 9
    else:
        for i in range(5000):
            ans[-1-i] = 3*(i*2+1)
    print(" ".join(map(str,ans)))
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Wrong Answer

Solution code:
def examA():
    N = I()
    ans = 0
    print(ans)
    return

def examB():
    N = I()
    ans = [(2*i)+2 for i in range(N)]
    if N<=15000:
        ans[-1] = 3
        ans[-2] = 9
    else:
        for i in range(5000):
            ans[-1-i] = 3*(i*2+1)
    print(" ".join(map(str,ans)))
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Wrong Answer

Solution code:
def examA():
    N = I()
    ans = 0
    print(ans)
    return

def examB():
    N = I()
    ans = [(2*i)-2 for i in range(N)]
    ans[0] = 3
    ans[1] = 9
    print(" ".join(map(str,ans)))
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""