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

print(" ".join(map(str, list(t))))

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 = best[0]
        print(best[2] + 1)


if __name__ == '__main__':
    main()

Solution (Python):
def resolve():
    D = int(input())
    C = [int(x) for x in input().split()]
    S = []
    for i in range(D):
        S.append(list(map(int, input().split())))
    last_d = []
    score = 0

    for d in range(D):
        contest = 0
        for i in range(len(C)):
            contest = max(contest, S[d][i])
        score += contest
        last_d.append(S[d].index(contest))
        for i in range(len(C)):
            if i in last_d:
                score -= C[i] * last_d[::-1].index(i)
            else:
                score -= C[i] * (d + 1)
        print(S[d].index(contest) + 1)

    
if __name__ == "__main__":
    resolve()

Solution (Python):
import random

for i in range(365):
  print(int(random.random()*100*(i*i)%26)+1)

Solution (Python):
import numpy as np
import sys
read = sys.stdin.read


D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS

last = np.zeros((26, ))
ans = []

def getContestType_at_d(d):
    s = -10000000
    for i in range(26):
        tmp = S[d][i] - np.sum(C * (d - last)) + C[i] * (d - last[i])
        if s < tmp:
            s = tmp
            t = i

    last[t] += 1

    return t + 1


for d in range(D):
    ans.append(getContestType_at_d(d))


print('\n'.join(map(str, ans)))

Solution (Python):
f=lambda:[*map(int,input().split())]
d=int(input())
c=f()
S=[]
for i in range(d): S+=[f()]
v=0
D=[0]*26
for i in range(d):
  print(S[i].index(max(S[i]))+1)

Solution (Python):
import random
import numpy as np
import sys
d = int(input())
c = list(map(int, input().split()))
s = []
for i in range(d):
    temp = list(map(int, input().split()))
    s.append(temp)
s = np.array(s)
c = np.array(c)


'''dice = list(range(26))
w = list(map(lambda x: x*x, c))
samples = random.choices(dice, k=d, weights=w)
for one in samples:
    print(one+1, file=f)'''
def p(text):
    print(text)

with open('output.txt', 'w') as f:
    for i in range(d):
        
        if max(s[i])>15000:
            
            p(s[i].argmax()+1)
        else:
            
            dice = list(range(26))
            w = c**2
            samples = random.choices(dice, k=1, weights=w)
            for one in samples:
                p(one+1)

Solution (Python):
import copy

D = int(input())
c = list(map(int,input().split()))
s = []
for i in range(D):
    s.append(list(map(int,input().split())))
last = [0]*26
    
ans = 0
md = [0]*26
cand = []
tl = []

for day in range(D):
    for j in range(26):
        last[j] += 1
    
    for k in range(26):
        
        merit = s[day][k]
        merit += last[k] * c[k]
        demerit = 0
        for j in range(26):
            if j != k:
                demerit += c[j] * last[j]
        md[k] = merit - demerit

    
    md2 = sorted(md)
    t = md.index(md2[-1])
    last[t] = 0
    tl.append(t+1)
    
    can = md.index(md2[-2])
    cand.append(can+1)
    
    

    


def calcans(tl):
    last = [0]*26
    ans = 0
    for day in range(D):
        
        ans += s[day][tl[day]-1]
        for j in range(26):
            last[j] += 1
        last[tl[day]-1] = 0
        
        minus = 0
        for j in range(26):
            minus += c[j] * last[j]
        ans -= minus
    return ans

normal = calcans(tl)
change = -1

tl2 = copy.deepcopy(tl)
for ii in range(D):
    tl2[ii] = cand[ii]
    challenge = calcans(tl2)
    if normal < challenge:
        normal = challenge
    else:
        tl2[ii] = tl[ii]
        
    
for tlc in tl2:
    print(tlc)

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

def getGreedy():
    t = []
    last = [-1 for _ in range(26)]
    for d in range(D):
        v_max = -1
        t_max = -1
        for t_ in range(26):
            v_ = 0
            v_ += s[d][t_]
            last[t_]=d
            for i in range(26):
                v_ -= c[i] * (d - last[i])
            if v_ > v_max or t_ == 0:
                t_max = t_
                v_max = v_
        t.append(t_max+1)
    return t
def printResult(t):
    for tt in t:
        print(tt)
def calc(t):
    v = 0
    last = [-1 for _ in range(26)]
    for d in range(D):
        v += s[d][t[d]]
        last[t[d]]=d
        for i in range(26):
            v -= c[i] * (d - last[i])
    return v

t = getGreedy()
printResult(t)

Solution (Python):
import random

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


class Scorer:

    def __init__(self, c, s):
        n_cty = len(c)
        self.c = c  
        self.s = s  
        self.elapsed_time = {cty: 0 for cty in range(n_cty)}

        self.score = 0

    def update_score(self, d, cty):
        
        for cty_ in self.elapsed_time:
            if cty_ == cty:
                self.elapsed_time[cty_] = 0
            else:
                self.elapsed_time[cty_] += 1

        cur_score = self.s[d][cty]
        for cty_ in self.elapsed_time:
            cur_score -= self.c[cty_] * self.elapsed_time[cty_]
        self.score += cur_score
        return self.score


N_REPLACE = 5
EPS = 0.5
ATT = 0.8

T = [random.randint(1, 26) for _ in range(D)]
best_score = -1
for _ in range(500):
    scorer = Scorer(C, S)

    T_ = T[:]

    
    for i in range(N_REPLACE):
        T_[random.randint(0, D - 1)] = random.randint(1, 26)

    for d in range(D):
        cty = T_[d] - 1
        scorer.update_score(d, cty)
    if best_score <= scorer.score:
        best_score = scorer.score
        T = T_
    elif random.random() < EPS:
        best_score = scorer.score
        T = T_
    EPS *= ATT

for t in T:
    print(t)

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

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

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

for a in ans:
    print(a)

Solution (Python):
import time
import random


class Problem:

    def __init__(self, D, s, c):
        self.last_days = [0] * 26
        self.D = D
        self.s = s
        self.c = c
        self.answer = [0] * self.D
        self.best_answer = [0] * self.D

    def scoring(self, day, ind):
        day_score = self.s[day][ind]
        minus_score = 0
        for i in range(26):
            if i != ind:
                minus_score += self.c[i] * (day + 1 - self.last_days[i])
        day_score -= minus_score
        return day_score

    def get_all_scores(self, day):
        """全ての選択肢のscoreを返す"""
        minus_score = 0
        all_scores = [0] * 26
        for i in range(26):
            if i == 0:
                for j in range(1, 26):
                    minus_score += self.c[j] * (day + 1 - self.last_days[j])
                all_scores[0] = self.s[day][0] - minus_score

            else:
                minus_score += self.c[i - 1] * (day + 1 - self.last_days[i - 1])
                minus_score -= self.c[i] * (day + 1 - self.last_days[i])
                all_scores[i] = self.s[day][i] - minus_score
        return all_scores

    def _strategy(self, day):
        ind = random.randint(0, 25)
        score = self.scoring(day, ind)
        return score, ind

    def solve(self):
        self.init()

        sum_score = 0
        for i in range(self.D):
            score, ind = self._strategy(i)
            self.last_days[ind] = i + 1
            self.answer[i] = ind
            sum_score += score
        return sum_score, self.answer

    def _strategy_perturbation(self):
        
        
        day = random.randint(0, 3)

        

        random.randint(0, 3)

    def solve_greed(self):
        self.init()

    def init(self):
        self.last_days = [0] * 26
        self.answer = [0] * self.D


def main():
    time_start = time.time()
    DO_TIME = 2 * 0.90
    D = int(input())
    c = list(map(int, input().split()))
    s = []

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

    max_score = 0

    problem = Problem(D, s, c)
    ite = 0
    while time.time() - time_start < DO_TIME:
        ite += 1
        score, answer = problem.solve()

        if score > max_score:
            
            
            max_score = score
            problem.best_answer = answer

    for i in range(D):
        problem.best_answer[i] += 1
        print(problem.best_answer[i])
    
    
    
    


main()

Solution (Python):


import sys
input=sys.stdin.readline
from random import shuffle, randint

def main():
    D=int(input())
    C=list(map(int,input().split()))
    S=[list(map(int,input().split())) for i in range(D)]
    maxT=[1 for i in range(D+1)]
    maxsat=0
    Tmoto=[i for i in range(1,27)]
    CS=[(C[i],i) for i in range(26)]
    CS.sort()
    for ignn in range(26):
        ign=set()
        for i in range(ignn):
            ign.add(CS[i][1]+1)
        Tmoto=set([i for i in range(1,27)])-ign
        Tmoto=list(Tmoto)
        ign=list(ign)
        shuffle(Tmoto)
        T=[]
        for i in range(D+1):
            if (i % 26 ==0 or i % 26== 17) and ignn>0:
                T.append(ign[randint(0,ignn-1)])
            else:
                T.append(Tmoto[i%(26-ignn)])
        last=[[0]*27 for i in range(D+1)]
        for i in range(1,D+1):
            for j in range(i,D+1):
                last[j][T[i]]=i
        sat=0
        for i in range(1,D+1):
            sat+=S[i-1][T[i]-1]
            for j in range(1,27):
                sat-=C[j-1]*(i-last[i][j])
        if ignn==0:
            maxsat=sat
            maxT=T[:]
        elif sat>maxsat:
            maxsat=sat
            maxT=T[:]
    for i in range(1,D+1):
        print(maxT[i])
    
if __name__=="__main__":
    main()

Solution (Python):
if __name__ == '__main__':
    import time
    START = time.time()
    LIMIT = START + 1.9

    from sys import stdin
    
    
    
    from copy import deepcopy
    
    from numpy import random as np_random
    
    import random
    input = stdin.readline

    CONTEST_NUM = 26
    INFTY = 10**9

    D = int(input())
    cc = [0]+list(map(int, input().split()))
    ss = [[0]*(CONTEST_NUM+1) for _ in range(D)]
    for i in range(D):
        ss[i] = [0]+list(map(int, input().split()))

    last_day = [-1]*(CONTEST_NUM+1)
    content = 0

    def count_discontent(content, date):
        for contest in range(1, CONTEST_NUM+1):
            content -= cc[contest]*(date-last_day[contest])
        return content

    def greedy_decide_contest(date):
        point = -INFTY
        for contest in range(1, CONTEST_NUM+1):
            get_point = ss[date][contest]+cc[contest]*(date-last_day[contest])
            if get_point > point:
                point = get_point
                t = contest
        return t

    tt = [0]*D
    for date in range(D):
        
        t = greedy_decide_contest(date)
        tt[date] = t
        content += ss[date][t]
        last_day[t] = date
        content = count_discontent(content, date)
        

    best_content = content
    best_tt = deepcopy(tt)

    P = 0.1

    while time.time() <= LIMIT:
        content = 0
        tt = [0]*D
        for date in range(D):
            if np_random.binomial(1, P):
                t = random.randint(1, CONTEST_NUM)
            else:
                t = greedy_decide_contest(date)
            tt[date] = t
            content += ss[date][t]
            last_day[t] = date
            content = count_discontent(content, date)
        if content > best_content:
            best_content = content
            best_tt = deepcopy(tt)
    
    

    for t in best_tt:
        print(int(t))

Solution (Python):
import math

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

nocontest = [1 for i in range(26)]

for i in range(D):
    s = S[i]
    contest = [0 for j in range(26)]
    for j in range(26):
        contest[j] = c[j] * nocontest[j] * s[j]
    
    max_contest = max(contest)
    ans = contest.index(max_contest)
    print(ans + 1)
    
    for j in range(26):
        if j == ans:
            nocontest[j] = 1
        else:
            nocontest[j] += 100

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

N = 26
L = [0] * N
for d in range(1, D + 1):
    mx = -10**18
    nx = -1

    for i, (c, l) in enumerate(zip(C, L)):
        r = c * (d - l) - S[d - 1][i]
        if mx < r:
            mx = r
            nx = i

    L[nx] = d
    print(nx + 1)

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

t = 0
while t < 365:
    for i in range(26):
        if t < 365:
            t += 1
            print(i+1)
        else:
            break;

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

for i in range(D):
    input()

c = 0
j = 0
while(True):
    j += 1
    if j == 27:
        j = 1
    rng = random.randint(0, 100)
    if rng > C[j - 1]:
        continue
    c += 1
    print(j)
    if c == D:
        break

Solution (Python):
import numpy as np

D=int(input())
*c,=map(int,input().split())
c=np.array(c)
s=[]
for i in range(D):
    *x,=map(int,input().split())
    s.append(x)

s=np.array(s).reshape((D,26))
tmps=s*1
dt=[]
cnt=np.array([0]*26)

for d in range(D):
    x=tmps[d]-c*(d-cnt)
    y=np.argmax(x)
    cnt[y]=d+1
    dt.append(y+1)

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

Solution (Python):
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(now, ContestType):
  res = c[ContestType] * (now - LastDay[ContestType])
  return res

def nasu(now, x, y, z):
  res = 0
  res += s[now-1][x]
  res += s[now][y]
  res += s[now+1][z]
  if x == y == z:
    res += (D - now) * ((now - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * (1 * c[y])
    now += 1
    res += (D - now) * (1 * c[z])
  elif x == y:
    res += (D - now) * ((now - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * (1 * c[y])
    now += 1
    res += (D - now) * ((now - LastDay[z]) * c[z])
  elif y == z:
    res += (D - now) * ((now - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * ((now - LastDay[y]) * c[y])
    now += 1
    res += (D - now) * (1 * c[z])
  elif x == z:
    res += (D - now) * ((now - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * ((now - LastDay[y]) * c[y])
    now += 1
    res += (D - now) * (2 * c[z])
  else:
    res += (D - now) * ((now - LastDay[x]) * c[x])
    now += 1
    res += (D - now) * ((now - LastDay[y]) * c[y])
    now += 1
    res += (D - now) * ((now - LastDay[z]) * c[z])
  return res

D = I()
c = IL()
s = [IL() for i in range(D)]

LastDay = [0]*26
for i in range(1,D+1-3):
  tmp = ["", 0]
  for x in range(26):
    for y in range(26):
      for z in range(26):
        score = nasu(i, x, y, z)
        if tmp[1] < score:
          tmp = [(x, y, z), score]
  LastDay[tmp[0][0]] = i
  print(tmp[0][0]+1)
else:
  tmp = ["", 0]
  for x in range(26):
    for y in range(26):
      for z in range(26):
        score = nasu(D-2, x, y, z)
        if tmp[1] < score:
          tmp = [(x, y, z), score]
  for i in tmp[0]:
    print(i+1)

Solution (Python):
from time import time
from random import random

limit_secs = 2
start_time = time()

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

def calc_score():
    score = 0
    S = 0
    last = [-1] * 26
    for d in range(D):
        S += s[d][t[d]]
        last[t[d]] = d
        for i in range(26):
            S -= c[i] * (d - last[i])
        score += max(10 ** 6 + S, 0)
    return score

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

def solution():
    return [i % 26 for i in range(D)]

t = solution()
S = calc_satisfaction()
while time() - start_time < limit_secs * 0.9:
    d = int(random() * D)
    q = int(random() * 26)
    old = t[d]
    t[d] = q
    new_S = calc_satisfaction()
    if new_S < S:
        t[d] = old
        S = new_S

for e in t:
    if 0 <= e <= 25:
        print(e + 1)
    else:
        print(0)

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


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

num = []
ans = 0

for i in range(d):
    day = list(zip(s[i], list(range(1,27))))
    day.sort(reverse=True)
    ans += day[0][0]
    num.append(day[0][1])

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

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

manzoku = 0
log = [-1] * 26
for i in range(d):
    max = 0
    maxi = 0
    for j in range(26):
        karilog = log
        kari = s[i][j]
        karilog[j] = i
        for k in range(26):
            kari -= c[k] * (i-karilog[k])
        if max < kari:
            max = kari
            maxj = j
    print(maxj+1)
    manzoku += max
    log[maxj] = i

Solution (Python):

d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split()))for _ in range(d)]
ans=[0]*d
for i in range(0,d,26):
  dd=set()
  uu=set()
  h=[]
  for j in range(i,min(i+26,d)):
    for k in range(26):
      h.append([s[j][k],j,k])
  h.sort(reverse=1)
  for t,j,k in h:
    if j in dd or k in uu:continue
    ans[j]=k
    dd.add(j)
    uu.add(k)
for i in ans:print(i+1)

Solution (Python):
import random
d=int(input())
c=list(map(int,input().split()))
num=[0]*26
ans=[]
numans=0
s=[]
for i in range(1,d+1):
    num1=1
    num2=-(10**100)
    num3=[0]*26
    for j in range(26):
        num3[j]=-1*((i-num[j])*c[j])
    s.append(list(map(int,input().split())))
    for j in range(26):
        num5=s[i-1][j]-num3[j]
        if num5>num2:
            num1=j+1
            num2=num5
    ans.append(num1)
    numans+=num2+s[i-1][num1-1]
    num[num1-1]=i
def sco(n1,n2,n3):
    n0=0
    n01=[0]*26
    old=ans[n1]
    ans[n1]=n2
    for k in range(n3):
        n0+=s[k][ans[k]-1]
        n01[ans[k]-1]=k+1
        for l in range(26):
            n0-=(k+1-n01[l])*c[l]
    return n0
for i in range(1540):
    num6=random.randint(1,26)
    num7=random.randint(1,365)
    num100=sco(num7-1,num6,d)
    if num100>numans:
        ans[num7-1]=num6
for i in range(d):
    print(ans[i])

Solution (Python):


def cost(c, d, lastdi):
    total = 0
    for i in range(26):
        total += c[i]*(d - lastdi[i])
    return total


D = int(input())

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

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


lastdi = [0 for _ in range(26)]

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

Solution (Python):
import copy
import time

t1 = time.time()

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

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

T2 = [0]*D
for i in range(D):
    T2[i] = i%26+1
    
p1 = calc(T)
p2 = calc(T2)
if p2 > p1:
    T = copy.deepcopy(T2)
    p = p2
else:
    p = p1

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

for t in T:
    print(t)

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

import numpy as np

lastdi = [0 for i in range(26)]
ans_c = []



d = 0
while True:
  if d == D:
    break
  if d < D - 3:
    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
    d += 1
    
  else:
    
    a = [sdi[d][i] + sdi[d+1][i2] + sdi[d+2][i3] - 3 * sum([c[k]*( d - lastdi[k] + 1) for k in range(26) if k not in [i,i2,i3]] ) for i in range(26) for i2 in range(26) for i3 in range(26)]
    idx = a.index(max(a))
    best_i3 = idx % 26 + 1
    best_i2 = (idx // 26) % 26 + 1
    best_i1 = idx // 676 + 1
    
    ans_c.append(best_i1)
    ans_c.append(best_i2)
    ans_c.append(best_i3)
    lastdi[best_i1-1] = d
    lastdi[best_i2-1] = d+1
    lastdi[best_i3-1] = d+2
    
    d += 3

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

Solution (Python):
import time
import random
import math
def sigmoid(x):
  return 1/(1+math.exp(-x))
def score(a,c,s,d):
  l=[-1 for i in range(26)]
  r=0
  for i in range(d):
    l[a[i]]=i
    r+=s[i][a[i]]
    for j in range(26):
      r-=c[j]*(i-l[j])
  return r
  
st=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
  s.append(list(map(int,input().split())))

ans=[]
l=[-1 for i in range(26)]
ld=[]
for i in range(d):
  ms=-10**9
  mt=None
  for j in range(26):
    js=c[j]*(i-l[j])+s[i][j]
    if ms<js:
      ms=js
      mt=j
  l[mt]=i
  ans.append(mt)
  ld.append([l[mt],d])
  if l[mt]>=0:
    ld[l[mt]][1]=i

os=score(ans,c,s,d)
nt=st
rate=1000
while nt-st<1.50:
  nt=time.time()
  na=[ans[i] for i in range(d)]
  na[random.randint(1,d-1)]=random.randint(0,25)
  ns=score(na,c,s,d)
  if sigmoid((ns-os)/rate/((2-nt+st)**2)-0.5)>random.random():
    os=ns
    ans=na
  
  


for i in ans:
  print(i+1)

Solution (Python):
D = int(input())
c_list = list(map(int,input().split(' ')))
s_list = []
for i in range(D):
    s_list.append(list(map(int,input().split(' '))))
minc = c_list.index(min(c_list))
for d in range(D):
    print(1)

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

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

sumC = sum(C)
def score(strategy):
    sat = 0
    last = np.zeros(26).astype(np.int)
    for i,ind in enumerate(strategy):
        last += 1
        last[ind] = 0
        sat -= np.sum(C * last)
        sat += S[i][ind]
    return sat


first = [i % 26 for i in range(D)]

ans = first
now_score = score(ans)

for i in range(1):
    
    for d in range(D):
        temp = ans[:]
        temp[d] = np.argmax(S[d])
        
        if score(temp) > now_score:
            ans = temp

for a in ans:
    print(a+1)

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

Solution (Python):
import numpy as np
import copy
D = int(input())
c = list(map(int,input().split()))
score = [0]*26
last = [0]*26
s = []
point = 0

for i in range(D):
  x = np.array(list(map(int, input().split())))
  for j in range(26):
    tmp = copy.copy(last)
    tmp[j] = i;
    for k in range(26):
  	  x[j] = x[j]-(c[k]*(i-tmp[k]))+point
  s.append(x.argmax())
  last[x.argmax()] = i
  point+=max(x)
for i in range(D):
  print(s[i]+1)