Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#D問題
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    A.extend([C]*B)
A.sort(reverse = True)
print(sum(A[:N]))




Fixed submission:
import heapq as hq
N, M = map(int, input().split())
A = list(map(int,input().split()))
A = [(-i,1) for i in A]
hq.heapify(A)
for i in range(M):
    B, C = map(int, input().split())
    hq.heappush(A,(-C,B))
sum_A = 0
for i in range(N):
    add_num = hq.heappop(A)
    sum_A += add_num[0]*-1
    if add_num[1] > 1:
        hq.heappush(A,(add_num[0],add_num[1]-1))
print(sum_A)

Buggy python submission (verdict: Runtime Error):
#D問題
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    A.extend([C]*B)
A.sort()
print(sum(A[:n]))




Fixed submission:
import heapq as hq
N, M = map(int, input().split())
A = list(map(int,input().split()))
A = [(-i,1) for i in A]
hq.heapify(A)
for i in range(M):
    B, C = map(int, input().split())
    hq.heappush(A,(-C,B))
sum_A = 0
for i in range(N):
    add_num = hq.heappop(A)
    sum_A += add_num[0]*-1
    if add_num[1] > 1:
        hq.heappush(A,(add_num[0],add_num[1]-1))
print(sum_A)

Buggy python submission (verdict: Time Limit Exceeded):
#D問題
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    if min(A) < C:
        for j in range(B):
            A.remove(min(A))
            A.append(C)
            if min(A) >= C:
                break
                

print(sum(A))




Fixed submission:
import heapq as hq
N, M = map(int, input().split())
A = list(map(int,input().split()))
A = [(-i,1) for i in A]
hq.heapify(A)
for i in range(M):
    B, C = map(int, input().split())
    hq.heappush(A,(-C,B))
sum_A = 0
for i in range(N):
    add_num = hq.heappop(A)
    sum_A += add_num[0]*-1
    if add_num[1] > 1:
        hq.heappush(A,(add_num[0],add_num[1]-1))
print(sum_A)

Buggy python submission (verdict: Time Limit Exceeded):
#D問題
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    for j in range(B):
            if min(A) < C:
                A.remove(min(A))
                A.append(C)

print(sum(A))




Fixed submission:
import heapq as hq
N, M = map(int, input().split())
A = list(map(int,input().split()))
A = [(-i,1) for i in A]
hq.heapify(A)
for i in range(M):
    B, C = map(int, input().split())
    hq.heappush(A,(-C,B))
sum_A = 0
for i in range(N):
    add_num = hq.heappop(A)
    sum_A += add_num[0]*-1
    if add_num[1] > 1:
        hq.heappush(A,(add_num[0],add_num[1]-1))
print(sum_A)
Buggy python submission (verdict: Runtime Error):
N = input()
answer_list = []
answer = 0

for i in range(len(N)):
    if N[i] == "A" or N[i] == "T" or N[i] == "C" or N[i] == "G":
        answer += 1
    else:
        answer_list.append(answer)
        answer = 0
print(max(answer_list))


Fixed submission:
N = input()
answer_list = []
answer = 0

for i in range(len(N)):
  if N[i] == "A" or N[i] == "T" or N[i] == "C" or N[i] == "G":
    answer += 1
  else:
    answer_list.append(answer)
    answer = 0
  if i+1 == len(N):
    answer_list.append(answer)
print(max(answer_list))
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S =input()
for i in range(Q):
  l, r = map(int, input().split())
  print(S[l-1:r].count('AC'))
  

Fixed submission:
N, Q = map(int, input().split())
S =input()
AC_list = [0]*N
count = 0
for i in range(1,N):
  if (S[i-1] + S[i]) == "AC":
    count +=1
  AC_list[i] = count

for i in range(Q):
  l, r = map(int, input().split())
  print(AC_list[r-1] - AC_list[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S =input()
for i in range(Q):
  l, r = map(int, input().split())
  print(S[l-1:r].count('AC'))
  

Fixed submission:
N, Q = map(int, input().split())
S =input()
AC_list = [0]*N
count = 0
for i in range(1,N):
  if (S[i-1] + S[i]) == "AC":
    count +=1
  AC_list[i] = count

for i in range(Q):
  l, r = map(int, input().split())
  print(AC_list[r-1] - AC_list[l-1])
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
tree_list = [int(input()) for _ in range(N)]
tree_list = sorted(tree_list)
ans = 10**9
for i in range(N-K+1):
    compare = tree_list[i+2]-tree_list[i]
    if ans > compare:
        ans = compare
print(ans)
    

Fixed submission:
N,K = map(int,input().split())
tree_list = [int(input()) for _ in range(N)]
tree_list = sorted(tree_list)
ans = 10**9
for i in range(N-K+1):
    compare = tree_list[i+K-1]-tree_list[i]
    if ans > compare:
        ans = compare
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
tree_list = []
for i in range(N):
    tree_list.append(int(input()))
tree_list = sorted(tree_list)
ans = 10**9
for i in range(N-K+1):
    compare = tree_list[i+2]-tree_list[i]
    if ans > compare:
        ans = compare
    if ans == 0:
      break
print(ans)
    

Fixed submission:
N,K = map(int,input().split())
tree_list = [int(input()) for _ in range(N)]
tree_list = sorted(tree_list)
ans = 10**9
for i in range(N-K+1):
    compare = tree_list[i+K-1]-tree_list[i]
    if ans > compare:
        ans = compare
print(ans)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
tree_list = []
for i in range(N):
    tree_list.append(int(input()))
tree_list = sorted(tree_list)
ans = 10**9
for i in range(N-K+1):
    compare = tree_list[i+2]-tree_list[i]
    if ans > compare:
        ans = compare
print(ans)
    

Fixed submission:
N,K = map(int,input().split())
tree_list = [int(input()) for _ in range(N)]
tree_list = sorted(tree_list)
ans = 10**9
for i in range(N-K+1):
    compare = tree_list[i+K-1]-tree_list[i]
    if ans > compare:
        ans = compare
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
length = [list(map(int,input().split()).append(i)) for _ in range(M)]
print(length)

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


length = [list(map(int,input().split())) for _ in range(M)]
for i in range(M):
  length[i].insert(2,i)
length = sorted(length)
ans_list =[0]*M
count = 1
for i in range(M):
  if i == 0:
    ans = str(length[i][0]).zfill(6) + str(count).zfill(6)
    ans_list[i] = [length[i][2],ans]
  elif i >= 1 and length[i][0] == length[i-1][0]:
    count += 1
    ans = str(length[i][0]).zfill(6) + str(count).zfill(6)
    ans_list[i] = [length[i][2],ans]
  elif i >= 1 and length[i][0] != length[i-1][0]:
    count = 1
    ans = str(length[i][0]).zfill(6) + str(count).zfill(6)
    ans_list[i] = [length[i][2],ans]
ans_list.sort(key=lambda x: x[0])
for i in range(M):
  print(ans_list[i][1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
button_list =[]
for i in range(1,N+1):
  button_list.append([i,int(input())])
bond_list = [button_list[0][0]]
dest = 0
for i in range(N):
  bond_list.append(button_list[button_list[dest][1]-1][0])
  bond_list.append(button_list[button_list[dest][1]-1][1])
  dest = button_list[button_list[dest][1]-1][1]-1
  if 2 in bond_list:
    print(bond_list.index(2))
    break;
  if len(bond_list) >=3 and bond_list[len(bond_list)-1] == bond_list[len(bond_list)-3]:
    print(-1)
    break;
  
  

Fixed submission:
N = int(input())
button_list =[]
for i in range(1,N+1):
  button_list.append(int(input()))

count = 0
dest = 1
for i in range(N):
    dest = button_list[dest - 1]
    count +=1
    if dest == 2:
        break;
if count == N:
    print(-1)
else:
    print(count)
Buggy python submission (verdict: Runtime Error):
S =input()
ans_list = []
for i in range(2**(len(S)-1)):
    comb = bin(i)[2:].zfill(len(S)-1)
    num_list = []
    num = S[0]
    for i in range(len(comb)):
        if comb[i] == "1":
            num_list.append(int(num))
            num = S[i+1]
        else:
            num += S[i+1]
    num_list.append(int(num))
    ans_list.append(sum(num_list))
print(sum(ans_list))

Fixed submission:
S =input()
ans_list = []
if len(S) == 1:
    print(int(S))
else:
    for i in range(2**(len(S)-1)):
        comb = bin(i)[2:].zfill(len(S)-1)
        num_list = []
        num = S[0]
        for i in range(len(comb)):
            if comb[i] == "1":
                num_list.append(int(num))
                num = S[i+1]
            else:
                num += S[i+1]
        num_list.append(int(num))
        ans_list.append(sum(num_list))
    print(sum(ans_list))
Buggy python submission (verdict: Time Limit Exceeded):
max = int(input())
orgList = list(map(int, input().split()))

result = 0;
for i in range(max):
    assertNo = orgList[i]
    sliceList = orgList[0:i+1]

    sliceList.sort()
    if sliceList[0] >= assertNo:
        result+= 1

print(result)


Fixed submission:
max = int(input())
orgList = list(map(int, input().split()))
min = 999999999999

result = 0;
for i in range(max):
    assertNo = orgList[i]
    if min > orgList[i]-1:
        min = orgList[i]

    if min >= assertNo:
        result+= 1

print(result)
Buggy python submission (verdict: Runtime Error):
def left(text, n):
  return text[:n]

def right(text, n):
  return text[-n:]

def mid(text, n, m):
  return text[n-1:n+m-1]
  
n = int(input())

rangeSet = [[0]*10 for i in range(10)]

# [1,9][9,1]など先頭＋最終の組み合わせを設定
for i in range(1,n+1):
	first = int(left(str(i),1))
	end = int(right(str(i),1))
	rangeSet[first][end] += 1

    kumiawase = 0
for k in range(1,10):
	for l in range(1,10):
		tmp = rangeSet[k][l] * rangeSet[l][k]
		kumiawase += tmp	
print(kumiawase)

Fixed submission:
def left(text, n):
  return text[:n]

def right(text, n):
  return text[-n:]

def mid(text, n, m):
  return text[n-1:n+m-1]
  
n = int(input())

rangeSet = [[0]*10 for i in range(10)]

# [1,9][9,1]など先頭＋最終の組み合わせを設定
for i in range(1,n+1):
	first = int(left(str(i),1))
	end = int(right(str(i),1))
	rangeSet[first][end] += 1

kumiawase = 0
for k in range(1,10):
	for l in range(1,10):
		tmp = rangeSet[k][l] * rangeSet[l][k]
		kumiawase += tmp	
print(kumiawase)
Buggy python submission (verdict: Runtime Error):
    print(chr(ord(input()) + 1))


Fixed submission:
print(chr(ord(input()) + 1))
Buggy python submission (verdict: Time Limit Exceeded):
mondai, kaitou = map(int, input().split())

# 問題ごとの
clearNo = []
# 問題ごとのWrong
wrong = {}
cleard = 0
pena = 0
# 解答数分繰り返す
kaitous = [input().split() for _ in range(kaitou)]
for i in kaitous:
    if i[0] in clearNo:
        continue
    else:
        if i[1] == 'WA':
            if i[0] in wrong:
                wrong[i[0]] += 1
            else:
                wrong[i[0]] = 1
        else:
            cleard += 1
            if i[0] in wrong:
                pena += wrong[i[0]]
            clearNo.append(i[0])

print(str(cleard) + ' ' + str(pena))


Fixed submission:
mondai, kaitou = map(int, input().split())

# 問題ごとのクリア管理
clearNo = [0] * (mondai+1)
# 問題ごとのWrong
wrong = [0] * (mondai+1)
cleard = 0
pena = 0
# 解答数分繰り返す
kaitous = [input().split() for _ in range(kaitou)]
for i in kaitous:
    qNo = int(i[0])
    result = i[1]
    if clearNo[qNo] == 1:
        continue
    else:
        if result == 'WA':
            wrong[qNo] += 1
        else:
            clearNo[qNo] = 1
            cleard += 1
            pena += wrong[qNo]

print(str(cleard) + ' ' + str(pena))

Buggy python submission (verdict: Time Limit Exceeded):
mondai, kaitou = map(int, input().split())

# 問題ごとの
clearNo = []
# 問題ごとのWrong
wrong = {}
cleard = 0
pena = 0
# 解答数分繰り返す
for i in range(kaitou):
    qNo, kaitou = input().split()
    qNo = qNo
    if qNo in clearNo:
        continue
    else:
        if kaitou == 'WA':
            if qNo in wrong:
                wrong[qNo] += 1
            else:
                wrong[qNo] = 1
        else:
            cleard += 1
            if qNo in wrong:
                pena += wrong[qNo]
            clearNo.append(qNo)

print(str(cleard) + ' ' + str(pena))


Fixed submission:
mondai, kaitou = map(int, input().split())

# 問題ごとのクリア管理
clearNo = [0] * (mondai+1)
# 問題ごとのWrong
wrong = [0] * (mondai+1)
cleard = 0
pena = 0
# 解答数分繰り返す
kaitous = [input().split() for _ in range(kaitou)]
for i in kaitous:
    qNo = int(i[0])
    result = i[1]
    if clearNo[qNo] == 1:
        continue
    else:
        if result == 'WA':
            wrong[qNo] += 1
        else:
            clearNo[qNo] = 1
            cleard += 1
            pena += wrong[qNo]

print(str(cleard) + ' ' + str(pena))
Buggy python submission (verdict: Runtime Error):
n = int(input())

sum = 0
for i in range(n):
  v,t = input().split()
  v = int(v)
  if t = 'BTC':
    sum+=v*38000
  else:
    sum+=v

print(sum)

Fixed submission:
n = int(input())
 
sum = 0
for i in range(n):
  v,t = input().split()
  v = float(v)
  if t == 'BTC':
    sum+=v*380000
  else:
    sum+=v
    
print(sum)
Buggy python submission (verdict: Runtime Error):
def retMax(a,b):
  if a>=b:
    return a
  else:
    return b

n = int(input())
r = []
dpList = [ [0] * 3 for x in range(n)]

for i in range(n):
  r.append(list(map(int,input().split())))

dpList[0][0] = r[0][0]  
dpList[0][1] = r[0][1]  
dpList[0][2] = r[0][2]  

for s in range(1,n):
  #b->a,c->aの最大値
  dpList[s][0] = retMax(dpList[s-1][1]+r[s][0],dpList[s-1][2]+r[s][0])
  #a->b,c->bの最大値
  dpList[s][1] = retMax(dpList[s-1][0]+r[s][1],dpList[s-1][2]+r[s][1])
  #a->c,b->cの最大値
  dpList[s][2] = retMax(dpList[s-1][0]+r[s][2],dpList[s-1][1]+r[s][2])

print(max(dpList[s]))
  

Fixed submission:
def retMax(a,b):
  if a>=b:
    return a
  else:
    return b

n = int(input())
r = []
dpList = [ [0] * 3 for x in range(n)]

for i in range(n):
  r.append(list(map(int,input().split())))

dpList[0][0] = r[0][0]  
dpList[0][1] = r[0][1]  
dpList[0][2] = r[0][2]  

for s in range(1,n):
  #b->a,c->aの最大値
  dpList[s][0] = retMax(dpList[s-1][1]+r[s][0],dpList[s-1][2]+r[s][0])
  #a->b,c->bの最大値
  dpList[s][1] = retMax(dpList[s-1][0]+r[s][1],dpList[s-1][2]+r[s][1])
  #a->c,b->cの最大値
  dpList[s][2] = retMax(dpList[s-1][0]+r[s][2],dpList[s-1][1]+r[s][2])

print(max(dpList[n-1]))
Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())

for i in range(n):
  c =input()
  if c=='Y':
    print('Four')
    sys.exit()
else:
  print('Three')
  

Fixed submission:
import sys
n = int(input())
cl = input().split()
for c in cl:
  if c=='Y':
    print('Four')
    sys.exit()
else:
  print('Three')
Buggy python submission (verdict: Runtime Error):
n = int(input())
cardList = [int(input()) for i in range(n)]

cardList = cardList.sort(reverse=True)

alice = 0
bob = 0
turn = True
for c in cardList:  
  if turn:
    alice+= c
    turn = False
  else:
    bob +=c
    turn =True
    
print(alice-bob)  

Fixed submission:
n = int(input())
cardList = map(int,input().split())
cl = list(cardList)
cl.sort(reverse=True)
alice = 0
bob = 0
turn = True
for c in cl:  
  if turn:
    alice+= c
    turn = False
  else:
    bob +=c
    turn =True
    
print(alice-bob)
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
b = list(map(int, input().split())) 

sum = 0
for ball in b:
  sum += ball - 0 if (ball - 0) < k - ball else k - ball
  
  print(sum*2)

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

Buggy python submission (verdict: Runtime Error):
a = int(input())
b=int(input())
return a*a - b

Fixed submission:
a = int(input())
b=int(input())
print(a*a - b)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split)
print (a -b if a-b <0 else 0)

Fixed submission:
a,b = map(int,input().split())
print (a -b if a-b >0 else 0)
Buggy python submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest
import math

def resolve():
    s,c= map(int,input().split())

    if s>=c/2:
        print(str(math.floor(c/2)))
    else:
        zanc = c - (s * 2)
        print(str(s + math.floor(zanc/4)))
        
resolve()

Fixed submission:
n = int(input())
print(n*800-(n//15*200))
Buggy python submission (verdict: Runtime Error):
def resolve():
    s,c= map(int,input().split())

    if s>=c/2:
        print(str(math.floor(c/2)))
    else:
        zanc = c - (s * 2)
        print(str(s + math.floor(zanc/4)))
        
resolve()

Fixed submission:
import sys
from io import StringIO
import unittest
import math

def resolve():
    s,c= map(int,input().split())

    if s>=c/2:
        print(str(math.floor(c/2)))
    else:
        zanc = c - (s * 2)
        print(str(s + math.floor(zanc/4)))
        
resolve()
Buggy python submission (verdict: Runtime Error):
s = input()

if s == 'a' or s == 'i' s == 'u' s == 'e' s == 'o' :
  print('vowel')
else:
  print('consonant')
        

Fixed submission:
s = input()
 
if s == 'a' or s == 'i' or s == 'u' or s == 'e' or s == 'o' :
  print('vowel')
else:
  print('consonant')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(input().split())
 
if a == b+c or b == a+c or c == a+b :
  print("Yes")
else:
  print("No")

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

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

if a = b+c or b = a+c or c = a+b :
  print("Yes")
else:
  print("No")
    

	



Fixed submission:
a,b,c = map(int,input().split())
 
if a == b+c or b == a+c or c == a+b :
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys
def main():
    S=input()
    Q=int(input())
    query=[]
    for i in range(Q):
        li = input().split(' ')
        query.append(li)
    f=True
    for i in range(Q):
        if(query[i][0]=='1'):
            f=not f
            continue
        else:
            F=query[i][1]
            C=query[i][2]
            
            if(f):
                if(F=='1'):
                    S=C+S
                else:
                    S=S+C
            else:
                C=C[::-1]
                if(F=='1'):
                    S=S+C
                else:
                    S=C+S
        
    if(not f):
        S=S[::-1]
    print(S) 



    

if __name__ == '__main__':
    main()

Fixed submission:
#!/usr/bin/env python3
import sys
from collections import deque
def main():
    S=input()
    Q=int(input())
    query=[list(input().split()) for _ in range(Q)]
    
    d=deque(S)
    c=0

    for q in query:
        if q[0]=="1":
            c+=1
        elif q[0]=="2":
            if (c%2==0 and q[1]=="1") or (c%2==1 and q[1]=="2"):
                d.appendleft(q[2])
            else:
                d.append(q[2])
    if(c%2!=0):
        d.reverse()
    print("".join(d))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, s: "List[int]", c: "List[int]"):
    for i in range(pow(10,N-1)-1,pow(10,N)):
        f=True
        for j in range(M):
            if not(str(i)[s[j]-1]==str(c[j])):f=False
            if(not f):break
        if(f):
            print(i)
            return
    print(-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    s = [int()] * (M)  # type: "List[int]"
    c = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        s[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, M, s, c)

if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, s: "List[int]", c: "List[int]"):
    if(pow(10,N-1)==1):x=0
    else:x=pow(10,N-1)
    for i in range(x,pow(10,N)):    
        f=True
        for j in range(M):
            if not(str(i)[s[j]-1]==str(c[j])):f=False
            if(not f):break
        if(f):
            print(i)
            return
    print(-1)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    s = [int()] * (M)  # type: "List[int]"
    c = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        s[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, M, s, c)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n,r=int(input())
ans=0
if n<10:
  ans=r+r*(10-n)
else:
  ans=r
ptinr(ans)

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

ans=0
if n<10:
  ans=r+100*(10-n)
else:
  ans=r
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
P=[int(input()) for _ in range(N)]

pp=[0]*N
for i in range(N):
    pp[i]=(p[i]+1)/2
sum=0
for i in range(0,K):
    sum+=pp[i]
for i in range(0,N-K):
    sum=max(sum,sum-pp[i]+pp[i+K])
print(sum)

    



Fixed submission:
from itertools import accumulate

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

pp=[0]*N
for i in range(N):
  pp[i]=(p[i]+1)/2

sum=0
temp=0
for i in range(0,K):
  temp+=pp[i]
sum=temp
for i in range(0,N-K):
  temp=temp-pp[i]+pp[i+K]
  sum=max(sum,temp)
print(sum)
Buggy python submission (verdict: Runtime Error):
A,B,C,D=int(input().split())
x=min(C,D)-max(A,B)
if x>0:
    print(x)
else:
    print("0")


Fixed submission:
A,B,C,D=map(int,input().split())
x=min(B,D)-max(A,C)
if x>0:
    print(x)
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
N,M=[int(i) for i in input().split()]
a=[]
b=[]
c=[]
for i in range(M):
    x,y=[int(i) for i in input().split()]
    if x==1 :
        c.append(y)
    if y==N:
        c.append(x)
if len(c)==len(set(c)):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


Fixed submission:
N=input()
print("ABC"+N)

Buggy python submission (verdict: Runtime Error):
N,M=[int(i) for i in input().split()]
a=[]
b=[]
c=[]
flag=False
for i in range(M):
    x,y=map(int,input().split())
    a.append(x)
    b.append(y)
    if x==1:
        c.append(y)
for i in range(M):
    if b[i]==N:
        flag=a[i] in c

if flag==False:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


Fixed submission:
N=input()
print("ABC"+N)