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):
from time import time
from random import randrange

def calc():
    s = 0
    last = [-1] * 26
    for i, t in enumerate(A):
        s += S[i][t]
        last[t] = i
        for j, c in enumerate(C):
            s -= c * (i - last[j])
    return s

sTime = time()
D = int(input())
C = [int(a) for a in input().split()]
S = [[int(a) for a in input().split()] for _ in range(D)]
A = [randrange(26) for _ in range(D)]
ans = calc()
while time() - sTime < 1.8:
    d = randrange(D)
    i = A[d]
    for k in range(d)[::-1]:
        if A[k] == i:
            prev = k
            break
    else:
        prev = -1
    for k in range(d + 1, D):
        if A[k] == i:
            prev_ne = k
            break
    else:
        prev_ne = D
    for j in range(26):
        t = S[d][j] - S[d][i]
        for k in range(d)[::-1]:
            if A[k] == j:
                new = k
                break
        else:
            new = -1
        for k in range(d + 1, D):
            if A[k] == j:
                new_ne = k
                break
        else:
            new_ne = D
        t += C[j] * (d - new) * (new_ne - d) - C[i] * (d - prev) * (prev_ne - d)
        if t > 0:
            A[d] = j
            ans += t
            prev, prev_ne = new, new_ne
            i = j
print(*[a + 1 for a in A], sep = "\n")

Solution (Python):
import sys
from typing import List, Tuple, Dict
from dataclasses import dataclass, field

import scipy
import numpy as np
from numba import jit

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


@dataclass()
class Node:
    date: int
    value: int
    result: list = field(default_factory=list)

    def __lt__(self, other) -> bool:
        return self.value < other.value


def calc_satisfaction(plan: List[int]) -> int:
    assert len(plan) == D
    res = 0
    last = np.zeros(26)

    for d in range(D):
        p = plan[d] - 1
        res += S[d][p]
        last[p] = d + 1

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

    return res


def calc_score(plan: List[int]) -> int:
    return max(10 ** 6 + calc_satisfaction(plan), 0)


def calc_dissatisfaction(d: int, last: np.ndarray) -> int:
    return sum([C[i] * (d - last[i]) for i in range(26)])


plan = []
last = np.zeros(26)
for d in range(D):
    t = 0
    max_s = 0

    for i in range(26):
        s = S[d][i] + C[i] * (d + 1 - last[i])
        if s > max_s:
            t = i
            max_s = s

    plan.append(t + 1)
    last[t] = d

print(plan, file=sys.stderr)

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

Solution (Python):
def a_atcoder_contest_scheduling(CONTEST=26):
    D = int(input())
    Satisfaction_decreasing = [int(i) for i in input().split()]
    Satisfaction_difference = [[int(i) for i in input().split()] for j in range(D)]

    
    ans = []
    current_satisfaction = 0
    last = {i: 0 for i in range(1, CONTEST + 1)}
    for day in range(1, D + 1):
        satisfaction = Satisfaction_difference[day - 1]
        max_diff = max(satisfaction)
        contest_type = satisfaction.index(max_diff) + 1
        current_satisfaction += satisfaction[contest_type - 1]
        last[contest_type] = day

        satisfaction_decreasing = sum(satisfaction[i - 1] * (day - last[i])
                                      for i in range(1, CONTEST + 1))
        current_satisfaction -= satisfaction_decreasing
        ans.append(contest_type)
    return '\n'.join(map(str, ans))

print(a_atcoder_contest_scheduling())

Solution (Python):
D = int(input())
c = map(int,input().split())
s = [input().split() for l in range(D)]
"""
t = []
for i in range(D):
    t += [int(input())]
manzoku = 0
d = 1
"""

for i in range(1,D+1):
    print((i%26)+1)
"""
while True:
    
    manzoku += s[d-1][t[d]-1]
"""

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:
                if last[k] > 0:
                    md -= (i + 1 - last[k]) * c[k]
        if md > mdmax:
            mdi = j
            mdmax = md

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

    last[j] = d + 1

for a in ans:
    print(a)

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 = 10
    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": copy.deepcopy(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": copy.deepcopy(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):
for i in range(365):
  print((i+3)%26+1)

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

  ans = [0]*D
  points = [0]*26
  last = [-1]*26
  for d in range(D):
    for i in range(26):
      points[i] = S[d][i]+C[i]*(d-last[i])*(d-last[i]+1)//2
    maxi = 0
    for i in range(26):
        if points[i]>maxi:
            con = i
            maxi = points[i]
    ans[d] = con+1
    last[con] = d
  
  return ans
print(*solve(),sep='\n')

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_sd<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>2*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))

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

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

last = [0]*I

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

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

print(contest + 1)

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

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

    print(contest + 1)

Solution (Python):


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

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

def get_objective_function(output):
    objective_function = 0
    last = [[-1 for i in range(26)] for d in range(D)]

    for d in range(D):
        objective_function += s[d][output[d]]

        last[d][output[d]] = d
        if d < D-1:
            for i in range(26):
                last[d+1][i] = max(last[d][i], last[d+1][i])

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

    point = max(10 ** 6 + objective_function, 0)
    return point








output = []
for d in range(D):
    output.append(s[d].index(max(s[d])))






for d in range(D):
    print(output[d] + 1)

Solution (Python):

import time
import numpy as np

start = time.time()
limit_time = 1.8


d = int(input())
c = [int(i) for i in input().split()]
s = [[int(i) for i in input().split()] for j in range(d)]

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

def point(t):
    result = 0
    map = {
        0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0,
        10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0, 17: 0, 18: 0, 19: 0,
        20: 0, 21: 0, 22: 0, 23: 0, 24: 0, 25: 0
    }
    for i in range(d):
        comp = t[i] - 1
        day = i + 1
        map[comp] = day
        result = result + s[i][comp]
        for cc in range(26):
            result = result - c[cc] * (day - map[cc])
    return result

t = np.argmax(s_num, axis=1) + 1

print("\n".join([str(i) for i in t]))

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


t = [random.randint(1,26) for _ in range(d)]
for i in range(d):
    print(t[i])

Solution (Python):
d=int(input())
C=sorted((c,e) for e,c in enumerate(map(int,input().split())))[::-1]
V=[1]*d
for i in range(d):
  j=0
  while i>>j&1: j+=1
  V[i]=C[j][1]+1
for v in V: print(v)

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())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
def Yes(x):print("Yes")if x==True else print("No")

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

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

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





typ=0
ans=0

for i in range(D):
    ma=0
    ind=0
    for j in range(26):
        if ma<=s[i][j]:
            ma=s[i][j]
            ind=j
    print(ind+1)

Solution (Python):
""" 貪欲法での攻略 """

import numpy as np

contest_types = 26
days = int(input())
cs = list(map(int, input().strip().split()))
ss = [list(map(int, input().strip().split())) for _ in range(days)]

cs = np.array(cs, dtype=np.int32)
ss = np.array(ss, dtype=np.int32)

last_days = np.array([-1] * contest_types, dtype=np.int32)
results = [0] * days

satisfaction = 0

for d in range(days):
    max_diff = - 1e9
    max_c_type = None
    for t in range(contest_types):
        diff = ss[d][t] - np.sum(cs * (d - last_days)) \
                        + cs[t] * (d - last_days[t])

        if diff > max_diff:
            max_diff = diff
            max_c_type = t

    results[d] = max_c_type


for t in results:
    print(t + 1)

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

for i in range(D):
    l = S[i].index(max(S[i]))
    T.append(l+1)
    
print(*T, sep="\n")

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

lenpastmax = 24 



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):
def calc(D, C, S, T):
    s = 0
    l = [-1] * len(C)
    for d, t in enumerate(T):
        t -= 1
        s += S[d][t]
        s -= C[t] * (d - l[t]) * (d - l[t] - 1) // 2
        l[t] = d
    s -= sum(c * (d - l[i]) * (d - l[i] + 1) // 2 for i, c in enumerate(C))
    return s


def main():
    D = int(input())
    C = list(map(int, input().split()))
    S = [list(map(int, input().split())) for _ in range(D)]
    
    M = [0] * 26
    
    for d in range(D):
        for i in range(26):
            M[i] += C[i]
        T = [m + s for m, s in zip(M, S[d])]
        i = T.index(max(T))
        M[i] = 0

        print(i + 1)

main()

Solution (Python):
d=int(input())
c=list(map(int,input().split()))
c_days=[0]*26
c_days_2=[0]*26
fir_ans=0
sec_ans=0
for i in range(d):
    s=list(map(int,input().split()))
    ss=sorted(s, reverse=False)
    
    for k in range(26):
        num=ss[k]
        n=s.index(num)
        if c_days_2[n]==0:

            fir_ans+=num
            continue 
    c_days_2[n]=i+1
    if i==0:
        nn=s.index(max(s))
    else:
        
        c_low=[c_days[x]*(i+1-c[x]) for x in range(26)]
        num=min(c_low)
        nn=c_low.index(num)
        sec_ans+=s[nn]
        c_days[n]=i+1

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

        los=c[l]*(i+1-c_days_2[l])
        fir_ans-=los
    if fir_ans>=sec_ans:
        print(n+1)
        sec_ans=fir_ans
        c_days_2=c_days
    else:
        print(nn+1)
        fir_ans=sec_ans
        c_days=c_days_2

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

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

t = solution()

for e in t:
    print(e + 1)

Solution (Python):
D = int(input())
A = [[0]*26]*D
S = 0
C = list(map(int,input().split()))
P = 0
ld =[0]*26
l = [0]*26
sp = 0
for i in range(D):
  A[i] = list(map(int,input().split()))
for j in range(D):
  maxvalue = max(A[j])
  index = A[j].index(maxvalue)
  for n in range(26):
    ld[n] = ld[n]+1
  sp = ld[index]
  ld[index] = 0 
  for k in range(26):
    l[k] = C[k]*ld[k]
  lmax =max(l)
  if 13*lmax > maxvalue:
    lindex = l.index(lmax)
    ld[index] = sp
    ld[lindex] = 0
    for m in range(26):
      l[m] = C[m]*ld[m]
  S = S+maxvalue-sum(l)
  print(index+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 )
  
  lastdi[ans] = d

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

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

Solution (Python):
ans = [1]*365
for i in range(365):
    ans[i]=i%13 + 5
for i in range(365):
    print(ans[i])

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

last = [0]*n
import copy
for i in range(d):
    m = -float('inf')
    ind = 0
    for k in range(n):
        x = s[i][k]
        buf = copy.copy(last)
        buf[k] = i+1
        for j in range(n):
            x -= c[j]*(i-buf[j]+1)
        if m<x:
            ind = k
            m = x
    last[ind] = i  
    print(ind+1)

Solution (Python):
import sys
from random import randint
input = sys.stdin.readline
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

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


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

for x in t: print(x + 1)

Solution (Python):
def main():
    D = int(input())
    c = list(map(int,input().split()))
    s = []
    for d in range(D):
        s.append(list(map(int,input().split())))
    
    last = [0 for i in range(26)]
    
    v = 0
    
    for d in range(D):
        tmp_score = [0 for i in range(26)]
        tmp_v = [0 for i in range(26)]
        for I in range(26):
            tmp_last = last
            tmp_v[I] = s[d][I]
            tmp_last[I] = d+1
            for i in range(26):
                tmp_v[I] -= c[i]*(d+1-tmp_last[i])
            tmp_score[I] = tmp_v[I]
        ans_i = tmp_score.index(max(tmp_score))
        print(ans_i+1)
        tmp_last[ans_i] = d+1
        v += tmp_v[ans_i]
        
    
if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np
D = int(input())
c = list(map(int,input().split()))
s=[]
for i in range(D):
  x = np.array(list(map(int, input().split())))
  s.append(x.argmax())
for i in range(D):
  print(s[i]+1)

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
S = []
con= 0
for _ in range(D):
    S.append(list(map(int, input().split())))
t = [-1]*D
best = [0]*D
last = [0]*26

for i in range(D):
    
    score = [-1]*26
    
    for x in range(26):
        if i==0:
            con = 0
        else:
            con = best[i-1]
        
        con += S[i][x]
        
        for j in range(26): 
            if not j==x:
                con -= C[j]*(i-last[j]+1)

        score[x]=con
    m = -100000
    ii = 0
    for k in range(26):
        if m<score[k]:
            m=score[k]
            ii=k
    
    last[ii]=i+1
    best[i]=score[ii]
    t[i]=ii+1
            
for i in range(D):
    print(t[i])

Solution (Python):
def 一日経過(n):
    return n+1
    
D=int(input())
C=list(map(int,input().split()))
S=[]
last=[0 for i in range(26)]
for i in range(D):
    s=list(map(int,input().split()))
    S.append(s)
for i in range(D):
    last=list(map(一日経過,last))
    max_score=0
    for j in range(26):
        a=0
        last_kari=last
        last_kari[j]=0
        a+=S[i][j]
        for k in range(26):
            a-=C[k]*last_kari[k]
        if a>max_score:
            max_score=a
            Ans=j
    last[Ans]=0
    print(Ans+1)

Solution (Python):
import numpy as np

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

T = []
last = np.zeros(26)

for i in range(D):
  down = ((i+1-last)*np.array(c)).sum()
  score = S[i, :] - down
  argmax = score.argmax()
  t = argmax+1
  last[t-1] = i+1
  print(t)

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 for i in range(10)]
for d in range(D):
    x=[]
    for b in range(10):
        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:a[0])[::-1]
    l2=[]
    for _,i,b in x[:10]:
        l2.append(l[b])
        l2[-1][i]=d+1
    l=l2
    print(x[0][1]+1)

Solution (Python):
D = int(input())
c = list(map(int,input().split()))
last_di = [0] * 26
for d in range(1, D+1):
    s = list(map(int,input().split()))
    satisfaction_list = [0] * 26
    for i in range(26):
        satisfaction_list[i] = c[i] - (d - last_di[i])
    min_index = satisfaction_list.index(min(satisfaction_list))
    print(min_index + 1)

Solution (Python):
import sys
input = sys.stdin.readline
import random
import time
import copy
time0=time.time()

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

T=[0]
for i in range(1,D+1):
    MAX=-1
    for j in range(1,27):
        if S[i][j]>MAX:
            k=j
            MAX=S[i][j]
    T.append(j)

ANS=0
LAST=[[0]*27 for i in range(D+1)]
for day in range(1,D+1):
    for j in range(1,27):
        LAST[day][j]=LAST[day-1][j]
    t=T[day]
    ANS+=S[day][t]
    LAST[day][t]=day

    for j in range(1,27):
        ANS-=C[j]*(day-LAST[day][j])

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

    before_t=T[d]

    ANS+=S[d][after_t]-S[d][before_t]

    T[d]=after_t

    for day in range(d,D+1):
        if T[day]!=before_t:
            ANS+=C[before_t]*(day-LAST[day][before_t])
            LAST[day][before_t]=LAST[day-1][before_t]
            ANS-=C[before_t]*(day-LAST[day][before_t])
        else:
            break

    ANS+=C[after_t]*(d-LAST[d][after_t])
    LAST[d][after_t]=d

    for day in range(d+1,D+1):    
        if T[day]!=after_t:
            ANS+=C[after_t]*(day-LAST[day][after_t])
            LAST[day][after_t]=LAST[day-1][after_t]
            ANS-=C[after_t]*(day-LAST[day][after_t])

    if ANS<BANS:
        T=BT
        LAST=BLAST
        ANS=BANS

print(*T[1:])

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


def calc(d):
    """
    貪欲法でd日目のスコアが最も高くなるコンテストを出力
    """
    score = 0
    t = 0
    for i in range(26):
        temp = 0
        temp += s[d][i]
        for j in range(26):
            temp -= c[j]*(d+1-last[j])
        if score > temp:
            pass
        else:
            score = temp
            contest = i
    return i

for d in range(D):
    i = calc(d)
    t.append(i)
    last[i] = d+1
for i in range(D):
    print(t[i])

Solution (Python):
import time
start = time.time()
import random
D = int(input())
*c, = map(int, input().split())
S = []
for _ in [None] * D:
    *s, = map(int, input().split())
    S += s,
last = [-1] * 26
INF = float("inf")

def check(T):
    M = 0
    MM = []
    for d in range(D):
        t = T[d]  
        M += S[d][t] - sum((d - last[i]) * c[i] for i in range(26) if i != t)
        last[t] = d
        
    return max(M + 10**6, 0)  

def 貪欲():
    M = 0
    T = []
    for d in range(D):
        m = -INF
        for j in range(26):
            Q = S[d][j] - sum((d - last[i]) * c[i] for i in range(26) if i != j)
            if m < Q:
                t, m = j, Q
        T += t,
        last[t] = d
        M += m
        
    return T, max(M + 10**6, 0) 

T, M = 貪欲()

while time.time() - start < 1.9:
    d, q = random.randrange(D), random.randrange(26)
    Check = T[:]
    Check[d] = q
    if (C := check(Check)) > M:
        M, T = C, Check
for s in T:print(s + 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())))

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 i in range(26):
        if i == ans:
            nocontest[i] = 1
        else:
            nocontest[i] += 1

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

t = []
memo = [0 for _ in range(26)]
for i in range(d):
    scores = []
    for j in range(26):
        delta_score = 0
        delta_score += s[i][j]
        for k in range(26):
            if j == k:
                continue
            delta_score -= c[k] * (i+1 - memo[k])
        scores.append((delta_score, j))

    scores.sort(key=lambda x: -x[0])
    choice = scores[0][1]
    t.append(choice+1)
    memo[choice] = i+1

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

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

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

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

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

Last = [-1] * 26


def f(i):
    return C[i] * (d - Last[i] if Last[i] >= 0 else 0)

for d in range(D):
    S = SS[d]
    t = -1
    x = -1e100
    minus = sum(f(i) for i in range(26))
    for i, s in enumerate(S):
        score = s - minus + f(i)


        if score > x:
            x = score
            t = i

    Last[i] = d

    ans = t + 1
    print(ans if 1 <= ans <= 26 else 1)

Solution (Python):
D = int(input())
C = list(map(int, input().split()))
s = list()
for i in range(D):
  s1 = list(map(int, input().split()))
  s.append(s1)
t = list()
for i in range(D):
  t.append(D%26)

def point(t, C, s):
  done = [0] * 26
  ans = 0
  for d in range(1, D+1):
    td = t[d-1]
    done[td] = d
    ans += s[d-1][td]
    for i in range(26):
      ans -= C[i]*(d-done[i])
  return ans

ans = 0
bettert = 0
for i in range(26):
  t[0] = i
  
  if(point(t, C, s) > ans):
    ans = point(t, C, s)
    bettert = i
    
print(bettert+1)
for i in range(1,D):
  print(t[i])

Solution (Python):
import sys
import numpy as np

input = sys.stdin.readline

D = int(input())
c = np.array(list(map(int, input().split())), dtype=int)
S = np.array([list(map(int, input().split())) for _ in range(D)], dtype=int)
dissatis = np.zeros(26, dtype=int)

v = 0
for i, s in enumerate(S):
    dissatis += c
    t = np.argmax(s+dissatis)
    dissatis[t] = 0
    print(t+1)

Solution (Python):
d=int(input())
c0=input().split()
cl=[]
csum=0
for i in range(26):
  c1=int(c0[i])
  cl.append(c1)
  csum+=c1
  
cd=[0 for i in range(26)]
for i in range(d):
  a0=input().split()
  addmax=0
  max26=0
  for j in range(26):
    a1=int(a0[j])
    add1=a1+(cd[j]+1)*cl[j]
    if addmax<add1:
      addmax=add1
      max26=j
  print(max26+1)
  for j in range(26):
    if j!=max26:
      cd[j]+=1