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

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([int(sum_c - data[i]) for i in a])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum_c = 0
c = collections.Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum_c += val
print('\n'.join([int(sum_c - data[i]) for i in a])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum_c = 0
for i, v in collections.Counter(a).items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum_c += val
print('\n'.join([int(sum_c - data[i]) for i in a])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum = 0
for i, v in collections.Counter(a).items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum += val
print('\n'.join([int(sum - data[i]) for i in a])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int, input().split()))
dif = [0] * n
sum = 0
for i, v in collections.Counter(a).items():
    if v < 2:
        continue
    val = v * (v - 1) // 2
    dif[i] = 2 * (v - 1) // 2
    sum += val
print('\n'.join([int(sum_count - data[i]) for i in a])
Problem p02756 (python)

Fixed submission:
import sys
from collections import deque

readline = sys.stdin.readline
readlines = sys.stdin.readlines

s = readline().rstrip()
q = readline()
queries = readlines()
s = deque(s)
tot_1 = 0
for i in queries:
    if i[0] == '1':
        tot_1 += 1
        continue
    c = i[4]
    if (tot_1 + int(i[2])) % 2 == 0:
        s.append(c)
    else:
        s.appendleft(c)
ans = "".join(s) if tot_1 % 2 == 0 else "".join(reversed(s))
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque

readline = sys.stdin.readline
readlines = sys.stdin.readlines

s = readline().rstrip()
q = readline()
queries = readlines()
s = deque(s)
tot_1 = 0
for i in queries:
    if i[0] == '1':
        tot_1 += 1
        continue
    c = i[4]
    if (tot_1 + int(i[2])) % 2 == 0:
        s.append(c)
    else:
        s.appendleft(c)
ans = "".join(queue) if tot_1 % 2 == 0 else "".join(reversed(queue))
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
readlines = sys.stdin.readlines

s = readline().rstrip()
queries = readlines()
tot_1 = 0
for i in queries:
    if i[0] == '1':
        tot_1 += 1
    else:
        if (tot_1 + int(i[2])) % 2 == 0:
            s = s + i[4]
        else:
            s = i[4] + s
if tot_1 % 2 == 1:
    s = s[::-1]
print(s)
Problem p02994 (python)

Fixed submission:
n, l = map(int, input().split())
t = list(map(lambda x: l + x, range(n)))
r = sum(t)
dif = 10 ** 100
for i in range(n):
    tmp = sum(t[:i] + t[i + 1:])
    dif_t = abs(r - tmp)
    if dif_t < dif:
        ans = tmp
        dif = dif_t
print(ans)

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
t = list(map(lambda x: l + x, range(n)))
r = sum(t)
for i in range(n):
    tmp = sum(t[:i] + t[i + 1:])
    dif_t = abs(r - tmp)
    if i == 0:
        dif = dif_t
    if dif_t < dif:
        ans = tmp
        dif = dif_t
print(ans)
Problem p03316 (python)

Fixed submission:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    Sn = sum(list(map(int, list(str(n)))))
    print('Yes' if n % Sn == 0 else 'No')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    Sn = sum(list(str(n)))
    print('Yes' if n % Sn == 0 else 'No')


if __name__ == '__main__':
    main()
Problem p03360 (python)

Fixed submission:
abc = list(map(int, input().split()))
k = int(input())
mx = abc.pop(abc.index(max(abc)))
print(mx * pow(2, k) + sum(abc))

Buggy submission (verdict: Runtime Error):
abc = list(map(int, input().split()))
k = int(input())
mx = abc.pop(max(abc))
print(mx * k + sum(abc))
Problem p03377 (python)

Fixed submission:
a, b, x = map(int, input().split())
print('YES' if a <= x <= a + b else 'NO')

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
print('YES' if a <= x <= a + b)
Problem p02573 (python)

Fixed submission:
n,m=map(int,input().split())
l=[set() for _ in range(n+1)]

for i in range(m):
  a,b=map(int,input().split())
  l[a].add(b)
  l[b].add(a)

from collections import deque

vi=[0 for _ in range(n+1)]
st=deque([i,i] for i in range(1,n+1))

while st:
  c,d=st.popleft()

  if vi[c]==0 :
    vi[c]=d
    for m in l[c]:
      st.appendleft([m,d])
from collections import Counter
s=Counter(vi)
mx=0
for m in s.values():
  mx=max(mx,m)
print(mx)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[set() for _ in range(n+1)]*(n+1)
mn=0
for i in range(m):
  a,b=map(int,input().split())
  l[a].add(b)
  l[b].add(a)

for i in range(n):
  aa=l[i]
  for k in l[i]:
    aa=aa|l[k]
  mn=max(mn,len(aa))
print(mn)
Problem p02574 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l=[0]*(10**6+100)
x=0
for m in a:
  l[m]+=1

j=2
#print(l)


while j <10**6+1:
  c=0
  k=1
  while j*k<=10**6+1 :
    if l[j*k]>0:
      c+=l[j*k]
    k+=1

  if c==n:
    print("not coprime")
    exit()
  elif c>1:
    x=1
  j+=1 
  
if x==1:
  print("setwise coprime")
else:
  print("pairwise coprime")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
l=[0]*(10**6+1)
for m in a:
  l[m]=1
x=0
j=2
#print(l)
for i in range(n):
  c=0
  k=1
  while j*k<=10**6+1 :
    if l[j*k]==1:
      c+=1
      l[j*k]=0
    k+=1
  if c==n:
    print("not coprime")
    exit()
  elif c>1:
    x=1
  j+=1 
if x==1:
  print("setwise coprime")
else:
  print("pairwise coprime")
Problem p02576 (python)

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

Buggy submission (verdict: Runtime Error):
h,w,m=map(int,input().split())
lh=[0]*h
lw=[0]*w
l=[[0 for _ in range(w)] for _ in range(h)]
for i in range(m):
  h1,w1=map(int,input().split())
  l[h1-1][w1-1]=1
  lh[h1-1]+=1
  lw[w1-1]+=1
hmax=max(lh)
wmax=max(lw)
lh2=[]
lw2=[]
for i in range(h):
  if lh[i]==hmax:
    lh2.append(i)
for i in range(w):
  if lw[i]==wmax:
    lw2.append(i)
 
s=1
for m in lh2:
  for m2 in lw2:
    if l[m][m2]==0:
      s=0
      
print(hmax+wmax-s)
Problem p02882 (python)

Fixed submission:
a,b,x=map(float,input().split())
import math
if x<=a*a*b/2:
  print(math.degrees(math.atan(a*b*b/2/x)))
elif (-x/a+a*b)==0:
  print(0)
else:
  print(math.degrees(math.atan(2/a/a*(a*b-x/a))))

Buggy submission (verdict: Runtime Error):
a,b,x=map(float,input().split())
import math
if x<=a*a*b/2:
  print(90-math.degrees(math.asin(2*x/a/b/((2*x/a/b)*2+b**2)**0.5)))
elif (-x/a+a*b)==0:
  print(0)
else:
  print(90-math.degrees(math.atan(a*a/2/(-x/a+a*b))))

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

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a-2b,0))
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
n,q=map(int,input().split())

d=[[0] for _ in range(n+1)]
d1=[0 for _ in range(n+1)]

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

for i in range(q):
  p,x=map(int,input().split())
  d1[p]+=x

#d 関係性 d1価
vi=[-1 for _ in range(n+1)]

def dfs(x,i):
  vi[x]=i+d1[x]
  for m in d[x]:
    if vi[m]==-1 and m!=0:
      dfs(m,vi[x])    

dfs(1,0)


print(*vi[1:])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
n,q=map(int,input().split())

d=[[0] for _ in range(n+1)]
d1=[0 for _ in range(n+1)]

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

for i in range(q):
  p,x=map(int,input().split())
  d1[p]+=x

for i in range(1,n+1):
  d[i].remove(0)
  
vi=[0 for _ in range(n+1)]

def dfs(x,i):
  vi[x]=i+d1[x]
  for m in d[x]:
    if vi[m]==0:
      dfs(m,vi[x])    

dfs(1,0)


print(*vi[1:])

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

d=[[0] for _ in range(n+1)]
d1=[0 for _ in range(n+1)]

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

for i in range(q):
  p,x=map(int,input().split())
  d1[p]+=x

for i in range(1,n+1):
  d[i].remove(0)
  
vi=[0 for _ in range(n+1)]

def dfs(x,i):
  vi[x]+=i+d1[x]
  for m in d[x]:
    if vi[m]==0:
      dfs(m,vi[x])    

dfs(1,0)


print(*vi[1:])
Problem p02971 (python)

Fixed submission:
n=int(input())
a=[int(input()) for _ in range(n)]
b=sorted(a)
for m in a:
  if m !=b[-1]:
    print(b[-1])
  else:
    print(b[-2])

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
a=2018
for i in range (l,min(r,l+2019)):
  for j in range(i+1,min(r+1,i+2019)):
    c= ((i%2019)*(j%2019))%2019
    if c<a:
      a=c
print(a)
Problem p03160 (python)

Fixed submission:
n=int(input())
import sys
sys.setrecursionlimit(10 ** 6)
h=list(map(int,input().split()))
cos={0:0,1:abs(h[1]-h[0])}
def cost(x):
  if x not in cos:
    d1=cost(x-1)+abs(h[x]-h[x-1])
    d2=cost(x-2)+abs(h[x]-h[x-2])
    cos[x]=min(d1,d2)
    return cos[x]
  else:
    return cos[x]
  
print(cost(n-1))

Buggy submission (verdict: Runtime Error):
n=int(input())
sys.setrecursionlimit(10 ** 6)
h=list(map(int,input().split()))
cos={0:0,1:abs(h[1]-h[0])}
def cost(x):
  if x not in cos:
    d1=cost(x-1)+abs(h[x]-h[x-1])
    d2=cost(x-2)+abs(h[x]-h[x-2])
    cos[x]=min(d1,d2)
    return cos[x]
  else:
    return cos[x]
  
print(cost(n-1))

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cos={0:0,1:abs(h[1]-h[0])}
def cost(x):
  if x not in cos:
    d1=cost(x-1)+abs(h[x]-h[x-1])
    d2=cost(x-2)+abs(h[x]-h[x-2])
    cos[x]=min(d1,d2)
    return cos[x]
  else:
    return cos[x]
  
print(cost(n-1))
Problem p03274 (python)

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

import bisect
c=bisect.bisect_left(x,0)
mt=2*10**8

for i in range(n-k+1):
  if i+k<c:continue
  mt=min(mt,2*abs(x[i])+abs(x[i+k-1]),abs(x[i])+2*abs(x[i+k-1]))
  if i+k-1 ==c-1:mt=min(mt,abs(x[i]))
  if i==c:mt=min(mt,x[i+k-1])
if n==k:
  if c!=n and c!=0:
    mt=min(2*abs(x[0])+x[-1],2*x[-1]+abs(x[0]))
  else:
    mt=max(abs(x[0]),abs(x[-1]))
print(mt)

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

st=0
m=3*10**8
for i in range(n-1):
  if x[i]<0 and x[i+1]>=0:
    st=i+1

for i in range(n-k+2):
  mi=x[k+i-1]-x[i]+min(abs(x[k+i-1]),abs(x[i]))
  print(x[k+i-1],x[i],mi)
  if k+i<st or i>st:continue
  if mi <m:m=mi
print(m)
Problem p03994 (python)

Fixed submission:
s=input()
k=int(input())
l=list(s)

for i in range(len(s)):
  f=(-ord(s[i])+ord("z")+1)%26
  if f<=k:
    l[i]="a"
    k-=f

k=k%26
a=ord(l[-1])+k 
if a> ord("z"):a-=26
l[-1]=chr(a)
print("".join(l))

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
l=list(s)

for i in range(len(s)):
  f=-ord(s[i])+ord("z")+1
  if f<=k:
    l[i]="a"
    k-=f
l[-1]=chr(ord(l[-1])+k)
print("".join(l))

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
l=list(s)

for i in range(len(s)):
  f=-ord(s[i])+ord("z")+1
  if f<=k:
    l[i]="a"
    k-=f
l[-1]=chr(ord(s[-1])+k)
print("".join(l))
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split())
p = set()
if n:
    p = set(map(int,input().split()))
mini = float('inf')
ans = float('inf')
for i in range(-400,400):
    if i not in p:
        if abs(x-i)<mini:
            mini = abs(x-i)
            ans = i
        elif abs(x-i)==mini and ans>i:
            ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n:
    p = set(map(int,input().split()))
mini = float('inf')
ans = float('inf')
for i in range(-400,400):
    if i not in p:
        if abs(x-i)<mini:
            mini = abs(x-i)
            ans = i
        elif abs(x-i)==mini and ans>i:
            ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n:
    p = set(map(int,input().split()))
mini = float('inf')
ans = float('inf')
for i in range(0,110):
    if i not in p:
        if abs(x-i)<mini:
            mini = abs(x-i)
            ans = i
        elif abs(x-i)==mini and ans>i:
            ans=i
print(ans)

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n:
    p = set(map(int,input().split()))
mini = float('inf')
ans = float('inf')
for i in range(1,102):
    if i not in p:
        if abs(x-i)<mini:
            mini = abs(x-i)
            ans = i
        elif abs(x-i)==mini and ans>i:
            ans=i
print(ans)
Problem p02601 (python)

Fixed submission:
#A = list(map(int, input().split()))
a, b, c = map(int, input().split())
k = int(input())
import math

if a >= b:
  p = int(math.log(a/b,2)) +1
else:
  p = 0
  
if b*(2**p) >= c:
  q = int(math.log(b*(2**p)/c,2)) +1
else:
  q = 0
#print(p)
#print(q)

if (p + q) <= k:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#A = list(map(int, input().split()))
a, b, c = map(int, input().split())
k = int(input())
import math

if a >= b:
  p = int(math.log(a, b))
else:
  p = 0
  
if b*p*2 >= c:
  q = int(math.log(b*2*p, c))
else:
  q = 0
#print(p)
#print(q)

if (p + q) <= k:
  print("Yes")
else:
  print("No")
Problem p02658 (python)

Fixed submission:
n = int(input())
values =list(map(int, input().split()))
a=1
t = 10**18
for i in range(n):
  if values[i] == 0:
    a = 0
    break
  if a > t:
    continue
  else:
    a=a*values[i]
 
if a <= t:
  print(a)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
values =list(map(int, input().split()))
a=1
 
for i in range(n):
  a=a*values[i]
  
import math
if math.log10(a) < 18:
  print(a)
else:
  print(-1)
Problem p02613 (python)

Fixed submission:
N = int(input())

ans = [0]*4
for n in range(N):
  C = input()
  if C == "AC":
    ans[0] += 1
  elif C == "WA":
    ans[1] += 1
  elif C == "TLE":
    ans[2] += 1
  elif C == "RE":
    ans[3] += 1

print("AC x {}".format(ans[0]))
print("WA x {}".format(ans[1]))
print("TLE x {}".format(ans[2]))
print("RE x {}".format(ans[3]))

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

ans = [0]*4
for n in range(n):
  C = input()
  if C = "AC":
    ans[0] += 1
  elif C = "WA":
    ans[1] += 1
  elif C = "TLE":
    ans[2] += 1
  elif C = "RE":
    ans[3] += 1

print("AC x ".format(ans[0]))
print("WA x ".format(ans[1]))
print("TLE x ".format(ans[2]))
print("RE x ".format(ans[3]))
Problem p02639 (python)

Fixed submission:
from sys import stdin
 
X = stdin.readline().strip().split(" ")
 
n = 0
for i in range(len(X)):
  if X[i] == "0":
    n = i+1
    break
print(n)

Buggy submission (verdict: Runtime Error):
from sys import stdin
 
X = stdin.readline().strip().split(" ")
 
n = 0
for i in range(len(X)):
  if X[i] == "0":
    n = i+1
    break
print n

Buggy submission (verdict: Runtime Error):
from sys import stdin

X = stdin.readline().strip().split(" ")

n = 0
for i in range(len(X)):
  if X[i] == 0:
    n = i+1
    break
print n
Problem p02641 (python)

Fixed submission:
from sys import stdin
 
input_num = stdin.readline().strip().split(" ")

X = int(input_num[0])
N = int(input_num[1])
num_list = []
if N != 0:
    num_list = [int(x) for x in stdin.readline().strip().split(" ")]


dec_num = X
inc_num = X
if N == 0:
    print(X)
elif X not in num_list:
    print(X)
else:
    while True:
        dec_num += -1
        inc_num += 1
        if dec_num not in num_list:
            print(dec_num)
            break
        if inc_num not in num_list:
            print(inc_num)
            break

Buggy submission (verdict: Runtime Error):
from sys import stdin
 
input_num = stdin.readline().strip().split(" ")

X = int(input_num[0])
N = int(input_num[1])
num_list = [int(x) for x in stdin.readline().strip().split(" ")]

dec_num = X
inc_num = X
if N == 0:
    print(X)
elif X not in num_list:
    print(X)
else:
    while True:
        dec_num += -1
        inc_num += 1
        if dec_num not in num_list:
            print(dec_num)
            break
        if inc_num not in num_list:
            print(inc_num)
            break

Buggy submission (verdict: Runtime Error):
from sys import stdin
 
input_num = stdin.readline().strip().split(" ")

X = int(input_num[0])
N = int(input_num[1])
num_list = [int(x) for x in stdin.readline().strip().split(" ")]

minv = 10000
num = 0

if N == 0:
  print(X)
else:
  for i in range(len(num_list)):
    if minv > abs(X - num_list[i]):
      minv = abs(X - num_list[i])
      num = i
  print(num_list[num])

Buggy submission (verdict: Runtime Error):
from sys import stdin
 
input_num = stdin.readline().strip().split(" ")

X = int(input_num[0])
N = int(input_num[1])
num_list = [int(x) for x in stdin.readline().strip().split(" ")]

minv = 10000
num = 0

if N == 0:
  print(X)
else:
  for i in range(len(num_list)):
    if minv > abs(X - num_list[i]):
      minv = abs(X - num_list[i])
      num = i
  print(num)

Buggy submission (verdict: Runtime Error):
from sys import stdin
 
input_num = stdin.readline().strip().split(" ")

X = int(input_num[0])
N = int(input_num[1])
num_list = stdin.readline().strip().split(" ")

minv = 10000
num = 0

if N == 0:
  print(X)
else:
  for i in range(len(num_list)):
    if minv > abs(X - num_list[i]):
      minv = abs(X - num_list[i])
      num = i
  print(num)
Problem p02657 (python)

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

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

print(N*M)
Problem p02909 (python)

Fixed submission:
S = input()


if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

S = list(map(int, input().split()))
N = S[0]
M = S[1]
A = list(map(int, input().split()))


for _ in range(M):
    A[A.index(max(A))] //= 2

print(sum(A))
Problem p03106 (python)

Fixed submission:
A, B, K = map(int, input().split())
yakusuu = []

for i in range(1, min(A, B)+1):
    if A % i == 0 and B % i == 0:
        yakusuu.append(i)

print(yakusuu[-K])

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

for i in range(2, min(A, B)+1):
    if A % i == 0 and B % 2 == 0:
        yakusuu.append(i)

print(yakusuu[K-1])
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input()) * int(input()))
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
num = [1]*(n + 1)
pena = [0]*(n + 1)
AC_cnt = 0
WA_cnt = 0
for i in range(m):
    p,s=input().split()
    if s == 'AC':
        if num[int(p)]:
            num[int(p)] = 0
            AC_cnt += 1
            WA_cnt += pena[int(p)]
    else:
        pena[int(p)] += 1
print(AC_cnt,WA_cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
num = [1]*(n + 1)
AC_cnt = 0
WA_cnt = 0
for i in range(m):
    p,s=input().split()
    if s == 'AC'
        if num[int(p)]:
            num[int(p)] = 0
            AC_cnt += 1
else:
    WA_cnt += 1
print(AC_cnt,WA_cnt)
Problem p02818 (python)

Fixed submission:
A,B,K = map(int,input().split())
if K < A:
  print(A - K, B)
elif A <= K and K < (A + B):
  print(0, B - (K - A))
else:
  print(0,0)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
if K < A:
  print(A - k, B)
elif A <= K and K < (A + B):
  print(0, B - (K - A))
else:
  print(0,0)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
if K < A:
  print(A - k, B)
elif A < K and K < A + B:
  print(0, B - (K - A))
else:
  print(0,0)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
if K < A:
  print(A - k, B)
elif A <= K and K < A + B:
  print(0, B - (K - A))
else:
  print(0,0)
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
num = b-a+1
ac = int((a-1)//c)
ad = int((a-1)//d)
bc = int(b//c)
bd = int(b//d)
e = c*d//(fractions.gcd(c,d))
a = int((a-1)//e)
b = int(b//e)
c = bc-ac
d = bd-ad
e = b-a
print(num-(c+d-e))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
num = b-a+1
ac = int((a-1)/c)
ad = int((a-1)/d)
bc = int(b/c)
bd = int(b/d)
e = c*d//(math.gcd(c,d))
a = int(a/e)
b = int(b/e)
c = bc-ac
d = bd-ad
e = b-a
print(num-(c+d-e))
Problem p03000 (python)

Fixed submission:
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(N+1)
x = 0
for i in range(1,N+1):
  D[i] = D[i-1]+L[i-1]
for i in D:
  if i <= X:
    x += 1
print(x)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(N+1)
x = 0
for i in range(1,N+2):
  D[i] = D[i-1]+L[i-1]
while D[x] <= X:
  x += 1
print(x)

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
L = list(map(int,input().split()))
D = [0]*(N+1)
x = 0
for i in range(1,N+1):
  D[i] = D[i-1]+L[i-1]
while D[x] <= X:
  x += 1
print(x)
Problem p03149 (python)

Fixed submission:
s = list(map(int,input().split()))
s.sort()
c = [1,4,7,9]

if s == c:
    print('YES')
else:
    print('NO')

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

c = [1,,4,7,9]

if s == c:
    print('YES')
else:
    print('NO')
Problem p03244 (python)

Fixed submission:
import collections
n = int(input())
v = list(map(int,input().split()))
v_odd = []
v_even = []
for i,v in enumerate(v):
    if i % 2:
        v_even.append(v)
    else:
        v_odd.append(v)
odd_n = len(v_odd)
even_n = len(v_even)
v_odd = collections.Counter(v_odd)
v_odd = sorted(v_odd.items(), key=lambda x:x[1],reverse=True)
v_even = collections.Counter(v_even)
v_even = sorted(v_even.items(), key=lambda x:x[1],reverse=True)

if v_odd[0] == v_even[0] and 2 <= len(v_odd) and 2 <= len(v_even):
    if v_odd[1][1] < v_even[1][1]:
        v_even.pop(0)
    elif v_odd[1][1] > v_even[1][1]:
        v_odd.pop(0)

num = v_odd[0][0]

ans = odd_n-v_odd[0][1]
st = 0
for i,v in v_even:
    if num == i:
        continue
    else:
        st = v
        break
print(ans+(even_n-st))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int,input().split()))
v_odd = []
v_even = []
for i,v in enumerate(v):
    if i % 2:
        v_even.append(v)
    else:
        v_odd.append(v)
odd_n = len(v_odd)
even_n = len(v_even)
v_odd = collections.Counter(v_odd)
v_odd = sorted(v_odd.items(), key=lambda x:x[1],reverse=True)
v_even = collections.Counter(v_even)
v_even = sorted(v_even.items(), key=lambda x:x[1],reverse=True)

if v_odd[0] == v_even[0]:
    if v_odd[1][1] < v_even[1][1]:
        v_even.pop(0)
    elif v_odd[1][1] > v_even[1][1]:
        v_odd.pop(0)

num = v_odd[0][0]

ans = odd_n-v_odd[0][1]
st = 0
for i,v in v_even:
    if num == i:
        continue
    else:
        st = v
        break
print(ans+(even_n-st))