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

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

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for i in range(m)]

l = []
for i in range(n):
  S = s.count(s[i])
  T = t.count(s[i])
  l.append(S - T)
  
if max(l) < 0:
  print("0")
else:
  print(max(l))
Problem p03408 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]

l = []
for i in range(n):
  S = s.count(s[i])
  T = t.count(s[i])
  l.append(S - T)
  
if max(l) < 0:
  print(0)
else:
  print(max(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for i in range(m)]

l = []
for i in range(n):
  S = s.count(s[i])
  T = t.count(t[i])
  l.append(S - T)
  
if max(l) < 0:
  print("0")
else:
  print(max(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for _ in range(n)]
m = int(input())
t = [int(input()) for i in range(m)]

l = []
for i in range(n):
  S = s.count(i)
  T = t.count(i)
  l.append(S - T)
  
if max(l) < 0:
  print("0")
else:
  print(max(l))
Problem p03424 (python)

Fixed submission:
n = int(input())
s = list(input().split())

if len(set(s)) == 3:
  print("Three")
else:
  print("Four")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list[input().split()]

if len(set(s)) == "Y":
  print("Four")
else:
  print("Three")

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
  s = input():
    if s == "Y":
      print("Four")
      break
    else:
      print("Three")
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())

if n%500 <= a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n , a = map(int,input().split())
if n%500 < a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n , a = map(int,input().split())
if 500%n >= a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n , a = map(int,input().split())
if 500%n <= a:
  print("Yes")
else:
  print("No")
Problem p03447 (python)

Fixed submission:
x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

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

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

Buggy submission (verdict: Runtime Error):
x,a,b = map(int,input().split())
print((x-a)%b)
Problem p03456 (python)

Fixed submission:
c=int(input().replace(" ",""))
print("Yes" if c==int(c**.5)**2 else "No")

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
c = (a,b)
if c == ((c**.5)**2):
  print("Yes")
else:
  print("No")
Problem p03469 (python)

Fixed submission:
s = input()
print(s.replace("2017","2018"))

Buggy submission (verdict: Runtime Error):
s = input()
print(s.replace("2017,"2018"))
Problem p03477 (python)

Fixed submission:
a, b, c, d = map(int,input().split())
if a + b > c + d:
  print("Left")
 
elif a + b < c + d:
  print("Right")
 
else:
  print("Balanced")

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int,input().split())
if a + b > c + d:
  prtin("Left")

elif a + b < c + d:
  print("Right")

else:
  print("Balanced")

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int,input().split())
if a + b > c + d:
  prtin("Left")

elif a + b < c + d:
  print("Right")

else:
  print("Balanced")

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int,input().split())
if a + b > c + d:
  prtin("Left")

elif a + b < c + d:
  print("Right")

else:
  print("Balansed")
Problem p03547 (python)

Fixed submission:
x, y = input().split()
if x < y:
  print("<")
 
elif x == y:
  print("=")
  
else:
  print(">")

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())
if x < y:
  print("<")

elif x == y:
  print("=")
  
else:
  print(">")
Problem p03605 (python)

Fixed submission:
n = list(input())
if n[0] == "9" or n[1] == "9":
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = list(input())
if n.index("9"):
    print("Yes")
else:
    print("No")
Problem p03635 (python)

Fixed submission:
n,m = map(int,input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
print(s[0] + str(len(s)-2) + s[-1])

Buggy submission (verdict: Runtime Error):
s = str(input())
print(s[0]+len(s)+s[-1])

Buggy submission (verdict: Runtime Error):
s = input()
print(s[0]+len(s)+s[-1])

Buggy submission (verdict: Runtime Error):
n,m = (int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m = (int(input()).split())
print((n-1)*(m-2))

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
print((n-1)*(m-1))
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
s = intput()

print(s[0] + str((len(s)-2)) + s[-1])

Buggy submission (verdict: Runtime Error):
print(s[0] + str((len(s)-2)) + s[-1])

Buggy submission (verdict: Runtime Error):
print(s[0] + str((len-2)) + s[-1])

Buggy submission (verdict: Runtime Error):
s = input()
print(s[0]+s.count()+s[-1])
Problem p03657 (python)

Fixed submission:
a, b = map(int,input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
  print("Possible")

else:
  print("Impossible")

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
l = list(input())
a = sorted(l)[::1]
print(sum(a)[-k:])
Problem p03679 (python)

Fixed submission:
x, a, b = map(int,input().split())
 
if 0 >= (b - a):
  print("delicious")
elif x < (b - a):
  print("dangerous")
else:
  print("safe")

Buggy submission (verdict: Runtime Error):
x, a, b = map(int,input().split())
 
if x => abs(b - a):
  print("safe")
elif x <= abs(b - a):
  print("dangerous")
else:
  print("delicious")

Buggy submission (verdict: Runtime Error):
x, a, b = map(int,input().split())
 
if x >= abs(b - a):
  print("safe")
elif x =< abs(b - a):
  print("dangerous")
else:
  print("delicious")
Problem p03729 (python)

Fixed submission:
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if a[-1] == b[0] and b[-1] == c[0]:
	print("YES")
else:
	print("NO")
Problem p03759 (python)

Fixed submission:
a, b, c = map(int,input().split())
if c - b == b - a:
	print("YES")
else:
	print("NO")

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

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input().split())
if c - b = a - b:
	print("Yes")
else:
	print("No")
Problem p03777 (python)

Fixed submission:
a, b = input().split()
if a =="H" and b == "H":
  print("H")
elif a == "H" and b == "D":
  print("D")
elif a == "D" and b == "H":
  print("D")
else:
  print("H")

Buggy submission (verdict: Runtime Error):
a, b input().split()
if a == "H" and b == "H":
  print("H")
elif a == "H" and b == "D":
  print("D")
elif a == "D" and b == "H":
  print("D")
else:
  print("H")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
if a == "H" and b == "H":
  print("H")
elif a == "H" and b == "D":
  print("D")
elif a == "D" and b == "H":
  print("D")
else:
  print("H")

Buggy submission (verdict: Runtime Error):
a, b = input().split())
if a =="H" and b == "H":
  print("H")
elif a == "H" and b == "D":
  print("D")
elif a == "D" and b == "H":
  print("D")
else:
  print("H")
Problem p03852 (python)

Fixed submission:
c = input()
if c == "a" or c == "i" or c == "u" or c == "e" or c == "o":
	print("vowel")
    
else:
	print("consonant")

Buggy submission (verdict: Runtime Error):
c = input()
if c = "a" or c = "i" or c = "u" or c = "e" or c = "o":
	print("vowel")
    
else:
	print("consonant")

Buggy submission (verdict: Runtime Error):
c = input()
if c = "a" or c = "i" or c = "u" or c = "e", c = "o":
	print("vowel")
    
else:
	print("consonant")
Problem p03943 (python)

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

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

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print(((a+b)*h)//2)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int,input().split())
print(((a+b)*h)//2)

Buggy submission (verdict: Runtime Error):
a, b, h = map(int.input().split())
print(((a+b)*h)//2)
Problem p04043 (python)

Fixed submission:
a, b, c = map(int,input().split())
if a == 5 and b == 5:
  print("YES")
elif b == 5 and c == 5:
  print("YES")
elif a == 5 and c == 5:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")
Problem p02848 (python)

Fixed submission:
n = int(input())
s = input()
alps = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
number = 0
ans = str()

for i in range(len(s)):
  alp = s[i]
  for j in range(26):
    if alps[j] == alp:
      number = (j + n) % 26
      ans += alps[number]
      
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
alps = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
number = 0
ans = str()

for i in range(n):
  alp = s[i]
  for j in range(26):
    if alps[j] == alp:
      number = (j + n) % 26
      ans += alps[number]

print(ans)
Problem p02885 (python)

Fixed submission:
x = input().split()
 
a = int(x[0])
b = int(x[1])
 
if a > b * 2:
  ret = a - b * 2
else:
  ret = 0
  
print(ret)

Buggy submission (verdict: Runtime Error):
a, b = int(input().split())
 
if a > b * 2:
  ret = a - b * 2
else:
  ret = 0
  
print(ret)

Buggy submission (verdict: Runtime Error):
x = input().split()
 
a = x[0]
b = x[1]
 
if a > b * 2:
  print(a - b * 2)
else:
  print(0)

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

a = x[0]
b = x[1]

if a > b * 2:
  ret = a - b * 2
else:
  ret = 0
  
print(ret)

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

if a > b * 2:
  ret = a - b * 2
else:
  ret = 0
  
print(ret)
Problem p02886 (python)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
cnt = 0
 
for i in range(N-1):
	for j in range(i+1, N):
  		cnt += d[i] * d[j]
 
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int, input().split()))
cnt = 0

for i in range(N-1)
	for j in range(i+1, N)
  		cnt += d[i] * d[j]

print(cnt)
Problem p02887 (python)

Fixed submission:
N = int(input())
S = input()
cnt = 0

for i in range(N-1):
  if S[i] == S[i+1]:
    cnt += 1
    
print(N - cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
cnt = 0
 
for i in range(N-1):
	if S[i] == S[i+1]:
      cnt += 1
 
print(N - cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
cnt = 0
 
for i in range(N-1):
	if S[i] == S[i+1]:
      	cnt += 1

print(N - cnt)

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

for i in range(N-1):
	if S[i] = S[i+1]:
      	cnt += 1

ret = N - cnt

print(ret)
Problem p02898 (python)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
cnt = 0
 
for i in range(N):
  if h[i] >= K:
    cnt += 1
    
print(cnt)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(input().split()))
cnt = 0
 
for i in range(N):
  if h[i] >= K:
    cnt += 1
    
print(cnt)

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

for i in range(N):
  if h[i] >= K:
    cnt += 1
    
print(cnt)
Problem p03720 (python)

Fixed submission:
n, m = map(int, input().split())
a = []
b = []
for i in range(m):
  l = list(map(int, input().split()))
  a.append(l[0])
  b.append(l[1])
cnt = 0

for i in range(1, n+1):
  for j in range(m):
    if a[j] == i:
      cnt += 1
    if b[j] == i:
      cnt += 1
  print(cnt)
  cnt = 0

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
b = []
for i in range(m):
  a[i], b[i] = map(int, input().split())
cnt = 0

for i in range(1, n+1):
  for j in range(m):
    if a[j] == i:
      cnt += 1
    if b[j] == i:
      cnt += 1
  print(cnt)
  cnt = 0

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
b = []
for i in range(m):
 a[i], b[i] = map(int, input().split())
cnt = 0

for i in range(1, n+1):
  for j in range(m):
    if a[j] == i:
      cnt += 1
    if b[j] == i:
      cnt += 1
  print(cnt)
  cnt = 0

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
b = []
for i in range(m):
 a[i], b[i] = map(int, input().split())
cnt = 0

for i in range(1, n+1):
  for j in range(m):
    if a[j] = i:
      cnt += 1
    if b[j] = i:
      cnt += 1
  print(cnt)
  cnt = 0
Problem p04044 (python)

Fixed submission:
N,L=map(int,input().split())
s=[str(input()) for i in range(N)]
p=sorted(s)
print("".join(p))

Buggy submission (verdict: Runtime Error):
N,L=map(int,input().split())
s=[list(input()) for i in range(N)]
p=sorted(s)

print("".joint(p))
Problem p02801 (python)

Fixed submission:
x = input()
y = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(26):
    if y[i] == x:
        print(y[i + 1])

Buggy submission (verdict: Runtime Error):
N, M = input().split()
N = int(N)
M = int(M)
p = []
S = []
for i in range(M):
    a, b = input().split()
    a = int(a)
    p.append(a)
    S.append(b)
right = 0
wrong = 0
for j in range(M):
    if right[p[j] - 1] == 0:
        if S[k] == 'WA':
            wrong += 1
        elif S[k] == 'AC' and :
            right += 1
print(str(right) + ' ' + str(wrong))

Buggy submission (verdict: Runtime Error):
N, M = input().split()
N = int(N)
M = int(M)
p = []
S = []
for i in range(M):
    a, b = input().split()
    a = int(a)
    p.append(a)
    S.append(b)
right = []
wrong = []
for j in range(N):
    right.append(0)
    wrong.append(0)
for k in range(M):
    if S[k] == 'WA' and right[p[k] - 1] == 0:
        wrong[p[k] - 1] += 1
    else if S[k] == 'AC':
        if right[p[k] - 1] == 0:
            right[p[k] - 1] += 1
print(str(sum(right)) + ' ' + str(sum(wrong)))
Problem p02924 (python)

Fixed submission:
n=int(input())
print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
a=int(input())
print(n*(n-1)/2)
Problem p03029 (python)

Fixed submission:
a,p = map(int,input().split())
print((3*a+p)//2)

Buggy submission (verdict: Runtime Error):
a,p = map(int,input().split())
print((3*a+p)//2)
Problem p03377 (python)

Fixed submission:
a,b,c= map(int,input().split())
if a+b>=c and a<=c :
    print("YES")
else :
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c= map(int,input().split())
if a+b>=c && a<=c :
    print("Yes")
else :
    print("No")
Problem p02789 (python)

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

if M >= N:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import fractions

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

a = A[0]
for i in range(1, N):
    g = a * A[i] // fractions.gcd(a, A[i])
    a = g
    
b = 0
for i in range(N):
    b = b + gcc // A[i]

c = b % (1000000007)
print(c)
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
p = []
S = []
for i in range(M):
    pp, SS = map(str, input().split())
    p.append(pp)
    S.append(SS)

a = []
for i in range(M):
    a.append(int(p[i]))

AC = 0
P = 0

Q = []
R = []
for i in range(N):
    Q.append(0)
    R.append(0)

for i in range(M):
    index = a[i] - 1
    if Q[index] == 0 and S[i] == 'AC':
        AC = AC + 1
        Q[index] = 1
    elif Q[index] == 0 and S[i] == 'WA':
        R[a[i] - 1] = R[a[i] - 1] + 1

for i in range(N):
    if Q[i] == 0:
        P = P
    else: P = P + R[i]

print(AC, P)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
p = []
S = []
for i in range(M):
    pp, SS = map(str, input().split())
    p.append(pp)
    S.append(SS)

a = []
for i in range(M):
    a.append(int(p[i]))

AC = 0
P = 0

Q = []
R = []
for i in range(N):
    Q.append(0)
    R.append(0)

for i in range(M):
    index = a[i] - 1
    if Q[index] == 0 and S[i] == 'AC':
        AC = AC + 1
        Q[index] = 1
    elif Q[index] == 0 and S[i] == 'WA':
        R[i - 1] = R[i - 1] + 1

for i in range(N):
    if Q[i] == 0:
        P = 0
    else: P = P + R[i]

print(AC, P)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
p = []
S = []
for i in range(M):
    pp, SS = map(str, input().split())
    p.append(pp)
    S.append(SS)

a = []
for i in range(M):
    a.append(int(p[i]))

AC = 0
P = 0

Q = []
R = []
for i in range(N):
    Q.append(0)
    R.append(0)

for i in range(M):
    index = a[i] - 1
    if Q[index] == 0 and S[i] == 'AC':
        AC = AC + 1
        Q[index] = 1
    elif Q[index] == 0 and S[i] == 'WA':
        R[i] = R[i] + 1

for i in range(N):
    if Q[i] == 0:
        P = 0
    else: P = P + R[i]

print(AC, P)
Problem p02823 (python)

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

med = N / 2 + 0.5
Sub = B - A

if (Sub) % 2 == 0:
    round_count = Sub // 2
else:
    round_count = min(A - 1, N - B) + 1 + (Sub - 1) // 2
            
print(round_count)

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

med = N / 2 + 0.5

for i in range(1e18):
    if abs(A - B) % 2 == 0:
        if A > B:
            A = A - 1
            B = B + 1

            if A < 1:
                A = 1
            elif B > N:
                B = N
        else:
            A = A + 1
            B = B - 1

            if A > N:
                A = N
            elif B < 1:
                B = 1
    else:
        Max = max([A, B])
        Min = min([A, B])
        if (Max + Min) / 2 > med:
            A = A + 1
            B = B + 1

            if A > N:
                A = N
            elif B > N:
                B = N
        else:
            A = A - 1
            B = B - 1

            if A < 1:
                A = 1
            elif B < 1:
                B = 1

    round_count = round_count + 1

    if A == B:
        break

print(round_count)
Problem p02861 (python)

Fixed submission:
# coding: utf-8
# Your code here!
import numpy as np
import itertools
def kyori(x1,y1,x2,y2):
    dis = ((x1-x2)**2+(y1-y2)**2)**0.5
    return dis
N = int(input())
xy = []
for n in range(N):
    xy.append(list(map(int, input().split())))
diss = np.zeros((N,N))
c = list(itertools.permutations(range(N), N))
s = 0
for n in range(len(c)):
    for d in range(N-1):
        if diss[c[n][d]][c[n][d+1]]==0:
            diss[c[n][d]][c[n][d+1]] = kyori(xy[c[n][d]][0],xy[c[n][d]][1],xy[c[n][d+1]][0],xy[c[n][d+1]][1])
            diss[c[n][d+1]][c[n][d]] = diss[c[n][d]][c[n][d+1]]
        s += diss[c[n][d]][c[n][d+1]]
print(s/len(c))

Buggy submission (verdict: Runtime Error):
import numpy as np
def kyori(x1,y1,x2,y2):
    dis = ((x1-x2)**2+(y1-y2)**2)**0.5
    return dis
N = int(input())
xy = []
for n in range(N):
    xy.append(list(map(int, input().split())))
diss = np.zeros(N)
for i in range(N-1):
    for j in range(i+1,N):
        diss[i+j-1] = kyori(xy[i][0],xy[i][1],xy[j][0],xy[j][1])
print(np.average(np.sum(diss) - diss))
Problem p02900 (python)

Fixed submission:
def get_prime(n):
    prime = []
    while n % 2 == 0:
        prime.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            prime.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        prime.append(n)
    return prime

A, B = map(int, input().split())
prime1 = get_prime(A)
prime2 = get_prime(B)
ans_prime = set(prime1) & set(prime2)
print(len(ans_prime) + 1)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
prime1 = get_prime(A)
prime2 = get_prime(B)
ans_prime = prime1 & prime2
print(len(ans_prime) + 1)

def get_prime(n):
    prime = []
    while n % 2 == 0:
        prime.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            prime.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        prime.append(n)
    return prime
Problem p02801 (python)

Fixed submission:
a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
C = input()
if (C != 'z') and (C in a):
	i = a.index(C)
	print (a[i+1])

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

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

AN = M * N - sum(A)

if (AN <= K) and (AN >= 0):
	print (AN)
else:
	print (-1)

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

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

AN = M * N - sum(A)

if (AN <= K) and (AN >= 0):
	print (AN)
elif AN < 0:
	print (0)
else:
	print (-1)

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(M)
print(N)
A = input().split()
print(A)
A = [int(s) for s in A]
print(A)
AN = M * N - sum(A)
print (AN)
if (AN <= K) and (AN >= 0):
	print (AN)
elif AN < 0:
	print (0)
else:
	print (-1)

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(M)
A = input().split()
A = [int(s) for s in A]
AN = M * N - sum(A)
if AN <= K:
	print (AN)
else:
	print ('-1')

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(M)
A = input().split()
A = [int(s) for s in A]
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
else:
	print ('-1')

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(M)
A = input().split()
A = [int(s) for s in A]
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
else:
	print (-1)

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(M)
A = input().split()
A = [int(s) for s in A]
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
elif AN < 0:
	print (0)
else:
	print (-1)

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(N)
print(N)
A = input().split()
print(A)
A = [int(s) for s in A]
print(A)
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
elif AN < 0:
	print (0)
else:
	print ('-1')

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(N)
A = input().split()
A = [int(s) for s in A]
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
elif AN < 0:
	print (0)
else:
	print (-1)

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(N)
A = input().split()
A = [int(s) for s in A]
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
else:
	print ('-1')

Buggy submission (verdict: Runtime Error):
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(N)
# print(N)
A = input().split()
# print(A)
A = [int(s) for s in A]
# print(A)
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
else:
	print ('-1')