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

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
prod=1
if 0 in A:
    prod=0
for i in A:
    prod*=i
    if prod>10**18:
        prod=-1
        break
print(prod)

Buggy submission (verdict: Runtime Error):
import numpy as np

n=int(input())
A=np.array(list(map(int,input().split())))
a=np.prod(A)

if a>10**18:
    print("-1")
else:
    print(a)

Buggy submission (verdict: Runtime Error):
import numpy as np

n=int(input())
A=np.ndarray(map(int,input().split()))
a=np.prod(A)
if a>10**18:
    print("-1")
else:
    print(a)
Problem p02780 (python)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=[sum(p[0:k])]
for i in range(1,n-k+1):
  ans.append(ans[i-1]+p[i+k-1]-p[i-1])
max_value=max(ans)
max_index=ans.index(max_value)
total=0
for i in p[max_index:max_index+k]:
  total+=(i+1)/2
print(total)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=[sum(p[0:k])]
  ans.append(ans[i-1]+p[i+k-1]-p[i-1])
max_value=max(ans)
max_index=ans.index(max_value)
total=0
for i in p[max_index:max_index+k]:
  total+=(i+1)/2
print(total)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=[]
for i in range(n-k):
  ans.append(sum(p[i:i+k]))
max_value=max(ans)
max_index=ans.index(max_value)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=[]
for i in range(n-k):
  ans.append(sum(p[i:i+k]))
max_value=max(ans)
max_index=ans.index(max_value)
total=0
for i in p[max_index:max_index+k]:
  total+=(i+1)/2
print(total)

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

ans=[]
for i in range(n-k):
  ans.append(sum(p[i:k+i]))
index=ans.index(max(ans))
total=0
for i in p[index:index+k]:
  total+=(i*(i+1))/(2*i)
print(total)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
p=list(map(int,input().split()))
pro=[]
for ch in p:
  pro.append((ch*(ch+1))/2)
ans=[]
for i in range(n-k):
  ans.append(sum(pro[i:k+i]))
print(max(ans))
Problem p02786 (python)

Fixed submission:
from bisect import bisect_right
 
n=int(input())
lst=[1]
lst2=[1]
for i in range(1,41):
  lst.append(2**i)
  lst2.append(lst2[i-1]+lst[i])
  
ind=bisect_right(lst,n)
print(lst2[ind-1])

Buggy submission (verdict: Runtime Error):
import bisect

n=int(input())
lst=[1]
lst2=[1]
for i in range(1,41):
  lst.append(2**i)
  lst2.append(lst2[i-1]+lst[i])
  
ind=bisect_left(lst,n)
print(lst2[ind])
Problem p02789 (python)

Fixed submission:
n,m=map(int,input().split())
if n==m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
lists=list(map(int,input().split()))
 
mn=n+1
cnt=0
for li in lists:
  if mn>li:
    mn=li
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
print("Yes" if n==m: else: "No")
Problem p02791 (python)

Fixed submission:
n=int(input())
lists=list(map(int,input().split()))
 
mn=n+1
cnt=0
for li in lists:
  if mn>li:
    mn=li
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
plist=map(int,input().split())
ans=0

while plist:
  max_index = plist.index(max_value)
  ans+=max_index+1
  plist=plist-plist[0:max_index]
print(ans)
Problem p02818 (python)

Fixed submission:
A,B,K=map(int,input().split())
if K>=A:
  K=K-A
  if K>=B:
    K=K-B
    print('0 0')
  else:
    B=B-K
    print(0,' ',B)
else:
  print(A-K,' ',B)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
while K!==0:
  if A>=1:
    A--
    K--
  else:
    B--
    K--
print(A,' ',B)
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
if (a*a*b)/2>x:
  print(math.degrees(math.atan(a*b*b/(2*x))))
else:
  print(math.degrees(math.atan(2*(a*a*b-x)/(a*a*a))))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
 
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a=sorted(a)
f=sorted(f,reverse=True)
 
l=-1
r=max(a)*max(f)
def ok():
    s=0
    for i in range(n):
        s+=max(0,int(int(a[i])-int(c/f[i])))
    return s<=k
 
while(l+1<r):
    c=int((l+r)/2)
    ok=lambda :
    	s=0
    	for i in range(n):
    	    s+=max(0,int(int(a[i])-int(c/f[i])))
    	return s<=k
    if ok:
        r=c
    else:
        l=c
print(r)

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
if a*a*b/2>x:
  print(math.degrees(math.atan(a*a*b/2*x)))
else:
  print(math.degrees(math.atan(2-2*x/a*a*b))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
if a*a*b/2>x:
  print(math.degrees(math.atan(a*a*b/2*x))
else   
  print(math.degrees(math.atan(2-2*x/a*a*b))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
if a*a*b/2>x:
  print(math.degrees(math.atan(a*a*b/2*x))
else:
        print(math.degrees(math.atan(2-2*x/a*a*b))
Problem p02885 (python)

Fixed submission:
A,B=map(int,input().split())
 
answer=A-2*B
 
if answer<0:
  print(0)
else:
  print(answer)

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

answer=a-2*B

if answer<0:
  print(0)
else:
  print(answer)
Problem p02887 (python)

Fixed submission:
N=int(input())
S=list(input())
check=[]
for i in range(N-1):
  if S[i]==S[i+1]:
    check.append(i)
check=reversed(check)
for i in check:
  S.pop(i)
print(len(S))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
check=[]
for i in range(N-1):
  if S[i]==S[i+1]:
    check.append(i)
reversed(check)
for i in check:
  S.pop(i)
print(len(S))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
check=[]
for i in range(N-1):
  if S[i]==S[i+1]:
    check.append(i)
reversed(check)
for i in check:
  S.pop(i)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
check=[]
for i in range(N-1):
  if S[i]==S[i+1]:
    check.append(i)
for i in check:
  S.pop(i)
Problem p02888 (python)

Fixed submission:
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
count=0
for i in range(N):
  for j in range(i+1,N):
    c=L[i]+L[j]
    index=bisect.bisect_left(L,c)
    count+=max(0,index-j-1)
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
 
N=int(input())
L=list(map(int,input().split()))
 
L.sort()
for i in range(0,N):
  for j in range(i+1,N):
    index=bisect.bisect_left(L,L[i]+L[j])
    count+=index-j-i
print(count)
Problem p03071 (python)

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

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
int(a)
int(b)
if a>b:
  print(2*a-1)
elif a==b:
  print(2*a)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:
  print(2*a-1)
elif a==b:
  print(2*a)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:
  print(2*a-1)
else if a=b:
  print(2*a)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:
  print(2*a-1)
elif a=b:
  print(2*a)
else:
  print(2*b-1

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if(a>b):
  print(2*a-1)
elif(a=b):
  print(2*a)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if(a>b):
  print(2*a-1)
elif(a=b):
  print(2*a)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if(a>b):
  print(2*a-1)
else if(a=b):
  print(2*a)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if(a>b):
  print(2a-1)
else if(a=b):
  print(2a)
else:
  print(2b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if(a>b):
  print(2a-1)
else if(a=b):
  print(2a)
else:
  print(2b-1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if(a>b):
  print(2a-1)
elif(a=b):
  print(2a)
else:
  print(2b-1)
Problem p03693 (python)

Fixed submission:
r,g,b=map(str,input().split())
X=int(r+g+b)
ans = "YES" if X%4==0 else "NO"
print(ans)

Buggy submission (verdict: Runtime Error):
rgb=list(map(str,input().split()))
X=int(join(rgb))
ans = "Yes" if X%4==0 else "No"
print(ans)

Buggy submission (verdict: Runtime Error):
rgb=list(map(int,input().split()))
rgb.sorted()
X=int(join(rgb))
ans = "Yes" if X%4==0 else "No"
print(ans)
Problem p02621 (python)

Fixed submission:
a=int(input())
print(a+a**2+a**3)

Buggy submission (verdict: Runtime Error):
N, M, K=[int(i) for i in input().split(" ")]
a=[int(i) for i in input().split(" ")]
b=[int(i) for i in input().split(" ")]

if (N>10**7) | (M>10**7) |(K>10**7):
    print(0)
else:
    time=0
    a_idx=0
    b_idx=0
    count=0
    while time<K:
        count+=1
        try:
            if a_idx+1==N:
                time+=b[b_idx]
                b_idx+=1
                if time>K:
                    count-=1
                continue
            elif b_idx+1==M:
                time+=a[b_idx]
                a_idx+=1
                if time>K:
                    count-=1
                continue    

            if a[a_idx]<b[b_idx]:
                time+=a[a_idx]
                a_idx+=1

            elif a[a_idx]>b[b_idx]:
                time+=b[b_idx]
                b_idx+=1
            else:
                try:
                    a_com=a_idx
                    b_com=b_idx
                    while True:
                        if a[a_com]>b[b_com]:
                            time+=a[a_idx]
                            a_idx+=1
                            break
                        elif a[a_com]<b[b_com]:
                            time+=b[b_idx]
                            b_idx+=1
                            break
                        a_com+=1
                        b_com+=1
                except:
                    time+=a[a_idx]
                    a_idx+=1
            if time>K:
                count-=1            
        except:
            break
    print(count)

Buggy submission (verdict: Runtime Error):
N, M, K=[int(i) for i in input().split(" ")]
a=[int(i) for i in input().split(" ")]
b=[int(i) for i in input().split(" ")]

if (N>10*8) | (M>10**8) |(K>10*8):
    print(0)
else:
    time=0
    a_idx=0
    b_idx=0
    count=0
    while time<K:
        count+=1
        try:
            if a_idx+1==N:
                time+=b[b_idx]
                b_idx+=1
                if time>K:
                    count-=1
                continue
            elif b_idx+1==M:
                time+=a[b_idx]
                a_idx+=1
                if time>K:
                    count-=1
                continue    

            if a[a_idx]<b[b_idx]:
                time+=a[a_idx]
                a_idx+=1

            elif a[a_idx]>b[b_idx]:
                time+=b[b_idx]
                b_idx+=1
            else:
                try:
                    a_com=a_idx
                    b_com=b_idx
                    while True:
                        if a[a_com]>b[b_com]:
                            time+=a[a_idx]
                            a_idx+=1
                            break
                        elif a[a_com]<b[b_com]:
                            time+=b[b_idx]
                            b_idx+=1
                            break
                        a_com+=1
                        b_com+=1
                except:
                    time+=a[a_idx]
                    a_idx+=1
            if time>K:
                count-=1            
        except:
            break
    print(count)
Problem p03455 (python)

Fixed submission:
linea,lineb = map(int,input().split())
if (linea%2)*(lineb%2)==0:
	print("Even")
else :
	print("Odd")

Buggy submission (verdict: Runtime Error):
linea = int(input())
lineb = int(input())
if (linea%2)*(lineb%2)==0
	print("Even")
else 
	print("Odd")
Problem p03493 (python)

Fixed submission:
line = input()
print(line.count("1"))

Buggy submission (verdict: Runtime Error):
line = int(intput())
print(line.count('1'))
Problem p02613 (python)

Fixed submission:
n=int(input())
ac=0
wa=0
tle=0
re=0
for _ in range(n):
    s=input()
    if s=="AC":
        ac+=1
    elif s=="WA":
        wa+=1
    elif s=="TLE":
        tle+=1
    else:
        re+=1
print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)

Buggy submission (verdict: Runtime Error):
n=int(input())
ac=0
wa=0
tle=0
re=0
for _ in range(n):
    s=input()
    if s=="AC":
        a+=1
    elif s=="WA":
        wa+=1
    elif s=="TLE":
        tle+=1
    else:
        re+=1
print("AC x ",ac)
print("WA x ",wa)
print("TLE x ",tle)
print("RE x ",re)
Problem p02765 (python)

Fixed submission:
N,R=list(map(int,input().split()))
 
if N>=10:
  print(R)
else:
  print(R+100*(10-N))

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
 
ans = 0
while 1 <= n:
  n = n / k
  ans += 1
 
print(ans)

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

if N>=10:
  print(R)
else:
  print(A+100*(10-N))
Problem p02885 (python)

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

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

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

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

num=0
for i in A:
   num+=1/i
    
print(1/num)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int.input().split())
ans = 1/sum(1/x for x in A)
print(ans)
Problem p02969 (python)

Fixed submission:
a = int(input())
s = 3 * a **2
print(s)

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

print(N//(2*D+1)+1)
Problem p03059 (python)

Fixed submission:
a,b,t=list(map(int, input().split()))
print((t//a)*b)

Buggy submission (verdict: Runtime Error):
n=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))

sum=0
for i in range(n):
  if V[i]>C[i]:
      sum+=V[i]-C[i]
print(sum)
Problem p02606 (python)

Fixed submission:
L, R, D = map(int, input().split())
ANS = 0
if L % D == 0:
  ANS = 1
elif R % D == 0:
  ANS += 1
 
ANS += (R-L)//D
print(ANS)

Buggy submission (verdict: Runtime Error):
L, R, D = map(int, input().split())
ANS = 0
if L % d == 0:
  ANS = 1

ANS += (R-L)//d
print(ANS)
Problem p02613 (python)

Fixed submission:
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
  S = input()
  if S == "AC":
   	AC += 1
  if S == "WA":
    WA+= 1
  if S == "TLE":
    TLE += 1
  if S == "RE":
    RE+= 1
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))

Buggy submission (verdict: Runtime Error):
N = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(N):
  S = input()
  if S == "AC
   AC += 1
  if S == "WA":
    WA+= 1
  if S == "TLE":
    TLE += 1
  if S == "RE":
    RE+= 1

print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))
Problem p02687 (python)

Fixed submission:
S = input()

if S[1] == 'B':
  print('ARC')
else:
  print('ABC')

Buggy submission (verdict: Runtime Error):
S = input()
if S[1] == B:
  print("ARC")
else:
  print('ABC')
Problem p03087 (python)

Fixed submission:
import copy

N, Q = map(int, input().split())
S = input()
t = [0]*(N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)

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

Buggy submission (verdict: Runtime Error):
import copy

N, Q = map(int, input().split())
S = input()
t = [0]*N
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)

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

Buggy submission (verdict: Runtime Error):
import copy

N, Q = map(int, input().split())
S = input()
ANSlist = [0]*Q
for i in range(Q):
    l ,r = map(int, input().split())
    SS = copy.copy(S)
    SS[l:r]
    for j in range(len(SS)):
        if SS[j] == "A" and SS[j+1] == "C":
            ANSlist[i] += 1
    
for i in range(len(ANSlist)):
    print(ANSlist[i])

Buggy submission (verdict: Runtime Error):
import copy

N, Q = map(int, input().split())
S = input()
for i in range(Q):
    l ,r = map(int, input().split())
    SS = copy.copy(S)
    SS[l:r]
    ANS = 0
    for j in range(len(SS)):
        if SS[j] == "A" and SS[j+1] == "C":
            ANS += 1
    
    print(ANS)

Buggy submission (verdict: Runtime Error):
import copy

N, Q = map(int, input().split())
S = int(input())
for i in range(Q):
    l ,r = map(int, input().split())
    SS = copy.copy(S)
    SS[l:r]
    ANS = 0
    for j in range(len(SS)):
        if SS[j] == "A" and SS[j+1] == "C":
            ANS += 1
    
    print(ANS)
Problem p04030 (python)

Fixed submission:
S = input()
ANSlist = []

for i in range(len(S)):
    if S[i] == '0':
        ANSlist.append('0')
    elif S[i] == '1':
        ANSlist.append('1')
    elif S[i] == 'B':
        if len(ANSlist) >=1:
            del ANSlist[-1]

ANS = ''.join(ANSlist)

print(ANS)

Buggy submission (verdict: Runtime Error):
S = input()
ANS = ""
for i in range(len(S)):
  if S[i] == B:
    ANS = ANS[:-1]
  else:
    ANS += S[i]

print(ANS)
Problem p04044 (python)

Fixed submission:
N, M = map(int, input().split())
Mylist = []
for i in range(N):
  S = input()
  Mylist.append(S)
 
ANSlist = sorted(Mylist)
ANS = ''.join(ANSlist)
print(ANS)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Mylist = []
for i in range(M):
  S = input()
  Mylist.append(S)
 
ANSlist = sorted(Mylist)
ANS = ''.join(ANSlist)
print(ANS)

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

ANSlist = sorted(Mylist)
ANS = ''.join(ANSlist)
print(ANS)
Problem p02640 (python)

Fixed submission:
n=input()
x,y=n.split()
for c in range(int(x)+1):
  cnt=0
  t=int(x)-c
  asi=2*c+4*t
  if asi==int(y):
    print("Yes")
    cnt=1
    break
if cnt==0:
  print("No")

Buggy submission (verdict: Runtime Error):
n=input()
x,y=n.split()
c=(4*int(x)-int(y))/2
t=int(x)-c
print(z)
if c.is_integer and 100>=c>=0 and 100>=t>=0:
  print('Yes')
else:
  print('No')
Problem p02641 (python)

Fixed submission:
xn=input()
x,n=xn.split()
if n=='0':
  print(int(x))
else:
  p=input()
  p={int(i) for i in p.split()}
  s={i for i in range(-150,150)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])

Buggy submission (verdict: Runtime Error):
xn=input()
x,n=xn.split()
if n=='0':
  print(int(x))
else:
  p=input()
  p={int(i) for i in p.split()}
  s={i for i in range(1,100)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])

Buggy submission (verdict: Runtime Error):
xn=input()
try:
  p=input()
except EOFError:
  x,n=xn.split()
  print(int(x))
else:
  x,n=xn.split()
  p={int(i) for i in p.split()}
  s={i for i in range(1,100)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])

Buggy submission (verdict: Runtime Error):
xn=input()
p=input()
x,n=xn.split()
if p==' ':
  print(int(x))
else:
  p={int(i) for i in p.split()}
  s={i for i in range(1,100)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])

Buggy submission (verdict: Runtime Error):
xn=input()
p=input()
x,n=xn.split()
if p=='':
  print(int(x))
else:
  p={int(i) for i in p.split()}
  s={i for i in range(1,100)}
  s_p=list(s-p)
  d=[abs(i-int(x)) for i in s_p]
  print(s_p[d.index(min(d))])
Problem p02621 (python)

Fixed submission:
# -*- coding: utf-8 -*-
val_1 = int(input())
val_2 = val_1 * val_1
val_3 = val_1 * val_1 * val_1

answer = val_1 + val_2 + val_3
print(answer)

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(2)]
S = s[0]
T = s[1]
print(S)
print(T)


def count_diff2(s, t):
    cnt = 0
    for c1,c2 in zip(s, t):
        if c1 != c2:
            cnt += 1
    return cnt

print(count_diff2(S, T))
Problem p02687 (python)

Fixed submission:
S = input()
print('ABC' if S =='ARC' else 'ARC')

Buggy submission (verdict: Runtime Error):
X = int(input())
for i in range(-200, 200):
    for j in range(-200, 200):
        if i**5 - j**5 == X:
            print(i,j)
            exit()
Problem p02727 (python)

Fixed submission:
X,Y,A,B,C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
a = sorted(p)[A-X:]+sorted(q)[B-Y:]+r
print(sum(sorted(a)[C:]))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
r.sort()
a = 0
while X>0:
    if p==[]:
        p[0] = 0
    if r==[]:
        r[0] = 0
    if p[-1] > r[-1]:
        a += p.pop()
    else:
        a += r.pop()
    X -= 1
while Y>0:
    if q==[]:
        q[0] = 0
    if r==[]:
        r[0] = 0
    if q[-1] > r[-1]:
        a += q.pop()
    else:
        a += r.pop()
    Y -= 1
print(a)
Problem p02936 (python)

Fixed submission:
from collections import deque
N,Q= map(int, input().split())
tree = [[] for _ in range(N)]
counter = [0]*N
visited = [False]*N
q = deque([0])

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

for i in range(Q):
    p,x = map(int, input().split())
    counter[p-1] += x

while q:
    parent = q.popleft()
    visited[parent] = True
    for child in tree[parent]:
        if visited[child]:
            continue
        counter[child] += counter[parent]
        q.append(child)
print(*counter)

Buggy submission (verdict: Runtime Error):
N,Q= map(int, input().split())
d = {}
counter = [0]*N
for i in range(N-1):
    key, value = input().split()
    if key in d.keys():
        d[key] += value
    else:
        d[key] = value

def fun_dict(key):
    temp = len(d[key])
    for i in range(temp):
        if d[key][i] in d.keys():
            d[key] += d[d[key][i]]
            fun_dict(d[key][i])
fun_dict('1')

for i in range(Q):
    p, x = map(int, input().split())
    counter[p-1] += x
    if str(p) in d.keys():
        for values in d[str(p)]:
            counter[int(values) - 1] += x
print(' '.join(map(str, counter)))

Buggy submission (verdict: Runtime Error):
N,Q= map(int, input().split())
d = {}
counter = [0]*N
for i in range(N-1):
    key, value = input().split()
    if key in d.keys():
        d[key] += value
    else:
        d[key] = value

def fun_dict(key):
    temp = len(d[key])
    for i in range(temp):
        if d[key][i] in d.keys():
            d[key] += d[d[key][i]]
            fun_dict(d[key][i])
fun_dict('1')

for i in range(Q):
    p, x = map(int, input().split())
    counter[p-1] += x
    if str(p) in d.keys():
        for values in d[str(p)]:
            counter[int(values) - 1] += x
print(list(map(str, counter)))
print(' '.join(map(str, counter)))
Problem p02606 (python)

Fixed submission:
L, R, d = input().split()
L = int(L)
R = int(R)
d = int(d)
cnt = 0
for t in range(L,R+1):
    if t % d == 0:
        cnt = cnt + 1

print(cnt)

Buggy submission (verdict: Runtime Error):
L, R, d = input().split()
L = int(L)
R = int(R)
d = int(d)
cnt = 0
for t in Range(L,R+1):
  if t % d == 0:
    cnt = cnt + 1

print(cnt)

Buggy submission (verdict: Runtime Error):
L, R, d = input().split()
cnt = 0
for t in Range(L,R+1):
  if t % d == 0:
    cnt = cnt + 1

print(cnt)
Problem p02607 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = 0

for t in range(1,N+1):
    if t % 2 != 0 and A[t-1] % 2 != 0:
        cnt = cnt + 1

print(cnt)

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

for t in range(1,N+1):
    if t % 2 != 0 and A[t] % 2 != 0:
        cnt = cnt + 1

print(cnt)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a+a**2+a**3)

Buggy submission (verdict: Runtime Error):
num v= input("")
sum1 = num + num^2 + num^3