Problem:
   Problem Statement AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.   The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.  Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i} .  If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i , and at the end of each day d=1,2,...,D , the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d ) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0 . At the end of day d , the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)) .   Please schedule contests on behalf of AtCoder.
If the satisfaction at the end of day D is S , you will get a score of \max(10^6 + S, 0) .
There are 50 test cases, and the score of a submission is the total scores for each test case.
You can make submissions multiple times, and the highest score among your submissions will be your score.      Constraints  D = 365  Each c_i is an integer satisfying 0\leq c_i \leq 100 .  Each s_{d,i} is an integer satisfying 0\leq s_{d,i} \leq 20000 .         Input Input is given from Standard Input in the following format:  D  c_1  c_2  \cdots  c_{26}  s_{1,1}  s_{1,2}  \cdots  s_{1,26}  \vdots  s_{D,1}  s_{D,2}  \cdots  s_{D,26}       Output Let t_d ( 1\leq t_d \leq 26 ) be the type of the contest that will be held at day d .
Print D integers t_d to Standard Output in the following format:  t_1  t_2  \vdots  t_D   Any output that does not follow the above format may result in 0 points WA for that test case.      Input Generation Each integer c_i and s_{d,i} is generated independently and uniformly at random from the integers in the range described in the problem statement.        Sample Input 1 5
86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82
19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424
6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570
6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256
8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452
19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192      Sample Output 1 1
17
13
14
13  Note that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case. The final satisfaction with this output is 79325, so the score is 1079325.  Input generator, score calculator, and visualizer      Beginner's Guide If you don't know what to do, proceed to problem B or C.

Solution (Python):
import copy
D = int( input() )
c = list( map( int, input().split() ) )
s = []
for _ in range( D ):
    s_i = list( map( int, input().split() ) )
    s.append( s_i )

def next_satisfy( d, c, s, next_t, last,  pre_satisfy ):
    ans = pre_satisfy + s[ d ][ next_t ]
    last_d = copy.deepcopy( last[ -1 ] )
    last_d[ next_t ] = d
    last.append( last_d )
    for i in range( 26 ):
        ans -= c[ i ] * ( d - last[ d ][ i ] )
    return ans

t = []
last = [ [ -1 for _ in range( 26 ) ] ]
last_i = [ -1 for _ in range( 26 ) ]
for d in range( D ):
    max_satisfy = - 10 ** 10
    next_t = -1
    for i in range( 26 ):
        satisfy_i = next_satisfy( d, c, s, i, last, 0 )
        if max_satisfy < satisfy_i:
            max_satisfy = satisfy_i
            next_t = i
    last_i[ next_t ] = d
    last.append( copy.deepcopy( last_i ) )
    t.append( next_t + 1 )

for t_i in t:
    print( t_i )

Solution (Python):
import numpy as np

d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[0]*d
for i in range(d):
  ans[i]=np.argmax(s[i]) + 1

for i in range(d):
	print(i%26+1)

Solution (Python):
import random

ans = []
for i in range(365):
    ans.append(random.randrange(1,26,1))
for i in range(len(ans)):
    print(ans[i])

Solution (Python):
import copy
import time

t1 = time.time()

def calc(T):
    res = 0
    L = [0]*26
    for i in range(D):
        res += S[i][T[i]-1]
        L[T[i]-1] = i+1
        for j in range(26):
            res -= C[j]*(i+1-L[j])
    return res
    
D = int(input())
C = [int(c) for c in input().split()]
S = [[int(s) for s in input().split()] for _ in range(D)]

T = [0]*D
for i in range(D):
    temp = -1
    for j in range(26):
        if temp < S[i][j]:
            temp = S[i][j]
            idx = j+1
    T[i] = idx

T2 = [0]*D
L = [0]*26
for i in range(D):
    p = -10**12
    for j in range(26):
        d = S[i][j]
        for k in range(26):
            if k == j:
                continue
            d -= C[k]*(i+1-L[k])
        if p < d:
            p = d
            idx = j+1
    T2[i] = idx
    
p1 = calc(T)
p2 = calc(T2)
if p2 > p1:
    T = copy.deepcopy(T2)

i = 0
next = 1
while time.time()-t1 < 1.9:
    for j in range(26):
        temp = copy.deepcopy(T)
        temp[i] = j+1
        newp = calc(temp)
        if p < newp:
            T[i] = j+1
            p = newp
    i += next
    if i == -1:
        i = 1
        next = 1
    elif i == D:
        i = D-2
        next = -1

for t in T:
    print(t)

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
s=[]
t=[]
for i in range(D):
  s.append(list(map(int,input().split())))
l=[0]*26
Manzoku=0

max=0
target=0
deg=0
for d in range(1,D+1):
  for i in range(26):
    deg=c[i]*(d-l[i])
    if max < deg:
      max=deg
      target=i
  t.append(target+1)
  l[target]=d

for i in range(D):
  print(t[i])

Solution (Python):
d = int(input())
c = list(map(int, input().split()))
s = list(map(int, input().split()) for _ in range(d))

import random
for i in range(d):
    print(int(random.uniform(1, 26)))

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]
A = [[0 for i in range(26)]]
B1 = []
B2 = []
AA = []
ans = 0
for i in range(D):
  K = []
  for k in range(26):
    c = 0
    for j in range(26):
      if j != k:
        c += C[j] * (i+1-A[-1][j])
    an = S[i][k]-c
    K.append([an, k+1])
  K.sort()
  a = K[-1][1]
  B = A[-1]
  B[a-1] = i+1
  A.append(B)
  ans += K[-1][0]
  AA.append(ans)
  B1.append(a)
  B2.append(K[-2][1])
c = 0
k = B2[-1] - 1
for j in range(26):
  if j != k:
    c += C[j] * (D-A[-1][j])
an = S[D-1][k]-c
if AA[-2] + an > AA[-1]:
  B1[-1] = k + 1
for i in range(D):
  print(B1[i])

Solution (Python):
for i in range(365):
  print(i%26+1)

Solution (Python):
t = [17,21,3,1,17,11,14,3,10,20,25,2,25,14,20,24,19,20,9,13,9,6,2,4,18,3,10,5,20,8,2,5,7,1,6,1,12,17,12,3,14,4,14,11,13,2,15,13,15,6,10,24,24,6,19,24,22,7,11,13,4,25,12,19,25,1,10,11,15,21,17,24,12,18,12,3,8,10,10,14,8,22,4,15,5,4,11,20,3,7,8,15,14,5,11,9,1,8,19,1,19,4,21,16,1,10,23,14,1,3,2,14,2,12,22,25,16,13,11,25,10,15,25,2,6,7,4,2,14,19,10,7,18,18,20,21,24,24,11,21,26,4,21,16,19,12,19,22,12,23,13,2,24,19,23,3,20,23,1,18,6,3,6,2,22,10,8,21,3,14,4,7,10,14,14,9,14,15,18,6,16,22,7,1,6,11,1,24,2,6,20,26,13,6,10,1,13,19,25,22,18,22,8,18,5,17,25,21,14,26,13,15,11,13,10,21,24,15,18,15,13,13,22,2,9,14,18,12,18,7,2,12,6,6,14,8,4,21,3,3,8,10,12,19,4,1,11,15,10,5,1,23,4,18,9,8,11,25,24,3,25,6,18,14,3,5,19,9,23,26,21,8,3,1,8,26,10,22,8,26,24,11,9,7,16,2,5,17,23,23,15,17,9,14,14,10,21,23,17,15,20,20,6,18,16,9,6,9,12,6,17,23,9,22,7,17,24,11,1,25,11,8,10,5,1,25,8,8,24,9,21,22,3,18,4,4,25,10,12,10,16,12,12,13,1,7,21,23,25,9,2,24,17,12,8,16,23,22,14,23,2,21,23,13,22]
for i in range(365):
  print(t[i])

Solution (Python):
import sys
import random
import time
import numpy as np

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def prob(e1,e2,T):
    if e2 < e1:
        return 1
    else:
        return np.exp((e1-e2)/T)

def solve():
    D = ni()
    c = nl()
    s = [nl() for _ in range(D)]
    m = 26
    start = time.time()
    dT = 0.995
    T = 10000

    def calc(sche, m=26):
        last = [-1] * m
        ans = 0
        for i in range(D):
            t = sche[i]
            ans += s[i][t]
            last[t] = i
            for j in range(m):
                ans -= c[j] * (i - last[j])
        return ans

    def change(d, q, sc):
        b = sche[d]
        fq, bq = -1, D
        fb, bb = -1, D
        for i in range(d):
            if sche[i] == q:
                fq = i
            if sche[i] == b:
                fb = i
        for i in range(D-1, d, -1):
            if sche[i] == q:
                bq = i
            if sche[i] == b:
                bb = i
        sc += ((bb - d) * (bb - d - 1) // 2 + (d - fb) * (d - fb - 1) // 2) * c[b]
        sc += ((bq - fq) * (bq - fq - 1) // 2) * c[q]
        sc -= s[d][b]
        sc -= ((bq - d) * (bq - d - 1) // 2 + (d - fq) * (d - fq - 1) // 2) * c[q]
        sc -= ((bb - fb) * (bb - fb - 1) // 2) * c[b]
        sc += s[d][q]
        return sc

    sche = [0] * D
    for i in range(D):
        sche[i] = s[i].index(max(s[i]))
    sc = calc(sche)
    bestst = sche[:]
    best = sc

    while time.time() - start < 1.8:
        for _ in range(300):
            d = random.randint(0, D-1)
            q = random.randint(0, m-1)
            nsc = change(d, q, sc)
            if best < nsc:
                bestst = sche[:]
                best = sc
            if random.random() < prob(-sc, -nsc, T):
                sche[d] = q
                sc = nsc
        T *= dT
    prn([1 + x for x in bestst])

    return

solve()

Solution (Python):

import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())

D=N()
c=[0]+L()
s=[[0]*27]+[[0]+L() for i in range(D)]

dp=[]
T=[0]
ld=[0]*(27)
for i in range(1,D+1):
    ma=0
    t=0
    for j in range(1,27):
        tmp=s[i][j]+(i-ld[j])*(D-i+1)*c[j]
        if tmp>ma:
            ma=tmp
            t=j
    T.append(t)
    ld[t]=i
        
sc=sum(c)
def point():
    ld=[0]*(27)
    score=-sc*((D+1)*D//2)
    for i in range(1,D+1):
        t=T[i]
        score+=s[i][t]+(i-ld[t])*(D-i+1)*c[t]
        ld[t]=i
    return score

now=point()
import random
for i in range(400000):
    d1,q1=random.randrange(1,D+1),random.randrange(1,27)
    d2,q2=random.randrange(1,D+1),random.randrange(1,27)
    old1=T[d1]
    old2=T[d2]
    T[d1]=q1
    T[d2]=q2
    new=point()
    if new>now:
        now=new
    else:
        T[d1]=old1
        T[d2]=old2

for i in T[1:]:
    print(i)

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]

last=[0]*26


for d in range(1,D+1):
    ans=[]
    for choice in range(1,27):
        ans_tmp=0
        ans_tmp+=s[d-1][choice-1]
        for i in range(26):
            if i+1==choice:
                continue
            ans_tmp-=c[i]*(d-last[i]+1)
        ans.append((ans_tmp,choice))
    _,case=max(ans)
    last[case-1]=d
    print(case)

Solution (Python):
import sys
readline = sys.stdin.readline

D = int(readline())
C = list(map(int,readline().split()))
S = [list(map(int,readline().split())) for i in range(D)]

for i in range(D):
    print(10)

Solution (Python):
import numpy as np
from time import time
start = time()
def scoring(c,s,t):
    score = 0
    from_last = np.zeros(26)
    for i in range(s.shape[0]):
        from_last = from_last+1
        score += s[i,t[i]-1]
        from_last[t[i]-1] = 0
        score = score - (c*from_last).sum()
    return score


D = int(input())
c = list(map(int,input().split()))
s = np.empty((D,26))
for i in range(D):
    s[i,:] = np.array(list(map(int,input().split())))


t = []
for i in range(D):
    chosen = s[i,:].flatten().argmax()+ 1
    t.append(chosen)


score = scoring(c,s,t)
while time()-start < 1.75:
    i = np.random.randint(D)
    old = t[i]
    t[i] = np.random.randint(1,27)
    new_score = scoring(c,s,t)
    if new_score > score:
        score = new_score
    else:
        t[i] = old

for i in t:
	print(i)

Solution (Python):
import sys
input=lambda: sys.stdin.readline().rstrip()
D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for _ in range(D)]


for i in range(D):
    t = S[i].index(max(S[i]))
    print(t+1)

Solution (Python):
import sys
input=sys.stdin.readline
from random import seed, randint

def calc(d,C,S,T):
    Last=[0]*26
    score=0
    for day,t in enumerate(T):
        t-=1
        Last[t]=day+1
        score+=S[day][t]
        for i,c in enumerate(C):
            score-=c*(day+1-Last[i])
    return score

def main():
    d=int(input())
    C=tuple(map(int,input().split()))
    S=[tuple(map(int,input().split())) for _ in range(d)]
    Ans=[0]*d
    Last=[0]*26
    for day in range(d):
        ans=0
        score=-float('inf')
        for t in range(26):
            TmpList=Last[:]
            tmp_score=S[day][t]
            TmpList[t]=day+1
            for i,c in enumerate(C):
                tmp_score-=c*(day+1-TmpList[i])
            if tmp_score>score:
                score=tmp_score
                ans=t+1
        Ans[day]=ans
        Last[ans-1]=day
    print(*Ans,sep='\n')
    
if __name__=='__main__':
    main()

Solution (Python):
D=int(input())
clist=list(map(int,input().split()))
smat=[[int(x) for x in input().split()] for _ in range(D)]



index_set=set(range(26))
for d in range(D):
  max_index=-1
  max_sd=-1
  for i in index_set:
    if max_sd<smat[d][i]:
      max_index=i
      max_sd=smat[d][i]
      
  max_index2=-1
  max_sd2=-1
  for i in range(26):
    if max_sd<smat[d][i]:
      max_index2=i
      max_sd2=smat[d][i]
      
  if max_index==max_index2:
    print(max_index+1)
    index_set.remove(max_index)
  else:
    if max_sd2>8*max_sd:
      print(max_index2+1)
    else:
      print(max_index+1)
      index_set.remove(max_index)      
      
  if not index_set:
    index_set=set(range(26))
  else:
    sum_c=0
    for i in index_set:
      sum_c+=clist[i]
    if sum_c==0:
      index_set=set(range(26))

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(d)]
heru = [0 for _ in range(26)]
for i in s:
	targ = i
	for j in range(26):
		targ[j] -= heru[j]
	r = targ.index(max(targ))
	heru[r] -= c[r]
	print(r+1)

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
s = []
p = [1]*d
for i in range(d):
    s.append(list(map(int,input().split())))
    p[i] = s[i].index(max(s[i]))+1
for i in range(d):
    print(p[i])

Solution (Python):
D = int(input())
c = list(map(int, input().split()))
last = [0] * 26
ans = []
S = []
prev_score = 0
for d in range(1, D+1):
    s = list(map(int, input().split()))
    S += [s]
    maxs = float('-inf')
    maxi = -1
    cumsump = 0
    for i in range(26):
        tmp = -c[i] * (d - last[i])
        cumsump += tmp
    for i in range(26):
        tmp = -c[i] * (d - last[i])
        tmp2 = s[i] + cumsump - tmp
        if tmp2 > maxs:
            maxs = tmp2
            maxi = i
    ans += [maxi+1]
    last[maxi] = d
    prev_score += maxs

for tt in range(13):
    for dd in range(D):
        last = [0] * 26
        score = 0
        for d in range(1, D+1):
            if dd == (d-1):
                maxc = 0
                maxci = -1
                for i in range(26):
                    cost = c[i] * (d - last[i])
                    if maxc < cost:
                        maxc = cost
                        maxci = i+1
                prev_a = ans[dd]
                ans[dd] = maxci
            td = ans[d-1] - 1
            cumsump = 0
            for i in range(26):
                if td != i:
                    tmp = -c[i] * (d - last[i])
                    cumsump += tmp
            last[td] = d
            score += S[d-1][td]+cumsump
        if score <= prev_score:
            ans[dd] = prev_a
        else:
            prev_score = score
    
for a in ans:
    print(a)

Solution (Python):
import sys
input = sys.stdin.readline
import random
import time
import copy
time0=time.time()

D=int(input())
C=[0]+list(map(int,input().split()))
S=[0]+[[0]+list(map(int,input().split())) for i in range(D)]

ANS=0
T=[0]
LAST=[0]*27
for day in range(1,D+1):
    SCORE=[-1<<30]*27
    for j in range(1,27):
        SC=0
        SC+=S[day][j]

        for k in range(1,27):
            if j==k:
                continue
            SC-=C[k]*(day-LAST[k])
        SCORE[j]=SC

    choose=SCORE.index(max(SCORE))
    T.append(choose)
    LAST[choose]=day

ANS=0
LAST=[[0]*27 for i in range(D+1)]
for day in range(1,D+1):
    for j in range(1,27):
        LAST[day][j]=LAST[day-1][j]
    t=T[day]
    ANS+=S[day][t]
    LAST[day][t]=day

    for j in range(1,27):
        ANS-=C[j]*(day-LAST[day][j])

while time.time()-time0<1.77:
    BT=copy.deepcopy(T)
    BLAST=copy.deepcopy(LAST)
    BANS=ANS
    
    d=random.randint(1,D)
    after_t=random.randint(1,26)

    before_t=T[d]

    ANS+=S[d][after_t]-S[d][before_t]

    T[d]=after_t

    for day in range(d,D+1):
        if T[day]!=before_t:
            ANS+=C[before_t]*(day-LAST[day][before_t])
            LAST[day][before_t]=LAST[day-1][before_t]
            ANS-=C[before_t]*(day-LAST[day][before_t])
        else:
            break

    ANS+=C[after_t]*(d-LAST[d][after_t])
    LAST[d][after_t]=d

    for day in range(d+1,D+1):    
        if T[day]!=after_t:
            ANS+=C[after_t]*(day-LAST[day][after_t])
            LAST[day][after_t]=LAST[day-1][after_t]
            ANS-=C[after_t]*(day-LAST[day][after_t])

    if ANS<BANS:
        T=BT
        LAST=BLAST
        ANS=BANS

print(*T[1:])

Solution (Python):
import random
D=int(input())                                          
c=list(map(int,input().split()))                        
s=[list(map(int,input().split())) for _ in range(D)]    





typ=0
ans=0
l=[i for i in range(1,27)]
for i in range(D):
    if i%26==0:
        random.shuffle(l)
    print(l[i%26])

Solution (Python):


from time import time
from math import exp
key = 1
rnd_mod = 12345678901234567891
rnd_x = 9876543210987654321 + 1234567890123456789 * key % rnd_mod
def rnd():
    global rnd_x
    rnd_x = rnd_x**2 % rnd_mod
    return (rnd_x>>10) % (1<<40)
def randrange(a, b=-1):
    if b > 0: return randrange(b-a) + a
    return rnd() % a

def calc():
    s = 0
    last = [-1] * 26
    for i, t in enumerate(A):
        s += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            s -= c * (i - last[j])
    return s

sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]



ans = calc()

while time() - sTime < 1.8:
    T = 1000 * max(1 - (time() - sTime) / 1.6, 0)
    d = randrange(D)
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for k in range(d + 1, D):
        if A[k] == i:
            prev_ne = k
            break
    else:
        prev_ne = D
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        for k in range(d + 1, D):
            if A[k] == j:
                new_ne = k
                break
        else:
            new_ne = D
        t += C[j] * (d - new) * (new_ne - d) - C[i] * (d - prev) * (prev_ne - d)
        if (T < 1 and t > 0) or (T >= 1 and randrange(1 << 10) < exp(max(min(t / T, 0), -10)) * (1 << 10)):
            A[d] = j
            ans += t
            prev, prev_ne = new, new_ne
            i = j
            if 0:
                print("A =", A)
                print("ans =", ans)
                print("calc =", calc())
            
            

print(*[a + 1 for a in A], sep = "\n")
if 0:
    print(ans)
    print("A =", A)

Solution (Python):
import random
import time
import copy
start=time.time()
d=int(input())
c=list(map(int, input().split()))
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
s=[]
solution=[]
last=[0]*26
sco=0
for i in range(d):
  s.append(list(map(int, input().split())))
for day in range(1,d+1):
  man=[]
  for i in range(26):
    man.append(s[day-1][i]+last[i]*c[i])
  con=man.index(max(man))
  sco+=s[day-1][con]
  last[con]=day
  for (i,j) in zip(last,range(26)):
    sco-=cli[i][j]
  solution.append(con)

while time.time()-start<1.9:
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(3)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[i][j]
  if sc>sco:
    solution=copy.deepcopy(sol)
    sco=sc
for i in solution:
  print(i+1)

Solution (Python):
def main():
    D = int(input())
    c = list(map(int, input().split()))
    last = [0] * 27
    for d in range(1, D+1):
        s = list(map(int, input().split()))
        max_s = max(s)
        index_s = s.index(max_s)
        print(index_s + 1)


if __name__ == '__main__':
    main()

Solution (Python):
import sys

input=sys.stdin.readline
from random import randint
d=int(input().rstrip())
c=[int(i)for i in input().split()]
s=[[int(i)for i in input().split()]for _ in range(d)]
last=[0]*26
for i in range(d):
    print((i+4)%26+1)

Solution (Python):

D = int(input())
cs = list(map(int, input().split()))
ss = [input().split() for l in range(D)]

for i in range(D):
    print(4)

Solution (Python):
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0

for i in range(D):
  s.append(list(map(int,(input().split()))))
  for day in range(26):
    if(last[day]!=0):
      last[day]+=1

  for j in range(26):
    for k in range(26):
      s[i][j]-=c[k]*(1-last[k])
  sat+=max(s[i])+c[s[i].index(max(s[i]))]
  last[s[i].index(max(s[i]))]=1
  ans=s[i].index(max(s[i]))+1
  print(ans)

Solution (Python):
for i in range(365):
  print(1)

Solution (Python):

import random
random.seed(0)

D = int(input())
C = list(map(int, input().split()))
list_S = [list(map(int, input().split())) for _ in range(D)]

answer = []

def manzoku(A):
  score = 0
  L = [0 for _ in range(26)]
  for i in range(D):
    S = list_S[i]
    contest_index = A[i]
    for j in range(26):
      if j==contest_index:
        L[j] = 0
        score += S[j]
      else:
        L[j] += C[j]
        score -= L[j] 
  return score

L = [0 for _ in range(26)]
for S in list_S:
  contest_index = -1
  contest_manzoku = -10**9
  for i in range(26):
    i_manzoku = S[i]+C[i]+L[i]
    if i_manzoku > contest_manzoku:
      contest_index = i
      contest_manzoku = i_manzoku
  answer.append(contest_index)
  for i in range(26):
    if i==contest_index:
      L[i] = 0
    else:
      L[i] += C[i]

answer = [0 for _ in range(D)]
manzoku_now = manzoku(answer)

answer_tmp = [answer[i] for i in range(D)]
for j in range(365):
  day = j%D
  contest = random.randrange(26)
  answer_tmp = [answer[i] for i in range(D)]
  answer_tmp[day] = contest
  if manzoku_now < manzoku(answer_tmp):
    manzoku_now = manzoku(answer_tmp)
    answer[day] = contest
  else:
    answer_tmp[day] = answer[day]

for index in answer:
  print(index+1)

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
up = []
for _ in range(d):
  up.append(list(map(int,input().split())))
ans = [[-1] for _ in range(26)]
for i in range(d):
  ans[i%26].append(i)






for al in range(26):
  ans[al].append(d)

import bisect
from random import random
from random import randrange
scr = 0
for al in range(26):
  now = ans[al]
  l = len(now)
  for j in range(1,l):
    scr -= c[al] * (now[j]-now[j-1]-1) * (now[j]-now[j-1]) // 2
    
  for j in range(1,l-1):
    scr += up[now[j]][al]
    
  

task = [i%26 for i in range(d)]

for _ in range(10**5):
  day = randrange(d)
  pre = task[day]
  pst = randrange(26)
  if pre == pst:
    continue
  bpre = bisect.bisect_left(ans[pre],day)
  bpst = bisect.bisect_left(ans[pst],day)
  bpre1 = ans[pre][bpre-1]
  bpre2 = ans[pre][bpre+1]
  bpst1 = ans[pst][bpst-1]
  bpst2 = ans[pst][bpst]
  
  
  
  
  tmp = 0
  tmp -= c[pre] * (day-bpre1) * (bpre2-day)
  
  tmp += c[pst] * (day-bpst1) * (bpst2-day)
  
  tmp -= up[day][pre]
  
  tmp += up[day][pst]
  
  
  if tmp > 0:
    
    
    ans[pre].remove(day)
    bisect.insort(ans[pst],day)
    
    
    task[day] = pst
    scr += tmp
    
  

  
for x in task:
  print(x+1)

Solution (Python):


def main():

    for i in range(365):
        print(10)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for _ in range(D):
        S.append([int(x) for x in input().split()])
    for i in range(D):
        print(S[i].index(max(S[i]))+1)

if __name__ == '__main__':
    main()

Solution (Python):
from bisect import bisect_left
D = int(input())
C = list(map(int, input().split()))  
S = [list(map(int, input().split())) for _ in range(D)]
Last = [-1] * 26
def calc_pena(day):
    res = 0
    for l, c in zip(Last, C):
        res += (day-l)*c
    return res
T2 = [[-1] for _ in range(26)]
def change(day, contest):
    diff = 0
    contest_old = T[day]
    T[day] = contest
    idx = bisect_left(T2[contest_old], day)
    diff -= C[contest_old] * (T2[contest_old][idx+1] - day) * (day - T2[contest_old][idx-1])
    del T2[contest_old][idx]
    idx = bisect_left(T2[contest], day)
    diff += C[contest] * (T2[contest][idx] - day) * (day - T2[contest][idx-1])
    T2[contest].insert(idx, day)
    diff += S[day][contest] - S[day][contest_old]
    return diff

T = []
ans = 0
for day, s in enumerate(S):
    best_gain = -999999
    best_gain_contest = None
    pena = 0
    for cont, (l, c, s_) in enumerate(zip(Last, C, s)):
        p = (day-l)*c
        pena += p
        if best_gain < s_ + p:
            best_gain = s_ + p
            best_gain_contest = cont
    T.append(best_gain_contest)
    Last[best_gain_contest] = day
    ans += best_gain - pena










print("\n".join(str(a+1) for a in T))

Solution (Python):
import sys
input = sys.stdin.readline
import random
import copy
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(d)]
ans = []
now = [0]*26
for i in range(d):
    no = -1
    score = -10**10
    for j in range(26):
        count = s[i][j]
        for k in range(26):
            if j == k:
                continue
            count -= (i+1-now[k])*c[k]
        if count > score:
            no = j
            score = count
    ans.append(no+1)
    now[no] = i+1
score = [0]*26
for i in range(d):
    
    now[ans[i]-1] = i+1
    ind = ans[i]-1
    for j in range(26):
        if j == ind:
            score[j] += s[i][ind]
        else:
            x = (i+1-now[j])*c[j]
            score[j]-= x
SUM = sum(score)
roop = 0
while roop < 1000:
    x = random.randint(1,d)
    y = random.randint(1,26)
    if ans[x-1] == y:
        continue
    be = ans[x-1]
    be -= 1
    now1 =  0
    now2 = 0
    nex = copy.deepcopy(ans)
    nex[x-1] = y
    y -= 1
    count1 = 0
    count2 = 0
    for j in range(d):
        if be == nex[j]-1:
            now1 = j+1
            count1 +=s[j][be]
        else:
            count1 -= (j+1-now1)*c[be]
        if y == nex[j]-1:
            now2 = j+1
            count2 +=s[j][y]
        else:
            count2 -= (j+1-now2)*c[y]
 
    count = SUM + count1+count2-score[be]-score[y]
    
    if count > SUM:
        score[be] = count1
        score[y] = count2
        ans = nex
        SUM = count
    roop += 1
for i in ans:
    print(i)

Solution (Python):



import random as ra
import copy
import time

start_time = time.time()

D = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(D)]



def cal_point(t):
    score = 0
    last = [0]*26
    for d in range(D):
        score += s[d][t[d]-1]
        last[t[d]-1] = d+1
        for i in range(26):
            score -= c[i]*(d+1-last[i])
    
    return score


t = []
last = [0]*26
for i in range(D):
    opt1 = s[i].index(max(s[i]))
    opt2 = last.index(min(last))
    if ra.random()<0.5:
        t.append(opt1+1)
        last[opt1] = i+1
    else:
        t.append(opt2+1)
        last[opt2] = i+1



max_score = 0
optimal_t = copy.deepcopy(t)

while (time.time()-start_time)<1.95:

    d = ra.randint(1,D)
    q = ra.randint(1,26)
    td = t[d-1]
    t[d-1] = q
    now = cal_point(t)
    if now > max_score:
        optimal_t = copy.deepcopy(t)
        max_score = now
    else:
        t[d-1] = td

print(*optimal_t,sep='\n')

Solution (Python):
D = int(input())
C = list(map(int, input().split()))

S = []
for _ in range(D):
  S.append(list(map(int, input().split())))

def solve():
  LastD = [0] * 26
  sc = 0
  for i in range(D):
    t = 0
    wk = -10000000000
    for tx in range(26):
      scwk = S[i][tx] + C[tx] * (i+1 - LastD[tx])
      if wk < scwk:
        wk = scwk
        t = tx
    sc += S[i][t]
    LastD[t] = i+1
    for j in range(26):
      sc -= C[j] * (i+1 - LastD[j])
    print(t+1)
  return sc
    
solve()