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, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    d = i_input()
    c_list = i_list()
    s_list = i_row_list(d)

    last_list = [0] * 26

    for day in range(1,d+1):
        result = 0
        max_point = -INF
        for i in range(26):
            plus_point = s_list[day-1][i]
            minus_point = 0
            for j in range(26):
                if i == j:
                    continue
                minus_point += c_list[j] * (day - last_list[j])
            sum_point = plus_point - minus_point
            if sum_point > max_point:
                result = i + 1
                max_point = sum_point
        print(result)

if __name__ == '__main__':
    main()

Solution (Python):
D,*CS = map(int, open(0).read().split())
C = CS[:26]
S = [CS[26*i:26*(i+1)] for i in range(1, D+1)]

def weight(xs):
    s = sum(CS)
    return [x / s for x in xs]

ds = [0] * 26
cmap = weight(C)

def pick(d):
    m = -1
    i = 0
    for j, x in enumerate(cmap):
        c = (d - ds[j]) * x
        if c > m:
            i = j
            m = c
    return i

for d in range(D):
    i = pick(d)
    ds[i] = d
    print(i + 1)

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

last = {}
for i in range(1,27):
    last[i] = 0

for d in range(1,D+1):
    ans = [1,0]
    for i in range(1,27):
        satisfaction = 0
        satisfaction += s[d-1][i-1]
        for j in range(1,27):
            if i != j:
                satisfaction -= c[j-1]*(d-last[j])
        if ans[1] <= satisfaction:
            ans = [i,satisfaction]
    last[ans[0]] = d
    print(ans[0])

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
import random
import time
start_time = time.time()
D = int(input())
c = [int(x) for x in input().split()]
s = []
for _ in range(D):
    s.append([int(x) for x in input().split()])
t = [random.randint(1, 26) for x in range(D)]
last = [0]*26
def solve(t):
    ans = 0
    for i in range(1, D + 1):
        ans += s[i - 1][t[i - 1] - 1]
        last[t[i - 1] - 1] = i
        for j in range(26):
            ans -= c[j]*(i - last[j])
    return ans
ans = solve(t)
while True:
    now_time = time.time()
    if now_time - start_time > 1.85:
        print(*t, sep='\n')
        break
    d, q = [random.randint(1, D), random.randint(1, 26)]
    temp = t[d - 1]
    t[d - 1] = q
    ans_2 = solve(t)
    if ans_2 > ans:
        ans = ans_2
    else:
        t[d - 1] = temp

Solution (Python):
from random import randint
from time import time
t1=time()

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

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

t=[]
for i in range(d):
	t.append(i%26+1)

t2=time()
while t2-t1<1.6:
	tt=t.copy()
	tt[randint(1,d)-1]=randint(1,26)
	if score(tt)>score(t):
		t=tt.copy()
	t2=time()
for x in t:
	print(x)

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

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]
        for i in range(26):
            if i == t: continue
            curr_val -= (day-last_di[i])*cl[i]
        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):
D = int(input())
c = list(map(int, input().split()))
s = []
for k in range(D):
    s.append(list(map(int, input().split())))


ans = [s[k].index(max(s[k]))+1 for k in range(D)]

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

Solution (Python):
import sys
import copy
import time

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline

D = None
C = None
S = None

def cnt_score(t):
    global D, C, S
    score = 0
    cnt = [-1] * 26

    for i in range(D):
        score += S[i][t[i] - 1]
        minusscore = 0
        cnt[t[i] - 1] = i
        for j in range(26):
            minusscore += (i - cnt[j]) * C[j]
        score -= minusscore
    return score


def main():
    global D, C, S
    D = int(input())
    C = [int(x) for x in input().split()]
    S = [[int(x) for x in input().split()] for _ in range(D)]

    start = time.time()

    ans = []
    for s in S:
        
        ans.append(C.index(max(C)) + 1)

    

    day = 0
    while True:
        
        current = time.time()
        if current - start > 1.9:
            break

        
        new_ans = copy.deepcopy(ans)
        old_score = cnt_score(ans)

        max_sore = old_score
        max_contest = ans[day]
        for i in range(26):
            new_ans[day] = i + 1
            new_score = cnt_score(new_ans)
            if new_score > old_score:
                max_contest = i + 1
                old_score = new_score
        ans[day] = max_contest

        
        day = (day + 1) % D

    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

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

        for i in range(26):
            self.satisfaction -= self.C[i]*(self.now - self.last[i])
        
        self.now += 1

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

        for i in range(26):
            if i != type:
                score -= self.C[i]*(self.now - self.last[i])
        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):
    next_contest = 0
    maxs = -(10**18)
    for i in range(26):
        score = acs._score_check(i)
        if maxs <= score:
            maxs = score
            next_contest = i

    acs.hold_contest(next_contest)
    print(next_contest+1)

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):
  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 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=0
            TmpList[t]=day+1
            for i,c in enumerate(C):
                tmp_score-=c*(day+1-TmpList[i])
            if tmp_score>score:
                score=tmp_score
                ans=t+1
        Ans[day]=ans
        Last[ans-1]=day
    print(*Ans,sep='\n')
    
if __name__=='__main__':
    main()

Solution (Python):
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):
def main():
    days = int(input())
    falliness = [int(x) for x in input().split()]
    satisfactions = [0]  
    for _ in range(days):
        satisfactions.append([int(x) for x in input().split()])

    last = [0] * 26
    sat_pre = 0
    for date in range(1, days + 1):
        for typ in range(26):
            if typ == 0:
                
                best = (sat_pre, last, typ)
            last_tmp = last[0:]
            sat = sat_pre
            last_tmp[typ] = date
            sat += satisfactions[date][typ]
            sat -= sum(
                falliness[i] * (date - last_tmp[i]) for i in range(26))
            if sat > best[0]:
                best = (sat, last_tmp, typ)
        last = last_tmp[0:]
        sat_pre = sat
        print(best[2] + 1)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import random

sys.setrecursionlimit(500000)
def input():
    return sys.stdin.readline()[:-1]

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




def content(t):
    cont = 0
    last = [0]*26
    for i in range(D):
        cont += s[i][t[i]-1]
        last[t[i]-1] = i+1
        for j in range(26):
            cont -= c[j]*(i+1-last[j])
    return cont

def main():
    t = [random.randint(1,26) for i in range(D)]
    prev = content(t)
    for i in range(5000):
        d,q = random.randint(0,D-1), random.randint(1,26)
        prev_t = t[d]
        t[d] = q
        now = content(t)
        if prev>content(t):
            t[d] = prev_t
        else:
            prev=now
    for a in t:
        print(a)


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np

D=int(input())
C=np.array(list(map(int,input().split())))
S=[]
S_sa=[]
sa=[]
for i in range(D):
    s=np.array(list(map(int,input().split())))
    sa=s-C
    S_sa.append(sa)
    S.append(s)

minus=365*sum(C)

for i in range(D):
    A=S_sa[i].tolist()
    ma=max(S_sa[i])
    print(A.index(ma)+1)

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

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

dp=[0]*26

def score_ans(s,c,now):
    tmp=0
    for i in range(26):
        tmp+=c[i]*(now - dp[i])
    
    return s-tmp

for i in range(d):

    score=0
    ans=1
    for j in range(26):
        s_i=s[i][j]
        if score<score_ans(s_i,c,i):
            ans=j+1

        dp[ans-1]=i    
    

    print(ans)

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(d)]
ld = [0]*26
score = 0
def dec(day):
    ans = 0
    for i in range(26):
        ans += c[i]*(day-ld[i])
    return ans

for i in range(d):
    ma=0
    t2=1
    score2=score
    for t in range(26):
        ld2=ld.copy()
        score2+=s[i][t]
        ld2[t]=i+1
        score2-=dec(i+1)
        ma = max(score2,ma)
        if score2==ma:
            t2=t
            t3=i+1
    score=ma
    ld[t2]=t3
    print(t2+1)

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

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

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

Solution (Python):
d = int(input())
c = list(map(int,input().split()))
s = []
p = [1]*d
for i in range(d):
    s.append(list(map(int,input().split())))
x = [0]*26
for i in range(d):
    q = 1
    m = -1
    for j in range(26):
        n = s[i][j] - x[j] - c[j]
        x[j] += c[j]
        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().strip())
c = list(map(int, input().strip().split()))
s = [list(map(int, input().split())) for _ in range(D)]

last=[0]*26 

for d in range(1,D+1): 
    max_=-float("inf")
    for contest in range(26): 
        score=s[d-1][contest]
        last[contest-1], tmp = d, last[contest-1]
        for i in range(26):
            score-=c[i]*(d-last[i])
        last[contest-1] = tmp
        if score>max_:
            nextContest=contest
            max_=score
    last[nextContest]=d
    print(nextContest+1)

Solution (Python):
def input_one_number():
    return int(input())


D = input_one_number()

def input_multiple_number_as_list():
    return list(map(int, input().split()))

c = input_multiple_number_as_list()

s = [[]*26 for _ in range(D)]

for i in range(D):
	s[i] = input_multiple_number_as_list()

for day in range(D):
	m = max(s[day])
	
	print((s[day].index(m)+14)%26+1)

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

for d in range(365):
    print(s[d].index(max(s[d]))+1)

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

INF = float('inf')
last = [0] * 26
for i,s in enumerate(S):
    best_k = -1
    best_score = -INF
    for k,s in enumerate(s):
        score = s
        for j,c in enumerate(C):
            if j==k: continue
            score -= c * (i+1 - last[j])
        if score > best_score:
            best_score = score
            best_k = k
    last[best_k] = i+1
    print(best_k+1)

Solution (Python):
D = int(input())
c = list(input().split())
Contestday = []

















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

Solution (Python):
import sys
input = sys.stdin.buffer.readline
import numpy as np

D = int(input())
c = np.array(input().split(), dtype=np.int32)
s = np.array([input().split() for _ in range(D)], dtype=np.int32)
last = np.zeros(26, dtype=np.int32)



ans = []
point = 0
for i in range(D):
    down = (i+1-last)*c
    loss = down * 2 + s[i,:]
    idx = np.argmax(loss)
    ans.append(idx+1)
    point += s[i, idx] - down.sum()
    last[idx] = i+1
    

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

Solution (Python):
def inputs(get_t=False):
    D = int(input())
    c = list(map(int, input().split()))
    s = []
    for d in range(D):
        sd = list(map(int, input().split()))
        s.append(sd)
    if get_t:
        t = []
        for d in range(D):
            t.append(int(input()))
    return D, c, s


def greety(D, c, s):
    best_t = []
    for day in range(1, D+1):
        day_idx = day - 1
        max_idx = s[day_idx].index(max(s[day_idx]))
        best_t.append(max_idx+1)
    return best_t


def output(types):
    for t in types:
        print(t)


if __name__ == "__main__":
    D, c, s = inputs()
    t = greety(D, c, s)
    output(t)

Solution (Python):
from random import randint

n = int(input())

for i in range(n):
  print(randint(1,26))

Solution (Python):
import random

for i in range(365):
  print(random.randint(1, 26))

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 - last[k]) * c[k]
        if md > mdmax:
            mdi = j
            mdmax = md
    ans.append(mdi + 1)
    for j in range(26):
        if j == mdi:
            last[j] = 0
        else:
            last[j] += 1

for a in ans:
    print(a)

Solution (Python):
from datetime import datetime
import random
starttime=datetime.now()
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(D)]
def evaluate(t):
    last=[[0 for j in range(26)] for i in range(D)]
    manzokudo=0
    res=[]
    for d in range(D):
        for i in range(26):
            if d!=0:
                last[d][i]=last[d-1][i]
        last[d][t[d]]=d+1
        manzokudo+=s[d][t[d]]
        for i in range(26):
            manzokudo-=c[i]*(d+1-last[d][i])
        res.append(manzokudo)
    return res
solution=[]
for i in range(D):
    j=0
    for k in range(26):
        if s[i][k]>s[i][j]:
            j=k
    solution.append(j)
nowmanzoku=evaluate(solution)
while((datetime.now()-starttime).total_seconds()<1.9):
    d=random.randrange(D)
    q=random.randrange(26)
    p=solution[d]
    
    solution[d]=q
    nextmanzoku=evaluate(solution)
    if nextmanzoku>nowmanzoku:
        nowmanzoku=nextmanzoku
    else:
        solution[d]=p
for i in solution:
    print(i+1)

Solution (Python):
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(d)]
prev=0
se=set()
for i in range(d):
    lis=[]
    if i//26>prev:
        se=set()
        prev=i//26
    for j in range(26):
        lis.append((s[i][j]-c[j],j))
    lis.sort(reverse=True)
    print(lis[0][1]+1)

Solution (Python):
def main():
    D = int(input())
    fuman = list(map(int, input().split()))
    manzoku = [[0]*26 for _ in range(D)]
    for i in range(D): manzoku[i] = list(map(int, input().split()))
    
    
    
    
    
    timepass = [0]*26
    
    x,t = 0,0
    for j in range(26):
        tmp = manzoku[i][j]
        if tmp>x:
            x = tmp
            t = j
    print(t+1)
    for i in range(1,D):
        
        x1 = 0
        t1 = 0
        for j in range(26):
            tmp = fuman[j]*timepass[j]
            if tmp>x1:
                x1 = tmp
                t1 = j
        
        x2 = 0
        t2 = 0
        for j in range(26):
            tmp = manzoku[i][j]
            if tmp>x2:
                x2 = tmp
                t2 = j
        
        if x1>x2:
            for j in range(26):
                if not j==t1: timepass[j] += 1
                else: timepass[j] = 0
            print(t1+1)
        else:
            for j in range(26):
                if not j==t2: timepass[j] += 1
                else: timepass[j] = 0
            print(t2+1)




main()

Solution (Python):
import random
import sys
import time
import copy

input = sys.stdin.readline

def main():
    d = int(input())
    c = list(map(int, input().split()))
    s = []
    for _ in range(d):
        s.append(list(map(int, input().split())))
    
    start_time = time.time()
    beamwidth = 5
    ans = [[] for _ in range(beamwidth)]
    suff = 0
    
    
    
    
        
    
    topk = [{"last": [0 for _ in range(26)], "score": 0, "ans": []} for _ in range(beamwidth)]
    for i in range(d):
        
        
        
        nnnnn = []  
        for bi in range(beamwidth):
            last = topk[bi]["last"]
            tmpsufss = []
            for con in range(26):
                tmpsufss.sort(key=lambda x: -x["score"])
                ttttt = topk[bi]["score"] + s[i][con]
                minus = 0
                for j in range(26):
                    if con == j:
                        continue
                    minus -= (i - last[j]) * c[j]
                ttttt += minus

                if len(tmpsufss) < beamwidth:
                    tmpsufss.append({
                        "last": last,
                        "score": ttttt,
                        "ans": copy.deepcopy(topk[bi]["ans"])
                    })
                    tmpsufss[-1]["last"][con] = i
                    tmpsufss[-1]["ans"].append(con)
                else:
                    if tmpsufss[-1]["score"] < ttttt:
                        tmpsufss.pop()
                        tmpsufss.append({
                            "last": last,
                            "score": ttttt,
                            "ans": copy.deepcopy(topk[bi]["ans"])
                        })
                        tmpsufss[-1]["last"][con] = i
                        tmpsufss[-1]["ans"].append(con)
            nnnnn.extend(tmpsufss)

        nnnnn.sort(key=lambda x: -x["score"])
        topk = nnnnn[:beamwidth]
        

    print(*[a + 1 for a in topk[0]["ans"]])

if __name__ == '__main__':
    main()

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    d = int(ipt())
    c = [int(i) for i in ipt().split()]
    s = [[int(i) for i in ipt().split()] for _ in range(d)]
    ld = [-1]*26
    edval = [0]*26

    for i in range(d):
        edval = s[i]*1
        for j in range(26):
            dl = i-ld[j]
            edval[j] += c[j]*dl*(dl+1)//2*0.75
        v = edval.index(max(edval))
        ld[v] = i
        print(v+1)

    return

if __name__ == '__main__':
    main()

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


def calc_score(D, C, S, T):
    """
    開催日程Tを受け取ってそこまでのスコアを返す
    """
    contest_last_opened = [0]*26  
    score = 0
    for d, t in enumerate(T, start=1):
        get_score = S[d-1][t-1]
        score += get_score
        contest_last_opened[t-1] = d
        loss_score = 0
        for i in range(26):
            ld = contest_last_opened[i]
            loss_score += C[i]*(d-ld)
        score -= loss_score
    return score


def local_search():
    pass


def main(D, C, S):
    T = []
    for d in range(1, D+1):
        
        
        
        today_score = calc_score(D, C, S, T + [1])
        today_contest = 1
        for i in range(2, 26 + 1):
            tmp_score = calc_score(D, C, S, T + [i])
            if today_score < tmp_score:
                today_score = tmp_score
                today_contest = i
        T.append(today_contest)
    return T


if __name__ == '__main__':
    D = int(input())
    C = [int(i) for i in input().split()]
    S = [[int(i) for i in input().split()] for j in range(D)]
    T = main(D, C, S)
    print(*T, sep="\n")

Solution (Python):
import random
D = int(input())
listC = list(map(int, input().split()))
answerL = []
numL = list(range(25))
for i in range(D):
    print(random.choice(numL)+1)

Solution (Python):


import sys
import numpy as np


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

c = np.array(c)
s = np.array(s)


KIND = 26
last = np.array([0 for i in range(KIND)])
for d in range(1, D + 1):
    index_d = d - 1
    t_d = 0
    diff_S_d = -sys.maxsize
    for k in range(KIND):
        last_k = last.copy()
        last_k[k] = d
        diff_S_d_k = s[index_d][k] - sum(c * (d - last_k))
        if diff_S_d_k > diff_S_d:
            diff_S_d = diff_S_d_k
            t_d = k + 1
    last[t_d - 1] = d
    print(t_d)

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


Ans = 0 
last = [-1]*26


for d in range(D):
    max_ans = 0
    max_i = 0
    
    for contest_id in range(26):
        ans = 0
        
        ans += S[d][contest_id]
        
        for i in range(26):
            if i != contest_id:
                ans -= C[i]*(d - last[i])
        
        if ans > max_ans:
            max_ans = ans
            max_i = contest_id
    
    last[max_i] = d
    
    print(max_i + 1)

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

lastdi = [0 for i in range(26)]
ans_c = []
for d in range(D):
  
  day_s = sdi[d]
  
  sloss = [day_s[i] + c[i]*(d - lastdi[i]) for i in range(26) ]
  ans = sloss.index(max(sloss))
  ans_c.append( ans+1 )
  
  for i in range(26):
    if i != ans:
      lastdi[i] += 1
  lastdi[ans] = d

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

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

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



if __name__ == "__main__":
	main()

Solution (Python):
from random import randint

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

T.append(1)
for i in range(D-1):
    T.append(randint(1, 26))
print(*T, sep="\n")

Solution (Python):
inf = 10**12


def main():
    import sys
    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)
    for t in T:
        print(t+1)
    exit()







    M = int(input())
    for _ in range(M):
        d, q = map(int, input().split())
        d -= 1
        q -= 1
        t = T[d]
        ans += S[d][q]
        ans -= S[d][t]
        i = bisect_left(days[q], d)
        ans += C[q] * (d - days[q][i-1]) * (days[q][i] - d)
        j = bisect_left(days[t], d)
        ans -= C[t] * (d - days[t][j-1]) * (days[t][j+1] - d)
        
        T[d] = q
        days[q].append(d)
        days[q].sort()
        days[t].remove(d)
        print(ans)


if __name__ == '__main__':
    main()