Buggy python submission (verdict: Time Limit Exceeded):
import random
import time
import copy
start = time.time()
D = int(input())
s = [[0 for j in range(26)] for i in range(D)]
c = list(map(int, input().split(" ")))
result = []
total = -10000000
for i in range(D):
    a = list(map(int, input().split(" ")))
    for j, k in enumerate(a):
        s[i][j] = int(k)
while(1):
    result_tmp = []
    total_tmp=0
    last = [0 for i in range(26)]
    for i in range(D):
        score = [0 for i in range(26)]

        for j in range(26):
            score[j] = s[i][j]
            for k in range(26):
                if j != k:
                    score[j] -= (i + 1 - last[k]) * c[k]
        score_sort = sorted(score, reverse=True)
        score_max = score_sort[0]

        tmp = []
        for j in range(26):
            if score_max >= 0 and score_max*0.95 <= score[j]:
                tmp.append(j)
            if score_max < 0 and score_max*1.05 <= score[j]:
                tmp.append(j)

        score_max = random.choice(tmp)

        result_tmp.append(score_max)
        last[score_max] = i + 1
        total_tmp += score[score_max]
    if total < total_tmp:
        total=total_tmp
        result = result_tmp.copy()
    end = time.time()
    if end - start > 1.9:
        break
for i in range(D):
    print(result[i]+1)


Fixed submission:
# coding: utf-8
# Your code here!

D = int(input())
# with open("sample1.in") as f:

#c = [0 for i in range(26)]
s = [[0 for j in range(27)] for i in range(D)]
c = list(map(int, input().split(" ")))
result=[]
# for i in range(26):
#    c[i] = int(input())
for i in range(D):
    a = list(map(int, input().split(" ")))
    for j, k in enumerate(a):
        #print(i, j, k)
        s[i][j] = int(k)
    result.append(a.index(max(a))+1)
    #print(a.index(max(a)))

for i in range(D):
    # print(s.index(max(s[i])))
    print(result[i])

Buggy python submission (verdict: Runtime Error):

D = int(input())
# with open("sample1.in") as f:

last = [0 for i in range(26)]
s = [[0 for j in range(26)] for i in range(D)]
c = list(map(int, input().split(" ")))
result = []
total = 0
# opened = []  #開催したやつを保存
for i in range(D):
    a = list(map(int, input().split(" ")))
    for j, k in enumerate(a):
        #print(i, j, k)
        s[i][j] = int(k)
        # スコア計算
    score_max = 0
    score_index = 0
    for j in range(26):

        if j == 0:
            score_max = s[i][j]+(i + 1 - last[j]) * \
                c[j]  # - (i - last[j]) * c[j]
            for k in range(26):
                score_max -= (i + 1 - last[k]) * c[k]
            score_index = 0
        else:
            score = s[i][j]+(i+1 - last[j]) * c[j]
            for k in range(26):
                score -= (i + 1 - last[k]) * c[k]

            if score_max < score:
                score_max = score
                score_index = j
            #print(i, j, score)
    result.append(score_index)
    #print(score_index, score)
    last[score_index] = i + 1
    toral += score
    # print(a.index(max(a)))
# print(total)
for i in range(D):
    # print(s.index(max(s[i])))
    print(result[i]+1)


Fixed submission:
# coding: utf-8
# Your code here!

D = int(input())
# with open("sample1.in") as f:

#c = [0 for i in range(26)]
s = [[0 for j in range(27)] for i in range(D)]
c = list(map(int, input().split(" ")))
result=[]
# for i in range(26):
#    c[i] = int(input())
for i in range(D):
    a = list(map(int, input().split(" ")))
    for j, k in enumerate(a):
        #print(i, j, k)
        s[i][j] = int(k)
    result.append(a.index(max(a))+1)
    #print(a.index(max(a)))

for i in range(D):
    # print(s.index(max(s[i])))
    print(result[i])

Buggy python submission (verdict: Runtime Error):
D = int(input())
# with open("sample1.in") as f:

last = [0 for i in range(26)]
s = [[0 for j in range(26)] for i in range(D)]
c = list(map(int, input().split(" ")))
# for i in range(26):
#    c[i] = int(input())
result=[]
# opened = []  #開催したやつを保存
for i in range(D):
    a = list(map(int, input().split(" ")))
    for j, k in enumerate(a):
        #print(i, j, k)
        s[i][j] = int(k)
        # スコア計算
    score = 0
    score_index = 0
    for j in range(26):
        if j == 0:
            score_max = s[i][j] - (i + 1 - last[j]) * c[j]
            score_index = 0
        else:
            score = s[i][j] - (i + 1 - last[j]) * c[j]
            if score_max < score:
                score_max = score
                score_index = j
    result.appned(score_index)
    #print(score_index, score)
    last[score_index] = i
    # print(a.index(max(a)))

for i in range(D):
    # print(s.index(max(s[i])))
    print(result[i])



Fixed submission:
# coding: utf-8
# Your code here!

D = int(input())
# with open("sample1.in") as f:

#c = [0 for i in range(26)]
s = [[0 for j in range(27)] for i in range(D)]
c = list(map(int, input().split(" ")))
result=[]
# for i in range(26):
#    c[i] = int(input())
for i in range(D):
    a = list(map(int, input().split(" ")))
    for j, k in enumerate(a):
        #print(i, j, k)
        s[i][j] = int(k)
    result.append(a.index(max(a))+1)
    #print(a.index(max(a)))

for i in range(D):
    # print(s.index(max(s[i])))
    print(result[i])