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

Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int, input().split()))

a = Counter(v[::2])
b = Counter(v[1::2])
a = a.most_common()
b = b.most_common()

if n % 2 == 0:
    al = n // 2
    bl = al
else:
    al = n // 2 + 1
    bl = n // 2

if len(a) == 1 and len(b) == 1:
    if a[0][0] == b[0][0]:
        print(min(a[0][1], b[0][1]))
    else:
        print(0)
elif len(a) == 1 or len(b) == 1:
    if len(a) == 1:
        if a[0][0] == b[0][0]:
            print(bl - b[1][1])
        else:
            print(bl - b[0][1])
    if len(b) == 1:
        if a[0][0] == b[0][0]:
            print(al - a[1][1])
        else:
            print(al - a[0][1])
else:
     if a[0][0] == b[0][0]:
         print(min(n - a[0][1] - b[1][1], n - a[1][1] - b[0][1])) 
     else:
         print(n - a[0][1] - b[0][1])

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

n = int(input())
v = list(map(int, input().split()))

a = Counter(v[::2])
b = Counter(v[1::2])
a = a.most_common()
b = b.most_common()

if n % 2 == 0:
    al = n // 2
    bl = al
else:
    al = n // 2 + 1
    bl = n // 2

if len(a) == 1 and len(b) == 1:
    if a[0][0] == b[0][0]:
        print(min(a[0][1], b[0][1]))
    else:
        print(0)
elif len(a) == 1 or len(bl) == 1:
    if len(a) == 1:
        if a[0][0] == b[0][0]:
            print(bl - b[1][1])
        else:
            print(bl - b[0][1])
    if len(b) == 1:
        if a[0][0] == b[0][0]:
            print(al - a[1][1])
        else:
            print(al - a[0][1])
else:
     if a[0][0] == b[0][0]:
         print(min(n - a[0][1] - b[1][1], n - a[1][1] - b[0][1])) 
     else:
         print(n - a[0][1] - b[0][1])
Problem p03380 (python)

Fixed submission:
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))

a.sort()
m = a[-1] // 2 + a[-1] % 2

i = bisect_left(a, m)

if i == 0:
    ans = str(a[-1]) + " " + str(a[0])
elif i == len(a)-1:
    ans = str(a[-1]) + " " + str(a[-2])
else:
    k = [a[i] - m, m - a[-1] % 2 - a[i-1]]
    s = min(k)
    s = k.index(s)
    ans = str(a[-1]) + " " + str(a[i-s])     

print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))

a.sort()
m = a[-1] // 2 + a[-1] % 2

i = bisect_left(a, m)

if i == 0:
    ans = str(a[-1]) + " " + str(a[0])
elif i == len(a)-1:
    ans = str(a[-1]) + " " + str(a[-2])
else:
    k = [a[i] - m, m - a[-1] % 2 - a[i-1]]
    s = min(m - a[-1] % 2 - a[i-1], a[i] - m)
    k.index(s)
    ans = str(a[-1]) + " " + str(a[i-s])     

print(ans)
Problem p03640 (python)

Fixed submission:
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(N):
  ans.extend([i+1 for _ in range(a[i])])
ans = [ans[i:i+W] for i in range(0, H*W, W)]
for i in range(1, H, 2):
  ans[i] = ans[i][::-1]
for r in ans:
  print(' '.join(map(str,r)))

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

m = np.argsort(a)[::-1]
n = [str(i+1) for i in m]
c = [a[i] for i in m]

ans = ["" for _ in range(H)]
j = 0
for i in range(H):
    count = 0
    while count != W:
        if count + c[i] <= W:
            ans[i] += n[j] * c[j]
            count += c[j]
            j += 1
        else:
            count = W - count
            ans[i] += n[j] * count
            c[j] -= count 
            count = W

for i in range(H):
    if i % 2 == 0:
        print(" ".join(ans[i][::-1]))
    else:
        print(" ".join(ans[i]))

Buggy submission (verdict: Runtime Error):
import numpy as np
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

m = np.argsort(a)[::-1]
n = [str(i+1) for i in m]
c = [a[i] for i in m]

ans = ["" for _ in range(H)]
j = 0
for i in range(H):
    count = 0
    while count != W:
        if count + c[i] <= W:
            ans[i] += n[j] * c[j]
            count += c[j]
            j += 1
        else:
            count = W - count
            ans[i] += n[j] * count
            count = W

for i in range(H):
    if i % 2 == 0:
        print(" ".join(ans[i][::-1]))
    else:
        print(" ".join(ans[i]))
Problem p03963 (python)

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

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

ans = K * ((K-1) ** (N-1))
Problem p03781 (python)

Fixed submission:
import math
import sys
import resource
n = int(input());
dp = []
def dfs(x, i) :
  dp[i] = dp[i-1] + i
  # print(i, dp[i])
  if dp[i] >= n : 
    return i
  return dfs(dp[i], i+1)

sys.setrecursionlimit(100000)

sz = 100000
dp = [0] * sz
print(dfs(0, 1))

Buggy submission (verdict: Runtime Error):
import math
n = int(input());
dp = []
def dfs(x, i) :
  dp[i] = dp[i-1] + i
  if dp[i] >= n : 
    return i
  return dfs(dp[i], i+1)

sz = int(math.sqrt(n)) + 10
dp = [0] * sz
ans = dfs(0, 1)
print(ans)
Problem p02602 (python)

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

for i in range(N-K):
    if score[i]<score[i+K]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
N,K = map(int,input().split())
score = list(map(int,input().split()))


for i in range(N-K):
    multi = np.prod(score[i:K+i])
    check = np.prod(score[i+1:K+i+1])
    if multi>=check:
        print("No")
    else:
        print("Yes")
Problem p02613 (python)

Fixed submission:
N=int(input())
a=0
b=0
c=0
d=0
for i in range(N):
    A=input()
    if A=="AC":
        a+=1
    elif A=="WA":
        b+=1
    elif A=="TLE":
        c+=1
    else:
        d+=1
print("AC x",a)
print("WA x",b)
print("TLE x",c)
print("RE x",d)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=0
b=0
c=0
d=0
for i in range(N):
    if input()=="AC":
        a+=1
    elif input()=="WA":
        b+=1
    elif input()=="TLE":
        c+=1
    else:
        d+=1
print("AC ×",a)
print("WA ×",b)
print("TLE ×",c)
print("RE ×",d)
Problem p02630 (python)

Fixed submission:
from collections import Counter
N=int(input())
number=list(map(int,input().split()))
sum_number=sum(number)
Q=int(input())
number_count=Counter(number)


for _ in range(Q):
    B,C=map(int,input().split())
    sum_number += (C-B)*number_count[B]
    number_count[C] += number_count[B]
    number_count[B] = 0
    print(sum_number)

Buggy submission (verdict: Runtime Error):
N=int(input())
number=list(map(int,input().split()))
sum_number=sum(number)
Q=int(input())
number_count=[0]*100000
for i in range(100000):
    number_count[i]=number.count(i)

for _ in range(Q):
    B,C=map(int,input().split())
    sum_number += (C-B)*number_count[B]
    number_count[C] += number_count[B]
    number_count[B] -= number_count[B]
    print(sum_number)

Buggy submission (verdict: Runtime Error):
N=int(input())
number=list(map(int,input().split()))
sum_number=sum(number)
Q=int(input())
number_count=[0]*100000
for i in range(100000):
    number_count[i]=number.count(i)

for j in range(Q):
    B,C=map(int,input().split())
    sum_number += (C-B)*number_count[B]
    number_count[C] += number_count[B]
    number_count[B] -= number_count[B]
    print(sum_number)

Buggy submission (verdict: Runtime Error):
N=int(input())
number=list(map(int,input().split()))
sum_number=sum(number)
Q=int(input())
number_count=[0]*100000
for i in range(100000):
    number_count[i]=number.count(i)

for j in range(Q):
    B,C=map(int,input().split())
    sum_number += (C-B)*number_count[B]
    number_count[C] += number_count[B]
    number_count[B] -= number_count[B]
    print(sum_number)
Problem p02646 (python)

Fixed submission:
# coding: utf-8
# Your code here!
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())

dis=abs(A-B)
dis1=(V-W)*T

if dis<=dis1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import math
A,V = int(input().split())
B,W = int(input().split())
T = int(input())

dis=abs(A-B)
dis1=(V-W)*T
if dis<=dis1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
A,V = int(input().split())
B,W = int(input().split())
T = int(input())

dis=abs(A-B)
dis1=(V-W)*T
if dis<=dis1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
A,V = int(input().split())
B,W = int(input().split())
T = int(input())

dis=abs(A-B)
dis1=(V-W)*T
if dis<=dis1:
    print("YES")
else:print("NO")
Problem p02658 (python)

Fixed submission:
N=int(input())
number=list(map(int,input().split()))
ans=1
if 0 in number:
    print(0)
    exit(0)
    
for i in range(N):
    ans *= number[i]
    if ans>1000000000000000000:
        print(-1)
        exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
sum = list(map(int,input().split()))
x = 1

for i in range(n):
    x *= sum[i]

if math.log(x,10)>18:
    print(-1)
    
else:
    print(x)

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

for i in range(n):
    x *= list[i]

if x>1000000000000000000:
    print(-1)
    
else:
    print(x)
Problem p02675 (python)

Fixed submission:
N = str(input())

if(N[-1]=="3"):
    print("bon")
    
if(N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8"):
    print("pon")
    
if(N[-1]=="2" or N[-1]=="4" or N[-1]=="5" or N[-1]=="7" or N[-1]=="9"):
    print("hon")

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())
MM = 6*M #分針の角度
HH = H*30 + M//2
rad = MM-HH
if(rad>=-90 and rad<=90):
    cosine = math.cos(math.radians(rad))
else:
    cosine = 0-math.cos(math.radians(rad))
    
r = math.sqrt(A**2+B**2-2*A*B*cosine)
print(r)

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())
MM = 6*M #分針の角度
HH = H*30 + M//2
rad = MM-HH
if(rad>=-90 and rad<=90):
    cosine = math.cos(math.radians(rad))
else:
    cosine = 0-math.cos(math.radians(rad))
    
r = math.sqrt(A**2+B**2-2*A*B*cosine)
print(r)

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int,input().split())
MM = 6*M #分針の角度
HH = H*30 + M//2
rad = MM-HH
cosine = math.cos(math.radians(rad))

r = math.sqrt(A**2+B**2-2*A*B*cosine)
print(r)
Problem p02730 (python)

Fixed submission:
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
S=list(input())
SS=S[0:(len(S)-1)//2]
SSS=S[(len(S)+3)//2:-1]
Sreverse=S[::-1]
if S==S[::-1] and SS==SS[::-1] and SSS==SSS[::-1]:
        print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
S=list(input())
SS=S[0:(len(S)-1)//2]
SSS=S[(len(S)+3)//2:-1]
Sreverse=S[::-1]
if S==S[::-1] and SS==SS[::-1] and SSS==SSS[::-1]:
        print("Yes")
else:
    print("No")
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
S = list(map(int, input().split()))
l = len(S)

ans = 1
num = 0

for i in range(l):
	num += S[i]
	if num <= X:
		ans += 1

print(ans)

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

for i in range(N+1):
    if D<=X:
        ans+=1
        D = D + length[i]
print(ans)

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

for i in range(N+1):
    if D<=X:
        ans+=1
    else:
        break
    D=D+length[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
length=list(map(int,input().split()))
ans=0
D=0
i=0
while True:
    if D<=X:
        ans+=1
    else:
        break
    D=D+length[i]
    i+=1
print(ans)
Problem p02641 (python)

Fixed submission:
"""#D - Not Divisible
N= map(int,input().split())
A= list(map(int,input().split()))"""


#C - Forbidden List
X,N= map(int,input().split())
p= list(map(int,input().split()))
A= list(range(-200,200))
#print(A)
for i in range(N):
    A.remove(p[i])

D = 201
ans = -100
for j in range(len(A)):
    if D > abs(X - A[j]):
        D = abs(X - A[j])
        ans = A[j]

    else:
        pass
print(ans)

Buggy submission (verdict: Runtime Error):
#C - Forbidden List
X,N= map(int,input().split())
p= list(map(int,input().split()))
A= list(range(1,X+1))
for i in range(N):
    A.remove(p[i])

D = 101
ans = 0
for j in range(len(A)):
    if D >= abs(X - A[j]):
        D = abs(X - A[j])
        ans = A[j]
    else:
        pass
print(ans)
Problem p02843 (python)

Fixed submission:
# C - 100 to 105
X = int(input())

for a in range(2501):
    for b in range(2501-100*a):
        for c in range(2501-100*a-101*b):
            for d in range(2501-100*a-101*b-102*c):
                for e in range(2501-100*a-101*b-102*c-103*d):
                    for f in range(2501-100*a-101*b-102*c*103*d-104*e):
                        if 100*a+101*b+102*c+103*d+104*e+105*f == X:
                            print(1)
                            exit()
                        else:
                            pass
print(0)

Buggy submission (verdict: Runtime Error):
for a in range(500):
    for b in range(500-100*a):
        for c in range(500-100*a-101*b):
            for d in range(500-100*a-101*b-102*c):
                for e in range(500-100*a-101*b-102*c-103*d):
                    for f in range(500--100*a-101*b-102*c*103*d-104*e):
                        if 100*a+101*b+102*c+103*d+104*e+105*f == X:
                            print(1)
                            exit()
                        else:
                            pass
print(0)
Problem p02922 (python)

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


A_new = A
if B == 1:
    count = 0    
else:
    count = 1
    while A_new <= B:
        if A_new == B:
            break
        else:
            A_new = A_new-1
            A_new += A
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):

A_new = A
count = 1
while A_new <= B:
    if A_new == B:
        break
    else:
        A_new += A-1
        count += 1
print(count)
Problem p02923 (python)

Fixed submission:
# C - Lower
N = int(input())
H = list(map(int, input().split()))
max = 0
count_i = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        count_i += 1
    else:
        if max > count_i:
            count_i = 0
        else:
            max = count_i
            count_i = 0

    if max > count_i:
        pass
    else:
        max = count_i
print(max)

Buggy submission (verdict: Runtime Error):
# # C - Lower
N = int(input())
H = list(map(int, input().split()))
count = []

for i in range(N):
    count_i = 0
    for j in range(i,N-1):
        if H[j] - H[j+1] >= 0:
            count_i += 1
            if j+1 == N-1:
                count.append(count_i)
            else:
                pass
        else:
            count.append(count_i)
            break

print(max(count))
Problem p02924 (python)

Fixed submission:
# D - ModSum
N = int(input())

ans = (N*(N-1))//2
print(int(ans))

Buggy submission (verdict: Runtime Error):
# D - ModSum
import numpy as np
N = int(input())

if N > 1:
    N_1 = np.array(list(range(1, N+1)))
    P_1 = np.array(list(range(2, N+1)))
    P_1 = np.append(P_1, 1)
    ans = sum(N_1 % P_1)
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
# D - ModSum
import numpy as np
N = int(input())

if N > 1:
    N_1 = np.array(list(range(1, N+1)))
    P_1 = np.array(list(range(2, N+1)))
    P_1 = np.append(P_1, 1)

    ans = sum(N_1 % P_1)
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
# D - ModSum
import numpy as np
N = int(input())

N_1 = np.array(list(range(1, N+1)))
P_1 = np.array(list(range(2,N+1)))
P_1 = np.append(P_1, 1)

ans = sum(N_1 % P_1)
print(ans)
Problem p02953 (python)

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

for i in range(1, N):
    H[i] = H[i] - 1
    if H[i] < H[i-1]:
        H[i] = H[i] + 1
    else:
        pass


count = 0
for k in range(N-1):
    if H[k] <= H[k + 1]:
        count = count + 1
    else:
        count = -1
        break

if 0 <= count <= N:
    print("Yes")
else:
    print("No")

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

for i in range(N-1):
	if H[i] < H[i+1]:
        pass
    else:
        H[i] = H[i]-1


count = 0
for k in range(N-1):
    if H[k] <= H[k + 1]:
        count = count + 1
    else:
        count = -1
        break

if 0 <= count <= N:
    print("Yes")
else:
    print("No")
Problem p03000 (python)

Fixed submission:
# B - Bounding
N, X = map(int,input().split())
L = list(map(int, input().split()))
D = 0
count = 1

for i in range(N):
    D += L[i]
    if D <= X:
        count += 1
    else:
        break

print(count)

Buggy submission (verdict: Runtime Error):
# B - Bounding
N, X = map(int,input().split())
L = list(map(int, input().split()))
D = 0
count = 0

for i in range(N+1):
    if D <= X:
        D += L[i]
        count += 1
    else:
        break
print(count)
Problem p03087 (python)

Fixed submission:
# C - GeT AC
N, Q = map(int, input().split())
S = str(input())
A = [list(map(int, input().split())) for i in range(Q)]
S1 = [0]*N
count = 0
for j in range(1,len(S)):
    if S[j] == 'C' and S[j - 1] == 'A':
        count += 1
    else:
        pass
    S1[j] = count
#print(S1)

for k in range(Q):
    print(S1[A[k][1]-1]-S1[A[k][0]-1])

Buggy submission (verdict: Runtime Error):
# C - GeT AC
N, Q = map(int, input().split())
S = str(input())
A = [list(map(int, input().split())) for i in range(Q)]
S1 = [0]*N
count = 0
for j in range(len(S)):
    if S[j] == 'A' and S[j + 1] == 'C':
        count = +1
        S1[j] = count
    else:
        pass
for k in range(Q):
    print(sum(S1[A[k][0]-1:A[k][1]-1]))

Buggy submission (verdict: Runtime Error):
# C - GeT AC
N, Q = map(int, input().split())
S = str(input())
A = [list(map(int, input().split())) for i in range(Q)]
S1 = [0]*N
count = 0
for j in range(len(S)):
    if S[j] == 'A' and S[j + 1] == 'C':
        count = +1
        S1[j] = count
    else:
        pass
for i in range(Q):
    print(sum(S1[A[i][0]-1:A[i][1]-1]))

Buggy submission (verdict: Runtime Error):
# C - GeT AC
N, Q = map(int, input().split())
S = str(input())
A = [list(map(int, input().split())) for i in range(Q)]
S1 = []

for j in range(len(S)):
    if S[j] == 'A' and S[j + 1] == 'C':
        S1.append(j+1)
    else:
        pass
print(S1)
for i in range(Q):
    count = 0
    ans = [k for k in S1 if A[i][0] <= k < A[i][1]]
    print(len(ans))

Buggy submission (verdict: Runtime Error):
# C - GeT AC
N, Q = map(int, input().split())
S = str(input())
A = [list(map(int, input().split())) for i in range(Q)]
S1 = []

for j in range(len(S)):
    if S[j] == 'A' and S[j + 1] == 'C':
        S1.append(j+1)
    else:
        pass

for i in range(Q):
    count = 0
    for k in range(len(S1)):
        if A[i][0] <= S1[k] < A[i][1]:
            count += 1
        else:
            pass
    print(count)
Problem p03328 (python)

Fixed submission:
# B - Stone Monument
a,b =map(int,input().split())

tmp= (b-a)*( b-a-1)/2

print(  int(tmp-a))

Buggy submission (verdict: Runtime Error):
# B - Stone Monument
N, M = map(int,input().split())

tmp= (M-N)*( M-N+1)/2

ans( tmp-N)
Problem p03633 (python)

Fixed submission:
# C - Multiple Clocks
# import math mathはatcoderでは使えない
from fractions import gcd
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
if N == 1:
    print(T[0])
else:
    DP = [0]*(N-1)
    DP[0] = (T[0]*T[1])//gcd(T[0],T[1])
    for i in range(1,N-1):
        DP[i] = (DP[i-1]*T[i+1]) // gcd(DP[i-1],T[i+1])
    print(DP[-1])

Buggy submission (verdict: Runtime Error):
# C - Multiple Clocks
# import math mathはatcoderでは使えない
from fractions import gcd
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
DP = [0]*(N-1)
DP[0] = (T[0]*T[1])//gcd(T[0],T[1])
for i in range(1,N-1):
    DP[i] = (DP[i-1]*T[i+1]) // gcd(DP[i-1],T[i+1])

print(DP[-1])

Buggy submission (verdict: Runtime Error):
# C - Multiple Clocks
import math
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
DP = [0]*(N-1)
DP[0] = (T[0]*T[1])//math.gcd(T[0],T[1])
for i in range(1,N-1):
    DP[i] = (DP[i-1]*T[i+1]) // math.gcd(DP[i-1],T[i+1])

print(DP[-1])
Problem p03659 (python)

Fixed submission:
# C - Splitting Pile
N = int(input())
a = list(map(int, input().split()))
sum_s = a[0]
tmp = sum(a)
sum_a = tmp - sum_s
ans = abs(sum_s - sum_a)

for i in range(1,N):
    sum_a = tmp - sum_s
    if ans > abs(sum_s - sum_a):
        ans = abs(sum_s - sum_a)
        sum_s += a[i]
    else:
        sum_s += a[i]
print(ans)

Buggy submission (verdict: Runtime Error):
 C - Splitting Pile
N = int(input())
a = list(map(int, input().split()))
sum_s = a[0]
tmp = sum(a)//2
for i in range(1,N):
    if sum_s < tmp:
        sum_s += a[i]
    else:
        break
sum_a = sum(a) - sum_s
ans = abs(sum_s - sum_a)
print(ans)
Problem p03673 (python)

Fixed submission:
# C - pushpush
from collections import deque
n = int(input())
a = list(map(int, input().split()))
b = deque()
for i in range(n):
    if n % 2 == 0:
        if i % 2 ==0:
            b.append(a[i])
        else:
            b.appendleft(a[i])
    else:
        if i % 2 !=0:
            b.append(a[i])
        else:
            b.appendleft(a[i])

print(*b, end=" ")

Buggy submission (verdict: Runtime Error):
# C - pushpush
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    if n % 2 == 0:
        if i % 2 ==0:
            b.append(a[i])
        else:
            b.insert(0,a[i])
    else:
        if i % 2 !=0:
            b.append(a[i])
        else:
            b.insert(0,a[i])


print(' '.join(map(int, b)))