Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

x, y, z, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
c = c[:k]

e = []

cnt = 0
for va in a:
    for vb in b:
        heapq.heappush(e, -(va+vb))

d = []
while len(e):
    ve = -heapq.heappop(e)
    for vc in c:
        heapq.heappush(d, -(ve+vc))

for i in range(k):
    print(-heapq.heappop(d))

Fixed submission:
import heapq

x, y, z, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

e = []

for va in a:
    for vb in b:
        e.append(va+vb)

e.sort(reverse=True)
e = e[:k]

d = []
for ve in e:
    for vc in c:
        heapq.heappush(d, -(ve+vc))

for i in range(k):
    print(-heapq.heappop(d))

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))[:k]

e = []

for va in a:
    for vb in b:
        e.append(va+vb)

e.sort(reverse=True)

e = e[:k]

d = []
for vc in c:
    for ve in e:
        d.append(vc+ve)

d.sort(reverse=True)
d = d[:k]

for vd in d:
    print(vd)

Fixed submission:
import heapq

x, y, z, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

e = []

for va in a:
    for vb in b:
        e.append(va+vb)

e.sort(reverse=True)
e = e[:k]

d = []
for ve in e:
    for vc in c:
        heapq.heappush(d, -(ve+vc))

for i in range(k):
    print(-heapq.heappop(d))

Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

e = []

for va in a:
    for vb in b:
        e.append(va+vb)

e.sort(reverse=True)

e = e[:k]

d = []
for vc in c:
    for ve in e:
        d.append(vc+ve)

d.sort(reverse=True)
d = d[:k]

for vd in d:
    print(vd)

Fixed submission:
import heapq

x, y, z, k = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

e = []

for va in a:
    for vb in b:
        e.append(va+vb)

e.sort(reverse=True)
e = e[:k]

d = []
for ve in e:
    for vc in c:
        heapq.heappush(d, -(ve+vc))

for i in range(k):
    print(-heapq.heappop(d))
Buggy python submission (verdict: Runtime Error):
N = int(input())

reds = []
for _ in range(N):
    reds.append(tuple(map(int, input().split())))
    
blues = []
for _ in range(N):
    blues.append(tuple(map(int, input().split())))

reds.sort()
blues.sort()

ans = 0
for blue in blues:
    c, d = blue

    # 条件に当てはまる赤を抽出
    targets = [red for red in reds if red[0] < c and red[1] < d]
    targets.sort(key=lambda x:x[1])

    # 赤のうち一番y座標が大きいものを抽出
    if reds_under_x:
        target = reds_under_x.pop()
        reds.remove(target)
        ans += 1

print(ans)


Fixed submission:
N = int(input())

reds = []
for _ in range(N):
    reds.append(tuple(map(int, input().split())))
    
blues = []
for _ in range(N):
    blues.append(tuple(map(int, input().split())))

reds.sort()
blues.sort()

ans = 0
for blue in blues:
    c, d = blue

    # 条件に当てはまる赤を抽出
    targets = [red for red in reds if red[0] < c and red[1] < d]
    targets.sort(key=lambda x:x[1])

    # 赤のうち一番y座標が大きいものを抽出
    if targets:
        target = targets.pop()
        reds.remove(target)
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

buttons = []

for i in range(n):
    buttons.append(int(input()))

index = 1
cnt = 0
history = []

while index != 2:
    if index in history:
        cnt = -1
        break

    history.append(index)        
    index = buttons[index-1]
    cnt += 1

print(cnt)

Fixed submission:
n = int(input())

buttons = []

for i in range(n):
    buttons.append(int(input()))

index = 1
cnt = 0

for i in range(n):
    index = buttons[index-1]
    cnt += 1

    if index == 2:
        print(cnt)
        exit()

print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

total = 1

for i in range(1, n+1):
    total *= i

print(total % (10**9 + 7))


Fixed submission:
import math

n = int(input())

f = math.factorial(n)

print(f % (10**9 + 7))

Buggy python submission (verdict: Runtime Error):
n = int(input())

total = 1

for i in range(1, n+1):
    total *= i

print(total / (10**9 + 7))

Fixed submission:
import math

n = int(input())

f = math.factorial(n)

print(f % (10**9 + 7))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

to = [[] for _ in range(N)]
visited = [False] * N

def dfs(v):
    n_visited = sum([1 if v else 0 for v in visited])
    if n_visited == N:
        return 1 
    
    ret = 0
    for u in to[v]:
        if not visited[u]:
            visited[u] = True
            ret += dfs(u)
            visited[u] = False  # 最も深い点から帰ってくる道中に、始点を除く全ての点を未訪問にする => 他のパスを辿ることが可能になる

    return ret


for _ in range(N):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)

visited[0] = True
print(dfs(0))

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

to = [[] for _ in range(N)]
visited = [False] * N

def dfs(v):
    if sum(visited) == N:
        return 1 
    
    ret = 0
    for u in to[v]:
        if not visited[u]:
            visited[u] = True
            ret += dfs(u)
            visited[u] = False  # 最も深い点から帰ってくる道中に、始点を除く全ての点を未訪問にする => 他のパスを辿ることが可能になる

    return ret


for _ in range(M):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)

visited[0] = True
print(dfs(0))
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))

l = sorted(p)
count = 0

for a, b in zip(p, l):
    if (a is not b): count += 1

if ((count == 0) or ((count == 2)):
    print("YES")
else:
    print("NO")

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

l = sorted(p)
count = 0

for a, b in zip(p, l):
    if (a is not b): count += 1

if ((count == 0) or (count == 2)):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int,input())
if (a < x <(a+b)):
    print('YES')
else:
    print('NO')

Fixed submission:
a,b,x = map(int,input().split())
if (a <= x <= (a+b)):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
if ("".join(sorted(input())) == "abc):
    print("Yes")
else:
    print("No")

Fixed submission:
if ("".join(sorted(input())) == "abc"):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#ABC071A
import math
x, a, b =list(map(int, input().split()))

ax = math.abs(a-x)
bx = math.abs(b-x)

if (ax < bx): print("A")
else: print('B')

Fixed submission:
#ABC071A
import math
x, a, b =list(map(int, input().split()))

ax = math.fabs(a-x)
bx = math.fabs(b-x)

if (ax < bx): print("A")
else: print('B')
Buggy python submission (verdict: Runtime Error):
#ABC050A
A, op, B = list(input().split())
if (op == '+'): print(A+B)
else: print(A-B)

Fixed submission:
#ABC050A
A, op, B = list(input().split())
A = int(A)
B = int(B)

if (op == '+'): print(A+B)
else: print(A-B)
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
s = []
for i in range(N):
    ss = input()
    s.append(ss)
t= []
for i in range(N):
    tt= sorted(s[i])
    t.append(tt)
#s.sort()
#print(t)

count = 0
for i in range(N):
    a = tt.count(tt[i])
    count = count+a
print(count-N)

Fixed submission:
import collections as cl
import itertools as it
N = int(input())
s = []
for i in range(N):
    ss = input()
    s.append(ss)
#print(s)
t = sorted(s)
t= []
for i in range(N):
    tt= sorted(s[i])
    ts = ",".join(tt)
    t.append(ts)
#    print(ts)
#print(t)
l = cl.Counter(t)
#print(l)
count = 0
for v in l.values():
    if v > 1:
        count = count + v*(v-1)/2
#    print(v)
print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
import math
import collections
N = int(input())
s = []
for i in range(N):
    ss = input()
    s.append(ss)
t= []
for i in range(N):
    tt= sorted(s[i])
    t.append(tt)
#s.sort()
#print(t)

count = 0
for i in range(N):
    start = t[i]
    for j in range(i+1,N):
#        print("i,j1=",i,j)
        if start == t[j]:
#            print("i,j=",i,j)
            count = count +1
print(count)

Fixed submission:
import collections as cl
import itertools as it
N = int(input())
s = []
for i in range(N):
    ss = input()
    s.append(ss)
#print(s)
t = sorted(s)
t= []
for i in range(N):
    tt= sorted(s[i])
    ts = ",".join(tt)
    t.append(ts)
#    print(ts)
#print(t)
l = cl.Counter(t)
#print(l)
count = 0
for v in l.values():
    if v > 1:
        count = count + v*(v-1)/2
#    print(v)
print(int(count))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#print("A=",A)
#print("B=",B)

count = 0
for i in range(N+1):
    if i == 0:
        taosita = B[i]-max((B[i]-A[i]),0)
        count = taosita
        B[i]= B[i]-taosita
#        print("i=0")
    elif i!=N
        #1つ前の勇者
        taosita1 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita1
        A[i] = A[i]-taosita1
        #今回の勇者
        taosita2 = B[i]-max((B[i]-A[i]),0)
        count =count + taosita2
        B[i]= B[i]-taosita2
    if i == N:
        #1つ前の勇者
        taosita3 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita3
#        A[i] = A[i]-taosita1
print(count)

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

count = 0
for i in range(N+1):
    if i == 0:
        taosita = B[i]-max((B[i]-A[i]),0)
        count = taosita
        B[i]= B[i]-taosita
#        print("i=0")
    elif i!=N:
        #1つ前の勇者
        taosita1 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita1
        A[i] = A[i]-taosita1
        #今回の勇者
        taosita2 = B[i]-max((B[i]-A[i]),0)
        count =count + taosita2
        B[i]= B[i]-taosita2
    if i == N:
        #1つ前の勇者
        taosita3 = B[i-1]-max((B[i-1]-A[i]),0)
        count =count + taosita3
#        A[i] = A[i]-taosita1
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import matplotlib.pyplot as plt
N,L = list(map(int,input().split()))
aji=[]
for i in range(N):
    aji.append(L+i)

absaji = []
for i in range(N):
    absaji.append(abs(aji[i]))

#newaji = np.abs(aji)
minaji = min(absaji)

if sum(aji) < 0:
    sumaji = sum(aji) + minaji
else:
    sumaji = sum(aji) - minaji
print(sumaji)


Fixed submission:
N,L = list(map(int,input().split()))
aji=[]
for i in range(N):
    aji.append(L+i)

absaji = []
for i in range(N):
    absaji.append(abs(aji[i]))

#newaji = np.abs(aji)
minaji = min(absaji)

if sum(aji) < 0:
    sumaji = sum(aji) + minaji
else:
    sumaji = sum(aji) - minaji
print(sumaji)
Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = list(map(int,input().split()))
dis = B - A + 1
CD = C*D//math.gcd(C,D)
perCfromA = (A-1)//C
perDfromA = (A-1)//D
perCDfromA = (A-1)//CD
perCfromB = B//C
perDfromB = B//D
perCDfromB = B//CD
warikire = (perCfromB + perDfromB -perCDfromB) - (perCfromA + perDfromA -perCDfromA)
warikirenai = dis -warikire
print(warikirenai)

Fixed submission:
import fractions
A,B,C,D = list(map(int,input().split()))
dis = B - A + 1

CD = C*D//(fractions.gcd(C,D))
#print(CD)
perCfromA = (A-1)//C
perDfromA = (A-1)//D
perCDfromA = (A-1)//(CD)


perCfromB = B//C
perDfromB = B//D
perCDfromB = B//(CD)

#print(perCfromA,perDfromA,perCDfromA,perCfromB,perDfromB,perCDfromB)
warikire = (perCfromB + perDfromB -perCDfromB) - (perCfromA + perDfromA -perCDfromA)
warikirenai = dis -warikire
print(warikirenai)

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = list(map(int,input().split()))
dis = B - A + 1

CD = C*D//math.gcd(C,D)
#print(CD)
perCfromA = (A-1)//C
perDfromA = (A-1)//D
perCDfromA = (A-1)//(CD)


perCfromB = B//C
perDfromB = B//D
perCDfromB = B//(CD)

#print(perCfromA,perDfromA,perCDfromA,perCfromB,perDfromB,perCDfromB)
warikire = (perCfromB + perDfromB -perCDfromB) - (perCfromA + perDfromA -perCDfromA)
warikirenai = dis -warikire
print(warikirenai)

Fixed submission:
import fractions
A,B,C,D = list(map(int,input().split()))
dis = B - A + 1

CD = C*D//(fractions.gcd(C,D))
#print(CD)
perCfromA = (A-1)//C
perDfromA = (A-1)//D
perCDfromA = (A-1)//(CD)


perCfromB = B//C
perDfromB = B//D
perCDfromB = B//(CD)

#print(perCfromA,perDfromA,perCDfromA,perCfromB,perDfromB,perCDfromB)
warikire = (perCfromB + perDfromB -perCDfromB) - (perCfromA + perDfromA -perCDfromA)
warikirenai = dis -warikire
print(warikirenai)
Buggy python submission (verdict: Runtime Error):
N,K=list(map(int,input().split()))
dis =N-K+1
if K >=2:
    print(dism-1)
elif K ==1:
    print(0)

Fixed submission:
N,K=list(map(int,input().split()))
dis =N-K+1
if K >=2:
    print(dis-1)
elif K ==1:
    print(0)

Buggy python submission (verdict: Runtime Error):
N,K=list(map(int,input().split())
dismax = N-K+1
print(dismax-1)
         

Fixed submission:
N,K=list(map(int,input().split()))
dis =N-K+1
if K >=2:
    print(dis-1)
elif K ==1:
    print(0)
Buggy python submission (verdict: Runtime Error):
N,K = map(int(input(),split()))
out = N - K + 1
print(out)

Fixed submission:
N,K = list(map(int,input().strip().split(" ")))
out = N - K + 1
print(out)

Buggy python submission (verdict: Runtime Error):
N,K = int(input())
out = N - K + 1
print(out)

Fixed submission:
N,K = list(map(int,input().strip().split(" ")))
out = N - K + 1
print(out)
Buggy python submission (verdict: Runtime Error):
N= int(input())
Sl = input()
K= int(input())
S=list(Sl)

for i in range(N):
 if S[i] != S[K-1]:
   S[i] = '*'
Snew = "".join(S)
print(Snew)

Fixed submission:
A,B,C= list(map(int,input().strip().split(" ")))
if A < C< B:
 print('Yes')
elif B < C < A:
 print('Yes')
else:
 print('No')

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

for i in range(N):
 if S[i]  != S[K-1]:
  ass = '*'
  S[i] = ass
print(S)

Fixed submission:
A,B,C= list(map(int,input().strip().split(" ")))
if A < C< B:
 print('Yes')
elif B < C < A:
 print('Yes')
else:
 print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = input().split()
maxH = H[0]
look = 1
for i in range(N-1):
	if N == 1:
    	print(1)
	elif H[i+1] >= maxH:
    	look = look + 1
    	maxH = H[i+1]
  	else:
    	maxH = maxH
print(look)

Fixed submission:
N = int(input())
H = list(map(int,input().strip().split(" ")))
maxH = H[0]
look = 1
for i in range(N-1):
  if H[i+1] >= maxH:
    look = look + 1
    maxH = H[i+1]
print(look)
Buggy python submission (verdict: Runtime Error):
int a, b
int c = a*b

if c%2 == 0:
	print('even')

if c%2 != 0:
	print('odd')

Fixed submission:
a,b = map(int, input().split())
print("Even" if a*b % 2 == 0 else "Odd")
Buggy python submission (verdict: Runtime Error):
s = input()
print(s[0]+str(len(s-2))+s[-1])

Fixed submission:
s = input()
print(s[0]+str(len(s)-2)+s[-1])
Buggy python submission (verdict: Runtime Error):
re,x=map(int,input().split())
print(' '.join(map(str,(list(range(x-re+1,x+re)))))

Fixed submission:
re,x=map(int,input().split())
print(*list(range(x-re+1,x+re)))

Buggy python submission (verdict: Runtime Error):
re,x=map(int,input().split())
print(' '.join(list(range(x-re+1,x+re))))

Fixed submission:
re,x=map(int,input().split())
print(*list(range(x-re+1,x+re)))

Buggy python submission (verdict: Runtime Error):
re,x=int(input().split())
print(' '.join(list(range(x-re+1,x+re))))

Fixed submission:
re,x=map(int,input().split())
print(*list(range(x-re+1,x+re)))
Buggy python submission (verdict: Runtime Error):
s=input()
length=len(s)-2
print(s[0]+length+s[-1])

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

Buggy python submission (verdict: Runtime Error):
s=input()
length=len(s)-2
print(f'{s[0]}{length}{s[-1]}')

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

Buggy python submission (verdict: Runtime Error):
length=len(s)-2
return s[0]+length+s[-1]

Fixed submission:
s=input()
length=len(s)-2
print(s[0]+str(length)+s[-1])
Buggy python submission (verdict: Runtime Error):
number,length=input().split()
input_list=[]
out=''
for i in range(number):
    input_list.append(input())
input_list.sort()
for i in input_list:
    out+=i
print(out)

Fixed submission:
number,length=map(int,input().split())
input_list=[]
out=''
for i in range(number):
    input_list.append(input())
input_list.sort()
for i in input_list:
    out+=i
print(out)
Buggy python submission (verdict: Runtime Error):
X = input()

result = False
try:
  X = int(X)
except:
  X = -1
  
  
if X in (3, 5, 7):
  return "YES"
return "NO"

Fixed submission:
X = input()

try:
  X = int(X)
except:
  X = -1
  
if X in (3, 5, 7):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
print(str(input(N))[::2])

Fixed submission:
print(str(input())[::2])
Buggy python submission (verdict: Runtime Error):
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
if len(rev_index) > 0:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")

Fixed submission:
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
if len(rev_index) == 2:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
elif len(rev_index) > 0:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")

Fixed submission:
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
p = list(map(lambda x: int(x), ss[1].split()))
rev_index = []
for i in range(N-1):
    if p[i] > p[i+1]:
        if len(rev_index) > 0:
            rev_index.append(i+1)
        else:
            rev_index.append(i)
if len(rev_index) == 2:
    p[rev_index[0]], p[rev_index[1]] = p[rev_index[1]], p[rev_index[0]]
if p == list(range(1,N+1)):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
W = [int(i) for i in ss[1].split(" ")]
print(min([abs(sum(W[T:]) - sum(W[:T])) for T in range(N))

Fixed submission:
# stdin
INPUT_SENTENCES = 2
ss = [input() for i in range(INPUT_SENTENCES)]
N = int(ss[0])
W = [int(i) for i in ss[1].split(" ")]
print(min([abs(sum(W[T:]) - sum(W[:T])) for T in range(N)]))
Buggy python submission (verdict: Runtime Error):
n=input()
n=int(n)
input_h=input().split()# 2 4 5のような入力
input_h=[int(num) for num in input_h]#intへ変換

for idx in range(n-1):

    if input_h[idx]<=input_h[idx+1]:
        continue
    elif input_h[idx]-1==input_h[idx+1]:
        continue
    else:
        print("No")
        break
else:
    print("Yes")
    


Fixed submission:
input_num=input().split()# 2 4 5のような入力
input_num=[int(num) for num in input_num]#intへ変換

A,B,C=input_num

cup_1=B
cup_2=C

cup_1=B+cup_2
cup_2=0

if cup_1>=A:
    cup_1=A
    cup_2=B+C-cup_1
    print(cup_2)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
n=input()
n=int(n)
input_h=input().split()# 2 4 5のような入力
input_h=[int(num) for num in input_h]#intへ変換

for idx in range(n-1):

    if input_h[idx]<=input_h[idx+1]:
        continue
    elif input_h[idx]-1==input_h[idx+1]:
        continue
    else:
        print("No")
        break
else:
    print("Yes")
    

Fixed submission:
input_num=input().split()# 2 4 5のような入力
input_num=[int(num) for num in input_num]#intへ変換

A,B,C=input_num

cup_1=B
cup_2=C

cup_1=B+cup_2
cup_2=0

if cup_1>=A:
    cup_1=A
    cup_2=B+C-cup_1
    print(cup_2)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
amap = {}
cnt = 0
n = int(input())
for i in range(n):
  s = "".join(sorted(input()))
  if s in amap:
    cnt += amap[s]
  amap[s] += 1

print(cnt)

Fixed submission:
amap = {}
cnt = 0
n = int(input())
for i in range(n):
  s = "".join(sorted(input()))
  if s in amap:
    cnt += amap[s]
    amap[s] += 1
  else:
    amap[s] = 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
s=0
y=0
for i in range(n+1):
    v=max(0,a[i]-y)
    if v<=b[i]:
        s+=a[i]
        y=b[i]-v
    elif v>b[i]:
        s+=b[i]+y
        y=0
print(s)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
s=0
y=0
for i in range(n):
    v=max(0,a[i]-y)
    if v<=b[i]:
        s+=a[i]
        y=b[i]-v
    elif v>b[i]:
        s+=b[i]+y
        y=0
print(s+min(a[-1],y))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=l.sorted(reverse=True)
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])

Fixed submission:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=sorted(l)
a.reverse()
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=l.sorted(reverse=True)
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])


Fixed submission:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
a=sorted(l)
a.reverse()
for v in l:
    if v==a[0]:
        print(a[1])
    else:
        print(a[0])
Buggy python submission (verdict: Runtime Error):
n=int(input())
li = list(map(int,input().slice()))
cnt=0
for i in range(1,n-1):
    if li[i-1]<li[i]<li[i+1]:
        cnt+=1
    elif li[i-1]>li[i]>li[i+1]:
        cnt+=1
print(cnt)

Fixed submission:
s=list(input())
s.sort()
if s[0] == s[1] and s[2]==s[3] and s[0] != s[2]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
    s=list(input())
    s.sort()
    if s[0] == s[1] and s[2]==s[3] and s[0]!=s[2]:
        print("Yes")
    else:
        print("No")

Fixed submission:
s=list(input())
s.sort()
if s[0] == s[1] and s[2]==s[3] and s[0] != s[2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
list = list(map(int,input().slice()))
cnt=0
for i in range(1,n-1):
    if list[i-1]<list[i]<list[i+1]:
        cnt+=1
    elif list[i-1]>list[i]>list[i+1]:
        cnt+=1
print(cnt)

Fixed submission:
n=int(input())
li =list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
    if li[i-1]<li[i]<li[i+1]:
        cnt+=1
    elif li[i-1]>li[i]>li[i+1]:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
var input=GET(require("fs").readFileSync("/dev/stdin","utf8"));
var str = input();
if(str[0] == str[1] || str[1]==str[2] || str[2]==str[3])console.log("Bad");
else console.log("Good")

Fixed submission:
s = input()
if s[0] != s[1] and s[1] != s[2] and s[2]!=s[3]:
    print("Good")
else:
    print("Bad")