Buggy python submission (verdict: Time Limit Exceeded):
import random
from copy import deepcopy

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

ans = []
last = [0]*26
for i in range(d):
    ma_po = -10**10
    ma_di = 0
    for j in range(26):
        po = s[i][j]
        for k in range(26):
            if k == j:
                continue
            po -= c[k]*(i+1-last[k])
        if po > ma_po:
            ma_po = po
            ma_di = j
    last[ma_di] = i+1
    ans.append(ma_di+1)

def score(l):
    lastd = [0]*26
    point = 0
    for j,k in enumerate(l):
        kk = k-1
        point += s[j][kk]
        lastd[kk] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
    return point

ma = score(ans)

def random_search():
    global ans,ma
    li = deepcopy(ans)
    D = random.randrange(d)
    Q = random.randrange(26)
    li[D] = Q+1
    if score(li) > ma:
        ans = deepcopy(li)
        ma = score(li)

for i in range(30000):
    random_search()

for i in ans:
    print(i)

Fixed submission:
import random

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

for i in range(d):
    print(random.randrange(1, 27, 1))

Buggy python submission (verdict: Time Limit Exceeded):
import random
from copy import deepcopy

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

def min_max(l):
    l_min = min(l)
    l_max = max(l)
    return [0.1+(i-l_min)/(l_max-l_min)for i in l]

dd = [max(s[i]) for i in range(d)]
qq = min_max(c)
dd = min_max(dd)

ddd = [i for i in range(d)]
qqq = [i for i in range(26)]

ans = []
last = [0]*26
for i in range(d):
    ma_po = -10**10
    ma_di = 0
    for j in range(26):
        po = s[i][j]
        for k in range(26):
            if k == j:
                continue
            po -= c[k]*(i+1-last[k])
        if po > ma_po:
            ma_po = po
            ma_di = j
    last[ma_di] = i+1
    ans.append(ma_di+1)

def score(l):
    lastd = [0]*26
    point = 0
    for j,k in enumerate(l):
        kk = k-1
        point += s[j][kk]
        lastd[kk] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
    return point

ma = score(ans)

def random_search():
    global ans,ma
    li = deepcopy(ans)
    D = random.choices(ddd,k=1,weights=dd)[0]
    Q = random.choices(qqq,k=1,weights=qq)[0]
    li[D] = Q+1
    if score(li) > ma:
        ans = deepcopy(li)
        ma = score(li)

for i in range(28000):
    random_search()

for i in ans:
    print(i)

Fixed submission:
import random

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

for i in range(d):
    print(random.randrange(1, 27, 1))

Buggy python submission (verdict: Time Limit Exceeded):
import random
from copy import deepcopy

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

def min_max(l):
    l_min = min(l)
    l_max = max(l)
    return [0.1+(i-l_min)/(l_max-l_min)for i in l]

dd = [max(s[i]) for i in range(d)]
qq = min_max(c)
dd = min_max(dd)

ddd = [i for i in range(d)]
qqq = [i for i in range(26)]

ans = []
last = [0]*26
for i in range(d):
    ma_po = -10**10
    ma_di = 0
    for j in range(26):
        po = s[i][j]
        for k in range(26):
            if k == j:
                continue
            po -= c[k]*(i+1-last[k])
        if po > ma_po:
            ma_po = po
            ma_di = j
    last[ma_di] = i+1
    ans.append(ma_di+1)

def score(l):
    lastd = [0]*26
    point = 0
    for j,k in enumerate(l):
        kk = k-1
        point += s[j][kk]
        lastd[kk] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
    return point

ma = score(ans)

def random_search():
    global ans,ma
    li = deepcopy(ans)
    D = random.choices(ddd,k=1,weights=dd)[0]
    Q = random.choices(qqq,k=1,weights=qq)[0]
    li[D] = Q+1
    if score(li) > ma:
        ans = deepcopy(li)
        ma = score(li)

for i in range(30000):
    random_search()

for i in ans:
    print(i)

Fixed submission:
import random

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

for i in range(d):
    print(random.randrange(1, 27, 1))

Buggy python submission (verdict: Time Limit Exceeded):
import random
from copy import deepcopy

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

ma = 0
li = [0]*26

for i in range(1000):
    lin = [random.randrange(0, 26, 1) for _ in range(d)]
    point = 0
    lastd = [0]*26
    for j,k in enumerate(lin):
        point += s[j][k]
        lastd[k] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
        if point > ma:
            ma = point
            li = deepcopy(lin)

for i in li:
    print(i+1)

Fixed submission:
import random

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

for i in range(d):
    print(random.randrange(1, 27, 1))