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, heapq

def calccontestnumbers(D, complaints, satisfications):
    ContestDays = [1] * 26
    HoldedContests = [-1] * D
    for i in range(D):
        Demands = []
        for j in range(26):
            Demand_j = ContestDays[j] * complaints[j] + satisfications[i][j]
            heapq.heappush(Demands, (-Demand_j, j) )
            ContestDays[j] += 1
        print("Day", i, ":", Demands)
        Demand_Contest = heapq.heappop(Demands)
        Contest = Demand_Contest[1]
        ContestDays[Contest] =1
        HoldedContests[i] = Contest+1
    return HoldedContests




if(__name__ == "__main__"):
    D = int(input().strip())
    complaints = list(map(int, input().split() ) )

    satisfications = []
    for i in range(D):
        satisfication = list(map(int, input().split() ) )
        satisfications.append(satisfication)
    HoldedContests = calccontestnumbers(D, complaints, satisfications)
    for i in range(D):
        print(HoldedContests[i])


Fixed, accepted submission:
import sys, heapq

def calccontestnumbers(D, complaints, satisfications):
    ContestDays = [1] * 26
    HoldedContests = [-1] * D
    for i in range(D-1):
        Demands = []
        for j in range(26):
            Demand_j = ContestDays[j] * complaints[j] + satisfications[i][j]
            heapq.heappush(Demands, (-Demand_j, j) )
            ContestDays[j] += 1
        Demand_Contest = heapq.heappop(Demands)
        Contest = Demand_Contest[1]
        ContestDays[Contest] =1
        HoldedContests[i] = Contest+1

    Demands = []
    for j in range(26):
        Demand_j = -ContestDays[j] * complaints[j] + satisfications[D-1][j]
        heapq.heappush(Demands, (-Demand_j, j) )
        ContestDays[j] += 1
    Demand_Contest = heapq.heappop(Demands)
    Contest = Demand_Contest[1]
    HoldedContests[D-1] = Contest+1

    return HoldedContests




if(__name__ == "__main__"):
    D = int(input().strip())
    complaints = list(map(int, input().split() ) )

    satisfications = []
    for i in range(D):
        satisfication = list(map(int, input().split() ) )
        satisfications.append(satisfication)
    HoldedContests = calccontestnumbers(D, complaints, satisfications)
    for i in range(D):
        print(HoldedContests[i])