Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
8
27 23 76 2 3 5 62 52

Fixed submission:
n = int(input())

w = list(map(int,input().split()))
count = 0
min = 1000
for t in range(1,n):
  count =  abs(sum(w[:t]) - sum(w[t:n])) 
  if count < min:
    min = count
print(min)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

s = [0]*n
for i in range(m):
  l,r = map(int,input().split())
  for j in range(l-1,r):
    s[j] += 1

print(s.count(m))

Fixed submission:
n,m=map(int,input().split())
L=[0]*m
R=[0]*m
table=[0]*(n+2)
for i in range(m):
   L[i],R[i]=map(int,input().split())
   table[L[i]]+=1
   table[R[i]+1]-=1
s=[0]*(n+2)#累積和をするリスト
for i in range(1,n+2):
   s[i]=s[i-1]+table[i]
print(s.count(m))
Buggy python submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = (C * D) // math.gcd(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = lcm(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)

Buggy python submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())
total = B - A + 1

num = math.gcd(C,D)
if num != 0:
    tmp = (C * D) // num
else:
    tmp = C*D


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total+D_total-tmp_total
print(total-cnt)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = lcm(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)

Buggy python submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())
total = B - A + 1

num = math.gcd(C,D)
tmp = (C * D) // num

C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total+D_total-tmp_total
print(total-cnt)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = lcm(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)

Buggy python submission (verdict: Runtime Error):
import math

A,B,C,D = map(int,input().split())


total = B - A + 1

tmp =(C * D) // math.gcd(C, D)

cnt = 0

# A
C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2


D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp

tmp_total = tmp_1 - tmp_2
cnt = C_total+D_total-tmp_total

print(total-cnt)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)


A,B,C,D = map(int,input().split())
total = B - A + 1

tmp = lcm(C,D) 


C_1 = B//C
C_2 = (A-1)//C
C_total = C_1 - C_2

D_1 = B//D
D_2 = (A-1)//D
D_total = D_1 - D_2

tmp_1 = B//tmp
tmp_2 = (A-1)//tmp
tmp_total = tmp_1 - tmp_2
cnt = C_total + D_total - tmp_total
print(total-cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n // (2*d + 1)
if n % (2*d + 1) == 0:
  print(ans)
else:
  print(ans+1)


Fixed submission:
r = int(input())

print("{}".format(3*r*r))
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n // (2*d + 1)
if n % (2*d + 1) != 0:
  print(ans+1)
else:
  print(ans)


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

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n/(2*d + 1)
if n % (2*d + 1) != 0:
  print(ans+1)
else:
  print(ans)


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

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n/(2*d + 1)
if n % (2*d + 1) != 0:
  print("{}".format(ans+1))
else:
  print("{}".format(ans))

Fixed submission:
n, d = map(int,input().split())
ans = n // (2*d + 1)
if n % (2*d + 1) == 0:
  print(ans)
else:
  print(ans+1)
Buggy python submission (verdict: Time Limit Exceeded):
def line(s):
    ret = [0] * len(s)
    for i in range(len(s)):
        ret[i] = 0 if s[i] == 'W' else 1

    return ret

def all_same(arr):
    for i in range(len(arr)-1):
        if arr[i] != arr[i+1]:
            return False
    return True

def opposite(x):
    return (x - 1) ** 2

def update(arr):
    count = 0
    while(not all_same(arr)):
        append = opposite(arr[-1])
        other = arr[-1]
        i = -1
        while(arr[i] == other or -i == len(arr) + 1):
            arr[i] = append
            i -= 1
        if -i == len(arr)/2:
            arr.reverse()
        count += 1
    return count

if __name__ == '__main__':
    s = raw_input()
    arr = line(s)
    print(update(arr))


Fixed submission:
def line(s):
    ret = [0] * len(s)
    for i in range(len(s)):
        ret[i] = 0 if s[i] == 'W' else 1

    return ret

def count(arr):
    c = 0
    for i in range(len(arr)-1):
        if arr[i+1] != arr[i]:
            c += 1
    return c

if __name__ == '__main__':
    s = raw_input()
    arr = line(s)
    print(count(arr))

Buggy python submission (verdict: Time Limit Exceeded):
def line(s):
    ret = [0] * len(s)
    for i in range(len(s)):
        ret[i] = 0 if s[i] == 'W' else 1

    return ret

def all_same(arr):
    for i in range(len(arr)-1):
        if arr[i] != arr[i+1]:
            return False
    return True

def opposite(x):
    return (x - 1) ** 2

def update(arr):
    count = 0
    while(not all_same(arr)):
        append = opposite(arr[-1])
        other = arr[-1]
        i = -1
        while(arr[i] == other or -i == len(arr) + 1):
            arr[i] = append
            i -= 1
        count += 1
    return count

if __name__ == '__main__':
    s = raw_input()
    arr = line(s)
    print(update(arr))


Fixed submission:
def line(s):
    ret = [0] * len(s)
    for i in range(len(s)):
        ret[i] = 0 if s[i] == 'W' else 1

    return ret

def count(arr):
    c = 0
    for i in range(len(arr)-1):
        if arr[i+1] != arr[i]:
            c += 1
    return c

if __name__ == '__main__':
    s = raw_input()
    arr = line(s)
    print(count(arr))
Buggy python submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())

#print((a * b) % 2)

if (a * b) % 2 == 1:
    print('Odd')
else:
    print('Even')f

Fixed submission:
a,b=(int(x) for x in input().split())

#print((a * b) % 2)

if (a * b) % 2 == 1:
    print('Odd')
else:
    print('Even')
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if math.log10(a) > 18:
        print(-1)
        exit()
    ans *= a
    elif ans % 10 == 0 and math.log10(ans) == 18:
        print(ans)
    elif math.log10(ans) > 18:
        print(-1)
        exit()
print(ans)

Fixed submission:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if a > 1000000000000000000:
        print(-1)
        exit()
    ans *= a
    if ans > 1000000000000000000:
        print(-1)
        exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
la = [int(i) for i in input().split()]
ans = 1
for a in la:
    ans *= a

if(math.log10(ans) > 18):
    print(-1)
else:
    print(ans)

Fixed submission:
import math
n = int(input())
la = [int(i) for i in input().split()]
la.sort(reverse=True)
ans = 1

if la[-1] == 0:
    print(0)
    exit()

for a in la:
    if a > 1000000000000000000:
        print(-1)
        exit()
    ans *= a
    if ans > 1000000000000000000:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from statistics import median


def main():
    i = 0
    n = 10**10
    a = []
    b = []
    for line in stdin:
        if i == 0:
            n = int(line)
            i += 1
            continue
        (ai, bi) = line.split()
        a.append(int(ai))
        b.append(int(bi))
        i += 1
        if i > n:
            break

    a_mid = median(a)
    b_mid = median(b)
    if a_mid == b_mid:
        print(1)
        return
    if b_mid - a_mid < 1:
        print(3)
        return
    if n % 2 == 0:
        print(int(b_mid - a_mid) * 2 + 1)
    else:
        print(int(b_mid - a_mid) + 1)

main()

Fixed submission:
from sys import stdin

def main():
    for line in stdin:
        factors = line.split()
        break

    print(int(factors[0]) * int(factors[1]))

main()

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

def main():
    for line in stdin:
        factors_str = line.split()
        break

    a = factor[0]
    b = factor[1] * 100
    prod = a * b / 100

    print(floor(prod))

main()

Fixed submission:
from sys import stdin

def main():
    for line in stdin:
        factors = line.split()
        break

    print(int(factors[0]) * int(factors[1]))

main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input().strip())
ans = 0
for i in range(n):
    ans = ans + i
print(ans)


Fixed submission:
import math
n = int(input().strip())
ans = (n*(n-1))//2

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input().strip())
arrayH = list(map(int, input().strip().split(' ')))
ans = 1
i = 0
while arrayH[i] <= arrayH[i+1]:
                ans = i + 1
                i = i + i
                if i == N - 1:
                        break
print(ans)


Fixed submission:
N = int(input().strip())
arrayH = list(map(int, input().strip().split(' ')))
ans = 1
for i in range(N - 1):
        yn = True
        for j in range(i+1):
                if arrayH[j] > arrayH[i+1]:
                        yn = False
        if yn:
                ans = ans + 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = input().strip().split(' ')
x,y,z,k = [int(x), int(y),int(z),int(k)]
aList = list(map(int, input().strip().split(' ')))
bList = list(map(int, input().strip().split(' ')))
cList = list(map(int, input().strip().split(' ')))
ansList = []
aList
for i in range(min(len(aList),k)):
        for j in range(min(len(bList),k)):
                for n in range(min(len(cList),k)):
                        y = aList[i] + bList[j] + cList[n]
                        ansList.append(y)
ansList.sort(reverse = True)

for i in range(k):
        print(ansList[i])


Fixed submission:
x,y,z,k = input().strip().split(' ')
x,y,z,k = [int(x), int(y),int(z),int(k)]
aList = list(map(int, input().strip().split(' ')))
bList = list(map(int, input().strip().split(' ')))
cList = list(map(int, input().strip().split(' ')))
ansList = []
# aList.sort(reverse = True)
# bList.sort(reverse = True)
# cList.sort(reverse = True)

abList = []
for i in range(len(aList)):
        for j in range(len(bList)):
                abList.append(aList[i] + bList[j])
abList.sort(reverse = True)
abcList = []
for s in range(min(len(abList),k)):
        for t in range(len(cList)):
                abcList.append(abList[s] + cList[t])
abcList.sort(reverse = True)
for a in range(min(len(abcList),k)):
        print(abcList[a])

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = input().strip().split(' ')
x,y,z,k = [int(x), int(y),int(z),int(k)]
aList = list(map(int, input().strip().split(' ')))
bList = list(map(int, input().strip().split(' ')))
cList = list(map(int, input().strip().split(' ')))
ansList = []
for i in range(len(aList)):
        for j in range(len(bList)):
                for n in range(len(cList)):
                        y = aList[i] + bList[j] + cList[n]
                        ansList.append(y)
ansList.sort(reverse = True)

for i in range(k):
        print(ansList[i])


Fixed submission:
x,y,z,k = input().strip().split(' ')
x,y,z,k = [int(x), int(y),int(z),int(k)]
aList = list(map(int, input().strip().split(' ')))
bList = list(map(int, input().strip().split(' ')))
cList = list(map(int, input().strip().split(' ')))
ansList = []
# aList.sort(reverse = True)
# bList.sort(reverse = True)
# cList.sort(reverse = True)

abList = []
for i in range(len(aList)):
        for j in range(len(bList)):
                abList.append(aList[i] + bList[j])
abList.sort(reverse = True)
abcList = []
for s in range(min(len(abList),k)):
        for t in range(len(cList)):
                abcList.append(abList[s] + cList[t])
abcList.sort(reverse = True)
for a in range(min(len(abcList),k)):
        print(abcList[a])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = input().strip().split(' ')
n, k = [int(n),int(k)]
l = []
for i in range(n):
    h = input()
    h = int(h)
    l.append(h)
dl = sorted(l)
ans = float('inf')
for j in range(n-k+1):
    ddl = []
    for a in range(k):
        ddl.append(dl[j+a])
    if max(ddl) - min(ddl) <= ans:
        ans = max(ddl) - min(ddl)
print(int(ans))


Fixed submission:
n, k = input().strip().split(' ')
n, k = [int(n),int(k)]
l = []
for i in range(n):
    h = input()
    h = int(h)
    l.append(h)
dl = sorted(l)
ans = float('inf')
for j in range(n-k+1):
    if abs(dl[j+k-1] - dl[j]) <= ans:
        ans = abs(dl[j+k-1] - dl[j])
print(int(ans))
Buggy python submission (verdict: Runtime Error):
nums = list(map(int, input().split())) # "1 2 3"と入力
n = nums[0]
t = nums[1]
minC = 1001
for i in range(n):
    numss = list(map(int, input().split()))
    c = numss[0]
    ti = numss[1]
    if ti <= t and minC > c:
        minC = c
if minC = 1001:
    print('TLE')
else:
    print(minC)


Fixed submission:
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t <= tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)

Buggy python submission (verdict: Runtime Error):
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t =< tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)


Fixed submission:
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t <= tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)

Buggy python submission (verdict: Runtime Error):
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t =< tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)


Fixed submission:
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t <= tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)
Buggy python submission (verdict: Runtime Error):
a = []
for i in range(5):
    a.append(int(input()))
k = input()

if a[4] - a[0] <= k:
    print("Yay!")
else:
    print(":(")


Fixed submission:
a = []
for i in range(5):
    a.append(int(input()))
k = int(input())

if a[4] - a[0] <= k:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().strip().split(' '))
S = input()
l = [0] * Q
r = [0] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().strip().split(' '))


for i in range(Q):
    print(S[(l[i]-1):(r[i])].count('AC'))


Fixed submission:
# 入力
N, Q = map(int, input().strip().split())
S = input()
l = [0] * Q
r = [0] * Q
for i in range(Q):
    l[i], r[i] = map(int, input().strip().split())

# 累積和
cum_sum = [0] * N
for i in range(N):
    if i == 0:
        cum_sum[i] = 0
    elif S[i - 1] == 'A' and S[i] == 'C':
        cum_sum[i] = cum_sum[i - 1] + 1
    else:
        cum_sum[i] = cum_sum[i - 1]

for i in range(Q):
    print(cum_sum[r[i] - 1] - cum_sum[l[i] - 1])
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
counter=0
while True:
    tmp=S.count('BW')
    if tmp == 0:
        print(counter)
        break
    else:
        counter+=tmp
        S=S.replace('BW','WB')

Fixed submission:
S = input()
counter = 0
# while True:
#     tmp=S.count('BW')
#     if tmp == 0:
#         print(counter)
#         break
#     else:
#         counter+=tmp
#         S=S.replace('BW','WB')

# i=0
# while True:
#     tmp = S[i:].find('W')
#     print(S[i:])
#     if tmp == -1:
#         print(counter)
#         break
#     else:
#         counter += tmp
#         i+=1

sum=0
for i in range(len(S)):
    if S[i]=='W':
        sum+=i
        counter+=1

n=counter-1
minus=n*(n+1)/2
print(int(sum-minus))
Buggy python submission (verdict: Runtime Error):
N,X=(int(x) for x in input().split())
tmp='P'
for i in range(N):
    tmp='B'+tmp+'P'+tmp+'B'
print(tmp[0:X].count('P'))

Fixed submission:
D=input()
intD=int(D)
if intD==25:
    print('Christmas')
elif intD==24:
     print('Christmas Eve')
elif intD==23:
    print('Christmas Eve Eve')
elif intD==22:
    print('Christmas Eve Eve Eve')
else:
    print('Error')

Buggy python submission (verdict: Runtime Error):
N,X=(int(x) for x in input().split())
burger=[]
burger.append('P')
for i in range(N):
    burger.append('B'+burger[-1]+'P'+burger[-1]+'B')
print(burger[-1][0:X].count('P'))

Fixed submission:
D=input()
intD=int(D)
if intD==25:
    print('Christmas')
elif intD==24:
     print('Christmas Eve')
elif intD==23:
    print('Christmas Eve Eve')
elif intD==22:
    print('Christmas Eve Eve Eve')
else:
    print('Error')
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())
counter = 0
for i in range(K + 1):
    if int(S[i]) != 1:
        log = counter
        num = int(S[i])
        break
    counter += 1

if K <= log:
    print(1)
else:
    print(num)


Fixed submission:
A, B = map(int, input().strip().split(' '))
print((A-1)*(B-1))

Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
# def yakusuu(x):
#     tmplist=list(sy.factorint(x).values())
#     a=1
#     for i in tmplist:
#         a*=i+1
#     return a
def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]
def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num
counter=0
for i in range(1,N+1,2):
    if search_divisor_num_1(i)==8:
        counter+=1
print(counter)

Fixed submission:
A, B = map(int, input().strip().split(' '))
print((A-1)*(B-1))
Buggy python submission (verdict: Runtime Error):
import sympy as sy
N=int(input())
def yakusuu(x):
    tmplist=list(sy.factorint(x).values())
    a=1
    for i in tmplist:
        a*=i+1
    return a
counter=0
for i in range(1,N+1,2):
    if yakusuu(i)==8:
        counter+=1
print(counter)

Fixed submission:
import math

N = int(input())


# def yakusuu(x):
#     tmplist=list(sy.factorint(x).values())
#     a=1
#     for i in tmplist:
#         a*=i+1
#     return a
def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0  # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]


def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))
        prime_list = make_prime_list_2(num_sqrt)

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num


counter = 0
for i in range(1, N + 1, 2):
    if search_divisor_num_1(i) == 8:
        counter += 1
print(counter)
Buggy python submission (verdict: Runtime Error):
A*B

Fixed submission:
A,B=map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = list(map(int,input().split()))
q = [1]*1
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] < h[b-1]:
        q[a-1] = 0
    elif h[a-1] > h[b-1]:
        q[b-1] = 0
    else:
        q[a-1] = 0
        q[b-1] = 0
print(q.count(1))

Fixed submission:
n,m = map(int,input().split())
h = list(map(int,input().split()))
q = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] < h[b-1]:
        q[a-1] = 0
    elif h[a-1] > h[b-1]:
        q[b-1] = 0
    else:
        q[a-1] = 0
        q[b-1] = 0
print(q.count(1))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
mod = 10**9 + 7

n,k = map(int,input().split())
cnt = 0
for i in range(k, n + 2):
    a = set()
    for v in combinations(range(n+1), i):
        a.add(sum(v)%mod)
    cnt += len(a)
print(cnt)

Fixed submission:
mod = 10**9 + 7

n,k = map(int,input().split())
tot = []
cur = 0
for i in range(n+1):
    cur += i
    tot.append(cur)

cnt = 0
for i in range(k, n+2):
    if n > i:
        max_ = tot[n] - tot[n - i]
    else:
        max_ = tot[n]
    min_ = tot[i - 1]
    cnt += max_ - min_ + 1
    cnt %= mod
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

r = 0
g = 0
b = 0

for v in s:
    if v == 'R':
        r += 1
    elif v == 'G':
        g += 1
    else:
        b += 1

ans = r*g*b

for i in range(0, n - 2):
    for j in range(i + 1,  n - 1):
        for k in range(j  + 1, n):
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k] and j - i == k - j:
                ans -= 1
print(ans)

Fixed submission:
n = int(input())
s = input()

ans = s.count('R')*s.count('G')*s.count('B')  # ここはただ簡潔にしただけ

for i in range(0, n - 2):
    for j in range(i + 1,  n - 1):
        k = (j - i) + j
        if k >= n:
            continue
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1
print(ans)