Buggy python submission (verdict: Runtime Error):
d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for i in range(d)]

def calc_score(day, contest, last):
  t_last = last[:]
  t_last[contest] = day + 1

  contest_score = s[day][contest]
  score = contest_score

  dis = 0
  for i in range(26):
    dis += c[i] * ((day + 1) - t_last[i])
  score -= dis

  return score

score = 0
last = [0 for i in range(26)]

for day in range(d):
  best_score = 0
  best_contest = -1
  for contest in range(26):
    t_score = calc_score(day, contest, last)
    if t_score > best_score:
      best_score = t_score
      best_contest = contest

  last[best_contest] = day + 1
  score += best_score
#  print(score)
  print(best_contest + 1

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

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

def calc_score(contest_num):
  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

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)
    if temp_point > each_point:
      each_point = temp_point
      each_contest_num = temp_contest_num

  ans.append(each_contest_num + 1)

for i in ans:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import random
import time
t_start = time.time()

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

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)
  ans.append(each_contest_num)
  ans_p.append(each_point)
#  print(last_l)

def cp(t_l):
  ans = 0
  for day in range(d):
    contest_num = t_l[day]
    contest_num -= 1

    contest_val = s_l[day][contest_num]

    ans += contest_val
    last_l[contest_num] = day

    for i in range(26):
      ans -= c_l[i] * (day - last_l[i])

  return ans
#    print(ans)

cnt = 0
elapsed_time = time.time() - t_start
while elapsed_time < 1.95:
  cnt += 1
  change_day = random.randint(0, len(ans)-1)
  old_contest_num = ans[change_day]
  old_point = sum(ans_p)
  new_contest_num = random.randint(0, 26)

  ans[change_day] = new_contest_num
  new_point = cp(ans)
  if new_point < old_point:
    ans[change_day] = old_contest_num

  elapsed_time = time.time() - t_start

#print(cnt)
for i in ans:
  print(i+1)

#print(sum(ans_p))

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

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

def calc_score(contest_num):
  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

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)
    if temp_point > each_point:
      each_point = temp_point
      each_contest_num = temp_contest_num

  ans.append(each_contest_num + 1)

for i in ans:
  print(i)