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

Fixed submission:
strS = input()
strT = input()

strS = list(strS)
strT = list(strT)

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1

print(len(strT)-maxRange)

Buggy submission (verdict: Runtime Error):
strS = input()
strT = input()

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m <= (len(strT)):
        if strS[l+m] != strT[m]:
            count += 1
        m += 1
    if maxRange > count:
        maxRange = count
    l += 1
print(maxRange)

Buggy submission (verdict: Runtime Error):
strS = input()
strT = input()

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m <= (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)

Buggy submission (verdict: Runtime Error):
strings = input().splitlines()

strS = list(strings[0])
strT = list(strings[1])

maxRange = 0
l = 0
while l < (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)

Buggy submission (verdict: Runtime Error):
strings = input().splitlines()

# 一致している数の最大値を取得する。
# そして、その一致している数と、Tの数を比較する。足りない文字数を補うと良い

strS = list(strings[0])
strT = list(strings[1])

maxRange = 0
l = 0
while l < (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)

Buggy submission (verdict: Runtime Error):
strings = input().splitlines()

# 一致している数の最大値を取得する。
# そして、その一致している数と、Tの数を比較する。足りない文字数を補うと良い

strS = list(strings[0])
strT = list(strings[1])

maxRange = 0
l = 0
while l < (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)
Problem p02577 (python)

Fixed submission:
n = input()
list_n = list(n)
list_n = [int(s) for s in list_n]
sum_list = 0
for i in range(len(list_n)):
    sum_list += list_n[i]
if sum_list%9 ==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = input()
list_n = list(n)
list_n = [int(s) for s in list_n]
sum_list = 0
for i in list_n:
    sum_list += list_n[i]
if sum_list%9 ==0:
    print('Yes')
else:
    print('No')
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 = [0]
b = [0]
ans = 0
max_num = 0
j = M
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])
for i in range(N+1):
    if a[i] > K:
        break
    else:
        while b[j] > K - a[i]:
            j -=1
            if j <0:
                break
    if K>= a[i] + b[j]:
        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()))
time = 0
i = 0
j = 0
count = 0
while time <= K:
    if i ==len(A) and j == len(B):
        break
    elif i >= len(A):
        for s in range(j,len(B)):
            time +=B[s]
            if time <= K:
                count +=1
    elif j >= len(B):
        for t in range(i,len(A)):
            time +=B[t]
            if time <=K:
                count += 1
    elif A[i] > B[j]:
        time += B[j]
        j += 1
        if time <= K:
            count += 1
    elif B[j]>=A[i]:
        time += A[i]
        i += 1
        if time <= K:
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
time = 0
i = 0
j = 0
count = 0
while time <= K:
    if i ==len(A) and j == len(B):
        break
    elif i >= len(A):
        for s in range(j,len(B)):
            time +=B[s]
            if time <= K:
                count +=1
    elif j >= len(B):
        for t in range(i,len(A)):
            time +=B[t]
            if time <=K:
                count += 1
    elif A[i] > B[j]:
        time += B[j]
        j += 1
        if time <= K:
            count += 1
    elif B[j]>=A[i]:
        time += A[i]
        i += 1
        if time <= K:
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
if len(A)>len(B):
    A += [0]*(len(A)-len(B))
elif len(B)>len(A):
    B += [0]*(len(B)-len(A))
print(A)
print(B)
time = 0
count = 0
i = 0
j = 0
goukei = 0
while time <= K:
    if A[i]>=B[j]:
        time += B[j]
        if time <= K:
            j +=1
            count += 1
    elif A[i] < B[j]:
        time += A[i]
        if time <= K:
            i += 1
            count +=1
print(count)

Buggy submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
time = 0
count = 0
i = 0
j = 0
while time <= K:
    if A[i]>=B[j]:
        time += B[j]
        if time <= K:
            j +=1
            count +=1
    elif A[i] < B[j]:
        time += A[i]
        if time <= K:
            i +=1
            count +=1
print(count)
Problem p02624 (python)

Fixed submission:
N = int(input())
count = 0
for i in range(1,N+1):
    t = N//i
    count += i * t*(t+1)/2
print(int(count))

Buggy submission (verdict: Runtime Error):
import sympy
f = 0
N = int(input())
for i in range(N+1):
    x = list(sympy.divisors(i))
    f = f + (i * len(x))
print(f)
Problem p02699 (python)

Fixed submission:
S,W = map(int,input().split())
if S<=W:
    print('unsafe')
elif S>W:
    print('safe')

Buggy submission (verdict: Runtime Error):
#(B)Battle
A,B,C,D=map(int,input().split())
while True:
    C -= B
    if C<=0:
        print('Yes')
        break
    A -= D
    if A<=0:
        print('No')
        break

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

if S<W:
    print('unsafe')
elif S>W :
    print('safe')
Problem p02572 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
s=sum(l)
su=0
for i in range(n):
	s=s-l[i]
	s=s%1000000007
	su=su+(l[i]*s)
	su=su%1000000007
print(su)

Buggy submission (verdict: Runtime Error):
#include <iostream>
using namespace std;
#define M 1000000007
int main()
{
	long long a[200000], i,n, j, s=0, su=0;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
		s=(s+a[i])%M;
	}
	for (i = 0; i < n; i++)
	{
		s -= a[i];
		s+=M;
		s%=M;
		su += (a[i] * s)%M;
		su %= M;
	}
	cout << su;
}
Problem p02723 (python)

Fixed submission:
S = input()

if S[2]==S[3] and S[4] == S[5]:
  print("Yes")
else:
  print("No")

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

if S[3]==S[4] and S[5] == S[6]:
  print("Yes")
else:
  print("No")
Problem p02753 (python)

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
readline = sys.stdin.buffer.readline
N,A,B = map(int, readline().split())
R=A*(N//(A+B))+min(A,N%(A+B))
print(R)
Problem p02570 (python)

Fixed submission:
d,t,s = map(int,input().split())

print('Yes' if d/s <= t else 'No')

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)

class UnionFind:
    def __init__(self, n):
        self.par = list(range(n)) #親
        self.rank = [0] * n #根の深さ

    # xの属する根を求める
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            # if they have the same parent, no need to union
            return
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # xとyが同じ集合に属するかを判定（同じ根に属するか）
    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.rank[self.find(x)]

N, M = map(int, input().split())
uf = UnionFind(N)

for _ in range(M):
    a, b = map(int, input().split())
    uf.unite(a-1, b-1)

cnt = [0] *n
for i in range(N):
    cnt[uf.par[i]] += 1
print(max(cnt))
Problem p02623 (python)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
aindex=n
bindex=m
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break

j= bindex
for i in range(aindex+1):
  if acumsum[i] >k:
    break
  while bcumsum[j] > k-acumsum[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()))
ans=0
aindex=n+1
bindex=m+1
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break

j= m
for i in range(n+1):
  if acumsum[i] >k:
    break
  while bcumsum[j] > k-acumsum[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()))
ans=0
aindex=n+1
bindex=m+1
acumsum = [0]
bcumsum = [0]

ab =0
for aa in range(n):
  ab += a[aa]
  acumsum.append(ab)# = ab
  if ab>k:
    aindex= aa
    break

ab =0
for bb in range(m):
  ab += b[bb]
  bcumsum.append(ab)
  if ab>k:
    bindex= bb
    break


from bisect import bisect_left
for i in range(aindex+1):
  j = bisect_left(bcumsum, k-acumsum[i])-1
  ans = max(ans, i+j)
print(ans)
Problem p02661 (python)

Fixed submission:

n=int(input())
a=[]
b=[]
for i in range(n):
    tmpa,tmpb = map(int,input().split())
    a.append(tmpa)
    b.append(tmpb)

a.sort()
b.sort()

if n%2==1:
    print(b[n//2] - a[n//2] +1)
else:
    print((b[n//2]+b[n//2-1]) - (a[n//2]+a[n//2-1]) +1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
b=[]
for i in range(n):
    tmpa,tmpb = map(int,input().split())
    a.append(tmpa)
    b.append(tmpb)

a.sort()
b.sort()

if n%2==1:
    print(b[n//2] - a[n//2] +1)
else:
    print((b[n//2+2]-b[n//2+1]) - (a[n//2+2]-a[n//2+1]) +1)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
 
for i in [1,2,3]:
  if i not in [a,b]:
    print(i)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
 
for i in [1,2,3]:
  if i not in [a,b]:
    print(j)

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

for i in [1,2,3]:
  if j not in [a,b]:
    print(j)
Problem p02862 (python)

Fixed submission:
import math

x, y = map(int,input().split())
mod = 10**9+7 #出力の制限

def cmb(n, k,MOD):
    if k > n - k:
        k = n - k
    ans = 1
    for i in range(1, k + 1):
        ans *= n + 1 - i
        ans *= pow(i, MOD - 2, MOD)
        ans %= MOD
    return ans

if (x+y)%3 != 0:
    ans = 0
else:
    m = (2*x - y) //3
    n = x - 2*m
    # print(m,n)
    if m <0 or n < 0 :
        ans = 0
    else:
        ans = cmb(n+m, m, mod)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

x, y = map(int,input())

ans = 0

xx = 1
for i in range(x):
    n = i # x：1 の数
    m = (x - i)/2 # x：2 の数
    if y- 2/n == m:
        if max(n,m) == m:
            n,m = m,n
        ans = math.factorial(n) // (math.factorial(n - m) * math.factorial(m))
        break

print(ans)
Problem p02951 (python)

Fixed submission:
# -*- coding: utf-8 -*-

a, b, c = map(int, input().split())
if b + c - a > 0:
    print(b + c - a)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
    A, B, C = map(int,input().split())
    if B+C-A < 0:
        print('0')
    else:
        print(B+C-A)
Problem p03013 (python)

Fixed submission:
n, m = map(int,input().split())
a = [int(input()) for i in range(m)]
a = set(a)
dp = [0] * (n+1)
dp[0] = 1

for i in range( 1, n+1):
    if i in a:
        dp[i]= 0
    else:
        dp[i]= (dp[i-1] + dp[i-2])

print(dp[n] % 1000000007)

Buggy submission (verdict: Runtime Error):
dp = [0] * (n+1)
dp[0] = 1

for i in range( 1, n+1):
    if i in a:
        dp[i]= 0
    else:
        dp[i]= (dp[i-1] + dp[i-2]) % 1000000007

print(dp[n])
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])
a.pop(0)
b.pop(0)
j=m-1
x=0
for i in range(n-1,-1,-1):
  if a[i]>k:
    continue
  while b[j]>k-a[i]:
    j-=1
  x=max(x,i+j+2)
print(x)

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 p02598 (python)

Fixed submission:
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    if mid == 0:
        return False
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))

Buggy submission (verdict: Runtime Error):
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9 + 1, -1))

Buggy submission (verdict: Runtime Error):
def mbisect(ok, ng):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    return ok


def check(mid):
    cnt = 0
    for i in a:
        cnt += (i + mid - 1) // mid - 1
    return cnt <= k


n, k = map(int, input().split())
a = tuple(map(int, input().split()))
print(mbisect(10 ** 9, -1))
Problem p02990 (python)

Fixed submission:
from scipy.misc import comb

n, k = map(int, input().split())
mod = 10**9+7

for i in range(1, k + 1):
    a = comb(k-1, i-1, exact=True) % mod
    b = comb(n - k + 1, i, exact=True) % mod
    print((a*b)%mod)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

n, k = map(int, input().split())
for i in range(1, k + 1):
    if i <= n - k + 1:
        a = comb(k-1, i-1, exact=True)
        b = comb(n - k + 1, i, exact=True)
        print(a*b%(10**9+7))

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n, k = map(int, input().split())
print(n - k + 1)
if n != k:
    for i in range(2, k+1):
        a = cmb(k-1, i-1)
        b = cmb(n - k + 1, i)
        print(a*b%(10**9+7))

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n, k = map(int, input().split())
print(n-k+1)
for i in range(2, k+1):
    a = cmb(k-1, i-1)
    b = cmb(n - k + 1, i)
    print(a*b%(10**9+7))
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1], reverse=True)

c = 0
for i, j in b:
    for k in range(c, i + c):
        if k == n:
            break
        if a[k] < j:
            a[k] = j
            c += 1
        else:
            break
print(sum(a))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1], reverse=True)

c = 0
for i, j in b:
    for k in range(c, i + c):
        if a[k] < j:
            a[k] = j
            c += 1
        else:
            break
print(sum(a))
Problem p03053 (python)

Fixed submission:
import numpy as np

h, w = map(int, input().split())
grid = (np.array([list(input())
                  for _ in range(h)]) == "#")
cost = np.full((h, w), 10 ** 9, dtype=np.int64)
cost[grid[:, :]] = 0

for i in range(1, h):
    cost[i] = np.minimum(cost[i], cost[i - 1] + 1)

for i in range(h - 1)[::-1]:
    cost[i] = np.minimum(cost[i], cost[i + 1] + 1)

for i in range(1, w):
    cost[:, i] = np.minimum(cost[:, i], cost[:, i - 1] + 1)

for i in range(w - 1)[::-1]:
    cost[:, i] = np.minimum(cost[:, i], cost[:, i + 1] + 1)

print(np.max(cost))

Buggy submission (verdict: Runtime Error):
import numpy as np

h, w = map(int, input().split())
grid = (np.array([list(input())
                  for _ in range(h)]) == "#")
cost = np.full((h, w), 1000, dtype=np.int64)
cost[grid[:, :]] = 0

for j in range(2):
    for i in range(h - 1):
        cost[i] = np.minimum(cost[i], cost[i + 1] + 1)
    for i in range(1, h)[::-1]:
        cost[i] = np.minimum(cost[i], cost[i - 1] + 1)
    for i in range(w - 1):
        cost[i] = np.minimum(cost[:, i], cost[:, i + 1] + 1)
    for n in range(1, w)[::-1]:
        cost[i] = np.minimum(cost[:, i], cost[:, i - 1] + 1)

print(np.max(cost))

Buggy submission (verdict: Runtime Error):
from collections import deque

h, w = map(int, input().split())

draw = ((1, 0), (-1, 0), (0, 1), (0, -1))
todo = deque([])
done = [[False for _ in range(w)] for _ in range(h)]
grid = []
for i in range(h):
    s = input()
    for j, k in enumerate(s):
        if k == "#":
            todo.append((i, j))
            done[i][j] = True
    grid.append(list(s))

cnt = -1
while todo:
    for i in range(len(todo)):
        n, m = todo.popleft()
        for dn, dm in draw:
            if not 0 <= n + dn < w or not 0 <= m + dm < h:
                pass
            elif done[n + dn][m + dm]:
                pass
            elif grid[n + dn][m + dm] == "#":
                pass
            elif grid[n + dn][m + dm] == ".":
                todo.append((n + dn, m + dm))
                done[n + dn][m + dm] = True
                grid[n + dn][m + dm] = "#"
    cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import deque

h, w = map(int, input().split())

draw = ((1, 0), (-1, 0), (0, 1), (0, -1))
todo = deque([])
done = [[False for _ in range(w)] for _ in range(h)]
grid = []
for i in range(h):
    s = input()
    for j, k in enumerate(s):
        if k == "#":
            todo.append((i, j))
            done[i][j] = True
    grid.append(list(s))

cnt = 0
while todo:
    tmp = deque([])
    while todo:
        n, m = todo.popleft()
        for dn, dm in draw:
            if not 0 <= n + dn < w or not 0 <= m + dm < h:
                pass
            elif done[n + dn][m + dm]:
                pass
            elif grid[n + dn][m + dm] == "#":
                pass
            elif grid[n + dn][m + dm] == ".":
                tmp.append((n + dn, m + dm))
                done[n + dn][m + dm] = True
                grid[n + dn][m + dm] = "#"
    todo = tmp
    cnt += 1

print(cnt - 1)
Problem p03221 (python)

Fixed submission:
n, m = map(int, input().split())
lst = [[] for _ in range(n + 1)]
py = [tuple(map(int, input().split())) for i in range(m)]

for i, (p, y) in enumerate(py):
    lst[p].append((y, i))

ans = [None] * m

for p, l in enumerate(lst):
    l.sort()
    for j, (y, i) in enumerate(l):
        ans[i] = str(p).zfill(6) + str(j + 1).zfill(6)

print(*ans, sep=('\n'))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [[] for _ in range(n + 1)]
py = [None] * m
for i in range(m):
    p, y = map(int, input().split())
    py[i] = [p, y]
    lst[p].append(y)

for i in range(m):
    lst[i] = {v: i for i, v in enumerate(sorted(lst[i]))}

for i, j in py:
    print(str(i).zfill(6) + str(lst[i][j]+1).zfill(6))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [[] for _ in range(n + 1)]
py = []
for i in range(m):
    p, y = map(int, input().split())
    py.append([p, y])
    lst[p].append(y)

for i in range(m):
    lst[i] = sorted(lst[i])

for i, j in py:
    print(str(i).zfill(6) + str(lst[i].index(j)+1).zfill(6))
Problem p03272 (python)

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

if N == 1:
    print(N)
else:
    print(N - i + 1)

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

if N = 1:
    print(N)
else:
    print(N - i + 1)
Problem p03803 (python)

Fixed submission:
a, b = map(int, input().split())
if a == 1:
    a = 14
if b == 1:
    b = 14
if a < b:
    print("Bob")
elif a > b:
    print("Alice")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a == 1:
    a = 14
if: b == 1:
    b = 14
if a < b:
    print("Bob")
elif a > b:
    print("Alice")
else:
    print("Draw")
Problem p02712 (python)

Fixed submission:
n=int(input())
s=0
s1,s2=0,0
for i in range(1,n+1):
    if i%3==0:
        s1+=i 
    elif i%5==0:
        s2+=i 
print((n*(n+1))//2-s1-s2)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
def solve(rr,gg,bb):
    d1,d2=defaultdict(list),defaultdict(list)
    for i in range(len(gg)):
        ii=gg[i]
        for j in range(len(rr)):
            jj=rr[j]
            if ii>jj:
                d1[ii].append(ii-jj)
    for i in range(len(gg)):
        ii=gg[i]
        for j in range(len(bb)):
            jj=bb[j]
            if ii<jj:
                d2[ii].append(jj-ii)
    s=0
    #print(d1,d2)
    for x in d1:
        for y in d1[x]:
            for z in d2[x]:
                if y!=z:
                    s+=1
    return s
        
n=int(input())
s=input()
l=list(s)
rr,gg,bb=[],[],[]
for i in range(len(s)):
    ii=s[i]
    if ii=='R':rr.append(i)
    if ii=="G":gg.append(i)
    if ii=="B":bb.append(i)
#print(rr,gg,bb)
print(solve(rr,gg,bb)+solve(rr,bb,gg)+solve(bb,rr,gg)+solve(bb,gg,rr)+solve(gg,rr,bb)+solve(gg,bb,rr))
Problem p02659 (python)

Fixed submission:
import decimal
a,b=input().split()
a=int(a)
b=decimal.Decimal(b)
print(int(a*b))

Buggy submission (verdict: Runtime Error):
a,b=map(float,input().split())
print(trunc(a*b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(int(a*b))
Problem p02659 (python)

Fixed submission:
from decimal import Decimal

a, b  = map(float, input().split())
a = Decimal(str(a))
b = Decimal(str(b))

print(int(a*b))

Buggy submission (verdict: Runtime Error):
import math
A, B = map(eval,input().split())
ans = A*B
print(math.tr