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

Fixed submission:
k = int(input())
a, b = [int(x) for x in input().split()]
res = (a//k < b//k) or (not a%k) or (not b%k)
print('OK' if res else 'NG')

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = [int(x) for x in input()]
res = a//k < b//k or not a%k or not b%k
print('OK' if res else 'NG')

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = [int(x) for x in input()]
res = a//k < b//k or not a%k not b%k
print('OK' if res else 'NG')

Buggy submission (verdict: Runtime Error):
import sys

k, tmp = [line.rstrip() for line in sys.stdin]
k, a, b = int(k), [int(x) for x in tmp.split()]
print(a//k < b//k)
Problem p03107 (python)

Fixed submission:
S=list(input())
a=S.count("1")
b=S.count("0")
if a>=b:
    print(b*2)
else :
    print(a*2)

Buggy submission (verdict: Runtime Error):
S=input()
A=S.replace(01"")
B=A.replace(10"")
print(len(S)-len(B))
Problem p02695 (python)

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

A = [1]*N
def recur(A=A, index=0, lim=M):
    if index>len(A)-2:
        return
    while A[index] <= lim-1:
        A[index] += 1
        yield A[::-1]
        yield from recur(A[:], index+1, A[index])
    return

def get_point(A):
    return sum((A[b[1]-1]-A[b[0]-1]==b[2])*b[3] for b in B)

print(max(0, get_point(A), *(get_point(i) for i in recur())))

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

A = [1]*N
def recur(A=A, index=0, lim=M):
    if index>len(A)-2:
        return
    while A[index] <= lim-1:
        A[index] += 1
        yield A[::-1]
        yield from recur(A[:], index+1, A[index])
    return

def get_point(A):
    return sum((A[b[1]-1]-A[b[0]-1]==b[2])*b[3] for b in B)

print(max(get_point(A), *(get_point(i) for i in recur())))
Problem p02693 (python)

Fixed submission:
n=int(input())
a,b=map(int,input().split())
l=[abb for abb in range(a, b+1)]
kl=[]
for am in l:
    if am%n==0:
        kl.append(am)
if len(kl)>0:
    print("OK")
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
n=int((input())
def f(n):
    a=0
    b=100
    while True:
        a+=1
        b*=(100+a)/100
        b=int(b)
        if b>=n:
            break
    return a
print(f(n))

Buggy submission (verdict: Runtime Error):
def f(n):
    a=0
    b=100
    while True:
        a+=1
        b*=(100+a)/100
        b=int(b)
        if b>=n:
            break
    return a
  
print(f(n))

Buggy submission (verdict: Runtime Error):
n=int(input())
a,b=map(int,input().split())
if a==b and if a%n==0:
    print("OK")
else:
     print("NG")
if (b-a+1)/n>=1:
  print("OK")
else:
    print("NG")
Problem p02699 (python)

Fixed submission:
n,m=map(int,input().split())
def func(n,m):
    return "unsafe" if n<=m else "safe"
print(func(n,m))

Buggy submission (verdict: Runtime Error):
n,b=input().split()
n,b=int(n),int(b)
def b(n,b):
    return "safe" if n>b else "No"
print(b(n,b))

Buggy submission (verdict: Runtime Error):
n,b=input().split()
def b(n,b):
    return "safe" if n>b else "No"
print(b(n,b))
Problem p02701 (python)

Fixed submission:
a=int(input())
b=[input() for i in range(a)]
def func(b):
    return len(set(b))
print(func(b))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(str,a.split()))
def func(b):
    return len(set(b))
print(func(b))

Buggy submission (verdict: Runtime Error):
a=map(int,input().split())
b=list(map(int,input().split()))
def func(a,b):
    ab=set(b)
    return len(ab)
Problem p02711 (python)

Fixed submission:
N=input()
def d(N):
    return "Yes" if "7" in N else "No"
print(d(N))

Buggy submission (verdict: Runtime Error):
N=input()
def d(N):
    return "Yes" if "7" in N else "No"
print(d(n))

Buggy submission (verdict: Runtime Error):
n=input().split())
def d(n):
    return "Yes" if "7" in n else "No"
print(d(n))

Buggy submission (verdict: Runtime Error):
n=int(input())
def d(n):
    return "Yes" if 7 in n else "No"
print(d(n))

Buggy submission (verdict: Runtime Error):
n=int(input())
def d(n):
    return "Yes" if 7 in n else ""No"
print(d(n))

Buggy submission (verdict: Runtime Error):
def function (N):
    return 'Yes' if 7 in N else 'No'
a= function(N)
print(a)

Buggy submission (verdict: Runtime Error):
def a(N):
    return 'Yes' if 7 in N else 'No'
nun=a(N)
print num
Problem p02712 (python)

Fixed submission:
n=int(input())
an=[a for a in range(1,n+1)]
o=[]
def ass(an):
    for c in an:
        if c%3==0 or c%5==0:
             continue
        else:
            o.append(c)
    return sum(o)
print(ass(an))

Buggy submission (verdict: Runtime Error):
n=int(input())
an=[a for a in range(1,n+1)]
o=[]
def ass(an):
    for c in an
        if c%3==0 or c%5==0:
             continue
        else:
            o.append(c)
    return sum(o)
print(ass(an))
Problem p02879 (python)

Fixed submission:
A, B = map(int, input().split())
if 1 <= A <= 9 and 1 <= B <= 9:
    print(A*B)
else:
     print (-1)

Buggy submission (verdict: Runtime Error):
A, B = int(input())
if 1<=A & A<=9 | 1<=B & B<=9:
    if 1<=A*B & A*B<=81:
        print (A*B)
    else:
        print (-1)
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
lis = list(map(int, input().split()))
count = 0
for i in range(N):
    if lis[i] >= K:
        count += 1
print(count)
Problem p02915 (python)

Fixed submission:
N = int(input())
print(N*N*N)

Buggy submission (verdict: Runtime Error):
N = int(input)
print(N*N*N)
Problem p02880 (python)

Fixed submission:
N=int(input())
lst=[]
for i in range(1,10):
    for j in range(1,10):
        lst.append(i*j)

if N in lst:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
lsr=[]
for i in range(1,9):
    for j in range(1,9):
        lst.append(i*j)

print("Yes" if N in lst else "No")
Problem p02891 (python)

Fixed submission:
S=input()
S_=S+"A"
K=int(input())
i=0
cnt=0
lst=[]
while i<len(S_)-1:
    if not S_[i] == S_[i+1]:
        cnt+=1
        lst.append(cnt)
        cnt=0
        i+=1
    else:
        i+=1
        cnt+=1
if len(lst)==1:#一種類の時
    print((lst[0]*K)//2)
elif S[0]!=S[-1]:
    ans=0
    for j in lst:
        ans+=j//2
    print(ans*K)
else:
    ans_1=0
    ans_2=0
    for k in range(len(lst)):
        ans_1+=lst[k]//2
    for k in range(len(lst)):
        if k==0:
            ans_2+=lst[k]//2
        elif k==len(lst)-1:
            ans_2+=lst[k]//2
            ans_2+=(lst[k]+lst[0])//2
        else:
            ans_2+=(lst[k]//2)*2
    print(ans_1+(ans_2-ans_1)*(K-1))

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())
S_=S*K+"A"
cnt=0
import queue
q=queue.Queue()
for i in S_:
    if not q.empty():
        if not i == q.get():
            n=1
            while not q.empty():
                q.get()
                n+=1
            cnt+=n//2
            q.put(i)
        else:
            q.put(i)
            q.put(i)#出した分戻さないと           
    else:
        q.put(i)
        #最後、入れっぱなしで終わってしまっていた
print(cnt)
Problem p02948 (python)

Fixed submission:
import heapq
N,M=map(int,input().split())
l=[tuple(map(int,input().split())) for i in range(N)]
l.sort(reverse=True)

h=[]
ans=0
for i in range(1,M+1):
    while l and l[-1][0]==i:
        heapq.heappush(h,l.pop()[1]*(-1))
    if h:
        ans-=heapq.heappop(h)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
l=[list(map(int,input().split())) for i in range(N)]
l_1=sorted(l,key=lambda l:l[1],reverse=True)
l_2=[0]*(M+N)
d=0
for i in range(N):
    if d+l_1[i][0]<=M:
        l_2[d+l_1[i][0]]+=l_1[i][1]
        del l_1[i]
        d+=1
    else:
        break
l_3=sorted(l_1, key=lambda l_1:(l_1[0],-l_1[1]))
for i in range(N):
    if d+l_3[i][0]<=M:
        l_2[d+l_1[i][0]]+=l_3[i][1]
        d+=1
    else:
        break 
print(sum(l_2))
Problem p02951 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
H=list(map(int,input().split()))
count=0
if len(H)==1:
    print("Yes")
elif len(H)==2:
    if H[0]<=H[1]+1:
        print("Yes")
    else:
        print("No")
elif H[0]<=H[1]+1:
    for i in range(1,N-1):
        if H[i]<=H[i+1]:
            count+=1
            continue
        elif H[i]==H[i+1]+1:
            H[i]-=1
            if H[i]<H[i-1]:
                print("No")
                break
            else:
                count+=1
                continue
        else:
            print("No")
            break
else:
    print("No")
if count==N-2:
    print("Yes")
Problem p02990 (python)

Fixed submission:
N, K = map(int, input().split())
R = N-K
RR = R-1
mod = 10**9+7

def nCr(n,r):
    K = 1
    for j in range(1,r+1):
        K = K*(n+1-j)//j
    return K

    
for i in range(K):
    ans = (nCr(K-1,i)%mod)*(nCr(N-K+1,i+1)%mod)
    ans = ans%mod
    print(ans)

Buggy submission (verdict: Runtime Error):
#132 12:55
n,k=map(int,input().split())
mod=7+10**9
def C(i,j):
    def a(n):
        b=1
        if n==0:
            return 1
        else:
            for x in range(1,n+1):
                b=b*x
            return b
    return int(a(i)/(a(j)*a(i-j)))

answer=[]
for i in range(1,k+1):
    if n-k-i+1<0:
        continue
    else:
        answer.append( (C(k-1,i-1)%mod)*(C(n-k+1,i)%mod ))
for i in range(len(answer)):
    print(answer[i]%mod)

Buggy submission (verdict: Runtime Error):
#132 12:55
n,k=map(int,input().split())
mod=7+10**9
def C(i,j):
    def a(n):
        b=1
        if n==0:
            return 1
        else:
            for x in range(1,n+1):
                b=b*x
            return b
    return int(a(i)/(a(j)*a(i-j)))

answer=[]
for i in range(1,k+1):
    if n-k-i+1<0:
        answer.append(0)
    else:
        answer.append( (C(k-1,i-1)%mod)*(C(n-k+1,i)%mod ))
for i in range(k):
    print(answer[i]%mod)

Buggy submission (verdict: Runtime Error):
#132 12:55
n,k=map(int,input().split())
def C(i,j):
    def a(n):
        b=1
        if n==0:
            return 1
        else:
            for x in range(1,n+1):
                b=b*x
            return b
    return int(a(i)/(a(j)*a(i-j)))

answer=[]
for i in range(1,k+1):
    if n-k-i+1<0:
        answer.append(0)
    else:
        answer.append( C(k-1,i-1)*C(n-k+1,i) )
for i in range(k):
    print(answer[i]%(7+10**9))

Buggy submission (verdict: Runtime Error):
#132 12:55
n,k=map(int,input().split())
def C(i,j):
    def a(n):
        b=1
        for x in range(1,n+1):
            b=b*x
        return b
    return int(a(i)/(a(j)*a(i-j)))

answer=[]
for i in range(1,k+1):
    if n-k-i+1<0:
        answer.append(0)
    else:
        answer.append( C(k-1,i-1)*C(n-k+1,i) )
for i in range(k):
    print(answer[i]%(7+10**9))

Buggy submission (verdict: Runtime Error):
#132 12:55
n,k=map(int,input().split())
def C(i,j):
    def a(n):
        b=1
        for x in range(1,n+1):
            b=b*x
        return b
    return int(a(i)/(a(j)*a(i-j)))

answer=[]
for i in range(1,k+1):
    if n-k-i+1<0:
        answer.append(0)
    else:
        answer.append( C(k-1,i-1)*C(n-k+1,i) )
for i in range(k):
    print(answer[i]%(7+10**9))
Problem p03013 (python)

Fixed submission:
N,M=map(int,input().split())
a = [int(input()) for _ in range(M)]
dp = [0]*(N+1)
j = 0
dp[0] = 1
mod = 10**9+7
for i in range(1, N+1):
    if j < M and i == a[j]:
        j += 1
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = (dp[i-1]+dp[i-2]) % mod
print(dp[N])

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
a=[int(input()) for i in range(M)]
a_a=np.ones( N+1 )
for i in range(M):
    a_a[a[i]]=0
c=np.zeros(N+1)
c[0]=1
for i in range(1,N+1):
    if i==1:
        c[i]=c[i-1]*a_a[i-1]
    else:
        c[i]=c[i-1]*a_a[i-1]+c[i-2]*a_a[i-2]
print(int(c[N])%(7+10**9))

Buggy submission (verdict: Runtime Error):
import sys

N,M=map(int,input().split())
a=[int(input()) for i in range(M)]
c=[0]*(N+1)
c[0]=1
MOD=7+10**9
if M==0:
    c[1]=1
    for i in range(1,N):
        c[i+1]=c[i]+c[i-1]
    print(c[N])
else:
    j=0
    for i in range(1,N+1):
        if i==a[j]:
            if j+1<=M:
                if i+1==a[j+1]:
                    print(0)
                    sys.exit(0)
                else:
                    j+=1
        elif i==1:
            c[i]=1
        else:
            c[i]=(c[i-1]+c[i-2])%MOD
    print(c[-1]%MOD)

Buggy submission (verdict: Runtime Error):
#129
N,M=map(int,input().split())
a=[int(input()) for i in range(M)]
f=[1,2,3,5,8]
def cu(x):
    global f
    if len(f)<x:
        for i in range(len(f),x):
            f.append( f[i-1]+f[i-2] )
    return f[x-1]

a_d=[a[0]-1]
for i in range(M-1):
    a_d.append( a[i+1]-a[i]-1 )
a_d.append(N-a[-1]-1)
if 0 in a_d[1:]:
    print(0)
    exit(0)
else:
    count=1
    for i in range(M+1):
        if i==0 and a_d[0]!=0:
            count=cu(a_d[0])
        elif i==M:
            count=count*cu(a_d[-1])
        else:
            if a_d[i]>=3:
                count=count*cu(a_d[i]-1)
print(count%(10**9+7))
Problem p02693 (python)

Fixed submission:
k = int(input())
x = input().split()
a = int(x[0])
b = int(x[1])
c = 0
for i in range(a,b+1):
  if i%k==0:
    c = 1
    break
if c==1:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
from math import floor,ceil
x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
print(ceil(ceil(a*c/b)-a*floor(c/b)))

Buggy submission (verdict: Runtime Error):
from math import floor,ceil
x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
print(int(floor(a*c/b)-a*floor(c/b)))

Buggy submission (verdict: Runtime Error):
from math import floor,ceil
x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
print(floor(floor(a*c/b)-a*floor(c/b)))

Buggy submission (verdict: Runtime Error):
from math import floor,ceil
x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
print(int(floor(a*c/b)-a*floor(c/b)))
Problem p02693 (python)

Fixed submission:
k =int(input())
a,b = map(int, input().split())
c = b//k
 
if b%k==0:
  print("OK")
elif k*c >=a:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
a,b,n = map(int, input().split())
#1 <= x <= n
#minimize  int(x/b)
#x = int(a*x/b) - a * int(x/b)

print((a*n)//b)
Problem p02711 (python)

Fixed submission:
x = str(input())
a = x[0]
b = x[1]
c = x[2]

if a=="7":
  print("Yes")
elif b =="7":
  print("Yes")
elif c == "7":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = map(str, input())
a = str[0]
b = str[1]
c = str[2]

if a==7:
  print("Yes")
elif b ==7:
  print("Yes")
elif c == 7:
  print("Yes")
else:
  print("No")
Problem p02723 (python)

Fixed submission:
x = list(input())
if (x[2] ==x[3]) and (x[4]==x[5]):
  print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
x = int(input())
a = int(x/500)
b = x - 500*a
c = int(b/5)

print(1000*a + 5*c)
Problem p02753 (python)

Fixed submission:
x = input()
if x =='AAA':
  print('No')
elif x == 'BBB':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
x = str(input())
if x =='AAA':
  print(No)
  elif x =='BBB':
    print(No)
    else:
      print(Yes)

Buggy submission (verdict: Runtime Error):
x = input()
if x =='AAA':
  print(No)
  elif x =='BBB':
    print(No)
    else:
      print(Yes)
Problem p03242 (python)

Fixed submission:
n = input()

print(n.replace("1","x").replace("9","1").replace("x","9"))

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

print(n.translate(str.maketrans({"1":"9"}))

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

print(n.replace("1","9").replace("9","1")

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

print(n.replace("1","9").repace("9","1"))

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

print(n.replace("1","9").repace("9","1")
Problem p03803 (python)

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

if a == b:
    print("Draw")
elif a == 1 and b != 1:
            print("Alice")
elif a != 1 and b == 1:
            print("Bob")
elif a < b:
            print("Bob")
else:
            print("Alice")

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

if a == b:
    print("Draw")
elif a == 1 B != 1:
            print("Alice")
elif a != 1 B == 1:
            print("Bob")
elif a < b:
            print("Alice")
else:
            print("Bob")

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

if a == b:
    print("Draw")
elif a == 1 B != 1:
            print("Alice")
elif a != 1 B == 1:
            print("Bob")
elif a < b:
            print("Alice")
else:
            print("Bob")
Problem p02879 (python)

Fixed submission:
a,b = map(int, input().split())
if 0 < a < 10 and 0 < b < 10:
  print(a * b)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input(9.split()))
if 0 < a < 10 and 0 < b < 10:
  print(a * b)
else:
  print(-1)
Problem p02699 (python)

Fixed submission:
a,b=map(int,input().split())
if a<=b: print('unsafe')
else: print('safe')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().sprit())
if a<=b:print('unsafe')
else:print('safe')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().sprit())
if a>b:print('unsafe')
else:print('safe')
Problem p02711 (python)

Fixed submission:
a=input()
ans='No'
for i in a:
  if i=='7':
    ans='Yes'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().sprit()))
b=True
for i in a
	if i==7:
    	print('Yes')
        b=False
        break;
if b:
  print('No')

Buggy submission (verdict: Runtime Error):
a=input()
if a[0]='7':
	print('Yes')
elif a[1]='7'
	print('Yes')
elif a[2]='7'
	print('Yes')
else:
  print('No')
Problem p03041 (python)

Fixed submission:
N, K = map(int,input().split())
S = [i for i in input()]
S[K-1] = S[K-1].lower()
print("".join(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
S = [i for i in input()]
S[K-1] = S[K].lower()
print("".join(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
S = [i for i in input()]
S[K] = S[K].lower()
print("".join(S))
Problem p03127 (python)

Fixed submission:
import fractions
N = int(input())
A = list(map(int, input().split()))
x = A[0]
for i in range(len(A)-1):
    x= fractions.gcd(x,A[i+1])
print(x)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))
x = A[0]
for i in range(len(A)-1):
    x= math.gcd(x,A[i+1])
print(x)
Problem p03137 (python)

Fixed submission:
N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if M > 1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l, reverse=True)
z = sum(ll[:N-1])
print(sum(l)-z)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if M >1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l,reverse=True)
z = 0
for i in range(N-1):
    z += ll[i]
print(sum(l)-z)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = sorted(list(map(int,input().split())))
if len(X) >1:
    l = [X[i+1]-X[i] for i in range(M-1)]
else:
    print(0)
    exit()
ll = sorted(l,reverse=True)
for i in range(N-1):
    ma = l.index(ll[i])
    l[ma] = 0
print(sum(l))
Problem p03221 (python)

Fixed submission:
N,M = map(int,input().split())
h = [list(map(int, input().split()))for i in range(M)]
for i in range(M):
    h[i].append(i)
h = sorted(h,key=lambda h:(h[0],h[1]))
k = 0
p = h[0][0]
for i in range(M):
    if h[i][0] == p:
        h[i].append(str(p).zfill(6)+str(k+1).zfill(6))
        k+=1
    else:
        p = h[i][0]
        k = 0
        h[i].append(str(p).zfill(6) + str(k + 1).zfill(6))
        k += 1
# print(h)
h = sorted(h,key=lambda h:h[2])
# print(h)
for i in range(M):
    print(h[i][3])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
h = [list(map(int, input().split()))for i in range(M)]
for i in range(M):
    h[i].append(i)
h = sorted(h,key=lambda h:(h[0],h[1]))
k = 0
p = h[0][0]
for i in range(M):
    if h[i][0] == p:
        h[i].append(str(p).zfill(6)+str(k+1).zfill(6))
        k+=1
    else:
        p = h[i][0]
        k = 0
        h[i].append(str(p).zfill(6) + str(k + 1).zfill(6))
        break
h = sorted(h,key=lambda h:h[2])
# print(h)
for i in range(M):
    print(h[i][3])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
h = [list(map(int, input().split()))for i in range(M)]
for i in range(M):
    h[i].append(i)
h = sorted(h,key=lambda h:(h[0],h[1]))
k = 0
p = h[0][0]
for i in range(M):
    if h[i][0] == p:
        h[i].append(str(p).zfill(6)+str(k+1).zfill(6))
        k+=1
    else:
        p += 1
        k = 0
        h[i].append(str(p).zfill(6) + str(k + 1).zfill(6))
        break
h = sorted(h,key=lambda h:h[2])
# print(h)
for i in range(M):
    print(h[i][3])
Problem p02729 (python)

Fixed submission:
n, m = input().split()
n = int(n)
m = int(m)
ans = (n * (n - 1) / 2) + (m * (m - 1) / 2)
print(round(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(pow(n / 3, 3))
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement

n, m, q = map(int,input().split())
l = []
s = []
for _ in range(q):
    a, b, c, d = map(int,input().split())
    l.append([a, b, c, d])

ps = list(combinations_with_replacement(range(1, m+1), n-1))
n_p = len(ps)

for i in range(n_p):
    ns = [1] + list(ps[i])
    ss = 0
    for j in range(q):
        k = l[j]
        if ns[k[1]-1] - ns[k[0]-1] == k[2]:
            ss += k[3]
    s.append(ss)

print(max(s))

Buggy submission (verdict: Runtime Error):
from itertools import combinations_with_replacement

n, m, q = map(int,input().split())
l = []
s = []
for _ in range(q):
    a, b, c, d = map(int,input().split())
    l.append([a, b, c, d])

ps = list(combinations_with_replacement(range(2, m+1), n-1))
n_p = len(ps)

for i in range(n_p):
    ns = [1] + list(ps[i])
    ss = 0
    for j in range(q):
        k = l[j]
        if ns[k[1]-1] - ns[k[0]-1] == k[2]:
            ss += k[3]
    s.append(ss)

print(max(s))
Problem p02771 (python)

Fixed submission:
s = [int(x) for x in list(input().split())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
ans = "APPROVED"
for i in s:
  if i%5 != 0 and i%3 != 0:
    ans = "DENIED"
    pass
print(ans)

Buggy submission (verdict: Runtime Error):
s = [x for x in list(input())]
ans = "No"
for i in range(3):
  tmp = [int(x)/int(s[i]) == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)

Buggy submission (verdict: Runtime Error):
s = [x for x in list(input())]
ans = "No"
for i in range(3):
  tmp = [int(x)/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)

Buggy submission (verdict: Runtime Error):
s = [int(x) for x in list(input())]
ans = "No"
for i in range(3):
  tmp = [x/s[i] == 1 for x in s]
  is_poor = 0
  for j in tmp:
    is_poor += j
  if is_poor == 2:
    ans = "Yes"
    pass
print(ans)
Problem p03631 (python)

Fixed submission:
N = list(map(int, (input())))
if N == N[::-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from fractions import gcd

def lcm(a, b):
  return a*b/gcd(a, b)

N = int(input())
T = list(int(input()) for i in range(N))
T = list(set(T))
T.sort()
a = lcm(T[0], T[1])
for i in T[2:]:
    a = lcm(a, i)
print(int(a))