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

Fixed submission:
x,y,z = input().split()
if x == y and x == z:
    print("No")
elif x == y or y == z or x == z:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())
z = int(input())
if x == y or y == z or x == z:
    print("Yes")
else:
    print("No")
Problem p02622 (python)

Fixed submission:
S = input()
T = input()
count = 0
for i in range(len(S)):
  if S[i]!=T[i]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
ソースコード 

Copy
Copy
S = input()
T = input()
count = 0
if S == T:
  print(0)
else:
  for i in range(len(S)):
    if S[i]!=T[i]:
      count += 1
  print(count)
Problem p03835 (python)

Fixed submission:
K, S = map(int, input().split())

count = 0
for x in range(K+1):
    if S-x<=2*K and S-x>=0:
        for y in range(K+1):
            if S-x-y<=K and S-x-y>=0:
                count += 1
#                 for z in range(K+1):
#                     if x+y+z==S:
#                         count += 1
print(count)

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())

count = 0
for x in range(K+1):
    if S-x<=2*K:
        for y in range(K+1):
            if S-x-y<=K:
                cout += S-x-y+1
#                 for z in range(K+1):
#                     if x+y+z==S:
#                         count += 1
print(count)
Problem p02880 (python)

Fixed submission:
n = int(input())

for i in range(10):
  for j in range(10):
    if i * j == n:
      print("Yes")
      exit()
print("No")

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

for i in range(1:10):
  for j in range(1:10):
    if i * j == n:
      print("Yes")
    else:
      print("No")
Problem p03835 (python)

Fixed submission:
K, S = map(int, input().split())

cnt = 0
for x in range(K+1):
  for y in range(K+1):
    z = S - x - y
    if 0 <= z and z <= K:
      cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())

cnt = 0
for x, y, z in range(K+1):
  if x + y + z == S:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())

cnt = 0
for x, y, z in range(K):
  if x+y+z == S:
    cnt += 1
print(cnt)
Problem p02987 (python)

Fixed submission:
def ok(s: str) -> str:
    char_count = {}
    for c in s:
      if c not in char_count:
        char_count[c] = 0
      if c in char_count.keys():
        char_count[c] += 1
    
    return all([count == 2 for count in char_count.values()])

numbers_str = input()
result = ok([c for c in numbers_str])
if result:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def ok(s: str): str:
    char_count = {}
    for c of s:
      if c not in char_count:
        char_count[c] = 0
      if c in char_count.keys():
        chars[c] += 1
    
    yes = all([count == 2 for count in char_count.values()])
    if yes:
      return 'Yes'
    else:
      return 'No'
Problem p02987 (python)

Fixed submission:
s=input()
for i in s:
    if s.count(i)!=2:
        print('No')
        break
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
str=list(input())
if str.count(str[0])==2 and str.count(str[1])==2:
    print("Yes")
elif str.count(str[0])==2 and str.count(str[2])==2:
else:
    print("No")
Problem p02835 (python)

Fixed submission:
a = list(map(int,input().split()))
sum = a[0] + a[1] + a[2]
if sum >= 22:
	print("bust")
else:
	print("win")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
sum = a[0] + a[1] + a[2]
if sum >= 22
	print("bust")
else:
	print("win")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
sum = a[0] + a[1] + a[2]
if sum <= 21
	print("win")
else
	print("bust")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
sum = a[0] + a[1] + a[2]
if sum >= 22
	print("bust")
else
	print("win")
Problem p02711 (python)

Fixed submission:
a = [x for x in input()]
for i in range(len(a)):
    if a[i] == '7':
        a[i] = True
    else:
        a[i] = False
if any(a):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = int(input())
if 7 in a:
  print("Yes")
else:
  print("No")
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int, input().split())
if k <= a:
    k_pa, k_pb, k_pc = k , 0, 0 
elif k > a and k-a <= b:
    k_pa, k_pb, k_pc = a, b, 0
elif k > a and k-a > b:
    k_pa, k_pb, k_pc = a, b, k-a-b
point = k_pa - (k-k_pa-k_pb)
print(point)

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
if k <= a:
    k_pa, k_pb, k,pc = k , 0, 0 
elif k >= a and k-a <= b:
    k_pa, k_pb, k_pc = a, k-a, 0
elif k >= a and k-a >= b:
    k_pa, k_pb, k_pc = a, k-a, k-a-b
point = k_pa - (k-a-b)
print(point)
Problem p03053 (python)

Fixed submission:
from collections import deque

# (sx, sy) から (gx, gy) への最短距離を求める
# 辿り着けないと INF
def bfs():
    # すべての点を INF で初期化
    d = [[float("inf")] * m for i in range(n)]

    # 移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    #queの定義
    que = deque([])
   
    for i in range(n):
        for j in range(m):
            # スタートとゴールの座標を探す
            if maze[i][j] == "#":
                sx = i
                sy = j
                que.append((sx, sy))
                d[sx][sy] = 0

    # キューが空になるまでループ
    while que:
        # キューの先頭を取り出す
        p = que.popleft()
        # 移動4方向をループ
        for i in range(4):
            # 移動した後の点を (nx, ny) とする
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]

            # 移動が可能かの判定とすでに訪れたことがあるかの判定
            # d[nx][ny] != INF なら訪れたことがある
            if 0 <= nx < n and 0 <= ny < m and maze[nx][ny] != "#" and d[nx][ny] == float("inf"):
                # 移動できるならキューに入れ、その点の距離を p からの距離 +1 で確定する
                que.append((nx, ny))
                d[nx][ny] = d[p[0]][p[1]] + 1
    ans = 0
    for i in range(n):
        for j in range(m):
            ans = max(ans, d[i][j])
    
    return ans

n, m = map(int, input().split())
maze = [list(input()) for i in range(n)]

print(bfs())

Buggy submission (verdict: Runtime Error):
# p37 迷路の最短路

from collections import deque


# (sx, sy) から (gx, gy) への最短距離を求める
# 辿り着けないと INF
def bfs():
    # すべての点を INF で初期化
    d = [[float("inf")] * n for i in range(m)]

    # 移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    #queの定義
    que = deque([])
   
    for i in range(n):
        for j in range(m):
            # スタートとゴールの座標を探す
            if maze[i][j] == "#":
                sx = i
                sy = j
                que.append((sx, sy))
                d[sx][sy] = 0

    # キューが空になるまでループ
    while que:
        # キューの先頭を取り出す
        p = que.popleft()
        # 移動4方向をループ
        for i in range(4):
            # 移動した後の点を (nx, ny) とする
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]

            # 移動が可能かの判定とすでに訪れたことがあるかの判定
            # d[nx][ny] != INF なら訪れたことがある
            if 0 <= nx < n and 0 <= ny < m and maze[nx][ny] != "#" and d[nx][ny] == float("inf"):
                # 移動できるならキューに入れ、その点の距離を p からの距離 +1 で確定する
                que.append((nx, ny))
                d[nx][ny] = d[p[0]][p[1]] + 1
    ans = 0
    for i in range(n):
        for j in range(m):
            ans = max(ans, d[i][j])
    
    return ans

n, m = map(int, input().split())
maze = [list(input()) for i in range(n)]

print(bfs())
Problem p02759 (python)

Fixed submission:
n = int(input())
ans = 0
if n % 2 ==  0:
    ans = int(n / 2)
else: 
    ans = int(n / 2) + 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(Decimal(n / 2))
Problem p02881 (python)

Fixed submission:
import math
s = input().split() #標準入力　sに値を入れる
n = int(s[0])
root = int(math.sqrt(n))
ans = 10**18
for i in range(1, root + 1):
    if n % i != 0:
        continue
    j = n / i
    ans = min(ans, i + j - 2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
s = input().split() #標準入力　sに値を入れる

def sort(A):
    if len(A) < 2:
        return A
    c = len(A)//2
    return merge(sort(A[:c]), sort(A[c:]))

def merge(X, Y):
    if len(X) < 1:
        return Y
    if len(Y) < 1:
        return X
    if (X[0] > Y[0]):
        return [Y[0]]+ merge(X, Y[1:])
    else:
        return [X[0]] + merge(X[1:], Y)

n = int(s[0])
divisors = []
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n//i)

divisors = sort(divisors)
l = len(divisors)
n1 = divisors[l // 2 - 1]
n2 = divisors[l // 2]
ans = n1 + n2 - 2
print(n2)
Problem p03135 (python)

Fixed submission:

t, x = map(int, input().split(' '))
print(t/x)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split(' ')))
#p = [list(map(int, input().split())) for _ in range(n)]
p = sorted(p, reverse=True)
if len(p) != n or n < 4:
  raise ValueError

#print(p[0], p[1:])
if p[0] < sum(p[1:]):
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split(' ')))
#p = [list(map(int, input().split())) for _ in range(n)]
p = sorted(p, reverse=True)
if len(p) != n:
  raise ValueError

#print(p[0], p[1:])
if p[0] < sum(p[1:]):
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split(' ')))
p = sorted(p, reverse=True)

if p[0] < sum(p[1:]):
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split(' ')))

p = sorted(p)
if p[0] < sum(p[1:]):
	print('Yes')
else:
	print('No')
Problem p03307 (python)

Fixed submission:
n = int(input())

print(2 * n if n % 2 != 0 else n)

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

if n < 1 or n > 10:
    raise ValueError

print(2 * n if n % 2 != 0 else n)

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

if n < 1 or n > 10:
    raise ValueError

print(2 * n)
Problem p02627 (python)

Fixed submission:
a = input().islower()

if a == 0:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = input().isupper()
if ture == a:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = input().isupper
if ture == a:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
input().isupper
if ture:
  print("A")
else:
  print("a")
Problem p02622 (python)

Fixed submission:
ans=0
S=list(input())
T=list(input())
for i in range(len(S)):
  if S[i] != T[i]:
    ans = ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
S,T=list(input().split())
count=0
for i in range(len(S)):
  if S[i]!=T[i]:
    count = count+1
print(count)
Problem p02712 (python)

Fixed submission:
n=int(input())
ans = 0
for i in range(n+1):
	if i%3 != 0 and i%5 !=0:
  		ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans = 0
for i in range(n+1):
	if a%3 != 0 and a%5 !=0:
  		ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans = 0
for i in range(a+1)
if a%3 != 0 and a%5 !=0:
  ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())
ans = 0
while i <= a+1
if a%3 != 0 and a%5 !=0:
  ans += i
print(ans)
Problem p02688 (python)

Fixed submission:
(n, k) = [int(s) for s in input().split()]

data = [[0 for i in range(k)] for j in range(n)]

for i in range(0, k):
    d = int(input())
    a = [int(s) for s in input().split()]

    for m in a:
        data[m - 1][i] = 1

dd = []

for d in data:
    dd.append(sum(d))

ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
(n, k) = [int(s) for s in input().split()]

data = [[0 for i in range(k)] for j in range(n)]

for i in range(0, k):
    d = int(input())
    a = [int(s) for s in input().split()]

    for m in a:
        data[m - 1][d - 1] = 1

dd = []



ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
(n, k) = [int(s) for s in input().split()]

data = [[0 for i in range(k)] for j in range(n)]

for i in range(0, k):
    d = int(input())
    a = [int(s) for s in input().split()]

    for m in a:
        data[m - 1][d - 1] = 1

dd = []

for d in data:
    dd.append(sum(d))

ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
(n, k) = [int(s) for s in input().split()]

data = arr = [[0 for i in range(k + 1)] for j in range(n + 1)]

for i in range(0, k):
    d = int(input())
    a = [int(s) for s in input().split()]

    for m in a:
        data[m - 1][d - 1] = 1

dd = []

for d in data:
    dd.append(sum(d))

ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
(n, k) = [int(s) for s in input().split()]

data = arr = [[0 for i in range(k)] for j in range(n)]

for i in range(0, k):
    d = int(input())
    a = [int(s) for s in input().split()]

    for m in a:
        data[m - 1][d - 1] = 1

dd = []

for d in data:
    dd.append(sum(d))

ans = 0

for ddd in dd:
    if ddd == 0:
        ans += 1

print(ans)
Problem p03072 (python)

Fixed submission:
def main():
    n = int(input())
    h_n = [int(s) for s in input().split()]

    cnt = 0
    for i in range(0, n):
        diff = [h_n[i] - h_n[j] for j in range(0, i)]
        cnt = cnt + 1 if len(list(filter(lambda x: x < 0, diff))) == 0 else cnt

    print(cnt)

    
main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    h_n = [int(s) for s in input().split()]

    for idx in range(1, n):
        diff = [h_n[idx] - h_n[i] for i in range(0, idx-1)]
        diff = filter(lambda x: x >= 0, diff)

    print(len(list(diff)) + 1)
    
main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    h_n = [int(s) for s in input().split()]

    for idx in range(1, n):
        diff = [h_n[idx] - h_n[i] for i in range(0, idx-1)]
        print(diff)
        diff = filter(lambda x: x >= 0, diff)

    print(len(list(diff)) + 1)
    
main()
Problem p02629 (python)

Fixed submission:
#ABC 171 C - One Quadrillion and One Dalmatians 10:59

n = int(input())
res =''
while n > 0:
    n -= 1
    res += chr(ord('a') + n % 26)
    n //= 26
print(res[::-1])

Buggy submission (verdict: Runtime Error):
#ABC 171 C - One Quadrillion and One Dalmatians 10:59

n = int(input())
q = []
while n > 0:
    v = n % 26
    q.append(v)
    n //= 26

res = ''
dic = {1: 'a', 2:'b', 3:'c', 4:'d', 5:'e', 6:'f', 7:'g', 8:'h', 9:'i',
      10:'j', 11:'k', 12:'l', 13:'m', 14:'n', 15:'o', 16:'p', 17:'q',
      18:'r', 19:'s', 20:'t', 21:'u', 22:'v', 23:'w', 24:'x', 25:'y', 26:'z'}

for i in reversed(q):
    res += dic[i]

print(res)
Problem p03329 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def rec(n):
    if n == 0: return 0
    if memo[n] != -1: return memo[n]
    
    res = n
    i = 1
    while 6**i <= n:
        res = min(res, rec(n - 6**i) + 1)
        i += 1
    
    i = 1
    while 9**i <= n:
        res = min(res, rec(n - 9**i) + 1)
        i += 1
    
    memo[n] = res
    return res

n = int(input())
memo = [-1]*(n+10)
print(rec(n))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7) #再帰関数の呼び出し制限

N = int(input())

def ch(x, y):
    cnt = 0
    while x**cnt <= y:
        cnt += 1
    return cnt

coin = [1]
for i in range(1, ch(6, N)):
    coin.append(6**i)

for i in range(1, ch(9, N)):
    coin.append(9**i)

def rec(n):
    if n == 0: return 0
    if memo[n] != -1: return memo[n]
    
    res = n
    
    for c in coin:
        res = min(res, rec(n-c)+1)
    
    memo[n] = res
    return memo[n]

memo = [-1]*(10**5+10)
rec(N)
print(memo[N])
Problem p02622 (python)

Fixed submission:
k=list(input())
m=list(input())
ams=0
for i in range(len(k)):
  if(k[i]!=m[i]):
    ams+=1
print(ams)

Buggy submission (verdict: Runtime Error):
k=list(input())
m=list(input())
ams=0
for i in (len(k)):
  if(k[i]!=m[i]):
    ams+=1
print(ams)
Problem p02881 (python)

Fixed submission:
n = int(input())
anser = n - 1
for i in range (2, n):
    if n % i == 0:
        j = n // i
        anser = i + j - 2
    if i * i > n:
        break
print(anser)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range (2, n):
    if n % i == 0:
        j = n // i
        anser = i + j - 2
    if i * i > n:
        break
print(anser)
Problem p02859 (python)

Fixed submission:
in_data = [int(input()) for i in range(1)]
print(in_data[0] ** 2)

Buggy submission (verdict: Runtime Error):
in_data = input()
print(in_data^2)
Problem p02693 (python)

Fixed submission:
def main():
    K = int(input())
    A, B = map(int, input().split())

    for i in range(A, B+1):
        if i % K == 0:
            print('OK')
            return
    print('NG')


if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
 main():
    K = int(input())
    A, B = map(int, input().split())
    x = list(range(K, 1001, K))
    print('OK') if any([A <= i <= B for i in x]) else print('NG')

    return


if __name__=="__main__":
    main()
Problem p02754 (python)

Fixed submission:
def main():
    n, a, b = map(int, input().split())
    q, mod = divmod(n, (a+b))
    x = mod if mod < a else a
    print(q*a+x)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, a, b = map(int, input().split())
    q, mod = divmod(n, (a+b))
    x = mod if mod < n else x = n
    print(q*a+x)

if __name__ == "__main__":
    main()
Problem p02753 (python)

Fixed submission:
S = input()

if S[0] == S[1] and S[1] == S[2]:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
input()

if S[0] == S[1] and S[1] == S[2]:
    print('No')
else:
    print('Yes')
Problem p02689 (python)

Fixed submission:
n, m = map(int, (input().split()))
h = list(map(int, input().split()))
p = [1]*n
max = 0
for i in range(m):
    a, b = map(int, (input().split()))
    if h[a-1] <= h[b-1]:
        p[a-1] = 0
    if h[a-1] >= h[b-1]:
        p[b-1] = 0
print(sum(p))

Buggy submission (verdict: Runtime Error):
n, m = map(int(input().split()))
h = list(map(int, input().split()))
p = [1]*n
max = 0
for i in range(m):
    a, b = map(int(input().split()))
    if h[a-1] <= h[b-1]:
        p[a-1] = 0
    if h[a-1] >= h[b-1]:
        p[b-1] = 0
print(sum(p))
Problem p02729 (python)

Fixed submission:
import math
N, M = list(map(int, input().split()))
n_pairs = math.factorial(N) // (2*math.factorial(N-2)) if N > 1 else 0
m_pairs = math.factorial(M) // (2*math.factorial(M-2)) if M > 1 else 0
print(n_pairs + m_pairs)

Buggy submission (verdict: Runtime Error):
import math
N, M = list(map(int, input().split()))
print(math.factorial(N) // (2*math.factorial(N-2)) + math.factorial(M) // (2*math.factorial(M-2)))
Problem p02676 (python)

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

if len(s)<=n:
    print(s)
else:
    i=0
    for i in range(n):
        print(s[i], end='')
    print('...')

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()

if len(s)<=n:
    print(s)
else:
    i=0
    for i in range(7):
        print(s[i], end='')
    print('...')
Problem p03011 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split())
a.sort()
print(a[0]+a[1])
Problem p02659 (python)

Fixed submission:
a, b = input().strip().split()
a, b = [int(a), float(b)]
ans = int(a * round(b * 100) // 100)
# ans = int(a * b)
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = input().strip().split()
a, b = [int(a), int(b)]
ans = int(a * b)
print(ans)
Problem p02897 (python)

Fixed submission:
n = int(input())
li = range(1, n+1)
odd = 0
for i in li:
    if i % 2 == 1:
        odd += 1
ans = odd / n
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
order = []
for i in range(1, n+1):
    order += [str(a.index(i)+1)]
print(' '.join(order))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
order = []
for i in range(1, n+1):
    order += [a.index(i)+1]
print(' '.join(map(str, order)))
Problem p02629 (python)

Fixed submission:
bounds = [sum([26 ** i for i in range(n)]) for n in range(1, 12)]
lis = 'abcdefghijklmnopqrstuvwxyz'
N = int(input())
for b in reversed(bounds):
    if b <= N:
        break
N -= b 
length = bounds.index(b) + 1
s = ''
for i in range(length - 1, 0, -1):
    idx, N = divmod(N, 26**i)
    s = s + lis[idx]
print(s + lis[N])

Buggy submission (verdict: Runtime Error):
bounds = [sum([26 ** i for i in range(n)]) for n in range(1, 11)]
lis = 'abcdefghijklmnopqrstuvwxyz'
N = int(input())
for b in reversed(bounds):
    if b <= N:
        break
N -= b 
length = bounds.index(b) + 1
s = ''
for i in range(length - 1, 0, -1):
    idx, N = divmod(N, 26**i)
    s = s + lis[idx]
print(s + lis[N])

Buggy submission (verdict: Runtime Error):
bounds = [sum([26 ** i for i in range(n)]) for n in range(1, 11)]
N = int(input())
for b in reversed(bounds):
    if b <= N:
        break
N -= b 
length = bounds.index(b) + 1
s = ''
for i in range(length - 1, 0, -1):
    idx, N = divmod(N, 26**i)
    s = s + lis[idx]
print(s + lis[N])
Problem p02793 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
from fractions import gcd
from functools import reduce


MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    common_multi = reduce(lambda x, y: x * y // gcd(x, y), A)
    print(sum(map(lambda x: common_multi // x, A)) % MOD)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from math import gcd
from functools import reduce


MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    common_multi = reduce(lambda x, y: x * y // gcd(x, y), A)
    print(sum(map(lambda x: common_multi // x, A)) % MOD)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

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

Fixed submission:
from math import factorial as fact
N, K = map(int, input().split())
def cnt_pairs(num1, num2):
    return fact(num1 + num2) // (fact(num1) * fact(num2))

for i in range(1, K + 1):
    if (i - 1 >=  0) and (K - i >= 0) and (N - K - i + 1 >= 0):
        blue_pairs = cnt_pairs(K - i, i - 1)
        print(cnt_pairs(N - K - i + 1, i) * blue_pairs % 1000000007)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from math import factorial as fact
N, K = map(int, input().split())
def cnt_pairs(num1, num2):
    return fact(num1 + num2) // (fact(num1) * fact(num2))

for i in range(1, K + 1):
    blue_pairs = cnt_pairs(K - i, i - 1)
    print(cnt_pairs(N - K - i + 1, i) * blue_pairs % 1000000007)
Problem p03072 (python)

Fixed submission:
input()
lis = list(map(int, input().split()))
print(len([n for i, n in enumerate(lis[1:]) if n >= max(lis[:i + 1])]) + 1)

Buggy submission (verdict: Runtime Error):
input()
lis = list(map(int, input().split()))
print(len([n for i, n in enumerate(lis[1:]) if n >= max(lis[:i + 1])]) + 1