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

Fixed submission:
n = [int(i) for i in input().split()]
a = n[0]
b = n[1]
if a < 10:
  b += (10-a)*100
print(b)

Buggy submission (verdict: Runtime Error):
n = [i for i in input().split()]
a = n[0]
b = n[1]
if a < 10:
  b += (10-a)*100
print(b)

Buggy submission (verdict: Runtime Error):
n = [i for i in input().split()]
a = n[1]
b = n[2]
if a < 10:
  b += (10-a)*100
print(b)

Buggy submission (verdict: Runtime Error):
n = [i for i in input().split()]
a = n[1]
b = n[2]
if a <10:
  b += (10-a)*100
print(b)
Problem p03471 (python)

Fixed submission:
import math
def calc_10000_5000_comb(n2,y2):
    max_10000 = min(math.floor(y2 / 10000), n2)
    for n_10000 in range(max_10000 + 1)[::-1]:
        y5000 = y2 - 10000 * n_10000
        n_5000 = math.floor(y5000 / 5000)
        if n_5000 + n_10000 == n2:
            return [n_10000, n_5000]
        if n2 < n_5000 + n_10000:
            break
    return []
ny = input()
n, y = [int(x) for x in ny.split(" ")]
min_y_1000 = y % 5000
min_n_1000 = math.floor(min_y_1000 / 1000)
max_n_1000 = n
match = [-1,-1,-1]
if y % 1000 == 0:
    for n_1000 in range(min_n_1000,max_n_1000 + 1, 5):
        y_2 = y - 1000 * n_1000
        n_2 = n - n_1000
        n_10000_n_5000_comb = calc_10000_5000_comb(n_2,y_2)
        if n_10000_n_5000_comb:
            match = n_10000_n_5000_comb + [n_1000]
            break
print(" ".join(map(str,match)))

Buggy submission (verdict: Runtime Error):
ny = input()
n, y = [int(x) for x in ny.split(" ")]
min_y_1000 = y % 5000
min_n_1000 = math.floor(min_y_1000 / 1000)
match = [-1,-1,-1]
if y % 1000 == 0:
    for n_1000 in range(min_n_1000,max_n_1000 + 1, 5):
        y_2 = y - 1000 * n_1000
        n_2 = n - n_1000
        n_10000_n_5000_comb = calc_10000_5000_comb(n_2,y_2)
        if n_10000_n_5000_comb:
            match = n_10000_n_5000_comb + [n_1000]
            break
print(" ".join(map(str,match)))
Problem p02818 (python)

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

if a <= k:
  if b -(k - a) <=0:
    print('0 0')
  else:
    s = 0
    t = b - (k - a)
    print('{} {}'.format(s, t))
else:
  s = a - k
  t = b
  print('{} {}'.format(s, t))

Buggy submission (verdict: Runtime Error):
a, b, k = int(input().split())

if a <= k:
  if b -(k - a) <=0:
    print('0 0')
  else:
    s = 0
    t = b - (k - a)
    print('{} {}'.format(s, t))
else:
  s = a - k
  t = b
  print('{} {}'.format(s, t))
Problem p02923 (python)

Fixed submission:
N = int(input())
Hs = input().split()
A = []
b = 0
b_h = 0
for i in range(N-1):
  if int(Hs[i]) < int(Hs[i+1]):
    b = i
    A.append(b-b_h)
    b_h = b+1

if len(A) != N-1:
  b = i + 1
  A.append(b-b_h)
  print(max(A))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
Hs = input().split()
A = []
for k in range(N): # 0, 1, 2, 3, 4
  c = 0
  for i in range(k, N - 1): # 0~3, 1~3, ... 
    if int(Hs[i]) < int(Hs[i+1]):
      A.append(c)
      break
    elif int(Hs[i]) >= int(Hs[i+1]):
      c += 1
    if i == N - 2:
      A.append(c)
      break
  if i == N - 2:
    break
      
print(max(A))
Problem p03105 (python)

Fixed submission:
ABC = input().split()
A = int(ABC[0])
B = int(ABC[1])
C = int(ABC[2])
if B / A > C:
  print(C)
else:
  print(int(B / A))

Buggy submission (verdict: Runtime Error):
ABC = input().split()
A = ABC[0]
B = ABC[1]
C = ABC[2]
if A / B > C:
  print(C)
else:
  print(A / B)
Problem p03085 (python)

Fixed submission:
A = input()
if A == "A":
  print("T")
elif A == "T":
  print("A")
elif A == "C":
  print("G")
elif A == "G":
  print("C")

Buggy submission (verdict: Runtime Error):
A = input()
if A 　== "A":
  print("T")
elif A == "T"
  print("A")
elif A == "C"
  print("G")
elif A == "G"
  print("C")
Problem p03136 (python)

Fixed submission:
n = int(input())
L = list(map(int, input().split()))
nagai = int(max(L))
wa = int(sum(L))
if nagai < wa - nagai:
   print('Yes')
else:
   print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
L = list(map(int, input().split()))
nagai = max(L)
if nagai > sum(L)
   print('Yes')
 else
   print('No')
Problem p02765 (python)

Fixed submission:
hako = list(map(int, input().split()))
if hako[0] < 10:
  print(100 * (10 - hako[0]) + hako[1])
else:
  print(hako[1])

Buggy submission (verdict: Runtime Error):
n, r = int(input().split())
if n < 10:
  print(100 * (10 - n) + r)
else:
  print(r)
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
if a % b == 0:
  print(a + b)
else:
  print(b - a)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
if b % a == 0:
  print(a + b)
else:
  print(b - a)
Problem p03238 (python)

Fixed submission:
a = int(input())
if a == 1:
  print("Hello World")
else:
  b = int(input())
  c = int(input())
  print(b + c)

Buggy submission (verdict: Runtime Error):
a = int(input())
kazu = [int(input()) for _ in range(1)]
if a == 1:
  print("Hello World")
else:
  print(sum(kazu))

Buggy submission (verdict: Runtime Error):
a = int(input())
kazu = [int(input()) for _ in range(2)]
if a == 1:
  print("Hello World")
else:
  print(sum(kazu))
Problem p03485 (python)

Fixed submission:
a, b = map(int, input().split())
x = (a + b) / 2
if x == (a + b) // 2:
  print((a + b) //2)
else:
  print((a + b) // 2 + 1)

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

Fixed submission:
kazu = ["A","B","C","D","E","F"]
X, Y = input().split()
x = kazu.index(X)
y = kazu.index(Y)
if x > y:
  print(">")
elif x == y:
  print("=")
elif x < y:
  print("<")

Buggy submission (verdict: Runtime Error):
kazu = {"A":10,"B":11,"C":12,"D":13,"E":14,"F":15}
x, y = input().split()
if kazu[x] > kazu[y]:
  print(">")
elif kazu[x] = kazu[y]:
  print("=")
elif kazu[x] < kazu[y]:
  print("<")
Problem p03635 (python)

Fixed submission:
n, m = map(int, input().split())
print((n - 1) * (m - 1))

Buggy submission (verdict: Runtime Error):
n, m = map(intm input().split())
print((n - 1) * (m - 1))
Problem p03852 (python)

Fixed submission:
boin = ["a", "e", "i", "o", "u"]
moji = input()
if moji in boin:
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
boin = [a, i, u, e, o]
moji = input()
if moji in boin:
  print('vowel')
else:
  print('consonant')
Problem p02772 (python)

Fixed submission:
n = int(input())
arr = [int(i) for i in input().split()]

for d in arr :
  
  if d % 2 == 0 :
    
    if d % 3 == 0 or d % 5 == 0:

      pass
    
    else :

      print("DENIED")
      exit()
      
print("APPROVED")

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = [int(i) for i in input().split()]

for d in arr :
  
  if d % 2 == 0 :
    
    if d % 3 == 0 :

      pass
    
    elif d % 5 = 0 : 
      pass
    
    else :

      print("DENIED")
      exit()
      
print("APPROVED")
Problem p03731 (python)

Fixed submission:
n,t = (int(i) for i in input().split())
ni = [int(i) for i in input().split()]

total = 0

for i in range(1,len(ni)) :
  delta = ni[i] - ni[i-1]
  if delta < t :
    total += delta
  else :
    total += t

    
print(total+t)

Buggy submission (verdict: Runtime Error):

N, T = map(int, input().split())
t = list(map(int, input().split()))
s, e = 0, 0
ans = 0
for i in range(N):
  if t[i] <= e:
    e = t[i] + T
    else:
      ans += e - s
      s = t[i]
      e = t[i] + T
ans += e - s
print(ans)
Problem p03101 (python)

Fixed submission:
H,W, = (int(i) for i in input().split())
h,w = (int(i) for i in input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
H,W,h,w = (int(i) for i in input().split())
print((H-W)*(h-w))
Problem p02801 (python)

Fixed submission:
s = input()
alphabet = list('abcdefghijklmnopqrstuvwxyz')
print(alphabet[alphabet.index(s)+1])

Buggy submission (verdict: Runtime Error):
s = input()
alphabet = list('abcdefghijklmnopqrstuvwxyz')
print(alphabet[alphabet.index(s)+1])

Buggy submission (verdict: Runtime Error):
alphabet = list('abcdefghijklmnopqrstuvwxyz')

s=input()

ss = alphabet.index(s)

print(alphabet[ss])
Problem p02767 (python)

Fixed submission:
import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X) + 1):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))

Buggy submission (verdict: Runtime Error):

import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X)):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))

Buggy submission (verdict: Runtime Error):

N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
for i in range(min(X), max(X)):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))

Buggy submission (verdict: Runtime Error):
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
for i in range(min(X), max(X)):
    ans = 0
    for j in X:
        ans += (j - i) * (j - i)
    ans_list.append(ans)

print(min(ans_list))
Problem p02806 (python)

Fixed submission:
def main():
    N = int(input())
    music = []
    m_time = []
    for _ in range(N):
        a, b = input().split()
        music.append(a)
        m_time.append(int(b))
    X = input()
    ans = 0
    for i, a in enumerate(music):
        if a == X:
            for j in range(i+1, N):
                ans += m_time[j]
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
#include<stdio.h>
int main(void){
  int N, A, B, sum, ans = 0;
  scanf("%d %d %d", &N, &A, &B);
  for(int i=0;i<=N;i++){
    int j=i;
    sum=0;
    while(j!=0){
      sum=sum+(j%10);
      j=j/10;
    }
    if(sum>=A && sum<=B){
      ans=ans+i;
    }
  }
  printf("%d\n", ans);
  return 0;
}
Problem p02767 (python)

Fixed submission:
import sys

N = int(input())

line = input().split(" ")
X = []

for e in line:
	X.append(int(e))

ans = sys.maxsize
for P in range(101):
	curr = 0

	for x in X:
		curr += (x - P)**2

	ans = min(ans, curr)


print(ans)

Buggy submission (verdict: Runtime Error):
from math import inf

N = int(input())

line = input().split(" ")
X = []

for e in line:
	X.append(int(e))

ans = inf
for P in range(101):
	curr = 0

	for x in X:
		curr += (x - P)**2

	ans = min(ans, curr)


print(ans)
Problem p02767 (python)

Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())), dtype = 'int64')
a1 = np.min(A)
a2 = np.max(A)

ans = 1000000
for p in range(a1,a2+1):
    B = (A-p)**2
    s = np.sum(B)
    if s < ans:
        ans = s

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
MOD = 10**9+7

N,a,b = map(int,input().split())

N = int(input())
A = np.array(list(map(int,input().split())), dtype = 'int64')
a1 = np.min(A)
a2 = np.max(A)

ans = 1000000
for p in range(a1,a2+1):
    B = (A-p)**2
    s = np.sum(B)
    if s < ans:
        ans = s

print(ans)
Problem p02768 (python)

Fixed submission:
MOD = 10**9+7

n,a,b = map(int,input().split())

Sn = pow(2,n,MOD) - 1
if a > b:
    a,b = b,a
Xa, Xb = 1,1
Ya, Yb = 1,1
for i in range(b):
    if i < a:
        Xa = ( Xa * (n-i) ) % MOD
        Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD
    Xb = ( Xb * (n-i) ) % MOD
    Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD

ans = Sn - Xa*Ya % MOD - Xb*Yb % MOD
while ans < 0:
    ans += MOD
    
print(ans)

Buggy submission (verdict: Runtime Error):
Sn = pow(2,n,MOD) - 1
if a > b:
    a,b = b,a
Xa, Xb = 1,1
Ya, Yb = 1,1
for i in range(b):
    if i < a:
        Xa = ( Xa * (n-i) ) % MOD
        Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD
    Xb = ( Xb * (n-i) ) % MOD
    Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD

ans = Sn - Xa*Ya % MOD - Xb*Yb % MOD
while ans < 0:
    ans += MOD
    
print(ans)
Problem p02787 (python)

Fixed submission:
import numpy as np

H, N = map(int,input().split())

A = np.zeros(N, dtype = int)
B = np.zeros(N, dtype = int)

for i in range(N):
    A[i],B[i] = map(int,input().split())
    
dp = np.full(H+1, np.inf)

dp[0] = 0
for i in range(1,H+1):
    dp[i] = np.amin( dp[np.maximum(i-A,0)] + B )

print(int(dp[H]))

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

H, N = map(int,input().split())

A = np.zeros(N, dtype = int)
B = np.zeros(N, dtype = int)

for i in range(N):
    A[i],B[i] = map(int,input().split())
    
dp = np.zeros(H+1, dtype = int)
dp[0] = 0
for i in range(1,H+1):
    dp[i] = np.amin([dp[np.amax(i-A,0)] + B])

print(int(dp[H]))

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

H, N = map(int,input().split())

A = np.zeros(N, dtype = int)
B = np.zeros(N, dtype = int)

for i in range(N):
    A[i],B[i] = map(int,input().split())
    
dp = np.zeros(H+1, dtype = int)
dp[0] = 0
for i in range(1,H+1):
    dp[i] = np.min([dp[np.max(i-A[j],0)] + B[j] for j in range(N)])
            
print(int(dp[H]))
Problem p02814 (python)

Fixed submission:
import numpy as np
import fractions
from functools import reduce

N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
A = A // 2

def lcmb(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm(L):
    return reduce(lcmb, L, 1)
    
T = lcm(A)

flg = False
for a in A:
    if (T//a)%2 == 0:
        flg = True
        break

m = M//T
if flg:
    ans = 0
elif m%2 == 0:
    ans = m//2
else:
    ans = m//2 + 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
A = A // 2

def lcmb(x,y):
    return (x*y)//math.gcd(x,y)
def lcm(L):
    return reduce(lcmb, L, 1)
    
T = lcm(A)
m = M//T
if m%2 == 0:
    ans = m//2
else:
    ans = m//2 + 1
print(ans)
Problem p02865 (python)

Fixed submission:
N = int(input())

if N%2 == 0:
    print(int(N//2-1))
else:
    print(int((N+1)//2-1))

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

N = int(input())
A = np.array(list(map(int,input().split())))
B = np.array(list(map(int,input().split())))
Bsi = np.argsort(B)
A2 = A[Bsi]
Bs = B[Bsi]
A2si = np.argsort(A2)
As = A2[A2si]
C = Bs-As
if any(C[C<0]):
    ans = 'No'
else:
    D = A2-As
    if any(D == 0):
        ans = 'Yes'
    elif all(As[1::]-Bs[:-1:] > 0):
        psum = A2si[0]
        for i,pi in enumerate(A2si[1:-1],1):
            psum += pi
            if psum == int(i*(i+1)/2):
                ans = 'Yes'
                break
        else:
            ans = 'No'
    else:
        ans = 'Yes'
        
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = sorted(list(map(int,input().split())))
ans = 1
D.append(-1)
if D[0]>0:
    ans = 0
elif D[1]==0:
    ans = 0
else:
    cur = 0
    n1 = 1
    n2 = 1
    for i,d in enumerate(D[1::],1):
        if d == cur:
            n2 += 1
        else:
            nn = (n1**n2)%998244353
            ans *= nn
            n1 = n2
            n2 = 1
            cur = d
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = sorted(list(map(int,input().split())))
ans = 1
D.append(-1)
if D[0]>0:
    ans = 0
elif D[1]==0:
    ans = 0
else:
    cur = 0
    n1 = 1
    n2 = 1
    for i,d in enumerate(D[1::],1):
        if d == cur:
            n2 += 1
        else:
            ans *= n1**n2
            ans %= 998244353                
            n1 = n2
            n2 = 1
            cur = d
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
D = sorted(list(map(int,input().split())))
ans = 1
D.append(-1)
if D[0]>0:
    ans = 0
elif D[1]==0:
    ans = 0
else:
    cur = 0
    n1 = 1
    n2 = 1
    for i,d in enumerate(D[1::],1):
        if d == cur:
            n2 += 1
        else:
            ans *= n1**n2
            n1 = n2
            n2 = 1
            cur = d
print(ans%998244353)

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

if N%2 == 0:
    print(int(N/2-1))
else:
    print(int((N+1)/2-1)
Problem p02867 (python)

Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())))
B = np.array(list(map(int,input().split())))
Bsi = np.argsort(B)
A2 = A[Bsi]
Bs = B[Bsi]
A2si = np.argsort(A2)
As = A2[A2si]
C = Bs-As
if any(C[C<0]):
    ans = 'No'
else:
    D = A2-As
    if any(D == 0):
        ans = 'Yes'
    elif all(As[1::]-Bs[:-1:] > 0):
        pi = 0
        i = 0
        while i<N-1:
            pi = A2si[pi]
            if pi == 0:
                ans = 'Yes'
                break
            else:
                i += 1
        else:
            ans = 'No'
    else:
        ans = 'Yes'
        
print(ans)

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

N = int(input())
A = np.array(list(map(int,input().split())))
B = np.array(list(map(int,input().split())))
Bsi = np.argsort(B)
A2 = A[Bsi]
Bs = B[Bsi]
A2si = np.argsort(A2)
As = A2[A2si]
C = Bs-As
if any(C[C<0]):
    ans = 'No'
else:
    D = A2-As
    if any(D == 0):
        ans = 'Yes'
    elif all(As[1::]-Bs[:-1:] > 0):
        psum = A2si[0]
        for i,pi in enumerate(A2si[1:-1],1):
            psum += pi
            if psum == int(i*(i+1)/2)
                ans = 'Yes'
                break
        else:
            ans = 'No'
    else:
        ans = 'Yes'
        
print(ans)
Problem p02780 (python)

Fixed submission:
from itertools import accumulate

n,k = map(int,input().split())
P = list(map(int,input().split()))

# 期待値の前計算
expP = [(P[i]+1)/2 for i in range(n)]

# 累積和の計算
acc = [0]+ list(accumulate(expP)) # 0を忘れずに

# 隣接する K 項の和の計算
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

n,k = map(int,input().split())
P = list(map(int,input().split()))

# 期待値の前計算
expP = [(P[i]+1)/2 for i in range(n)]

# 累積和の計算
acc = [0]+ list(+accumulate(expP)) # 0を忘れずに
print(acc)

# 隣接する K 項の和の計算
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate

n,k = map(int,input().split())
P = list(map(int,input().split()))

# 期待値の前計算
expP = [(P[i]+1)/2 for i in range(n)]

# 累積和の計算
acc = list([0]+accumulate(expP)) # 0を忘れずに
print(acc)

# 隣接する K 項の和の計算
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, k = map(int, input().split())
P = list(map(int, input().split()))
#n = 10
#k = 4
#P = [17, 13, 13, 12, 15, 20, 10, 13, 17, 11]
ans2 = list()
for i in range(n - (k-1)):
    ans2.append(P[i:i+k])
#print(ans2)

ans3 = list()
for i in ans2:
    ans3.append(sum(i))
#print(ans3)

am = np.argmax(ans3)
#print(am)
am2 = P[am:am+k]
#print(am2)

ans = 0
for i in am2:
    for j in range(1, i + 1):
        ans += j / i
print(ans)
Problem p02791 (python)

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

smallest_so_far = float("inf")
cnt = 0

for the_num in P:
    if the_num < smallest_so_far :
        smallest_so_far = the_num
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
'''C - Welcome to AtCoder
高橋君は AtCoder のコンテストに参加しています。

このコンテストでは、 N 問の問題が出題されます。
高橋君はコンテスト中に M回の提出を行いました。

i 回目の提出は pi番目の問題への提出であり、結果は Si (AC または WA) でした。
高橋君の正答数は、AC を 1回以上出した問題の数です。
高橋君のペナルティ数は、高橋君が AC を 1 回以上出した各問題において、初めて AC を出すまでに出した WA の数の総和です。
高橋君の正答数とペナルティ数を答えてください。

入力
入力は以下の形式で標準入力から与えられる。

N M
p1 S1
:
pM SM

2 5
1 WA
1 AC
2 WA
2 AC
2 WA
>
2 2

100000 3
7777 AC
7777 AC
7777 AC
>
1 0

6 0
>
0 0
'''
import numpy as np

N, M = map(int, input().split())

AC = np.array([0]*N) # 正解を入れる箱
WA = np.array([0]*N) # 不正解を入れる箱

for _ in range(M):
    p, S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA": # まだ「正解が出てない & 不正解」
        WA[int(p)-1] += 1              # なら不正解の箱に＋１
    else:
        AC[int(p)-1] = 1               # それ以外は正解の箱に１
    
print(sum(AC), sum(WA*AC)) # ただし不正解の箱は最後まで正解が出なかった問題はペナルティ無しにする必要があるので、正解の箱の中身と掛け合わせて消しておく。
Problem p02801 (python)

Fixed submission:
C = input()

nb = lambda xx: chr(ord(xx) + 1) 
print(nb(C))

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

if sum(A) > N * M:
    print(0)
elif N * M - sum(A) - K < 0:
    print(N * M - sum(A))
else:
    print(-1)
Problem p02802 (python)

Fixed submission:
import numpy as np
 
N,M = map(int,input().split()) 
 
AC = np.array([0]*N)
WA = np.array([0]*N)
 
for i in range(M):
    p,S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA":
       WA[int(p)-1] += 1
    else:
        AC[int(p)-1] = 1

print(sum(AC),sum(AC*WA))

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N,M = map(int,input().split()) 
 
AC = np.array([0]*N)
WA = np.array([0]*N)
 
for i in range(M):
    p,S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA":
       WA[int(p)-1] += 1
    else:
        AC[int(p)-1] = 1

print(sum(AC),sum(AC*WA))

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

N, M = map(int, input().split())

AC = np.array([0]*N) # 正解を入れる箱
WA = np.array([0]*N) # 不正解を入れる箱

for _ in range(M):
    p, S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA": # まだ「正解が出てない & 不正解」
        WA[int(p)-1] += 1              # なら不正解の箱に＋１
    else:
        AC[int(p)-1] = 1               # それ以外は正解の箱に１
    
print(sum(AC), sum(WA*AC)) # ただし不正解の箱は最後まで正解が出なかった問題はペナルティ無しにする必要があるので、正解の箱の中身と掛け合わせて消しておく。

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

N, M = map(int, input().split())

AC = np.array([0]*N) # 正解を入れる箱
WA = np.array([0]*N) # 不正解を入れる箱

for _ in range(M):
    p, S = input().split()
    
    if AC[int(p)-1] ==0 and S == "WA": # まだ「正解が出てない & 不正解」
        WA[int(p)-1] += 1              # なら不正解の箱に＋１
    else:
        AC[int(p)-1] = 1               # それ以外は正解の箱に１
    
print(sum(AC), sum(WA))
Problem p02811 (python)

Fixed submission:
K, X = map(int, input().split())
if 500 * K >= X:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
    K, X = map(int, input().split())
    if 500 * K >= X:
        print('Yes')
    else:
        print('No')
Problem p02952 (python)

Fixed submission:
N = int(input())
result = 0
for i in range(1, N+1):
    if len(str(i)) % 2 == 1:
        result += 1
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
lg = len(N)
cnt = 0
if lg == 6:
    cnt = 90900
elif lg == 5:
    cnt += N - 10000 + 1
    cnt += 909
elif lg == 4:
    cnt = 909
elif lg == 3:
    cnt += N - 100 + 1
    cnt += 9
elif lg == 2:
    cnt = 9
else:
    cnt = N
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
lg = len(N)
cnt = 0
if lg == 6:
    cnt = 90909
elif lg == 5:
    cnt += N - 10000 + 1
    cnt += 909
elif lg == 4:
    cnt = 909
elif lg == 3:
    cnt += N - 100 + 1
    cnt += 9
elif lg == 2:
    cnt = 9
else:
    cnt = N
print(cnt)
Problem p02982 (python)

Fixed submission:
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
 
def dist(A, B):
    sums = 0
    for i in range(len(A)):
        sums += (abs(A[i] - B[i])) ** 2
    sums = sums ** 0.5
    return sums
 
for i in range(N-1):
    for j in range(i+1, N):
#            if isinstance(dist(X[i], X[j]), int):
        if dist(X[i], X[j]).is_integer():
            cnt += 1
print(cnt)

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

cnt = 0
for i in range(N):
    if i + 1 == P[i]:
        cnt += 1

if cnt >= N - 2:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
    N, D = map(int, input().split())
    X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0

def dist(A, B):
    sums = 0
    for i in range(len(A)):
        sums += (abs(A[i] - B[i])) ** 2
    sums = sums ** 0.5
    return sums

for i in range(N-1):
    for j in range(i+1, N):
#            if isinstance(dist(X[i], X[j]), int):
        if dist(X[i], X[j]).is_integer():
            cnt += 1
print(cnt)