Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

l = []
for i in range(n):
    hoge = A.index(min(A))
    print(hoge+1, end=' ')
    A[hoge] = n+1


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

l = [0] * n
for i, x in enumerate(A):
    l[x-1] = i+1
for i in l:
    print(i, end=' ')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))

l = []
for i in range(n):
    hoge = A.index(min(A))
    l.append(hoge+1)
    A[hoge] = n+1

for i in l:
    print(i, end=' ')

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

l = [0] * n
for i, x in enumerate(A):
    l[x-1] = i+1
for i in l:
    print(i, end=' ')
Buggy python submission (verdict: Time Limit Exceeded):
Ncount = int(input())
strings = []
count_flag = 0
letters_count = []
for i in range(Ncount):
  strings.append(input())
  
def letter_count(string):
  letters = {}
  for i in range(10):
    if string[i] not in letters:
      letters[string[i]] = 1
    else :
      letters[string[i]] += 1
  return letters

for i in strings:
  letters_count.append(letter_count(i))


for i in range(len(letters_count)):
  for j in range(i+1, len(letters_count)):
    if letters_count[i] == letters_count[j]:
      count_flag += 1

print(count_flag)

Fixed submission:
Ncount = input()
strings = []
count_flag = 0
letters = {}
for i in range(int(Ncount)):
  strings.append(''.join(sorted(input())))

for i in strings:
  if i not in letters:
    letters[i] = 0
  else :
    letters[i] += 1
    count_flag += letters[i]

print(count_flag)

Buggy python submission (verdict: Time Limit Exceeded):
Ncount = int(input())
strings = []
count_flag = 0
letters_count = []
for i in range(Ncount):
  strings.append(input())
  
def letter_count(string):
  letters = {}
  for i in range(10):
    if string[i] not in letters:
      letters[string[i]] = 1
    else :
      letters[string[i]] += 1
  return letters

for i in strings:
  letters_count.append(letter_count(i))
  
for i in range(len(letters_count)):
  for j in range(i+1, len(letters_count)):
    if letters_count[i] == letters_count[j]:
      count_flag += 1

print(count_flag)

Fixed submission:
Ncount = input()
strings = []
count_flag = 0
letters = {}
for i in range(int(Ncount)):
  strings.append(''.join(sorted(input())))

for i in strings:
  if i not in letters:
    letters[i] = 0
  else :
    letters[i] += 1
    count_flag += letters[i]

print(count_flag)
Buggy python submission (verdict: Runtime Error):
x,y,z = map(int, input().split())
if (z+y)%2==1:
  	d = min(y + z - 2, 2*x-y-z)+1; 
	print(d//2)
else:
	print((abs(y-z)+1)//2)


Fixed submission:
x,y,z = map(int, input().split())
if (z+y)%2==1:
        d = min(y + z - 2, 2*x-y-z)+1
        print(d//2)
else:
	print((abs(y-z)+1)//2)

Buggy python submission (verdict: Runtime Error):
x,y,z = map(int, input().split())
if (z+y)%2==1:
	print(min(max(y,z)-1, max(x-y,x-z))
else:
	print((abs(y-z)+1)//2)


Fixed submission:
x,y,z = map(int, input().split())
if (z+y)%2==1:
        d = min(y + z - 2, 2*x-y-z)+1
        print(d//2)
else:
	print((abs(y-z)+1)//2)
Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  p=list(map(int,input().split()))
  c=[0]*100
  for i in p:
    c[i]=1
  if max(p)<x:
    print(x)
  elif min(p)>x:
    print(x)
  else:
    i=0
    while True:
      if p.count(x-i)==0:
        print(x-i)
        break
      elif p.count(x+i)==0:
        print(x+i)
        break
      else:
        i+=1

Fixed submission:
x,n=map(int,input().split())
if n!=0:
  p=list(map(int,input().split()))
else:
  p=[]
ans=0
if x in p:
  low=x
  high=x
  while True:
    low-=1
    high+=1
    if low in p:
      if high in p:
        continue
      else:
        ans=high
        break
    else:
      ans=low
      break
  print(ans)
else:
  print(x)

Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())
if n!=0:
  p=list(map(int,input().split()))
  c=[0]*100
  for i in p:
    c[i-1]+=1
  ans=0
  while True:
    if c[x-ans-1]==0:
      ans=x-ans
      break
    elif c[x+ans-1]==0:
      ans=x+ans
      break
    else:
      ans+=1
  print(ans)
else:
  print(x)

Fixed submission:
x,n=map(int,input().split())
if n!=0:
  p=list(map(int,input().split()))
else:
  p=[]
ans=0
if x in p:
  low=x
  high=x
  while True:
    low-=1
    high+=1
    if low in p:
      if high in p:
        continue
      else:
        ans=high
        break
    else:
      ans=low
      break
  print(ans)
else:
  print(x)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m=map(int,input().split())
ab=list(list(map(int,input().split())) for i in range(m))
d=deque()
d.append(1)
t=[deque() for i in range(n)]
for i in range(m):
  t[ab[i][0]-1].append(ab[i][1])
  t[ab[i][1]-1].append(ab[i][0])
h=[0]*(n-1)
u=deque()
while 0 in h:
  for i in t[d[0]-1]:
    if i in d or i in u:
      continue
    else:
      h[i-2]+=d[0]
      d.append(i)
  u.append(d[0])
  d.popleft()
print("Yes")
for i in range(n-1):
  print(h[i])

Fixed submission:
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  g[a-1].append(b)
  g[b-1].append(a)
q=deque()
q.append(1)
check=[0]*n
check[0]=1
ans=[0]*n
while len(q)!=0:
  v=q.popleft()
  for u in g[v-1]:
    if check[u-1]==0:
      check[u-1]=1
      ans[u-1]=v
      q.append(u)
print("Yes")
for i in range(1,n):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n,m=map(int,input().split())
ab=list(list(map(int,input().split())) for i in range(m))
d=deque()
d.append(1)
t=[deque() for i in range(n)]
for i in range(m):
  t[ab[i][0]-1].append(ab[i][1])
  t[ab[i][1]-1].append(ab[i][0])
h=[0]*(n-1)
u=deque()
while 0 in h:
  for i in t[d[0]-1]:
    if i in d or i in u:
      continue
    else:
      h[i-2]+=d[0]
      d.append(i)
  u.append(d[0])
  d.popleft()
print("Yes")
for i in range(n-1):
  print(h[i])

Fixed submission:
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  g[a-1].append(b)
  g[b-1].append(a)
q=deque()
q.append(1)
check=[0]*n
check[0]=1
ans=[0]*n
while len(q)!=0:
  v=q.popleft()
  for u in g[v-1]:
    if check[u-1]==0:
      check[u-1]=1
      ans[u-1]=v
      q.append(u)
print("Yes")
for i in range(1,n):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
s=input()
if s="ABC":
  print("ARC")
else:
  print("ABC")

Fixed submission:
s=input()
if s=="ABC":
  print("ARC")
else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
for i in range(10**5):
  b=(x-i**5)**(1/5)
  if b==math.floor(b) and b==math.ceil(b):
    print(i,int(b))
    break

Fixed submission:
x=int(input())
for i in range(-1000,1000):
  for j in range(-1000,1000):
    if i**5-j**5==x:
      print(i,j)
      break
  else:
    continue
  break

Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
for i in range(10**2):
  b=(x-i**5)**(1/5)
  if b==math.floor(b) and b==math.ceil(b):
    print(i,int(b))
    break

Fixed submission:
x=int(input())
for i in range(-1000,1000):
  for j in range(-1000,1000):
    if i**5-j**5==x:
      print(i,j)
      break
  else:
    continue
  break
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n=int(input())
a=list(map(int,input().split()))
d=deque()
for i in range(1,n):
  d.append((i+1)-a[i])
cnt=0
for i in range(n-1):
  cnt+=d.count(a[i]+(i+1))
  d.popleft()
print(cnt)

Fixed submission:
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
d=defaultdict(int)
cnt=0
for i in range(n):
  cnt+=d[i-a[i]]
  d[a[i]+i]+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  for j in range(max(i+1,a[i]+1),n):
    if abs(i-j)==a[i]+a[j]:
      cnt+=1
print(cnt)

Fixed submission:
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
d=defaultdict(int)
cnt=0
for i in range(n):
  cnt+=d[i-a[i]]
  d[a[i]+i]+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
maxf=0
if n>b:
  i=n//b
  maxf=max((a*n)//b-a*(n//b)),((a*(b*i-1))//(b-a*(b*i-1)//b))
  print(maxf)
else:
  print((a*n)//b-a*(n//b))

Fixed submission:
a,b,n=map(int,input().split())
if n<b:
  print(a*n//b)
else:
  if n==b:
    print(a*(n-1)//b)
  else:
    i=n//b
    print(max((a*n//b-a*i),(a*(b*i-1)//b-a*(i-1))))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
maxf=0
if n>=b:
  for i in range(n//b):
    x=b*(i+1)-1
    if maxf<=(a*x)//b-a*(x//b):
      maxf=(a*x)//b-a*(x//b)
  print(maxf)
else:
  print((a*n)//b-a*(n//b))

Fixed submission:
a,b,n=map(int,input().split())
if n<b:
  print(a*n//b)
else:
  if n==b:
    print(a*(n-1)//b)
  else:
    i=n//b
    print(max((a*n//b-a*i),(a*(b*i-1)//b-a*(i-1))))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
maxf=0
if n>b:
  for i in range(n//b):
    x=b*(i+1)-1
    if maxf<=(a*x)//b-a*(x//b):
      maxf=(a*x)//b-a*(x//b)
  print(maxf)
else:
  for i in range(n+1):
    x=i
    if maxf<=(a*x)//b-a*(x//b):
      maxf=(a*x)//b-a*(x//b)
  print(maxf)

Fixed submission:
a,b,n=map(int,input().split())
if n<b:
  print(a*n//b)
else:
  if n==b:
    print(a*(n-1)//b)
  else:
    i=n//b
    print(max((a*n//b-a*i),(a*(b*i-1)//b-a*(i-1))))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=set(a)
cnt=0
for i in b:
  x=a.count(i)
  c=x*(x-1)//2
  cnt+=c
for i in a:
  x=a.count(i)
  print(cnt+(1-x))

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
cnt=0
for i in a:
  b[i-1]+=1
for i in b:
  cnt+=i*(i-1)//2
for i in a:
  print(cnt+(1-b[i-1]))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
B=A
for i in range(N):
  x=A[i]
  A.pop(i)
  S=list(set(A))
  sum=0
  for j in range(len(S)):
    a=A.count(S[j])
    if a!=1:
      sum+=a*(a-1)//2
  A.insert(i,x)
  print(sum)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
cnt=0
for i in a:
  b[i-1]+=1
for i in b:
  cnt+=i*(i-1)//2
for i in a:
  print(cnt+(1-b[i-1]))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
B=A
for i in range(N):
  x=A[i]
  A.pop(i)
  S=list(set(A))
  sum=0
  for j in range(len(S)):
    a=A.count(S[j])
    sum+=a*(a-1)//2
  A.insert(i,x)
  print(sum)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
cnt=0
for i in a:
  b[i-1]+=1
for i in b:
  cnt+=i*(i-1)//2
for i in a:
  print(cnt+(1-b[i-1]))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if 4a*b<(c*c-2*c*(a+b)+(a+b)*(a+b)):
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b<0:
  print("No")
elif 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
S=deque(input())
Q=int(input())
T=[]
for i in range(Q):
  T.append(input().split())
for i in range(Q):
  if T[i][0]=="1":
    S.reverse()
  else:
    if T[i][1]=="1":
      S.appendleft(T[i][2])
    else:
      S.append(T[i][2])
print("".join(S))

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
T=[]
m=0
for i in range(Q):
  T.append(input().split())
for i in range(Q):
  if T[i][0]=="1":
    if len(S)>1:
      if m==0:
        m=1
      else:
        m=0
        
  else:
    if T[i][1]=="1":
      if m==0:
        S.appendleft(T[i][2])
      else:
        S.append(T[i][2])
   
    else:
      if m==0:
        S.append(T[i][2])
      else:
        S.appendleft(T[i][2])
if m==0:
  print("".join(S))
else:
  S.reverse()
  print("".join(S))

Buggy python submission (verdict: Runtime Error):
S=list(input())
Q=int(input())
T=[]
for i in range(Q):
  T.append(input().split())
for i in range(Q-1):
  if T[i][0]=="1" and T[i+1][0]=="1":
    T.pop(i)
    T.pop(i)
for i in range(len(T)):
  if T[i][0]=="1":
    S.reverse()
  else:
    if T[i][1]=="1":
      S.insert(0,T[i][2])
    else:
      S.append(T[i][2])
print("".join(S))

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
T=[]
m=0
for i in range(Q):
  T.append(input().split())
for i in range(Q):
  if T[i][0]=="1":
    if len(S)>1:
      if m==0:
        m=1
      else:
        m=0
        
  else:
    if T[i][1]=="1":
      if m==0:
        S.appendleft(T[i][2])
      else:
        S.append(T[i][2])
   
    else:
      if m==0:
        S.append(T[i][2])
      else:
        S.appendleft(T[i][2])
if m==0:
  print("".join(S))
else:
  S.reverse()
  print("".join(S))

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
Q=int(input())
T=[]
for i in range(Q):
  T.append(input().split())
for i in range(Q):
  if T[i][0]=="1":
    S.reverse()
  else:
    if T[i][1]=="1":
      S.insert(0,T[i][2])
    else:
      S.append(T[i][2])
print("".join(S))

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
T=[]
m=0
for i in range(Q):
  T.append(input().split())
for i in range(Q):
  if T[i][0]=="1":
    if len(S)>1:
      if m==0:
        m=1
      else:
        m=0
        
  else:
    if T[i][1]=="1":
      if m==0:
        S.appendleft(T[i][2])
      else:
        S.append(T[i][2])
   
    else:
      if m==0:
        S.append(T[i][2])
      else:
        S.appendleft(T[i][2])
if m==0:
  print("".join(S))
else:
  S.reverse()
  print("".join(S))
Buggy python submission (verdict: Runtime Error):
from statistics import mode

N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
print(mode(S))

Fixed submission:
n=int(input())
s=[input() for i in range(n)]
s.sort()
b=list(set(s))
b.sort()
a=s[0]
m=[0]
for i in range(n):
  if s[i]!=a:
    m.append(i)
    a=s[i]
m.append(n)
o=[]
for i in range(len(m)-1):
  o.append(m[i+1]-m[i])
num=max(o)
for i in range(len(o)):
  if o[i]==num:
    print(b[i])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(N):
  for j in range(i+1,N):
    if A[i]==A[j]:
      flag=1
      break
      
if flag==0:
  print("YES")
else:
  print("NO")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
if len(A)==len(set(A)):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(N):
  for j in range(i+1,N):
    if A[i]==A[j]:
      flag=1
      
if flag==0:
  print("YES")
else:
  print("NO")

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
if len(A)==len(set(A)):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
p=list(map(int,input().split()))
E=[]
for i in range(N):
  E.append((1+p[i])/2)
Max_E=0
for i in range(K):
  Max_E=Max_E+E[i]
for i in range(1,N-K+1):
  A=0
  for j in range(i,i+K):
    A=A+E[j]
  if A>Max_E:
    Max_E=A
print(Max_E)

Fixed submission:
import numpy as np
N,K=map(int,input().split())
p=list(map(int,input().split()))
E=[]
for i in range(N):
  E.append((1+p[i])/2)
S=np.cumsum(E)
max=0
if N!=K:
  for i in range(N-K+1):
    if S[i+K-1]-S[i-1]>max:
       max=S[i+K-1]-S[i-1]
  print(max)
else:
  print(sum(E))
Buggy python submission (verdict: Runtime Error):
H,N=map(int,input().split())
A=list(map(int,input().split()))
Max_A=0
for i in range(len(A)):
  Max_A=Max_A+A[i]
if Max_A>=H:
  print("YES")
else:
  print("NO")

Fixed submission:
H,A=map(int,input().split())
count=0
while H>0:
  H=H-A
  count=count+1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n=int(input())
p=list(map(int,input().split()))
cnt=0
s=deque()
for i in p:
  s.append(i)
  if min(s)==i:
    cnt+=1
print(cnt)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
cnt=0
min=p[0]
for i in p:
  if i<=min:
    cnt+=1
    min=i
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P=list(map(int,input().split()))
count=0
for i in range(N):
  flag=0
  for j in range(i):
    if P[i]>P[j]:
      flag=1
      break
  if flag==0:
    count=count+1
    
print(count)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
cnt=0
min=p[0]
for i in p:
  if i<=min:
    cnt+=1
    min=i
print(cnt)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
count=0
for i in range(N-2):
  if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
    count=count+1
print(count)

Fixed submission:
K,X=map(int,input().split())
if 500*K>=X:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
cnt=0
for i in range(1000):
  flag=0
  pin=str(i).zfill(3)
  for j in range(n):
    if s[j]==pin[0] and flag==0:
      flag=1
      num1=j
    if s[j]==pin[1] and flag==1 and num1<j:
      flag=2
      num2=j
    if s[j]==pin[2] and flag==2 and num2<j:
      cnt+=1
      break
print(cnt)

Fixed submission:
n=int(input())
s=input()
cnt=0
for i in range(1000):
  flag=0
  pin=str(i).zfill(3)
  if s.find(pin[0])==-1:
    continue
  s1=s[s.find(pin[0])+1:]
  if s1.find(pin[1])==-1:
    continue
  s2=s1[s1.find(pin[1])+1:]
  if s2.find(pin[2])==-1:
    continue
  cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
cnt=0
for i in range(1000):
  flag=0
  pin=str(i).zfill(3)
  for j in range(n-2):
    if s[j]==pin[0]:
      flag=1
      break
  if flag==1:
    for k in range(j+1,n-1):
      if s[k]==pin[1]:
        flag=2
        break
  if flag==2:
    for l in range(k+1,n):
      if s[l]==pin[2]:
        cnt+=1
        break
print(cnt)

Fixed submission:
n=int(input())
s=input()
cnt=0
for i in range(1000):
  flag=0
  pin=str(i).zfill(3)
  if s.find(pin[0])==-1:
    continue
  s1=s[s.find(pin[0])+1:]
  if s1.find(pin[1])==-1:
    continue
  s2=s1[s1.find(pin[1])+1:]
  if s2.find(pin[2])==-1:
    continue
  cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
if N%2==1:
  print("No")
else:
  flag=0
  for i in range(len(S)):
    if S[i]!=S[i+(len(S)/2)]:
      flag=1
      break
  if flag==0:
    print("Yes")
  else::
    print("No")

Fixed submission:
n=int(input())
s=input()
if n%2==1:
  print("No")
else:
  for i in range(n//2):
    if s[i]!=s[i+(n//2)]:
      print("No")
      break
  else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
E=[]
for i in range(1,N+1):
  for j in range(N):
    if A[j]==i:
      E.append(j+1)
      break

for i in range(N):
  print(E[i],end=" ")

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
  b[a[i]-1]+=i+1
c=[str(i) for i in b]
print(" ".join(c))
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Max=0
for i in range(N):
  if A[i]>=B[i]:
    Max+=B[i]
  else:
    B[i]-=A[i]
    if A[i+1]>=B[i]:
      A[i+1]-=B[i]
      Max+=A[i]+B[i]
    else:
      A[i+1]=0
      Max+=A[i]+A[i+1]
print(Max)    

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
A=[]
A.append(B[0])
for i in range(0,N-2):
  A.append(min(B[i],B[i+1]))
A.append(B[N-2])
sum=0
for i in range(N):
  sum+=A[i]
print(sum)
Buggy python submission (verdict: Runtime Error):
N=int(input())
if 1<=N and N<10:
	print(N)
elif 10<=N and N<100:
	print("9")
elif 100<=N and N<1000:
	print(9+N-99)
elif 1000<=N and N<10000:
	print("909")
elif 10000<=N and N<100000:
	print(909+N-999)
else:
	print("90909")

Fixed submission:
A,B,C=map(int,input().split())
if B+C>A:
	print(B+C-A)
else:
	print("0")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
h=list(map(int,input().split()))
if n>1:
  for i in range(n-1):
    for j in range(i+i,n):
      if h[i]-h[j]>1:
        print("No")
        break
    else:
      continue
    break
  else:print("Yes")
else:
  print("Yes")

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
max=h[0]
flag=0
for i in h:
  if i>=max:
    max=i
  elif max-i>=2:
    flag=1
    break
if flag==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
for i in range(n):
  x=a[i]
  a.pop(i)
  print(max(a))
  a.insert(i,x)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
max1=1
m=0
for i in range(n):
  if max1<a[i]:
    max1=a[i]
    m=i
a.pop(m)
max2=max(a)
a.insert(m,max1)
for i in range(n):
  if i!=m:
    print(max1)
  else:
    print(max2)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
L=[]
R=[]
for i in range(M):
  l,r=map(int,input().split())
  L.append(l)
  R.append(r)
count=0
for i in range(1,N+1):
  if max(L)<=i<=min(R):
    count+=1
print(count)

Fixed submission:
N,M=map(int,input().split())
L=[]
R=[]
for i in range(M):
  l,r=map(int,input().split())
  L.append(l)
  R.append(r)
count=0
if max(L)>min(R):
  print(0)
else:
  print(min(R)-max(L)+1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
L=[]
R=[]
for i in range(M):
  l,r=map(int,input().split())
  L.append(l)
  R.append(r)
count=0
for i in range(1,N+1):
  for j in range(M):
    if L[j]>i or i>R[j]:
      break
  else:
    count+=1
print(count)

Fixed submission:
N,M=map(int,input().split())
L=[]
R=[]
for i in range(M):
  l,r=map(int,input().split())
  L.append(l)
  R.append(r)
count=0
if max(L)>min(R):
  print(0)
else:
  print(min(R)-max(L)+1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a%2==0 or b%2==0:
  print("No")
else:
  priint("Yes")

Fixed submission:
a,b=map(int,input().split())
if a%2==0 or b%2==0:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=1
for i in range(n):
  s*=a[i]
cnt=0
while s%2==0:
  s//=2
  cnt+=1

print(cnt)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  while a[i]%2==0:
    a[i]//=2
    cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
if abs(a-b)>10**18:
  print("unfair)
else:
  if k%2==0:
    print(a-b)
  else:
    print(b-a)

Fixed submission:
a,b,c,k=map(int,input().split())
if abs(a-b)>10**18:
    print("unfair")
else:
    if k%2==0:
        print(a-b)
    else:
        print(b-a)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if len(set(a))==3:
  print("Three")
else:
  print("Four")

Fixed submission:
n=int(input())
a=list(input().split())
if len(set(a))==3:
  print("Three")
else:
  print("Four")
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int,input().split()))
if len(list(set(a)))<=k:
  print(0)
else:
  l=[0]*n
  for i in range(n):
    l[a[i]-1]+=1
  l.sort()
  ans=0
  cnt=0
  i=0
  while cnt<(len(list(set(a)))-k):
    if l[i]!=0:
      ans+=l[i]
      cnt+=1
      i+=1
    else:
      i+=1
  print(ans)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
if len(list(set(a)))<=k:
  print(0)
else:
  d={}
  for i in range(n):
    if a[i] in d:
      d[a[i]]+=1
    else:
      d[a[i]]=1
  d=sorted(d.items(),key=lambda x:x[1])
  m=len(d)
  cnt=0
  for i in range((len(list(set(a))))-k):
    cnt+=d[i][1]
  print(cnt)
Buggy python submission (verdict: Runtime Error):
x,y,z=map(int(input().split()))
ans=1
x-=(y+2*z)
print(ans+x//(y+z))

Fixed submission:
x,y,z=map(int,(input().split()))
ans=1
x-=(y+2*z)
print(ans+x//(y+z))
Buggy python submission (verdict: Runtime Error):
c=input()
d=input()
if c[0]==d[3] and c[1]==d[1] and c[2]==d[0]:
  print("YES")
else:
  print("NO")

Fixed submission:
c=input()
d=input()
if c[0]==d[2] and c[1]==d[1] and c[2]==d[0]:
  print("YES")
else:
  print("NO")