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

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

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = list(map(int,input().split()))
ans = 0
for i in range n:
  if(l[i]>=k):
    ans += 1
print(ans)
Problem p03244 (python)

Fixed submission:
# coding: utf-8
import collections
n=int(input())
all_str=list(map(int,input().split()))
i=0
j=0
o_str=[]   # 0, ,2,
e_str=[]   #  ,1, ,3,
while(2*i<n):
  o_str.append(all_str[2*i])
  i+=1
while(2*j+1<n):
  e_str.append(all_str[2*j+1])
  j+=1

o_c=collections.Counter(o_str)
e_c=collections.Counter(e_str)
o_mode=o_c.most_common()[0][0]
e_mode=e_c.most_common()[0][0]
o_mode_n=o_str.count(o_mode)
e_mode_n=e_str.count(e_mode)
if(o_mode==e_mode):
  if(len(o_c)==1 and len(e_c)==1):
    if(o_mode_n>e_mode_n):
      e_mode_n=0
      
    else:
      
      o_mode_n=0
      
  else:
    if(len(o_c)==1):
      o_c_sec=0
      e_c_sec=e_c.most_common()[1][1]
    elif(len(e_c)==1):
      e_c_sec=0
      o_c_sec=o_c.most_common()[1][1]
    else:
      o_c_sec=o_c.most_common()[1][1]
      e_c_sec=e_c.most_common()[1][1]
    if(o_c_sec>e_c_sec):
      o_mode_n=o_c.most_common()[1][1]
    else:
      e_mode_n=e_c.most_common()[1][1]
alt=len(all_str)-o_mode_n-e_mode_n
print(alt)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import statistics
import collections
n=int(input())
all_str=list(map(int,input().split()))
i=0
o_str=[]   # 0, ,2,
e_str=[]   #  ,1, ,3,
while(2*i+1<n):
  o_str.append(all_str[2*i])
  e_str.append(all_str[2*i+1])
  i+=1
o_mode=statistics.mode(o_str)
e_mode=statistics.mode(e_str)
if(o_mode!=e_mode):
  alt=len(all_str)-o_str.count(o_mode)-e_str.count(e_mode)
else:
  alt=min(o_str.count(o_mode),e_str.count(e_mode))
print(alt)
Problem p02614 (python)

Fixed submission:
import numpy as np

H,W,K = list(map(int, input().split()))
t=[]
for i in range(H):
    t.append([int(i) for i in input().replace(".","0").replace("#","1")])

cnt = 0
for i in range(2**H):
    for j in range(2**W):
        d = np.array(t)
        i_2 = [int(k) for k in bin(i)[2:].rjust(H,"0")]
        j_2 = [ int(k) for k in bin(j)[2:].rjust(W,"0")]
        #print(i_2)
        #print(j_2)
        
        d= ((d.T)*i_2).T
        d= d*j_2
        
        num = d.sum()
        if num == K:
            cnt +=1
            
print(cnt)

Buggy submission (verdict: Runtime Error):
import pandas as pd

H,W,K = list(map(int, input().split()))
t=[]
for i in range(H):
    t.append([int(i) for i in input().replace(".","0").replace("#","1")])

cnt = 0
for i in range(2**H):
    for j in range(2**W):
        d = pd.DataFrame(t)
        i_2 = [int(k) for k in bin(i)[2:].rjust(H,"0")]
        j_2 = [ int(k) for k in bin(j)[2:].rjust(W,"0")]
        #print(i_2)
        #print(j_2)
        
        for h in range(H):
            d.iloc[h,:] = d.iloc[h,:] * i_2[h]
        for w in range(W):
            d.iloc[:,w] = d.iloc[:,w] * j_2[w]
        num = sum((d == 1).sum())
        #print(num)
        #print(d)
        if num == K:
            cnt +=1
            
print(cnt)

Buggy submission (verdict: Runtime Error):
import pandas as pd

H,W,K = list(map(int, input().split()))
t=[]
for i in range(H):
    t.append([int(i) for i in input().replace(".","0").replace("#","1")])

cnt = 0
for i in range(2**H):
    for j in range(2**W):
        d = pd.DataFrame(t)
        i_2 = [int(k) for k in bin(i)[2:].rjust(H,"0")]
        j_2 = [ int(k) for k in bin(j)[2:].rjust(W,"0")]
        #print(i_2)
        #print(j_2)
        
        for h in range(H):
            d.iloc[h,:] = d.iloc[h,:] * i_2[h]
        for w in range(W):
            d.iloc[:,w] = d.iloc[:,w] * j_2[w]
        num = sum((d == 1).sum())
        #print(num)
        #print(d)
        if num == K:
            cnt +=1
            
print(cnt)

Buggy submission (verdict: Runtime Error):
import pandas as pd

H,W,K = list(map(int, input().split()))
t=[]
for i in range(H):
    t.append([int(i) for i in input().replace(".","0").replace("#","1")])

cnt = 0
for i in range(2**H):
    for j in range(2**W):
        d = pd.DataFrame(t)
        i_2 = [int(k) for k in bin(i)[2:].rjust(H,"0")]
        j_2 = [ int(k) for k in bin(j)[2:].rjust(W,"0")]
        #print(i_2)
        #print(j_2)
        
        for h in range(H):
            d.iloc[h,:] = d.iloc[h,:] * i_2[h]
        for w in range(W):
            d.iloc[:,w] = d.iloc[:,w] * j_2[w]
        num = sum((d == 1).sum())
        #print(num)
        #print(d)
        if num == K:
            cnt +=1
Problem p02615 (python)

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

a.sort(reverse = True)
p = a[0]
for i in range(N-2): #-1は上記a[0]分、もう-1は最初の要素挿入は加点されないため。
    p += a[(i//2)+1]

print(p)

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

@njit
def fnc(N,a):
    a.sort(reverse = True)
    p=0
    ppl = [a[0]]*2
    best_index = 1
    best_point = a[0]
    for i in a[1:]:
        p += best_point
        ppl = ppl[:best_index]+[i]+ppl[best_index:]
        #print(ppl)
        point_list = [min(ppl[i],ppl[i+1]) for i in range(0,len(ppl)-1)]
        #print(point_list)
        best_point = max(point_list)
        for j,q  in enumerate(point_list):
            if q == best_point:
                best_index = j+1
                continue
    return p     

print(fnc(N,a))
Problem p02606 (python)

Fixed submission:
L, R, d = map(int, input().split(" "))

a = R // d
b = (L-1) // d
print(a-b)

Buggy submission (verdict: Runtime Error):
L, R, d = map(int, input().split(" "))

tmp = (R-L+1)/d
if tmp < 1 :
    if (d >= L) & (d <= R):
        count1 = 1
else:
    count1 = tmp

print(int(count1))
Problem p02600 (python)

Fixed submission:
X = int(input())
print(10 - X//200)

Buggy submission (verdict: Runtime Error):
X = int(input())
print 10 - X//200
Problem p02602 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
answers = ["Yes" if A[i] > A[i-K] else "No" for i in range(K, N)]
print("\n".join(answers))

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

answers = ["Yes" if A[i] > A[i-K] else "No" for i in range(K, N)]
print("\n".join(answers))
Problem p02605 (python)

Fixed submission:
N = int(input())

planes = {
  'U': [],
  'R': [],
  'D': [],
  'L': []
}

for _ in range(N):
  x, y, t = input().split()
  x, y = int(x), int(y)
  planes[t].append((x, y))
  
BIG = 10**18
  
def time(ps):
  ps.sort()
  ans = BIG
  for i in range(len(ps)-1):
    y1, x1, t1 = ps[i]
    y2, x2, t2 = ps[i+1]
    
    if y1 != y2:
      continue
    
    if t1 == 1 and t2 == -1:
      ans = min(ans, x2 - x1)
  return 5*ans


ud = [(x, y, 1) for x, y in planes['U']] + [(x, y, -1) for x, y in planes['D']]
lr = [(y, x, 1) for x, y in planes['R']] + [(y, x, -1) for x, y in planes['L']]

ur = [(x+y, y-x, 1) for x, y in planes['U']] + [(x+y, y-x, -1) for x, y in planes['R']]
ul = [(x-y, y+x, 1) for x, y in planes['U']] + [(x-y, y+x, -1) for x, y in planes['L']]
rd = [(x-y, y+x, 1) for x, y in planes['R']] + [(x-y, y+x, -1) for x, y in planes['D']]
ld = [(x+y, y-x, 1) for x, y in planes['L']] + [(x+y, y-x, -1) for x, y in planes['D']]

ans = min(time(ud), time(lr), time(ur), time(ul), time(rd), time(ld))
if ans >= BIG:
  print("SAFE")
else:
  print(ans)

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

planes = {
  'U': [],
  'R': [],
  'D': [],
  'L': []
}

for _ in range(N):
  x, y, t = input().split()
  x, y = int(x), int(y)
  planes[t].append((x, y))
  
BIG = 10**18
  
def time(ps):
  sort(ps)
  ans = BIG
  for i in range(len(ps)-1):
    y1, x1, t1 = ps[i]
    y2, x2, t2 = ps[i+1]
    
    if y1 != y2:
      continue
    
    if t1 == 1 and t2 = -1:
      ans = min(ans, x2 - x1)
  return 5*ans


ud = [(x, y, 1) for x, y in planes['U']] + [(x, y, -1) for x, y in planes['D']]
lr = [(y, x, 1) for x, y in planes['R']] + [(y, x, -1) for x, y in planes['L']]

ur = [(x+y, y-x, 1) for x, y in planes['U']] + [(x+y, y-x, -1) for x, y in planes['R']]
ul = [(x-y, y+x, 1) for x, y in planes['U']] + [(x-y, y+x, -1) for x, y in planes['L']]
rd = [(x-y, y+x, 1) for x, y in planes['R']] + [(x-y, y+x, -1) for x, y in planes['D']]
ld = [(x+y, y-x, 1) for x, y in planes['L']] + [(x+y, y-x, -1) for x, y in planes['D']]

ans = min(time(ud), time(lr), time(ur), time(ul), time(rd), time(ld))
if ans >= BIG:
  print("SAFE")
else:
  print(ans)
Problem p02632 (python)

Fixed submission:
K = int(raw_input())
S = raw_input().strip()
L = len(S)

P = 10**9 + 7

facts = [0 for _ in xrange(L + K)]
finvs = [0 for _ in xrange(L + K)]
facts[0] = 1
for i in xrange(1, L+K):
  facts[i] = (i*facts[i-1]) % P

finvs[L+K-1] = pow(facts[L+K-1], P-2, P)
for i in xrange(L+K-2, -1, -1):
  finvs[i] = (finvs[i+1]*(i+1)) % P

ans = 0
for k in xrange(0, K+1):
  ncr = (facts[k+L-1]*finvs[k]*finvs[L-1]) % P
  ans += ncr * pow(25, k, P) * pow(26, K-k, P)
  ans %= P

print ans

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

S = raw_input().strip()
L = len(S)

P = 10**9 + 7

facts = [0 for _ in xrange(L + N)]
finvs = [0 for _ in xrange(L + N)]
facts[0] = 1
for i in xrange(1, L+N):
  facts[i] = (i*facts[i-1]) % P

finvs[L+N-1] = pow(facts[L+N-1], P-2, P)
for i in xrange(L+N-2, -1, -1):
  finvs[i] = (finvs[i+1]*(i+1)) % P

ans = 0
for k in xrange(0, K+1):
  ncr = (facts[k+L-1]*finvs[k]*finvs[L-1]) % P
  ans += ncr * pow(25, k, P) * pow(26, K-k, P)
  ans %= P

print ans
Problem p02886 (python)

Fixed submission:
n = int(raw_input())
ds = map(int, raw_input().split())
t = 0
for i in range(n):
  for j in range(i+1, n):
    t += ds[i] * ds[j]
print(t)

Buggy submission (verdict: Runtime Error):
n = int(input())
ds = map(int, input().split())
t = 0
for i in range(n):
  for j in range(i, n):
    t += d[i] * d[j]
print(t)
Problem p02917 (python)

Fixed submission:
n =  int(raw_input())
B = map(int, raw_input().split())
B = [1000000] + B + [1000000]
print sum(min(B[i-1], B[i]) for i in range(1, n+1))

Buggy submission (verdict: Runtime Error):
n =  int(raw_input())
B = map(int, raw_input().split())
print sum(B) - sum([abs(B[i] - B[i-1]) for i in xrange(1, n)])
Problem p02921 (python)

Fixed submission:
forecast = raw_input().strip()
real = raw_input().strip()
assert len(forecast) == len(real)
print sum([1 for i in xrange(len(forecast)) if forecast[i] == real[i]])

Buggy submission (verdict: Runtime Error):
forecast = raw_input().strip()
real = raw_input().strip()
assert len(forecast) == len(real)
print sum([1 for i in xrange(len(forecast)) if forecast[i] == real[i] else 0])

Buggy submission (verdict: Runtime Error):
forecast = raw_input().strip()
real = raw_input().strip()
assert len(forecast) == len(real)
print sum([1 for i in xrange(len(forecast)) if forecast[i] == real[i] else 0])
Problem p03006 (python)

Fixed submission:
from collections import Counter

N = int(raw_input())

points = [map(int, raw_input().split()) for _ in xrange(N)]

if N == 1:
    print 1
else:
    dist = lambda p1, p2: (p1[0]-p2[0], p1[1]-p2[1])

    vecs = []
    for i in xrange(N):
        for j in xrange(N):
            if j == i:
                continue
            vecs.append(dist(points[i], points[j]))

    vecs_cnt = Counter(vecs)
    # print Counter(vecs)
    ans = max(vecs_cnt.values())

    print N-ans

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

N = int(raw_input())

points = [map(int, raw_input().split()) for _ in xrange(N)]

# print N, points

dist = lambda p1, p2: (p1[0]-p2[0], p1[1]-p2[1])

vecs = []
for i in xrange(N):
    for j in xrange(i+1, N):
        vecs.append(dist(points[i], points[j]))

vecs_cnt = Counter(vecs)
# print Counter(vecs)
ans = max(vecs_cnt.values())

print N-ans
Problem p02582 (python)

Fixed submission:
S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else:
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame)

Buggy submission (verdict: Runtime Error):
S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame)
Problem p02639 (python)

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

for i in range(5):
    if x[i]==0:
        print(i+1)

Buggy submission (verdict: Runtime Error):
x = [int(input()) for i in range(5)]

for i in range(5):
    if x[i]==0:
        print(i)
Problem p02657 (python)

Fixed submission:
A,B = (int(x) for x in input().split())

print(A*B)

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

print(A*B)
Problem p02741 (python)

Fixed submission:
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(arr[k-1])

Buggy submission (verdict: Runtime Error):
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = input()
print(arr[k])
Problem p02657 (python)

Fixed submission:
a,b = [int(e) for e in input().split()]
print(a*b)

Buggy submission (verdict: Runtime Error):
a,b = [int(e) for e in input().split()]
print(a*b)2 5
Problem p02658 (python)

Fixed submission:
n = int(input())
a = [int(e) for e in input().split()]
ans = 1
if 0 in a:
    print(0)
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            print(-1)
            break  
    else:
        print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(e) for e in input().split()]
ans = 1
if 0 in a:
    print(0)
else:
for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        break  
else:
    print(ans)
Problem p02830 (python)

Fixed submission:
n = int(input())
s,t = [i for i in input().split()]
a=''
for i in range(0,2*n):
    if i % 2 == 0:
        a += s[i//2]
    else:
        a += t[i//2]
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
t = input()
a=''
for i in range(0,2*n):
    if i % 2 == 0:
        a += s[i//2]
    else:
        a += t[i//2]
print(a)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
t = input()
a=''
for i in range(0,2*n):
    if i % 2 == 0:
        a += s[i//2]
    else:
        a += t[i//2]
print(a)
Problem p02899 (python)

Fixed submission:
n = int(input())
a = [int(e) for e in input().split()]
b = [0] * n
for i in range(0,n):
    b[a[i] - 1] = i + 1
for j in range(0,n):
    print(b[j], end = " ")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(e) for e in input().split()]
b = [0] * n
for i in range(0,n):
    b[a[i]] = i + 1
for j in range(0,n):
    print(b[j], end = " ")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(e) for e in input().split()]
b = []
for i in range(0,n):
    b[a[i]] = i + 1
for j in range(0,n):
    print(b[j], end = " ")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(e) for e in input().split()]
for i in range(0,n):
    for j in range(0,n):
        if l[j] == i:
            print(j, end = " ")
            break
Problem p02612 (python)

Fixed submission:
import math

price = int(input())
payment = math.ceil(float(price) / 1000) * 1000
result = payment - price
print(int(result))

Buggy submission (verdict: Runtime Error):
import math

price = input()
payment = math.ceil(float(price) / 1000) * 1000
result = payment - price
print(int(result))
Problem p02582 (python)

Fixed submission:
S = input()
 
if S.count("R") == 2 and S[1] != "R":
  print(1)
  
else:
  print(S.count("R"))

Buggy submission (verdict: Runtime Error):
S = input()

if S.count("R") == 2 and S[1] != R:
  print(1)
  
else:
  print(S.count("R"))

Buggy submission (verdict: Runtime Error):
S = input()

if ("RRR" in S) == true:
  print(3)
elif("RR" in S) == true:
  print(2)
elif("R" in S) == true:
  print(1)
else:
  print(0)
Problem p02613 (python)

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

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

 
ansAC = 0
ansWA = 0
ansTLE = 0
ansRE = 0
 
for i in range(N):
  S = input()
  if S == "AC":
    ansAC += 1
  elif S == "TLE":
    ansTLE += 1
  elif S == "WA":
    ansWA += 1
  elif S == "RE":
    ansRE += 1
print("AC x " + ansAC)
print("WA x " + ansWA)
print("TLE x " + ansTLE)
print("RE x " + ansRE)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
 
ansAC = 0
ansWA = 0
ansTLE = 0
ansRE = 0
 
for i in range(N):
  if i == "AC":
    ansAC += 1
  elif i == "TLE":
    ansTLE += 1
  elif i == "WA":
    ansWA += 1
  elif i == "RE":
    ansRE += 1
print("AC x " + ansAC)
print("WA x " + ansWA)
print("TLE x " + ansTLE)
print("RE x " + ansRE)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
 
ansAC = 0
ansWA = 0
ansTLE = 0
ansRE = 0
 
for i in S:
  if i == "AC":
    ansAC += 1
  elif i == "TLE":
    ansTLE += 1
  elif i == "WA":
    ansWA += 1
  elif i == "RE":
    ansRE += 1
print("AC x " + ansAC)
print("WA x " + ansWA)
print("TLE x " + ansTLE)
print("RE x " + ansRE)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
 
ansAC = 0
ansWA = 0
ansTLE = 0
ansRE = 0
 
for i in S:
  if i == "AC":
    ansAC += 1
  elif i == "TLE":
    ansTLE += 1
  elif i == "WA":
    ansWA += 1
  elif i == "RE":
    ansRE += 1
print("AC x " + ansAC)
print("WA x " + ansWA)
print("TLE x " + ansTLE)
print("RE x " + ansRE)

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

ansAC = 0
ansWA = 0
ansTLE = 0
ansRE = 0

for i in S:
  if i == "AC":
    ansAC += 1
  elif i == "TLE":
    ansTLE += 1
  elif i == "WA":
    ansWA += 1
  elif i == "RE":
    ansRE += 1
print("AC x " + ansAC)
print("WA x " + ansWA)
print("TLE x " + ansTLE)
print("RE x " + ansRE)
Problem p02705 (python)

Fixed submission:
R = int(input())
print(2*R*3.14)

Buggy submission (verdict: Runtime Error):
R = map(int,input())
print(2*R*3.14)
Problem p02717 (python)

Fixed submission:
line = input().rstrip().split(" ")
N = [str(n) for n in line]
X = N[0]
Y = N[1]
Z = N[2]
tmp = 0

tmp = X
X = Y
Y = tmp

tmp = X
X = Z
Z = tmp

print(X,Y,Z)

Buggy submission (verdict: Runtime Error):
line = input().rstrip().split(" ")
N = [str(n) for n in line]
X = N[0]
Y = N[1]
Z = N[2]
tmp = 0

tmp = X
X = Y
Y = tmp

tmp = X
X = Z
Z = tmp

print(*X,*Y,*Z)
Problem p02718 (python)

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

votes = sum(vote)
ans = [i for i in vote if i * 4 * M >= votes]

if len(ans) >= M:
    print('Yes')
    
else:
    print('No')

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

votes = sum(vote)
ans = [i for i in L if i * 4 * M >= votes]

if len(ans) >= M:
    print('Yes')
    
else:
    print('No')
Problem p03827 (python)

Fixed submission:
N = int(input())
S = input()
x = 0
ans = 0
 
for i in S:
  if i == "I":
    x += 1
  elif i == "D":
    x -= 1
  ans = max(ans,x)
  
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input().split()
x = 0

for N in S:
  if S[N] == "I":
    x += 1
  elif S[N] == "D":
    x -= 1
print(x)
Problem p03200 (python)

Fixed submission:
S = input()
length = len(S)
countB = 0
for c in S:
    if c == 'B':
        countB += 1
soko = 1
ans = 0
for i in range(length):
    if S[-i-1] == 'B':
        ans += i + 1  - soko
        soko += 1
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
length = len(S)
for c in S:
    if c == 'B':
        countB += 1
soko = 1
ans = 0
for i in range(length):
    if S[-i-1] == 'B':
        ans += i + 1  - soko
        soko += 1
print(ans)
Problem p03206 (python)

Fixed submission:
D = int(input())
sa = 25 - D
ans = "Christmas"
for _ in range(sa):
    ans += " Eve"
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
trees = [int(input()) for i in range(N)]
trees.sort()
ans = 10 ** 10
for i in range(N - K + 1):
    ans = min(ans, abs(trees[i]-trees[i+K-1]))
print(ans)
Problem p03264 (python)

Fixed submission:
import math
instr = input()
K = int(instr)

COdd = math.ceil(K / 2)
CEven = int(K / 2)

ans = COdd * CEven
print(ans)

Buggy submission (verdict: Runtime Error):
import math
instr = intput()
K = int(instr)

COdd = math.ceil(K / 2)
CEven = int(K / 2)

ans = COdd * CEven
print(ans)
Problem p02582 (python)

Fixed submission:
print(len(max(input().split('S'))))

Buggy submission (verdict: Runtime Error):
print(len(max(input().split('S')))
Problem p02602 (python)

Fixed submission:
n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
for i in range(k, n):
    print("Yes" if a[i] > a[i - k] else "No")

Buggy submission (verdict: Runtime Error):
n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
for i in range(k, n):
    print("Yes" if a[k + i] > a[i] else "No")
Problem p02606 (python)

Fixed submission:
l, r, d = [int(x) for x in input().split()]
print(r // d - (l - 1) // d)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [0] * 10**5
for x in range(1, 101):
	for y in range(1, 101):
		for z in range(1, 101):
			a[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1
for i in range(1, n + 1):
	print(a[i])
Problem p02607 (python)

Fixed submission:
input()
print(sum([int(x) % 2 for x in input().split()[::2]]))

Buggy submission (verdict: Runtime Error):
print(sum([x % 2 for x in input().split()[::2]))
Problem p02608 (python)

Fixed submission:
n = int(input())
a = [0] * 10**5
for x in range(1, 101):
	for y in range(1, 101):
		for z in range(1, 101):
			a[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1
for i in range(1, n + 1):
	print(a[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [0] * 10**5
for x in range(1, 101):
	for y in range(1, 101):
    	for z in range(1, 101):
      		a[x**2 + y**2 + z**2 + x*y + y*z + z*x] += 1
for i in range(1, n + 1):
	print(a[i])
Problem p02687 (python)

Fixed submission:
print(f"A{['B', 'R'][input() == 'ABC']}C")

Buggy submission (verdict: Runtime Error):
print(f"A{["B", "R"][input()[1] == "B"]}C")
Problem p02713 (python)

Fixed submission:
from math import*
r = range(1, int(input()) + 1)
print(sum(gcd(gcd(a, b), c) for a in r for b in r for c in r))

Buggy submission (verdict: Runtime Error):
program hi;
var 
    a, b, c, k, i, ans: longint;
    r: array[1..200] of longint;

procedure aswap(var x: longint; var y: longint);
var tmp: longint;
begin
    if x > y then begin
        tmp := x;
        x := y;
        y := tmp;
    end;
end;

function gcd(x: longint; y: longint): longint;
var i: longint;
begin
    aswap(x, y);
    for i := 1 to y do 
        if (x mod i = 0) and (y mod i = 0) then
            gcd := i;
end;

begin
    readln(k);
    for i := 1 to k do 
        r[i] := i;
    ans := 0;
    for c := 1 to k do 
        for b := 1 to k do 
            for a := 1 to k do 
                ans := ans + gcd(gcd(r[a], r[b]), r[c]);
    writeln(ans);
end.
Problem p02772 (python)

Fixed submission:
n, *a = map(int, open(0).read().split())
print("DENIED" if sum((i % 3) * (i % 5) for i in a if i % 2 == 0) else "APPROVED")

Buggy submission (verdict: Runtime Error):
n, *a = map(int, open(0).read().split())
print(["APPROVED", "DENIED"][sum((i % 3) * (i % 5) for i in a if i % 2 == 0)])
Problem p03150 (python)

Fixed submission:
s = list(input())
ans = 'NO'
for i in range(len(s)):
    if ''.join(s[:i] + s[len(s)-7+i:]) == 'keyence':
        ans = 'YES'
        break
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
ans = 'NO'
for i in range(len(s)):
    if ''.join(s[:i] + s[n-7+i:]) == 'keyence':
        ans = 'YES'
        break
print(ans)