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

Fixed submission:
N, M = map(int, input().split())
stu = []
for _ in range(N):
  stu.append(tuple(map(int, input().split())))
che = []
for _ in range(M):
  che.append(tuple(map(int, input().split())))

for i in range(N):
  ans = 0
  min_l = pow(10, 10)
  for j in range(M):
    l = abs(stu[i][0] - che[j][0]) + abs(stu[i][1] - che[j][1])
    if l < min_l:
      min_l = l
      ans = j+1
  print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
stu = []
for _ in range(N):
  stu.append(tuple(map(int, input().split())))
che = []
for _ in range(M):
  che.append(tuple(map(int, input().split())))

for i in range(N):
  ans = 0
  min_l = pow(10, 10)
  for j in range(M):
    l = abs(stu[i][0] - che[i][0]) + abs(stu[i][1] - che[i][1])
    if l < min_l:
      min_l = l
      ans = j+1
  print(ans)
Problem p03804 (python)

Fixed submission:
N, M = map(int, input().split())
n = []
m = []
for i in range(N):
  s = str(input())
  row = []
  for j in range(N):
    if s[j] == "#":
      row.append(1)
    else:
      row.append(0)
  n.append(row)
for i in range(M):
  s = str(input())
  row = []
  for j in range(M):
    if s[j] == "#":
      row.append(1)
    else:
      row.append(0)
  m.append(row)
 
def search(a,b):
  mr = mc = 0
  for r in range(a, a+M):
    for c in range(b, b+M):
      if n[r][c] != m[mr][mc]:
        return False
      mc += 1
    mr += 1
    mc = 0
  return True

ans = 0
for i in range(N-M+1):
  for j in range(N-M+1):
    if search(i,j):
      ans = 1
      break
  if ans:
    break
if ans:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
n = []
m = []
for i in range(N):
  s = str(input())
  row = []
  for j in range(N):
    if s[i] == "#":
      row.append(1)
    else:
      row.append(0)
  n.append(row)
for i in range(M):
  s = str(input())
  row = []
  for j in range(M):
    if s[i] == "#":
      row.append(1)
    else:
      row.append(0)
  m.append(row)
 
def search(a,b):
  mr = mc = 0
  for r in range(a, a+M):
    for c in range(b, b+M):
      if n[r][c] != m[mr][mc]:
        return False
      mc += 1
    mr += 1 
  return True

ans = 0
for i in range(N-M+1):
  for j in range(N-M+1):
    if search(i,j):
      ans = 1
      break
  if ans:
    break
if ans:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
n = []
m = []
for i in range(N):
  s = str(input())
  row = []
  for j in range(N):
    if s[i] == "#":
      row.append(1)
    else:
      row.append(0)
  n.append(row)
for i in range(M):
  s = str(input())
  row = []
  for j in range(M):
    if s[i] == "#":
      row.append(1)
    else:
      row.append(0)
  m.append(row)
 
def search(a,b):
  for r in range(a, a+M-1):
    for c in range(b, b+M-1):
      #print(r,c)
      if n[r][c] != m[r][c]:
        return False
  return True
#print(n, m)
ans = 0
for i in range(N-M+1):
  for j in range(N-M+1):
    if search(i,j):
      ans = 1
      break
  if ans:
    break
if ans:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
n = []
m = []
for i in range(N):
  s = str(input())
  row = []
  for j in range(N):
    if s[i] == "#":
      row.append(1)
    else:
      row.append(0)
  n.append(row)
for i in range(M):
  s = str(input())
  row = []
  for j in range(M):
    if s[i] == "#":
      row.append(1)
    else:
      row.append(0)
  m.append(row)

def search(a,b):
  for r in range(a, a+M):
    for c in range(b, b+M):
      if n[r][c] != m[r][c]:
        return False
  return True
  
ans = 0
for i in range(N-M):
  for j in range(N-M):
    if search(i,j):
      ans = 1
      break
  if ans:
    break
if ans:
  print("Yes")
else:
  print("No")
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())

print(6-A-B)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input())

print(6 - A - B)
Problem p02831 (python)

Fixed submission:
from fractions import gcd 

A,B = list(map(int,input().split()))

def lcm(A, B):
    return (A * B) // gcd(A, B)

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
import math

A,B = int(input().split())

def lcm(A, B):
    return (A * B) // math.gcd(A, B)

print(lcm(a, b))
Problem p02859 (python)

Fixed submission:
r = int(input())


print(r*r)

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

print(r*r)

Buggy submission (verdict: Runtime Error):
def main(r):
  return r*r
  
  

if __name__ == '__main__':
  r = input()
  main()

Buggy submission (verdict: Runtime Error):

def main(r):
  return r*r
  

if __name__ == '__main__':
  r = int(input())
  main()
Problem p02785 (python)

Fixed submission:
n, k = list(map(int, input().split(' ')))
h_arr = sorted(list(map(int, input().split(' '))),reverse=True)
 
if n <= k:
  print('0')
else:
  print(sum(h_arr[k:]))

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split(' ')))
h_arr = list(map(int, input().split(' '))).sorted(reverse=True)

if n <= k:
  print('0')
else:
  print(sum(h_arr[k:]))
Problem p02785 (python)

Fixed submission:
import math

EnemyCount, slayeCount = map(int, input().split())
enemyHealths = list(map(int, input().split(" ")))
enemyHealths.sort()

if EnemyCount < slayeCount:
    slayeCount = EnemyCount

for _ in range(slayeCount):
    del enemyHealths[-1]

print(sum(enemyHealths))

Buggy submission (verdict: Runtime Error):
import math

EnemyCount, slayeCount = map(int, input().split())
enemyHealths = list(map(int, input().split(" "))).sort()

if EnemyCount < slayeCount:
    slayeCount = EnemyCount

for _ in range(slayeCount):
    del enemyHealths[-1]

print(sum(enemyHealths))
Problem p02879 (python)

Fixed submission:
A,B = (int(num) for num in input().split())
if A>9  or B>9:
    print(-1)
else:
    print(A*B)

Buggy submission (verdict: Runtime Error):
import math

a,b,x = (int(num) for num in input().split())
suf2 = a*b
vol = a*a*b
if (vol/2)>=x:
    l = x*2 / suf2
    x = b/l
    ans = math.degrees(math.atan(x))
else:
    l = (vol-x)*2 / (a*a)
    x = l/a
    ans = math.degrees(math.atan(x))
    
print(round(ans,6))
Problem p02881 (python)

Fixed submission:
import math

raw = input()
N = int(raw)
n = math.sqrt(N)
a,b = math.modf(n)
m = int(b)

count = N - 1

for i in range(m,1,-1):
    if (N % i)==0:
        ans = i + (N // i) -2
        count = ans
        break

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
n = np.sqrt(N)
m = int(n)

count = N - 1
for i in range(n,2,-1):
    if (N % i)==0:
        ans = i +(N % i) -2
        count = ans
        break

print(ans)
Problem p02836 (python)

Fixed submission:
from math import floor, ceil

S = input()
a = S[:floor(len(S)/2)]

n = 0
for i in range(floor(len(S)/2)):
    if not a[i] == S[-(i+1)]:
        n += 1
    
print(n)

Buggy submission (verdict: Runtime Error):
from math import floor, ceil

S = input()
a = S[:floor(len(S)/2)]

n = 0
for i in range(floor(len(S)/2)):
    if not a[i] == S[-(i+1)]:
        n += 1
    
print(n)
Problem p02987 (python)

Fixed submission:
s=list(input())
s=set(s)
if (len(s) == 2):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
s=string(set(s))
if (len(s) != 2):
  print("NO")
  else:
    print("YES")
Problem p03104 (python)

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

def f(n):
    ret=[]
    for i in range(1,49):
        a = 2**i
        b = (n+a//2)//a
        if a>(n+a//2):
            break
        c = (b-1)*(2**(i-1)) + min((n+a//2)-a*b+1, a//2)
        ret.append(c)
    return ret

l1 = f(B)
l2 = f(A-1) if A>0 else []
l2 += [0]*(len(l1)-len(l2))
l3 = []
for i in range(len(l1)):
    l3.append((l1[i]-l2[i])%2)

ans = 0

for i in range(len(l3)):
    ans += (2**i)*l3[i]

print(ans)

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

def f(n):
    ret=[]
    for i in range(1,49):
        a = 2**i
        b = (n+a//2)//a
        if a>(n+a//2):
            break
        c = (b-1)*(2**(i-1)) + min((n+a//2)-a*b+1, a//2)
        ret.append(c)
    return ret

if A==0:
    y = f(B)
if A>0:
    l1 = f(B)
    l2 = f(A-1)
    l2 += [0]*(len(l1)-len(l2))
    l3 = []
    for i in range(len(l1)):
        l3.append((l1[i]-l2[i])%2)

ans = 0

for i in range(len(l3)):
    ans += (2**i)*l3[i]

print(ans)
Problem p02847 (python)

Fixed submission:
S = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
s = input()
print(7-S.index(s))

Buggy submission (verdict: Runtime Error):
S = ["SUN","MON","TUE","WED","THU","FRT","SAT"]
s = input()
print(7-S.index(s))
Problem p02897 (python)

Fixed submission:
a = int(input())
if a%2 == 0:
    print(0.5)
else:
    b = (int(a/2)+1)/a
    print(b)

Buggy submission (verdict: Runtime Error):
n = map(int,input().split(" "))
if n==1:
    print("1.0")
elif n%2 == 0:
    print("0.5")
else:
    print("0.6")

Buggy submission (verdict: Runtime Error):
a = map(int,input().split(" "))
if a==1:
    print("1")
elif a%2 == 0:
    print("0.5")
else:
    print("0.6")
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e-a>k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=map(int,input().split())
if e-a>k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=map(int,input().split())
if abs(a-e)>k:
    print(":(")
else:
    print("Yay!")
Problem p02819 (python)

Fixed submission:
import math 

def is_prime(n):
	if n == 1:
		return False
		
	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False
			
	return True
	
n = int(input())

X = n

for i in range(n,10**6):
	if is_prime(i):
		break
		
print(i)

Buggy submission (verdict: Runtime Error):
from sympy import nextprime
from sympy import isprime

X = int(input())

if isprime(X) == True:
	print(nextprime(X))
else:
	print(X)
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):
A, B) = map(int, input().split(' '))
if A < 10 and B < 10:
    print(A * B)
else:
    print('-1')
Problem p02880 (python)

Fixed submission:
N = int(input())
for a in range(1, 10):
    flag = False
    for b in range(1, 10):
        if a * b == N:

            flag = True
            break
    if flag:
        break
if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
for a in range(1, 10):
    for b in range(1, 10):
        if a * b == N:
            print('yes')
        else:
            print('No')
Problem p02835 (python)

Fixed submission:
#coding: utf-8

value = input()

list = value.split()

for i in range(len(list)):
  list[i] = int(list[i])
  
sum = list[0] + list[1] + list[2]

if sum >= 22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
#coding: utf-8

value = input()

list = value.split()

for i in range(len(lise)):
  list[i] = int(list[i])
  
sum = list[0] + list[1] + list[2]

if sum >= 22:
  print("bust")
else:
  print("win")
Problem p03135 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
t = 0
for l in L :
    t += l
t = t - max(L)

    
if max(L) < t:
  print("Yes")
else :
  print("No")
Problem p03327 (python)

Fixed submission:
N = int(input())

if (N<=999) :
    print('ABC')
else :
    print('ABD')

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

c = b - a
y = 0
for i in range(c+1):
    y = y + i

print(y-b)
Problem p02879 (python)

Fixed submission:
i = list(map(int, input().split()))
if ((i[0] >= 1 and i[0] <= 9) and (i[1] >= 1 and i[1] <= 9)):
    print (i[0] * i[1])
else:
    print (-1)

Buggy submission (verdict: Runtime Error):
i = list(map(int, input().split()))
if ((i[0] >= 1 and i[0] <= 9) and (i[1] >= 1 and i[1] <= 9)):
    print (i[0] * i[1])
else:
    print -1
Problem p02831 (python)

Fixed submission:
import fractions
A,B =[int(i) for i in input().split()]
result = (A*B) // fractions.gcd(A, B)
print(result)

Buggy submission (verdict: Runtime Error):
import math
A,B =[int(i) for i in input().split()]
result = (A*B) // math.gcd(A, B)
print(result)
Problem p02792 (python)

Fixed submission:
n=int(input())
t=[[0]*10 for _ in range(10)]
for i in range(1,n+1):
  t[int(str(i)[0])][i%10]+=1
a=0
for i in range(10):
  for j in range(10):
    a+=t[i][j]*t[j][i]
print(a)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=0
for i in range(1,n+1):
  for j in range(i,n+1):
    if str(i)[0]==str(j)[-1] and str(j)[0]==str(i)[-1]:
      a++
print(a)
Problem p02836 (python)

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

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

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
happiness = 0

for i in range(0, N, 1):
  if i > 0:
    if A[i-1] == (A[i]-1):
      happiness += (B[A[i]-1]+C[A[i]-2])
    else:
      happiness += B[A[i]-1]
  else:
    happiness += B[A[i]-1]
print(happiness)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
happiness = 0

for i in range(0, N, 1):
  if i > 0:
    if A[i-1] == (A[i]-1):
      happiness += (B[A[i]]+C[i-1])
  else:
    happiness += B[A[i]-1]
print(happiness)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
happiness = 0

for i in range(0, N, i++):
  if(A[N-1]==A[N]-1):
    happiness += (B[A[N]]+C[N-1])
  else:
    happiness += B[A[N]]
print(happiness)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
happiness = 0

for i in range(0, N, i++):
  if(A[N-1]==A[N]-1):
    happiness += (B[A[N]]+C[N-1])
  else:
    happiness += B[A[N]]
Problem p02785 (python)

Fixed submission:
class Main:
    s = list(map(int, input().split()))
    n = s[0]
    k = s[1]
    sum = 0
    kSum = 0
    list = [int(i) for i in input().split()]
    newList = sorted(list, reverse=True)
    list[:k]
    for num in newList:
        sum += num
    for kNum in newList[:k]:
        kSum += kNum
    print(sum-kSum)

Buggy submission (verdict: Runtime Error):
class Main:
    s = list(map(int, input().split()))
    n = s[0]
    k = s[1]
    sum = 0
    ksum=0
    list = [int(i) for i in input().split()]
    list = sorted(1, reverse=True)
    list[:k]
    for num in list:
        sum += num
    for knum in list[:k]:
        ksum += knum
    print(sum-ksum)
Problem p02785 (python)

Fixed submission:
s = input().split()
N = int(s[0])
K = int(s[1])

H = list(map(int, input().split()))
H_s = sorted(H, reverse=True)

print(sum(H_s[K:]))

Buggy submission (verdict: Runtime Error):
s = input().split()
N = int(s[0])
K = int(s[1])

H = list(map(int, input().split()))

H_s = sorted(H, reverse=True)
H_s[:N] = 0

print(sum(H_s))

Buggy submission (verdict: Runtime Error):
s = input().split()
N = int(s[0])
K = int(s[1])

H = input().split()

H_s = sorted(H, reverse=True)
H_s[:N] = 0

print(sum(H_s))
Problem p02935 (python)

Fixed submission:
n = int(input())
v = list(map(int, input().split()))
 
for i in range(n-1):
  mn1 = min(v)
  v.remove(min(v))
  mn2 = min(v)
  v.remove(min(v))
  v.append((mn1 + mn2) / 2.0)
 
print(v[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))
 
for i in range(n-1):
	mn1 = v.remove(min(v))
	mn2 = v.remove(min(v))
	v.append((mn1 + mn2) / 2)
 
print(v[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split()))
 
for i in range(n-1):
	mn1 = v.remove(min(v))
    mn2 = v.remove(min(v))
    v.append((mn1 + mn2) / 2)
 
print(v[0])

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

for i in range(n-1):
	mn1 = v.remove(min(v))
    mn2 = v.remove(min(v))
    v.append((mn1 + mn2) / 2)

print(v[0])
Problem p03127 (python)

Fixed submission:
# gcd
def gcd(a, b):
	return gcd(b, a % b) if b != 0 else a

N = int(input())
L = [int(x) for x in input().split()]

max_gcd = L[0]

for i in range(1, N):
    max_gcd = gcd(max_gcd, L[i])

print(max_gcd)

Buggy submission (verdict: Runtime Error):
# gcd
def gcd(a, b):
	return gcd(b, a % b) if b != 0 else a

L = [int(x) for x in input().split()]

max_gcd = L[0]

for i in range(1, N):
    max_gcd = gcd(max_gcd, L[i])

print(max_gcd)
Problem p02831 (python)

Fixed submission:
from sys import stdin
import fractions

A, B = [int(x) for x in stdin.readline().rstrip().split()]

print((A * B) // fractions.gcd(A, B))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math

# A = int(stdin.readline().rstrip())
A, B = [int(x) for x in stdin.readline().rstrip().split()]
# print(A, B)

if A < B:
    A, B = B, A

print((A * B) // math.gcd(A, B))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math

# A = int(stdin.readline().rstrip())
A, B = [int(x) for x in stdin.readline().rstrip().split()]
# print(A, B)

print((A * B) // math.gcd(A, B))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math

A, B = [int(x) for x in stdin.readline().rstrip().split()]


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


print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math

# A = int(stdin.readline().rstrip())
A, B = [int(x) for x in stdin.readline().rstrip().split()]
# print(A, B)


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


print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math

# A = int(stdin.readline().rstrip())
A, B = [int(x) for x in stdin.readline().rstrip().split()]
# print(A, B)


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


print(lcm(A, B))
Problem p02832 (python)

Fixed submission:
from sys import stdin
import fractions

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
# print(N)
# print(A)
nex = 1
ans = 0

for i in range(N):
    if A[i] == nex:
        nex += 1
    else:
        ans += 1

print(-1) if N == ans else print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin
import fractions

N = stdin.readline().rstrip().split()
A = [int(x) for x in stdin.readline().rstrip().split()]
# print(N)
# print(A)
nex = 1
ans = 0

for i in range(N):
    if A[i] == nex:
        nex += 1
    else:
        ans += 1

print(-1) if N == ans else print(ans)
Problem p03011 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
NM = input()
N, M = NM.split(" ")
del NM
N, M = int(N), int(M)
broken_steps = [int(input()) for num in range(M)]
#all_steps = [num for num in range(N+1)]
all_steps = np.ones(N+1, dtype=np.int64)  ##np.int32だと足りない
all_steps[broken_steps] = 0
ok_steps = list(all_steps)
#ok_steps = [0 if num in broken_steps else 1 for num in range(len(all_steps))]
#for num in range(len(all_steps)):
#  if num in broken_steps:
#    ok_steps.append(0)
#  else:
#  	ok_steps.append(1)
#del all_steps, broken_steps
#print(ok_steps)
for num in range(0, len(ok_steps)):
  i = - (num + 1)
  
  if (i==-1 or i==-2):
    pass
  else:
    if ok_steps[i]==0:
      pass
    else:
      ok_steps[i] = ok_steps[i+1] + ok_steps[i+2]
      

#for num in range(0, len(ok_steps)):
#  i = - (num + 1)
#  
#  if (i==-1 or i==-2):
#    pass
#  else:
#    if ok_steps[i]==0:
#      pass
#    else:
#      print(i)
#      ok_steps[i] = ok_steps[i+1] + ok_steps[i+2]
#print(ok_steps[-3])        
print(ok_steps[0]%1000000007)
Problem p02832 (python)

Fixed submission:
n = int(raw_input())
bricks = raw_input().split()
bricks = [int(i) for i in bricks]
smash = 0
result = []
pos = 1
if 1 not in bricks:
  smash = -1
else:
  for i in bricks:
    if i == pos:
      pos = pos+1
    else:
      smash = smash + 1
print smash

Buggy submission (verdict: Runtime Error):
n = int(raw_input())
bricks = raw_input().split()
bricks = [int(i) for i in bricks]
smash = 0
result = []
pos = 1
if 1 not in bricks:
  smash = -1
else:
  for i in range(1,n+1):
    if i >= len(bricks): break
    while bricks[i-1] != i:
      bricks.pop(i-1)
      smash = smash+1
print(smash)
Problem p02793 (python)

Fixed submission:
from sys import stdin
def gcd(x, y):
	while(y):x, y = y, x % y 
	return x
n = int(stdin.readline())
a = list(map(int,stdin.readline().split()))
lcm = a[0]
for i in range(1,n):lcm = (lcm*a[i])//gcd(lcm,a[i])
b = [lcm // i for i in a]
print(sum(b)%1000000007)

Buggy submission (verdict: Runtime Error):
from sys import stdin
from math import gcd
n = int(stdin.readline())
a = list(map(int,stdin.readline().split()))
lcm = a[0]
for i in range(1,n):lcm = (lcm*a[i])//gcd(lcm,a[i])
b = [lcm // i for i in a]
print(sum(b)%1000000007)
Problem p02785 (python)

Fixed submission:
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
#print(H)
H.sort()
#print(H)
Ans = 0
for x in range(0,min(K,N)):
#    print(x)
    H.pop()
#print(H)
for x in H:
    Ans = x+Ans
print(Ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
H.sort()
Ans = 0
for x in (0,K):
    H.pop()
for x in range(0,N):
    Ans = H[x]+Ans
print(Ans)
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
if A < 10 and B < 10:
    print(A * B)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
A,B = map(input,int.split())
if A < 10 and B < 10:
    print(A * B)
else:
    print(-1)
Problem p02948 (python)

Fixed submission:
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*10**5
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:M]:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

Buggy submission (verdict: Runtime Error):
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*M
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v:
    for j in i:heappush(q,-j)
    z-=heappop(q)
print(z)

Buggy submission (verdict: Runtime Error):
from heapq import*
N,M=map(int,input().split())
t=[list(map(int,input().split())) for _ in range(N)]
q=[0]*M
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v:
    for j in i:heappush(q,-j)
    z-=heappop(q)
print(z)

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

N,M=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N)]
A.sort()

A = np.array(A)

cnt = 0
for day in range(1,M+1):
    B = A[A[:,0]<=day,1]
    if B.size > 0:
        index = np.argmax(B)
        cnt += B[index]
        A = np.delete(A,index,0)

print(cnt)

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

N,M=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(N)]
A.sort()

A = np.array(A)

cnt = 0
for day in range(1,M+1):
    B = A[A[:,0]<=day,1]
    if B.size > 0:
        index = np.argmax(B)
        cnt += B[index]
        A = np.delete(A,index,0)
print(cnt)