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

Fixed submission:
b = input()
if b.isupper() == True:
    print('A')
else:
    print('a')

Buggy submission (verdict: Runtime Error):
a = input()
if a.ispper() == True:
    print('A')
else:
    print('a')
Problem p02725 (python)

Fixed submission:
K, N = map(int,input().split())
A = list(map(int,input().split()))
x = []

for i in range(N - 1):
    x.append(A[i + 1] - A[i])
x.append(A[0] + K - A[N - 1])
x = sorted(x)
del x[N - 1]
print(sum(x))

Buggy submission (verdict: Runtime Error):
N = int(input())
x = 0
a = []
for i in range(2,N,2):
    while i % 2 == 0:
        i //= 2
        x += 1
    a.append(x)
    x = 0
a = sorted(a)
a = a[::-1]
print(a[0])
Problem p02754 (python)

Fixed submission:
N, A, B = map(int,input().split())
x = N // (A + B)
y = N % (A + B)
ans = x * A + min(y,A)
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,input().split())
ans = 0
x = 0
y = 0
Ball1 = ['b']
Ball2 = ['r']
Ball = Ball1 * A + Ball2 * B
while x < N :
    x = x + A + B
    y += 1
Ball = Ball * y
Ball = Ball[0:N]
ans = Ball.count('b')
print(ans)

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

balls_list = []
while len(balls_list) <= n:
    balls_list.append(['r'] * a)
    balls_list.append(['b'] * b)

new_list = balls_list[ :n]

from collections import Counter

count = Counter(new_list)

x = count['b']

print(x)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
if a < 3200:
    print('red')

Buggy submission (verdict: Runtime Error):
a = int(input())
s = int(input())
if a >= 3200:
    print('s')
if a < 3200:
    print('red')
Problem p02580 (python)

Fixed submission:
H, W, M = map(int, input().split())
bombs = {}
rows = []
cols = []
for i in range(H):
    rows.append([i, 0])
for i in range(W):
    cols.append([i, 0])
for i in range(M):
    y, x = map(lambda x: x - 1, map(int, input().split()))
    bombs[(y,x)] = True
    rows[y][1] += 1
    cols[x][1] += 1


rows = sorted(rows, key=lambda x: x[1], reverse=True)
cols = sorted(cols, key=lambda x: x[1], reverse=True)
answer = 0
for row in rows:
    a = cols[0][1] + row[1] - (1 if (row[0], cols[0][0]) in bombs else 0)
    if a > answer:
        answer = a
for col in cols:
    a = rows[0][1] + col[1] - (1 if (rows[0][0], col[0]) in bombs else 0)
    if a > answer:
        answer = a
print(answer)

Buggy submission (verdict: Runtime Error):
H, W, M = map(int, input().split())
bombs = []
for i in range(H):
    bombs.append([False] * W)
rows = []
for i in range(H):
    rows.append([i, 0])
cols = []
for i in range(W):
    cols.append([i, 0])
for i in range(M):
    y, x = map(lambda x: x - 1, map(int, input().split()))
    bombs[y][x] = True
    rows[y][1] += 1
    cols[x][1] += 1


rows = sorted(rows, key=lambda x: x[1], reverse=True)
cols = sorted(cols, key=lambda x: x[1], reverse=True)
answer = 0
for row in rows:
    a = cols[0][1] + row[1] - (1 if bombs[row[0]][cols[0][0]] else 0)
    if a > answer:
        answer = a
for col in cols:
    a = rows[0][1] + col[1] - (1 if bombs[rows[0][0]][col[0]] else 0)
    if a > answer:
        answer = a
print(answer)
Problem p02762 (python)

Fixed submission:
N, M, K = map(int, input().split())
friend = {}
for i in range(M):
    A, B = map(lambda x: x-1, map(int, input().split()))
    if A not in friend:
        friend[A] = []
    if B not in friend:
        friend[B] = []
    friend[A].append(B)
    friend[B].append(A)

block = {}
for i in range(K):
    C, D = map(lambda x: x-1, map(int, input().split()))
    if C not in block:
        block[C] = []
    if D not in block:
        block[D] = []
    block[C].append(D)
    block[D].append(C)

first = {}
for i in range(N):
    if i not in first:
        first[i] = i
        if i in friend:
            queue = []
            queue.extend(friend[i])
            counter = 0
            while counter < len(queue):
                item = queue[counter]
                first[item] = i
                if item in friend:
                    for n in friend[item]:
                        if n not in first:
                            queue.append(n)
                counter += 1

size = {}
for key in first:
    if first[key] not in size:
        size[first[key]] = 1
    else:
        size[first[key]] += 1

for i in range(N):
    if i not in friend:
        print(0)
        continue
    no_friend = 0
    if i in block:
        for b in block[i]:
            if first[b] == first[i]:
                no_friend += 1
    print(size[first[i]] - len(friend[i]) - no_friend - 1)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
friend = {}
for i in range(M):
    A, B = map(lambda x: x-1, map(int, input().split()))
    if A not in friend:
        friend[A] = []
    if B not in friend:
        friend[B] = []
    friend[A].append(B)
    friend[B].append(A)

block = {}
for i in range(K):
    C, D = map(lambda x: x-1, map(int, input().split()))
    if C not in block:
        block[C] = []
    if D not in block:
        block[D] = []
    block[C].append(D)
    block[D].append(C)

first = {}
for i in range(N):
    if i not in first:
        first[i] = i
        queue = []
        queue.extend(friend[i])
        counter = 0
        while counter < len(queue):
            item = queue[counter]
            first[item] = i
            for n in friend[item]:
                if n not in first:
                    queue.append(n)
            counter += 1

size = {}
for key in first:
    if first[key] not in size:
        size[first[key]] = 1
    else:
        size[first[key]] += 1

for i in range(N):
    if i not in friend:
        print(0)
        continue
    no_friend = 0
    if i in block:
        for b in block[i]:
            if first[b] == first[i]:
                no_friend += 1
    print(size[first[i]] - len(friend[i]) - no_friend - 1)
Problem p03013 (python)

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

memo = {
    0: 1
}
queue = [0]
counter = 0
def step(height, n):
    if height + n not in memo:
        memo[height + n] = memo[height]
        queue.append(height + n)
    else:
        memo[height + n] += memo[height]


while counter < len(queue):
    # print(memo, queue, counter)
    item = queue[counter]
    counter += 1
    if item + 1 not in a and item + 1 <= N:
        step(item, 1)
    if item + 2 not in a and item + 2 <= N:
        step(item, 2)

if N not in memo:
    print(0)
else:
    print(memo[N] % 1000000007)

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

memo = {}
def dfs(height):
    if height in memo:
        return memo[height]
    if height == N:
        memo[height] = 1
        return 1
    elif height > N:
        return 0
    if height in a:
        memo[height] = 0
        return 0
    step1 = dfs(height + 1)
    step2 = dfs(height + 2)
    if step1 == 0 and step2 == 0:
        memo[height] = 0
        return 0
    else:
        memo[height] = step1 + step2
        return step1 + step2
        
print(dfs(0) % 1000000007)
Problem p03041 (python)

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

S = S[:K-1] + S[K-1].lower() + S[K:]

print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
graph = {}
root = -1
for n in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1

    if root == -1:
        root = u
    if u not in graph:
        graph[u] = {}
    if v not in graph:
        graph[v] = {}
    graph[u][v] = w
    graph[v][u] = w    

answer = [-1] * N
def search(node, depth):
    answer[node] = depth
    for n in graph[node]:
        if answer[n] == -1:
            search(n,depth + graph[node][n])
if N == 1:
    print('0')
else:
    search(root, 0)
    for a in answer:
        print('0' if a % 2 else '1')
Problem p03104 (python)

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

# 2進数のn桁目の0からxまでの和が偶数か奇数かを返す
def even_odd(x, n):
    if n == 1:
        if x % 4 == 1 or x % 4 == 2:
            return 1
        else:
            return 0

    num = (x % (2 ** n)) - 2 ** (n - 1)
    if num < 0:
        return 0
    elif num % 2 == 0:
        return 1
    else:
        return 0

# 10 ** 12 => 2 ** 40
s = 0
for i in range(1, 41):
    if (even_odd(B, i) + even_odd(A-1, i)) % 2 == 1:
        s += 2 ** (i - 1)
print(s)

Buggy submission (verdict: Runtime Error):
123456789012 123456789012
Problem p02754 (python)

Fixed submission:
n, a, b = [int(i) for i in input().split()]
ans = (n // (a + b)) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = []
    for i in range(x):
        balls += list("b" * a) + list("r" * b)
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = []
    for i in range(x):
        balls += list("b" * a) + list("r" * b)
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = [*["b"] * a, *["r"] * b] * x
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = [*["b"] * a, *["r"] * b] * x
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
if a == 0:
    print(0)
else:
    x = (n // (a + b)) + 1
    balls = [*["b"] * a, *["r"] * b] * x
    ans = 0
    for i in range(n):
        if balls[i] == "b":
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(i) for i in input().split()]
x = (n // (a + b)) + 1
balls = [*["b"] * a, *["r"] * b] * x
ans = 0
for i in range(n):
    if balls[i] == "b":
        ans += 1
print(ans)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
if N % 2 != 0:
    print("No")
else:
    arr = list(S)
    s_len = len(arr) // 2
    if arr[s_len:] == arr[:s_len]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = int(input())
if N % 2 != 0:
    print("No")
else:
    arr = list(S)
    s_len = len(arr) // 2
    if arr[s_len:] == arr[:s_len]:
        print("Yes")
    else:
        print("No")
Problem p02881 (python)

Fixed submission:
from math import sqrt

N = int(input())

for i in range(int(sqrt(N) + 1), -1, -1):
    if N % i == 0:
        print((i - 1) + (N // i - 1))
        break

Buggy submission (verdict: Runtime Error):
N = int(input())
ret = []
for i in range(1, N):
    for j in range(i, N):
        if i * j == N:
            ret.append(i + j - 2)
print(min(ret))
Problem p02897 (python)

Fixed submission:
N = int(input())
odds = list(filter(lambda x: x % 2 != 0, range(1, N + 1)))
print("{:.10f}".format(len(odds) / float(N)))

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = filter(lambda x: x % 2 != 0, range(1, N + 1))
print(len(nums) / float(N))
Problem p02970 (python)

Fixed submission:
import math

N, D = [int(i) for i in input().split()]
print(math.ceil(N / ((2 * D) + 1)))

Buggy submission (verdict: Runtime Error):
import math
N, D = [int(i) for i in input().split()]
print(math.ceil(N / ((2 * D) + 1)
Problem p03127 (python)

Fixed submission:
def gcd(x, y):
    if y > x:
        x, y = y, x
    while y != 0:
        x, y = y, x % y
    return x


N = int(input())
A = [int(i) for i in input().split()]
ans = A[N - 1]
for i in range(N - 1):
    ans = gcd(ans, A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = [int(i) for i in input().split()]
ans = A[N - 1]
for i in range(N - 1):
    ans = math.gcd(ans, A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = [int(i) for i in input().split()]
ans = A[0]
for i in range(1, N):
    ans = math.gcd(ans, A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = [int(i) for i in input().split()]
ans = A[0]
for i in range(1, N):
    ans = math.gcd(ans, A[i])
print(ans)
Problem p03767 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
ret = 0
for n in range(N, N*3, 2):
    ret += A[n]
print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(sorted(list(map(int, input().split()))))
# N = 2
# A = list(sorted([5,2,8,5,1,5]))
group = []
ret = 0
for a in A:
    print(A)
    group.append([A.pop(0), A.pop(), A.pop()])
for g in group:
    ret += list(sorted(g))[1]
print(ret)
Problem p03785 (python)

Fixed submission:
N, C, K = [int(i) for i in input().split()]
T = sorted([int(input()) for i in range(N)])
ans = 1
limit = 0
ti = T[0]
for i in range(N - 1):
    limit += 1
    if ti + K < T[i + 1] or limit == C:
        ti = T[i + 1]
        ans += 1
        limit = 0
print(ans)

Buggy submission (verdict: Runtime Error):
N, C, K = [int(i) for i in input().split()]
T = sorted([int(input())] for i in range(N))
ans = 1
limit = 0
ti = T[0]
for i in range(N - 1):
    limit += 1
    if ti + K < T[i + 1] or limit == C:
        ti = T[i + 1]
        ans += 1
        limit = 0
print(ans)

Buggy submission (verdict: Runtime Error):
N, C, K = [int(i) for i in input().split()]
T = list(sorted([int(i) for i in input().split()]))
ans = 1
limit = 0
ti = T[0]
for i in range(N - 1):
    limit += 1
    if ti + K < T[i + 1] or limit == C:
        ti = T[i + 1]
        ans += 1
        limit = 0
print(ans)

Buggy submission (verdict: Runtime Error):
N, C, K = [int(i) for i in input().split()]
T = list(sorted([int(i) for i in input().split()]))
ans = 1
limit = 0
ti = T[0]
for i in range(N - 1):
    limit += 1
    if ti + K < T[i + 1] or limit == C:
        ti = T[i + 1]
        ans += 1
        limit = 0
print(ans)
Problem p02633 (python)

Fixed submission:
import math

x=int(input())
print(360//math.gcd(x,360))

Buggy submission (verdict: Runtime Error):
x=r()
print(360/x)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
a.append(a[i] + A[i])
for i in range(M):
b.append(b[i] + B[i])
ans, j = 0, M
for i in range(N + 1):
if a[i] > K:
break
while b[j] > K - a[i]:
j -= 1
ans = max(ans, i + j)
print(ans)
Problem p02570 (python)

Fixed submission:
D, T, S = map(int, input().split())
if D/S <= T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
D, T, S = map(int. input().split())
if D/S <= T:
  print("Yes")
else:
  print("No")
Problem p02577 (python)

Fixed submission:
N = input()
S = 0
for i in N:
  S+=int(i)

if S%9 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = input()
S = 0
for i in N:
  S+=int(i)

if i%9 == 0:
  print("Yes")
else:
  print("No")
Problem p02594 (python)

Fixed submission:
if int(input()) >= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if int(input()) >= 30:
  print("Yes")
lese:
  print("No")
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[0:K]+"...")

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[0:K+"..."])
Problem p02785 (python)

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

H.sort(reverse=True)
print(sum(H[K:]))

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

for i in range(K):
	H.remove(max(H))
    
print(sum(H))
Problem p02836 (python)

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

Buggy submission (verdict: Runtime Error):
S = input()
count = 0
for i in range(int(len(S)/2)):
  if S[i] != S[len(S)-i]:
    count += 1
print(count)
Problem p02933 (python)

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

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

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

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

Fixed submission:
S = input()

if (S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]) or \
(S[0]==S[2] and S[1]==S[3] and S[0]!=S[1]) or \
(S[0]==S[3] and S[1]==S[2] and S[0]!=S[2]):
  print("Yes")
else:
  print("No")

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

if
(S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]) or
(S[0]==S[2] and S[1]==S[3] and S[0]!=S[1]) or
(S[0]==S[3] and S[1]==S[2] and S[0]!=S[2]):
  print("Yes")
else:
  print("No")
Problem p03011 (python)

Fixed submission:
P, Q, R = map(int, input().split())
print(min(P+Q, Q+R, R+P))

Buggy submission (verdict: Runtime Error):
P, Q, R = map(int, input().split())
print(min(P+Q, Q+R, R+A))

Buggy submission (verdict: Runtime Error):
P, Q, R = map(int, input()split())
print(min(P+Q, Q+R, R+A))
Problem p03013 (python)

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

#import math
def fibonacci(n):
    #a = 1/math.sqrt(5) * (((1+math.sqrt(5))/2)**n - ((1-math.sqrt(5))/2)**n)
    if n <= 0:
        a = 0
    elif n<=2:
        a =1
    else:
        a0=1
        a1=1
        for i in range(3,n+1):
            a = a0 + a1
            a0 = a1
            a1 = a
    return(int(a))

ans = 1
t1 = 0
a_ind = 0
for i in range(N+1):
    if i == A[a_ind] or i == N:
        t2 = A[a_ind]
        ans *= fibonacci(t2-t1)
        t1 = A[a_ind]+1
        a_ind =min(a_ind+1, len(A)-1)
print(ans%1000000007)

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

import math
def fibonacci(n):
    a = 1/math.sqrt(5) * (((1+math.sqrt(5))/2)**n - ((1-math.sqrt(5))/2)**n)
    return(int(a))

ans = 1
t1 = 0
a_ind = 0
for i in range(N+1):
    if i == A[a_ind] or i == N:
        t2 = A[a_ind]
        ans *= fibonacci(t2-t1)
        t1 = A[a_ind]+1
        a_ind =min(a_ind+1, len(A)-1)
print(ans%1000000007)
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
X_subtraction = []
for i in range(len(X)-1):
    X_subtraction.append(X[i+1] - X[i])

X_subtraction.sort(reverse=True)
del X_subtraction[0:N-1]

print(sum(X_subtraction))

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

X.sort()
X_subtraction = []
for i in range(len(X)-1):
    X_subtraction.append(X[i+1] - X[i])

if X_subtraction != []:
    for _ in range(N-1):
        X_subtraction.remove(max(X_subtraction))

print(sum(X_subtraction))
Problem p03208 (python)

Fixed submission:
N, K = map(int, input().split())
h = []
[h.append(int(input())) for i in range(N)]

h.sort()
l = []
for i in range(N-K+1):
    l.append(h[i+K-1] - h[i])
print(min(l))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = []
[h.append(int(input())) for i in range(N)]

l = []
for i in range(N):
    a = []
    for j in range(N):
        if i != j and h[i]-h[j]>=0:
            a.append(h[i]-h[j])
    if len(a) >= K-1:
        l.append(a)

l2 = []
for i in range(len(l)):
    a = min(l[i])
    l[i].remove(a)
    l2.append(min(l[i]))
print(min(l2))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h_in = []
[h_in.append(int(input())) for i in range(N)]

l = []
for i in range(N):
    a = []
    for j in range(N):
        if i != j and h[i]-h[j]>=0:
            a.append(h[i]-h[j])
    if len(a) >= K-1:
        l.append(a)

l2 = []
for i in range(len(l)):
    a = min(l[i])
    l[i].remove(a)
    l2.append(min(l[i]))
print(min(l2))
Problem p03221 (python)

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

def FillZero(num,f=6):
    s = ""
    s += (f - len(str(num))) * "0"
    s += str(num)
    return(s)

for i in range(M):
    l[i].append(i)

l = sorted(l, key = lambda x:(x[0],x[1]))

key0 = l[0][0]
key1 = 0
for i in range(M):
    if key0 == l[i][0]:
        key1 += 1
        l[i][1] = key1
    else:
        key1 = 1
        l[i][1] = key1
        key0 = l[i][0]

l = sorted(l, key = lambda x:x[2])

for i in range(M):
    print(FillZero(l[i][0]) + FillZero(l[i][1]))

Buggy submission (verdict: Runtime Error):
def FillZero(num,f=6):
    s = ""
    s += (f - len(str(num))) * "0"
    s += str(num)
    return(s)

for i in range(M):
    l[i].append(i)

l = sorted(l, key = lambda x:(x[0],x[1]))

key0 = l[0][0]
key1 = 0
for i in range(M):
    if key0 == l[i][0]:
        key1 += 1
        l[i][1] = key1
    else:
        key1 = 1
        l[i][1] = key1
        key0 += 1

l = sorted(l, key = lambda x:x[2])

for i in range(M):
    print(FillZero(l[i][0]) + FillZero(l[i][1]))

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

def FillZero(num,f=6):
    s = ""
    s += (f - len(str(num))) * "0"
    s += str(num)
    return(s)

for i in range(M):
    l[i].append(i)

l = sorted(l, key = lambda x:(x[0],x[1]))

key0 = l[0][0]
key1 = 0
for i in range(M):
    if key0 == l[i][0]:
      	key1 += 1
        l[i][1] = key1
    else:
        key1 = 1
        l[i][1] = key1
        key0 += 1

l = sorted(l, key = lambda x:x[2])

for i in range(M):
    print(FillZero(l[i][0]) + FillZero(l[i][1]))
Problem p03265 (python)

Fixed submission:
x1, y1, x2, y2 = map(int, input().split())
print(x2-y2+y1, y2+x2-x1, x1+y1-y2, y1-x1+x2)

Buggy submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
import math
d12 = math.sqrt((x1-x2)**2 + (y1-y2)**2)
  
for x in range(-100, x1):
  for y in range(-100, 100):
    d14 = math.sqrt((x1-x)**2 + (y1-y)**2)
    if d12 == d14:
      y4 = y
      break
  if d12 == d14:
    x4 = x
    break
      
for x in range(-100, x2):
  for y in range(-100, 100):
    d23 = math.sqrt((x2-x)**2 + (y2-y)**2)
    if d12 == d23:
      y3 = y
      break
  if d12 == d23:
    x3 = x
    break

print(x3, y3, x4, y4)
Problem p03272 (python)

Fixed submission:
N, i = map(int, input().split())
print(N-i+1)

Buggy submission (verdict: Runtime Error):
N, i = int(input().split())
print(N-i+1)
Problem p02693 (python)

Fixed submission:
k = int(input())
a,b = [int(x) for x in input().split()]
ans = "NG"
for i in range(1000):
  if a <= i * k and i * k <= b:
    ans = "OK"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input)
a,b = [int(x) for x in input().split()]
ans = "NG"
for i in range(1000):
  if a <= i * k and i * k <= b:
    ans = "OK"
    break
print(ans)
Problem p02707 (python)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = [0] * n
for i in range(n-1):
  ans[a[i]-1] += 1
for i in range(n):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]
ans = [0] * n
for i in range(n):
  ans[a[i]-1] += 1
for i in range(n):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(x) for x in input().split()]
ans = [0] * n
for i in range(n):
  ans[a[i]] += 1
for i in range(n):
  print(ans[i])