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 sys
from random import randint
input = sys.stdin.readline
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

t = [0] * D
last = [0] * 26
def score(day, score):
  for i in range(26): score -= (day - last[i]) * c[i]
  return score
def run(day):
  global last
  last = [0] * 26
  res = 0
  for d in range(day):
    contest = t[d] - 1
    last[contest] = d + 1
    res = score(d + 1, res) + s[d][contest]
  return res


for d in range(1, D + 1):
  mx = -float("inf")
  mxx = randint(1, 27)
  for x in range(26):
    t[d - 1] = x
    res = run(d)
    if mx < res:
      mx = res
      mxx = x
  t[d - 1] = mxx
for d in range(1, D + 1):
  mx = -float("inf")
  mxx = t[d - 1]
  for x in range(26):
    t[d - 1] = x
    res = run(d)
    if mx < res:
      mx = res
      mxx = x
  t[d - 1] = mxx

for x in t: print(x + 1)

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
like=0
but=0
s=[]
last=[]
show=''
for i in range(26):
    last.append(0)
for i in range(d):
    keys=list(map(int,input().split()))
    s.append(keys)
for i in range(d):
    show+=str(s[i].index(max(s[i]))+1)
    show+='\n'
print(show)

Solution (Python):
import numpy as np
ans=0
D=int(input())
C=np.array(list(map(int,input().split())))
last_day=np.array([0 for _ in range(26)])

for day in range(1,D+1):
    score=np.array(list(map(int,input().split())))
    tmp=C*(last_day-day)
    S=sum(tmp)
    for k in range(26):
        tmp[k]=score[k]+S-tmp[k]
    
    idx=np.argmax(tmp)
    
    last_day[idx]=day
    print(idx+1)

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]
ans = [0]*D
manzoku_down = [0]*26
for i in range(D):
    tmp = -float('inf')
    for j in range(26):
        last = 0
        for l in range(0,i+1):
            if ans[l] == j+1:
                last = j+1
        manzoku_down[j] = C[j]*((i+1)-last)
    for k in range(26):
        if S[i][k]-sum(manzoku_down)+manzoku_down[k] >= tmp:
            tmp = S[i][k]-sum(manzoku_down)+manzoku_down[k]
            ans[i] = k+1
for i in ans:
    print(i)

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

t=[0]*D

S=0


last=[0]*26
for d in range(D):
    bestchoice=0
    bestscore=-1000000

    plusscore=0
    minusscore=0

    for i in range(26):
        plusscore=s[d][i]
        minusscore=c[i]*(d+1 - last[i])

        if bestscore<(plusscore+minusscore):
            bestscore=(plusscore+minusscore)
            bestchoice=i
    
    t[d]=bestchoice+1
    S+=s[d][bestchoice]
    last[bestchoice]=d+1

    for i in range(26):
        S-=c[i]*(d+1 - last[i])

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

Solution (Python):
from math import inf
A=26

D=int(input())

C=[0]+list(map(int,input().split())) 


for i in range(1,D+1):
    S=list(map(int,input().split()))

    M=max(S)
    print(S.index(M)+1)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def score(tt):
    ans=0
    for i,t in enumerate(tt):
        t-=1
        ans += ss[i][t]
        p = i - last[t]
        ans -= p * (p + 1) // 2 * cc[t]
        last[t] = i + 1
    for t in range(26):
        p = d - last[t]
        ans -= p * (p + 1) // 2 * cc[t]
    return ans

inf=10**16
d = II()
cc = LI()
ss = LLI(d)
ans = 0
last = [0] * 26
tt=list(range(1,27))*(d//26+1)
tt=tt[:d]
for _ in range(50):
    for i in range(d):
        mx=-inf
        best=0
        for j in range(1,27):
            tt[i]=j
            cur=score(tt)
            if cur>mx:
                mx=cur
                best=j
        tt[i]=best

print(*tt,sep="\n")

Solution (Python):
D = int(input())
c = list(map(int, input().split()))
s = []
for i in range(D):
  s.append(list(map(int, input().split())))
  
sdictlist = []
sdictlistsorted = []
for i in range(D):
  onedict = {}
  for j in range(26):
    onedict[j] = s[i][j]
  sdictlist.append(onedict)
  onesorteddict = sorted(onedict.items(), key=lambda x:x[1], reverse=True)
  sdictlistsorted.append(onesorteddict)

lenpastmax = 22 




pastlist = []
for i in range(D):
  j = 0
  while(sdictlistsorted[i][j][0] in pastlist):
    j += 1
  print(sdictlistsorted[i][j][0]+1)
  pastlist.append(sdictlistsorted[i][j][0])
  if(len(pastlist)==lenpastmax):
    pastlist.pop(0)

Solution (Python):
import copy
import time
import random

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

p = calc(T)

while time.time()-t1 < 1.8:
    i = random.randint(0, D-1)
    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

for t in T:
    print(t)

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
s= [list(map(int,input().split())) for _ in range(D)]
u= [s[i].index(max(s[i]))+1 for i in range(D)]
for ans in u:
    print(ans)

Solution (Python):
import random
from copy import deepcopy

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

ans = [1]*d

def score(l):
    lastd = [0]*26
    point = 0
    for j,k in enumerate(l):
        kk = k-1
        point += s[j][kk]
        lastd[kk] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
    return point

ma = score(ans)

def random_search():
    global ans
    li = deepcopy(ans)
    D = random.randrange(0,d,1)
    Q = random.randrange(0,26,1)
    li[D] = Q+1
    if score(li) > ma:
        ans = deepcopy(li)

for i in range(1000):
    random_search()

for i in ans:
    print(i)

Solution (Python):
import time
import random

def test(li):
    m=0
    for i in range(D):
        m+=s[i][li[i]-1]
        last[li[i]-1]=i+1
        for j in range(26):
            m-=c[j]*(i+1-last[j])
    return m

start=time.time()
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(D)]
last=[0]*26
t=[random.randrange(1,27) for i in range(D)]

res=test(t)

while(True):
    if time.time()-start>=1.70:
        break
    for i in range(D):
        if time.time()-start>=1.70:
            break
        q=random.randrange(1,27)
        li=t.copy()
        li[i]=q
        r=test(li)
        if r>res:
            res=r
            t[i]=q
print(*t,sep='\n')

Solution (Python):
from random import randint, seed

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

def calc(ans):
    ret = 0
    L = [0] * D
    for d, t in enumerate(ans):
        ret += S[d][t]
        for c, l in zip(C, L):
            ret -= c * (d - l)
    return ret

mx = -10**18
ans = None
for i in range(1000):
    seed(i)
    A = [randint(0, 25) for _ in range(D)]
    res = calc(A)
    if mx < res:
        mx = res
        ans = A

print(*[a + 1 for a in A], sep='\n')

Solution (Python):
def main():
    INF = 10 ** 9 + 10

    D = int(input())
    *C, = map(int, input().split())
    
    
    S = [[int(x) for x in input().split()] for _ in range(D)]
    

    last = [-1] * 26

    def diff(d, t):
        ret = S[d][t]
        ret -= sum(ci * (d - last[i]) for i, ci in enumerate(C) if i != t)
        return ret

    T = []
    score = 0
    for d in range(D):
        delta = -INF
        take_t = -1
        for t_ in range(26):
            buf = diff(d, t_)
            if delta < buf:
                delta = buf
                take_t = t_

        last[take_t] = d
        score += buf
        T.append(take_t + 1)
    print(*T, sep='\n')
    


if __name__ == '__main__':
    main()

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

S = []
for i in range(D):
    Si = list(map(int, input().split()))
    S.append(Si)
I = 26

last = [0]*I

score = S[1]
contest = score.index(max(score))

last = [x+1 for x in last]
last[contest] = 0

print(contest + 1)

for day in range(1, D):
    ddc = sum([C[i]*(last[i]+1) for i in range(I)])
    score = [-ddc + C[i]*(last[i]+1) + S[day][i] for i in range(I)]
    contest = score.index(max(score))

    last = [x+1 for x in last]
    last[contest] = 0

    print(contest + 1)

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

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

INF = 10**18
eps = 10**-7

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

past = -1
for s in S:
    ansidx = 0
    anssum = 0
    for i,si in enumerate(s,start=1):
        if anssum < si and past != i:
            ansidx = i
            anssum = si
    print(ansidx)
    past = ansidx

Solution (Python):
import sys
import numpy as np
import numba

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

i4 = numba.int32

def get_input():
    D = int(readline())
    C = np.array(readline().split(), np.int32)
    S = np.array([readline().split() for _ in range(D)], np.int32)
    return D, C, S

@numba.njit((i4, i4[:], i4[:, :], i4[:]), cache=True)
def first_computation(D, C, S, T):
    x = 0
    last = np.zeros((26, D), np.int32)
    for d in range(D):
        if d:
            last[:, d] = last[:, d - 1]
        i = T[d]
        x += S[d, i]
        last[i, d] = d + 1
        for i in range(26):
            x -= C[i] * (d + 1 - last[i, d])
    return last, x

@numba.njit((i4, i4[:], i4[:, :], i4[:], i4[:, :], i4, i4), cache=True)
def difference_update(D, C, S, T, last_day, d, q):
    p = T[d]
    T[d] = q
    x = S[d, q] - S[d, p]

    i = np.searchsorted(last_day[p], d + 1)
    d_p = last_day[p, i - 1] if i >= 1 else 0
    coef = 0
    for k in range(d, D):
        if last_day[p, k] == d + 1:
            
            coef += d_p - d - 1
            last_day[p, k] = d_p
        else:
            break
    x += coef * C[p]

    coef = 0
    for k in range(d, D):
        if last_day[q, k] < d + 1:
            coef += (d + 1 - last_day[q, k])
            last_day[q, k] = d + 1
        else:
            break
    x += coef * C[q]
    return x

def first_strategy(D, C, S):
    T = np.empty(D, np.int32)
    for d in range(D):
        T[d] = np.argmax(S[d])
    return T

def output(T):
    T += 1
    print(*T, sep='\n')

D,C,S = get_input()

T = first_strategy(D,C,S)
output(T)

Solution (Python):
import time
st=time.time()
d=int(input())
c=[0]+[int(j)for j in input().split()]
s=[[0]+[int(j)for j in input().split()]for i in range(d)]
s2=[sorted([[j,idx]for idx,j in enumerate(s[i])],reverse=True)for i in range(d)]
t=[i[0][1]for i in s2]
ans=0
p=1
q=t[0]-1
se=set()
while time.time()-st<1.8:
    if len(se)==26:
        p+=1
        if p>d:break
        se=set()
        q=t[p-1]
    se.add(q)
    l=[0]*27
    tmp=0
    pre=t[p-1]
    t[p-1]=q
    for i,j in enumerate(t,1):
        tmp+=s[i-1][j]
        l[j]=i
        for k in range(1,27):
            tmp-=(i-l[k])*c[k]
    if ans<tmp:
        ans=tmp
    else:
        t[p-1]=pre
    nextq=list(set(range(1,27))-se)
    if nextq!=[]:
        q=nextq[0]

for i in t:
    print(i)

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

SUM = 0
last = [0] * 28
for d in range(1, D + 1):
    i = S[d - 1].index(max(S[d - 1]))
    print(i + 1)

Solution (Python):
inf = 10**12


def main():
    import sys
    from random import randint
    from bisect import bisect_left
    input = sys.stdin.readline

    D = int(input())
    C = list(map(int, input().split()))
    S = []
    for _ in range(D):
        S.append(list(map(int, input().split())))
    ans = 0
    last = [-1] * 26
    days = [[-1] for _ in range(26)]
    T = []
    
    for d in range(D):
        plus = -inf
        t = -1
        for tt in range(26):
            plus_new = S[d][tt] + C[tt] * (d - last[tt])
            if plus_new > plus:
                t = tt
                plus = plus_new
        T.append(t)
        ans += S[d][t]
        last[t] = d
        days[t].append(d)
        for i in range(26):
            ans -= C[i] * (d - last[i])
    for t in range(26):
        days[t].append(D)

    def calc(d, q, cur):
        t = T[d]
        cur += S[d][q]
        cur -= S[d][t]
        i = bisect_left(days[q], d)
        cur += C[q] * (d - days[q][i - 1]) * (days[q][i] - d)
        j = bisect_left(days[t], d)
        cur -= C[t] * (d - days[t][j - 1]) * (days[t][j + 1] - d)
        return cur

    
    size = 5
    try_num = 1000
    for x in range(D // size):
        d_list = list(range(x*size, (x+1)*size))
        for _ in range(try_num):
            t_new = [randint(0, 25) for _ in range(size)]
            ans_new = ans
            for i, d in enumerate(d_list):
                ans_new = calc(d, t_new[i], ans_new)
            if ans_new > ans:
                ans = ans_new
                for i, d in enumerate(d_list):
                    t_old = T[d]
                    T[d] = t_new[i]
                    days[t_new[i]].append(d)
                    days[t_new[i]].sort()
                    days[t_old].remove(d)
    for t in T:
        print(t+1)


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]
      
  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()))
c_days=[0]*26
c_days_2=[0]*26
fir_ans=0
sec_ans=0
for i in range(d):
    s=list(map(int,input().split()))
    
    n=s.index(max(s))
    c_days_2[n]=i+1
    if i==0:
        nn=s.index(max(s))
    else:
        
        c_low=[c[x]*(i+1-c_days[x]) for x in range(26)]
        
        nn=c_low.index(max(c_low))
        sec_ans+=s[nn]
        c_days[nn]=i+1

    for l in range(26):
        los=c[l]*(i+1-c_days[l])
        sec_ans-=los

        los=c[l]*(i+1-c_days_2[l])
        fir_ans-=los

    if fir_ans>=sec_ans:
        print(n+1)
        sec_ans=fir_ans
        c_days_2=c_days
    else:
        print(nn+1)
        fir_ans=sec_ans
        c_days=c_days_2

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

Solution (Python):
import numpy as np

d = int(input())
C = np.array(list(map(int, input().strip().split())))
S = np.array([list(map(int, input().strip().split())) for i in range(d)])
D = np.zeros(26)

t = 0
for i in range(d):
    day = i + 1
    temp_score = 0
    con = 0
    d_l = [day]*26
    for j in range(26):
        score = S[i][j]
        score -= sum((d_l - D) * C)
        score += (day - D[j]) * C[j]
        if score > temp_score:
            con = j
            temp_score = score
    print(con + 1)
    D[con] = i + 1
    t += temp_score

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline

D = int(input())
C = list(map(int,input().split()))
S = [list(map(int,input().split())) for _ in range (D)]
M = 26
INF = 10**20

ans = [0]*D
lasts = [0]*(M+1)

score = 0
for i in range(D):
    contest = 0
    max_score = -INF
    for m in range(M):
        new_score = score
        new_score += S[i][m]
        for m2 in range(M):
            if m==m2:continue
            new_score -= C[m2]*(i+1-lasts[m2])
        if new_score>max_score:
            contest = m+1
            max_score = new_score
    
    ans[i] = contest
    lasts[contest-1] = i+1
    score = max_score

for a in ans:
    print(a)

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]
a=0
d=0
for i in range(26):
  b=0
  for j in range(D):
    b+=s[j][i]
  b-=((D-1)*c[i])
  if a<=b:
    d=i
for i in range(D):
  if i!=D-1:
    print(d+1)
  else:
    p=0
    q=0
    for j in range(26):
      if p<=s[D-1][j]:
        p=s[D-1][j]
        q=j
    print(j+1)

Solution (Python):
dur=int(input())
c=list(map(int,input().split()))
d=[0]*26
for i in range(dur):
  t=0
  s=list(map(int,input().split()))
  m=-1<<64
  for j in range(26):
    alt=s[j]+c[j]*(i+1-d[j])+sum([-c[k]*(i+1-d[k]) for k in range(26)])
    if alt>m:
      m=alt
      t=j
  print(t+1)
  d[t]=i+1
def cost():
  for i in range(dur):
    t=0
    s=list(map(int,input().split()))
    m=-1<<64
    for j in range(26):
      alt=s[j]+c[j]*(i+1-d[j])+sum([-c[k]*(i+1-d[k]) for k in range(26)])
      if alt>m:
        m=alt
        t=j
    print(t+1)
    d[t]=i+1

Solution (Python):
import random

D = int(input())
c_list = list(map(int, input().split()))
for i in range(D):
    S_list = list(map(int, input().split()))
for i in range(D):
    print(random.randint(1,26))

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 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):
from random import *
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(365)]
for i in range(365):
    cand=0
    for j in range(26):
        if s[i][cand]<s[i][j]:
            cand=j
    print(cand+1)

Solution (Python):
import  numpy as np
D = int(input())
c = np.array(list(map(int, input().split())))
s = [list(map(int, input().split())) for _ in range(D)]
last_d = np.array([0]*len(c))

ans = 0
for i in range(D):
  cc = c*(last_d+i+1)
  max_c = max(cc)
  index = np.argmax(cc)
  print(index + 1)
  last_d[index] = -(i+1)
  ans += s[i][index]
  cc[index] = 0
  for j in cc:
    ans -= j

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):
    d,q=random.randrange(1,D+1),random.randrange(1,27)
    old=T[d]
    T[d]=q
    new=point()
    if new>now:
        now=new
    else:
        T[d]=old

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

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(26):
            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):

def main():
    import sys
    import numpy as np
    D=int(sys.stdin.readline())
    S=np.zeros((D,26))
    C=np.array(map(int,sys.stdin.readline().split()))
    for i in range(D):
        S[i]=list(map(int,sys.stdin.readline().split()))
    
    for i in range(D):
        print(np.argmax(S[i])+1)

main()

Solution (Python):
import sys
import numpy as np

ri = lambda: int(sys.stdin.readline())
rl = lambda: list(map(int, sys.stdin.readline().split()))

D = ri()
c = np.array(rl())
s = np.array([np.array(rl()) for _ in range(D)])
for lis in s:
  tmp_list = lis/c
  max_idx = np.argmax(tmp_list)
  print(max_idx + 1)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    D = int(input())
    c = [0] + list(map(int, input().split()))
    s = [[0]*27]
    for _ in range(D):
        s.append([0] + list(map(int, input().split())))
    for i in range(1, D+1):
        print(s[i].index(max(s[i])))

if __name__ == '__main__':
    main()

Solution (Python):
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
X=[0]*26
Y,Z=0,0
for i in range(D):
  for j in range(26):
    X[j]+=C[j]
  Y,Z=-1,-10**20
  for j in range(26):
    if Y==-1:
      Y,Z=0,X[0]+S[i][0]
    if Z<X[j]+S[i][j]:
      Y,Z=j,X[j]+S[i][j]
  X[Y]=0
  print(Y+1)

Solution (Python):

import copy
D = int(input())
C = list(map(int,input().split()))
S = []
for i in range(D):
    s = list(map(int,input().split()))
    S.append(s)
    
day_of_problems = [0] * 27

tmp = 0

for i in range(D):
    A = []
    for t in range(26):
        A.append(S[i][t] + day_of_problems[t])
    tmp = max(A)
    idx = A.index(tmp)
    day_of_problems[idx] = i+1
    print(idx+1)

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

sat = 0
last = [0] * 26
for d in range(D):
    v = 0
    j = 0
    for x in range(26):
        if v < s[d][x]:
            j = x
            v = s[d][x]
    last[j] = d + 1
    print(j+1)

    for i in range(26):
        sat -= (d + 1 - last[i]) * c[i]
    sat += s[d][j]

Solution (Python):
d = int(input())
cl = list(map(int, input().split()))
sl = []
for _ in range(d):
    sl.append(list(map(int, input().split())))

tl = []



last_di = [-1]*26
ans = 0
for day in range(d):
    best_t = 0
    best_t_val = -999999999999
    for t in range(26):
        curr_val = sl[day][t]*1
        for i in range(26):
            if i == t: continue
            curr_val -= (day-last_di[i])*cl[i]*4.5
        if curr_val >= best_t_val:
            best_t = t
            best_t_val = curr_val
    tl.append(best_t+1)
    last_di[best_t] = day
    ans += best_t_val
    
    
    
    

for t in tl:
    print(t)

Solution (Python):

import numpy as np
d=int(input())
c=np.array(list(map(int,input().split())))
s=[None]*d
r0=[None]*d
r1=[None]*d
cm=np.array([0]*26)
cd=np.array([0]*26)
for i in range(d):
  s[i]=list(map(int,input().split()))
s=np.array(s)
for j in range(d):  
  
  
  r_i=np.argmax(s[j])
  cd=c*cm
  if np.max(cd>s[i][r_i]):
    r_i=np.argmax(cd)
  r0[j]=r_i
  for k in range(26):
    cm[k]+=1
  cm[r_i]=0
  
  
cm=np.array([0]*26)
cd=np.array([0]*26)  
rand = np.random.randint(100, size = d) 
for j in range(d):  
  
  r_i=r0[j]
  cd=c*cm
  if rand[j]>80:
    r_i=np.argmax(cd)
  r1[j]=r_i
  for k in range(26):
    cm[k]+=1
  cm[r_i]=0
for j in range(d):
  print(r1[j]+1)

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for i in range(D)]


satisfaction = 0
last = [0]*26

for i in range(D):

    best_sat = 0
    best_T = 0
    for t in range(26):
        t_sat = S[i][t] + satisfaction - \
                sum([C[k]*((i+1)-last[k]) for k in range(26)]) + C[t]*((i+1)-last[t])
        if t_sat > best_sat:
            best_T = t
            best_sat = t_sat

    saticfaction = best_sat
    last[best_T] = i + 1
    
    
    print(best_T+1)

Solution (Python):


from collections import defaultdict
from copy import deepcopy

def greedy(D, c, s):

    ret = []
    last = defaultdict(int)

    for d in range(1, D+1):

        last = defaultdict(int)
        scores = dict()


        for choice in range(1,27):
            _last = deepcopy(last)  
            satisfaction = s[(d, choice)]
            _last[choice] = d
            for i in range(1,27):
                satisfaction -= c[i]*(d - _last[i])

            scores[choice] = satisfaction

        choice = max(scores, key=scores.get)
        ret += [choice]
        last[choice] = d

    return '\n'.join(map(str, ret))

D = int(input())
c = input().split(' ')
c = list(map(int, c))
c = [float("inf")] + c
s = dict()
for i in range(D):
    row = input().split(' ')
    for j, e in enumerate(row):
        e = int(e)
        s[(i+1, j+1)] = e

print(greedy(D, c, s))