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


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        for line in sys.stdin:
            lines.append(line.strip())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    d = [int(e) for e in lines[0].split(' ')][0]
    cc = [int(e) for e in lines[1].split(' ')]
    ss = []
    for i in range(d):
        ss.append([int(e) for e in lines[i+2].split(' ')])


    return (d, cc, ss)


def solve(d, cc, ss):

    def minus(d, last_d):
        total = 0
        for i in range(26):
            ld = last_d.get(i, 0)
            total = total + cc[i] * (d - ld)
        return total


    t = []
    last_d = dict()
    for i in range(1, d + 1):

        s = ss[i-1]
        max_satis = None
        max_satis_index = None
        for j in range(26):
            last_d_tmp = last_d.copy()
            last_d_tmp[j] = i

            satis = s[j] - minus(i, last_d_tmp)
            if max_satis is None or satis > max_satis:
                max_satis = satis
                max_satis_index = j
        
        last_d[max_satis_index] = i
        t.append(max_satis_index + 1)
        


    return t
    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Solution (Python):
def main():
    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 = []
    for d in range(D):
        score = -100*365
        t = 0
        for i in range(26):
            tmp = S[d][i]
            for j in range(26):
                if i != j:
                    tmp -= C[j]*(d + 1 - last[j])
            if tmp > score:
                score = tmp
                t = i + 1
        last[t - 1] = d + 1
        ans.append(t)
    print('\n'.join(map(str, ans)))

if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np

D = int(input())
C = list(map(int, input().split()))
for d in range(D):
    S = np.array(list(map(int, input().split())))
    print(np.argmax(S)+1)

Solution (Python):
import numpy as np
d=int(input())
c=list(map(int,input().split()))
TotalLoss=sum(c)
for i in range(26):
  c[i]=TotalLoss-c[i]
c=np.array(c)
s=[]
for i in range(d):
  si=list(map(int,input().split()))
  s.append(si)
s=np.array(s)
s-=c
ans=[]
for i in range(d):
  si=s[i]
  index=np.argmax(si)
  ans.append(index+1)
for i in range(d):
  print(ans[i])

Solution (Python):
import random

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

out = [random.randint(1,26) for i in range(D)]

sat = 0
last = [0] * 26
for d in range(D):
    assert(1 <= out[d] and out[d] <= 26)
    j = out[d] - 1
    last[j] = d + 1
    for i in range(26):
        sat -= (d + 1 - last[i]) * c[i]
    sat += s[d][j]

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

Solution (Python):
D = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(D):
  tmp = [int(j) for j in input().split()]
  s.append(tmp)
  
sat = 0
lst = [0 for i in range(26)]

for i in range(D):
  satlst = [0 for j in range(26)]
  for j in range(26):
    sattmp = sat + s[i][j]
    for k in range(26):
      if j != k:
        sattmp -= c[k] * ((i + 1) - lst[k])
    satlst[j] = sattmp
  sat = max(satlst)
  lst[satlst.index(sat)] = (i + 1)
  print(satlst.index(sat) + 1)

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



max_index_c=-1
max_c=-1
for i in range(26):
  if max_c<clist[i]:
    max_index_c=i+1
    max_c=clist[i]

for d in range(D):
  print(max_index_c)

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

Solution (Python):
import random

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

Solution (Python):
from time import time
from random import randrange
import sys
def input():
	return sys.stdin.readline()[:-1]
d = int(input())
c = list(map(int, input().split()))
C = sum(c)
s = [list(map(int, input().split())) for _ in range(d)]

t = []

def score(t):
	res = 0
	minus = 0
	last = [0 for _ in range(26)]
	for i, x in enumerate(t):
		minus += C - c[x-1] * (i - last[x-1] + 1)
		res -= minus
		res += s[i][x-1]
		last[x-1] = i+1
		
	return res


res = 0
minus = 0
last = [0 for _ in range(26)]
for i in range(d):
	minus += C
	M = 0
	M_ind = -1
	for j in range(26):
		if M < c[j] * (i - last[j] + 1) + s[i][j]:
			M = c[j] * (i - last[j] + 1) + s[i][j]
			M_ind = j
	minus -= c[j] * (i - last[j] + 1)
	last[M_ind] = i+1
	res -= minus - s[i][M_ind]
	t.append(M_ind+1)

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

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

for i in range(14):
    for j in range(26):
        print(26-j)
print(23)

Solution (Python):
d = int(input())
c = list(map(int, input().split()))
prev = [0] * 26
for i in range(d):
  s = list(map(int, input().split()))
  happy = - (10 ** 10)
  ans = 0
  for j in range(26):
    tmp = s[j]
    cost = 0
    for k in range(26):
      if j == k:
        continue
      cost += c[k] * (i - prev[k])
    tmp -= cost
    if tmp > happy:
      happy = tmp
      ans = j
  prev[ans] = i
  print(ans+1)

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


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

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

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

  return point


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

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

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

    if temp_point > each_point:
      each_point = temp_point
      each_contest_num = temp_contest_num

  last_l[each_contest_num] = day
  ans.append(each_contest_num + 1)



for i in ans:
  print(i)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

import numpy as np
D = int(input())
Cs = np.array(list(mapint()))
Ss = np.array([list(mapint()) for _ in range(D)], dtype=np.float64)
last = np.zeros(26, dtype=np.float64)

for i in range(D):
    last_2 = last-i
    last_2.astype(np.float64)
    Ss[i] -= last_2*Cs
    idx = np.argmax(Ss[i])
    last[idx] = i+1
    print(idx+1)

def check(Ts):
    last = [0]*26
    
    sati = 0
    for i in range(D):
        t = Ts[i]-1
        sati += Ss[i][t]
        last[t] = i+1
        for j, l in enumerate(last):
            c = Cs[j]
            sati -= (i+1-l)*c
        print(sati)

Solution (Python):

import random

D = int(input())

C = [int(y) for y in input().split()]

S = []

ans = []

def scoring(inp,poi):
    
    score = 0
    day = 1
    last = [0] * 26
    
    for I in inp:
        score += poi[day-1][I-1]
        last[I-1] = day
        for ind,J in enumerate(last):
            score -= C[ind] * (day - ind - 1)
        day += 1
        
    return score

for i in range(D):
    s = [int(y) for y in input().split()]
    S.append(s)

for i in S:
    k = 0
    num = 0
    for f,t in enumerate(i):
        k = max(k,t)
        if k == t:
            num = f + 1
    ans.append(num)

counter = 10

base = scoring(ans,S)
nbase = 0
d = 0
ansc = ans.copy()

for i in range(counter):
    p = random.randint(0,25)
    q = random.randint(0,D-1)
    ansc[q] = p
    nbase = scoring(ansc,S)
    if nbase > base:
        ans = ansc.copy()
    else:
        ansc = ans.copy()

for i in ans:
    print("{}".format(int(i)))

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
    for i in range(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):
d=int(input())
c=list(map(int,input().split()))
c_days=[0]*26

fir_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[n]==0:

            fir_ans+=num
            continue 
    c_days[n]=i+1
    print(n+1)
    '''
    for l in range(26):
        los=c[l]*(i+1-c_days[l])
        fir_ans-=los
    print(fir_ans)
    '''

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

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

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

last_held = [-1 for i in range(26)]
ans = []
for date, daily_scores in enumerate(S):
    minus_score = 0
    for i in range(26):
        minus_score += cost[i] * (date - last_held[i])

    max_score = daily_scores[0] + cost[0] * (date - last_held[0])
    max_index = 0
    for i, daily_score in enumerate(daily_scores):
        tmp = daily_score + cost[i] * (date - last_held[i])
        if max_score < tmp:
            max_index = i
            max_score = tmp
    if max_score <= minus_score:
        tmp = 0
        max_index = 0
        for i in range(26):
           if tmp < cost[i] * (date - last_held[i]):
               tmp = cost[i] * (date - last_held[i])
               max_index = i
    last_held[max_index] = date
    ans.append(max_index+1)
print("\n".join(map(str, ans)))

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, [1])
        today_contest = 1
        for i in range(2, 26 + 1):
            tmp_score = calc_score(D, C, S, [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 sys
input = sys.stdin.readline
def main():
    D = int(input())
    c = list(map(int, input().split()))
    s = []
    for _ in range(D):
        si = list(map(int, input().split()))
        s.append(si)
    for i in range(D):
        max_type = [-1, 0]
        for j in range(26):
            if s[i][j] > max_type[1]:
                max_type[0], max_type[1] = j, s[i][j]
        print(max_type[0]+1)
if __name__ == "__main__":
    main()

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

Solution (Python):
def resolve():
    import copy
    D = int(input())
    cost = list(map(int, input().split()))
    sat = [list((map(int, input().split()))) for _ in range(D)]
    last = [0]*26

    for i in range(D):
        maxcost = 0
        ans = 0

        for j in range(26):
            nowlast = copy.deepcopy(last)
            nowlast[j] = i+1
            plussat = sat[i][j]
            minussat = 0
            for k in range(26):
                minussat += (i + 1 - nowlast[k]) * (cost[k])
            cum = plussat-minussat

            if maxcost < cum:
                ans = j
                maxcost = cum
        last[ans] = i

        print(ans+1)

resolve()

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)
    print(objective_function, point)




output = []
for d in range(D):
    output.append(s[d].index(max(s[d])))
for d in output:
    print(d+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

  for d in range(D):
    ans[d] = d%26+1
  
  return ans
print(*solve(),sep='\n')

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

def score_minus(d, q):
    minus = 0
    for i, (c, ls) in enumerate(zip(clst, last)):
        if i == d:
            continue
        minus += c * (d - ls)
    return minus
    
ans = 0
for i in range(d):
    tmp = 0
    for q in range(26):
        tmp_score = s[i][q] - score_minus(i, q)
        if tmp_score > tmp:
            tmp = tmp_score
            max_q = q
    print(max_q + 1)
    last[max_q] = i

Solution (Python):

def myFunc(i,Score,depth):
  tmp_score=Score
  tmp_max_choice=0
  for j in c:
    tmp_score-=j
  tmp_max_score=tmp_score
  for k,j in enumerate(s[i]):
    if tmp_max_score<tmp_score+j+c[k]:
      tmp_max_choice=k
      tmp_max_score=tmp_score+j+c[k]
  return tmp_max_score,tmp_max_choice
  

D=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(D):
  s.append(list(map(int,input().split())))
Score=0
for i in range(D):
  score,choice=myFunc(i,Score,1)
  Score=score
  print(choice+1)

Solution (Python):
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
  
for i in range(D):
  s.append(list(map(int,(input().split()))))
  sat+=max(s[i])
  ans=s[i].index(max(s[i]))+1
  t.append(ans)
  print(ans)

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
import numpy.random as random
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    
    
    random.seed(2020)
    D = int(readline())
    C = list(map(int, readline().split()))
    S = list(list(map(int, readline().split())) for _ in range(D))

    for _ in range(D):
        print(random.randint(1,26))


if __name__ == '__main__':
    main()

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

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

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

i = 0
for d in range(D):
    print(i + 1)
    i += 1
    i %= 26

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(s.index(max(s)) + 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):
import random
def main():
    D = int(input())
    C = list(map(int, input().split()))
    S = [list(map(int, input().split())) for _ in range(D)]

    score = 0
    last_day = [-1] * 26
    for d in range(D):
        print(random.randint(1, 26))


if __name__ == '__main__':
    main()

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

total = 0
last = [0] * 26
ans = []
for i in range(1, D+1):
    score = [0] * 26
    for t in range(26):
        score[t] += S[i-1][t]
        for j in range(26):
            if j != t:
                score[t] -= C[j] * (i - last[j])
    total += max(score)
    last[score.index(max(score))] = i
    ans.append(score.index(max(score))+1)

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

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)

for i in range(d):

    s_max=max(s[i])
    index=s[i].index(s_max)

    print(index+1)

Solution (Python):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
D = int(readline())
C = list(map(int,readline().split()))
score = []
t = []
for i in range(D):
    s = list(map(int,readline().split()))
    max_ind = s.index(max(s)) + 1
    t.append(max_ind)
    score.append(s)
last = [0] * 26
S = 0
for d in range(D):
    select = t[d]-1
    S += score[d][select]
    last[select] = d+1
    for i in range(26):
        S -= C[i] * (d+1-last[i]) 
for i in range(D):
    print(t[i])

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

init = s.argmax(axis=1) + 1

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

Solution (Python):
import random
D = int(input())
c = list(map(int, input().split()))
s = []
for i in range(D):
  S = list(map(int, input().split()))
  s.append(S)
  
for i in range(365):
  ans = random.randint(1, 26)
  print(ans)

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

now = [0]*26
for i in range(365):
    no = -1
    score = -10**10
    for j in range(26):
        count = s[i][j]
        for k in range(26):
            if j == k:
                continue
            count -= (i+1-now[k])*c[k]
        if count > score:
            no = j
            score = count
    print(no+1)
    now[no] = i+1

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

    len_C = len(C)
    types = []
    lasts = [0] * 26

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

        c = []
        c_sum = 0
        for j in range(len_C):
            c.append((i + 1 - lasts[j]) * C[j])
            c_sum += (i + 1 - lasts[j]) * C[j]  

        if c_sum >= s:
            t = c.index(max(c)) + 1
            lasts[t - 1] = i + 1
        else:
            t = S[i].index(s) + 1

        types.append(t)

    for type in types:
        print(type)


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())))
    i = 1
    for _ in range(D):
        print(i)
        i += 1
        if i > 26:
            i = 1

if __name__ == '__main__':
    main()

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

last = [-1] * Z
ans = 0
T = []
for d in range(D):
    maxScore = 0
    cand = 0
    for i in range(26):
        tmp = last[i]
        last[i] = d
        up = S[d][i]
        down = sum(C[j] * (d - last[j]) for j in range(Z))
        score = up - down
        if maxScore < score:
            cand = i
            maxScore = score
        last[i] = tmp
    T.append(cand + 1)
print(*T, sep='\n')

Solution (Python):


from collections import defaultdict
from heapq import heappush, heappop
import sys
import numpy as np


sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  


def debug(*x):
    print(*x)


def solve(D, CS, S):
    "void()"
    for i in range(D):
        print(S[i].argmax() + 1)


def calcScore(answer, D, CS, S):
    last = [-1] * 26
    score = 0
    for i in range(D):
        j = answer[i] - 1
        score += S[i, j]
        last[j] = i
        score -= sum(CS[j] * (i - last[j]) for j in range(26))
    return score


def main():
    D = int(input())
    CS = list(map(int, input().split()))
    S = np.int16(read().split())
    S = S.reshape((D, 26))

    
    solve(D, CS, S)


T = """
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
"""

OUT = """
1
17
13
14
13
"""


def _test():
    import doctest
    doctest.testmod()
    as_input(T)
    main()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())
    input = f.readline
    read = f.read


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('solve', solve.__doc__.strip().split()[0])(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        
        
        from my_module import solve  
    elif sys.argv[-1] == "-t":
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()

Solution (Python):
def main():
    d=int(input())
    c=list(map(int,input().split()))
    s=[list(map(int,input().split())) for _ in range(d)]
    last=[0]*27
    ans=[]
    for i in range(1,d+1):
        a=0
        for j in range(1,27):
            a-=c[j-1]*(i-last[j])
        pa=0
        mlast=[0]*2
        for t in range(1,27):
            if s[i-1][t-1]+c[t-1]*(i-last[j])>pa:
                mlast=[t,i]
                pa=s[i-1][t-1]+c[t-1]*(i-last[j])
        a+=pa
        last[mlast[0]]=mlast[1]           
        ans.append(mlast[0])
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

Solution (Python):


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


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

Solution (Python):
D = int(input())
A = [[0]*26]*D
S = 0
C = list(map(int,input().split()))
P = 0
ld =[0]*26
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
  ld[index] = 0 
  P=0
  for k in range(26):
    P = P+C[k]*ld[k]
  S = S+maxvalue-P
  print(index+1)

Solution (Python):
D = int(input())
C = [int(i) for i in input().split()]
scores = [[int(i) for i in input().split()] for j in range(D)]

for i in scores:
    print(i.index(max(i))+1)

Solution (Python):

def resolve():
    D = int(input())
    C = list(map(int, input().split()))
    S = [list(map(int, input().split())) for _ in range(D)]
    T = []
    last = [0 for _ in range(26)]
    
    def calc(day, typ):
        score = S[day][typ]
        for j in range(26):
            if j == typ:
                continue
            score -= C[j]*(day+1-last[j])
        return score

    for d in range(D):
        maxscore, maxcontest = -float("inf"), None
        for typ in range(26):
            _score = calc(d, typ)
            if maxscore < _score:
                maxscore = _score
                maxcontest = typ
        T.append(maxcontest)
        last[typ] = d+1
    
    [print(t+1) for t in T]



if __name__ == '__main__':
    resolve()