Buggy python submission (verdict: Time Limit Exceeded):
def data_input():
    D = int(input())
    C = tuple(map(int, input().split()))

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

    return D, C, S


def score(D, C, S, T):
    """入力D, C, Sと出力Tからスコアを計算する関数"""

    last = [0] * 26  # 0で初期化されている

    def decrease(d):
        """d日めにiを開催した時の満足度の減少を返す関数"""
        res = 0
        base = sum(C)
        res -= base * (d + 1)
        for i in range(26):
            res += C[i] * last[i]
        return res

    V = []
    for d, i in enumerate(T):
        if d == 0:
            v = 0
        last[i] = d + 1
        v += S[d][i] + decrease(d)
        V.append(v)
    return V


D, C, S = data_input()

T = []
Cum_v = []
max_v = 0
for d in range(D):
    max_t = 0
    for i in range(26):
        v = score(d, C, S[:d+1], T+[i])[-1]
        if v >= max_v:
            # print(f'local_max at {d}-day is updated to {v}')
            max_t = i
            max_v = v
    T.append(max_t)
    print(max_t)

Fixed submission:
D = 365

for i in range(D):
  print(1)

Buggy python submission (verdict: Time Limit Exceeded):
def data_input():
    D = int(input())
    C = tuple(map(int, input().split()))

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

    return D, C, S


def score(D, C, S, T):
    """入力D, C, Sと出力Tからスコアを計算する関数"""

    last = [0] * 26  # 0で初期化されている

    def decrease(d, last):
        """d日めにiを開催した時の満足度の減少を返す関数"""
        res = 0
        for i in range(26):
            ith = C[i] * (d+1 - last[i])
            res -= ith
        return res

    v = 0
    for d, i in enumerate(T):
        last[i] = d + 1
        v += S[d][i] + decrease(d, last)
    return v

D, C, S = data_input()
T = []
for d in range(D):
    local_max = 0
    for i in range(26):
        if score(d, C, S, T+[i]) >= local_max:
            max_i = i
            local_max = score(d, C, S, T+[i])
            # print(f'local_max at {d}-day is updated to {local_max}')
    T.append(max_i)

v = score(D, C, S, T)

for t in T:
    print(t+1)

Fixed submission:
D = 365

for i in range(D):
  print(1)

Buggy python submission (verdict: Time Limit Exceeded):
def data_input():
    D = int(input())
    C = tuple(map(int, input().split()))

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

    return D, C, S


def score(D, C, S, T):
    """入力D, C, Sと出力Tからスコアを計算する関数"""

    last = [0] * 26  # 0で初期化されている

    def decrease(d, last):
        """d日めにiを開催した時の満足度の減少を返す関数"""
        res = 0
        for i in range(26):
            ith = C[i] * (d+1 - last[i])
            res -= ith
        return res

    V = []  # V[d]はd日めの満足度を表す
    for d, i in enumerate(T):
        if d == 0:
            v = 0
        last[i] = d + 1
        v += S[d][i] + decrease(d, last)
        # print(d, i, v, S[d][i], decrease(d, last), last)
        V.append(v)
    return V

D, C, S = data_input()
T = []
for d in range(D):
    local_max = 0
    for i in range(26):
        if score(d, C, S, T+[i])[-1] >= local_max:
            max_i = i
            local_max = score(d, C, S, T+[i])[-1]
            # print(f'local_max at {d}-day is updated to {local_max}')
    T.append(max_i)

V = score(D, C, S, T)

for v in V:
    print(v)

Fixed submission:
D = 365

for i in range(D):
  print(1)

Buggy python submission (verdict: Runtime Error):
def data_input():
    D = int(input())
    C = tuple(map(int, input().split()))

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

    return D, C, S


def score(D, C, S, T):
    """入力D, C, Sと出力Tからスコアを計算する関数"""

    last = [0] * 26  # 0で初期化されている

    def decrease(d, last):
        """d日めにiを開催した時の満足度の減少を返す関数"""
        res = 0
        for i in range(26):
            ith = C[i] * (d+1 - last[i])
            res -= ith
        return res

    V = []  # V[d]はd日めの満足度を表す
    for d, i in enumerate(T):
        if d == 0:
            v = 0
        last[i] = d + 1
        v += S[d][i] + decrease(d, last)
        # print(d, i, v, S[d][i], decrease(d, last), last)
        V.append(v)
    return V

T = []
for d in range(D):
    local_max = 0
    for i in range(26):
        if score(d, C, S, T+[i])[-1] >= local_max:
            max_i = i
            local_max = score(d, C, S, T+[i])[-1]
            # print(f'local_max at {d}-day is updated to {local_max}')
    T.append(max_i)

V = score(D, C, S, T)

for v in V:
    print(v)

Fixed submission:
D = 365

for i in range(D):
  print(1)