Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    R, C, K = map(int, input().split())
    item = [[0 for _ in range(C)] for r in range(R)]
    for _ in range(K):
        r, c, k = map(int, input().split())
        item[r-1][c-1] = k
    
    DP = [[[-1 for _ in range(C)] for r in range(R)] for i in range(4)]
    visited = [[False for c in range(C)] for r in range(R)]
    q = deque()
    DP[0][0][1] = 0
    visited[0][0] = True
    if item[0][0] > 0:
        DP[1][0][1] = item[0][0]
        DP[0][1][0] = item[0][0]
    q.append((0, 1))
    q.append((1, 0))
    while q:
        r, c = q.popleft()
        if not visited[r][c]:
            visited[r][c] = True
            for i in range(4):
                if DP[i][r][c] > -1:
                    if r + 1 < R: 
                        DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c])
                        q.append((r+1, c))
                    if c + 1 < C: 
                        DP[i][r][c+1] = max(DP[i][r][c+1], DP[i][r][c])
                        q.append((r, c+1))
                    if i < 3 and item[r][c] > 0:
                        if r + 1 < R: DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c] + item[r][c])
                        if c + 1 < C: DP[i+1][r][c+1] = max(DP[i+1][r][c+1], DP[i][r][c] + item[r][c])

    ans = DP[3][R-1][C-1]
    for i in range(3): ans = max(ans, DP[i][R-1][C-1] + item[R-1][C-1])
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys

def solve():
    input = sys.stdin.readline
    R, C, K = map(int, input().split())
    item = [[0 for _ in range(C)] for r in range(R)]
    for _ in range(K):
        r, c, k = map(int, input().split())
        item[r-1][c-1] = k
    
    DP = [[[-1 for _ in range(C)] for r in range(R)] for i in range(4)]
    DP[0][0][0] = 0
    for r in range(R):
        for c in range(C):
            for i in range(4):
                if DP[i][r][c] > -1:
                    if r + 1 < R: 
                        DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c])
                    if c + 1 < C: 
                        DP[i][r][c+1] = max(DP[i][r][c+1], DP[i][r][c])
                    if i < 3 and item[r][c] > 0:
                        if r + 1 < R: DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c] + item[r][c])
                        if c + 1 < C: DP[i+1][r][c+1] = max(DP[i+1][r][c+1], DP[i][r][c] + item[r][c])

    ans = DP[3][R-1][C-1]
    for i in range(3): ans = max(ans, DP[i][R-1][C-1] + item[R-1][C-1])
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    mod = 998244353
    DP = defaultdict(int)
    DP[(A, B)] = 1
    for cb in range(B + 1, D + 1):
        DP[(A, cb)] = (DP[(A, cb - 1)] * A) % mod

    for ca in range(A + 1, C + 1):
        DP[(ca, B)] = (DP[(ca - 1, B)] * B) % mod
        for nb in range(B + 1, D + 1):
            DP[(ca, nb)] = (DP[(ca, nb - 1)] * ca + DP[(ca - 1, nb)] * nb - DP[(ca - 1, nb - 1)] * (ca - 1) * (nb - 1)) % mod

    print(DP[(C, D)])
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    mod = 998244353

    DP = [[0 for j in range(D + 1)] for i in range(C + 1)]
    DP[A][B] = 1
    for b in range(B + 1, D + 1):
        DP[A][b] = (DP[A][b-1] * A) % mod
    
    for a in range(A + 1, C + 1):
        DP[a][B] = (DP[a-1][B] * B) % mod
        for b in range(B + 1, D + 1):
            DP[a][b] = ((DP[a][b-1] * a) % mod + (DP[a-1][b] * b) % mod - (DP[a-1][b-1] * (a-1) * (b-1)) % mod) % mod
    print(DP[C][D])
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    mod = 998244353
    DP = defaultdict(int)
    DP[(A, B)] = 1
    for cb in range(B + 1, D + 1):
        DP[(A, cb)] = (DP[(A, cb - 1)] * A) % mod

    for ca in range(A + 1, C + 1):
        DP[(ca, B)] = (DP[(ca - 1, B)] * B) % mod
        for nb in range(B + 1, D + 1):
            DP[(ca, nb)] = (DP[(ca, nb - 1)] * ca + DP[(ca - 1, nb)] * nb - DP[(ca - 1, nb - 1)] * (ca - 1) * (nb - 1)) % mod

    print(DP[(C, D)])
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    A, B, C, D = map(int, input().split())
    mod = 998244353

    DP = [[0 for j in range(D + 1)] for i in range(C + 1)]
    DP[A][B] = 1
    for b in range(B + 1, D + 1):
        DP[A][b] = (DP[A][b-1] * A) % mod
    
    for a in range(A + 1, C + 1):
        DP[a][B] = (DP[a-1][B] * B) % mod
        for b in range(B + 1, D + 1):
            DP[a][b] = ((DP[a][b-1] * a) % mod + (DP[a-1][b] * b) % mod - (DP[a-1][b-1] * (a-1) * (b-1)) % mod) % mod
    print(DP[C][D])
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    if N == 1: 
        print(1)
        return 0

    B = [False] * (max(A) + 1)
    nums = dict()
    for a in A:
        B[a] = True
        if a in nums: nums[a] += 1
        else: nums[a] = 1
    
    ans = 0
    for k in nums:
        if nums[k] > 1: continue
        else:
            flag = True
            for i in range(1, k):
                if i ** 2 > k: break
                if k % i == 0:
                    if B[i]:
                        flag = False
                        break
                    if B[k // i] and k // i < k:
                        flag = False
                        break
            if flag: ans += 1
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    A.sort()
    L = max(A)
    ad = defaultdict(int)
    for a in A: ad[a] += 1

    ans = 0
    B = [True] * (L + 1)
    for a in A:
        if B[a]:
            if ad[a] == 1: ans += 1
        k = 2 * a
        while k <= L:
            B[k] = False
            k += a

    print(ans)

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10000000)
mod = 998244353

def solve():
    input = sys.stdin.readline
    N, S = map(int, input().split())
    A = [int(a) for a in input().split()]
    DP = [[0 for _ in range(S + 1)] for i in range(N)]
    DP[0][0] = 2
    if A[0] <= S: DP[0][A[0]] = 1
    ans = 0
    for i, a in enumerate(A[1:]):
        for s in range(S + 1):
            if DP[i][s] > 0:
                DP[i+1][s] += (DP[i][s] * 2) % mod
                DP[i+1][s] %= mod
                if s + a <= S:
                    DP[i+1][s+a] += DP[i][s]
                    DP[i+1][s+a] %= mod         
    print(DP[N-1][S])
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
mod = 998244353

def solve():
    input = sys.stdin.readline
    N, S = map(int, input().split())
    A = [int(a) for a in input().split()]
    DP = [[0 for _ in range(S + 1)] for i in range(N)]
    DP[0][0] = 2
    if A[0] <= S: DP[0][A[0]] = 1
    ans = 0
    for i, a in enumerate(A[1:]):
        for s in range(S + 1):
            if DP[i][s] > 0:
                DP[i+1][s] += (DP[i][s] * 2) % mod
                DP[i+1][s] %= mod
                if s + a <= S:
                    DP[i+1][s+a] += DP[i][s]
                    DP[i+1][s+a] %= mod         
    print(DP[N-1][S])
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys
from bisect import bisect_left
changed = []
input = sys.stdin.readline
N = int(input())
A = [int(a) for a in input().split()]
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    u, v = map(int, input().split())
    Edge[u-1].append(v-1)
    Edge[v-1].append(u-1)
LIS = [10 ** 20] * N

def dfs(i, pre, Ans):
    changeID = bisect_left(LIS, A[i])
    changed.append(LIS[changeID])
    LIS[changeID] = A[i]
    Ans[i] = changeID + 1
    for nextN in Edge[i]:
        if nextN != pre: dfs(nextN, i, Ans)
    backNum = changed.pop()
    LIS[changeID] = backNum
    return 0


def solve():
    Ans = [1] * N
    dfs(0, 0, Ans)
    print("\n".join(map(str, Ans)))
    

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from bisect import bisect_left
sys.setrecursionlimit(1000000)
INF = pow(10, 10)

changed = []
input = sys.stdin.readline
N = int(input())
A = [int(a) for a in input().split()]
Edge = [[] for _ in range(N)]
for _ in range(N-1):
    u, v = map(int, input().split())
    Edge[u-1].append(v-1)
    Edge[v-1].append(u-1)
LIS = [INF] * N

def dfs(i, pre, Ans):
    changeID = bisect_left(LIS, A[i])
    changed.append((changeID, LIS[changeID]))
    LIS[changeID] = min(A[i], LIS[changeID])
    #print(i, LIS)
    #print(changed)
    Ans[i] = bisect_left(LIS, INF) 
    for nextN in Edge[i]:
        if nextN != pre: dfs(nextN, i, Ans)
    backID, backV = changed.pop()
    LIS[backID] = backV
    return 0

def solve():
    Ans = [1] * N
    dfs(0, 0, Ans)
    print("\n".join(map(str, Ans)))
    
    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [(A[i], i) for i in range(N)]
    B.sort(reverse = True)

    DP = [[-1 for j in range(N + 1)] for _ in range(N)] #i番目の幼児まで見た時、左からi番目まで埋まっている時の最大値
    DP[0][0] = B[0][0] * abs(B[0][1] - (N - 1))
    DP[0][1] = B[0][0] * B[0][1]

    for i in range(1, N):
        for j in range(i + 1):
            #右に詰める時はjの値は変わらない
            #左に詰めるときはj += 1
            DP[i][j] = max(DP[i][j], DP[i-1][j] + B[i][0] * abs(B[i][1] - (N - 1 - i + j)))
            DP[i][j+1] = max(DP[i][j+1], DP[i-1][j] + B[i][0] * abs(B[i][1] - j))
    print(max(DP[N-1]))

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [(A[i], i) for i in range(N)]
    B.sort(reverse = True)

    DP = [[-1 for j in range(N + 1)] for _ in range(N)] #i番目の幼児まで見た時、左からi番目まで埋まっている時の最大値
    DP[0][0] = B[0][0] * abs(B[0][1] - (N - 1))
    DP[0][1] = B[0][0] * B[0][1]

    for i in range(1, N):
        for j in range(i + 1):
            #右に詰める時はjの値は変わらない
            #左に詰めるときはj += 1
            DP[i][j] = max(DP[i][j], DP[i-1][j] + B[i][0] * abs(B[i][1] - (N - 1 - i + j)))
            DP[i][j+1] = max(DP[i][j+1], DP[i-1][j] + B[i][0] * abs(B[i][1] - j))
    print(max(DP[N-1]))

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    toInt = {"R": 0, "G":1, "B": 2}
    count = [[0, 0, 0] for _ in range(N)]
    count[N-1][toInt[S[N-1]]] += 1
    for i in reversed(range(N-1)):
        for j in range(3): count[i][j] = count[i+1][j]
        count[i][toInt[S[i]]] += 1

    ans = 0
    for i in range(N-2):
        iInt = toInt[S[i]]
        for j in range(i+1, N-1):
            right = {0, 1, 2} - {iInt, toInt[S[j]]}
            if len(right) == 1:
                for key in right:
                    ans += count[j + 1][key]
                    if 2 * j - i < N and toInt[S[2*j - i]] == key: ans -= 1
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    col = {"R": 0, "G": 1, "B": 2}
    B = [[0, 0, 0] for _ in range(N)]
    B[N-1][col[S[N-1]]] = 1
    for i in reversed(range(N-1)):
        for j in range(3): B[i][j] = B[i+1][j]
        B[i][col[S[i]]] += 1

    ans = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            if set((S[i], S[j])) == {"R", "G"}: 
                ans += B[j+1][2]
                if 2 * j - i < N and S[2 * j - i] == "B": ans -= 1
            elif set((S[i], S[j])) == {"B", "G"}: 
                ans += B[j+1][0]
                if 2 * j - i < N and S[2 * j - i] == "R": ans -= 1
            elif set((S[i], S[j])) == {"B", "R"}: 
                ans += B[j+1][1]
                if 2 * j - i < N and S[2 * j - i] == "G": ans -= 1
            
    print(ans)
            

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys

def solve():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    if H == 1 or W == 1: print(1)
    else: Ans = (H // 2 + H % 2) * (W // 2 + W % 2) + (H // 2) *  (W // 2)
    print(Ans)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys

def solve():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    if H == 1 or W == 1: print(1)
    else: 
        Ans = (H // 2 + H % 2) * (W // 2 + W % 2) + (H // 2) *  (W // 2)
        print(Ans)

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    N, P = map(int, input().split())
    S = input().strip("\n")
    modSum = 0
    modSum = int(S[0]) % P
    modDict = defaultdict(int)
    ans = 0

    if P == 2 or P == 5:
        for i in range(N):
            if int(S[i]) % P == 0:
                ans += i + 1
        
    else:
        modDict[modSum[0]] += 1
        for i in range(1, N):
            modSum = ((modSum * 10) + int(S[i])) % P
            modDict[modSum] += 1

        for key in modDict:
            v = modDict[key]
            if key > 0: ans += v * (v - 1) // 2
            else: ans += v + (v * (v - 1) // 2)
    
    print(ans)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys

def solve():
    input = sys.stdin.readline
    N, P = map(int, input().split())
    S = list(input().strip("\n"))

    if P == 2 or P == 5:
        count = 0
        for i in range(N):
            s = int(S[N - 1 - i])
            if s % P == 0: count += N - i
        print(count)
    else:
        modDict = dict()
        modDict[0] = 1
        sSum = 0
        for i in range(N):
            s = int(S[N - 1 - i])
            sSum += s * pow(10, i, P)
            sSum %= P
            if sSum in modDict: modDict[sSum] += 1
            else: modDict[sSum] = 1
        count = 0
        for key in modDict:
            count += modDict[key] * (modDict[key] - 1) // 2
        print(count)
            

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import itemgetter
from collections import deque, Counter
from itertools import permutations, combinations
from heapq import heapify, heappop, heappush
from bisect import bisect, bisect_left

def search(n, x, m, K, D):
    ini = x % m
    modD = [D[i] % m for i in range(K)]
    roop , rem = (n - 1) // K, (n - 1) % K
    last = ini
    equal = 0
    for i in range(K):
        if i < rem and rem > 0:
            if modD[i] == 0: equal += roop + 1
            else: last += (roop + 1) * modD[i]
        else:
            if modD[i] == 0: equal += roop
            else: last += roop * modD[i]
    up = (last // m) - (ini // m)
    return n - 1 - equal - up

def solve():
    input = sys.stdin.readline
    K, Q = map(int, input().split())
    D = [int(d) for d in input().split()]
    Ans = []
    for _ in range(Q):
        n, x, m = map(int, input().split())
        Ans.append(search(n, x, m, K, D))

    for i, a in enumerate(Ans): print(a)

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from operator import itemgetter
from collections import deque, Counter
from itertools import permutations, combinations
from heapq import heapify, heappop, heappush
from bisect import bisect, bisect_left

def search(n, x, m, K, D):
    ini = x % m
    modD = [D[i] % m for i in range(K)]
    roop , rem = (n - 1) // K, (n - 1) % K
    last = ini
    equal = 0
    for i in range(K):
        if i < rem and rem > 0:
            if modD[i] == 0: equal += roop + 1
            else: last += (roop + 1) * modD[i]
        else:
            if modD[i] == 0: equal += roop
            else: last += roop * modD[i]
    up = (last // m) - (ini // m)
    return n - 1 - equal - up

def solve():
    input = sys.stdin.readline
    K, Q = map(int, input().split())
    D = [int(d) for d in input().split()]
    Ans = []
    for _ in range(Q):
        n, x, m = map(int, input().split())
        Ans.append(search(n, x, m, K, D))

    for i, a in enumerate(Ans): print(a)

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque, defaultdict
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush
from math import pi, inf
sys.setrecursionlimit(10000000)

def Attack(L):
    if L == 1: return 1
    else:
        return 1 + 2 * Attack(L//2)

def solve():
    H = int(input())
    print(Attack(H))

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from collections import deque, defaultdict
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10000000)

def Attack(L):
    if L == 1: return 1
    else:
        return 1 + 2 * Attack(L//2)

def solve():
    H = int(input())
    print(Attack(H))

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque, defaultdict
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush

def solve():
    input = sys.stdin.readline
    H, N = map(int, input().split())
    M = [tuple(int(a) for a in input().split()) for _ in range(N)]
    DP = [1000000000] * (H + 2) #ダメージiを与えるのに必要な最小MP, DP[H+1]はH以上のダメージを与えた場合
    DP[0] = 0
    for i, m in enumerate(M):
        a, b = m
        for j in range(H-a+1): DP[j + a] = min(DP[j + a], DP[j] + b)
        for j in range(H-a+1, H): DP[H + 1] = min(DP[H + 1], DP[j] + b)
    print(min(DP[H], DP[H + 1]))

    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from collections import deque, defaultdict
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush

def solve():
    input = sys.stdin.readline
    H, N = map(int, input().split())
    M = [tuple(int(a) for a in input().split()) for _ in range(N)]
    DP = [1000000000] * (H + 2) #ダメージiを与えるのに必要な最小MP, DP[H+1]はH以上のダメージを与えた場合
    DP[0] = 0
    for i, m in enumerate(M):
        a, b = m
        for j in range(max(H-a+1, 0)): DP[j + a] = min(DP[j + a], DP[j] + b)
        for j in range(max(H-a+1, 0), H): DP[H + 1] = min(DP[H + 1], DP[j] + b)
    print(min(DP[H], DP[H + 1]))

    return 0

if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque, defaultdict
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush

def solve():
    input = sys.stdin.readline
    H, N = map(int, input().split())
    M = [tuple(int(a) for a in input().split()) for _ in range(N)]
    DP = [[10000000 for _ in range(H + 2)] for i in range(N)]
    a0, b0 = M[0]
    for d in range(100000):
        if d * a0 >= H + 1:
            DP[0][H + 1] = d * b0
            break
        else: DP[0][d * a0] = d * b0
    for i in range(1, N):
        a, b = M[i]
        for j in range(H + 1):
            if DP[i - 1][j] < 10000000:
                if j < a: DP[i-1][j]
                else: DP[i][j] = min(DP[i-1][j], DP[i][j - a] + b)
        DP[i][H + 1] = min(DP[i][H + 1], DP[i-1][H + 1])
        DP[i][H + 1] = min(DP[i][H + 1], min(DP[i][H-a+1:H]) + b)
    
    print(min(DP[N-1][H], DP[N-1][H+1]))
    #print(DP)
    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys
from collections import deque, defaultdict
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush

def solve():
    input = sys.stdin.readline
    H, N = map(int, input().split())
    M = [tuple(int(a) for a in input().split()) for _ in range(N)]
    DP = [1000000000] * (H + 2) #ダメージiを与えるのに必要な最小MP, DP[H+1]はH以上のダメージを与えた場合
    DP[0] = 0
    for i, m in enumerate(M):
        a, b = m
        for j in range(max(H-a+1, 0)): DP[j + a] = min(DP[j + a], DP[j] + b)
        for j in range(max(H-a+1, 0), H): DP[H + 1] = min(DP[H + 1], DP[j] + b)
    print(min(DP[H], DP[H + 1]))

    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    playlist = dict()
    time = [0] * (N + 1)
    for i in range(N):
        s, t = map(str, input().split())
        playlist[s] = i
        time[i + 1] = time[i] + int(t)
    print(time[N] - time[playlist[input()] + 1])


    return 0

if __name__ == "__main__":
    solve()

Fixed submission:
import sys

def solve():
    N = int(input())
    playlist = dict()
    time = [0] * (N + 1)
    for i in range(N):
        s, t = map(str, input().split())
        playlist[s] = i
        time[i + 1] = time[i] + int(t)
    w = input()

    print(time[N] - time[playlist[w] + 1])


    return 0

if __name__ == "__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
S = ["SUN", "MON","TUE","WED","THU","FRI","SAT"]
d = input()
for i in range(d):
  if d == S[i]:
    print(7 - i)
    break

Fixed submission:
S = ["SUN", "MON","TUE","WED","THU","FRI","SAT"]
d = input()
for i in range(7):
  if d == S[i]:
    print(7 - i)
    break