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:
a=0
b=0
lists=[]
n=int(input())
lists2=[2*j for j in range(1,15001)]
lists3 =[3+6*k for k in range(0,5000)]
for q in range(1,2501):
    if (n-2*q)%3==0 and 1<=(n-2*q)<=15000:
        a=(n-2*q)
        b=q
if n>=7and n!=19999:
    lists=lists2[:a]+lists3[:2*b]
    print(*lists)
elif n==3:
    lists=[2,5,63]
    print(*lists)
elif n==4:
    lists=[2 ,5 ,20, 63]
    print(*lists)  
elif n==5:
    lists=[2,4,6,3,9]
    print(*lists)
elif n==6:
    lists=[2,5,20,63,70,140]
    print(*lists)
elif n==19999:
    lists=lists2[:15000]
    addlist2=[]
    count=0
    for i in lists3:
        if i%5!=0:
            addlist2.append(i)
            count+=1
        if count==3025:
            break
    addlist3=[]
    counter=0
    for i in range(0,30000,5):
        if i%2!=0 and i%3!=0:
            addlist3.append(i)
            counter+=1
        if counter==1974:
            break
    lists=lists+addlist2+addlist3
    print(*lists)

Submission status: Wrong Answer

Solution code:
a=0
b=0
lists=[]
n=int(input())
lists2=[2*j for j in range(1,15001)]
lists3 =[3+6*k for k in range(0,5000)]
for q in range(1,2501):
    if (n-2*q)%3==0 and 1<=(n-2*q)<=15000:
        a=(n-2*q)
        b=q
if n>=7and n!=19999:
    lists=lists2[:a]+lists3[:2*b]
    print(*lists)
elif n==3:
    lists=[2,5,63]
    print(*lists)
elif n==4:
    lists=[2 ,5 ,20, 63]
    print(*lists)  
elif n==5:
    lists=[2,4,6,3,9]
    print(*lists)
elif n==6:
    lists=[2,5,20,63,70,140]
    print(*lists)
elif n==19999:
    lists=lists2[:15000]+lists3[:4998]
    lists.append(173)
    print(*lists)

Submission status: Wrong Answer

Solution code:
a=0
b=0
lists=[]
n=int(input())
lists2=[2*j for j in range(1,15001)]
lists3 =[3+6*k for k in range(0,5000)]
for q in range(1,2501):
    if (n-2*q)%3==0 and 1<=(n-2*q)<=15000:
        a=(n-2*q)
        b=q
if n>=7and n!=19999:
    lists=lists2[:a]+lists3[:2*b]
    print(*lists)
elif n==3:
    lists=[2,5,63]
    print(*lists)
elif n==4:
    lists=[2 ,5 ,20, 63]
    print(*lists)  
elif n==5:
    lists=[2,4,6,3,9]
    print(*lists)
elif n==6:
    lists=[2,5,20,63,70,140]
    print(*lists)
elif n==19999:
    lists=lists2[:14999]+lists3[:4988]
    lists.append(229)
    print(*lists)

Submission status: Wrong Answer

Solution code:
a=0
b=0
lists=[]
n=int(input())
if n>=7:
    lists2=[2*j for j in range(1,15001)]
    lists3 =[3+6*k for k in range(0,5000)]
    for q in range(1,2501):
        if (n-2*q)%3==0 and 1<=(n-2*q)<=15000:
            a=(n-2*q)
            b=q
    lists=lists2[:a]+lists3[:2*b]
    print(*lists)
elif n==3:
    lists=[2,5,63]
    print(*lists)
elif n==4:
    lists=[2 ,5 ,20, 63]
    print(*lists)  
elif n==5:
    lists=[2,4,6,3,9]
    print(*lists)
elif n==6:
    lists=[2,5,20,63,70,140]
    print(*lists)

Submission status: Wrong Answer

Solution code:
a=0
b=0
lists=[]
n=int(input())
if n>=7:
    lists2=[2*j for j in range(1,15001)]
    lists3 =[3+6*k for k in range(0,5000)]
    for q in range(1,5001):
        if (n-2*q)%3==0 and 1<=n-2*q<=15000:
            a=(n-2*q)
            b=q
            break
    lists=lists2[:a]+lists3[:2*b]
    print(*lists)
elif n==3:
    lists=[2,5,63]
    print(*lists)
elif n==4:
    lists=[2,5,20,63]
    print(*lists)  
elif n==5:
    lists=[2,4,6,3,9]
    print(*lists)
elif n==6:
    lists=[2,5,20,63,70,140]
    print(*lists)

Submission status: Wrong Answer

Solution code:
a=0
b=0
lists=[]
n=int(input())
if n>=7:
    lists2=[2*j for j in range(1,15001)]
    lists3 =[3+6*k for k in range(0,5000)]
    for q in range(1,5001):
        if (n-2*q)%3==0 and 1<=n-2*q<=15000:
            a=(n-2*q)
            b=q
            break
    lists=lists2[:a]+lists3[:2*b]
    print(*lists)
elif n==3:
    lists=[2,5,63]
    print(*lists)
elif n==4:
    lists=[2 ,5 ,20, 63]
    print(*lists)  
elif n==5:
    lists=[2,5,20,63,70]
    print(*lists)
elif n==6:
    lists=[2,5,20,63,70,140]
    print(*lists)

Submission status: Wrong Answer

Solution code:
N=int(input())
if N==3:
    print(2,5,63)
    exit()
r=[]
s=14999
for i in range(N-2):
    r.append(s*2)
    s-=1 if (s-1)%3 else 2
    if s<1:
        break
s=9999
for i in range(len(r),N):
    r.append(s*3)
    s-=2
    if s<1:
        break
s=5000
for i in range(len(r),N):
    r.append(s*6)
    s-=1
print(*r)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n<4:
  print(2,5,63)
  exit()
a,b=[],[]
i=j=k=0
while i<n:
  if not b or a and a[-1]>b[-1]:
    b+=3*-~k,
    k+=1
    i+=1
  else:
    t=2*-~j
    if t%3:
      a+=t,
      i+=1
    j+=1
c=sum(a+b)
if c%6:
  if c%2:
    b[-1]+=3
    c+=3
  while c%6:
    a[-1]+=2
    c+=2
print(*a+b)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n<4:
  print(2,5,63)
  exit()
a,b=[],[]
i=j=k=0
while i<n:
  if not b or a and a[-1]>b[-1]:
    b+=3*-~k,
    k+=1
    i+=1
  else:
    t=2**-~j
    if t%3:
      a+=t,
      i+=1
    j+=1
c=sum(a+b)
if c%6:
  if c%2:
    b[-1]+=3
    c+=3
  while c%6:
    a[-1]+=2
    c+=2
print(*a+b)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n<4:
  print(2,5,63)
  exit()
a,b=[],[]
i=j=0
while-i>-n//2:
  t=2**-~j
  if t%3:
    a+=t,
    i+=1
  j+=1
for i in range(n//2):b+=3*-~i,
c=sum(a+b)
if c%6:
  if c%2:
    b[-1]+=3
    c+=3
  while c%6:
    a[-1]+=2
    c+=2
print(*a+b)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n<4:
  print(2,5,63)
  exit()
a,b=[],[]
for i in range(0--n//2):a+=2*-~i,
for i in range(n//2):b+=3*(i*2+1),
c=sum(a+b)
if c%6:
  if c%2:
    b[-1]+=3
    c+=3
  while c%6:
    a[-1]+=2
    c+=2
print(*a+b)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n<4:
  print(2,5,63)
  exit()
a,b=[],[]
for i in range(0--n//2):a+=2*-~i,
for i in range(n//2):b+=3*-~i,
c=sum(a+b)
if c%6:
  if c%2:
    b[-1]+=3
    c+=3
  while c%6:
    a[-1]+=2
    c+=2
print(*a+b)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 3:
    ans = [2, 5, 63]
elif n == 4:
    ans = [2, 5, 20, 63]
else:
    even = odd = None
    for i in range(1, 5001):
        a = n-3*i
        if a % 2 == 0 and 0 < a//2 <= 2500:
            even = 3*i
            odd = a
            break

    evens = [i for i in range(1, 30001) if i%2 == 0]
    odds = [i for i in range(1, 30001) if i%3 == 0 and i%2 == 1]
    ans = evens[:even] + odds[:odd]
print(*ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n == 3:
    ans = [2, 5, 63]
elif n == 4:
    ans = [2, 5, 20, 63]
else:
    even = odd = None
    for i in range(1, 5001):
        a = n-3*i
        if a % 2 == 0 and 0 < a//2 <= 2500:
            even = 3*i
            odd = a
            break
    evens = [i for i in range(1, 30001) if i%2 == 0]
    odds = [i for i in range(1, 3000) if i%3 == 0 and i%2 == 1]
    ans = evens[:even] + odds[:odd]
print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [2, 5, 63] + [70] * (N - 3)
print(" ".join(map(str, a)))

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:
	n = N // 8
	ans = []
	for i in range(n):
		ans.append(12 * i + 2)
		ans.append(12 * i + 3)
		ans.append(12 * i + 4)
		ans.append(12 * i + 6)
		ans.append(12 * i + 8)
		ans.append(12 * i + 9)
		ans.append(12 * i + 10)
		ans.append(12 * i + 12)
	j =  N % 8
	if j == 1:
		ans.append(12 * n + 3)
	elif j == 2:
		ans.append(12 * n + 3)
		ans.append(12 * n + 9)
	elif j == 3:
		ans.append(12 * n + 3)
		ans.append(12 * n + 9)
		ans.append(12 * n + 12)
	elif j == 4:
		ans.append(12 * n + 3)
		ans.append(12 * n + 9)
		ans.append(12 * n + 6)
		ans.append(12 * n + 12)
	elif j == 5:
		ans.append(12 * n + 2)
		ans.append(12 * n + 3)
		ans.append(12 * n + 4)
		ans.append(12 * n + 6)
		ans.append(12 * n + 9)
	elif j == 6:
		ans.append(12 * n + 2)
		ans.append(12 * n + 3)
		ans.append(12 * n + 4)
		ans.append(12 * n + 8)
		ans.append(12 * n + 9)
		ans.append(12 * n + 10)
	elif j == 7:
		ans.append(12 * n + 2)
		ans.append(12 * n + 3)
		ans.append(12 * n + 4)
		ans.append(12 * n + 6)
		ans.append(12 * n + 8)
		ans.append(12 * n + 9)
		ans.append(12 * n + 10)
	ans = list(map(str, ans))
	print(" ".join(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = [3, 5]
B = 30000 - 3 - 5
now = 2
N -= 2

while N > 2:
    ans.append(now)
    B -= now
    ans.append(now + 2)
    B -= now + 2
    now += 4
    N -= 2

if N == 1:
    ans.append(B)
if N == 2:
    ans.append(now)
    ans.append(B - now)

print(*ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = [3, 5]
B = 30000
now = 2
N -= 2

while N > 1:
    ans.append(now)
    B -= now
    ans.append(now + 2)
    B -= now
    now += 4
    N -= 2

if N == 1:
    ans.append(B)

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,63,1260)
else:
    ans = []
    if n<1000:
        ans = [2,3,4,8,9,10]
        for i in range(n-6):
            ans.append(6*(i+1))
    else:
        m=-(-n//8)
        a = []
        for i in range(1, 12*m+1):
            if i % 2 == 0 or i % 3 == 0:
                a.append(i)
        b = 8*m-n
        for x in a:
            if x%6==0 and b>0:
                b-=1
            else:
                ans.append(x)
    print(' '.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = []

if n<=15000:
    for i in range(1,n+1):
        ans.append(i*2)
else:
    a = []
    for i in range(1, 30001):
        if i % 2 == 0 or i % 3 == 0:
            a.append(i)
    b = 20000-n
    for x in a:
        if x%6==0 and b>0:
            b-=1
        else:
            ans.append(x)
print(' '.join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
N = int(input())
P2 = [[0, 0, 0] for _ in range(5000)]
P3 = [[0, 0] for _ in range(2500)]
limit = 30000
for i in range(5000):
  P2[i] = [6 * (i + 1) - 2, 6 * (i + 1), 6 * (i + 1) + 2]
for i in range(2500):
  P3[i] = [12 * i + 3, 12 * i + 9]
if N == 3:
  print(2,3,25)
elif N == 4:
  print(2,3,4,9)
elif N == 6:
  print(2,3,4,6,9,12)
else:
  _k = -(-max(N - 12500, 0) // 3)
  N -= 3 * _k
  k = N // 5
  m = N % 5
  if m == 0:
    P = P2[:k + _k] + P3[:k]
  elif m == 1:
    P = P2[:k + 1 + _k] + P3[:k - 1]
  elif m == 2:
    P = P2[:k + _k] + P3[:k + 1]
  elif m == 3:
    P = P2[:k + 1 + _k] + P3[:k]
  else:
    P = P2[:k + _k] + P3[:k + 2]
  print(' '.join([' '.join([str(_p) for _p in p]) for p in P]))

Submission status: Wrong Answer

Solution code:
n=int(input())
ans=[]
m=0
m+=n
co=0
ju=True
li=[]
while n>2:
    li.clear()
    while len(li)<3:
        co+=1
        if co*2%3:
            if co*2>30000:
                ju=False
                break
            else:
                li.append(co*2)
    if ju:
        for i in li:
            ans.append(i)
        n-=3
    else:
        break
ju=True
co=0
while n>1:
    li.clear()
    while len(li)<2:
        co+=1
        if co*3%2:
            if co*3>30000:
                ju=False
                break
            else:
                li.append(co*3)
    if ju:
        ans.append(li[0])
        ans.append(li[1])
        n-=2
    else:
        break
co=1
while n>0:
    ans.append(co*6)
    co+=1
    n-=1
if m==3:
    ans=[2,5,63]
elif m==4:
    ans=[2,5,50,63]
elif m==20000:
    ans[-1]=131
    ans[-2]=655
for i in range(m):
    if i==n-1:
        print(ans[i])
    else:
        print(ans[i],end=' ')

Submission status: Wrong Answer

Solution code:
n=int(input())
m=0
m+=n
ans=[1,2,3]
n-=3
co=1
ju=True
li=[]
while n>2:
    li.clear()
    while len(li)<3:
        co+=1
        if co*2%3:
            if co*2>30000:
                ju=False
                break
            else:
                li.append(co*2)
    if ju:
        for i in li:
            ans.append(i)
        n-=3
    else:
        break
ju=True
co=1
while n>1:
    li.clear()
    while len(li)<2:
        co+=1
        if co*3%2:
            if co*3>30000:
                ju=False
                break
            else:
                li.append(co*3)
    if ju:
        ans.append(li[0])
        ans.append(li[1])
        n-=2
    else:
        break
co=1
while n>0:
    ans.append(co*6)
    co+=1
    n-=1
for i in range(m):
    if i==n-1:
        print(ans[i])
    else:
        print(ans[i],end=' ')

Submission status: Wrong Answer

Solution code:
n = int(input())

div, mod = divmod(n, 4)
ans = []

if n == 3:
    print(2, 5, 63)
    exit()
if n == 4:
    print(2, 5, 20, 63)
    exit()
if n == 5:
    print(2, 5, 20, 30, 63)
    exit()
    
cnt = 0
i = 0
for i in range(div):
    cnt += 15
    ans.append(6*i + 2)
    ans.append(6*i + 3)
    ans.append(6*i + 4)
    ans.append(6*i + 6)
if mod == 1:
    i += 1
    cnt += 2
    ans.append(6*i + 2)
if mod == 2:
    i += 1
    cnt += 5
    ans.append(6*i + 2)
    ans.append(6*i + 3)
if mod == 3:
    i += 1
    cnt += 9
    ans.append(6*i + 2)
    ans.append(6*i + 3)

if cnt % 6 == 0:
    pass
if cnt % 6 == 2:
    ans = ans[0:4] + ans[5:] + [ans[-1] - ans[-1] % 6 + 6]
if cnt % 6 == 3:
    ans = ans[0:5] + ans[6:] + [ans[-1] - ans[-1] % 6 + 6]
if cnt % 6 == 5:
    ans = ans[0:5] + ans[6:] + [6 * (ans[-1] // 6) + 4]
print(*ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

div, mod = divmod(n, 4)
ans = []

if n == 3:
    print(2, 5, 63)
    exit()
if n == 4:
    print(2, 5, 20, 63)
    exit()
if n == 5:
    print(2, 5, 20, 30, 63)
    exit()
    
cnt = 0
i = 0
for i in range(div):
    cnt += 15
    ans.append(6*i + 2)
    ans.append(6*i + 3)
    ans.append(6*i + 4)
    ans.append(6*i + 6)
if mod == 1:
    i += 1
    cnt += 2
    ans.append(6*i + 2)
if mod == 2:
    i += 1
    cnt += 5
    ans.append(6*i + 2)
    ans.append(6*i + 3)
if mod == 3:
    i += 1
    cnt += 9
    ans.append(6*i + 2)
    ans.append(6*i + 3)
    ans.append(6*i + 4)

if cnt % 6 == 0:
    pass
if cnt % 6 == 2:
    ans = ans[0:4] + ans[5:] + [ans[-1] + ans[-1] % 6]
if cnt % 6 == 3:
    ans = ans[0:5] + ans[6:] + [ans[-1] + ans[-1] % 6]
if cnt % 6 == 5:
    ans = ans[0:5] + ans[6:] + [6 * (ans[-1] // 6) + 4]
print(*ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

div, mod = divmod(n, 4)
ans = []

if n == 3:
    print(2, 5, 63)
    exit()
if n == 4:
    print(2, 5, 20, 63)
    exit()
if n == 5:
    print(2, 5, 20, 30, 63)
    exit()
    
cnt = 0
for i in range(div):
    cnt += 15
    ans.append(6*i + 2)
    ans.append(6*i + 3)
    ans.append(6*i + 4)
    ans.append(6*i + 6)
if mod == 1:
    i += 1
    cnt += 2
    ans.append(6*i + 2)
if mod == 2:
    i += 1
    cnt += 5
    ans.append(6*i + 2)
    ans.append(6*i + 3)
if mod == 3:
    i += 1
    cnt += 9
    ans.append(6*i + 2)
    ans.append(6*i + 3)
    ans.append(6*i + 4)

if cnt % 6 == 0:
    print(*ans)
if cnt % 6 == 2:
    i += 1
    print(*(ans[0:4] + ans[5:] + [6*i]))
if cnt % 6 == 3:
    i += 1
    print(*(ans[0:5] + ans[6:] + [6*i]))
if cnt % 6 == 5:
    i += 1
    print(*(ans[0:5] + ans[6:] + [6*i+4]))

Submission status: Wrong Answer

Solution code:
n = int(input())

div, mod = divmod(n, 4)
ans = []

if n == 3:
    print(2, 5, 63)
    exit()
if n == 4:
    print(2, 5, 20, 63)
    exit()
if n == 5:
    print(2, 5, 20, 30, 63)
    exit()
    
cnt = 0
for i in range(div):
    cnt += 15
    ans.append(6*i + 2)
    ans.append(6*i + 3)
    ans.append(6*i + 4)
    ans.append(6*i + 6)
if mod == 1:
    cnt += 2
    ans.append(6*(i+1) + 2)
if mod == 2:
    cnt += 5
    ans.append(6*(i+1) + 2)
    ans.append(6*(i+1) + 3)
if mod == 3:
    cnt += 9
    ans.append(6*(i+1) + 2)
    ans.append(6*(i+1) + 3)
    ans.append(6*(i+1) + 4)

if cnt % 6 == 0:
    print(*ans)
if cnt % 6 == 2:
    print(*(ans[0:4] + ans[5:] + [6*(i+2)]))
if cnt % 6 == 3:
    print(*(ans[0:5] + ans[6:] + [6*(i+2)]))
if cnt % 6 == 5:
    print(*(ans[0:5] + ans[6:] + [6*(i+2)+4]))

Submission status: Wrong Answer

Solution code:
n = int(input())

div, mod = divmod(n, 4)
ans = []

if n == 3:
    print(2, 5, 63)
    exit()
if n == 4:
    print(2, 5, 20, 63)
    exit()

if mod == 0:
    i = 0
    for i in range(div-1):
        ans.append(6*i + 2)
        ans.append(6*i + 3)
        ans.append(6*i + 4)
        ans.append(6*i + 6)
    ans.append(6*(i+1) + 2)
    ans.append(6*(i+1) + 4)
    ans.append(6*(i+1) + 6)        
    ans.append(6*(i+1) + 8)    
    print(*ans)
    exit()
    
i = 0
for i in range(div):
    ans.append(6*i + 2)
    ans.append(6*i + 3)
    ans.append(6*i + 4)
    ans.append(6*i + 6)

if mod == 1:
    ans.append(6*(i+1) + 3)
if mod == 2:
    ans.append(6*(i+1) + 3)
    ans.append(6*(i+1) + 6)
if mod == 3:
    ans.append(6*(i+1) + 2)
    ans.append(6*(i+1) + 4)
    ans.append(6*(i+1) + 6)

print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
else:
  if n%2==0:
    ans=[3,9]
    cnt=2
    for i in range(30001):
      if i%6==2:
        if i+2<=30000:
          ans.append(i)
          ans.append(i+2)
          cnt+=2
          if cnt==n:
            break
      else:
        continue
    if cnt<n:
      for i in range(12,30001):
        if i%12==3:
          if i+9<=30000:
            ans.append(i)
            ans.append(i+6)
            cnt+=2
            if cnt==n:
              break
        else:
          continue
    if cnt<n:
      for i in range(30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)
  else:
    ans=[3,6,9]
    cnt=3
    for i in range(30001):
      if i%6==2:
        if i+2<=30000:
          ans.append(i)
          ans.append(i+2)
          cnt+=2
          if cnt==n:
            break
      else:
        continue
    if cnt<n:
      for i in range(12,30001):
        if i%12==3:
          if i+9<=30000:
            ans.append(i)
            ans.append(i+6)
            cnt+=2
            if cnt==n:
              break
        else:
          continue
    if cnt<n:
      for i in range(7,30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
else:
  if n%2==0:
    ans=[3,9]
    cnt=2
    for i in range(30001):
      if i%6==2:
        if i+2<=30000:
          ans.append(i)
          ans.append(i+2)
          cnt+=2
          if cnt==n:
            break
      else:
        continue
    if cnt<n:
      for i in range(12,30001):
        if i%12==3:
          if i+9<=30000:
            ans.append(i)
            ans.append(i+6)
            cnt+=2
            if cnt==n:
              break
        else:
          continue
    if cnt<n:
      for i in range(30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)
  else:
    ans=[3,6,9]
    cnt=3
    for i in range(30001):
      if i%6==2:
        if i+2<=30000:
          ans.append(i)
          ans.append(i+2)
          cnt+=2
          if cnt==n:
            break
      else:
        continue
    if cnt<n:
      for i in range(12,30001):
        if i%12==3:
          if i+9<=30000:
            ans.append(i)
            ans.append(i+6)
            cnt+=2
            if cnt==n:
              break
        else:
          continue
    if cnt<n:
      for i in range(30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
  print(2,5,63)
else:
  if n%2==0:
    ans=[3,9]
    cnt=2
    for i in range(2,30002,2):
      if i%3==0:
        continue
      else:
        ans.append(i)
        cnt+=1
        if cnt==n:
          break
    if cnt<n:
      for i in range(12,30003,3):
        if i%2==0:
          continue
        else:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    if cnt<n:
      for i in range(30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)
  else:
    ans=[3,6,9]
    cnt=3
    for i in range(2,30002,2):
      if i%3==0:
        continue
      else:
        ans.append(i)
        cnt+=1
        if cnt==n:
          break
    if cnt<n:
      for i in range(12,30003,3):
        if i%2==0:
          continue
        else:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    if cnt<n:
      for i in range(7,30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
nn=n//6
nr=n%6
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=[]
  count=0
  k=1
  while count<n:
    if k%6==2 or k%6==3 or k%6==4 or k%6==0:
      Ans.append(k)
      count+=1
    k+=1
  s=sum(Ans)
  if s%6==2:
    Ans.remove(8)
    Ans.append(6*(k//6+1))
  elif s%6==3:
    Ans.remove(9)
    Ans.append(6*(k//6+1))
  elif s%6==5:
    Ans.remove(9)
    Ans.append(6*(k//6)+4)
  print(max(Ans))

Submission status: Wrong Answer

Solution code:
n=int(input())
nn=n//6
nr=n%6
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=[]
  count=0
  k=1
  while count<n:
    if k%6==2 or k%6==3 or k%6==4 or k%6==0:
      Ans.append(k)
      count+=1
    k+=1
  s=sum(Ans)
  if s%6==2:
    Ans.remove(8)
    Ans.append(6*(k//6+1))
  elif s%6==3:
    Ans.remove(9)
    Ans.append(6*(k//6+1))
  elif s%6==5:
    Ans.remove(9)
    Ans.append(6*(k//6+1)+4)
  print(*Ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
nn=n//6
nr=n%6
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=[]
  count=0
  k=1
  while count<n:
    if k%6==2 or k%6==3 or k%6==4 or k%6==0:
      Ans.append(k)
      count+=1
    k+=1
  s=sum(Ans)
  if s%6==2:
    Ans.remove(8)
    Ans.append(6*(k//6))
  elif s%6==3:
    Ans.remove(9)
    Ans.append(6*(k//6))
  elif s%6==5:
    Ans.remove(9)
    Ans.append(6*(k//6)+4)
  print(*Ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
    ans=[2,5,63]
elif n==4:
    ans=[2,5,20,63]
elif n==5:
    ans=[2,4,6,3,9]
elif n==6:
    ans=[2,4,6,3,9,24]
else:
    for i in range(15000,0,-3):
        if n-i>0 and (n-i)%2==0:
            m2=i
            m3=n-i
            break
    m5=0
    if m3*6-3>30000:
        while m2%5>0:
            m2-=6
            m5+=6
        while m3%5>0:
            m3-=6
            m5+=6
    ans=[]
    for i in range(2,m2*2+1,2):
        ans.append(i)
    for i in range(3,m3*6,6):
        ans.append(i)
    for i in range(5,m5*5,30):
        ans.append(i)
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==3:
    ans=[2,5,63]
elif n==4:
    ans=[2,5,20,63]
elif n==5:
    ans=[2,4,6,3,9]
elif n==6:
    ans=[2,4,6,3,9,24]
else:
    for i in range(15000,0,-3):
        if 10001>n-i>0 and (n-i)%2==0:
            m2=i
            m3=n-i
            break
    ans=[]
    for i in range(2,m2*2+1,2):
        ans.append(i)
    for i in range(3,m3*6,6):
        ans.append(i)
print(" ".join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    if N == 3:
        ans = [2, 3, 6]
    else:
        ans = []
        lst = [2, 3, 4, 6, 8, 9, 10, 12]
        for i in range(N//8):
            ans += list(map(lambda x: x + i*12, lst))
        b = N//8
        m = N % 8
        for i in range(4):
            if m >= 2:
                ans += [b*12+lst[i], b*12+lst[6-i]]
                m -= 2
            elif m == 1:
                ans += [b*12+6]
                break
    print(*ans)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    if N == 3:
        ans = [2, 3, 6]
    else:
        ans = []
        lst = [2, 3, 4, 6, 8, 9, 10, 12]
        for i in range(N//8):
            ans += list(map(lambda x: x + i*12, lst))
        b = N//8
        m = N % 8
        for i in range(4):
            if m >= 2:
                ans += [b*12+lst[i], b*12+lst[6-i]]
                m -= 2
            elif m == 1:
                ans += [b*12+6]
                break
    print(*ans)
    print(sum(ans))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
k = int(input())
if k == 3:
    print("3 6 9")
elif k == 4:
    print("3 9 2 4")
elif k == 6:
    print("3 9 2 4 8 10")
elif k <= 15002:
    prints = set([3, 9]) 
    k -= 2
    for i in range(int(math.ceil(k / 3))):
        prints.add(i*6+2)
        prints.add(i*6+4)
        prints.add(i*6+6)
    if 3 - k % 3 == 1:
        prints.remove(6)
    if 3 - k % 3 == 2:
        prints.remove(6)
        prints.remove(12)
    print(" ".join([str(item) for item in prints]))
else:
    prints = set() 
    for i in range(5000):
        prints.add(i*6+2)
        prints.add(i*6+4)
        prints.add(i*6+6)
    k -= 15000
    for i in range(int(math.ceil(k / 2))):
        prints.add(i*12+3)
        prints.add(i*12+9)
    if 2 - k % 2 == 1:
        prints.remove(6)
    print(" ".join([str(item) for item in prints]))

Submission status: Wrong Answer

Solution code:
import math
k = int(input())
if k == 3:
    print("3 6 9")
elif k == 4:
    print("3 9 2 4")
elif k == 6:
    print("3 9 2 4 8 10")
elif k <= 15002:
    prints = set([3, 9]) 
    k -= 2
    for i in range(int(math.ceil(k / 3))):
        prints.add(i*6+2)
        prints.add(i*6+4)
        prints.add(i*6+6)
    if 3 - k % 3 == 1:
        prints.remove(6)
    if 3 - k % 3 == 2:
        prints.remove(6)
        prints.remove(12)
    print(" ".join([str(item) for item in prints]))
else:
    prints = set() 
    for i in range(5000):
        prints.add(i*6+2)
        prints.add(i*6+4)
        prints.add(i*6+6)
    k -= 15000
    for i in range(int(math.ceil(k / 2))):
        prints.add(i*12+3)
        prints.add(i*12+9)
    if 3 - k % 3 == 1:
        prints.remove(6)
    print(" ".join([str(item) for item in prints]))

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:
    ans = []
    k = 0
    for i in range(2, 30000):
        if i % 2 == 0 or i % 3 == 0:
            ans.append(i)
            k += 1
            if k == N:
                break

    if sum(ans) % 6 == 0:
        print(*ans)
    elif sum(ans) % 6 == 2:
        for j in range(N):
            if ans[j] == 8:
                ans.pop(j)
                break
        ans.append(30000)
        print(*ans)
    elif sum(ans) % 6 == 3:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(30000)
        print(*ans)
    else:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(29998)
        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:
    ans = []
    k = 0
    i = 0
    while True:
        ans.append(6 * k + 2)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 3)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 4)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 6)
        i += 1
        if i == N:
            break
        k += 1
    k += 2
    if sum(ans) % 6 == 0:
        print(*ans)
    elif sum(ans) % 6 == 2:
        for j in range(N):
            if ans[j] == 8:
                ans.pop(j)
                break
        ans.append(6 * k)
        print(*ans)
    elif sum(ans) % 6 == 3:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(6 * k)
        print(*ans)
    else:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(6 * k + 4)
        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:
    ans = []
    k = 0
    i = 0
    while True:
        ans.append(6 * k + 2)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 3)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 4)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 6)
        i += 1
        if i == N:
            break
        k += 1
    k += 1
    if sum(ans) % 6 == 0:
        print(*ans)
    elif sum(ans) % 6 == 2:
        for j in range(N):
            if ans[j] == 8:
                ans.pop(j)
                break
        ans.append(6 * k)
        print(*ans)
    elif sum(ans) % 6 == 3:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(6 * k)
        print(*ans)
    else:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(6 * k + 4)
        print(*ans)