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

Fixed submission:
def main():
    N,M = map(int, input().split())
    Xs = [int(s) for s in input().split()]

    # 目的地よりコマが多いなら操作は不要
    if N >= M:
        print(0)
        return

    Xs.sort()
    distance_list = []
    for i in range(M):
        if i == M-1:
            break
        distance = abs(Xs[i] - Xs[i+1])
        distance_list.append(distance)
    distance_list.sort(reverse=True)

    for i in range(N-1):
        distance_list.pop(0)

    print(sum(distance_list))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N,M = map(int, input().split())
    Xs = [int(s) for s in input().split()]

    # 目的地よりコマが多いなら操作は不要
    if N >= M:
        print(0)
        return

    Xs.sort()
    distance_list = []
    for i in range(M):
        if i == M-1:
            break
        distance = abs(Xs[i] - Xs[i+1])
        distance_list.append(distance)
    distance_list.sort(reverse=True)

    for i in range(N-1):
        distance_list.pop(i)

    print(sum(distance_list))


if __name__ == "__main__":
    main()
Problem p03250 (python)

Fixed submission:
def main():
    inputs = [int(s) for s in input().split()]
    sorted_list = sorted(inputs,reverse=True)
    result = int(str(sorted_list[0])+str(sorted_list[1])) + sorted_list[2]
    print(result)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    ABC = [int(s) for s in input().split()]
    sorted = ABC.sort()
    result = int(str(sorted[0])+str(sorted[1])) + sorted[2]
    print(result)

if __name__ == "__main__":
    main()
Problem p03135 (python)

Fixed submission:
t,x = map(int, input().split())
print(t/x)

Buggy submission (verdict: Runtime Error):
t = int(input())
x = int(input())
print(t/x)
Problem p03723 (python)

Fixed submission:
a,b,c = map(int,input().split())
for i in range(600):
  if a&1 or b&1 or c&1:
    break
  a,b,c = a//2, b//2, c//2
  a, b, c = b + c, a + c, a + b
ans = i if i < 500 else -1
print(ans)

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


for i in range(600):
  if a == b and b == c:
    break
  a,b,c = a//2, b//2, c//2
  a, b, c = b + c, a + c, a + b
ans = i if i < 600 else -1
print(-1
Problem p02773 (python)

Fixed submission:
n = int(input())
l = [str(input()) for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

if max == 1:
  ans.append([l[n-1], 1])
      
for i in ans:
  if i[1] == max:
    print(i[0])

Buggy submission (verdict: Runtime Error):
l = [input() for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

for i in ans:
  if i[1] == max:
    print(i[0])

Buggy submission (verdict: Runtime Error):
l = [input() for i in range(n)]
l.sort()
i = 0
max = 1
count = 1
ans = []

while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if i == n-1 and count >= max:
      ans.append(l[n-1])

  else:
    if count >= max:
      max = count
      ans.append(l[i])
      count = 1
      i += 1
    else:
      count = 1
      i += 1

if max == 1:
  ans.append(l[n-1])
      
for i in ans:
  print(i)
Problem p02989 (python)

Fixed submission:
n=int(input())
list=list(map(int,input().split()))
list2=list.sort()

print(list[int(n/2)]-list[int(n/2)-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
list=list(map(int,input().split()))
list2=sorted(list)
if n%2==0:
  print(list[n/2]-list[n/2-1])
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
list=list(map(int,input().split()))
list2=sort(list)
if n%2==0:
  print(list[n/2]-list[n/2-1])
else:
  print(0)
Problem p02990 (python)

Fixed submission:
import math
MOD = 10 ** 9 + 7

N, K = map(int, input().split())


def f(n):
    return math.factorial(n)


for i in range(K):
    if N - K - i >= 0:
        print(f(N - K + 1) // f(N - K - i) // f(i + 1)
              * (f(K - 1) // f(K - i - 1) // f(i)) % MOD)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  if n-k+1 >= i:
    print((int(factorial(k-1) * factorial(n-k+1)/factorial(i-1)/factorial(k-i)/factorial(i)/factorial(n-k+1-i))%((10**9)+7)))
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  if n-k+1 >= i:
    print(int(factorial(k-1) * factorial(n-k+1)/factorial(i-1)/factorial(k-i)/factorial(i)/factorial(n-k+1-i))%((10**9)+7))
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  if n-k+1 >= i:
    print(int((factorial(k-1) * factorial(n-k+1)/factorial(i-1)/factorial(k-i)/factorial(i)/factorial(n-k+1-i))%((10**9)+7)))
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  if n-k+1 >= i:
    print(int(((factorial(k-1)) * (factorial(n-k+1))/(factorial(i-1))/(factorial(k-i))/(factorial(i))/(factorial(n-k+1-i)))%(10**9+7)))
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  if n-k+1 >= i:
    print(int(((factorial(k-1)) * (factorial(n-k+1))/(factorial(i-1))/(factorial(k-i))/(factorial(i))/(factorial(n-k+1-i)))%(10**9+7)))
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  if n-k+1-i >= i:
    print(int(((factorial(k-1)) * (factorial(n-k+1))/(factorial(i-1))/(factorial(k-i))/(factorial(i))/(factorial(n-k+1-i)))%(10**9+7)))
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
from math import factorial 
for i in range(1,k+1):
  print(((factorial(k-1)) * (factorial(n-k+1))/(factorial(i-1))/(factorial(k-i))/(factorial(i))/(factorial(n-k+1-i)))%(10**9+7))
Problem p03072 (python)

Fixed submission:
n=int(input())
li=list(map(int,input().split()))
count=0
for i in range(1,n):
  if li[i] >= max(li[0:i]):
    count +=1
print(count+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
li=list(map(int,input().split()))
count=0
for i in range(1,n):
  if li[i] >= max(li[0:i])
    count +=1
print(count+1)
Problem p03073 (python)

Fixed submission:
n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0:
  counta=0 
  countb=0
  a=list("10"*int((int(len(n))/2)))
  b=list("01"*int((int(len(n))/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(len(n))-1)/2))+"1")
  bb=list("01"*int(((int(len(n))-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(aa[i]))
    countbb+=abs(int(li[i])-int(bb[i]))
  print(min(countaa,countbb))

Buggy submission (verdict: Runtime Error):
n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0:
  counta=0 
  countb=0
  a=list("10"*int((int(n)/2)))
  b=list("01"*int((int(n)/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(n)-1)/2))+"1")
  bb=list("01"*int(((int(n)-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(aa[i]))
    countbb+=abs(int(li[i])-int(bb[i]))
  print(min(countaa,countbb))

Buggy submission (verdict: Runtime Error):
n=input()
li=list(n)
if len(n)==1:
  print(0)
elif len(n)%2==0 and len(n) != 1:
  counta=0 
  countb=0
  a=list("10"*int((int(n)/2)))
  b=list("01"*int((int(n)/2)))
  for i in range(len(n)):
    counta+= abs(int(li[i])-int(a[i]))
    countb+=abs(int(li[i])-int(b[i]))
  print(min(counta,countb))

elif len(n)%2==1 and len(n) != 1:
  countaa=0 
  countbb=0
  aa=list("10"*int(((int(n)-1)/2))+"1")
  bb=list("01"*int(((int(n)-1)/2))+"0")
  for i in range(len(n)):
    countaa+=abs(int(li[i])-int(a[i]))
    countbb+=abs(int(li[i])-int(b[i]))
  print(min(countaa,countbb))
Problem p03186 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a + b >= c :
  print(b+c)
elif a==b==c==0:
  print(0)
else:
  print(a+2*b+1)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a + b >= c + 1:
  print(b+c)
elif a==b==c==0:
  print(0)
elif a+b=c:
  print(b+c)
else:
  print(a+2*b+1)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a + b >= c:
  print(b+c)
else:
  print(a+2b)
Problem p03265 (python)

Fixed submission:
x1,y1,x2,y2=map(int,input().split())
x3=x2+y1-y2
y3=y2+x2-x1
x4=x3+y2-y3
y4=y3+x3-x2
print(x3,y3,x4,y4)

Buggy submission (verdict: Runtime Error):
x(1),y(1),x(2),y(2)=map(int,input().split())
for i in range(3,5):
  x(i)=x(i-1)+y(i-2)-y(i-1)
  y(i)=y(i-1)+x(i-1)-x(i-2)
print(x(3) y(3) x(4) y(4))
Problem p02785 (python)

Fixed submission:
N,K = map(int,input().split())
hp = list(map(int,input().split()))
hp_sort = sorted(hp)
if K < N:
    print(sum(hp_sort[0:N-K]))
else:
    print('0')

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
hp = list(map(int,input().split()))
hp_sort = sorted(hp,reverse = True)
if K < len(hp):
    i = 0
    for i in range(K):
        del hp_sort[i]
    print(sum(hp_sort))
else:
    print('0')

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
hp = list(map(int,input().split()))
hp_sort = sorted(hp,reverse = True)
if K < len(hp):
    for i in range(K):
        del hp_sort[i]
    print(sum(hp_sort))
else:
    print('0')
Problem p02792 (python)

Fixed submission:
N = int(input())

import numpy as np

X = np.arange(N+1)
A = X.copy()

for i in [1,10,100,1000,10000,100000]:
    A[i:i*10] = X[i:i*10] // i
B = X % 10

C = np.zeros((10,10), dtype=int)

for i in range(1,N+1):
    C[A[i], B[i]] += 1
count = 0

for i in range(10):
    for j in range(10):
        count += C[i][j] * C[j][i]

print(count)

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

import numpy as np

X = np.arange(N+1)
A = X.copy()

for i in [1,10,100,1000,10000]:
    A[i:i*10] = X[i:i*10] // i
B = X % 10
C = np.zeros((10,10), dtype=int)

for i in range(1,N+1):
    C[A[i], B[i]] += 1
count = 0

for i in range(10):
    for j in range(10):
        count += C[i][j] * C[j][i]
print(count)
Problem p02820 (python)

Fixed submission:
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

import numpy as np

score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)

t = t.reshape(M,K).T

for i in range(K):
    for j in range(M):
        if j!=0 and t[i,j] == t[i,j-1]:
            t[i,j] = 0

print(score[t].sum())

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)

t = t.reshape(M,K).T

for i in range(K):
    for j in range(M):
        if j!=0 and t[i,j] == t[i,j-1]:
            t[i,j] = 0

print(score[t].sum())
Problem p02831 (python)

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

import fractions 

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

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

import math

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

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

import math

print(A * B // gcd(A, B))
Problem p02863 (python)

Fixed submission:
# E
import numpy as np
N, T = map(int, input().split())
# A=cost. B=value
A, B = np.array([input().split() for _ in range(N)], dtype=int).T

weight,value = A, B
# dp[i][w] = i番目までからwを超えないように選んだ時の最大値, まだ最後の食べ物を選んでない
d0 = np.zeros((N,T),int)
# dp[i][w] = i番目までからwを超えないように選んだ時の最大値, もう最後の食べ物を選んだ
d1 = np.zeros((N,T),int)
# 初期値として0番目の商品を加える
d0[0,weight[0]:] = value[0]
d1[0,:] = value[0]

for n in range(1, N):
  w = weight[n]
  # w < weight[n]
  d0[n][:w] = d0[n-1][:w]
  d1[n][:w] = np.fmax(d1[n-1][:w], d0[n-1][:w] + value[n])
  # w >= weight[n]
  d0[n][w:] = np.fmax(d0[n-1][:-w] + value[n], d0[n-1][w:])
  d1[n][w:] = np.fmax(np.fmax(d1[n-1][:-w] + value[n], d1[n-1][w:]), d0[n-1][w:] + value[n])

print(d1[-1,-1])

Buggy submission (verdict: Runtime Error):
# E
import numpy as np
N, T = map(int, input().split())
# A=cost. B=value
A, B = np.array([input().split() for _ in range(N)], dtype=int).T

weight,value = A, B
# dp[i][w] = i番目までからwを超えないように選んだ時の最大値, まだ最後の食べ物を選んでない
d0 = np.zeros((N,T),int)
# dp[i][w] = i番目までからwを超えないように選んだ時の最大値, もう最後の食べ物を選んだ
d1 = np.zeros((N,T),int)
# 初期値として0番目の商品を加える
d0[0,weight[0]:] = value[0]
d1[0,:] = value[0]

for n in range(1, N):
  for w in range(T):
    if (w >= weight[n]):
      d0[n][w] = np.max(d0[n-1][w-weight[n]] + value[n], d0[n-1][w])
      d1[n][w] = np.max(d1[n-1][w-weight[n]] + value[n], d1[n-1][w], d0[n-1][w] + value[n])
    else:
      d0[n][w] = d0[n-1][w]
      d1[n][w] = np.max(d1[n-1][w], d0[n-1][w] + value[n])

print(d1[-1,-1])
Problem p02847 (python)

Fixed submission:
day = input()

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT':6}

print(7 - days[day])

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

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT',6}

print(7 - days[day])

Buggy submission (verdict: Runtime Error):
day = input().rstrip()

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT',6}

print (7 - days[day])

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

days = {'SUN':0, 'MON':1, 'TUE':2, 'WED':3, 'THU':4, 'FRI': 5,'SAT',6}

print (7 - days[day])
Problem p03041 (python)

Fixed submission:
x = input()
s = input()

n, k = x.split()
k = int(k)
s = list(s)

s[k-1] = s[k-1].lower()

print("".join(s))

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

a, b = x.split()
a = list(a)
b = int(b)

a[b] = a[b].lower()

print("".join(a))
Problem p02754 (python)

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

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ana=N//(A+B)*A
rem=N%(A+B)
ana=ana+rem.count(A)
print(ana)
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
if (a==b or b==c or c==a) :
  if a==b==c:
    print("No")
  else :
    print("Yes")

else :
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if (a==b or b==c or c==a) :
  if a==B==C:
    print("No")
  else :
    print("Yes")

else :
    print("No")
Problem p02915 (python)

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

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

score = 0
for i in range(0,N-1):
    if A[i+1] - A[i] == 1:
        score += C[A[i] - 1]

print(score + sum(B))
Problem p03041 (python)

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

str_list = list(before_str)
str_list[K-1] = str_list[K-1].swapcase()

after_str = ''.join(str_list)

print(after_str)

Buggy submission (verdict: Runtime Error):
#NとKに数値入る                                                                                                                   N,K = map(int, input().split())

#before_strに文字列
before_str = input()

str_list = list(before_str)
str_list[K-1] = str_list[K-1].swapcase()

after_str = ''.join(str_list)

print(after_str)
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):
usr = eval(input())
if usr[-1] == usr[-2] and usr[-3] == usr[-4]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
user_input = eval(input())
print((user_input // 500) * 1000 + ((user_input % 500) // 5) * 5)
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().rstrip().split())
k = n // (a + b)
r = n % (a + b)
print(k * a + min(r, a))

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split().rstrip())
k = n // (a + b)
r = n % (a + b)
print(k * a + min(r, a))
Problem p02757 (python)

Fixed submission:
n, p = map(int, input().rstrip().split())
s = input().rstrip()

if p == 2 or p == 5:
    ans = 0
    s = map(int, s)
    for i, c in enumerate(s):
        if c % p == 0:
            ans += i + 1
    print(ans)
else:
    s = s[::-1]
    cnt = [0] * p
    k = 0
    cnt[k] = 1
    w = 1
    for i, c in enumerate(map(int, s)):
        k = c * w + k
        w *= 10
        while k >= p:
            k -= p
        while w >= p:
            w -= p
        cnt[k] += 1

    ans = 0
    for i in range(p):
        ans += cnt[i] * (cnt[i] - 1) // 2
    print(ans)

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

if p == 2 or p == 5:
    ans = 0
    s = map(int, s)
    for i, c in enumerate(s):
        if c % p == 0:
            ans += i + 1
    print(ans)
else:
    s = s[::-1]
    cnt = [0] * p
    k = 0
    cnt[k] = 1
    for i, c in enumerate(map(int(s))):
        k = (c * (10**i) + k) % p
        cnt[k] += 1

    ans = 0
    for i in range(p):
        ans += cnt[i] * (cnt[i] - 1) // 2
    print(ans)
Problem p04005 (python)

Fixed submission:
a, b, c = [int(i) for i in input().split()]
if a*b*c %2==0:
  print(0)
else:
  print(min(a*b, a*c, b*c))

Buggy submission (verdict: Runtime Error):
def solve(n, x, a):
	costs = []
	cost_min = 0
	for k in range(n):
		if k == 0:
			costs = a.copy()
		else:
			for i in range(n):
				costs[i] = min(costs[i], a[(i-k)%n])
		cost_k = sum(costs) + k*x
		if k == 0:
			cost_min = cost_k
		else:
			cost_min = min(cost_min, cost_k)		
		if cost_min < (k+1) *x:
			break

	return cost_min
n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
print(solve(n,x,a))
Problem p04021 (python)

Fixed submission:
def solve(a):
	l = len(a)
	h = l//2 + l%2
	a0 = [a[2*i] for i in range(h)]
	b = a.copy()
	b.sort()
	b0 = [b[2*i] for i in range(h)]

	a0 = set(a0)
	b0 = set(b0)

	return len(a0 - b0)
n = int(input())
a = [int(input()) for i in range(n)]
print(solve(a))

Buggy submission (verdict: Runtime Error):
def solve(a):
	l = len(a)
	a1 = [a[2*i+1] for i in range((l+1)//2)]
	b = a.copy()
	b.sort()
	b1 = [b[2*i+1] for i in range((l+1)//2)]

	a1 = set(a1)
	b1 = set(b1)

	return len(a1 - b1)
n = int(input())
a = [int(input()) for i in range(n)]
print(solve(a))
Problem p02777 (python)

Fixed submission:
S,T = input().split()
A,B = input().split()
U = input()
A,B = int(A), int(B)

if U == T:
    B -= 1
elif U == S:
    A -= 1

print(A , " " , B)

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

if U == T:
    B -= 1
if U == S:
    A -= 1

print(A , " " , B)

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

if U == T:
    B -= 1
if U == S:
    A -= 1
    
print(str(A) +  " " + str(B))
Problem p02725 (python)

Fixed submission:
# C - Traveling Salesman around Lake
K,N = list(map(int, input().split()))
A = list(map(int, input().split()))

a = A[1] - A[0]
for i in range(1,N-1):
    j = i + 1
    a = max(a,A[j]-A[i])

b = K-(A[N-1]-A[0])
c = max(a,b)
ans = K -c
print(ans)

Buggy submission (verdict: Runtime Error):
# C - Traveling Salesman around Lake
K,N = list(map(int, input().split()))
A = list(map(int, input().split()))

import numpy as np
D = np.zeros((N, N))

for i in range(N):
    j = (i+1)%N
    if j == 0:
        D[i,j]=K-abs(A[j]-A[i])
    else:
        D[i,j] = abs(A[j]-A[i])

idx = np.unravel_index(np.argmax(D), D.shape)
dmax = D[idx]
ans = int(K - dmax)
print(ans)
Problem p02829 (python)

Fixed submission:
l1 = [1,2,3]
l2 = [int(input()) for i in range(2)]
ans = list(set(l1) - set(l2))
print(ans[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T  = input().split()

S_list = list(S)
T_list = list(T)
U_list = []
for i in range(N):
    U_list.append(S_list[i])
    U_list.append(T_list[i])

U = ''.join(U_list)
print(U_list)

Buggy submission (verdict: Runtime Error):
N = int(input())
S, T  = input().split()

S_list = list(S)
T_list = list(T)
U_list = []
for i in range(N):
    U_list.append(S_list[i])
    U_list.append(T_list[i])

U = ''.join(U_list)
print(U)
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
r = input()
s = r**2
print(s)
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input()**2))

Buggy submission (verdict: Runtime Error):
print(input()**2)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = str(input())
 
if N + 2 // 2 == 1:
    print('No')
 
else:
    f = int(N/2)
    b = int(N/2)
    front = S[:f]
    back = S[b:]
    if front == back:
        print('Yes')
    else:
        print('No')
    
#print(front)
#print(back)

Buggy submission (verdict: Runtime Error):
Source Code 

Copy
Copy
N = input()
S = str(input())
 
if N + 2 // 2 == 1:
  print('No')
 
else:
  f = int((N/2)-1)
  b = int(N/2)
  front = S[:f]
  back = S[b:]
  if front == back:
    print('Yes')
  else:
    print('No')

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

if N + 2 // 2 == 1:
  print('No')

else:
  f = int(N/2)
  b = int(N/2)
  front = S[:f]
  back = S[b:]
  if front == back:
    print('Yes')
  else:
    print('No')
Problem p02897 (python)

Fixed submission:
N = int(input())
odd = 0
for i in range (1, N+1):
    if i%2==1:
        odd += 1

print(odd/N)

Buggy submission (verdict: Runtime Error):
N = int(input())
odd = 0
if i%2==1 for i in range (1, N+1):
  odd += 1
print(odd//N)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = str(input())

if a<3200:
  print('red')
else:
  print(s)

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

if a<3200:
  print('red')
else:
  print(s)

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

if a<3200:
  print('red')
else:
  print(s)
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
if s == "AAA" or s == "BBB":
  return True
else:
  return False
Problem p02754 (python)

Fixed submission:
n,a,b = map(int,input().split())
print((n//(a+b))*a+min(n%(a+b),a))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
print(a*n//(a+b)+min(n%(a+b),a)
Problem p02771 (python)

Fixed submission:
nums= input().split()


for i in range(len(nums)):
    nums[i] = int(nums[i])
    
nums.sort()


if nums[1] == nums[2] and nums[0]<nums[1]:
    print("Yes")
elif nums[1] == nums[0] and nums[1]<nums[2]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
nums= input().split()


for i in range(len(nums)):
    nums[i] = int(nums[i])
    
nums.sort()


if nums[1] == nums[2] and nums[0]<nums[1]:
    print(Yes)
elif nums[1] == nums[0] and nums[1]<nums[2]:
    print(Yes)
else:
    print(No)

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

nums.sort()


if nums[1] == nums[2] and nums[0]<nums[1]:
    print(True)
elif nums[1] == nums[0] and nums[1]<nums[2]:
    print(True)
else:
    print(False)