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

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

A = []
for i in range(a):
    A.append(list(input()))
B = []
for i in range(b):
    B.append(list(input()))
f = 0
for i in range(a - b + 1):
    for j in range(a - b + 1):
        if A[i][j] == B[0][0]:
            ans = 0
            for k in range(b):
                for l in range(b):
                    if A[i+k][j+l] == B[k][l]:
                        continue
                    else:
                        ans = 1
            if ans == 0 and f == 0:
                print("Yes")
                f = 1
                break
if f == 0:
    print("No")

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

L = []

for i in range(a):
    L.append([j for j in input()])

K = []

for i in range(b):
    K.append([j for j in input()])
ind = 0
for i in range(a-b+1):
    for j in range(a-b+1):
        if L[i][j] == K[0][0] and ind == 0:
            for k in range(b):
                if L[i+k][j:j+b] != K[i+k]:
                    break
                if k == b - 1 and ind == 0:
                    print("Yes")
                    ind = 1
                    break
if ind == 0:
    print("No")

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

L = []

for i in range(a):
    L.append([j for j in input()])

K = []

for i in range(b):
    K.append([j for j in input()])
ind = 0
for i in range(a-b+1):
    for j in range(a-b+1):
        if L[i][j] == K[0][0]:
            for k in range(b):
                if L[i+k][j:j+b] == K[i+k]:
                    continue
                else:
                    break
            if k == b - 1 and ind == 0:
                print("Yes")
                ind = 1
                break
if ind == 0:
    print("No")

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

L = []

for i in range(a):
    L.append([j for j in input()])

K = []

for i in range(b):
    K.append([j for j in input()])

for i in range(a-b+1):
    for j in range(a-b+1):
        if L[i][j] == K[0][0]:
            for k in range(b):
                if L[i+k][j:j+b] == K[i+k]:
                    continue
                else:
                    break
            if k == b - 1:
                print("Yes")
                quit()
print("No")
Problem p03803 (python)

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

if a == 1: 
    a += 13
if b == 1: 
    b += 13

if a > b:
    print('Alice')
elif a < b:
    print('Bob')
else:
    print('Draw')

Buggy submission (verdict: Runtime Error):
if a == 1: a += 13
if b == 1: b += 13

if a > b:
    print('Alice')
elif a < b:
    print('Bob')
else:
    print('Draw')
Problem p02596 (python)

Fixed submission:
import numpy as np
K=int(input()) 

S=0
count=-1

for i in range(K):
  S = (S*10)%K
  S = (S+7)%K
  if( S == 0):
    count = i+1
    break

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
K=int(input()) 

S=""
count=-1

for i in range(K):
  S += "7"
  M = int(S):
  if( M%K == 0):
    count = i+1
    break

print(count)
Problem p02547 (python)

Fixed submission:
n=int(input())
lst=[list(map(int,input().split())) for _ in range(n)]
# print(lst)
cnt=0
ans="No"
for i in range(n):
    a,b=lst[i]
    # print(a,b)
    if a==b:
        cnt+=1
    else:
        cnt=0
    if cnt==3:
        # print(a,b,cnt)
        ans="Yes"
        break

print(ans)

Buggy submission (verdict: Runtime Error):
#include <algorithm>
#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;

int main(){
        int n,a,b;
        int cnt=0;
        cin>>n;
        
        for(int i=0;i<n;i++){
                cin>>a>>b;
                if(a==b){
                        cnt++;
                }else{
                        cnt=0;
                }
                if(cnt==3){
                        cout<<"Yes"<<endl;
                        return 0;
                }
                
        }
        cout<<"No"<<endl;
        return 0;
}
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if a>=k:
  print(k)
elif a<k:
  if k-a<=b:
    print(a)
  elif k-a >b:
    print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
ans=0
if(a>=k):
  ans+=k
  #print(k)
elif(a<k):
  ans+=a
  if(k-a<=b):
    #print(ans)
  elif (k-a>b):
    ans+=b
    ans-=k-a-b
    #print(ans)
print(ans)
Problem p02711 (python)

Fixed submission:
a=input()
cnt=0
for i in a:
  if i=="7":
    cnt+=1
    break
print(["No","Yes"][cnt])

Buggy submission (verdict: Runtime Error):
a=input()
cnt=0
for i in a::
  if i=="7":
    cnt+=1
    break
print(["No","Yes"][cnt])
Problem p02729 (python)

Fixed submission:
from math import factorial

x,y=map(int,input().split())
if x>1:
    a = factorial(x) / factorial(2) / factorial(x - 2)
else: a=0
if y>1:
    b = factorial(y) / factorial(2) / factorial(y - 2)
else: b=0
print(int(a+b))

Buggy submission (verdict: Runtime Error):
from math import factorial

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

a = factorial(x) / factorial(2) / factorial(x - 2)
b = factorial(y) / factorial(2) / factorial(y - 2)
print(int(a+b))

Buggy submission (verdict: Runtime Error):
from scipy import special
x,y=map(int,input().split())

a = special.comb(x, 2, True)
b = special.comb(y, 2, True)

print(a+b)

Buggy submission (verdict: Runtime Error):
from scipy import special
x,y=map(int,input().split())

a = special.comb(x, 2, True)
b = special.comb(y, 2, True)

print(a+b)

Buggy submission (verdict: Runtime Error):
from scipy import special
x,y=map(int,input().split())

a = special.comb(x, 2, True)
b = special.comb(y, 2, True)

print(a+b)
Problem p02759 (python)

Fixed submission:
print((int(input())+1)//2)

Buggy submission (verdict: Runtime Error):
#include<iostream>
using namespace std;

int main(){
    int a;
    cin>>a;
    cout<<(a+2-1)/2<<endl;
    return 0;

}
Problem p02766 (python)

Fixed submission:
n,m=map(int,input().split()) 
lst_b=[] 
lst_c=[] 
while(True): 
    b=n//m 
    c=n%m 
    lst_b.append(b) 
    lst_c.append(c) 
    n=b 
    if b==0: 
    	print(len("".join(map(str,lst_c[::-1])))) 
    	break

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split()) 
lst_b=[] 
lst_c=[] 
while(True): 
    b=n//m 
    c=n%m 
    lst_b.append(b) 
    lst_c.append(c) 
    n=b 
    	if b==0: 
    		print("".join(map(str,lst_c[::-1]))) 
    		break
Problem p02819 (python)

Fixed submission:
n=int(input()) 
m=10**5+4 
for i in range(n,m): 
	lst=[] 
	if all(( i % j) !=0 for  j in range(2,int(n**0.5//1+1))): 
		print(i) 
		break

Buggy submission (verdict: Runtime Error):
n=int(input())
bool_1=True
while(1):
	for i in range(n**0.5//1):  
		if n % i ==0: 
			bool_1=False
			break
    n+=1      
    if bool_1:break
print(bool_1)

Buggy submission (verdict: Runtime Error):
n=int(input()) 
m=10**5+4 
for i in range(n,m): 
	lst=[] 
	if all(( i % j) !=0 for  j in range(2,int(n**0.5//1+1))): 
		print(i,j) 
		break

Buggy submission (verdict: Runtime Error):
n=int(input())
m=10**5+1
for j in range()
for i in range(n,m):
  for j in range(2,int(n**0.5//1+1)):
    i % i==0:
      print(i)
      break
Problem p02831 (python)

Fixed submission:
import fractions  
a,b=map(int,input().split())  
print(a*b//fractions.gcd(a,b))

Buggy submission (verdict: Runtime Error):
from fractions import Fractions  
a,b=map(int,input().split())  
print(a*b//fractions.gcd(a,b))

Buggy submission (verdict: Runtime Error):
from math import fractions  
a,b=map(int,input().split())  
print(a*b//fractions.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math  
a,b=map(int,input().split())  
print(a*b//fractions.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math 
a,b=map(int,input().split()) 
print(a*b//math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math 
a,b=map(int,input().split()) 
print(a*b//math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math 
a,b=map(int,input().split()) 
print(a*b/math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(a*b/math.gcd(a,b))
Problem p02859 (python)

Fixed submission:
print((int(input())**2))

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

Fixed submission:
n=int(input())
for i in range(1,10):
	if n % i ==0 and n//i <=9:
		print("Yes")
		break
else:
	print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
for i in range(1,10):
	if n % i ==0 and n//i <=9:
    	print("Yes")
    	break
else:
	print("No")
Problem p02881 (python)

Fixed submission:
def div_make(n):
    divisor =[]
    n=int(n)
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisor.append([i,n//i])
    return divisor

a=int(input())

lst=[]
for i in div_make(a):
    lst.append(i[0]+i[1])
ans=0
ans=min(lst)-2
print(ans)

Buggy submission (verdict: Runtime Error):
ef div_make(n):
    divisor =[]
    n=int(n)
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisor.append([i,n//i])
    return divisor

a=int(input())

lst=[]
for i in div_make(a):
    lst.append(i[0]+i[1])
ans=0
ans=min(lst)-2
print(ans)
Problem p02897 (python)

Fixed submission:
a=int(input()) 
print(((a+1)//2)/a)

Buggy submission (verdict: Runtime Error):
print(int(input()+0.5)//2)
Problem p02916 (python)

Fixed submission:
n=int(input())
l=[list(map(int,input().split())) for _ in range(3)]

count_num=0
for i in l[0]:
    count_num += l[1][i-1]
for j in range(n-1):
    if (l[0][j])+1 == l[0][j+1]:
        count_num += l[2][(l[0][j])-1]
    
print(count_num)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]

count_num=0
for i in l[0]:
    count_num += l[1][i-1]
for j in range(n-1):
    if (l[0][j])+1 == l[0][j+1]:
        count_num += l[2][(l[0][j])-1]
    
print(count_num)
Problem p02933 (python)

Fixed submission:
a=int(input())
b=input()
print(b if a>=3200 else "red")

Buggy submission (verdict: Runtime Error):
a=int(inpout())
b=input()
print(b if a>=3200 else "red")
Problem p02935 (python)

Fixed submission:
n=int(input()) 
lst=list(map(int,input().split()))
lst.sort()
#print(lst) 
a=[] 

for i in range(n): 
	if i==0: 
		#print(lst[i]) 
		a.append(lst[i]) 
	else: 
		#print(lst[i]) 
		a.append((a[-1]+lst[i])/2)   
print(a[-1])

Buggy submission (verdict: Runtime Error):
 n=int(input()) 
lst=list(map(int,input().split())) 
#print(lst) 
a=[] 

for i in range(n): 
	if i==0: 
		#print(lst[i]) 
		a.append(lst[i]) 
	else: 
		#print(lst[i]) 
		a.append((a[-1]+lst[i])/2)   
print(a[-1])
Problem p02959 (python)

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

ans=0
right=0
left=0
for i in range(n):
    left=min(a[i],b[i])
    ans+=left
    a[i]-=left
    b[i]-=left
    
    right=min(a[i+1],b[i])
    ans+=right
    a[i+1]-=right
    b[i]-=right
print(ans)

Buggy submission (verdict: Runtime Error):
ans=0
right=0
left=0
for i in range(n):
    left=min(a[i],b[i])
    ans+=left
    a[i]-=left
    b[i]-=left
    
    right=min(a[i+1],b[i])
    ans+=right
    a[i+1]-=right
    b[i]-=right
print(ans)

Buggy submission (verdict: Runtime Error):
ns=0
right=0
left=0
for i in range(n):
    left=min(a[i],b[i])
    ans+=left
    a[i]-=left
    b[i]-=left
    
    right=min(a[i+1],b[i])
    ans+=right
    a[i+1]-=right
    b[i]-=right
print(ans)
Problem p02970 (python)

Fixed submission:
a,b=map(int,input().split()) 
for i in range(21): 
	l=(b*2+1)*i 
	if l>=a: 
		print(i) 
		break

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split()) 
for i in range(21): 
	l=(b*2+1)*i 
		if l>=a: 
			print(i) 
			break

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split()) 
for i in range(21): 
	l=(b*2+1)*i 
		if l>=a: 
			print(i) 
			break

Buggy submission (verdict: Runtime Error):
 a,b=map(int,input().split()) 
for i in range(21): 
	l=(b*2+1)*i 
		if l>=a: 
			print(i) 
			break
Problem p02989 (python)

Fixed submission:
n=int(input())
l=sorted(list(map(int,input().split())))
print(l[n//2]-l[n//2-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=sort(list(map(int,input().split())))
print(l[n//2]-l[n//2-1])
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split()) 
s=input() 
print(s[0:k-1]+s[k-1:k].lower()+s[k:])

Buggy submission (verdict: Runtime Error):
n,k=int(input())
s=input()
print(s[0:k-1]+s[k-1:k]+s[k:])
Problem p03042 (python)

Fixed submission:
x=input()
a=x[:2]
b=x[2:]
ans_lst=[]
for y in [a,b]:
	if "00"<y<"13":
		ans_lst.append(True)
	else:ans_lst.append(False)
if all(ans_lst):
    print("AMBIGUOUS")
elif not any(ans_lst):
    print("NA")
elif ans_lst[0] and ans_lst[1]==False:
	print("MMYY")
elif ans_lst[0]==False and ans_lst[1]:
	print("YYMM")

Buggy submission (verdict: Runtime Error):
x=input()
a=x[:2]
b=x[2:]
ans_lst=[]
for y in [a,b]:
	if "00"<y<"13":
  		ans_lst.append(True)
    else:ans_lst.append(False)
if all(ans_lst):
    print("AMBIGUOUS")
elif not any(ans_lst):
    print("NA")
elif ans_lst[0] and ans_lst[1]==False:
	print("MMYY")
elif ans_lst[0]==False and ans_lst[1]:
	print("YYMM")
Problem p03072 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
cnt=1
max_h=-1
for i in range(n-1):
  max_h=max(l[i],max_h)
  if l[i+1]>=max_h:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
max_value=-999
cnt=0
for i in range(n):
  if max_value<=l[i]:
    max_value=max(max_balue,l[i])
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
max_value=-999
cnt=0
for i in range(n):
  if max_balue<l[i]:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
cnt=1
max_h=-1
for i in range(n):
  max_h=max(l[i],max_h)
  if l[i+1]>=max_h:
    cnt+=1
print(cnt)
Problem p03075 (python)

Fixed submission:
l=list(int(input()) for _ in range(5))
m=int(input())
print([":(","Yay!"][l[4]-l[0]<=m])

Buggy submission (verdict: Runtime Error):
l=list(int(input()) for _ in range(5))
m=int(input())
cnt=0
for i in range(5):
  if l[i+1]-l[i]<=m:
    cnt+=1
print([":(","Yay!"][cnt==5])
Problem p03208 (python)

Fixed submission:
n,k=map(int,input().split())
lst=[int(input()) for _ in range(n)]
lst=sorted(lst)
ans=float("inf")
for i in range(n+1-k):
  ans=min(ans,lst[k-1+i]-lst[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
lst=[int(input()) for _ in range(n)]
lst=sorted(lst)
ab=lst[k-1]-lst[0]
cd=lst[-1]-lst[-k]
print(ans=min(ab,cd))
Problem p03252 (python)

Fixed submission:
a=input()
b=input()
dic_a={}
dic_b={}
for i in a:
    if i not in dic_a:
        dic_a[i]=1
    else:
        dic_a[i] += 1
for i in b:
    if i not in dic_b:
        dic_b[i]=1
    else:
        dic_b[i] += 1


print("Yes" if (sorted(dic_a.values())==sorted(dic_b.values())) else "No" )

Buggy submission (verdict: Runtime Error):
l=input()
m=input()
ll=set(l)-sei(m)
lll=set(m)-set(l)
print(["No","Yes"][len(ll)==len(lll)])
Problem p03327 (python)

Fixed submission:
print(["ABC","ABD"][len(input())==4])

Buggy submission (verdict: Runtime Error):
print(["ABD","ABC][len(input())==3])
Problem p03631 (python)

Fixed submission:
a=input()
print(["No","Yes"][a[0]==a[2]])

Buggy submission (verdict: Runtime Error):
a=input()
print(["No","Yes"][a[0]==a[2])
Problem p02793 (python)

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

def lcm(x, y):
    if x == 0 or y == 0:
        return 0
    else:
        return x // gcd(x, y) * y

def main():
    mod = int(1e9 + 7)
    n = int(input())
    a = list(map(int, input().split()))
    l = 1
    for i in range(n):
        l = lcm(l, a[i])

    ans = 0

    for i in range(n):
        ans += l // a[i]

    ans %= mod

    print(int(ans))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    while y > 0:
        tmp = x % y
        x = y
        y = tmp
    return x

def lcm(x, y):
    if x == 0 or y == 0:
        return 0
    else:
        return x / gcd(x, y) * y

def main():
    mod = int(1e9 + 7)
    n = int(input())
    a = list(map(int, input().split()))
    l = 1
    for i in range(n):
        l = lcm(l, a[i])

    ans = 0

    for i in range(n):
        ans += l // a[i]

    ans %= mod

    print(int(ans))

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

Fixed submission:
from math import sqrt

def IsPrime(n: int) -> bool:
    cnt = 2
    while cnt * cnt <= n:
        if n % cnt == 0:
            return False
        else:
            cnt += 1
    return True

def main():
    x = int(input())
    while True:
        if (IsPrime(x)):
            print(x)
            exit()
        else:
            x += 1

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sympy import prime, sieve

x = int(input())
pos = sieve.search(x)

if pos[0] == pos[1]:
    print(x)
else:
    print(prime(pos[1]))
Problem p02627 (python)

Fixed submission:
c=input()
if "A" <= c <= "Z":
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
c=input()
if "A"<=c&&c<="Z":
  print("A")
else:
  print("a")
Problem p02571 (python)

Fixed submission:
#!/usr/bin/env python

s = input()
t = input()

errors = []
for i in range(len(s)-len(t)+1):
    error = 0 
    for j in range(len(t)):
        if s[i+j] != t[j]:
            error += 1
    errors.append(error)
print(min(errors))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

s = input()
t = input()

errors = []
for i in range(len(s)-len(t)+1):
    error = 0 
    for j in range(len(t)):
        if s[i+j] != t[j]:
            error += 1
    errors.append(error)
print(min(errors)
Problem p02623 (python)

Fixed submission:
#!/usr/bin/env python3
# binary search 1

from bisect import bisect_left, bisect_right

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cumsum_b = [0 for _ in range(m+1)]
for i in range(1,m+1):
    cumsum_b[i] = cumsum_b[i-1] + b[i-1]
cumsum_a = [0 for _ in range(n+1)]
for i in range(1,n+1):
    cumsum_a[i] = cumsum_a[i-1] + a[i-1]

# print('cumsum_b =', cumsum_b)
ans = -1
for i in range(n+1):
    res = k-cumsum_a[i]
#    print('cumsum_a[{}] ='.format(i), cumsum_a[i])
#    print('res =', res)
    if res < 0:
        break
    bl = bisect_right(cumsum_b, res) - 1 
#    print('i =', i)
#    print('bl =', bl)
    tmp = i + bisect_right(cumsum_b, res) - 1 
    if ans <= tmp:
        ans = tmp 

print(ans)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0 
time = 0 

while time <= k:
#    print('time =', time)
#    print('a =', a)
#    print('b =', b)

    if len(a) > 0:
        if a[0] <= b[0]:
            if len(a) > 0:
                time += a[0]
                ans += 1
                a.pop(0)
            elif len(b) > 0:
                time += b[0]
                ans += 1
                b.pop(0)
        else:
            if len(b) > 0:
                time += b[0]
                ans += 1
                b.pop(0)
            elif len(a) > 0:
                time += a[0]
                ans += 1
                a.pop(0)

    elif len(b) > 0:
        time += b[0]
        ans += 1
        b.pop(0)

    if len(a) == 0 and len(b) == 0:
        break

if time == k:
    print(ans)
else:
    print(ans-1)
Problem p02831 (python)

Fixed submission:
#!/usr/bin/env python3
from fractions import gcd 
a, b = map(int, input().split())
print(int(a*b/gcd(a,b)))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import math
a, b = map(int, input().split())
print(int(a*b/math.gcd(a,b)))
Problem p02881 (python)

Fixed submission:
#!/usr/bin/env python3
import math
import numpy as np

n = int(input())
ans = np.inf
for i in range(1, int(math.sqrt(n))+1):
    if n%i==0:
        q = n//i
        tmp = i+q 
        if tmp <= ans:
            ans = tmp 
            i_ = i 
            q_ = q 

print(ans-2)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import math
import numpy as np

n = int(input())
ans = np.inf
for i in range(1, int(math.sqrt(n))):
    if n%i==0:
        q = n/i 
        tmp = i+q 
        if tmp <= ans:
            ans = tmp 
print(int(ans-2))
Problem p02729 (python)

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

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,m=map(int,input().split())
if n==0 or n==1:
    print(cmb(m,2))
    quit()
elif m==0 or m==1:
    print(cmb(n,2))
    quit()
print(cmb(n,2)+cmb(m,2))

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,m=map(int,input().split())
if n<2 and m<2:
    print(0)
    quit()
if n==0:
    print(cmb(m,2))
    quit()
elif m==0:
    print(cmb(n,2))
    quit()
print(cmb(n,2)+cmb(m,2))
Problem p02754 (python)

Fixed submission:
n,a,b=map(int,input().split())
rupu= n//(a+b)
amari=n%(a+b)
if amari>a :
    print(rupu*a+a)
else:
    print(rupu*a+amari)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
s=["b"]*a+["r"]*b 
rupu= n//len(s)
amari=n%len(s)
if amari>a :
    print(rupu*a+a)
else:
    print(rupu*a+amari)
Problem p02836 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
w = list(map(int,input().split()))
sum_w=sum(w)
sum_a=0
sa=[]
for i in range(n):
    sum_a += w[i]
    sa.append(abs(sum_w - sum_a * 2))
print(min(sa))
Problem p02970 (python)

Fixed submission:
n,p=map(int,input().split())
if n%(2*p+1)==0:
    print(n//(2*p+1))
else:
    print(n//(2*p+1)+1)

Buggy submission (verdict: Runtime Error):
n,p=map(int,input().split())
if n%(2p+1)==0:
    print(n//(2p+1))
else:
    print(n//(2p+1)+1)
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(input())
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
print("".join(s))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
if s[k-1]=="A":
    s[k-1]="a"
elif s[k-1]=="B":
    s[k-1]="b"
else:
    s[k-1]="c"
print(s)
Problem p03127 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
amin=min(a)
while len(a)>1:
    s=min(a)
    a = list(map(lambda x:x%s, a))
    a = [i for i in a if i > 0]+[s]
print(a[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
while len(a)>1:
    s=min(a)
    a = list(map(lambda x:x-min(a), a))
    a = [i for i in a if i != 0]+[s]
print(int(a))
Problem p03208 (python)

Fixed submission:
n,k=map(int,input().split())
l=[]
sa=[]
for i in range(n):
    h=int(input())
    l.append(h)
l.sort()
for i in range(n-k+1):
    sa.append(l[i+k-1]-l[i])
print(min(sa))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
sa=[]
ans=[]
for i in range(n):
    h=int(input())
    l.append(h)
l.sort()
for i in range(1,n):
    sa.append(abs(l[i]-l[i-1]))
for i in range(k-1):
    ans.append(sa[i+k-2]+sa[i])
print(min(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[]
sa=[]
ans=[]
for i in range(n):
    h=int(input())
    l.append(h)
for i in range(1,n):
    sa.append(l[i]-[i-1])
sa.sort()
sa.reverse()
for i in range(k-1):
    ans.append(sa[i])
print(min(ans))
Problem p02546 (python)

Fixed submission:
x=input()
if x[-1]=="s":
  print(f"{x}es")
else:
  print(f"{x}s")

Buggy submission (verdict: Runtime Error):
x=input()
if x[-1]="s":
  print(x"es")
else:
  print(x"s")