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):
d = int(input())
c = list(map(int, input().split()))
prev = [0] * 26
for i in range(d):
  s = list(map(int, input().split()))
  happy = - (10 ** 10)
  ans = -1
  
  for j in range(26):
    tmp = s[j] 
    if tmp > happy:
      happy = tmp
      ans = j
  prev[ans] = i
  print(ans+1)

Solution (Python):
D = int(input())
for i in range(D):
    print(i%26+1)

Solution (Python):

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

last = [0] * 27
manzoku = [0] * 27
for i in range(1, D+1):
    for j in range(1, 27):
        manzoku[j] -= c[j] * (i - last[j])
    manzoku[s[i-1].index(max(s[i-1]))] += max(s[i-1])
    last[s[i-1].index(max(s[i-1]))] = i
    result = s[i-1].index(max(s[i-1])) + 1
    print(result)

Solution (Python):
import random

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


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

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

for i in range(d):
  if i%26==0:
    a=np.argmax(s[0])
  print((i+a)%26+1)

Solution (Python):
D = int(input())
for i in range(D):
  print(i%26 + 1)

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

Solution (Python):
import numpy as np
from sys import argv
import time
np.random.seed(1)


def input_from_file():
    with open(argv[1], "r") as f:
        D = int(f.readline())
        C = np.array(f.readline().split(), dtype=int)
        S = tuple(tuple(map(int, f.readline().split())) for _ in range(D))
    return D, C, S


def input_from_console():
    D = int(input())
    C = np.array(input().split(), dtype=int)
    S = tuple(tuple(map(int, input().split())) for _ in range(D))
    return D, C, S


def greed(D, C, S):
    last = np.ones(26, dtype=int)
    ans = []
    for s in S:
        s = np.array(s)
        tmp = s + C * last
        i = np.argmax(tmp)
        last[i] = 0
        last += 1
        ans.append(i + 1)
    return ans


def calc_score(D, C, S, T):
    res = 0
    last = np.ones(26, dtype=int)
    for d, t in enumerate(T):
        t -= 1
        last[t] = 0
        score = S[d][t]
        score -= (C * last).sum()
        res += score
        last += 1
    return res


def output_to_file(ans):
    with open("output.txt", "w", newline="") as f:
        for a in ans:
            f.write("{}\n".format(a))


def main():
    start = time.time()
    lim = 1.500
    D, C, S = input_from_console()
    
    
    sol = greed(D, C, S)
    score = calc_score(D, C, S, sol)
    while True:
        d = np.random.randint(0, D)
        q = np.random.randint(1, 27)
        old = sol[d]
        sol[d] = q
        new_score = calc_score(D, C, S, sol)
        if new_score > score:
            score = new_score
        else:
            sol[d] = old
        if time.time() - start >= lim:
            break
    print(*sol, 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_sd2<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>16*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):
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 = 200

    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 = nsc
            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):
D=int(input())
C=list(map(int,input().split()))
import sys
S=sys.stdin.readlines()
A=[0]*26
B=[0]*D
k=0
p=C.index(max(C))
for i in range(26):
  if C[i]!=0:
    k+=C[i]
for i in range(26):
    A[i]=int(C[i]/k*D)

for i in range(26):
  for j in range(A[i]):
    m=max([l if B[l]==0 and l<(D+1)//(A[i]+1)*j else 0 for l in range(D)])
    B[m]=i+1

for i in range(D):
  if B[i]==0:
    B[i]=p+1

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

Solution (Python):
from random import randint
for i in range(365):
  print(randint(1,26))

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

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

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

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
  manzoku_tmp = manzoku(answer_tmp)
  if manzoku_now < manzoku_tmp:
    manzoku_now = manzoku_tmp
    answer[day] = contest
  else:
    answer_tmp[day] = answer[day]

for index in answer:
  print(index+1)

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

def calc(d, q):
    select_rand = select.copy()
    select_rand[d] = q
    last = [0] * 26
    satisfied_rand = 0
    for i in range(1, D+1):
        t = select_rand[i-1]
        satisfied_rand += s[i-1][t-1]
        last[t-1] = i
        for j in range(26):
            satisfied_rand -= c[j] * (i-last[j])
    return (satisfied_rand, select_rand)

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

c = np.array(c)

last = [0] * 26
select = []
satisfied = 0
for i in range(1, D+1):
    last_d = [c[j]*(i-last[j]) for j in range(26)]
    last_d_sum = sum(last_d)
    
    s_d = np.array(s[i-1])
    maxindexA = np.argmax(s_d)
    satis_optA = s_d[maxindexA] - last_d_sum + last_d[maxindexA]
    
    
    last_d = np.array([c[j]*(i-last[j]) for j in range(26)])
    maxindexB = np.argmax(last_d)
    satis_optB = s_d[maxindexB] -last_d_sum + last_d[maxindexB]

    if satis_optA >= satis_optB:
        
        select.append(maxindexA+1)
        satisfied += satis_optA
        last[maxindexA] = i
    else:
        
        select.append(maxindexB+1)
        satisfied += satis_optB
        last[maxindexB] = i

while time.time() < 2:
    d = random.randint(0, D-1)
    q = random.randint(1, 26)
    result = calc(d, q)
    if satisfied < result[0]:
        select = result[1]

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

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

est = 20000
for _ in range(200):
  for _ in range(500):
    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]
    
    
    r = random()
    exp = math.exp(tmp/est)
    if exp > r:
      
      
      ans[pre].remove(day)
      bisect.insort(ans[pst],day)
      
      
      task[day] = pst
      scr += tmp
      
    
  est -= 100

  
for x in task:
  print(x+1)

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):
from time import time
import random
random.seed(0)

now = time()

MAX = 26

d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
t = []
for row in s:
    mxi = 1
    mx = 0
    for i, e in enumerate(row, 1):
        if e > mx:
            mx = e
            mxi = i

    t.append(mxi)

last = [0] * MAX

score = 0
for day, e in enumerate(t, 1):
    score += s[day-1][e-1]
    last[e-1] = day

    for ec, elast in zip(c, last):
        score -= ec * (day - elast)

di = 1

c_sum = sum(c)
c_li = []
for i, e in enumerate(c, 1):
    c_li += [i] * e

while time() - now <= 1.85:
    prev_score = score

    di -= 1
    ed = (di + d - 1) % d + 1
    qi = random.randint(0, c_sum - 1)
    eq = c_li[qi]

    q_old = t[ed-1]
    d_prev = {q_old: 0, eq: 0}

    c_old = c[q_old-1]
    c_new = c[eq-1]

    for day, e in enumerate(t, 1):
        if e in d_prev.keys():
            d_prev[e] = day

        score += c_old * (day - d_prev[q_old])
        score += c_new * (day - d_prev[eq])

    score -= s[ed-1][q_old-1]
    score += s[ed-1][eq-1]

    t[ed-1] = eq

    d_prev = {q_old: 0, eq: 0}

    for day, e in enumerate(t, 1):
        if e in d_prev.keys():
            d_prev[e] = day

        score -= c_old * (day - d_prev[q_old])
        score -= c_new * (day - d_prev[eq])

    if prev_score > score:
        t[ed-1] = q_old
        score = prev_score

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

Solution (Python):
import numpy as np
from functools import partial
D = int(input())
C = list(map(int, input().split()))
B = np.array([0] * 26)
S = [list(map(int, input().split())) for _ in range(D)]

def calc_satisfaction(d, t):
    _B = np.array(B)
    _B[t-1] = d
    satiety = sum(C * (d - B))
    return S[d-1][t-1] - satiety

satisfaction = 0
for d in range(1, D+1):
    f = partial(calc_satisfaction, d)
    t, satisfaction_d = max([(t, f(t)) for t in range(1, 27)], key=lambda x: x[1])
    B[t-1] = d
    satisfaction += satisfaction_d
    print(t)

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,ma
    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)
        ma = score(li)

for i in range(10000):
    random_search()

for i in ans:
    print(i)

Solution (Python):
D = int(input())
c = [int(x) for x in input().split()]
s = []
for i in range(D):
    s.append([int(x) for x in input().split()])
kotae = 0
nissuu = [0] * 26
key = ""
for k in range(26):
  nissuu = [0] * 26
  ans = 0  
  for i in range(D):
    t = (i+k) % 26 + 1
    for j in range(26):
        if j == t-1:
            nissuu[j] = 0
        else:
            nissuu[j] += 1
        ans -= c[j]*nissuu[j]
    ans += s[i][t-1]
    if kotae <= ans:
        kotae = ans
        key = k
for i in range(D):
    print((i+key) % 26 + 1)

Solution (Python):
import random
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 range(d):
	print(random.randrange(26)%26 + 1)

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(500000):
    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()))
D= [list(map(int, input().split())) for i in range(d)]

ans=[0]*d

PL=[0]*26

for i in range(d):
    cnt=0
    cntt=-10**9
    x=1
    for k in range(len(c)):
        v=PL[:]
        cnt = D[i][k]
        v[k] = i + 1
        for j in range(len(c)):
            cnt-=(i+1-v[j])*c[j]
        if cnt>cntt:
            x=k+1
            cntt=max(cnt,cntt)
    ans[i]=x
    PL[x-1]=i


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

Solution (Python):
import random
import time
t_start = time.time()

d = int(input())
c_l = list(map(int,input().split()))
s_l = [list(map(int,input().split())) for i in range(d)]


def calc_score(contest_num, last_l):
  contest_val = s_l[day][contest_num]
  point = contest_val

  temp_last_l = last_l[:]
  temp_last_l[contest_num] = day


  for i in range(26):
    point -= c_l[i] * (day - temp_last_l[i])

  return point


last_l = [-1 for i in range(26)]
ans = []
ans_p = []

point = 0
for day in range(d):
  each_point = 0
  each_contest_num = 0

  for temp_contest_num in range(26):
    temp_point = calc_score(temp_contest_num, last_l)

    if temp_point > each_point:
      each_point = temp_point
      each_contest_num = temp_contest_num

  last_l[each_contest_num] = day

  ans.append(each_contest_num)
  ans_p.append(each_point)


def cp(t_l):
  ans = 0
  for day in range(d):
    contest_num = t_l[day]
    contest_num -= 1

    contest_val = s_l[day][contest_num]

    ans += contest_val
    last_l[contest_num] = day

    for i in range(26):
      ans -= c_l[i] * (day - last_l[i])

  return ans


cnt = 0
elapsed_time = time.time() - t_start
while elapsed_time < 1.70:
  cnt += 1
  change_day = random.randint(0, len(ans)-1)
  old_contest_num = ans[change_day]
  old_point = sum(ans_p)
  new_contest_num = random.randint(0, 26)

  ans[change_day] = new_contest_num
  new_point = cp(ans)
  if new_point < old_point:
    ans[change_day] = old_contest_num

  elapsed_time = time.time() - t_start


for i in ans:
  print(i+1)

Solution (Python):
import random
dur=int(input())
c=list(map(int,input().split()))
cM=max(c)
for i in range(26):
  if c[i]==cM:M=i
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
  r=random.randint(1,1000)
  if r<30:
    print(M+1)
    d[M]=i+1
  else:
    print(t+1)
    d[t]=i+1

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

import random
for i in range(D):
  print(random.randrange(1,26))

Solution (Python):
d = int(input())
clst = list(map(int, input().split()))
slst = []
lastday = [0] * 26
for i in range(d):
  slst.append(list(map(int, input().split())))
for i in range(1, d + 1): 
  resmax = 0
  best = 1
  for j in range(26): 
    res = 0
    oldlast = lastday[j]
    lastday[j] = i
    res += slst[i - 1][j]
    c = 0
    for k in range(26):
      c += clst[k] * (i - lastday[k])
    res -= c
    if res > resmax:
      resmax = res
      best = j
    lastday[j] = oldlast
  lastday[best] = i
  print(best + 1)

Solution (Python):
import numpy as np

D=int(input())
c=list(map(int,input().split()))
s=np.array([])
last_day=np.zeros(26)
now_day=np.zeros(26)

now_satice=0
for i in range(1,D+1):
  s=np.array(input().split(), dtype=np.int64)
  sc_mul=s*c
  max_space=np.argmax(sc_mul)
  last_day[max_space]=i
  now_day=np.full(26, i)
  down=c*(now_day-i*last_day)
  now_satice+=sc_mul[max_space]-down.sum()
  
  print(max_space+1)

Solution (Python):

from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

from random import randint
import time

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

t1 = time.time()
d = inn()
c = inl()
s = []
for i in range(d):
    s.append(inl())
t = []
for i in range(d):
    t.append(randint(0,25))

cnt = 0
mx = -BIG
mxt = []
while True:
    cnt += 1
    if cnt==100:
        t2 = time.time()
        if t2>t1+1.8:
            break
        cnt = 0
    v = score(t)
    if v>mx:
        mx = v
        mxt = t
    dd = randint(0,d-1)
    while True:
        qq = randint(0,25)
        if qq!=t[dd]:
            break
    t[dd] = qq
    

for i in range(d):
    print(mxt[i]+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[:40]:
        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):
ans = [1]*365
for i in range(26*5):
    ans[i]=i%26 + 1

for i in range(26*5,26*10):
    ans[i]=i%13 + 1

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

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

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

def based_b():
    last = [0 for _ in range(26)]
    for i in range(D):
        d = i + 1
        max_score = (-1) * float('inf')
        t = 0
        for contest in range(26):
            last_tmp = last[:]
            score = S[i][contest]
            last_tmp[contest] = d
            for x in range(26):
                score -= C[x] * (d - last_tmp[x])
            if max_score < score:
                t = contest
                max_score = score
        last[t] = d
        print(t+1)

based_b()

Solution (Python):
import sys

d = [0] * 26
def judge(n, t):
    today = t[n - 1] - 1
    res = S[n - 1][today]
    for j, dd in enumerate(d):
        if today != j:
            res -= C[j] * (n - dd)
    return res

D = int(input())
C = list(map(int, sys.stdin.readline().rsplit()))
S = [list(map(int, sys.stdin.readline().rsplit())) for _ in range(D)]

d = [0] * 26
res = 0
tt = []
for i in range(1, D + 1):
    maxi = 0
    for j in range(26):
        tt.append(j + 1)
        jg = judge(i, tt)
        if maxi < jg:
            maxT = j + 1
            maxi = jg
        tt.pop()
    d[maxT - 1] = i
    tt.append(maxT - 1)
    print(maxT)

Solution (Python):
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
cmax=max(c)
c_index = c.index(cmax)
for i in range(d):
  if i % 5 == 4:
    print(c_index+1)
  else:
    max_value = max(s[i])
    max_index = s[i].index(max_value)
    print(max_index+1)

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 = 20 




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 sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from random import randrange 
from itertools import accumulate
from bisect import bisect_left
import time


def calc(LIST):
    ans=0
    last=[0]*26
    for i in range(len(LIST)):
        a=i+1 
        x=LIST[i]-1
        
        ans+=S[i][x]
        
        last[x]=a
        temp=0
        for j in range(26):
            temp+=C[j]*(a-last[j])
        
        ans-=temp
        

    return ans
    
def answerer(c):
    """
    
    最初にですが乱択をします。ただし、Cの値に応じてあたりやすさをでかくします
    """    
    acc=list(accumulate(c))
    ret=[]
    for d in range(D):
        temp=randrange(acc[-1]) 
        s=bisect_left(acc,temp)
        ret.append(s+1)
        
    return ret
    
def resolve():
    global D,C,S
    
    D,=pin()
    C=[*pin()]
    S=[[*pin()]for i in range(D)]
    answerer(C)


    
    start=time.time()
    max_score=0-max(C)*365*26
    king=[1]*365
    while(time.time()-start<1.8):
        temp=answerer(C)
        challenge=calc(temp)
        if challenge>max_score:
            max_score=challenge
            king=temp[:]
    print(*king,sep="\n")
        

resolve()

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

m = 0
ans = []
last = [0] * 26
for i in range(d):
    
    mdmax = -10000000000000000
    mdi = 0
    for j, ss in enumerate(s[i]):
        md = 0
        
        for k in range(26):
            if j == k:
                md += ss
            else:
                md -= (i + 1 - last[k]) * c[k]
        if md > mdmax:
            mdi = j
            mdmax = md

    ans.append(mdi + 1)
    m += mdmax

    last[mdi] = d + 1

for a in ans:
    print(a)

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

D = i()
c = I()
for i in range(D):
    s = l()
    print(s.index(max(s))+1)