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

Fixed submission:
from math import floor
x,y = map(int,input().split())
for i in range(0,x+1):
    if (2*(i) + 4*(x-i) == y):
        print("Yes")
        exit(0);
print("No")

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
z = 2*x + y/2
if (z - floor(z) == 0):
  print("Yes")
else:
  print("No")
Problem p02700 (python)

Fixed submission:
from math import ceil
a,b,c,d = map(int, input().split())
x = ceil(a/d)
y = ceil(c/b)
if (x>=y):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from math import ceil
a,b,c,d = map(int, input().split())
x = (a+d-1)/d
y = (b+c-1)/b
if (x>=y):
  print("Yes")
  else:
    print("No")
Problem p02719 (python)

Fixed submission:
n,k = map(int,input().split())
ans = n%k
if (abs(ans-k) < ans):
	ans = abs(ans-k)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input())
pn = n
while(abs(n-k)<n):
  pn = n
  n = abs(n-k)
print(pn)
Problem p03323 (python)

Fixed submission:
a,b = map(int,input().split())
if (a<=8 and b<=8):
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
if (a<=8 and b<=8):
  print("Yay!")
else:
  print(":(")
Problem p02921 (python)

Fixed submission:
S=input()
T=input()
ans=0
for i in range(3):
  if S[i]==T[i]:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
ans=0
for i in range(3):
  if(S[i]==T[i])ans+=1
print(ans)
Problem p02993 (python)

Fixed submission:
a=input()
if a[0]==a[1] or a[1]==a[2] or a[2]==a[3]:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
a=input()
print("Good") if a[0]!=a[1]&a[1]!=a[2]&a[2]!=a[3] else print("Bad")

Buggy submission (verdict: Runtime Error):
s=input()
for i in range(1,4):
  if s[i]==s[i-1]:
    print("Bad")
    return
print("Good")
Problem p03288 (python)

Fixed submission:
n=int(input())
print('ABC') if n<1200 else print('ARC') if n<2800 else print('AGC')

Buggy submission (verdict: Runtime Error):
n=int(input())
print('ABC') if n<1200 elif n<2800 print('ARC') else print('AGC')

Buggy submission (verdict: Runtime Error):
n=int(input())
print('ABC') if n<1200 else if n<2800 print('ARC') else print('AGC')
Problem p03597 (python)

Fixed submission:
print(int(input())**2-int(input()))

Buggy submission (verdict: Runtime Error):
print(int(input())**2-int(input())
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,input().split())
print("A") if abs(x-a)<abs(x-b) else print('B')

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

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a%3==0) || (b%3==0) || ((a+b)%3==0):
  print("Possible")
else:
  print("Impossible")
Problem p03943 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print("Yes") if a[0]+a[1]==a[2] else print("No")

Buggy submission (verdict: Runtime Error):
a=list(map(int,input()))
a.sort()
print("Yes") if max(a[2]==a[1]+a[0]) else print("No")

Buggy submission (verdict: Runtime Error):
a=list(map(int,input())).sort()
print("Yes") if max(a[2]==a[1]+a[0]) else print("No")
Problem p02841 (python)

Fixed submission:
a,b = map(int,input().split())
c,d = map(int,input().split())
m31 = [1,3,5,7,8,10,12]
m30 = [4,6,9,11]

if a in m31 and b == 31:
    print(1)
elif a in m30 and b == 30:
    print(1)
elif a == 2 and b == 28:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c,d = map(int,input().split())
m31 = [1,3,5,7,8,10,12]
m30 = [4,6,9,11]

if a in m31 and b == 31:
    print(1)
elif a in m30 and b == 30:
    print(1)
elif a == 2 and b == 28:
    print(1)
else:
    print(0)
Problem p02842 (python)

Fixed submission:
import math
a = int(input())

X = math.ceil(a/1.08)

if math.floor(X*1.08) == a: 
    print(X)
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
    a = int(input())

    X = int(a/1.08 + 0.9)

    if int(X*1.08) == a: 
        print(X)
    else:
        print(":(")
Problem p02553 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
maxa=max(a*c,a*d,b*c,b*d)
print(maxa)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int(),input().split())
maxa=max(a*c,a*d,b*c,b*d)
print(maxa)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int(),input().split())
maxa=a*c
e=a*d
f=b*c
g=b*d
h=max(maxa,e)
j=max(f,g)
if h>j:
  print(h)
else:
  print(j)
Problem p02576 (python)

Fixed submission:
n,x,t=map(int,input().split())
if n%x==0:
  print(n//x*t)
else:
  print((n//x+1)*t)

Buggy submission (verdict: Runtime Error):
N,X,T=map(int,input(),split())
if N/X==0:
  print(N/X*T)
else:
  print((N//X+1)*T)

Buggy submission (verdict: Runtime Error):
N,X,T=map(int,input(),split())
print((N//X+1)*T)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=int(input())
T=int(input())
print((N//X+1)*T)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=int(input())
T=int(input())
print((int(N//X)+1)*T)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=int(input())
T=int(input())
print((int(N/X)+1)*T)
Problem p02582 (python)

Fixed submission:
S=input()
if S=="SSS":
    print(0)
elif S=="SSR":
    print(1)
elif S=="SRS":
    print(1)
elif S=="RSS":
    print(1)
elif S=="SRR":
    print(2)
elif S=="RSR":
    print(1)
elif S=="RRS":
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
#coding :utf-8
S=input(">")
if (S==sss):
    print(3)
elif(S==ssr):
    print(2)
elif(S==srs):
    print(1)
elif(S==rss):
    print(1)
elif(S==srr):
    print(2)
elif(S==rsr):
    print(1)
elif(S==rrs):
    print(2)
else:
    print(0)
Problem p02783 (python)

Fixed submission:
h,a=map(int,input().split())
if h%a==0:
  print(h//a)
else:
  print(h//a+1)

Buggy submission (verdict: Runtime Error):
h,a=map(int,input.split())
if h%a==0:
  print(h//a)
else:
  print(h//a+1)
Problem p02555 (python)

Fixed submission:
S = int(input())
mod = (10 ** 9 + 7)
if S < 3:
  print(0)
else:
  ans = 1
  max_length = S // 3
  dp = [[-1 for i in range(S-3+1)] for j in range(max_length+1)]
  for diff_size in range(S-3+1):
    for length in range(max_length+1):
      if length == 0:
        dp[length][diff_size] = 0
      elif length == 1 or diff_size == 0:
        dp[length][diff_size] = 1
      elif length == 2:
        dp[length][diff_size] = diff_size + 1
      elif diff_size == 1:
        dp[length][diff_size] = length
      else:
        if dp[length][diff_size] == -1:
          dp[length][diff_size] = dp[length-1][diff_size] + dp[length][diff_size-1]
  for length in range(2, max_length + 1):
    diff = S - length * 3
    ans += dp[length][diff]
    ans %= mod

  print(ans)

Buggy submission (verdict: Runtime Error):
mod = (10 ** 9 + 7)
tot = 1
l = [1, 0, 0]
for i in range(3, 2000):
  nex = (tot - l[-1] - l[-2]) % mod
  tot = (tot + nex) % mod
  l.append(nex)
print(l[int(input())])

Buggy submission (verdict: Runtime Error):
mod = (10 ** 9 + 7)
tot = 1
l = [1, 0, 0]
for i in range(3, 2000):
  nex = (tot - l[-1] - l[-2])
  tot = (tot + nex) 
  l.append(nex)
print(l[int(input())])
Problem p02573 (python)

Fixed submission:
class UnionFind:
    def __init__(self, n):
        self.parent = [-1] * n
        self.rank = [1] * n
        self.count = [1] * n
 
    def get_root(self, i):
        while self.parent[i] != -1:
            i = self.parent[i]
        return i
 
    def is_same_tree(self, i, j):
        return self.get_root(i) == self.get_root(j)
 
    def merge(self, i, j):
        i = self.get_root(i)
        j = self.get_root(j)
        if i == j:
            return
 
        if self.rank[i] > self.rank[j]:
            self.parent[j] = i
            self.rank[i] = max(self.rank[i], self.rank[j] + 1)
            self.count[i] += self.count[j]
        else:
            self.parent[i] = j
            self.rank[j] = max(self.rank[j], self.rank[i] + 1)
            self.count[j] += self.count[i]
n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
  a, b = [int(i) - 1 for i in input().split()]
  uf.merge(a, b)
print(max(uf.count))

Buggy submission (verdict: Runtime Error):
lass UnionFind:
  def __init__(self, n):
    self.parent = [-1] * n
    self.rank = [1] * n
    self.count = [1] * n

  def get_root(self, i):
    if self.parent[i] == i:
      return i
    else:
      self.parent[i] = self.get_root(self.parent[i])
      return self.parent[i]
    #while self.parent[i] != -1:
    #  i = self.parent[i]
    #return i

  def is_same_tree(self, i, j):
    return self.get_root(i) == self.get_root(j)

  def merge(self, i, j):
    i = self.get_root(i)
    j = self.get_root(j)
    if i == j:
      return

    if self.rank[i] > self.rank[j]:
      self.parent[j] = i
      self.rank[i] = max(self.rank[i], self.rank[j] + 1)
      self.count[i] += self.count[j]
    else:
      self.parent[i] = j
      self.rank[j] = max(self.rank[j], self.rank[i] + 1)
      self.count[j] += self.count[i]


n, m = map(int, input().split())
uf = UnionFind(n)
for _ in range(m):
  a, b = [int(i) - 1 for i in input().split()]
  uf.merge(a, b)
print(max(uf.count))
Problem p03325 (python)

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

res = 0
for i in range(N):
  fi_flg = False
  while fi_flg is False:
    if a[i] % 2 == 0:
      a[i] = int(a[i]/2)
      res += 1
    else:
      fi_flg = True
      
print(res)

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

fi_flg = False
res = 0
while fi_flg is False:
  twice_flg = False
  for i in range(len(a)):
    if (a[i] % 2 == 0) and (twice_flg == False):
      a[i] = int(a[i]/2)
      twice_flg = True
    else:
      a[i] = int(a[i]*3)
 
  if twice_flg is False:
    fi_flg = True
  else:
    res += 1
print(res)
Problem p03455 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = a * b
if s % 2 == 0:
  return "Even"
else:
  return "Odd"
Problem p02548 (python)

Fixed submission:
N = int(input())
NR = int(N**0.5)
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

count += int(N/2)
print(count)

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

    for i in range(1,int(N)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
 
 
 
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
NR = int(N**0.5)
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
 
count += int(N/2)
print(count)
N = int(input())
NR = int(N**0.5)
count = 0
if int(N/2)-N/2 == 0:
    for i in range(1,int(N/2)):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)
else:
    for i in range(1,int(N/2)+1):
        if int(N/i)-N/i == 0:
            count += int(N/i)-1
        else:
            count += int(N/i)

count += int(N/2)
print(count)
Problem p02576 (python)

Fixed submission:
nxt = input().split()
# print(nxt)
N = int(nxt[0])
X = int(nxt[1])
T = int(nxt[2])
# print(N,X,T)
tmp = N/X - int(N/X)
if tmp == 0:
    counter = int(N/X)
else:
    counter = int(N/X) + 1
# print(counter)
print(counter * T)

Buggy submission (verdict: Runtime Error):
nxt = input().split()
#print(nxt)
N = int(nxt[0]) 
X = int(nxt[1])
T = int(nxt[2])
#print(N,X,T)
tmp = N/X - int(N/X)
if tmp == 0:
    counter = int(N/X)
else:
    counter = int(N/X) + 1
#print(counter)
print(counter * T)
Problem p02660 (python)

Fixed submission:
import math

def is_prime(n):
    if n==1:
        return False
    nmax = int(math.sqrt(n)) + 1
    for i in range(2, nmax):
        if(n%i)==0:
            return False
    return True

def pf(n):
    sn = int(math.sqrt(n)) + 1
    ps = []
    for i in range(1, sn):
        if (n%i)==0:
            ps.append(i)
            ps.append(int(n/i))
    del ps[0]
    return ps        

n = int(input())
ps = []
num = pf(n)
for i in num:
    if is_prime(i):
        ps.append(i)
        
zs = []        
for p in ps:
    z = p
    while(z<=n):
        zs.append(z)
        z *= p
zs.sort()

cnt = 0
for z in zs:
    if(n>1):
        if(n%z==0):
            n /= z
            cnt += 1
print(cnt)

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

def is_prime(n):
    nmax = np.sqrt(n)
    nmax = nmax.astype(np.int64) + 1
    for i in range(2, nmax):
        if(n%i)==0:
            return False
    return True

def pf(n):
    sn = np.sqrt(n).astype(np.int64) + 1
    ps = []
    for i in range(1, sn):
        if (n%i)==0:
            ps.append(i)
            ps.append(int(n/i))
    del ps[0]
    return ps        

n = int(input())
ps = []
num = pf(n)
for i in num:
    if is_prime(i):
        ps.append(i)
        
zs = []        
for p in ps:
    z = p
    while(z<=n):
        zs.append(z)
        z *= p
zs.sort()
cnt = 0
for z in zs:
    if(n>1):
        if(n%z==0):
            n /= z
            cnt += 1
print(cnt)
Problem p02612 (python)

Fixed submission:
import math

N = int(input())

a = math.ceil(N / 1000)

b = 1000*a - N

print(b)

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

a = math.ceil(N / 1000)

b = 1000*a - N

print(b)
Problem p02628 (python)

Fixed submission:
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = sorted(c)
result = 0
for i in range(b):
    result += d[i]

print(result)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = list(map(int, input().split()))
d = sorted(c)
result = 0
for i in range(3):
    result += d[i]

print(result)
Problem p02639 (python)

Fixed submission:
n = list(map(int, input().split()))
result = 0
for i in range(len(n)):
  if n[i] == 0:
    print(i+1)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

for i in range(X + 1):
    if i * 2 + (X - i) * 4 == Y:
        print('Yes')
        break
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
for i in range(x+1):
    if 2*i+4*(x-i)==y:
        print("Yes")
print('No')

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
for i in range(x+1):
    if 2*i+4*(x-i)==y:
        print("Yes")
        break
else:
    print("No")
Problem p03369 (python)

Fixed submission:
n = input()
count = 0
for i in n:
    if i == "o":
        count += 1
print(700+count*100)

Buggy submission (verdict: Runtime Error):
n = input()
count = 0
for i in n:
  	if i == "×":
      	break
    else:
      	count += 1
print(700+count*100)
Problem p03371 (python)

Fixed submission:
a, b, c, x, y = map(int, input().split())

res = a*x + b*y
for i in range(1, max(x, y)+1):
    ab = i*2
    cand = ab*c + a*max(0, x-i) + b*max(0, y-i)

    res = min(res, cand)

print(res)

Buggy submission (verdict: Runtime Error):
A,B,C,X,Y = map(int, input().split())
ans = X*A + Y*B
for i in range(max(X+Y)+1):
    C = 2*C*i + max(0,X-i)*A + max(0,Y-i)*B
    ans = min(ans, C)
print(ans)
Problem p03486 (python)

Fixed submission:
a = list(input())
b = list(input())
a.sort()
b.sort()
b.reverse()
a=''.join(a)
b=''.join(b)
if a < b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
a = list(a)
b = list(b)

if (a.sort(reverse=True) < b.sort()):
    print("Yes")
else:
    print("No")
Problem p03494 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
count = 0

while all(i % 2 == 0 for i in a):
    a = [j/2 for j in a]
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
count = 0

while all(i % 2 == 0 for i in A):
    a = [j/2 for j in a]
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
count = 0
while True:
    if a[0]%2 == 0 and a[1]%2==0 and a[2]%2==0:
        a = map(i//2 for i in range(n))
        count += 1
    else:
         break
print(count)
Problem p03636 (python)

Fixed submission:
a = list(input())
n = len(a)-2
print(a[0],n,a[-1],sep=(""))

Buggy submission (verdict: Runtime Error):
a = list(input())
n = len(a)-2
print(a[0],n,a[-1],sep=("")
Problem p02630 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5+1)
for i in a:
  dp[i]+=1

for j in range(q):
  b,c=map(int,input().split())
  ans+=(c-b)*dp[b]
  dp[c]+=dp[b]
  dp[b]=0
  print(ans)

Buggy submission (verdict: Runtime Error):
dp=[0]*(10**5+1)
for i in range(1,10**5+1):
  dp[i]=a.count(i)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5+1)
for i in range(1,10**5+1):
  dp[i]=a.count(i)

for j in range(3000):
  b,c=map(int,input().split())
  ans+=(c-b)*dp[b]
  dp[c]+=dp[b]
  dp[b]=0
  print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5)
for i in range(1,10**5):
  dp[i]=a.count(i)

for j in range(q):
  b,c=map(int,input().split())
  ans+=(c-b)*dp[b]
  dp[c]=dp[b]+dp[c]
  dp[b]=0
  print(ans)
Problem p02642 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
kmax = sorted(a)[-1]
c = [0]*(kmax+1)

for i in range(n):
  c[a[i]] -= 1
  for j in range(a[i],(kmax+1),a[i]):
    c[j] += 2

ans=c.count(1)
print(ans)

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

def main():
  ans = 0
  for i in range(n):
    for j in range(i+2):
      if a[i] % a[j] == 0 and i != j:
        ans += 1
        break
  print(n-ans)

main()
Problem p02675 (python)

Fixed submission:
n = int(input())
m = n % 10

if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print("hon")
elif m == 3:
  print("bon")
else:
  print("pon")

Buggy submission (verdict: Runtime Error):
n = input()
m = n % 10

if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print(hon)
elif m == 3:
  print(bon)
else:
  print(pon)

Buggy submission (verdict: Runtime Error):
n = input()
m = n % 10

if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print("hon")
elif m == 3:
  print("bon")
else:
  print("pon")

Buggy submission (verdict: Runtime Error):
n = input()
m = n % 10

if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print("hon")
elif m == 3:
  print("bon")
else:
  print("pon")

Buggy submission (verdict: Runtime Error):
n = input()
m = n % 10

if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print("hon")
elif m = 3:
  print("bon")
else:
  print("pon")
Problem p02719 (python)

Fixed submission:
import math
n,k = map(int,input().split())
     
#m = math.floor(n/k)
n = n%k
     
print(min(n,k-n))

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

m = math.floor(n/k)
n = n-m*k

print(min(n,abs(n-k))
Problem p02727 (python)

Fixed submission:
from collections import deque
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=deque(sorted(list(map(int,input().split())),reverse=True))
p=deque(p[:x])
q=deque(q[:y])
ans=sum(p)+sum(q)

while p[-1]<r[0] or q[-1]<r[0]:
  if p[-1]<q[-1]:
    ans+=r[0]-p[-1]
    r.popleft()
    p.pop()
  else:
    ans+=r[0]-q[-1]
    r.popleft()
    q.pop()
  if p==deque([]) or q==deque([]) or r==deque([]):
    break
if r==deque([]):
  pass
elif p==deque([]):
  while q[-1]<r[0]:
    ans+=r[0]-q[-1]
    r.popleft()
    q.pop()
    if q==deque([]) or r==deque([]):
      break
elif q==deque([]):
  while p[-1]<r[0]:
    ans+=r[0]-p[-1]
    r.popleft()
    p.pop()
    if p==deque([]) or r==deque([]):
      break
  
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())),reverse=True)
q=sorted(list(map(int,input().split())),reverse=True)
r=deque(sorted(list(map(int,input().split())),reverse=True))
p=deque(p[:x])
q=deque(q[:y])
ans=sum(p)+sum(q)

while p[-1]<r[0] or q[-1]<r[0]:
  if p[-1]<q[-1]:
    ans+=r[0]-p[-1]
    r.popleft()
    p.pop()
  else:
    ans+=r[0]-q[-1]
    r.popleft()
    q.pop()
  if p==[] or q==[] or r==[]:
    break
print(ans)
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
dp=[0]*(n+1)
charge=[0]*(n+1)
cnt=0
ans=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    charge[int(q[:-3])]+=1
  elif dp[int(q[:-3])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
    ans+=1
    cnt+=charge[int(q[:-3])]
    charge[int(q[:-3])]=0
print(ans,cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
for i in range(m):
  q=input()
  if dp[int(q[:-3])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[i])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
print(dp.count("A"),cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
dp=[0]*(n+1)
cnt=0
for i in range(m):
  q=input()
  if dp[int(q[i])]!="A" and q[-2]=="W":
    dp[int(q[:-3])]="W"
    cnt+=1
  elif dp[int(q[i])]!="A" and q[-2]=="A":
    dp[int(q[:-3])]="A"
print(dp.count("A"),cnt)
Problem p02812 (python)

Fixed submission:
n=int(input())
s=input()
ans=0
for i in range(n-2):
  if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
for i in range(n-1):
  if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
    ans+=1
print(ans)
Problem p02818 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
if a>=k:
  print(a-k.b)
elif a+b>=k:
  print(0,a+b-k)
else:
  print(0,0)
Problem p02921 (python)

Fixed submission:
S=input()
T=input()
print(sum(s==t for s,t in zip(S,T)))

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
print(sum(s==t for s,t in zip(s,t)))
Problem p02983 (python)

Fixed submission:
import sys
l,r = map(int,input().split())
if l+2019<=r:
  print(0)
  sys.exit()
l=l%2019
r=r%2019
if l>=r:
  print(0)
  sys.exit()

ans=2018
for i in range(l,r):
  if ans == 0:
    break
  for j in range(i+1,r+1):
    ans = min(ans,i*j%2019)
    if ans == 0:
      break
print(ans)

Buggy submission (verdict: Runtime Error):
l=int(input())%2019
r=int(input())%2019+1
ans=2018
for i in range(l):
  if ans == 0:
    break
  for j in range(i+1,r):
    min(ans,i*j%2019)
    if ans == 0:
      break
print(ans)
Problem p03105 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(min(c,b//a))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().spli())
print(min(c,b//a))
Problem p03136 (python)

Fixed submission:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)

if l[0]<sum(l[1:]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
l=sorted(list(map(int,input().split()))reverse=True)

if l[0]<sum(l[1:]):
  print("Yes")
else:
  print("No")