Problem:
AtCoder currently hosts three types of contests: ABC, ARC, and AGC. As the number of users has grown, in order to meet the needs of more users, AtCoder has decided to increase the number of contests to 26 types, from AAC to AZC. For convenience, we number these 26 types as type 1 through type 26. AtCoder wants to schedule contests for D days so that user satisfaction is as high as possible. For every day, AtCoder will hold exactly one contest, and each contest will end on that day. The satisfaction is calculated as follows.    * The satisfaction at the beginning of day 1 is 0. Satisfaction can be negative.   * Holding contests increases satisfaction. The amount of increase will vary depending on a variety of factors. Specifically, we know in advance that holding a contest of type i on day d will increase the satisfaction by s_{d,i}.   * If a particular type of contest is not held for a while, the satisfaction decreases. Each contest type i has an integer c_i, and at the end of each day d=1,2,...,D, the satisfaction decreases as follows. Let \mathrm{last}(d,i) be the last day before day d (including d) on which a contest of type i was held. If contests of type i have never been held yet, we define \mathrm{last}(d,i)=0. At the end of day d, the satisfaction decreases by \sum _{i=1}^{26}c_i \times (d-\mathrm{last}(d,i)).  Please schedule contests on behalf of AtCoder. If the satisfaction at the end of day D is S, you will get a score of \max(10^6 + S, 0). There are 50 test cases, and the score of a submission is the total scores for each test case. You can make submissions multiple times, and the highest score among your submissions will be your score.

Incorrect submission (verdict: Wrong Answer):
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    D = NI()
    C = NLI()
    S = [NLI() for _ in range(D)]
    #T = [NI() - 1 for _ in range(D)]
    T = []
    last = [0]*26
    conf = 0
    for i in range(D):
        idx, s = argmax(S[i])
        T.append(idx)
        conf += s
        last[idx] = i+1
        for a in range(26):
            conf -= C[a] * (i+1 - last[a])
        print(conf)


def argmax(A):
    A = [[i, a] for i, a in enumerate(A)]
    A.sort(key=lambda x: x[1], reverse=True)
    return A[0]


if __name__ == "__main__":
    main()

Fixed, accepted submission:
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


def main():
    D = NI()
    C = NLI()
    S = [NLI() for _ in range(D)]
    #T = [NI() - 1 for _ in range(D)]
    T = []
    last = [0]*26
    conf = 0
    for i in range(D):
        idx, s = argmax(S[i])
        T.append(idx)
        conf += s
        last[idx] = i+1
        for a in range(26):
            conf -= C[a] * (i+1 - last[a])
        print(idx+1)


def argmax(A):
    A = [[i, a] for i, a in enumerate(A)]
    A.sort(key=lambda x: x[1], reverse=True)
    return A[0]


if __name__ == "__main__":
    main()