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

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


if a == b:
    print("Draw")
elif a == 1:
    print("Alice")
elif b == 1:
    print("Bob")
elif a > b:
    print("Alice")
elif a < b:
    print("Bob")

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

A = [input() for n in range(N)]
B = [input() for m in range(M)]

ans = "Yes"
for a in A:
    for b in B:
        print(a, b)
        if b not in a:
            ans = "No"
print(ans)

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

A = [input() for n in range(N)]
B = [input() for m in range(M)]
for a in A:
    cnt = 0
    for b in B:
        if b in a:
            cnt += 1
        else:
            cnt = 0
        if cnt == M:
            print("Yes")
            exit()

print("No")

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

cards = {"2": 1, "3": 2, "4": 3, "5": 4, "6": 5, "7": 6, "8": 7, "9 ": 8, "10": 9, "11": 10, "12": 11, "13": 12, "1": 13 }

if cards[a] > cards[b]:
    print("Alice")
elif cards[a] < cards[b]:
    print("Bob")
else:
    print("Draw")

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

cards = {"2": 1, "3": 2, "4": 3, "5": 4, "6": 5, "7": 6, "8": 7, "9 ": 8, "10": 9, "11": 10, "12": 11, "13": 12, "1": 13 }

if cards[a] > cards[b]:
    print("Alice")
elif cards[a] < cards[b]:
    print("Bob")
else:
    print("Draw")
Problem p02699 (python)

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

if a[1] >= a[0] :
  print("unsafe")
else: 
  print("safe")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
 
A = a[0]
B = a[1]
C = a[2]
D = a[3]
 
while B>0 and D>0:
  D = D - A
  if D <= 0:
    print("No")
    break
  B = B - D
  if B <= 0:
    print("Yes")
    break
Problem p02785 (python)

Fixed submission:
import numpy
N,K = map(int,input().split())
H = list(map(int,input().split()))

H = numpy.sort(H)
sum = 0
#print(H)
if N-K > 0:
  for i in range(N-K):
    sum = sum + H[i]
else:
    sum = 0
    
print(sum)

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

H = numpy.sort(H)
#print(H)

for i in range(K):
  H.remove(H[N-1-i])

print(sum(H))

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

H = sorted(H)
#print(H)

for i in range(K):
  H.remove(H[N-1-i])

print(sum(H))
Problem p03315 (python)

Fixed submission:
S = input()
num = 0
for i in range(len(S)):
    if S[i] == '+': num = num + 1
    else : num = num -1
print(num)

Buggy submission (verdict: Runtime Error):
S = input()
num = 0
for i in range(len(S))
	if S[i] == '+':
    	num = num + 1
    else:
    	num = num - 1
print(num)
Problem p02773 (python)

Fixed submission:
N = int(input())
dict1 = {}
for _ in range(N):
  s = input()
  if s in dict1:
    dict1[s] += 1
  else:
    dict1[s] = 1
max_num= max(dict1.values())
list1 = [d[0] for d in dict1.items() if d[1]==max_num]
list1.sort()
for s in list1:
  print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
dict1 = {}
for _ in range(N):
  s = input()
  if s in dict1:
    dict[s] += 1
  else:
    dict[s] = 1
list1 = [d[0] for d in dict1.items() if d[1]==max(dict1.values())]
list1.sort()
for s in list1:
  print(s)
Problem p02779 (python)

Fixed submission:
N = int(input())
list1 = sorted(list(map(int, input().split())))
pre_num = None
s = 'YES'
for num in list1:
  if num == pre_num:
    s = 'NO'
    break
  pre_num = num
print(s)

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

s = 'YES'
for i in range(N-1):
  if list[i] == list[i+1]:
    s = 'NO'
    break
print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
list1 = list(map(int, input().split())).sort()
pre_num = None
s = 'YES'
for num in list1:
  if num == pre_num:
    s = 'NO'
    break
  pre_num = num
print(s)
Problem p02622 (python)

Fixed submission:
a = input()
b = input()
 
count = 0
for i in range(0, len(a)):
    if a[i] != b[i]:
        count+=1
      
print(count)

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

count = 0
for i in range(0, len(a)):
    if a[i] != b[i];
        count+=1
      
print(count)
Problem p02682 (python)

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

if a >= k:
  print(k)
elif a + b >= k:
  print(a)
else:
  print(a - (k - a - b))

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

if a >= k:
  print(k)
elif a + b >= k:
  print(a)
else:
  print(a - (k - a - b)
Problem p02753 (python)

Fixed submission:
import sys
S = input()

if not ( len(S) == 3 and ( "A" in S or "B" in S)): sys.exit()

print('No') if S == 'AAA' or S == 'BBB' else print('Yes')

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

if not ( len(S) == 3 and ( "A" in S or "B" in S)): sys.exit()

print('No') if S = 'AAA' or S = 'BBB' else print('Yes')
Problem p02754 (python)

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

if not ( 1 <= N <= 10**18 and 0 <= A and 0 <= B and 0 < A + B <= 10**18 ): sys.exit()
if not ( isinstance(N,int) and isinstance(A,int) and isinstance(B,int) ): sys.exit()

count = N // (A+B)
remind = N % (A+B) if N % (A+B) <= A else A
    
print(count * A + remind)

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

if not ( 1 <= N <= 10**18 and 0 <= A and 0 <= B and 0 < A + B <= 10**18 ): sys.exit()
if not ( isinstance(N,int) and isinstance(A,int) and isinstance(B,int) ): sys.exit()

count = 0
while N >= 0:
    if N <= A:
        remind = N
        break
    N -= A+B
    count += 1
print(count * A + remind)
Problem p02880 (python)

Fixed submission:
import sys
N = int(input())
array = [ I for I in range(1,10) ]

if not ( 1 <= N <= 100 ): sys.exit()

if N >= 82:
    print('No'); sys.exit()
else:
    for J in array:
        if (N % J) == 0 and (N // J) <= 9 : print('Yes'); sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
array = [ I for I in range(1,10) ]

if not ( 1 <= N <= 100 ): sys.exit()

for J in range(1,10):
    for K in range(1,10):
        if n == J*K:
            print('Yes')
            sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
array = [ I for I in range(1,10) ]

if not ( 1 <= N <= 100 ): sys.exit()

for J in range(1,10):
    for K in range(1,10):
        if n == J*K:
            print('Yes')
print('No')
Problem p02951 (python)

Fixed submission:
import sys
A,B,C = map(int,input().split())
if not ( 1 <= B <= 20 and B <= A <= 20 ): sys.exit()
if not ( 1 <= C <= 20 ): sys.exit()

res =  C - (A - B)
print(res) if res >= 0 else print(0)

Buggy submission (verdict: Runtime Error):
import sys
A,B,C = map(int,input().split())
if not ( 1 <= B <= 20 and B <= A <= 20 ): sys.exit()
if not ( 1 <= C <= 20 ): sys.exit()

res =  C - (A - B)
print(res) if res >= 0 else: print(0)
Problem p03272 (python)

Fixed submission:
import sys
N,i = map(int,input().split())
if not ( 1 <= N <= 100 and 1 <= i <= N ):
    sys.exit()

print(N - i + 1)

Buggy submission (verdict: Runtime Error):
import sys
N,i = map(int,input().split())
array = [ x for x in range(N) ]
if not ( 1 <= N <= 100 and 1 <= i <= N ):
    sys.exit()

for I in range(N):
    if array[i] == array[-I]:
        print(I+1)
Problem p03803 (python)

Fixed submission:
import sys
A,B = map(int,input().split())
if A < 0 or A > 13 or B < 0 or B > 13:
    sys.exit()

if A == 1 or B == 1:
    if A == B:
        print("Draw")
    elif A == 1:
        print("Alice")
    elif B == 1:
        print("Bob")
    sys.exit()

if A > B:
    print("Alice")
elif B > A:
    print("Bob")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
import sys
A,B = map(int,input.split())
if A < 0 or A > 13 or B < 0 or B > 13:
    sys.exit()

if A == 1 or B == 1:
    if A == B:
        print("Draw")
    elif A == 1:
        print("Alice")
    elif B == 1:
        print("Bob")
    sys.exit()

if A > B:
    print("Alice")
elif B > A:
    print("Bob")
else:
    print("Draw")
Problem p03834 (python)

Fixed submission:
import sys
import re
#X = list(map(str,input().split()))
X = str(input())
print(re.sub(',',' ',X))

Buggy submission (verdict: Runtime Error):
import sys
K,S = map(int,input().split())
if K < 2 or K > 2500:
  sys.exit()

X = 0
count = 0
while X <= K:
  Y = 0
  while Y <= K:
    Z = S - X - Y
    if Z <= K and Z >= 0:
      count += 1
    Y += 1
  X += 1
print(count)

Buggy submission (verdict: Runtime Error):
import sys
K,S = map(int,input().split())
if K < 2 or K > 2500:
  sys.exit()
if X > K or Y > K or Z > K:
  sys.exit()

X = 0
count = 0
while X <= K:
  Y = 0
  while Y <= K:
    Z = 0
    while Z <= K:
      if X + Y + Z == S:
        count += 1
      Z += 1
    Y += 1
  X += 1
print(count)

Buggy submission (verdict: Runtime Error):
import sys
import res
#X = list(map(str,input().split()))
X = str(input())
print(re.sub(',',' ',X))
Problem p02771 (python)

Fixed submission:
a, b, c = input().split()
 
if a == b and a != c:
  print('Yes')
elif b == c and b != a:
  print('Yes')
elif c == a and c != b:
  print('Yes')
else:
  print('No')

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

if a == b and a != c:
  print('Yes')
elif b == c and b != a:
  print('Yes')
elif c == a and c != b:
  print('Yes')
else:
  print('No)
Problem p02701 (python)

Fixed submission:
n = int(input())
l =[]
for i in range(0,n):
  l.append(str(input()))
print(len(set(l)))

Buggy submission (verdict: Runtime Error):
n = int(input())
l =[]
for i in range(0,n):
  l.append(input())
print(len(set(l))
Problem p02711 (python)

Fixed submission:
string = input()
list_of_integers =[int(d) for d in str(string)]

l = len(list_of_integers)
ans = "No"
for i in list_of_integers:
  if (i == 7):
    ans = "Yes"
  
print(ans)

Buggy submission (verdict: Runtime Error):
n = list(int(input()))
ans = "No"
for i in range(0 , len(n)):
  if n[i] = 7
  ans = "Yes"
  break
print(ans)
Problem p02726 (python)

Fixed submission:
n,x,y = map(int, input().split())
ans = [0]*n
for i in range(1 , n):
  for j in range(i+1 ,n+1):
    ans[min(abs(j-i),abs(x-i)+abs(y-j)+1)]+=1
    
for i in range(1,n):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
n,x,y = map(int, input().split())
ans = [0]*n
for i in range(0 , n):
  for j in range(i+1 ,n+1):
    ans= ans(min(abs(j-i), abs(x-i), abs(y-j)+1)+1
    
for i in range(1,n):
  print(ans[i])
Problem p02753 (python)

Fixed submission:
s = input()
l = list(s)
ans= "No"
for i in range(0,len(l)-1):
  if(l[i]!= l[i+1]):
    ans = "Yes"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
l = list(s)
for i in range(0,len(l)-1):
  if(l[i]!= l[i+1]):
    print("Yes")
    break()
  else:
    print("No")
Problem p02771 (python)

Fixed submission:
# cook your dish here
l= list(map(int, input().split()))
if(l[0]==l[1]!=l[2] or l[0]!=l[1]==l[2] or l[0]==l[2]!=l[1]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
l= list(map(int input().split()))
if(l[0]==l[1] or l[1]==l[2]) and l[1]!=l[2]:
  print("Yes")
else:
  print("No")
Problem p02773 (python)

Fixed submission:
from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
m = max(S.values())
for v in sorted(k for k, v in S.items() if v == m):
	print(v)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [input() for _ in range(N)]
l.sort()
l2 = []
for i in range(0,N-1):
    if (l[i]==l[i+1]):
        l2.append(l[i])
ans=list(set(l2))
if len(l2)==0:
    for k in range(0,N):
        print(l[k])
for j in range(0,len(l2)):
    print(ans[j])
Problem p02831 (python)

Fixed submission:
a,b = map(int, input().split())
def gcd(a, b):
    while b:
        a, b= b, a%b
    return a
def lcm(a, b):
    return (a * b) // gcd(a, b)
print(lcm(a, b))

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

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

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

Fixed submission:
S = input()

count = 0
for i in range(int(len(S)/2)):
    if S[i] != S[len(S)-i-1]:
        count += 1

print(count)

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

count = 0
for i in range(int(len(S)/2)):
    if S[i] != S[len(S)-i-1]:
        count += 1

print(count)
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('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if d-a<=k
  print('Yay!')
else:
  print(':(')
Problem p02831 (python)

Fixed submission:
import fractions

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

def main():
    
    a,b = map(int, input().split())
    
    ans = lcm(a,b)
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

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

def main():
    
    a,b = map(int, input().split())
    
    print(lcm(a, b))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def main():
    
    a,b = map(int, input().split())
    
    print(lcm(a, b))

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

Fixed submission:

s = str(input())

mm_f = 0
mm_e = 0

if 0 < int(s[0:2]) <= 12:
    mm_f = 1
if 0 < int(s[2:]) <= 12:
    mm_e = 1

if mm_f == 1 and mm_e == 1:
    print('AMBIGUOUS')
elif mm_f == 1 and mm_e == 0:
    print('MMYY')
elif mm_f == 0 and mm_e == 1:
    print('YYMM')
else:
    print('NA')

Buggy submission (verdict: Runtime Error):

s = str(input())

mm_f = 0
mm_e = 0

if 0 < int(s[0:2]) <= 12:
    mm_f = 1
if 0 < int(s[2:]) <= 12:
    mm_e = 1

if mm_f == 1 and mm_e == 1:
    print('AMBIGUOUS')
elif mm_f == 1 and mm == 0:
    print('MMYY')
elif mm_f == 0 and mm_e == 1:
    print('YYMM')
else:
    print('NA')
Problem p03107 (python)

Fixed submission:
S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")
 
print(2*min(c0, c1))

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

while a == 0:
    S.strip("01")
    S.strip("10")
    if "01" in S & "10" in S:
        a = 0
    else:
        a = 1

print(str(N - len(S))

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

tmp = S
a = 0
b = 0
c = 0
count = 0
if len(tmp)-1 == b:
    a = 1
while a == 0:
    if tmp[b] != tmp[b+1]:
        if len(tmp) == 2:
            tmp = ''
            break
        else:
            count += 1
            tmp = tmp[:b] + tmp[b+2:]
            b = 0
            c += 1
    else:
        b += 1
        if len(tmp)-1 == b:
            a = 1

print(str(count*2))
Problem p03011 (python)

Fixed submission:
a = list(map(int,input().split()))
print(sum(a) - max(a))

Buggy submission (verdict: Runtime Error):
a = map(int,input().split())
print(sum(a) - max(a))
Problem p03036 (python)

Fixed submission:
r, d, x = map(int, input().split())
for _ in range(10):
    x = x * r - d
    print(x)

Buggy submission (verdict: Runtime Error):
r, d, x = map(int, input().split())
for _ in range(10):
	x = x * r - d
    print(x)
Problem p03327 (python)

Fixed submission:
print('ABC' if int(input()) < 1000 else 'ABD')

Buggy submission (verdict: Runtime Error):
print('ABC' if int(intput()) < 1000 else 'ABD')
Problem p02793 (python)

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

MOD=10**9+7

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

g=A[0]
for i in range(1, N):
    g = g*A[i]//fractions.gcd(g, A[i])
ans=0
g%=MOD
for i in range(N):
  ans+=g*modinv(A[i],MOD)
  ans%=MOD
print(ans)

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

MOD=10**9+7

g=A[0]
for i in range(1, N):
    g = g*A[i]//fractions.gcd(g, A[i])
ans=0
for i in range(N):
  ans+=int(g/A[i])%MOD
  ans%=MOD
print(ans)
Problem p02627 (python)

Fixed submission:
a = input()
ans = a.upper()
if a == ans:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = input()
ans = upper(a)
if a == ans:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = str(input())
ans = str(upper(a))
if a = ans:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = input()
ans = upper(a)
if a = ans:
  print("A")
else:
  print("a")
Problem p02754 (python)

Fixed submission:
N, A, B = map(int, input().split())
print(N//(A+B)*A+min(A, N%(A+B)))

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>

using namespace std;

long long n, a, b;

int main(){
	cin >> n >> a >> b;
	cout << a*n/(a+b)+min(a, n%(a+b)) << endl;
}
Problem p02935 (python)

Fixed submission:
N = int(input())
e = list(map(int,input().split()))
e.sort()
for i in range(N - 1):
    a = e.pop(0)
    b = e.pop(0)
    e.insert(0, (a+b)/2)
ans = e[0]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
e = list(map(int,input().split()))
for i in range(N):
    x = int(input())
    e.append(x)
e.sort()
for i in range(N - 1):
    a = e.pop(0)
    b = e.pop(0)
    e.insert(0, (a+b)/2)
ans = e[0]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
e = list()
for i in range(N):
    x = int(input())
    e.append(x)
e.sort()
for i in range(N - 1):
    a = e.pop(0)
    b = e.pop(0)
    e.insert(0, (a+b)/2)
ans = e[0]
print(ans)
Problem p02623 (python)

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

A = list(map(int,input().split()))
A.insert(0, 0)
B = list(map(int,input().split()))
a = []
b = []

def nibun(L,l,r,target):

  wrk = -(-(l+r)//2)
  
#  print(l,r,target,wrk)
  
  if r == l:
    if r == len(L):
      return 0
    else:
      return wrk + 1
  
  if l == (len(L)-1):
    if L[wrk-1] > target:
      return wrk
    else:
      return 0

  if L[wrk] == target:
    return wrk+1

  elif L[wrk] > target:
    return nibun(L,l,wrk-1,target)

  else:
    return nibun(L,wrk,r,target)

  
s = 0
for i,e in enumerate(B):
  s += e 
  b.append(s)

s = 0
ans = 0
for i in range(len(A)):
#  print(i,'kaime')
#  print(s,i,A[i])
  s += A[i]
  if s > K:
    break
  else:  
    wrk = nibun(b,-1,len(b),K-s)
    
    ans=max(ans,i+wrk)
#    print('koko',s,wrk,ans)

print(ans)

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

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

X = 0
I = 0
J = 0



def read(i,j,k,x):
  
#  print('i',i,' j',j,' k',k,' x',x)
  
  if i == len(A):
    ans1 = x
  else:
    if k >= A[i]:
      ans1 = read(i+1,j,k-A[i],x+1)
    else:
      ans1 = x
  
  if j == len(B):
    ans2 = x
  else:
    if k >= B[j]:
      ans2 = read(i,j+1,k-B[j],x+1)
    else:
      ans2 = x
  
  return max(ans1,ans2)
  
print(read(I,J,K,0))
Problem p02711 (python)

Fixed submission:
n=input()
flg = 0
for s in n:
    if s == '7':
        flg = 1
 
if flg == 1:
      print('Yes')
else:
      print('No')

Buggy submission (verdict: Runtime Error):
flg = 0
for s in n:
    if s == '7':
        print(s)
        flg = 1

if flg == 1:
      print('Yes')
else:
      print('No')
Problem p02723 (python)

Fixed submission:
s = input()

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

else:
    print('No')

Buggy submission (verdict: Runtime Error):
k , n = (int(x) for x in input().split())
a = [int(i) for i in input().split()]
b = []

for i in range(n-1):
    b.append(a[i+1] - a[i])
    
b.append(a[0] + k -a[n-1])

ans=0

b.sort()

for i in range(len(b)-1):
    ans = b[i] + ans
    
    
print(ans)
Problem p02725 (python)

Fixed submission:
k , n = (int(x) for x in input().split())
a = [int(i) for i in input().split()]
b = []
 
for i in range(n-1):
    b.append(a[i+1] - a[i])
    
b.append(a[0] + k -a[n-1])

ans=0 
b.sort()
 
for i in range(len(b)-1):
    ans = b[i] + ans

print(ans)

Buggy submission (verdict: Runtime Error):
k , n = (int(x) for x in input().split())
a = [int(i) for i in input().split()]

for i in range(n-1):
    b.append(a[i+1] - a[i])
    
b.append(a[0] + k -a[n-1])

lans=0
ans = 999999999999

for i in range(len(b)):
    lans = 0
    for j in range(len(b)):
        if i != j:
            lans = b[j] + lans
    ans = min(ans,lans)
    
print(ans)
Problem p03011 (python)

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

i.sort();

print(i[0]+i[1]);

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
 
sum_W = sum(W)
add_W = 0
 
for i in range(N):
   add_W += W[i]
   if add_W >= sum_W - add_W:
       print(min(abs(add_W - sum_W + add_W), abs(add_W - W[i] - sum_W + add_W - W[i])))
       break

Buggy submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
 
sum_W = sum(W)
add_W = 0
 
for i in range(N):
   add_W += W[i]
   if add_W >= sum_W - add_W:
       print(min(abs(add_W - sum_W + add_W), abs(add_W - W[i] - sum_W + add_W - W[i])))
       break
Problem p03012 (python)

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
 
sum_W = sum(W)
add_W = 0
 
for i in range(N):
   add_W += W[i]
   if add_W >= sum_W - add_W:
       print(min(abs(add_W - sum_W + add_W), abs(add_W - W[i] - sum_W + add_W - W[i])))
       break

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

sum_list = sum(w);
sum_list2 = sum_list/2;

sum_of_all = 0;
i = 0;
while sum_of_all <sum_list2:
  sum_of_all += sum_list[i];
  i=i+1;
  
print(abs((sum_list-sum_of_all)-sum_of_all))
Problem p02676 (python)

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

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

Fixed submission:
s = input()
str = list(s)
 
ca = str.count("A")
cb = str.count("B")
 
if ca == 3 or cb == 3:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
in = input()
str = list(in)

ca = str.count("A")
cb = str.count("B")

if ca == 3 or cb == 3:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
in = input()
str = list(in)

bef = str[0]
for i in range(3):
  if bef != str[i]:
    print("Yes")
    exit()
print("No")
Problem p02860 (python)

Fixed submission:
import sys
n = int(input())
s = input()
d = int(n/2)
if(len(s)%2 == 1):
    print("No")
    sys.exit()
else:
    for i in range(d):
        if(s[i] != s[i + d]):
            print("No")
            sys.exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
s = input()
a = int(len(s)/2)

if(len(a)%2 == 1):
  print("No")
  sys.exit()

for i in range(a):
  if(s[i] != s[i + a]):
    print("No")
    sys.exit()
    
print("Yes")
Problem p02879 (python)

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

if(a > 9 or b > 9):
    print("-1")
else:

    print(a*b)

Buggy submission (verdict: Runtime Error):
a,b  = int(input().split())
print(a*b)
Problem p02897 (python)

Fixed submission:
import math
import itertools
n = int(input())
 
if(n %2 == 1):
    d = int((n-1)/2) + 1
else:
    d = int(n/2)
 
ans = d/n
 
print('{:.08f}'.format(ans))

Buggy submission (verdict: Runtime Error):
import math
import itertools
n = int(input())

if(n %2 == 1):
    d = int((n-1)/2) + 1
else:
    d = int(n/2)

ans = d/n

print(f'{ans:.08f}')
Problem p02831 (python)

Fixed submission:
import fractions

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

Buggy submission (verdict: Runtime Error):
import math

a,b=map(int,input().split())
print(a*b//math.gcd(a,b))