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 numpy as np

d = int(input())
c = list(map(int, input().split()))
c_sum = sum(c)
s = [[] for _ in range(d)]
for i in range(d):
  s[i] = list(map(int, input().split()))
  
last = [0 for _ in range(26)]
plan = [-1 for _ in range(d)]

def loss(today):
  sum = 0
  for i in range(26):
    sum += c[i-1] * (today - last[i-1])
  return sum
  
  
v = 0
for today in range(1, d+1):
  t = np.argmax([s[today-1][i] + c[i]*(today - last[i-1]) for i in range(26)])
  t += 1
  last[t-1] = today
  plan[today-1] = t
  print(t)

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(1,D+1):
    print(5)

Solution (Python):
import sys
import random

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def write_output(out):
    with open("my_sample2.out", mode="w") as f:
        for x in out:
            f.write(str(x + 1) + "\n")

def main():
    d = int(readline())
    c = list(map(int, readline().split()))
    s = [list(map(int, readline().split())) for _ in range(d)]

    sat_cur = 0
    last = [1] * 26
    out = [-1] * d

    for day in range(d):
        estimate = [0.0] * 26
        for cid in range(26):
            if s[day][cid] > 16000:
                estimate[cid] = last[cid] * c[cid] + c[cid] ** 1
        cur = estimate.index(max(estimate))
        out[day] = cur
        sat_cur += s[day][cur]
        last[cur] = 1
        for cid in range(26):
            if cid != cur:
                last[cid] += 1
                sat_cur -= last[cid] * c[cid]

    for _ in range(500):
        sat_temp = 0
        change_day = random.randint(0, d - 1)
        change_cid = random.randint(0, 25)
        last = [1] * 26
        for day in range(d):
            if day == change_day:
                cur = change_cid
            else:
                cur = out[day]
            sat_temp += s[day][cur]
            last[cur] = 1
            for cid in range(26):
                if cid != cur:
                    last[cid] += 1
                    sat_temp -= last[cid] * c[cid]
        
        if sat_temp > sat_cur:
            out[change_day] = change_cid

    for x in out:
        print(x + 1)

    




if __name__ == '__main__':
    main()

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

fuman=[0]*26

for i in range(d):
    if i==0:
        p=c.index(max(c))
        print(p+1)
    else:
        p=fuman.index(max(fuman))
        print(p+1)
        
    for j in range(26):
        fuman[j]+=c[j]
    fuman[p]=0

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

for d in range(D):
    if d%27==0:
        print(20)
    else:
        print(d%27)

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
    
    score=calc(d,C,S,Ans)
    
    
    
    
    m=10000
    for i in range(m):
        T=Ans[:]
        seed(i)
        d_idx=randint(0,d-1)
        q=randint(1,26)
        
        T[d_idx]=q
        tmp=calc(d,C,S,T)
        if tmp>score:
            score=tmp
            Ans=T[:]
    
    
    
    print(*Ans,sep='\n')
    
if __name__=='__main__':
    main()

Solution (Python):


def choose_t(c_lst, s_lst, last, day):
    scr_max = -float('inf')
    for t in range(26):
        scr = 0
        scr += s_lst[t]
        for typ in range(26):
            if typ != t:
                scr -= c_lst[typ] * (day - last[typ])

        if scr > scr_max:
            scr_max = scr
            ret = t

    return(ret)


def main():
    d = int(input())
    c_lst = list(map(int, input().split()))
    s_mat = [list(map(int, input().split())) for _ in range(d)]

    last = [-1 for _ in range(26)]
    for day in range(d):
        t = choose_t(c_lst, s_mat[day], last, day)
        last[t] = day
        print(t+1)


if __name__ == '__main__':
    main()

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

def judge(t):
    last = [0]*M
    score = 0
    for i in range(D):
        score += S[i][t[i]-1]
        last[t[i]-1] = i+1
        for m in range(M):
            score -= C[m]*(i+1-last[m])
    return score

from random import randint
import time
start = time.time()
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

while (time.time()-start<1.5):
    
    new_ans = [a for a in ans]
    idx = randint(0,D-1)
    val = randint(1,26)
    new_ans[idx] = val
    
    new_score = judge(new_ans)
    if new_score>score:
        score = new_score
        ans[idx] = val

for a in ans:
    print(a)

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())))
x = [1]*26
for i in range(d):
    q = 1
    m = -1
    for j in range(26):
        n = s[i][j] + (x[j]**2)*c[j]
        x[j] += 1
        if(m < n):
            m = n
            q = j
    x[q] *= 0
    p[i] = q+1
for i in range(d):
    print(p[i])

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
for i in range(D):
    S = list(map(int, input().split()))
    print(S.index(max(S))+1)

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

N = (C/np.sum(C)*D)
MN = np.argmax(N)

N = np.floor(N)
N[MN] += D-np.sum(N)



Plan = np.zeros(D,int)
num = np.arange(D).reshape(D,-1)

S = np.hstack((S,num)).T


test=list()
for i in range(26):
    for j in range(int(N[i])):
        test.append(int(i))


for i in test:
    l = np.argmax(S[i])
    
    Plan[S[26,l]] = i
    S = np.delete(S,l,1)


[print(i+1) for i in Plan]

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])

MAX=ANS
MAXT=copy.deepcopy(T)
d=0
after_t=0

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

    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*1000<MAX*995:
        T=BT
        LAST=BLAST
        ANS=BANS
    elif ANS>MAX:
        MAX=ANS
        MAXT=copy.deepcopy(T)

print(*MAXT[1:])

Solution (Python):
ans = [1]*365
for i in range(150):
    ans[i]=i%26 + 1
for i in range(150,255):
    ans[i]=i%10 + 1
for i in range(255,365):
    ans[i]=i%26 + 1

for i in range(365):
    print(ans[i])

Solution (Python):
import random


d=int(input())
C=[int(i) for i in input().split()]
s=[[int(i) for i in input().split()] for q in range(d)]

sco=0
L=[0 for i in range(26)]
ans=[]


for i in range(d):
    mayou=random.choice(range(26))
    est=s[i][mayou]+C[mayou]*(i+1-L[mayou])
    ans.append(mayou)
    

sco=est


"""
L=[0 for i in range(26)]
for q in range(d):
    t=ans[q]
    sco+=s[q][t]
    
    
    L[t]=q+1
    for i in range(26):
        if L[i]!=-1:
            sco-=C[i]*(q+1-L[i])
    
    print(sco)
"""


m=1000000

for que in range(m):
    newsco=sco
    dn,q=random.choice(range(1,d)),random.choice(range(1,27))
    dn-=1
    q-=1
    old=ans[dn]
    ans[dn]=q
    now=dn
    cnt=1
    while now!=0 and ans[now]!=old:
        now-=1
        cnt+=1
    now=dn
    while now!=d and ans[now]!=old:
        newsco-=cnt*C[old]
        now+=1
        cnt+=1
    newsco-=s[dn][old]
    newsco+=s[dn][q]
    now=dn
    cnt=1
    while now!=0 and ans[now]!=q:
        now-=1
        cnt+=1
    now=dn
    while now!=d and ans[now]!=q:
        newsco+=cnt*C[q]
        now+=1
        cnt+=1
    
    if newsco>sco:
        sco=newsco
        
    else:
        ans[dn]=old

for ele in ans:
    print(ele+1)

Solution (Python):
D=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for i in range(D)]
l=[[0]*26]
t=[[]]
v=[0]
for d in range(D):
    x=[]
    for b in range(len(l)):
        x.extend([(S[d][i]-sum([(d+1-l[b][j])*C[j] for j in range(26) if i!=j]),i,b) for i in range(26)])
    x=sorted(x,key=lambda a:v[a[2]]+a[0])[::-1]
    l2=[]
    t2=[]
    v2=[]
    for _,i,b in x[:9]:
        l2.append(l[b].copy())
        l2[-1][i]=d+1
        t2.append(t[b].copy())
        t2[-1].append(i+1)
        v2.append(v[b]+_)
    l=l2
    t=t2
    v=v2
print(*t[0],sep='\n')

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

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

def maxarg(l):
    nl=len(l)
    ma=-10**20
    idx=-1
    for i in range(nl):
        if l[i]>ma:
            ma=l[i]
            idx=i
    return (idx,ma)

last=[0]*26
for j,ss in enumerate(s):
    
    cand = [ss[i]-c[i]*(j+1-last[i]) for i in range(26)]
    
    idx,val = maxarg(cand)
    last[idx]=j+1
    
    print(idx+1)

Solution (Python):
def _calc_today_max_v3(today, D, Ci, Sdi, last_day):
    bad_1st_values = [Ci[contest] * (today + 1 - last_day[contest]) for contest in range(26)]
    total_bad_1st_value = sum(bad_1st_values)
    bad_2nd_values = [Ci[contest] * (today + 2 - last_day[contest]) for contest in range(26)]
    total_bad_2nd_value = sum(bad_2nd_values)
    bad_3rd_values = [Ci[contest] * (today + 3 - last_day[contest]) for contest in range(26)]
    total_bad_3rd_value = sum(bad_2nd_values)

    max_value = -99999999999999999
    max_context = 0
    for contest_1st in range(26):
        contest_1st_value = Sdi[today][contest_1st]
        bad_1st_value = total_bad_1st_value - bad_1st_values[contest_1st]
        if today == D - 1:
            today_value = contest_1st_value - bad_1st_value
            if max_value < today_value:
                max_value = today_value
                max_context = contest_1st
        else:
            for contest_2nd in range(26):
                contest_2nd_value = Sdi[today + 1][contest_2nd]
                bad_2nd_value = total_bad_2nd_value - bad_1st_values[contest_1st] - bad_2nd_values[contest_2nd] \
                                + Ci[contest_1st]

                today_value = contest_1st_value + contest_2nd_value - bad_1st_value - bad_2nd_value
                if max_value < today_value:
                    max_value = today_value
                    max_context = contest_1st
                
                
                
                
                
                
                
                
                
                
                
                
                
                

    return max_context


def _calc_today_max_v2(today, D, Ci, Sdi, last_day):
    today_bad_values = [Ci[contest] * (today + 1 - last_day[contest]) for contest in range(26)]
    today_total_bad_value = sum(today_bad_values)
    bad_2nd_values = [Ci[contest] * (today + 2 - last_day[contest]) for contest in range(26)]
    total_bad_2nd_value = sum(bad_2nd_values)

    max_value = -99999999999999999
    max_context = 0
    for contest_1st in range(26):
        contest_1st_value = Sdi[today][contest_1st]
        bad_1st_value = today_total_bad_value - today_bad_values[contest_1st]
        if today == D - 1:
            today_value = contest_1st_value - bad_1st_value
            if max_value < today_value:
                max_value = today_value
                max_context = contest_1st
        else:
            for contest_2nd in range(26):
                contest_2nd_value = Sdi[today + 1][contest_2nd]
                bad_2nd_value = total_bad_2nd_value - today_bad_values[contest_1st] - bad_2nd_values[contest_2nd]
                today_value = contest_1st_value + contest_2nd_value - bad_1st_value - bad_2nd_value
                if max_value < today_value:
                    max_value = today_value
                    max_context = contest_1st
    return max_context


def _calc_today_max(today, D, Ci, Sdi, last_day):
    today_bad_values = [Ci[contest] * (today + 1 - last_day[contest]) for contest in range(26)]
    today_total_bad_value = sum(today_bad_values)

    max_value = -99999999999999999
    max_context = 0
    for contest in range(26):
        today_contest_value = Sdi[today][contest]
        today_bad_value = today_total_bad_value - today_bad_values[contest]
        today_value = today_contest_value - today_bad_value
        if max_value < today_value:
            max_value = today_value
            max_context = contest

    return max_context


def _main(D, Ci, Sdi):
    last_day = [0] * 26
    for today in range(D):
        max_contest = _calc_today_max_v3(today, D, Ci, Sdi, last_day)
        print(max_contest + 1)
        last_day[max_contest] = today + 1


def _execute():
    D = int(input())
    Ci = list(map(int, input().split()))
    Sdi = []
    for i in range(D):
        Sdi.append(list(map(int, input().split())))
    _main(D, Ci, Sdi)


if __name__ == "__main__":
    _execute()

Solution (Python):
class ACS:
    def __init__(self, D, C, S):
        self.now = 1
        self.D = D
        self.satisfaction = 0
        self.sat_log = []
        self.C = C
        self.S = S
        self.last = [0]*26
    
    def hold_contest(self, T):
        self.satisfaction += self.S[self.now-1][T]
        self.last[T] = self.now

        for i in range(26):
            self.satisfaction -= self.C[i]*(self.now - self.last[i])
        
        self.sat_log.append(self.satisfaction)
        self.now += 1
    
    def choice_max(self):
        maxs, maxi = -(10**18), 0
        for i in range(26):
            s = self.score_check(i)
            if s >= maxs:
                maxs = s
                maxi = i
        return maxi


    def score_check(self, T):
        score = self.satisfaction + self.S[self.now-1][T]

        for i in range(26):
            if i != T:
                score -= self.C[i]*(self.now - self.last[i])
        return score

    def nd_score_check(self, Ts: list):
        last = self.last[::]
        score = self.satisfaction
        d = self.now
        
        
        for T in Ts:
            score += self.S[d-1][T]
            last[T] = d
            for i in range(26):
                score -= self.C[i]*(d - last[i])
            d += 1
        return score

        

    def _log(self):
        print(f"\nday {self.now}\n satisfaction: {self.satisfaction}")

        


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

acs = ACS(D, C, S)

for d in range(D//2):
    next_contests = (0, 0)
    maxs = -(10**18)
    for i in range(26):
        for j in range(26):
            score = acs.nd_score_check([i, j])
            if maxs <= score:
                maxs = score
                next_contests = (i, j)

    acs.hold_contest(next_contests[0])
    acs.hold_contest(next_contests[1])
    print(next_contests[0]+1, next_contests[1]+1, sep='\n')
print(acs.choice_max()+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)]
t=[np.random.randint(1,27) for _ in range(D)]

MAX=0
for _ in range(1500):
    d=np.random.randint(1,D+1)
    q=np.random.randint(1,27)
    last=np.array([0]*26)
    v=0
    for i in range(1,D+1):
        if i==d:
            v+=s[d-1][q-1]
            last[q-1]=d
            v-=np.dot(c,d-last)
            continue
        v+=s[i-1][t[i-1]-1]
        last[t[i-1]-1]=i
        v-=np.dot(c,i-last)
    if v>MAX:
        MAX=v
        t[d-1]=q

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 i in range(d)]
mem = [0 for i in range(26)]
v = 0
su = sum(c)
for a in range(d):
    print(d%26+1)

Solution (Python):
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(D)]
lastday=[0 for j in range(26)]
points=[0 for i in range(D)]
t=[0 for i in range(D)]


lastday=[lastday[i]+1 for i in range(26)]
minus=[x*y for (x,y) in zip(c,lastday)]
firstday=minus.index(max(minus))
lastday[firstday]=0
t[0]=firstday+1

for days in range(1,D):
    temp=[x*y for (x,y) in zip(c,lastday)]
    totalminus=sum(temp)
    if max(s[days])<totalminus:
        today=temp.index(max(temp)) 
    else:
        today=s[days].index(max(s[days]))
    lastday=[lastday[i]+1 for i in range(26)]
    lastday[today]=0
    t[days]=today+1
    
for ts in t:
    print(ts)

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 = []

for i in range(d):
    ans.append(s[i].index(max(s[i]))+1)

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(5000):
    random_search()

for i in ans:
    print(i)

Solution (Python):
print(*[(i%26)+1 for i in range(365)],sep="\n")

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007




def main():
	D = inputInt()
	C = inputList()
	S = []
	ans = []
	for i in range(D):
		s = inputList()
		S.append(s)

	minC = min(C)
	minCn = 0
	for i,val in enumerate(C):
		if val == minC:
			minCn = i

	for i,val in enumerate(S):
		tmp = max(val)
		for j,vol in enumerate(val):
			if tmp == vol:
				ans.append(random.randint(1, 26))
				break

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



if __name__ == "__main__":
	main()

Solution (Python):
def lackSatisfaction(c, d, last):
    lack = 0
    max = 0
    mindex = 0
    for i in range(len(c)):
        tmp = c[i] * (d - last[i])
        lack += tmp
        if (max < tmp):
            max = tmp
            mindex = i
    return max, mindex


D = int(input())
c = list(map(int, input().split()))

d = []
last = {}
for i in range(26):
    last[i] = 0

score = 0
for i in range(D):
    s = list(map(int, input().split()))
    rate = 0
    type = 0
    maxLack, mindex = lackSatisfaction(c, i + 1, last)
    for j in range(len(s)):
        if (rate < s[j]):
            rate = s[j]
            type = j + 1
    if (maxLack < rate):
        d.append(type)
    else:
        d.append(mindex + 1)
    last[d[i] - 1] = i + 1

for i in range(len(d)):
    print(d[i])

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

Solution (Python):
def yumiri(L, n):
  for i in range(len(L)):
    if L[i] > n:
      return i - 1

def naobou(d, q):
  newans = ans

  rd = t[d - 1] - 1
  rq = yumiri(ZL[rd], d)
  newans += SUMD[ZL[rd][rq] - ZL[rd][rq - 1] - 1] * c[rd]
  newans += SUMD[ZL[rd][rq + 1] - ZL[rd][rq] - 1] * c[rd]
  newans -= SUMD[ZL[rd][rq + 1] - ZL[rd][rq - 1] - 1] * c[rd] 
  del ZL[rd][rq]

  nd = q - 1
  nq = yumiri(ZL[nd], d)
  newans += SUMD[ZL[nd][nq + 1] - ZL[nd][nq] - 1] * c[nd]
  newans -= SUMD[d - ZL[nd][nq] - 1] * c[nd]
  newans -= SUMD[ZL[nd][nq + 1] - d - 1] * c[nd]
  ZL[nd].insert(nq + 1, d)

  newans -= s[d - 1][rd]
  newans += s[d - 1][nd]

  if newans < ans:
    ZL[rd].insert(rq, d)
    del ZL[nd][nq + 1]
    return ans
  else:
    t[d - 1] = q
    return newans 

def rieshon():
  ans = 0
  for i in range(D):
    ans += s[i][t[i] - 1]
    for j in range(26):
      if t[i] - 1 == j:
        L[j] = 0
        ZL[j].append(i + 1)
      else:
        L[j] += 1
        ans -= L[j] * c[j]
  for i in range(26):
    ZL[i].append(D + 1)
  return ans

import time
import random
startTime = time.time()

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

t = [1] * D

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

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 < 50000:
    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):
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

manzoku = 0
last = [-1]*26


def teika(day):
    n = 0
    for i in range(26):
        n += C[i]*(day-last[i])
    return n

def check(day):
    contest_no = 0
    x = S[day][0] + C[0]*(day-last[0])
    
    for i in range(1, 26):
        y = S[day][i] + C[i]*(last[i]-day)
        if y > x:
            contest_no = i
    return contest_no

for day in range(D):
    n = check(day)
    print(n+1)
    last[n] = day
    manzoku += S[day][n]
    manzoku -= teika(day)

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

Solution (Python):
import copy

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

results = []














last = [0 for i in range(26)]
next_costs = [0 for i in range(26)]

for d in range(D):

    for i in range(26):
        next_costs[i] = C[i] * (d-last[i])

    result = -100000
    next_costs_sum = sum(next_costs)
    result_idx = -1
    for i in range(26):
        tmp_result = S[d][i] - (next_costs_sum - C[i] * (d-last[i]))
        if tmp_result > result:
            result = tmp_result
            result_idx = i
    last[result_idx] = d
    results.append(result_idx + 1)





















for result in results:
    print(result)

Solution (Python):
D = int(input()) 
c = list(map(int, input().split()))
s_matrix = [list(map(int, input().split())) for _ in range(D)]
last = [0] * 26
satis = 0

for i in range(D):
    satis2 = satis
    last2 = last.copy()
    for k in range(26):
        satis3 = satis2
        last3 = last2.copy()

        satis2 += s_matrix[i][k]
        last2[k] = i + 1
        for j in range(26):
            satis2 -= c[j] * (i+1 - last2[j])
        
        if satis2 > satis:
            satis = satis2
            ans = k + 1
            last = last2.copy()
        satis2 = satis3
        last2 =last3.copy()
    
    print(ans)

Solution (Python):
def resolve():
    d = int(input())
    ci = list(map(int, input().split()))
    si = [list(map(int, input().split())) for _ in range(d)]
    answers = []
    for i in range(d):
        certain_date_s = si[i]
        answers.append(certain_date_s.index(max(certain_date_s))+1)
    [print(answer) for answer in answers]
resolve()