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

Fixed submission:
a, b, c, x, y =map(int,input().split())
if a + b <= 2*c :
  print(a*x +b*y)
else:
  if x <= y :
    print(min(2*x*c+(y-x)*b,2*y*c))
  else :
    print(min(2*y*c+(x-y)*a,2*x*c))

Buggy submission (verdict: Runtime Error):
a, b, c, x, y =map(int,input().split())
if a + b <= 2*c :
  print(a*x +b*y)
else:
  if x <= y :
    print(min(2*x*c+(y-x)*b,2*y*c)
  else :
    print(min(2*y*c+(x-y)*a,2*x*c)
Problem p03106 (python)

Fixed submission:
A, B, K = [int(x) for x in input().split()]

if A==1 or B==1:
    print(1)
else:
    div = [x for x in range(1, min(A,B)+1) if A%x==0 and B%x==0]
    print(div[-K])

Buggy submission (verdict: Runtime Error):
A, B, K = input().split()

if int(A)==1 or int(B)==1:
    print(1)
else:
    div = [x for x in range(1, min(int(A),int(B))) if int(A)%x==0 and int(B)%x==0]
    print(div[-int(K)])
Problem p03219 (python)

Fixed submission:
s = input().split()
x, y = int(s[0]), int(s[1])

print(int(x+y/2))

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())

print(int(x+y/2))
Problem p02995 (python)

Fixed submission:
import fractions

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

A -= 1

Z = ((C * D) // fractions.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)

Buggy submission (verdict: Runtime Error):
import math

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

A -= 1

Z = ((C * D) // math.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)

Buggy submission (verdict: Runtime Error):
import math

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

A -= 1

Z = (C * D // math.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)
Problem p02999 (python)

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

if X < A:
    print(0)
else:
    print(10)

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

total = 0
ans = 0
r = 0

for l in range(N):
    while total < K:

        if r >= N:
            break

        else:
            total += a[r]
            r += 1

    if total < K:
        break

    ans += N-r+1
    total -= a[l]

print(ans)
Problem p03000 (python)

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

cnt = 0
total = 0

for i in range(N):
    if total <= X:
        cnt += 1
        total += L[i]
    else:
        break
else:
    if total <= X:
        cnt += 1


print(cnt)

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

cnt = 0
total = 0
i = 0

while total <= X:
    cnt += 1
    total += L[i]
    i += 1

print(cnt)
Problem p03061 (python)

Fixed submission:
def GCD(a, b):
    if a == 0 and b == 0:
        return 0
    elif a == 0:
        return b
    elif b == 0:
        return a

    while a % b != 0:
        r = a % b
        a, b = b, r
    return b

ans = 0
N = int(input())
A = tuple(map(int,input().split()))

X = [0]*N
Y = [0]*N

for i in range(1,N):
    X[i] = GCD(X[i-1],A[i-1])
for i in range(N-1)[::-1]:
    Y[i] = GCD(Y[i+1],A[i+1])

for i in range(N):
    ans = max(ans,GCD(X[i],Y[i]))

print(ans)

Buggy submission (verdict: Runtime Error):
def GCD(a, b):
    while a % b != 0:
        r = a % b
        a, b = b, r
    return b

ans = 0
N = int(input())
A = tuple(map(int,input().split()))
A2 = tuple(set(A))

if len(A2) <= 2:
    A2 = (A2[0],A2[0])

for i in range(N-1):
    for j in range(i+1,N):
        ans = max(ans,GCD(A2[i],A2[j]))

print(ans)
Problem p03074 (python)

Fixed submission:
n,k = map(int,input().split())
s = tuple(input())

now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
nums =[]

for i in range(n):
    if s[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1    #見る値の切り替え
        cnt = 1

if cnt != 0:
    nums.append(cnt)

if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * k + 1
ans = 0
left = 0
right = 0
tmp = 0

for i in range(len(nums))[::2]:
    next_left = i
    next_right = min(i+add, len(nums))
    # 尺取法
    while next_left > left:
        tmp -= nums[left]
        left += 1
    while next_right > right:
        tmp += nums[right]
        right += 1
    ans = max(tmp,ans)

print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = tuple(input())

now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
nums =[]

for i in range(n):
    if s[i] == '0'+str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1    #見る値の切り替え
        cnt += 1

if cnt != 0:
    nums.append(cnt)

if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * k + 1
ans = 0
left = 0
right = 0
r_l_sum = 0
for i in range(len(nums))[::2]:
    next_left = i
    next_right = min(i+add,len(nums))
    # 尺取法
    while next_left > left:
        tmp -= nums[left]
        left += 1
    while next_right > right:
        tmp += nums[right]
        right += 1
    ans = max(tmp,ans)

print(ans)
Problem p02681 (python)

Fixed submission:
S=input()
T=input()

if T.startswith(S) and len(S) + 1 == len(T):
    print('Yes')
else:
    print('No')

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

tele=[0]*N
for i in range(N):
    tele[i]=list[i]-1

temp=[0]*N
town=0
for i in range(N):
    temp[i]=tele[town]
    town=tele[town]

for i in range(N):
    for j in range(N):
        if temp[i]-temp[j]==0:
            m=abs(i-j)
            break
K_temp=K%m

city=0
for i in range(K_temp):
    city=tele[city]

print(city+1)
Problem p02641 (python)

Fixed submission:
x,n=map(int,input().split())

if n==0:
    print(x)
else:
    p=list(map(int,input().split()))

    num=[1]*102
    count=1

    for i in p:
        num[i]=0   
    if num[x]==1:
        print(x)
    else:
        while True:
            if x-count>-1:
                if num[x-count]==1:
                    print(x-count)
                    break
            if x+count<103:
                if num[x+count]==1:
                    print(x+count)
                    break    
            count+=1

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

if n==0:
    print(x)
else:
    p=list(map(int,input().split()))

    num=[1]*101
    count=1

    for i in p:
        num[i]=0   
    if num[x]==1:
        print(x)
    while True:
        if x-count>-1:
            if num[x-count]==1:
                print(x-count)
                break
        if x+count<102:
            if num[x+count]==1:
                print(x+count)
                break    
        count+=1
Problem p02690 (python)

Fixed submission:
x=int(input())
for i in range(1000):
  for j in range(1000):
    if i**5-j**5==x:
      a,b=i,j
      break
else:
  for k in range(1000):
    for l in range(1000):
      if k**5+l**5==x:
        a,b=k,(-1)*l
        break
        
print(a,b)

Buggy submission (verdict: Runtime Error):
x=int(input())
count=0
hugou=1
while True:
  y=(x+count**5)**(1/5)
  if int(y)==y:
    break
  y=(x+((-1)*count)**5)**(1/5)
  if int(y)==y:
    hugou*=(-1)
    break
  count+=1
  
print(int(y),hugou*count)

Buggy submission (verdict: Runtime Error):
x=int(input())
count=0
hugou=1
while True:
  y=(x+count**5)**(1/5)
  if int(y)==y:
    break
  y=(x+((-1)*count)**5)**(1/5)
  if int(y)==y:
    hugou*=(-1)
    break
  count+=1
  
print(int(y),hugou*count)

Buggy submission (verdict: Runtime Error):
x=int(input())
count=0
hugou=1
while True:
  y=(x+count**5)**(1/5)
  if int(y)==y:
    break
  y=(x+((-1)*count)**5)**(1/5)
  if int(y)==y:
    hugou*=(-1)
    break
  count+=1
  
print(int(y),hugou*count)
Problem p02742 (python)

Fixed submission:
import math
n,w=map(int,input().split())
if n==1 or w==1:
    print(1)
else:
    ans=math.ceil(w/2)*math.ceil(n/2)+(w//2)*(n//2)
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
n,w=map(int,input().split())
if n==1 or w==1:
    print(1)
else:
    ans=math.ceil(w/2)*math.ceil(n/2)+(w//2)*(n//2)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n,w=map(int,input().split())
if h==1 or w==1:
    print(1)
else:
    ans=math.ceil(w/2)*math.ceil(n/2)+(w//2)*(n//2)
print(ans)
Problem p02783 (python)

Fixed submission:
h,a=map(int,input().split())
if h%a==0:
    print(h//a)
else:
    print(1+h//a)

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
a=list(map(int,input().split()))
sum=0
for i in range(n):
    sum+=a[i]
print('Yes' if sum>=h else 'No')
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(input().split())
print(a+b if b%a==0 else b-a)
Problem p02630 (python)

Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

num = collections.Counter(A)

S = sum(A)
slist = []

for i in range(Q):
	B, C = map(int, input().split())
	numb = num[B]
	S += (C - B) * numb
	num[C] += numb
	num[B] = 0
	slist.append(S)

[print(i) for i in slist]

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

num = []

for i in range(1, 100000):
	num.append(A.count(i))

S = sum(A)
slist = []

for i in range(Q):
	B, C = map(int, input().split())
	numb = num[B-1]
	S += (C - B) * numb
	num[C-1] += numb
	num[B-1] = 0
	slist.append(S)

[print(i) for i in slist]

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

num = []

for i in range(1, 100000):
	# 行列Aの要素にiが何個あるか数えてnumに追加
	num.append(A.count(i))

S = sum(A)
slist = []

for i in range(Q):
	B, C = map(int, input().split())
	numb = num[B-1]
	S += (C - B) * numb
	num[C-1] += numb
	num[B-1] = 0
	slist.append(S)

[print(i) for i in slist]

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input()))
q = int(input())
count = 0

for i in range(q):
	count = 0
	b, c = map(int, input().split())
	for a in l:
		if a == b:
			l[count] = c
		print(sum(l))
		count++
Problem p02657 (python)

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

x=a*b
print(x)

Buggy submission (verdict: Runtime Error):
A=input()
B=input()
a=int(A)
b=int(B)
x=a*b
print(x)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
x=A*B
print(x)

Buggy submission (verdict: Runtime Error):
A=input()
B=input()
x=A*B
print(x)
Problem p02657 (python)

Fixed submission:
number = list(map(int, input().split()))
print(number[0] * number[1])

Buggy submission (verdict: Runtime Error):
a,b = list(map(float, input().split()))
aint = int(a)
print('{}'.format(round(aint * number[1])))

Buggy submission (verdict: Runtime Error):
number = int(input()).split('')
print(number[0] * number[1])
Problem p02658 (python)

Fixed submission:
n = int(input())
number = list(map(int, input().split()))
seki = 1
if 0 in number:
  seki = 0
else:
  for i in number:
    seki = seki*i
    if seki > 10 ** 18:
      seki = -1
      break
    else:
      continue
print(seki)

Buggy submission (verdict: Runtime Error):
n = int(input())
number = list(map(int, input().split()))
seki = 0
seki2 = -1
for i in number:
  seki = seki*i
 if seki > 10 ** 18:
  print(seki2)
 else:
  print(seki)

Buggy submission (verdict: Runtime Error):
n = int(input())
number = list(map(int, input().split()))
seki = 0
seki2 = -1
for i in numebr:
  seki = seki*i
 if seki > 10 ** 18:
  print(seki2)
 else:
  print(seki)
Problem p02675 (python)

Fixed submission:
n = input()
slist = list(n)
number = int(slist[len(slist) - 1])

if number == 3:
  print('bon')
elif number == 0 or number == 1 or number == 6 or number == 8:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
import math
a, b, h, m = map(int, input().split())
hrad = h * 30 + m * 0.5
mrad = m * 6
rad = hrad - mrad
if rad < 0:
    rad = -rad
else:
    if rad > 180:
        rad = 360 - rad
    else:
        pass
c = float((a**2 + b**2 - 2 * a * b * math.cos(math.radians(rad))) ** (0.5))
print(c)

Buggy submission (verdict: Runtime Error):
s = input()
slist = list(s)


number = int(slist(len(slist) - 1))

if number == 3:
  print('bon')
elif number == 0 or number == 1 or number == 6 or number == 8:
  print('pon')
else:
  print('hon')
Problem p02677 (python)

Fixed submission:
import math
a, b, h, m = map(int, input().split())
hrad = h * 30 + m * 0.5
mrad = m * 6
rad = hrad - mrad
if rad < 0:
    rad = -rad
else:
    if rad > 180:
        rad = 360 - rad
    else:
        pass
c = float((a**2 + b**2 - 2 * a * b * math.cos(math.radians(rad))) ** (0.5))
print(c)

Buggy submission (verdict: Runtime Error):
import math
param = list(map(int, input()))
a = param[0]
b = param[1]
h = param[2]
m = param[3]
hrad = ( h / 12 ) * 360 + ( m / 60) * 30
mrad = ( m / 60 ) * 360
rad = hrad - mrad
print(rad)
if rad < 0:
    rad = -rad
else:
    if rad > 180:
        rad = 360 - rad
    else:
        pass
print(rad)
c = float((a**2 + b**2 - 2 * a * b * math.cos(math.radians(rad))) ** (0.5))
print(c)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
slist = list(s)
tlist = list(t)
pas = 'Yes'
for i in range(len(slist)):
  if slist[i] != tlist[i]:
    pas = 'No'
    break
  else:
    continue
print(pas)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
slist = list(s)
tlist = list(t)
pass = 'Yes'
for i in range(len(slist)):
  if slist[i] != tlist[i]:
    pass = 'No'
  else:
    continue
print(pass)
Problem p02952 (python)

Fixed submission:
n = int(input())
c = 0
for i in range(1, n+1):
  if len(list(str(i))) % 2 != 0:
    c += 1

print(c)

Buggy submission (verdict: Runtime Error):
n int(input())
c = 0
for i in range(1, n+1):
  if len(list(str(i))) % 2 != 0:
    c += 1

print(c)
Problem p02641 (python)

Fixed submission:
x,n=map(int,input().split())
if(n==0):
  print(x)
else:
    l=[]
    l1=[]
    li=list(map(int,input().split()))
    for i in range(n+1):
        if x-i not in li:
            l.append(x-i)
        if x+i not in li:
            l1.append(x+i)
    a=max(l)
    b=min(l1)
    if(abs(a-x)>abs(b-x)):
        print(b)
    else:
        print(a)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
if(n==0):
  print(x)
else:
    l=[]
    l1=[]
    li=list(map(int,input().split()))
    for i in range(n):
        if x-i not in li:
            l.append(x-i)
        if x+i not in li:
            l1.append(x+i)
    a=max(l)
    b=min(l1)
    if(abs(a-x)>abs(b-x)):
        print(b)
    else:
        print(a)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
if(n==0):
  print(x)
else:
    l=[]
    l1=[]
    li=list(map(int,input().split()))
    for i in range(n):
        if x-i not in li:
            l.append(x-i)
        if x+i not in li:
            l1.append(x+i)
    a=max(l)
    b=min(l1)
    if(abs(a-x)>abs(b-x)):
        print(b)
    else:
        print(a)
Problem p03005 (python)

Fixed submission:
n,k = map(int, input().split(" "))
if k == 1:
  print(0)
else:
  print(n - k)

Buggy submission (verdict: Runtime Error):
n,k = map(int, iuput().split(" "))
if k == 1:
  print(0)
else:
  print(n - k)
Problem p03006 (python)

Fixed submission:
N = int(input())
xlist = []
ylist = []
pqlist = []
pqcount = {}
for i in range(N):
  x, y = map(int, input().split(" "))
  xlist.append(x)
  ylist.append(y)

for i in range(N):
  for j in range(i+1, N):
    p = xlist[i] - xlist[j]
    q = ylist[i] - ylist[j]
    tuple_pq = (p, q,)
    if (-p, -q,) in pqlist:
      tuple_pq = (-p, -q)
    if not (tuple_pq in pqlist):
      pqlist.append(tuple_pq)
      pqcount[tuple_pq] = 1
    else:
      pqcount[tuple_pq] += 1

if N == 1:
  print(1)
else:
  print(N - max(pqcount.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
xlist = []
ylist = []
pqlist = []
pqcount = {}
for i in range(N):
  x, y = map(int, input().split(" "))
  xlist.append(x)
  ylist.append(y)

for i in range(N):
  for j in range(i+1, N):
    p = xlist[i] - xlist[j]
    q = ylist[i] - ylist[j]
    tuple_pq = (p, q,)
    if not (tuple_pq in pqlist):
      pqlist.append(tuple_pq)
      pqcount[tuple_pq] = 1
    else:
      pqcount[tuple_pq] += 1

if N == 1:
  print(1)
else:
  print(N - max(pqcount.vzalues()))

Buggy submission (verdict: Runtime Error):
N = int(input())
xlist = []
ylist = []
pqlist = []
pqcount = {}
for i in range(N):
  x, y = map(int, input().split(" "))
  xlist.append(x)
  ylist.append(y)

for i in range(N-1):
  for j in range(i+1, N):
    p = xlist[i] - xlist[j]
    q = ylist[i] - ylist[j]
    tuple_pq = (p, q,)
    if not (tuple_pq in pqlist):
      pqlist.append(tuple_pq)
      pqcount[tuple_pq] = 1
    else:
      pqcount[tuple_pq] += 1

print(N - max(pqcount.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
xlist = []
ylist = []
pqlist = []
pqcount = {}
for i in range(N):
  x, y = map(int, input().split(" "))
  xlist.append(x)
  ylist.append(y)

for i in range(N):
  for j in range(i+1, N):
    p = xlist[i] - xlist[j]
    q = ylist[i] - ylist[j]
    tuple_pq = (p, q,)
    if not (tuple_pq in pqlist):
      pqlist.append(tuple_pq)
      pqcount[tuple_pq] = 1
    else:
      pqcount[tuple_pq] += 1

print(N - max(pqcount.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
x_1, y_1 = map(int, input().split(" "))
x_2, y_2 = map(int, input().split(" "))
p, q = (x_2 - x_1), (y_2 - y_1)
cost = 1
before_x, before_y = x_2, y_2
for i in range(2, N):
  x, y = map(int, input().split(" "))
  if (x - p != before_x) | (y - q != before_y):
    cost += 1
  before_x, before_y = x, y
  
print(cost)
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split(" "))
print((3 * A + P) // 2)

Buggy submission (verdict: Runtime Error):
A, P = map(int, input.split(" "))
print((3 * A + P) // 2)
Problem p03059 (python)

Fixed submission:
loop, kosu, time = map(int, input().split(" "))
print(kosu * (time//loop))

Buggy submission (verdict: Runtime Error):
loop, kosu, time = map(int, input().split(" "))
print(kosu * (time//loop)
Problem p02639 (python)

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

for i in range (len(D)):
    if D[i]==0:
        print(i+1)

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

for i in D:
    if D[i]==0:
        print(i)
Problem p02801 (python)

Fixed submission:
C=input()
lst=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
print(lst[lst.index(C)+1])

Buggy submission (verdict: Runtime Error):
C=input()
lst=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
print(lst[lst.index(C)+1])

Buggy submission (verdict: Runtime Error):
C=input()
lst=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","v","w","x","y"]
print(lst[lst.index(C)+1])
Problem p02993 (python)

Fixed submission:
s=list(input())

def judge(s):        
    for i in range(len(s)-1):
        if s[i]==s[i+1]:
            return 'Bad'
        else:
            continue
    return 'Good'
print(judge(s))

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

if S[0]==S[1]:
  print('Bad')
elif S[1]==S[2]:
  print('Bad')
elif S[2]==S[3]:
  print('Bad')
else:
  print('Good')
Problem p02995 (python)

Fixed submission:
import fractions

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

cc = (B//C)-((A-1)//C)
dd = (B//D)-((A-1)//D)

x= (C * D // fractions.gcd(C, D))
ee = (B//x)-((A-1)//x)

ans = (B-A+1)-(cc + dd - ee)
print(int(ans))

Buggy submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return ((x * y)//math.gcd(x, y))

cc = (B//C)-((A-1)//C)
dd = (B//D)-((A-1)//D)

x = lcm(C,D)
ee = (B//x)-((A-1)//x)

ans = (B-A+1)-(cc + dd - ee)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

cc = (B//C)-((A-1)//C)
dd = (B//D)-((A-1)//D)

x = lcm(C,D)
ee = (B//x)-((A-1)//x)

ans = (B-A+1)-(cc + dd - ee)
print(ans)
Problem p03037 (python)

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

left = []
right= []

for i in range(M):
    L, R = map(int, input().split())
    left.append(L)
    right.append(R)

l = max(left)
r = min(right)

if l <= r:
    print(r-l+1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
left=0
right=N

for i in range(N):
    L, R = map(int, input().split())
    if L > left:
        left = L
    if R < right:
        right = R

if left <= right:
    print(right-left+1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
left=0
right=0

for i in range(N):
    L, R = map(int, input().split())
    if L > left:
        left = L
    if R < left:
        right = R

if left <= right:
    print(right-left+1)
else:
    print(0)
Problem p02732 (python)

Fixed submission:
import collections


m = int(input())
A = list(map(int,input().split()))[:m]
c = collections.Counter(A)
 
def hoge(n):
    return n * (n - 1) // 2

full = sum([ hoge(i) for i in c.values()])

for a in A:
    print(full - hoge(c[a]) + hoge(c[a]-1))

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

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

m = int(input())
a = list(map(int,input().split()))[:m]
c = collections.Counter(a)

memo = {}
rmemo = {}

for i in a:
    if not rmemo.get(i):
        print(rmemo[i])
        continue

    res = 0
    for k,v in c.items():
        if i == k: v -= 1
        
        if v >= 2:
            if not memo.get(v):
                memo[v] = combinations_count(v, 2)

            res += memo[v]
    rmemo[i] = res
    print(res)
Problem p02811 (python)

Fixed submission:
k,x = map(int,input().split())

if 500*k >= x:
    print('Yes')
else:
    print('No')

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

print(b.count('ABC'))
Problem p02818 (python)

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

a = a - k

if a < 0:
    b = 0 if b+a <0 else  b+a
    a=0
print (a,b)

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

aa = a - k
if aa < 0:
    bb = 0 if b+aa <0 else  b+aa
    aa=0

print (aa,bb)

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

aa = a - k
if aa < 0:
    bb=b+aa
    aa=0

print (aa,bb)
Problem p02838 (python)

Fixed submission:
# import numpy as np
n=int(input())
# a=np.array(list(map(int,input().split())))
a=list(map(int,input().split()))

ans=0
mod=10**9+7
for i in range(60):
    x=0
    for j in range(n):
        if (a[j] >>i&1) :x+=1

    now = x*(n-x) % mod

    for j in range(i):
        now = now*2 % mod
    ans += now
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))

ans=0
mod=10**9+7
for i in range(60):
    x=0
    for j in range(n):
        if (a[j] >>i&1) :x+=1

    now = x*(n-x) % mod

    for j in range(i):
        now = now*2 % mod
    ans += now
    ans %= mod

print(ans)