Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03013 (python)

Fixed submission:
def fibonacci(N):
    a = 1
    b = 2
    c = 0

    if N <= 1:
        return 1
    elif N == 2:
        return 2
    else:
        for i in range(N-2):
            c = a+b
            a = b
            b = c
    return c


def main():
    N,M = map(int,input().split())
    A = [int(input()) for _ in range(M)]

    temp = 1
    for i in range(M+1):
        if M == 0:
            temp = fibonacci(N)
            break
        else:
            if i == 0:
                num = fibonacci(A[i]-1)
            else:
                if i <= M-1:
                    if A[i-1] == A[i]-1:
                        print(0)
                        return
                    num = fibonacci(A[i]-A[i-1]-2)
                else:
                    num = fibonacci(N-A[i-1]-1)
        temp *= num
    print(temp%1000000007)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def fibonacci(N):
    a = 1
    b = 2
    c = 0

    if N <= 1:
        return 1
    elif N == 2:
        return 2
    else:
        for i in range(N-2):
            c = a+b
            a = b
            b = c
    return c


def main():
    N,M = map(int,input().split())
    A = [int(input()) for _ in range(M)]

    temp = 1
    for i in range(M+1):
        if i == 0:
            num = fibonacci(A[i]-1)
        else:
            if i <= M-1:
                if A[i-1] == A[i]-1:
                    print(0)
                    return
                num = fibonacci(A[i]-A[i-1]-2)
            else:
                num = fibonacci(N-A[i-1]-1)
        temp *= num
    print(temp%1000000007)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def fibonacci(N):
    a = 1
    b = 2
    c = 0

    if N <= 1:
        return 1
    elif N == 2:
        return 2
    else:
        for i in range(N-2):
            c = a+b
            a = b
            b = c
    return c

def main():

    N,M = map(int,input().split())
    A = [int(input()) for _ in range(M)]

    temp = 1
    for i in range(M+1):
        if i == 0:
            num = fibonacci(A[i]-1)
        else:
            if i <= M-1:
                if A[i-1] == A[i]-1:
                    print(0)
                    return
                num = fibonacci(A[i]-A[i-1]-2)
            else:
                num = fibonacci(N-A[i-1]-1)
        temp *= num
    print(temp%1000000007)


if __name__ == '__main__':
    main()
Problem p03272 (python)

Fixed submission:
def main():
    n,i = map(int,input().split())

    print(n+1-i)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
vdef main():
    n,i = map(int,input().split())

    print(n+1-i)

if __name__ == '__main__':
    main()
Problem p03307 (python)

Fixed submission:
import fractions

def main():
    n = int(input())
    print(int(2*n/fractions.gcd(2, n)))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    n = int(input())
    print(int(2*n/math.gcd(2, n)))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

def main():
    n = int(input())
    print(int(2*n/math.gcd(2, n)))

if __name__ == '__main__':
    main()
Problem p02777 (python)

Fixed submission:
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial

sys.setrecursionlimit(10**7)
S, T = input().split()
A, B = map(int, input().split())
s = input()

if s == S:
    print(A-1, B)
else:
    print(A, B-1)

Buggy submission (verdict: Runtime Error):
S, T = input.split()
a, b = map(int, input.split())
s = input()
if s == S:
  print(a-1, b)
else:
  print(a, b-1)
Problem p02793 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
from fractions import gcd
div = 10**9 + 7

def main():
    N = int(input())
    A = list(map(int, input().split()))
    sA = list(set(A))

    val = 1
    def lcm(a, b):
        ret = gcd(a, b)
        ret = a*b//ret
        return ret

    val = sA[0]
    for a in sA[1:]:
        val = lcm(val, a)

    B = [val//a for a in A]
    sumB = sum(B)
    sumB %= div

    print(sumB)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def input():
    return sys.stdin.readline()[:-1]
from fractions import gcd
div = 10**9 + 7

sys.setrecursionlimit(10**7)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    sA = list(set(A))

    val = 1
    def lcm(a, b):
        ret = gcd(a, b)
        ret = a*b//ret
        return ret

    val = sA[0]
    for a in sA[1:]:
        val = lcm(val, a)

    B = [val//a for a in A]
    sumB = sum(B)
    sumB %= div

    print(sumB)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def input():
    return sys.stdin.readline()[:-1]
from fractions import gcd
div = 10**9 + 7

sys.setrecursionlimit(10**7)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    sA = list(set(A))

    val = 1
    def lcm(a, b):
        ret = gcd(a, b)
        ret = a*b//ret
        return ret

    val = sA[0]
    for a in sA[1:]:
        val = lcm(val, a)

    B = [val//a for a in A]
    sumB = sum(B)
    sumB %= div

    print(sumB)

if __name__ == '__main__':
    main()
Problem p02833 (python)

Fixed submission:
import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


N = int(input())
if N % 2:
    print(0)
    exit()
else:
    N //= 2

ans = 0
while N > 0:
    N //= 5
    ans += N
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N = int(input())

if N%2:
    print(0)
    exit()

print(sum([N//(2*5**i) for i in range(1, 50)]))

import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N = int(input())

if N%2:
    print(0)
    exit()

print(sum([N//(2*5**i) for i in range(1, 50)]))

Buggy submission (verdict: Runtime Error):
import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N = int(input())

if N%2:
    print(0)
    exit()

v = math.floor(math.log(N, 5))

print(sum([N//(2*5**i) for i in range(1, v+1)]))

Buggy submission (verdict: Runtime Error):
import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)

N = int(input())


if N%2 == 1:
    print(0)
    exit()

v = math.log(N, 5)

l = [i for i in range(1, math.floor(v+1))]
ll = [2*5**i for i in l]
lll = [N//i for i in ll]
print(sum(lll))

Buggy submission (verdict: Runtime Error):
import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)

N = int(input())


if N%2 == 1:
    print(0)
    exit()

v = math.log(N, 5)

l = [i for i in range(1, math.floor(v+1))]
ll = [2*5**i for i in l]
lll = [N//i for i in ll]
print(sum(lll))

Buggy submission (verdict: Runtime Error):
import math
import sys
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N = int(input())


if N%2 == 1:
    print(0)
    exit()

v = math.log(N, 5)

l = [i for i in range(1, math.floor(v+1))]
ll = [2*5**i for i in l]
lll = [N//i for i in ll]
print(sum(lll))
Problem p02834 (python)

Fixed submission:
import sys, heapq
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N, u, v = map(int, input().split())



def dijkstra_heap(s,edge):
#始点sから各頂点への最短距離
    d = [10**20] * N
    used = [True] * N #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

AB = [list(map(int, input().split())) for _ in range(N-1)]

adjl = [[] for _ in range(N)]
for ab in AB:
    a, b = ab[0]-1, ab[1]-1
    adjl[a].append([1, b])
    adjl[b].append([1, a])

du = dijkstra_heap(u-1, adjl)
dv = dijkstra_heap(v-1, adjl)
dOK = [j for i, j in zip(du, dv) if i < j]

print(int(max(dOK)-1))

Buggy submission (verdict: Runtime Error):
import sys, numpy as np, heapq
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson  
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N, u, v = map(int, input().split())



def dijkstra_heap(s,edge):
#始点sから各頂点への最短距離
    d = [10**20] * N
    used = [True] * N #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

AB = [list(map(int, input().split())) for _ in range(N-1)]

adjl = [[] for _ in range(N)]
for ab in AB:
    a, b = ab[0]-1, ab[1]-1
    adjl[a].append([1, b])
    adjl[b].append([1, a])

du = dijkstra_heap(u-1, adjl)
dv = dijkstra_heap(v-1, adjl)
dOK = [j for i, j in zip(du, dv) if i < j]

print(int(max(dOK)-1))
Problem p02862 (python)

Fixed submission:
import math
import itertools
import sys

x, y = [int(x) for x in input().split()]

if (x+y) % 3:
  print(0)
  sys.exit()

total_move = (x+y) // 3
move_a = 2 * total_move - x

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = total_move
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

a = cmb(total_move,move_a,mod)

print(a)

Buggy submission (verdict: Runtime Error):
import math
import itertools
import sys

x, y = [int(x) for x in input().split()]

if (x+y) % 3:
    print(0)
    sys.exit()

total_move = (x+y) // 3
move_a = 2 * total_move - x

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = total_move
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

    a = cmb(total_move,move_a,mod)

print(a)
Problem p02892 (python)

Fixed submission:
from collections import deque
import sys
sys.setrecursionlimit(10**7)
N = int(input())
S = [input().strip() for _ in range(N)]

flg = False
max_cnt = 1
for sp, row in enumerate(S):
    # start BFS
    C = [0]*N
    C[sp] = 1
    q = deque([])
    for i, v in enumerate(row):
        if v == '1':
            q.append(int(i))

    cnt = 1 # length
    c = -1 # color
    while q:
        for i in range(len(q)):
            np_ind = q.popleft()
            if C[np_ind] == -c:
                print(-1)
                exit()
            elif C[np_ind] == c:
                pass
            else:
                C[np_ind] = c
                for i, v in enumerate(S[np_ind]):
                    if v == '1' and C[i] == 0:
                        q.append(int(i))
        cnt += 1
        c *= -1
    if max_cnt < cnt:
        max_cnt = cnt

print(max_cnt)

Buggy submission (verdict: Runtime Error):
sin/agc039 >>> cat b.py 
from collections import deque
import sys
sys.setrecursionlimit(10**7)
N = int(input())
S = [input().strip() for _ in range(N)]
C = [0]*N

flg = False
for sp, row in enumerate(S):
    if flg:
        break

    if row.count('1') == 1 or sp == len(S)-1:
        flg = True

        # start BFS
        C[sp] = 1
        q = deque([])
        for i, v in enumerate(row):
            if v == '1':
                q.append(int(i))

        cnt = 0 # length
        c = -1 # color
        while q:
            cnt += 1
            for i in range(len(q)):
                np_ind = q.popleft()
                if C[np_ind] == -c:
                    print(-1)
                    exit()
                elif C[np_ind] == c:
                    pass
                else:
                    C[np_ind] = c
                    for i, v in enumerate(S[np_ind]):
                        if v == '1':
                            q.append(int(i))
            c *= -1

print(cnt)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a>=3200: print(s)
else: print('red')

Buggy submission (verdict: Runtime Error):
from collections import deque
N, Q = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N-1)]
PX = [list(map(int, input().split())) for _ in range(Q)]

chil = [[] for _ in range(N+1)]
count = [0]*(N+1)

for ab in AB:
    chil[ab[0]].append(ab[1])
    chil[ab[1]].append(ab[0])

def cleanse(fromN, toN):
    chil[toN].remove(fromN)
    if len(chil[toN])==0:  # leaf
        return
    for node in chil[toN]:
        cleanse(toN, node)

for node in chil[1]:
    cleanse(1, node)

def addition(fromN, toN, value):
    count[toN] += value
    if len(chil[toN])==0:
        return
    for node in chil[toN]:
        addition(toN, node, value)

for px in PX:
    count[px[0]] += px[1]
    for node in chil[px[0]]:
        addition(px[0], node, px[1])

print(*count[1:])
Problem p02948 (python)

Fixed submission:
import heapq
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()

q = []
idx = 0
ans = 0
for i in range(1, M+1):
    while idx < N:
        a, b = AB[idx]
        if a <= i:
            heapq.heappush(q, -b)
            idx += 1
        else:
            break
    if len(q) > 0:
        b = heapq.heappop(q)
        ans -= b

print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort()

q = []
idx = 0
ans = 0
for i in range(1, M+1):
    while idx < N:
        a, b = AB[idx]
        if a <= i:
            heapq.heappush(q, -b)
            idx += 1
        else:
            break
    if len(q) > 0:
        b = heapq.heappop(q)
        ans -= b

print(ans)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
div = 1000000007

a.sort()
A = [0]*(N+1)
A[0] = 1

flag = True
if M==0: flag = False

for i in range(1, N+1):
  if flag and i == a[0]:
    A[i] = 0
    a.remove(i)
    if len(a)==0: flag = False
  else:
    if i==1: A[i] = 1
    else:
      A[i] = (A[i-1] + A[i-2])%div

print(A[N])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
div = 1000000007

a.sort()
A = [0]*(N+1)
A[0] = 1

flag = True
for i in range(1, N+1):
  if flag and i == a[0]:
    A[i] = 0
    a.remove(i)
    if len(a)==0: flag = False
  else:
    if i==1: A[i] = 1
    else:
      A[i] = (A[i-1] + A[i-2])%div

print(A[N])
Problem p03038 (python)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]

A = sorted(A)
BC = sorted(BC, key=lambda x: -x[1])

lenA = len(A)
i = 0
for bc in BC:
  for j in range(bc[0]):
    if i > lenA-1: break
    if A[i] > bc[1]: break
    A[i] = bc[1]
    i += 1

print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]

A = sorted(A)
BC = sorted(BC, key=lambda x: -x[1])

lenA = len(A)
i = 0
for bc in BC:
  for j in range(bc[0]):
    if A[i] > bc[1]: break
    if i > lenA: break
    A[i] = bc[1]
    i += 1

print(sum(A))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]

A = sorted(A)
BC = sorted(BC, key=lambda x: -x[1])

i = 0
for bc in BC:
  for j in range(bc[0]):
    if A[i] > bc[1]: break
    A[i] = bc[1]
    i += 1

print(sum(A))
Problem p03317 (python)

Fixed submission:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, K = map(int, input().split())
A = list(map(int, input().split()))

print(math.ceil((N-1)/(K-1)))

Buggy submission (verdict: Runtime Error):
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N, K = map(int, input().split())
A = list(map(int, input().split()))

print(math.ceil((N-1)/(K-1))
Problem p03329 (python)

Fixed submission:
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N = int(input())
INF = 10**18

res = 0
dp = [INF]*(10*N)
dp[0] = 0
for i in range(0, N):
    dp[i+1] = min(dp[i+1], dp[i]+1)

    j = 1
    while i+6**j <= N:
        dp[i+6**j] = min(dp[i+6**j], dp[i]+1)
        j += 1

    l = 1
    while i+9**l <= N:
        dp[i+9**l] = min(dp[i+9**l], dp[i]+1)
        l += 1

print(dp[N])

Buggy submission (verdict: Runtime Error):
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

N = int(input())
INF = 10**18

res = 0
dp = [INF]*(2*N)
dp[0] = 0
for i in range(0, N+1):
    dp[i+1] = min(dp[i+1], dp[i]+1)

    j = 1
    while i+(6**j) <= N:
        dp[i+(6**j)] = min(dp[i+(6**j)], dp[i] + 1)
        j += 1

    l = 1
    while i+(9**l) <= N:
        dp[i+(9**l)] = min(dp[i+9**l], dp[i] + 1)
        l += 1

print(dp[N])
Problem p02578 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
answer=0
if N==1:
    print(0)
else:
    for n in range(N - 1):
        if A[n] > A[n + 1]:
            sa = A[n] - A[n + 1]
            answer += sa
            A[n + 1] = A[n]
    if A[-2] > A[-1]:
        answer += A[-2] - A[-1]
    print(answer)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
answer=0
for n in range(N-1):
    if A[n]>A[n+1]:
        sa=A[n]-A[n+1]
        answer+=sa
        A[n+1]=A[n]
if A[-2]>A[-1]:
    answer+=A[-2]-A[-1]
print(answer)
Problem p02624 (python)

Fixed submission:
N = int(input())

ans = 0
for x in range(1, N + 1):
    n = N // x
    ans += n * (2 * x + (n - 1) * x) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())

answer=1
# -*- coding:utf-8 -*-
import math
import numpy as np

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    return data


def factorization(n):
    arr = []
    temp = n
    for i in get_sieve_of_eratosthenes(int(N**0.5)):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    number=1


    for a in arr:
        number*=(a[1]+1)
    return number



for n in range(2,N+1):
    answer+=n*factorization(n)

print(answer)

Buggy submission (verdict: Runtime Error):
N=int(input())
import math
import sympy

answer=0
for n in range(1,N+1):
    suuji=sympy.divisors(n)
    answer+=suuji*n
print(answer)

Buggy submission (verdict: Runtime Error):
N=int(input())
import math
import sympy

answer=0
for n in range(1,N+1):
    suuji=sympy.divisor_count(n)
    answer+=suuji*n
print(answer)
Problem p02629 (python)

Fixed submission:
import math
N=int(input())

a=[chr(i) for i in range(97, 97+26)]
# [chr(i) for i in range(ord('a'), ord('z')+1)]
if N>26:
    answers = []
    while N > 0:
        N-=1
        b = N % 26
        answers.append(a[b ])
        N = N // 26

    answers.reverse()
    b = ''
    for a in answers:
        b += a
    print(b)
else:
    print(a[N-1])

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
n=1
while True:
    if N <= 26**n:
        break
    n+=1
c=N
for n_ in range(1,n):
    c-=26**n_

a=[chr(i) for i in range(97, 97+26)]
# [chr(i) for i in range(ord('a'), ord('z')+1)]

answers=[]
while N>=26:
    b=N%26
    answers.append(a[b-1])
    N=N//26

answers.append(a[b-1])
answers.reverse()
b=''
for a in answers:
    b+=a
print(b)
Problem p02682 (python)

Fixed submission:
A,B,C,K=map(int,input().split())
if A+B>=K:
    if A<=K:
        print(A)
    else:
        print(K)
else:
    print(A*2-K+B)

Buggy submission (verdict: Runtime Error):
A,B,C,K=map(int,input().split())
a=[1]*A
b=[0]*B
c=[-1]*C
S=a+b+c
T=S[:K]
print(sum(T))
Problem p02759 (python)

Fixed submission:
N=int(input())

print(-(-N//2))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
numbers=[' ',]*N
kotae=0
for a in range(M):
    suuji=[]
    s,c=input().split()
    if numbers[int(s)-1]==' ':
        numbers[int(s)-1]=c
    else:
        if numbers[int(s)-1]==c:
            continue
        else:
            print('-1')
            kotae+=1
            break

for a in range(3):
    if numbers[a]==' ':
        numbers[a]=0
if numbers[0]==0:
    del numbers[0]
    if numbers[0]==0:
        del numbers[0]
        if numbers[0]==0:
            del numbers[0]
if kotae==0:
    if len(numbers)!=N:
        print('-1')
    else:
       moji=''
       for a in numbers:
           moji+=str(a)
       print(int(moji))