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

Fixed submission:
N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]
BC.sort(key = lambda x: -x[1])

for B, C in BC:
  A.extend([C]*B)
  if len(A) > N*2:
    break
A.sort(reverse = True)
print(sum(A[:N]))

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(N)]
BC.sort(key = lambda x: -x[1])

for B, C in BC:
  A.extend([C]*B)
  if len(A) > N*2:
    break
A.sort(reverse = True)
print(sum(A[:N]))

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(N)]
BC.sort(key = lambda x: -x[1])

for B, C in BC:
  A.extend([C]*B)
  if len(A) > N*2:
    break

print(sum(A[:N][::-1]))
Problem p03077 (python)

Fixed submission:
n, a, b, c, d, e = [int(input()) for _ in range(6)]
x = min(a,b,c,d,e)
print((n+x-1)//x+4)

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

n, a, b, c, d, e = [int(input()) for _ in range(6)]
r = min([h for h in [a,b,c,d,e] if h != 1])
if 1 in [a,b,c,d,e]:
  r -= 1
dd, ii = modf(n/r)
ll = int(ii)+int(dd*10)
print(5 if ll == 0 else ll)

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

n, a, b, c, d, e = [int(input()) for _ in range(6)]
r = [h for h in [a,b,c,d,e] if h != 1]
if 1 in [a,b,c,d,e]:
  r = min(r)-1
dd, ii = modf(n/min(r))

print(max(5, int(ii)+int(dd*10)))

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

n, a, b, c, d, e = [int(input()) for _ in range(6)]
r = [h for h in [a,b,c,d,e] if h != 1]
if 1 in [a,b,c,d,e]:
  r -= 1
dd, ii = modf(n/min(r))

Buggy submission (verdict: Runtime Error):
n, a, b, c, d, e = [int(input()) for _ in range(6)]
r = [h for h in [a,b,c,d,e] if h != 1]
if 1 in [a,b,c,d,e]:
  r -= 1
dd, ii = modf(n/min(r))

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

n, a, b, c, d, e = [int(input()) for _ in range(6)]

dif = 0
ss = [a,b,c,d,e]
for i in range(N-1):
  if ss[i] > ss[i+1]:
    dif += ss[i]-ss[i+1]
dd, ii = modf(n/max(dif, min(ss)))
print(max(5, int(ii)+int(dd*10)))
Problem p03137 (python)

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

tmp = sorted([X[i+1] - X[i] for i in range(M-1)])
if(tmp != []):
  if(len(tmp) == 1):
    print(*tmp)
  elif(N == 1):
    print(sum(tmp))
  else:
    print(sum(tmp[:-(N-1)]))
else:
  print(0)

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

tmp = [abs(X[i+1] - X[i]) for i in range(M-1)]
if(tmp != []):
  for _ in range(N-1):
    tmp.remove(max(tmp))
  print(sum(tmp))
else:
  print(0)

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

tmp = [abs(X[i+1] - X[i]) for i in range(M-1)]
if(tmp != []):
  tmp.remove([max(tmp) for _ in range(N-1)]
  print(sum(tmp))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))
tmp = []
for i in range(M-1):
  tmp.append(X[i+1] - X[i])
if(tmp != []):
  for i in range(N-1):
    tmp.remove(max(tmp))
  print(sum(tmp))
else:
  print(0)
Problem p03208 (python)

Fixed submission:
N, K = map(int,input().split())
h = sorted([int(input()) for i in range(N)])
trees = [h[i+K-1] - h[i] for i in range(N-K+1)]
print(min(trees))

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
h = sorted(int(input()) for _ in range(N))

ans = 1e9+7
for i in range(N-K+1):
  ans = min(ans, h[i+K]-h[i])
print(ans)
Problem p03286 (python)

Fixed submission:
N = int(input())

ans = ""
while N != 0:
  if(N%2 == 0):
    ans += "0"
  else:
    ans += "1"
    N -= 1
  N /= -2
if(ans == ""):
  ans = "0"
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = ""
while N != 0:
  if(N%2 == 0):
    ans += "0"
  else:
    ans += "1"
    N -= 1
  N //= -2
if(bit == ""):
  ans = ""
print(ans[::-1])
Problem p03315 (python)

Fixed submission:
N = input()
print(N.count('+') - N.count('-'))

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <string>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)

int main(){
  string s;
  cin >> s;
  int ans = 0;
  rep(i, 4){
    if (s[i] == '+') ++ans;
    else --ans;
  }
  cout << ans << endl;
}
Problem p03329 (python)

Fixed submission:
N = int(input())

ans = 10**9+7
for i in range(N+1):
  j = N-i
  cnt = 0
  while i > 0:
    cnt += i%6
    i //= 6
  while j > 0:
    cnt += j%9
    j //= 9
  ans = min(ans, cnt)
print(ans)

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

nine = [9**i for i in range(7, 0, -1)]
six = [6**i for i in range(8, 0, -1)]
tmp = {}

def f(n):
  if(n < 6):
    return n
  if(n in tmp):
    return tmp[n]
  
  m = 1e9+7
  if(n >= 9):
    mn = max(x for x in nine if x <= n)
    if(n%mn == 0):
      m = min(m, n//max_nine)
    else:
      m = min(m, f(n-mn)+1)
  ms = max(x for x in six if x <= n)
  if(n%ms == 0):
    m = min(m, n//ms)
  tmp[n] = min(m, f(n-ms)+1)
  return tmp[n]
print(f(N))
Problem p03631 (python)

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

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int,input().split())
x = max(A, C)
y = min(B, D)
if(y-x > 0):
  print(y - x)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int,input().split())
x = max(A, B)
y = min(C, D)
if(y-x > 0):
  print(y - x)
else:
  print(0)
Problem p03775 (python)

Fixed submission:
N = int(input())
x = round(N**0.5)
while N%x != 0:
  x -= 1
print(len(str(N//x)))

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  n = ni()

  def divi(n):
    res = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        res.append(i)
        if i != n // i:
          res.append(n // i)
    return res

  def digitlen(n):
    return len(str(n))

  x = divi(n)
  x.sort()
  m = len(x) // 2
  if m == 1:
    m = 0
  print(max(digitlen(x[m]), digitlen(x[m+1])))

main()

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
na = lambda : map(int, stdin.readline().split())
ni = lambda : int(ns())
def main():
  n = ni()
  nagasa = lambda x: len(str(x))
  def f(a, b):
    x = nagasa(a)
    y = nagasa(b)
    return x if x > y else y

  def divi(n):
    res = []
    for i in range(1, int(n**0.5)+1):
      if n % i == 0:
        res.append(i)
        if i != n // i:
          res.append(n // i)
    return res
  x = divi(n)
  print(f(x[-1], x[-2]))

main()
Problem p03803 (python)

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

if(A == 1 and B == 1):
  print("Draw")
  exit()
elif(A == 1):
  print("Alice")
  exit()
elif(B == 1):
  print("Bob")
  exit()
elif(A > B):
  print("Alice")
elif(A < B):
  print("Bob")
else:
  print("Draw")

Buggy submission (verdict: Runtime Error):
A, B = map(int,input().split())
if((A == 1 and A < B) or A > B):
  print('Alice')
elif((B == 1 and A > B) or A < B):
  print('Bob')
else:
  print(Draw)
Problem p02729 (python)

Fixed submission:
def c(i):
    return i*(i-1)//2

n,m=map(int,input().split())
print(c(n)+c(m))

Buggy submission (verdict: Runtime Error):
import math
n_num,m_num=map(int,input().split())
n_comb=math.factorial(n_num)//(math.factorial(n_num-2)*math.factorial(2))
m_comb=math.factorial(m_num)//(math.factorial(m_num-2)*math.factorial(2))
print(int(n_comb+m_comb))

Buggy submission (verdict: Runtime Error):
import math
n_num,m_num=map(int,input().split())
n_comb=math.factorial(n_num)/(math.factorial(n_num-2)*math.factorial(2))
m_comb=math.factorial(m_num)/(math.factorial(m_num-2)*math.factorial(2))
print(int(n_comb+m_comb))
Problem p02959 (python)

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

dp = [0]*N #勇者が倒す数

for i in range(N):
  dp[i] = min(A[i], B[i])
  A[i] -= dp[i]
  B[i] -= dp[i]
  rem = A[i]
  if rem==0:
    tmp = min(A[i+1], B[i])
    dp[i] += tmp
    A[i+1] -= tmp
print(sum(dp))

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

dp = [0]*N

for i in range(N):
  dp[i] = min(A[i], B[i])
  A[i], B[i] -= dp[i]
  if rem==0:
    tmp = min(A[i+1], B[i])
    dp[i] += tmp
    A[i+1] -= tmp
print(sum(dp))
Problem p02989 (python)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
d.sort()
a = d[N//2-1]
b = d[N//2]
if a==b:
  print(0)
else:
  print(b-a)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = map(int, input().split())
d.sort()
a = d[N//2-1]
b = d[N//2]
if a==b:
  print(0)
else:
  print(b-a)
Problem p03011 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(min([a+b, a+c, b+c]))

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(min([a+b, a+c, b+c])
Problem p03013 (python)

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

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]
dp = [0]*n
dp[0] = 1
dp[1] =0 if 2 in a else 1
for i in range(2, N+1):
  dp[i] = (dp[i-1] + dp[i-2])%(10**9+7) if i not in a else 0
print(dp[n])
Problem p03042 (python)

Fixed submission:
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

Buggy submission (verdict: Runtime Error):
S = input().rstrip()
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)
Problem p02759 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(N // 2);
else:
    print(N // 2 + 1)

Buggy submission (verdict: Runtime Error):
N = (int,input())
if N % 2 == 0:
    print(N // 2);
else:
    print(N // 2 + 1)
Problem p02847 (python)

Fixed submission:
weeks = {'MON': '1', 'TUE': '2', 'WED': '3', 'THU': '4', 'FRI': '5', 'SAT': '6', 'SUN': '0'}
s = input()
print(7-int(weeks.get(s)))

Buggy submission (verdict: Runtime Error):
 weeks = {'MON': '1', 'TUE': '2',
          'WED': '3', 'THU': '4',
          'FRI': '5', 'SAT': '6',
          'SUN': '0'
         }
  s = input()
  print(7-int(weeks.get(s)))

Buggy submission (verdict: Runtime Error):
weeks = {'MON': '1', 'TUE': '2',
    ...: 'WED': '3', 'THU': '4',
    ...: 'FRI': '5', 'SAT': '6',
    ...: 'SUN': '0'^M
    ...: }
    ...: S = input('')
    ...: print(7-int(weeks.get(S)))

Buggy submission (verdict: Runtime Error):
 weeks = {'MON': '1', 'TUE': '2',
    ...:  'WED': '3', 'THU': '4',
    ...:  'FRI': '5', 'SAT': '6',
    ...:  'SUN': '0'
    ...:  }
    ...: S = input('today:')
    ...: print(7-int(weeks.get(S)))
Problem p02711 (python)

Fixed submission:
N = input()
 
if '7'in N:
  print('Yes')
else:
  print('No')

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

if '7'in N:
  print('Yes')
 else:
  print('No')
Problem p02819 (python)

Fixed submission:
x = int(input())


while True:
	for i in range(2, int(x**0.5)+1):
		if x%i==0:
			x += 1
			break
	else:
		print(x)
		break

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


while True:
	for i in range(2, x**0.5+1):
		if x%i==0:
			x += 1
			break

	print(x)
	break

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


while True:
	for i in range(2, x**0.5+1):
		if x%i==0:
			continue
	else:
		print(x)
		break
	x += 1
Problem p02707 (python)

Fixed submission:
num_employee = int(input())
num_subordinate = [0] * num_employee

for boss in map(int, input().split(' ')):
    num_subordinate[boss-1] += 1

print('\n'.join(map(str, num_subordinate)))

Buggy submission (verdict: Runtime Error):
社員数 = int(input())

上司 = list(map(int, input.split(' ')))

for 社員番号 in range(1, 社員数+1):
    print(上司.count(社員番号))
Problem p02711 (python)

Fixed submission:
N = input()
ans = "No"
if N[0] == "7" or N[1] == "7" or N[2] == "7":
  ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N[0] == 7 or N[1] == 7 or N[2] == 7:
  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):
N = int(input())
a = list(map(int,input().split()))
BS = 1
for i in range(N):
  if a[i] == i:
    BS += 1
if a[i] == 1:
  print(-1)
else:
  print(N+1-BS)
Problem p02897 (python)

Fixed submission:
N = int(input())
if N % 2 ==0:
  print(1/2)
elif N == 1:
  print(1)
else:
  print((N//2+1)/N)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2 ==0:
  print(1/2)
elif N == 1:
  print(1)
else:
  print((N-N//2)/N)N = int(input())
if N % 2 ==0:
  print(1/2)
elif N == 1:
  print(1)
else:
  print((N-N//2)/N)
Problem p03135 (python)

Fixed submission:
T,X = map(int,input().split());print(T/X)

Buggy submission (verdict: Runtime Error):
T,K = map(int,input().split())
print(T/X)
Problem p03250 (python)

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

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if B >= A and B >= C:
  print(B*10+C+A)
if C >= A and C >= B:
  print(C*10+A+B)
if A >= B and A >= C:
  print(A:10+B+C)
Problem p02707 (python)

Fixed submission:
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
b = np.zeros(n)
for i in a: b[i-1] += 1
for i in b: print(int(i))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
b = [len(i for i in a if i == j) for j in range(n+1)]
print(b[1:])
Problem p03127 (python)

Fixed submission:
import fractions

N = int(input())
A = [int(i) for i in input().split()]

gcd = A[0]

for i in range(1,len(A)):
    gcd = fractions.gcd(gcd,A[i])

print(gcd)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = [int(i) for i in input().split()]

gcd = A[0]

for i in range(1,len(A)):
    gcd = math.gcd(gcd,A[i])

print(gcd)
Problem p03774 (python)

Fixed submission:
N,M = (int(i) for i in input().split())
a=[]
b=[]
c=[]
d=[]

for i in range(N):
    A,B = (int(i) for i in input().split())
    a.append(A)
    b.append(B)

for i in range(M):
    C,D = (int(i) for i in input().split())
    c.append(C)
    d.append(D)


closest = N*[0]

for i in range(N):
    minimum = abs(a[i]-c[0])+abs(b[i]-d[0])
    number = 1
    for j in range(1,M):
        distance = abs(a[i]-c[j])+abs(b[i]-d[j])
        if distance < minimum:
            minimum = distance
            number = j+1
    closest[i] = number

for i in range(N):
    print(closest[i])

Buggy submission (verdict: Runtime Error):
N,M = (int(i) for i in input().split())

student = []
for i in range(N):
    a,b = (int(k) for k in input().split())
    student.append([a,b])

points = []
for i in range(M):
    c,d = (int(k) for k in input().split())
    points.append([a,b])
    
distance = []
kyori = []


for i in range(N):
    for j in range(1):
        kyori.append(abs(student[i][0]-points[j][0]) + abs(student[i][1]-points[j][1]))
    distance.append(min(kyori[j]))

for i in range(N):
    for j in range(1,M):
        kyori[j] = abs(student[i][0]-points[j][0]) + abs(student[i][1]-points[j][1])
    distance.append(min(kyori[j]))

for i in range(N):
    print(distance[i])
Problem p02711 (python)

Fixed submission:
input_str=input()

if '7' in input_str:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# countBcd[i] : 最大公約数がiとなる数列の個数
# 全てiの倍数である数列の数はint(K/i) ** N ただし、全てi*2,i*3・・・の場合を除く

N, K = [int(x) for x in input().split()]
countBcd = [0]*(K+1)
mod=10**9+7
sumTotal=0
for i in range(K,0,-1):
    countBcd[i] = int(K/i) ** N

    for j in range(i*2,K+1,i):
        countBcd[i] += mod - countBcd[j]
        countBcd[i] %= mod

    sumTotal += i*countBcd[i]
    sumTotal %= mod

print(sumTotal)
Problem p02753 (python)

Fixed submission:
S = input()

if all(i == "A" for i in S) or all(i == "B" for i in S):
    print("No")
else:
    print("Yes")

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

taxfree = A/0.08
while taxfree*0.08 < A+1:
    if B <= taxfree*0.1 < B+1:
        ans.append(int(taxfree))
        break
    taxfree += 1

taxfree = B/0.1
while taxfree*0.1 < B+1:
    if B <= taxfree*0.08 < A+1:
        ans.append(int(taxfree))
        break
    taxfree += 1

if len(ans) != 0:
    print(min(ans))
else:
    print(-1)

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

if all(S == "A") or all(S == "B"):
    print("No")
else:
    print("Yes")

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

if all(S == "A") or all(S == "B"):
    print("No")
else:
    print("Yes")
Problem p02835 (python)

Fixed submission:
A = list(map(int, input().split()))
print("win" if sum(A) < 22 else "bust")

Buggy submission (verdict: Runtime Error):
A = [map(int, input().split())]
print("win" if sum(A) < 22 else "bust")

Buggy submission (verdict: Runtime Error):
A = [map(int, input().split())]
print("win" if sum(A) >= 22 else "bust")
Problem p02711 (python)

Fixed submission:
N = input()
n = [int(c) for c in N]
for ni in n:
  if ni == 7:
    print("Yes")
    exit()
print("No")

Buggy submission (verdict: Runtime Error):
N = input()
n = [int(c) for c in s]
for ni in n:
  if ni == 7:
    print("Yes")
    exit()
print("No")
Problem p02707 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
x=Counter(a)
for i in range(1,n+1):
  print(x[i])

Buggy submission (verdict: Runtime Error):
        n = int(input())
        a = list(map(int, input().split()))
        from collections import Counter
        x=Counter(a)
        for i in range(1,n+1):
          print(x[i])

Buggy submission (verdict: Runtime Error):
        n = int(input())
        a = list(map(int, input().split()))
        from collections import Counter
        x=Counter(a)
        for i in range(1,n+1):
          print(x[i])

Buggy submission (verdict: Runtime Error):
    n = int(input())
    a = list(map(int, input().split()))
    import Counter
    x=Counter(a)
    for i in range(1,n+1):
      print(x[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
import Counter
x=Counter(a)
for i in range(1,n+1):
  print(a[x])
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())
array = (1,2,3)
array.remove(A,B)
print (array)

Buggy submission (verdict: Runtime Error):
def Amondai(A, B):
	newArray = {1, 2, 3}
    newArray.clear(A)
    newArray.clear(B)
    retern newArray
Problem p03137 (python)

Fixed submission:
import numpy as np
N, M = map(int, input().split())
X = list(map(int, input().split()))

if M <= N:
    print(0)
else:
    X.sort()
    # print("X =", X)
    dX = np.diff(X)
    # print("dX =", dX)
    dX.sort()
    print(sum(dX[:M-N]))

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

if M <= N:
    print(0)
else:
    X.sort()
    # print("X =", X)
    dX = np.diff(X)
    # print("dX =", dX)
    dX.sort()
    print(sum(dX[:M-N]))

f.close()

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

if M <= N:
    print(0)
else:
    X.sort()
    dX = np.diff(X)
    dX.sort()
    print(sum(dX[:N+1]))
Problem p03265 (python)

Fixed submission:
import numpy as np
x1, y1, x2, y2 = map(int, input().split())

R = np.array([[0,-1],[1,0]])

r1 = np.array([x2-x1, y2-y1])
r2 = np.dot(R, r1)
x3, y3 = r2 + np.array([x2, y2])
r3 = np.dot(R, r2)
x4, y4 = r3 + np.array([x3, y3])

print(x3, y3, x4, y4)

Buggy submission (verdict: Runtime Error):
import numpy as np
x1, y1, x2, y2 = map(int, input().split())

R = np.array([[0,-1],[1,0]])

r1 = np.array([x2-x1, y2-y1])
r2 = R @ r1
x3, y3 = r2 + np.array([x2, y2])
r3 = R @ r2
x4, y4 = r3 + np.array([x3, y3])

print(x3, y3, x4, y4)
Problem p03326 (python)

Fixed submission:
N, M = map(int, input().split())
x = [None] * N
y = [None] * N
z = [None] * N

for i in range(N):
    x[i], y[i], z[i] = map(int, input().split())

ans = 0

for xs in [1, -1]:
    for ys in [1, -1]:
        for zs in [1, -1]:
            D = [xs*x[i] + ys*y[i] + zs*z[i] for i in range(N)]
            D.sort(reverse=True)
            ans = max(ans, sum(D[:M]))

print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

N, M = map(int, input().split())
x = [None] * N
y = [None] * N
z = [None] * N


for i in range(N):
    x[i], y[i], z[i] = map(int, input().split())

if M == 0:
    print(0)
elif M == 1:
    vallist = [abs(x[i]) + abs(y[i]) + abs(z[i]) for i in range(N)]
    print(max(vallist))
elif M == N:
    print(abs(sum(x[i])) + abs(sum(y[i])) + abs(sum(z[i])))
else:
    ans = 0
    v = 0
    for I in itertools.combinations([i for i in range(N)], M):
        I = list(I)
        v = abs(sum([x[i] for i in I]))
        v += abs(sum([y[i] for i in I]))
        v += abs(sum([z[i] for i in I]))
        ans = max(ans, v)
    print(ans)
Problem p02829 (python)

Fixed submission:
a = {1, 2, 3}
a.remove(int(input()))
a.remove(int(input()))
print(list(a)[0])

Buggy submission (verdict: Runtime Error):
a = {1, 2, 3}
a.remove(int(input())
a.remove(int(input())
print(list(a)[0])
Problem p02835 (python)

Fixed submission:
a1, a2, a3 = map(int, input().split())
print('bust' if a1+a2+a3 >= 22 else 'win')

Buggy submission (verdict: Runtime Error):
a1, a2, a3 = map(int, input().split())
return 'bust' if a1+a2+a3 >= 22 else 'win'
Problem p02836 (python)

Fixed submission:
# redcoder
string = input()
n = len(string) - 1

s = n//2 + 1
count = 0
for i in range(s):
  if string[i] != string[n-i]:
    count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
# redcoder
string = input()
n = len(string) - 1
if n == 1:
	print(0)
    exit(0)
    
s = 0 
e = n
count = 0
while e > s:
	if string[e] != string[s]:
    	count += 1
    e -= 1
    s += 1

print(count)
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
return int(input()**2)
Problem p02707 (python)

Fixed submission:
n = int(input())
boss_list = list(map(int, input().split(" ")))

boss_count_list = [0] * n


for val in boss_list:
  boss_count_list[val - 1] += 1

for val in boss_count_list:
  print(val)

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

boss_list = sorted(boss_list, reverse=True)


for i in range(n, 0, -1):
    boss_num = 0
    boss_num = boss_list.index(i-1)
    # boss_list = boss_list[boss_num:]
    del boss_list[:boss_num]

    if i == 0:
        boss_num -= 1

    print(boss_num)