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

Fixed submission:
n,m = [int(i) for i in input().split()]
ab = []
for i in range(m):
  ab.append([int(i)-1 for i in input().split()])

def find_index(c,eld):
  if c in eld[c]:
    return(c,len(eld[c]))
  else:
    return(eld[c][0],len(eld[eld[c][0]]))
           
eld = []
for i in range(n):
  eld.append([i])
stat = eld
ans = [int(len(eld)*(len(eld)-1)/2)]

for a,b in ab[1:][::-1]:
#  print(eld)
  a_index,a_size = find_index(a,eld)
  b_index,b_size = find_index(b,eld)
#  print(a_index,b_index)
  if a_index == b_index:
    ans.append(ans[-1])
    continue
  else:
    next = a_size * b_size
    ans.append(ans[-1] - next)

  if a_size >= b_size:
    eld[a_index].extend(eld[b_index])
    for i in eld[b_index]:
      eld[i] = [a_index]
  else:
    eld[b_index].extend(eld[a_index])
    for i in eld[a_index]:
      eld[i] = [b_index]

for i in ans[::-1]:
  print(i)

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

n,m = [int(i) for i in input().split()]

keiro = np.eye(n)
ab = []
for i in range(m):
  a,b = [int(i)-1 for i in input().split()]
  ab.append([a, b])
  keiro[a,b] = 1
  keiro[b,a] = 1

for i in range(m):
  cnt = 0
  a,b = ab[i]
  keiro[a,b] = 0
  keiro[b,a] = 0
  
  eig, p = np.linalg.eig(keiro)
  p_inv = np.linalg.inv(p)
  eig = eig**(m-i-1)
  d = np.diag(eig)
  keiro_tmp = np.dot(p,d)
  keiro_tmp = np.dot(keiro_tmp,p_inv)
  cnt = int(np.sum(keiro_tmp == 0) / 2)
  print(cnt)

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

n,m = [int(i) for i in input().split()]

keiro = np.eye(n)
ab = []
for i in range(m):
  a,b = [int(i)-1 for i in input().split()]
  ab.append([a, b])
  keiro[a,b] = 1
  keiro[b,a] = 1

for i in range(m):
  cnt = 0
  a,b = ab[i]
  keiro[a,b] = 0
  keiro[b,a] = 0
  
  eig, p = np.linalg.eig(keiro)
  p_inv = np.linalg.inv(p)
  eig = eig**(m-i-1)
  d = np.diag(eig)
  keiro_tmp = np.dot(p,d)
  keiro_tmp = np.dot(keiro_tmp,p_inv)
  cnt = np.sum(keiro_tmp == 0) / 2
  print(cnt)

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

n,m = [int(i) for i in input().split()]

keiro = np.eye(n)
ab = []
for i in range(m):
  a,b = [int(i)-1 for i in input().split()]
  ab.append([a, b])
  keiro[a,b] = 1
  keiro[b,a] = 1

cnt = []
for i in range(m):
  cnt = 0
  a,b = ab[i]
  keiro[a,b] = 0
  keiro[b,a] = 0
  
  eig, p = np.linalg.eig(keiro)
  p_inv = np.linalg.inv(p)
  eig = eig**(m-i-1)
  d = np.diag(eig)
  keiro_tmp = np.dot(p,d)
  keiro_tmp = np.dot(keiro_tmp,p_inv)
  for j in range(0,n-1):
    for k in range(j+1,n):
      if keiro_tmp[j,k] == 0:
        cnt += 1
  print(cnt)

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

n,m = [int(i) for i in input().split()]

keiro = np.eye(n)
ab = []
for i in range(m):
  a,b = [int(i)-1 for i in input().split()]
  ab.append([a, b])
  keiro[a,b] = 1
  keiro[b,a] = 1
cnt = []
for i in range(m):
  cnt_i = 0
  a,b = ab[i]
  keiro[a,b] = 0
  keiro[b,a] = 0
  keiro_tmp = keiro.copy()
  for j in range(m-i-1):
    keiro_tmp = np.dot(keiro_tmp,keiro_tmp)
  for j in range(0,n-1):
    for k in range(j+1,n):
      if keiro_tmp[j,k] == 0:
        cnt_i += 1
  cnt.append(cnt_i)
for i in range(m):
  print(cnt[i])
Problem p02970 (python)

Fixed submission:
import math
N, D = map(int, input().split())
i = N / (2*D + 1)
if 1 <= N <= 20 and 1 <= D <= 20:
    if i > 0:
        i = math.ceil(i)
        print(i)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
D = int(input())
i = N / (2*D + 1)
if 1 <= N <= 20 and 1 <= D <= 20:
    if i > 0:
        i = math.ceil(i)
        print(i)
Problem p03011 (python)

Fixed submission:
a, b, c = [int(i) for i in input().split()]
d = a + b
e = b + c
f = c + a
print(min(d, e, f))

Buggy submission (verdict: Runtime Error):
import statistics
lis = []
for i in range(3):
  a = int(input())
  a = [a]
  lis += a
x = min(lis)
y = statistics.median(lis)
print(x+y)

Buggy submission (verdict: Runtime Error):
import statistics
lis = []
for i in range(3):
    a = int(input())
    a = [a]
    lis += a
x = min(lis)
y = statistics.median(lis)
print(x+y)
Problem p02819 (python)

Fixed submission:
import math
def get_primenumber(number):
    prime_list = []
    search_list = list(range(2,10**6+1))
    while True:
      if search_list[0] > math.sqrt(number):
        prime_list.extend(search_list)
        break
      else:
        head_num = search_list[0]
        prime_list.append(head_num)
        search_list.pop(0)
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list

x = int(input())
h = get_primenumber(x)
for i in h:
    if i >= x:
        print(i)
        exit()

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

x = int(input())
print(nextprime(x-1))
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
ans = [1] * (n + 1)
for i in a:
    ans[i] = 0
for i in range(2, n + 1):
    if ans[i]:
        ans[i] = ans[i - 1] + ans[i - 2]
    if ans[i] >= 1000000007:
        ans[i] = ans[i] % 1000000007
print(ans[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = [1] * (n + 1)
for i in a:
    ans[i] = 0
for i in range(2, n + 1):
    if ans[i]:
        ans[i] = ans[i - 1] + ans[i - 2]
    if ans[i] >= 1000000007:
        ans[i] = ans[i] % 1000000007
print(ans[-1])
Problem p03242 (python)

Fixed submission:
a=int(input())
print(1110-a)

Buggy submission (verdict: Runtime Error):
a=str(input())
b=int(a[0])
c=int(a[1])
d=int(a[2])
if b==1:
  b="9"
elif b==9:
  b="1"
if c==1:
  c="9"
elif c==9:
  c="1"
if d==1:
  d="9"
elif d==9:
  d=="1"
e=int(b+c+d)
print(e)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,list(input(),split()))
if a==1:
  a=9
elif a==9:
  a=1
if b==1:
  b=9
elif b==9:
  b=1
if c==1:
  c=9
elif c==9:
  c==1
print({}{}{}.format(a,b,c))
Problem p02682 (python)

Fixed submission:
a=1
b=0
c=-1
A,B,C,K=input().split()
A=int(A)
B=int(B)
C=int(C)
K=int(K)
test=0
if K>=A:
    a=a*A
    test=test+a
    K=K-A
elif K<=A:
    a=a*K
    test=test+a
    c=0
if K>=B:
    b=b*B
    test=test+b
    K=K-B
elif K<=B: 
    b=b*K
    test=test+b
    c=0
    
if K>=C:
    c=c*C
    test=test+c
    K=K-C
elif K<=C:
    c=c*K
    test=test+c
    
    
print(test)

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


if len(S)+1==len(T):
    for i in range(len(S)): #回数の時は絶対range()
        if S[i]==T[i]:
            a='ok'
            continue
        else:
            a='no'
            break
else:
    print('no')

if a=='ok':
    print('Yes')
else:
    print('No')
Problem p02970 (python)

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

Buggy submission (verdict: Runtime Error):
n, d = map(int, input())
print(n//(2*d+1)+(1 if n%(2*d+1)!=0 else 0))
Problem p02831 (python)

Fixed submission:
a=list(map(int,input().split()))
A=a[0]
B=a[1]

import fractions

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

print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
A=a[0]
B=a[1]

import math

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

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

Fixed submission:
a = list(map(int,input().split()))
A=a[0]
B=a[1]

if 1<=A<=9 and 1<=B<=9:
    print(A*B)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
flag=0
for i in range(9):
    for j in range(9):
        if (i+1)*(j+1)==N:
            flag=1

if flag==1:
    print('Yes')
else:
    print('No')
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
N = input()
password = N * N * N
print(password)

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

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(10*a[2]+a[0]+a[1])

Buggy submission (verdict: Runtime Error):
NMXY = list(map(int,input().split()))
N=NMXY[0]
M=NMXY[1]
X=NMXY[2]
Y=NMXY[3]
x=list(map(int,input().split()))
y=list(map(int,input().split()))
flag1=[]
flag2=[]

Z=list(range(X+1,Y))

for k in Z:
    flag1.append(all([i<k for i in x]))
    flag2.append(all([j>=k for j in y]))
print(flag1)
print(flag2)
if any(flag1) and any(flag2):
    print('No War')
else:
    print('War')
Problem p03265 (python)

Fixed submission:
X1, Y1, X2, Y2 = map(int, input().split())
X3, Y3 = X2-(Y2-Y1), Y2+(X2-X1)
X4, Y4 = X3-(Y3-Y2), Y3+(X3-X2)
print(X3, Y3, X4, Y4)

Buggy submission (verdict: Runtime Error):
o
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
x = b // k * k
if a <= x:
    print("OK")
else:
    print("NG")

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

if ('A,B%K==0'):
  print('OK')
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
K=int(input())
A=int(input())
B=int(input())
if A>=1 and B<=1000:
  print('OK')
else:
  print('NG')
Problem p02701 (python)

Fixed submission:
n = int(input())

s_list = []
for i in range(n):
    s = str(input())
    s_list.append(s)
    
print(len(set(s_list)))

Buggy submission (verdict: Runtime Error):
n = int(input())
list =[input() for _ in range(n)]: 
print(len(set(list)))
Problem p02785 (python)

Fixed submission:
n, k = map(int, input().split())
H = list(map(int, input().split()))
if k>=n:
    print(0)
else:
  H.sort(reverse=True)
  for i in range(k):
    H[i] = 0

  print(sum(H))

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

H.sort(reverse=True)
for i in range(k):
  H[i] = 0

print(sum(H))

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

H.sort(reverse=True)
for i in range(k):
  H[i] = 0
  print(H)

print(sum(H))
Problem p02790 (python)

Fixed submission:
a,b = map(int,input().split())
min_a=str(a)*b
min_b=str(b)*a
print(min(min_a, min_b))

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
min_a=str(a)*b
min_b=str(b)*a
print(min(min_a, min_b)
Problem p03803 (python)

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

def convert_num(a):
    if a == 1:
        a = 14
    return a

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

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

def convert_num(a):
    if a == 1:
        a = 14
    return a

a = convert_num(a)
b = convert_num(b)
if a > b:
    print('Alice')
elif a == b:
    print('Draw')
else:
    print('Bob')
Problem p03805 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())
 
G = np.zeros((N, N)) 
total_path_num = 0
not_reach_node = list(range(1, N))
node = 0
 
for i in range(M):
  a, b = map(int, input().split())
  G[a-1, b-1] += 1
  G[b-1, a-1] += 1
  
def search_path(G, not_reach_node, node):
  global total_path_num
  if len(not_reach_node) == 0:
    total_path_num += 1
    return total_path_num
  
  for x in np.where((G[node] == 1))[0]:
    if (x in not_reach_node):
      not_reach_node_copy = not_reach_node.copy()
      not_reach_node_copy.remove(x)
      search_path(G, not_reach_node_copy, x)

search_path(G, not_reach_node, node)      	
 
print(total_path_num)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())
 
G = np.zeros((N, M)) 
total_path_num = 0
not_reach_node = list(range(1, N))
node = 0
 
for i in range(M):
  a, b = map(int, input().split())
  G[a-1, b-1] += 1
  G[b-1, a-1] += 1
  
def search_path(G, not_reach_node, node):
  global total_path_num
  if len(not_reach_node) == 0:
    total_path_num += 1
    return total_path_num
  
  for x in np.where((G[node] == 1))[0]:
    try:
      if (x in not_reach_node):
        not_reach_node_copy = not_reach_node.copy()
        not_reach_node_copy.remove(x)
        search_path(G, not_reach_node_copy, x)
    except:
      pass
        
search_path(G, not_reach_node, node)      	
 
print(total_path_num)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M = map(int, input().split())

G = np.zeros((N, M)) 
total_path_num = 0
not_reach_node = list(range(1, N))
node = 0

for i in range(M):
  a, b = map(int, input().split())
  G[a-1, b-1] += 1
  G[b-1, a-1] += 1
  
def search_path(G, not_reach_node, node):
  global total_path_num
  if len(not_reach_node) == 0:
    total_path_num += 1
    return total_path_num
  
  for x in np.where((G[node] == 1))[0]:
    if (x in not_reach_node):
      not_reach_node_copy = not_reach_node.copy()
      not_reach_node_copy.remove(x)
      search_path(G, not_reach_node_copy, x)
        
search_path(G, not_reach_node, node)      	

print(total_path_num)
Problem p02729 (python)

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

if a >= 2 and b >=2 :
    ans = ((a * (a + 1))//2 - a) + ((b * (b +1))//2 - b)
    print(ans)

if a < 2 and b < 2:
    print(0)

if a < 2 and b >= 2:
    print((b * (b + 1))//2 -b)

if a >= 2 and b < 2:
    print((a * (a + 1))//2 -a)

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

if a >= 2 and b >=2 :
    ans = (a * (a + 1)//2 - a) + (b * (b +1)//2 - b)
    print(ans)

if a < 2 and b < 2:
    print(0)

if a < 2 and b >= 2:
    print(b * (b + 1)//2 -b)

if a >= 2 and b < 2:
    print(a * (a + 1)//2 -a)
Problem p02753 (python)

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

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

for i in range(10000):
  if i * 0.08 == a and i * 0.1 == b:
    print(i)
    exit(0)
else:
  print(-1)

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

for i in range(10000):
  if i == a * 0.08 and i ==  b * 0.1:
    print(i)
    exit(0)
print('-1')

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

for i in range(10000):
  if i == a * 0.08 and i ==  b * 0.1:
    print(i)
    exit(0)
  else:
    print('-1')

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

for i in range(10000):
  if i == a * 0.08 and i ==  b * 0.1:
    print(i)
  else:
    print('-1')

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

for i in range(10000):
  if a * 0.08 == b * 0.1:
    print(a)
    exit(0)
  else:
    print('-1')
Problem p02754 (python)

Fixed submission:


n, a, b = map(int, input().split())
ans = n // (a + b) * a
rem = n % (a + b)
ans += min(rem, a)
print(ans)

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


ans = (n //(a + b)) * a
if n % (a + b) <= a:
  print(ans + (n % (a + b))
elif n % (a + b) >= a:
  print(ans + a)

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


ans = (n //(a + b)) * a
if n % (a + b) < a:
  print(ans + (n % (a + b))
elif n % (a + b) >= a:
  print(ans + a)

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


ans = (n //(a + b)) * a
if n % (a + b) < a:
  print(ans + (n % (a + b))
elif n % (a + b) > a:
  print(ans + a)
Problem p02771 (python)

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

if len(set(a)) == 2:
  print('Yes')
else:
  print('No')

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

if set(len(a)) == 2:
  print('Yes')

else:
  print('No')

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

if len(set(a)) = 2:
  print('Yes')
else:
  print('No')

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

if len(set(a)) =< 2:
  print('Yes')
else:
  print('No')
Problem p02835 (python)

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

if a + b + c >= 22:
  print('bust')
else:
  print('win')

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

if a + b + c <= 22:
  print('bust')
else;¥:
  print('win')
Problem p02880 (python)

Fixed submission:
n = int(input())

for i in range(1, n + 1):
    if n % i == 0:
        j = n // i
        if i < 10 and j < 10:
            print('Yes')
            break
else:
    print('No')

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

list = []

for i in range(a):
  if a % i == 0:
    list.append(i)
list2 = []
for j in list:
  if j < 10:
    list2.append(j)

if len(list2) >= 2:
  print('Yes')
else:
  print('No')
Problem p02897 (python)

Fixed submission:
no=int(input())
n=no
c=0
while(n>0):
  if n%2 == 1:
    c += 1
  n -= 1
print(c/no)

Buggy submission (verdict: Runtime Error):
no=int(input())
n=no
c=0
while(n):
  if n == 0:
    print c/n
    break
  if n%2 == 1:
    c += 1

Buggy submission (verdict: Runtime Error):
no=int(input())
n=no
c=0
while(n):
  if n == 0:
    print c/n
    break
  if n%2 == 1:
    c += 1
Problem p02759 (python)

Fixed submission:
import math
 
N = float(input())
print(math.ceil(N/2))

Buggy submission (verdict: Runtime Error):
import math

N = input()
print(math.ceil(N/2))
Problem p02829 (python)

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

print(6-A-B)

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

pirnt(6-A-B)
Problem p02860 (python)

Fixed submission:
# coding: utf-8
N=int(input())
S=input()
if S[:int(N/2)]==S[int(N/2):]: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
N=int(input())
S=input()
if S[:N/2]==S[N/2:]: print("Yes")
else: print("No")
Problem p02879 (python)

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

if 0<A and A<10 and 0<B and B<10:
    print(A*B)
else:
    print(-1)

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

if 0<A and A<10 and 0<B and B<10:
    print(A*B)
else:
    print(-1)

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

if 0<A and A<10 and 0<B and B<10:
    print(A*B)
else:
    print(-1)
Problem p02676 (python)

Fixed submission:
K=input()
S=input()
K=int(K)
S=str(S)
longS=len(S)
if longS <= K :
    print(S)
else:
    head=S[0:K]
    print(head + "...")

Buggy submission (verdict: Runtime Error):
K,S=input().split("\n")
K=int(K)
S=str(S)
longS=len(S)
if longS <= K :
    print(S)
else:
    head=S[0]
    print(head + "...")
Problem p02712 (python)

Fixed submission:
n=int(input())
n3=n//3
s3=(n3*3)*(n3+1)//2
n5=n//5
s5=((n5)*5)*(n5+1)//2
n15=n//15
s15=((n15)*15)*(n15+1)//2
 
s=n*(n+1)//2
s=s-s3-s5+s15
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
n3=n//3
s3=((n3)*3)(n3+1)//2
n5=n//5
s5=((n5)*5)(n5+1)//2
n15=n//15
s15=((n15)*15)(n15+1)//2

s=n*(n+1)//2
s=s-s3-s5+s15
print(s)
Problem p02723 (python)

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

Buggy submission (verdict: Runtime Error):
n=input()
if a[2]==a[3] and a[4]==a[5]:
  print("Yes")
else:
  print("No")
Problem p02773 (python)

Fixed submission:
N = int(input())
dicta = {}
for i in range(N):
    word = input()
    dicta.setdefault(word, 0)
    dicta[word] += 1
word_c = list(dicta.items())
word_c.sort(key=lambda tup: tup[1], reverse=True)
max_len_word = [word_c[0][0]]
for j in range(1,len(word_c)):
    if word_c[j][1] == word_c[0][1]:
        max_len_word.append(word_c[j][0])
    else:
        break
max_len_word.sort()
for word in max_len_word:
    print(word)

Buggy submission (verdict: Runtime Error):
N = int(input())
dicta = {}
for i in range(N):
    word = input()
    dicta.setdefault(word, 0)
    dicta[word] += 1
word_c = list(dicta.items())
word_c.sort(key=lambda tup: tup[1], reverse=True)
max_len_word = [word_c[0][0]]
for j in range(1,N):
    if word_c[j][1] == word_c[0][1]:
        max_len_word.append(word_c[j][0])
    else:
        break
max_len_word.sort()
for word in max_len_word:
    print(word)
Problem p02948 (python)

Fixed submission:
import heapq
job = list()
salary = list()
n,m = map(int,input().split())

for i in range(n):
    a,b = map(int,input().split())
    job.append((a,b))

job.sort(reverse = True)

for x in job:
    s,t = x
    heapq.heappush(salary,t)
    if s - m > 0:
        heapq.heappop(salary)
    else:
        m -= 1

print(sum(salary))

Buggy submission (verdict: Runtime Error):
import heapq
job = list()
salary = list()
n,m = map(int,input().split())

for i in range(n):
    a,b = map(int,input().split())
    job.append(a,b)
    
job.sort(reverse = True)

for x in job:
    s,t = x
    heapq.heappush(salary,t)
    if s - m > 0:
        heapq.heappop(salary)
    else:
        m -= 1

print(sum(salary))

Buggy submission (verdict: Runtime Error):
job = list()
salary = list()
k = m
n,m = map(int,input().split())

for i in range(n):
    a,b = map(int,input().split())
    job.append((a,b))

job.sort(reverse = True)

for x in job:
    s,t = x
    salary.append(t)

    if s - k > 0:
        salary.remove(min(salary))
    else:
        k -= 1

print(sum(salary))
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
print("Yes" if S[:N//2] == S[N//2:] else "No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
print("No") if N%2!==0  else print("No") if S[:(N/2)+1:] != S[(N/2)+1::]
      else print("Yes")
Problem p02723 (python)

Fixed submission:
S=input()

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

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
    arrayAns.append(int(arrayP[i]))
for i in range(y):
    arrayAns.append(int(arrayQ[i]))
arrayAns.sort()
for i in range(min(len(arrayR), len(arrayAns))):
    if arrayAns[i] <= int(arrayR[i]):
        arrayAns[i] = int(arrayR[i])
    else:
        break
print(sum(arrayAns))

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = map(int, input().split())
arrayP = list(map(int, input().split()))
arrayQ = list(map(int, input().split()))
arrayR = list(map(int, input().split()))
arrayP.sort(reverse=True)
arrayQ.sort(reverse=True)
arrayR.sort(reverse=True)
arrayAns = []
for i in range(x):
    arrayAns.append(int(arrayP[i]))
for i in range(y):
    arrayAns.append(int(arrayQ[i]))
arrayAns.sort()
for i in range(len(arrayR)):
    if arrayAns[i] <= int(arrayR[i]):
        arrayAns[i] = int(arrayR[i])
    else:
        break
print(sum(arrayAns))
Problem p02990 (python)

Fixed submission:
n,k = map(int,input().split())
blue = k
red = n-k

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for i in range(1,k+1):
    if red < i-1 :
        ans = 0
    else:
        ans = int( cmb(blue - 1 ,i-1)* cmb (red + 1 , i))
    print(ans % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
blue = k
red = n-k

from scipy.special import comb


for i in range(1,k+1):
    ans = int( (comb(blue - 1 ,i-1)% (10**9 + 7)) * (comb (red + 1 , i)% (10**9 + 7)))
    print(ans % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
blue = k
red = n-k

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

for i in range(1,k+1):
    ans = cmb(blue - 1 ,i-1) * cmb (red + 1 , i)
    print(ans % (10**9 + 7))