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

Fixed submission:
N, K = map(int, input().split())
AB = []
for _ in range(N):
    AB.append(input())
count = 0
for string in sorted(AB, key = lambda x: int(x.split()[0])):
    a = int(string.split()[0])
    b = int(string.split()[1])
    count += b
    if count >= K:
        print(a)
        break

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
lis = [10**5]*K
for _ in range(N):
    a, b = map(int, input().split())
    if a < lis[K-1]:
        for index, num in enumerate(lis):
            if num > a:
                if index + b < K:
                    lis = lis[:index] + [a for _ in range(b)] + lis[index:K-b]
                else:
                    lis = lis[:index] + [a for _ in range(K-index)]
                break
print(lis[K-1])
Problem p02787 (python)

Fixed submission:
H, N = map(int, input().split())
damage = []
mp = []
 
for i in range(N):
    a, b = map(int, input().split())
    damage.append(a)
    mp.append(b)
 
dp = [[0]+[float("inf")]*H for _ in range(N + 1)]

for i in range(N):
    for j in range(H + 1):
        if j - damage[i] >= 0:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - damage[i]] + mp[i])
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i + 1][0] + mp[i])

print(dp[N][H])

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
damage = []
mp = []

for i in range(N):
    a, b = map(int, input().split())
    damage.append(a)
    mp.append(b)

dp = [[0]+[float("inf")]*H for _ in range(N + 1)]

for j in range(1, H + 1):
    if j % damage[0] == 0:
        x = j // damage[0]
    else:
        x = j // damage[0] + 1 
    dp[1][j] = x * mp[0]

for i in range(1, N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i][j - damage[i]] + mp[i])

for i, row in enumerate(dp):
    if i == 0:
        continue
    buf = float("inf")
    for j in range(H + 1):
        if row[H - j] > buf:
            row[H - j] = buf
        buf = row[H - j]

print(dp[N][H])

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
damage = []
mp = []

for i in range(N):
    a, b = map(int, input().split())
    damage.append(a)
    mp.append(b)

dp = [[0]+[float("inf")]*H for _ in range(N + 1)]

for j in range(1, H + 1):
    if j % damage[0] == 0:
        x = j // damage[0]
    else:
        x = j // damage[0] + 1 
    dp[1][j] = x * mp[0]

for i in range(1, N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - damage[i]] + mp[i])

for i, row in enumerate(dp):
    if i == 0:
        continue
    buf = float("inf")
    for j in range(H + 1):
        if row[H - j] > buf:
            row[H - j] = buf
        buf = row[H - j]

print(dp[N][H])

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
damage = []
mp = []

for i in range(N):
    a, b = map(int, input().split())
    damage.append(a)
    mp.append(b)

dp = [[0]+[float("inf")]*H for _ in range(N + 1)]

for j in range(1, H + 1):
    if j % damage[0] == 0:
        x = j // damage[0]
    else:
        x = j // damage[0] + 1 
    dp[1][j] = x * mp[0]

for i in range(1, N):
    for j in range(H + 1):
        dp[i + 1][j] = min(dp[i][j], dp[i + 1][j - damage[i]] + mp[i])
    
print(dp[N][H])
Problem p02803 (python)

Fixed submission:
from collections import deque

def bfs(h, w):
    q = deque([[h, w]])
    dist[h][w] = 0

    while len(q) != 0:
        y, x = q.popleft()

        for step in steps:
            nx = x + step[0]
            ny = y + step[1]
            if nx < 0 or nx >= W or ny < 0 or ny >= H:
                continue
            if maze[ny][nx] == "#":
                continue
            if dist[ny][nx] != -1:
                continue
            dist[ny][nx] = dist[y][x] + 1
            q.append([ny, nx])


H, W = map(int, input().split())
maze = [[s for s in input()] for _ in range(H)]

steps = [[1, 0], [0, 1], [-1, 0], [0, -1]]
max_dist = [[0]*W for _ in range(H)]

for h in range(H):
    for w in range(W):
        if maze[h][w] == "#":
            continue
        dist = [[-1]*W for _ in range(H)]
        bfs(h, w)
        for row in dist:
            for d in row:
                max_dist[h][w] = max(max_dist[h][w], d)

ans = 0
for row in max_dist:
    for d in row:
        ans = max(ans, d)

print(ans)

Buggy submission (verdict: Runtime Error):
def dfs(y, x, y0, x0, d=0):
    if y < 0 or y >= H or x < 0 or x >= W:
        return

    if seen[y][x]:
        return

    seen[y][x] = True

    if maze[y][x] == "#":
        return

    if d > dist[y0][x0]:
        dist[y0][x0] = d

    dfs(y, x+1, y0, x0, d+1)
    dfs(y+1, x, y0, x0, d+1)
    dfs(y, x-1, y0, x0, d+1)
    dfs(y-1, x, y0, x0, d+1)


dist = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        seen = [[False] * W for _ in range(H)]
        dfs(i, j, i, j)

ans = 0
for row in dist:
    for d in row:
        ans = max(ans, d)

print(ans)
Problem p02866 (python)

Fixed submission:
import collections
 
N = int(input())
D = list(map(int, input().split()))
 
c = collections.Counter(D)
 
if c[0] != 1:
    print(0)
elif D[0] != 0:
    print(0)
else:
    ans = 1
    buf = 1
    for i in range(max(D) + 1):
        if c[i] == 0:
            print(0)
            break
        ans *= buf ** c[i]
        buf = c[i]
    else:
        print(ans % 998244353)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
D = list(map(int, input().split()))
D_sorted = sorted(D)

count_list = collections.Counter(D)

if count_list[0] != 1:
    print(0)
else:
    prod = 1
    for i in range(1, D_sorted[-1] + 1):
        if count_list[i] == 0:
            print(0)
            break
        prod *= count_list[i - 1]**count_list[i]

print(prod % 998244353)
Problem p02936 (python)

Fixed submission:
N, Q = map(int, input().split())
graph = [[] for i in range(N)]

for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1

    ans[p] += x

seen = [False for i in range(N)]

stack = [0]

# dfs
while stack != []:
    v = stack.pop()
    seen[v] = True

    for i in graph[v]:
        if seen[i] == True:
            continue
        ans[i] += ans[v]
        stack.append(i)

print(*ans)

Buggy submission (verdict: Runtime Error):
import copy

N, Q = map(int, input().split())
graph = [[] for i in range(N)]

def dfs(v, d, p_list=[0]):
    seen[v] = True
    depth[v] = d
    parents_list[v] = copy.copy(p_list)
    for i in graph[v]:
        if seen[i] == True:
            continue
        p_list.append(i)
        dfs(i, d+1, p_list)
        p_list.pop()

for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

seen = [False for i in range(N)]
depth = [0 for i in range(N)]
parents_list = [[] for i in range(N)]
dfs(0, 0)

ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1

    for j, parent in enumerate(parents_list):
        if p in parent:
            ans[j] += x

print(*ans)
Problem p03401 (python)

Fixed submission:
N = int(input())
A = [0]

A_0 = map(int, input().split())
for i in A_0:
    A.append(i)
A.append(0)
    
sum_A = 0
for i in range(N + 1):
    sum_A += abs(A[i] - A[i + 1])

for i in range(1, N + 1):
    if (A[i+1] - A[i]) * (A[i] - A[i-1]) >= 0:
        print(sum_A)
    else:
        print(sum_A - min(abs(A[i+1] - A[i]), abs(A[i] - A[i-1])) * 2)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0, *list(map(int, input().split())), 0]

sum_A = 0
for i in range(N + 1):
    sum_A += abs(A[i] - A[i + 1])

for i in range(1, N + 1):
    if (A[i+1] - A[i]) * (A[i] - A[i-1]) >= 0:
        print(sum_A)
    else:
        print(sum_A - min(abs(A[i+1] - A[i]), abs(A[i] - A[i-1])) * 2)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0, *list(map(int, input().split())), 0]

sum_A = 0
for i in range(N + 1):
    sum_A += abs(A[i] - A[i + 1])

for i in range(1, N + 1):
    if (A[i+1] - A[i]) * (A[i] - A[i-1]) >= 0:
        print(sum_A)
    else:
        print(sum_A - min(abs(A[i+1] - A[i]), abs(A[i] - A[i-1])) * 2)
Problem p03730 (python)

Fixed submission:
a, b, c = map(int, input().split())
rest = set()
for i in range(b):
    rest.add(a * i % b)
if c in list(rest):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
rest = set()
for i in range(b):
    rest.add(a * i % b)
if c in list(set):
    print("YES")
else:
    print("NO")
Problem p03493 (python)

Fixed submission:
print(input().count('1'))

Buggy submission (verdict: Runtime Error):
print(input().count(1))
Problem p03494 (python)

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))

Buggy submission (verdict: Runtime Error):
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)
Problem p02952 (python)

Fixed submission:
N=int(input())
h=len(str(N))
if h%2==1:
  a=N-(10**(h-1))+1
  a=a+((100**((h-1)//2))-1)//11
  print(a)
elif h%2==0:
  a=((100**(h//2))-1)//11
  print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
s=list(N)
h=len(s)
if h%2==1:
  a=N-(10**(h-1))+1
  a=a+((100**((h-1)/2))-1)/11
  print(a)
elif h%2==0:
  a=((100**(h/2))-1)/11
  print(a)
Problem p02958 (python)

Fixed submission:
N=int(input())
s=list(map(int,input().split()))
t=sorted(s)
g=0
for i in range(N):
  if t[i]!=s[i]:
    g+=1
if g==2 or g==0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N=int(input())
s=list(map(int,input(),split()))
t=sorted(s)
g=0
for i in range(N):
  if t[i]!=s[i]:
    g+=1
if g==2:
  print("YES")
else:
  print("NO")
Problem p03076 (python)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
time=0
menu=[A,B,C,D,E]
count=0
order=[]
kauri=[]
for i in range(5):
  if menu[i]%10==0:
      order.append(menu[i])
      count+=1
for h in range(9):
  for g in range(5):
    if menu[g]%10==9-h:
      kauri.append(menu[g])
      order.append(menu[g]+(h+1))
if  count!=5:
  order[4]=kauri[4-count]      
print(sum(order))

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
time=0
menu=[A,B,C,D,E]
count=0
order=[]
kauri=[]
for i in range(5):
  if menu[i]%10==0:
      order.append(menu[i])
      count+=1
for h in range(9):
  for g in range(5):
    if menu[g]%10==9-h:
      kauri.append(menu[g])
      order.append(menu[g]+(h+1))
order[4]=kauri[4-count]      
print(sum(order))
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
s=[]
o=[]
for i in range(N):
  c,t=map(int,input().split())
  if t<=T:
    s.append(c)
  else:
    o.append(c)
if len(o)==N:
  print("TLE")
else:
  print(min(s))

Buggy submission (verdict: Runtime Error):
N,T=map(int,input().split())
s=[]
o=[]
for i in range(N):
  c,t=map(int,input().split())
  if t<=T:
    s.append(c)
  else:
    o.append(c)
if len(o)==N:
  print(TLE)
else:
  print(min(s))
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a*b)%2==0:
  print(Even)
else:
  print(Odd)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a*b%2==0:
  print(Even)
else:
  print(Odd)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=a*b
if c%2==1:
  print('Odd')
elif c%2==0:
  print('Even')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=a*b
if c%2==1:
  print('Odd')
elif c%2==0:
  print('Even')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a*b%2==1:
  print('Odd')
elif a*b%2==0:
  print('Even')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a*b%2==1:
  print('Odd')
elif a*b%2=0:
  print('Even')
Problem p03697 (python)

Fixed submission:
A,B=map(int,input().split())
if A+B>=10:
  print("error")
else :
  print(A+B)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input())
if A+B>=10:
  print("error")
else :
  print(A+B)
Problem p02813 (python)

Fixed submission:
from itertools import*
i = list(permutations(range(1,int(input())+1))).index
a = tuple(map(int, input().split()))
b = tuple(map(int, input().split()))
print(abs(i(a) - i(b)))

Buggy submission (verdict: Runtime Error):
from itertools import*
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
i = list(permutations(range(1,n+1))).index
print(abs(i(a) - i(b)))
Problem p02958 (python)

Fixed submission:
input()
p = list(map(int, input().split()))
a = 0
for i, p_ in enumerate(p):
  a += (p_ != (i + 1))
print('YNEOS'[a > 2 :: 2])

Buggy submission (verdict: Runtime Error):
input()
p = list(map(int, input().split()))
for i, p_ in enumerate(p):
  a += (p_ != (i + 1))
print('YNEOS'[a > 2 :: 2])
Problem p03096 (python)

Fixed submission:
n=int(input());d=[0]*200001;a=1;b=0
for i in range(n):
    c=int(input())
    if b!=c:
        a+=d[c]
        d[c]=a
    b=c
print(a%(10**9+7))

Buggy submission (verdict: Runtime Error):
n=int(input());d=[0]*20001;a=1;b=-1
for i in range(n):
    c=int(input())
    if b!=c:
        a+=d[c]
        d[c]=a
    b=c
print(a%(10**9+7))

Buggy submission (verdict: Runtime Error):
n=int(input());d=[0]*20001;a=1;b=-1
for i in range(n):
    c=int(input())
    if b!=c:
        a+=d[c]
        d[c]=a
    b=c
print(a%(10**9+9))

Buggy submission (verdict: Runtime Error):
n=int(input());d=[0]*(n+1);l=[int(input()) for i in range(n)];a=1;b=-1
for i in range(n):
    c=l[i]
    if b!=c:
        a+=d[c]
        d[c]=a
    b=c
print(a%(10**9+9))
Problem p03231 (python)

Fixed submission:
import fractions
n,m = map(int, input().split(' '))
s = input()
t = input()
g = fractions.gcd(n, m)
Flag = True
for i in range(n):
    if (m*i)%n == 0:
        if s[i] != t[int((i*m)/n)]:
            Flag = False
if Flag:
    print(int((n*m)/g))
else:
    print('-1')

Buggy submission (verdict: Runtime Error):
import math
n,m = map(int, input().split(' '))
s = input()
t = input()
g = math.gcd(n,m)
Flag = True
for i in range(n):
    if (m*i)%n == 0:
        if s[i] != t[int((i*m)/n)]:
            Flag = False
if Flag:
    print(int((n*m)/g))
else:
    print(-1)
Problem p03289 (python)

Fixed submission:
S=input()
flag=True
if S[0]=="A":
    if S[2:-1].count("C")==1:
        S=S.replace('A','').replace('C','')
        if S==S.lower():
            flag=True
        else:
            flag=False
    else:
        flag=False
else:
    flag=False
if flag:
    print('AC')
else:
    print('WA')

Buggy submission (verdict: Runtime Error):
S=input()
flag=True
if S[0]=="A":
    if S[2:-1].count("C")==1:
        S=S.replace('A','').replace('C','')
        if S==S.lower():
            flag=True
        else:
            flag=False
    else:
        flag=false
else:
    flag=False
if flag:
    print('AC')
else:
    print('WA')
Problem p03302 (python)

Fixed submission:
a, b = map(int, input().split())
if a + b == 15:
    print('+')
elif a*b == 15:
    print('*')
else:
    print('x')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input.split())
if a + b == 15:
    print('+')
elif a*b == 15:
    print('*')
else:
    print('x')

Buggy submission (verdict: Runtime Error):
s=input()
l=input()
x=''
for i in range(len(s)):
        if i%l==0:
                x+=s[i]
print(x)
Problem p04033 (python)

Fixed submission:
a, b = (int(x) for x in input().split())
if a > 0:
    print('Positive')
elif a <= 0 and b >= 0:
    print('Zero')
else:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')

Buggy submission (verdict: Runtime Error):
if a > 0:
    print('Positive')
if a <= 0 and b >= 0:
    print('Zero')
else:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
Problem p03671 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()

print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if a >= b and a >= c:
    print(b + c)
elif b >= a and b >= c:
    print(a + c)
elif c >= a and c >= b:
    print(a + b)
elif a == b == c:
    print(a + b

Buggy submission (verdict: Runtime Error):
def total_cost(num1, num2, num3):
    if num1 >= num2 and num1 >= num3:
        return num2 + num3
    elif num2 >= num1 and num2 >= num3:
        return num1 + num3
    elif num3 >= num1 and num3 >= num2:
        return num1 + num2
    elif num1 == num2 == num3:
        return num1 + num2

print(total_cost(int(input()), int(input()), int(input())))
Problem p03826 (python)

Fixed submission:
A, B, C, D = map(int,input().split())

volume1 = A * B
volume2 = C * D

if volume1 > volume2:
    print(volume1)
else:
    print(volume2)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
D = input()

volume1 = A * B
volume2 = C * D

if volume1 > volume2:
    print(volume1)
else:
    print(volume2)
Problem p03844 (python)

Fixed submission:
num1, op, num2 = input().split()

if op == "+":
    print(int(num1) + int(num2))
elif op == "-":
    print(int(num1) - int(num2))

Buggy submission (verdict: Runtime Error):
num1 = float(input())
op = input()
num2 = float(input())

if op == "+":
    print(num1 + num2)
elif op == "-":
    print(num1 - num2)
Problem p03962 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(len(set([a, b, c])))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

1 < a, b, c < 100
if a == b == c:
    print(1)
else:
    if a != b != c:
        print(3)
    else:
        print(2)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print(int((a + b) * h / 2))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print(int((a + b) * h / 2))

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())
print((a + b) * h // 2)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())

print((a + b) * h / 2)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int, input().split())

print((a + b) * h / 2)
Problem p03210 (python)

Fixed submission:
d = int(input())
if d == 3 or d== 5 or d==7:
 print("YES")
else:
 print("NO")

Buggy submission (verdict: Runtime Error):
d = int(input())
if d == 3 or d== 5 or d==7:
	print("YES")
else
	print("NO")
Problem p02780 (python)

Fixed submission:
N, K = map(int, input().split())
pi = list(map(int, input().split()))

tmp = sum(pi[0 : K])
max = tmp

if N == K:
    print((max + K) / 2)
else:
    for i in range(N - K):
        tmp = tmp - pi[i] + pi[i + K]
        if tmp > max:
            max = tmp
    print((max + K) / 2)

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

max = 0
maxi = 0
for i in range(N - K):
    tmp = sum(pi[i : i + K - 1])
    if tmp > max:
        max = tmp
        maxi = i

out = 0
for j in range(K)
    exp = (pi[j + maxi] + 1) / 2
    out = out + exp

print(out)

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

max = 0
maxi = 0
for i range(N - K):
    sum = pi(i) + pi(i + 1) + pi(i + 2)
    if sum >= max:
        max = sum
        maxi = i

out = 1 + (pi(maxi) - 1) * 0.5 + 1 + (pi(maxi + 1) - 1) * 0.5 + 1 + (pi(maxi + 2) - 1) * 0.5
print(out)

Buggy submission (verdict: Runtime Error):
N, K = map(int(input().split()))
pi = list(map(int(x) for x in input().split()))

max = 0
maxi = 0
i = 0
for j range(N - K):
    sum = pi(j) + pi(j + 1) + pi(j + 2)
    if sum >= max:
        max = sum
        maxi = j

out = 1 + (pi(i) - 1) * 0.5 + 1 + (pi(i + 1) - 1) * 0.5 + 1 + (pi(i + 2) - 1) * 0.5
print(out)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
pi = list(int(x) for x in input().split())

max = 0
maxi = 0
for i range(N - K):
    sum = pi(i) + pi(i + 1) + pi(i + 2)
    if sum >= max:
        max = sum
        maxi = i

out = 1 + (pi(i) - 1) * 0.5 + 1 + (pi(i + 1) - 1) * 0.5 + 1 + (pi(i + 2) - 1) * 0.5
print(out)
Problem p03588 (python)

Fixed submission:
#!user/bin/env python
# coding:utf-8

n = int(input())
info = []

for i in range(n):
    # ai = int(input())
    # bi = int(input())
    abi = input()
    ai, bi = int(abi.split(' ')[0]), int(abi.split(' ')[1])
    
    info.append([ai, bi])

info = sorted(info, key=lambda inf: inf[1])

imp = info[0][0] + info[0][1]
print(imp)

Buggy submission (verdict: Runtime Error):
#!user/bin/env python
# coding:utf-8

n = int(input())
info = []

for i in range(n):
    ai = int(input())
    bi = int(input())
    info.append([ai, bi])

info = sorted(info, key=lambda inf: inf[1])

imp = info[0][0] + info[0][1]
print(imp)
Problem p02900 (python)

Fixed submission:
import math
 
def gcd(x, y):
	while y != 0:
		z = x % y
		x = y
		y = z
	return x
 
a, b = map(int, input().split())
x    = gcd(a, b)
y    = int(math.sqrt(x))
c    = 1

for i in range(2, y + 1):
	if y < i:
		break;
	if x % i == 0:
		c += 1
		while x % i == 0:
			x //= i
			
if 1 < x:
	c += 1

print(c)

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
x    = math.gcd(a, b)
y    = int(math.sqrt(x))
ps   = [1, 2, 3, 5, 7, 11, 13]
p    = ps[-1]

def check(p):
	q = int(math.sqrt(p))
	
	for i in range(2, len(ps)):
		if p % ps[i] == 0:
			return False
		if q < ps[i]:
			break
	
	return True

while p <= y:
	p += 2
	while check(p) == False:
		p += 2
	ps.append(p)

print(sum(1 for p in ps if x % p == 0))
Problem p02936 (python)

Fixed submission:
n, q = [int(x) for x in input().split()]
vs   = []
	
for _ in range(0, n + 1):
	vs.append([])
	
xs    = [0]     * (n + 1)
fs    = [False] * (n + 1)
us    = [0]     * n
fs[1] = True
us[0] = 1
ui    = 0

for _ in range(0, n - 1):
	a, b = [int(x) for x in input().split()]
	vs[a].append(b)
	vs[b].append(a)

for _ in range(0, q):
	p, x   = [int(x) for x in input().split()]
	xs[p] += x
	
for i in range(0, n):
	x = xs[us[i]]
	for v in vs[us[i]]:
		if fs[v] == False:
			xs[v] += x
			ui    += 1
			us[ui] = v
			fs[v]  = True

print(" ".join(str(x) for x in xs[1:]))

Buggy submission (verdict: Runtime Error):
n, q = [int(x) for x in input().split()]
vs   = []
xs   = []
	
for _ in range(0, n + 1):
	vs.append([])
	xs.append(0)

for _ in range(0, n - 1):
	a, b = [int(x) for x in input().split()]
	vs[a].append(b)

for _ in range(0, q):
	p, x   = [int(x) for x in input().split()]
	xs[p] += x
	
def calc(v, x, vs, xs):
	xs[v] += x
	for u in vs[v]:
		calc(u, xs[v], vs, xs)

calc(1, 0, vs, xs)

print(" ".join(str(x) for x in xs[1:]))

Buggy submission (verdict: Runtime Error):
n, q = [int(x) for x in input().split()]
ns   = []
vs   = []
ps   = []
xs   = []
	
for _ in range(0, n + 1):
	ns.append([])
	vs.append(0)

for _ in range(0, n - 1):
	a, b = [int(x) for x in input().split()]
	ns[a].append(b)
	
def calc(i, x, ns, vs):
	vs[i] += x
	for v in ns[i]:
		calc(v, x, ns, vs)

for _ in range(0, q):
	p, x = [int(x) for x in input().split()]
	calc(p, x, ns, vs)

print(" ".join(str(x) for x in vs[1:]))
Problem p03281 (python)

Fixed submission:
n = int(input())
c = 0

for x in range(1, n + 1, 2):
    if sum(1 for y in range(1, x // 2) if x % y == 0) == 7:
        c += 1

print(c)

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

for x in range(2, n // 2 + 1)
  if n % x == 0:
    c += 1

print(c)
Problem p03220 (python)

Fixed submission:
N = int(input())
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))

res, height = 0, 100001
for i in range(N) :
    tmp = T - H[i] * 0.006
    if height > abs(A - tmp) :
        height = abs(A - tmp)
        res = i + 1

print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

res, height = 0, 100001
for i in range(N) :
    if height > abs(A - tmp) :
        height = abs(A - tmp)
        res = i + 1

print(res)