Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

from numba import njit


def getInputs():
    D = int(readline())
    CS = np.array(read().split(), np.int32)
    C = CS[:26]
    S = CS[26:].reshape((-1, 26))
    return D, C, S


@njit('(i8, i4[:], i4[:, :], i4[:], )', cache=True)
def _compute_score1(D, C, S, out):
    score = 0
    last = np.zeros(26, np.int32)
    for d in range(len(out)):
        i = out[d]
        score += S[d, i]
        last[i] = d + 1
        score -= np.sum(C * (d + 1 - last))
    return last, score


def _update_score():
    pass

@njit('(i8, i4[:], i4[:, :], i4[:], i8, )', cache=True)
def _ramdom_update(D, C, S, out, score):
    d = np.random.randint(0, D)
    q = np.random.randint(0, 26)
    p = out[d]
    out[d] = q

    last, new_score = _compute_score1(D, C, S, out)
    if score < new_score:
        score = new_score

    return out, last, score



def _random_swap():
    pass


def step1(D, C, S):
    out = []
    LAST = 0
    for d in range(D):
        max_score = -10000000
        best_i = 0
        
        for i in range(26):
            out.append(i)
            last, score = _compute_score1(D, C, S, np.array(out, np.int32))
            if max_score < score:
                max_score = score
                LAST = last
                best_i = i
            out.pop()

        out.append(best_i)

    return np.array(out), LAST, max_score


def step2(D, C, S, out, score):
    for _ in range(10 ** 4):
        out.dtype = np.int32
        out, last, score = _ramdom_update(D, C, S, out, score)
    return out, last, score


def output(out):
    out += 1
    print('\n'.join(out.astype(str).tolist()))


D, C, S = getInputs()
out, _, score = step1(D, C, S)
out, _, score = step2(D, C, S, out, score)
output(out)
#print(score)

Fixed submission:
import numpy as np
import sys
read = sys.stdin.read


D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS

last = np.zeros((26, ))
ans = []

def getContestType_at_d(d):
    s = -10000000
    for i in range(26):
        tmp = S[d][i] - np.sum(C * (d - last)) + C[i] * (d - last[i])
        if s < tmp:
            s = tmp
            t = i

    last[t] += 1

    return t + 1


for d in range(D):
    ans.append(getContestType_at_d(d))


print('\n'.join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

from numba import njit


def getInputs():
    D = int(readline())
    CS = np.array(read().split(), np.int32)
    C = CS[:26]
    S = CS[26:].reshape((-1, 26))
    return D, C, S


@njit('(i8, i4[:], i4[:, :], i4[:], )', cache=True)
def _compute_score1(D, C, S, out):
    score = 0
    last = np.zeros(26, np.int32)
    for d in range(len(out)):
        i = out[d]
        score += S[d, i]
        last[i] = d + 1
        score -= np.sum(C * (d + 1 - last))
    return last, score


def _update_score():
    pass

@njit('(i8, i4[:], i4[:, :], i4[:], i8, )', cache=True)
def _ramdom_update(D, C, S, out, score):
    d = np.random.randint(D)
    q = np.random.randint(26)
    p = out[d]
    out[d] = q

    last, new_score = _compute_score1(D, C, S, out)
    if score < new_score:
        score = new_score

    return out, last, score



def _random_swap():
    pass


def step1(D, C, S):
    out = []
    LAST = 0
    for d in range(D):
        max_score = -10000000
        best_i = 0
        
        for i in range(26):
            #out[d] = i
            out.append(i)
            last, score = _compute_score1(D, C, S, np.array(out, np.int32))
            if max_score < score:
                max_score = score
                LAST = last
                best_i = i
            out.pop()

        #out[d] = best_i
        out.append(best_i)

    return np.array(out), LAST, max_score


def step2(D, C, S, out, score):
    for _ in range(10 ** 4):
        out.dtype = np.int32
        out, last, score = _ramdom_update(D, C, S, out, score)
    return out, last, score


def output(out):
    out += 1
    print('\n'.join(out.astype(str).tolist()))


D, C, S = getInputs()
out, _, score = step1(D, C, S)
out, _, score = step2(D, C, S, out, score)
output(out)
#print(score)

Fixed submission:
import numpy as np
import sys
read = sys.stdin.read


D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS

last = np.zeros((26, ))
ans = []

def getContestType_at_d(d):
    s = -10000000
    for i in range(26):
        tmp = S[d][i] - np.sum(C * (d - last)) + C[i] * (d - last[i])
        if s < tmp:
            s = tmp
            t = i

    last[t] += 1

    return t + 1


for d in range(D):
    ans.append(getContestType_at_d(d))


print('\n'.join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

from numba import njit


def getInputs():
    D = int(readline())
    CS = np.array(read().split(), np.int32)
    C = CS[:26]
    S = CS[26:].reshape((-1, 26))
    return D, C, S


@njit('(i8, i4[:], i4[:, :], i4[:], )', cache=True)
def _compute_score1(D, C, S, out):
    score = 0
    last = np.zeros(26, np.int32)
    for d in range(len(out)):
        i = out[d]
        score += S[d, i]
        last[i] = d + 1
        score -= np.sum(C * (d + 1 - last))
    return last, score


def _update_score():
    pass

@njit('(i8, i4[:], i4[:, :], i4[:], i8, )', cache=True)
def _ramdom_update(D, C, S, out, score):
    d = np.random.randint(D)
    q = np.random.randint(26)
    p = out[d]
    out[d] = q

    last, new_score = _compute_score1(D, C, S, out)
    if score < new_score:
        score = new_score

    return out, last, score



def _random_swap():
    pass


def step1(D, C, S):
    out = []
    LAST = 0
    for d in range(D):
        max_score = -10000000
        best_i = 0
        
        for i in range(26):
            #out[d] = i
            out.append(i)
            last, score = _compute_score1(D, C, S, np.array(out, np.int32))
            if max_score < score:
                max_score = score
                LAST = last
                best_i = i
            out.pop()

        #out[d] = best_i
        out.append(best_i)

    return np.array(out), LAST, max_score


def step2(D, C, S, out, score):
    for _ in range(10 ** 5):
        out.dtype = np.int32
        out, last, score = _ramdom_update(D, C, S, out, score)
    return out, last, score


def output(out):
    out += 1
    print('\n'.join(out.astype(str).tolist()))


D, C, S = getInputs()
out, _, score = step1(D, C, S)
out, _, score = step2(D, C, S, out, score)
output(out)
#print(score)

Fixed submission:
import numpy as np
import sys
read = sys.stdin.read


D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS

last = np.zeros((26, ))
ans = []

def getContestType_at_d(d):
    s = -10000000
    for i in range(26):
        tmp = S[d][i] - np.sum(C * (d - last)) + C[i] * (d - last[i])
        if s < tmp:
            s = tmp
            t = i

    last[t] += 1

    return t + 1


for d in range(D):
    ans.append(getContestType_at_d(d))


print('\n'.join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

from numba import njit


def getInputs():
    D = int(readline())
    CS = np.array(read().split(), np.int32)
    C = CS[:26]
    S = CS[26:].reshape((-1, 26))
    return D, C, S


def _compute_score(output):
    last = np.zeros((26, ))
    for d in range(len(output)):
        last[output[d]] = d + 1
        score = S[d][output[d]] - np.sum(C * (d + 1 - last))

    return score


def solve():
    output = []
    #SCORE = 0
    for _ in range(D):
        max_score = float('-inf')
        best_i = 0
        for i in range(26):
            output.append(i)
            score = _compute_score(output)
            if max_score < score:
                max_score = score
                best_i = i + 1
            output.pop()
        output.append(best_i)
        #SCORE += max_score
        #print(SCORE)

    return output


if __name__ == "__main__":
    D, C, S = getInputs()
    ans = solve()
    print('\n'.join(map(str, ans)))

Fixed submission:
import numpy as np
import sys
read = sys.stdin.read


D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS

last = np.zeros((26, ))
ans = []

def getContestType_at_d(d):
    s = -10000000
    for i in range(26):
        tmp = S[d][i] - np.sum(C * (d - last)) + C[i] * (d - last[i])
        if s < tmp:
            s = tmp
            t = i

    last[t] += 1

    return t + 1


for d in range(D):
    ans.append(getContestType_at_d(d))


print('\n'.join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

from numba import njit


def getInputs():
    D = int(readline())
    CS = np.array(read().split(), np.int32)
    C = CS[:26]
    S = CS[26:].reshape((-1, 26))
    return D, C, S


def _compute_score(output):
    score = 0
    last = np.zeros((26, ))
    for d in range(len(output)):
        last[output[d]] = d + 1
        for i in range(26):
            score -= (d + 1 - last[i]) * C[i]
        score += S[d][output[d]]

    return score


def solve():
    output = []
    for _ in range(D):
        max_score = float('-inf')
        best_i = 0
        for i in range(26):
            output.append(i)
            score = _compute_score(output)
            if max_score < score:
                max_score = score
                best_i = i + 1
            output.pop()
        output.append(best_i)

    return output


if __name__ == "__main__":
    D, C, S = getInputs()
    ans = solve()
    print('\n'.join(map(str, ans)))

Fixed submission:
import numpy as np
import sys
read = sys.stdin.read


D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS

last = np.zeros((26, ))
ans = []

def getContestType_at_d(d):
    s = -10000000
    for i in range(26):
        tmp = S[d][i] - np.sum(C * (d - last)) + C[i] * (d - last[i])
        if s < tmp:
            s = tmp
            t = i

    last[t] += 1

    return t + 1


for d in range(D):
    ans.append(getContestType_at_d(d))


print('\n'.join(map(str, ans)))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
read = sys.stdin.read
 

D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS
 
last = np.zeros((26, ))


def getContestType_at_d(d, k):
    s = -10000000
    for i in range(26):
        mask = np.ones((26, ))
        mask[i] = 0
        score = S[d][i] - np.sum(C * (d + 1 - last) * mask)
        score -= np.sum(C * (min(365, d + k) + 1 - last))
        if s < score:
            s = score
            t = i
 
    last[t] = d + 1
 
    return t + 1, s

max_score = -1
for k in range(26):
    score = 0
    ans = []
    for d in range(D):
        t, s = getContestType_at_d(d, k)
        ans.append(t)
        #ans.append(getContestType_at_d(d, k))
        score += s
    #print('score:', score)
    score = min(0, score)
    if max_score < score:
        max_score = score
        ANS = ans
    

print('\n'.join(map(str, ANS)))

Fixed submission:
import numpy as np
import sys
read = sys.stdin.read


D = int(input())
CS = np.array(read().split(), np.int32)
C = CS[:26]
S = CS[26:].reshape((-1, 26))
del CS

last = np.zeros((26, ))
ans = []

def getContestType_at_d(d):
    s = -10000000
    for i in range(26):
        tmp = S[d][i] - np.sum(C * (d - last)) + C[i] * (d - last[i])
        if s < tmp:
            s = tmp
            t = i

    last[t] += 1

    return t + 1


for d in range(D):
    ans.append(getContestType_at_d(d))


print('\n'.join(map(str, ans)))