Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

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

# まずスタートの点数
p_pre = 1
for item in a[:k]:
    p_pre *= item

# n-k回やる
for i in range(n-k):
    # iこ目をなくしてk+iこめをふやす
    p_next = ((p_pre / a[i]) * a[k+i])
    if p_next > p_pre:
        print("Yes")
    else:
        print("No")

    p_pre = p_next


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

# n-k回やる
for i in range(n-k):
    # iこ目をなくしてk+iこめをふやす
    if a[k+i] > a[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())

def calc(l):
    if l <= 5:
        return 0

    ans = 0
    m = math.floor(math.sqrt(n/6))
    M = math.floor(math.sqrt(n/6))
    MM = math.floor(math.sqrt(n-2))
    for i in range(1, m+2):
        for k in range(max(1, M-1), MM+2):
            for j in range(i, k+1):
                if i**2 + j**2 + k**2 + i*j + j*k + k*i == l:
                    d = len(set([i, j, k]))
                    if d == 3:
                        ans += 6
                    elif d == 2:
                        ans += 3
                    elif d == 1:
                        ans += 1
    
    return ans

for p in range(1, n+1):
    print(calc(p))

Fixed submission:
n = int(input())
N = 10 ** 4

l = [0 for _ in range(N + 1)]

for i in range(1, 42):
    for k in range(1, 99):
        for j in range(i, k+1):
            s = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if s > N:
                continue
            d = len(set([i, j, k]))
            if d == 3:
                l[s] += 6
            elif d == 2:
                l[s] += 3
            elif d == 1:
                l[s] += 1

for i in range(1, n+1):
    print(l[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

def calc(m):
    result = 0
    for i in range(1, 41):
        for j in range(1, 41):
            for k in range(1, 41):
                if i**2 + j**2 + k**2 + i*j + j*k + k*i == m:
                    result += 1

    print(result)

for p in range(1, n+1):
    calc(p)

Fixed submission:
n = int(input())
N = 10 ** 4

l = [0 for _ in range(N + 1)]

for i in range(1, 42):
    for k in range(1, 99):
        for j in range(i, k+1):
            s = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if s > N:
                continue
            d = len(set([i, j, k]))
            if d == 3:
                l[s] += 6
            elif d == 2:
                l[s] += 3
            elif d == 1:
                l[s] += 1

for i in range(1, n+1):
    print(l[i])
Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(n)]

#dp[i][j] := i番目までの物でjの価値を実現するのに必要な最小コスト
dp = [[0] * 1001 for _ in range(n+1)]
for j in range(1, 1001):
    dp[0][j] = float("inf")

for i in range(n):
    for j in range(1001):
        if j < items[i][0]:
            dp[i+1][j] = min(dp[i][j], items[i][1])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-items[i][0]] + items[i][1])

print(dp[n][h])

Fixed submission:
h, n = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(n)]

#dp[i][j] := i番目までの物でjの価値を実現するのに必要な最小コスト
dp = [[0] * (h+1) for _ in range(n+1)]
for j in range(1, h+1):
    dp[0][j] = float("inf")

for i in range(n):
    for j in range(h+1):
        if j < items[i][0]:
            dp[i+1][j] = min(dp[i][j], items[i][1])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-items[i][0]] + items[i][1])

print(dp[n][h])

Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(n)]

#dp[i][j] := i番目までの物ででjまでのコストで実現できる最大値
dp = [[0] * 100000001 for _ in range(n+1)]

for i in range(n):
    for j in range(1001):
        if j < items[i][1]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i+1][j-items[i][1]] + items[i][0])

m = 0
while True:
    if dp[n][m] >= h:
        print(m)
        exit()
    m += 1

Fixed submission:
h, n = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(n)]

#dp[i][j] := i番目までの物でjの価値を実現するのに必要な最小コスト
dp = [[0] * (h+1) for _ in range(n+1)]
for j in range(1, h+1):
    dp[0][j] = float("inf")

for i in range(n):
    for j in range(h+1):
        if j < items[i][0]:
            dp[i+1][j] = min(dp[i][j], items[i][1])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-items[i][0]] + items[i][1])

print(dp[n][h])

Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(n)]

#dp[i][j] := i番目までの物ででjまでのコストで実現できる最大値
dp = [[0] * 1001 for _ in range(n+1)]

for i in range(n):
    for j in range(1001):
        if j < items[i][1]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i+1][j-items[i][1]] + items[i][0])

m = 0
while True:
    if dp[n][m] >= h:
        print(m)
        exit()
    m += 1

Fixed submission:
h, n = map(int, input().split())
items = [tuple(map(int, input().split())) for _ in range(n)]

#dp[i][j] := i番目までの物でjの価値を実現するのに必要な最小コスト
dp = [[0] * (h+1) for _ in range(n+1)]
for j in range(1, h+1):
    dp[0][j] = float("inf")

for i in range(n):
    for j in range(h+1):
        if j < items[i][0]:
            dp[i+1][j] = min(dp[i][j], items[i][1])
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-items[i][0]] + items[i][1])

print(dp[n][h])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    L = []
    for i in range(N):
        xi, li = map(int, input().split())
        s = xi - li
        f = xi + li
        L.append((s, f))
    
    L.sort(key=lambda x: x[1])

    ans = 0
    while L:
        e = L[0]
        L = [i for i in L if i[0] >= e[1]]
        ans += 1
    
    print(ans)

if __name__ == "__main__":
    main()



Fixed submission:
def main():
    N = int(input())
    L = []
    for i in range(N):
        xi, li = map(int, input().split())
        s = xi - li
        f = xi + li
        L.append((f, s))
    
    L.sort()

    ans = 0
    finish = -float("inf")
    for i in L:
        if finish <= i[1]:
            ans += 1
            finish = i[0] 

    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    L = []
    for i in range(N):
        xi, li = map(int, input().split())
        s = xi - li
        f = xi + li
        L.append((s, f))
    
    L.sort(key=lambda x: x[1])

    ans = 0
    while L:
        e = L[0]
        L = [i for i in L if i[0] >= e[1]]
        ans += 1
    
    print(ans)

if __name__ == "__main__":
    main()



Fixed submission:
def main():
    N = int(input())
    L = []
    for i in range(N):
        xi, li = map(int, input().split())
        s = xi - li
        f = xi + li
        L.append((f, s))
    
    L.sort()

    ans = 0
    finish = -float("inf")
    for i in L:
        if finish <= i[1]:
            ans += 1
            finish = i[0] 

    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())

    #6**6=46656, 6**7=279936
    #9**5=59049, 9**6=531441
    list = [1]
    list.extend([6 ** i for i in range(1, 7)])
    list.extend([9 ** i for i in range(1, 6)])

    dp = [float("inf")] * 100000
    dp[0] = 0

    for i in range(N+1):
        for j in list:
            dp[i+j] = min(dp[i+j], dp[i]+1)

    print(dp[N])

if __name__ == "__main__":
    main()



Fixed submission:
def main():
    N = int(input())

    #6**6=46656, 6**7=279936
    #9**5=59049, 9**6=531441
    list = [1]
    list.extend([6 ** i for i in range(1, 7)])
    list.extend([9 ** i for i in range(1, 6)])

    dp = [float("inf")] * 100001
    dp[0] = 0

    for i in range(N+1):
        for j in list:
            if i + j > 100000:
                continue
            else:
                dp[i+j] = min(dp[i+j], dp[i]+1)

    print(dp[N])

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
a, b, h = [int(input()) for i in range(4)]

print(round((a + b) * h / 2))

Fixed submission:
a, b, h = [int(input()) for i in range(3)]

print(round((a + b) * h / 2))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
v,e=map(int,input().split())
m=defaultdict(list)

for i in range(e):
    x,y=map(int,input().split())
    m[x].append(y)
dp=defaultdict(lambda:-1)
def longestPath():
    
    def findLongestPath(vtx):
        if(dp[vtx]!=-1):
            return dp[vtx]
        res=0
        for i in m[vtx]:
            res=max(res,1+findLongestPath(i))
        dp[vtx]=res
        return res
        
        
    
    ans=0
    for i in range(1,v+1):
        ans=max(ans,findLongestPath(i))
    
    return ans;

print(longestPath())


Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)
v,e=map(int,input().split())
m=defaultdict(list)

for i in range(e):
    x,y=map(int,input().split())
    m[x].append(y)
dp=defaultdict(lambda:-1)
def longestPath():
    
    def findLongestPath(vtx):
        if(dp[vtx]!=-1):
            return dp[vtx]
        res=0
        for i in m[vtx]:
            res=max(res,1+findLongestPath(i))
        dp[vtx]=res
        return res
        
        
    
    ans=0
    for i in range(1,v+1):
        ans=max(ans,findLongestPath(i))
    
    return ans;

print(longestPath())
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
j = 1
for i in A:
    j = i * j
if j > 10**18:
    print(-1)
else:
    print(j)

Fixed submission:
N = int(input())
A = sorted(list(map(int, input().split())), )
j = 1
if A[0] == 0:
    print(0)
    exit()
for i in A:
    j = i * j
    if j > 10**18:
        print(-1)
        exit()
if j > 10**18:
    print(-1)
else:
    print(j)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
n_1 = N - (K * (N // K))
n_2 = abs(n - K)
print(min(n_1, n_2))

Fixed submission:
N, K = map(int, input().split())
n_1 = N - (K * (N // K))
n_2 = abs(n_1 - K)
print(min(n_1, n_2))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
max_k_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
max_k_list.sort()
for max_k in max_k_list:
    print(max_k)

Fixed submission:
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
max_count = c.most_common()[0][1]
max_k_list = [kv[0] for kv in c.items() if kv[1] == max_count]
max_k_list.sort()
for max_k in max_k_list:
    print(max_k)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split(" ")))
s = 1
for i in range(1,N):
    P_S = sorted(P[:i], reverse=True)
    if P_S[i-1] >= P[i]:
        s+=1
    else:
        continue

print(s)

Fixed submission:
N = int(input())
P = list(map(int, input().split(" ")))
cnt = 0
S = P[0]
for i in range(N):
    if S >= P[i]:
        cnt += 1
    S = min(S, P[i])

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split(" ")))
s = 1
for i in range(1,N):
    for j in range(i):
        if P[j] > P[i]:
            if i == j+1:
                s += 1
        else:
            break
print(s)

Fixed submission:
N = int(input())
P = list(map(int, input().split(" ")))
cnt = 0
S = P[0]
for i in range(N):
    if S >= P[i]:
        cnt += 1
    S = min(S, P[i])

print(cnt)
Buggy python submission (verdict: Runtime Error):
S, T = input().split()
print(f'{T}{S}')

Fixed submission:
S, T = input().split()
print(T+S)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
H = input().split()
H_i = [int(h) for h in H]

print(sum(h>K for h in H_i)

Fixed submission:
N, K = map(int,input().split())
H = input().split()
H_i = [int(h) for h in H]

print(sum(h>=K for h in H_i))
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
x=0
for i in range(1000000000):
    x+=1
    if abs(a-i) == abs(b-i):
        print(i)
        exit()
print('IMPOSSIBLE')

Fixed submission:
a,b = map(int,input().split())
if (b-a)%2 == 1:
    print('IMPOSSIBLE')

else:
    print(int((b-a)/2 + a))
Buggy python submission (verdict: Runtime Error):
PQR = list(map(int, input().split()))
PQR.sort
print(PQR[0]+PQR[1]

Fixed submission:
PQR = list(map(int, input().split()))
PQR.sort(reverse=False)
print(PQR[0]+PQR[1])
Buggy python submission (verdict: Runtime Error):
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(Number.sum())
else:
    print(Number[1]*2 -1)

Fixed submission:
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(Number[1]*2 -1)

Buggy python submission (verdict: Runtime Error):
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(f'{Number[1]*2 -1}')

Fixed submission:
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(Number[1]*2 -1)

Buggy python submission (verdict: Runtime Error):
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(f'{Number[1]*2 -1}')

Fixed submission:
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(Number[1]*2 -1)

Buggy python submission (verdict: Runtime Error):
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(Number.sum())
else:
    print(Number[1]*2 -1)

Fixed submission:
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(Number[1]*2 -1)

Buggy python submission (verdict: Runtime Error):
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(Number.sum())
else:
    print(f'{Number[1]*2 -1}')

Fixed submission:
Number= list(map(int, input().split()))
Number.sort()
if Number[0] == Number[1]:
    print(sum(Number))
else:
    print(Number[1]*2 -1)
Buggy python submission (verdict: Runtime Error):
a = input()
s = list(a)
s_int = [int(i) for i in s ]
t = len(s_int)
i = 0
while 0 in s_int and 1 in s_int and i < len(s_int):
    if s_int[i] == 0 and s_int[i+1] == 1:
        s_int.pop(i)
        s_int.pop(i)
    elif s_int[i] == 1 and s_int[i+1] == 0:
        s_int.pop(i)
        s_int.pop(i)
    else:
        i += 1
print(t - len(s_int))

Fixed submission:
a = input()
s = list(a)
s_int = [int(i) for i in s ]
t = len(s_int)
i = 0
c0 = s_int.count(0)
c1 = s_int.count(1)
if c0 > c1:
    print(2*c1)
else:
    print(2*c0)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
for i in range(5*10**15):
    s = s.replace('2','22')
    s = s.replace('3','333')
    s = s.replace('4','4444')
    s = s.replace('5','55555')
    s = s.replace('6','666666')
    s = s.replace('7','7777777')
    s = s.replace('8','88888888')
    s = s.replace('9','999999999')
    s = s[:k]
print(s)

Fixed submission:
s = input()
k = int(input())
cnt = 0
while s[:1] == '1':
    s = s[1:]
    cnt +=1
if k <= cnt:
    print('1')
else:
    print(s[:1])
Buggy python submission (verdict: Runtime Error):
N = input()
print(f'ABC{N}')

Fixed submission:
N = input()
print('ABC'+ N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
evens = [i for i in range(1, N+1) if i%2 ==0]
even_cnts = []
for even in evens:
    cnt = 0
    while even % 2 ==0:
        cnt += 1
        even = even / 2
    even_cnts.append(cnt)
max_cnts = max(even_cnts)
index = even_cnts.index(max_cnts)
print(evens[index])

Fixed submission:
import sys
N = int(input())
evens = [i for i in range(1, N+1) if i%2 ==0]
even_cnts = []
if evens == []:
    print(1)
    sys.exit()
for even in evens:
    cnt = 0
    while even % 2 ==0:
        cnt += 1
        even = even / 2
    even_cnts.append(cnt)
max_cnts = max(even_cnts)
index = even_cnts.index(max_cnts)
print(evens[index])
Buggy python submission (verdict: Runtime Error):
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())

collect_dict = dict(collections.Counter(a))

now = sum(a)

ans = []
for i in range(q):
    b, c = map(int,input().split())
    now -= collect_dict[b] * b
    tmp = collect_dict[b]
    collect_dict.pop(b)
    if c not in collect_dict.keys():
        collect_dict[c] = 0
    collect_dict[c] += tmp
    now += c * tmp
    ans.append(now)

for i in ans:
    print(i)

Fixed submission:
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())

collect_dict = dict(collections.Counter(a))

now = sum(a)

ans = []
for i in range(q):
    b, c = map(int,input().split())
    if b not in collect_dict.keys():
        ans.append(now)
        continue
    now -= collect_dict[b] * b
    tmp = collect_dict[b]
    collect_dict.pop(b)
    if c not in collect_dict.keys():
        collect_dict[c] = 0
    collect_dict[c] += tmp
    now += c * tmp
    ans.append(now)

for i in ans:
    print(i)

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

n = int(input())
a = list(map(int,input().split()))
q = int(input())

collect_dict = dict(collections.Counter(a))

now = sum(a)

ans = []
for i in range(q):
    b, c = map(int,input().split())
    now -= collect_dict[b] * b
    tmp = collect_dict[b]
    collect_dict.pop(b)
    collect_dict[c] += tmp
    now += c * tmp
    ans.append(now)

for i in ans:
    print(i)

Fixed submission:
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())

collect_dict = dict(collections.Counter(a))

now = sum(a)

ans = []
for i in range(q):
    b, c = map(int,input().split())
    if b not in collect_dict.keys():
        ans.append(now)
        continue
    now -= collect_dict[b] * b
    tmp = collect_dict[b]
    collect_dict.pop(b)
    if c not in collect_dict.keys():
        collect_dict[c] = 0
    collect_dict[c] += tmp
    now += c * tmp
    ans.append(now)

for i in ans:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int, input().split()))

ans = 1
for i in a:
    ans *= i

if ans >= 1000000000000000001:
    print(-1)
    exit()
print(ans)

Fixed submission:
n = int(input())

a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit()
ans = 1
for i in a:
    ans *= i

    if ans >= 1000000000000000001:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
// #MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(int argc, char const *argv[]) {
  float n;
  std::cin >> n;
  std::cout << n*2*M_PI << '\n';
  return 0;
}


Fixed submission:
import math

n = int(input())
print(2*n*math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = 0
ans_list = []
for j in range(1, n):
    for i in range(j):
        for k in range(j + 1, n):
            if j - i == k - j:
                continue
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans += 1
                ans_list.append([i,j,k])
print(ans)


Fixed submission:
n = int(input())
s = input()
ans = 0
ans_list = []

R_index = []
G_index = []
B_index = []

for i in range(n):
    if s[i] == 'R':
        R_index.append(i)
    elif s[i] == 'G':
        G_index.append(i)
    elif s[i] == 'B':
        B_index.append(i)

ans = len(R_index) * len(G_index) * len(B_index)

for j in range(1, n-1):
    for i in range(min(n-j-1,j)+1):
        # print(j,i)
        # print(min(n-j-1,j))
        #
        # print(s[j-i],s[j],s[j+i])
        if s[j-i] != s[j] and s[j] != s[j+i] and s[j-i] != s[j+i]:
            # print('here')
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

R_index = []
G_index = []
B_index = []

for i in range(n):
    if s[i] == 'R':
        R_index.append(i)
    elif s[i] == 'G':
        G_index.append(i)
    elif s[i] == 'B':
        B_index.append(i)

ans = 0
# print(R_index)
# print(G_index)
# print(B_index)

for i in R_index:
    for j in G_index:
        for k in B_index:
            temp_i = min(i,j,k)
            temp_k = max(i,j,k)
            temp_j = i + j + k - temp_i - temp_k
            if temp_k - temp_j == temp_j - temp_i:
                continue
            ans += 1


print(ans)


Fixed submission:
n = int(input())
s = input()
ans = 0
ans_list = []

R_index = []
G_index = []
B_index = []

for i in range(n):
    if s[i] == 'R':
        R_index.append(i)
    elif s[i] == 'G':
        G_index.append(i)
    elif s[i] == 'B':
        B_index.append(i)

ans = len(R_index) * len(G_index) * len(B_index)

for j in range(1, n-1):
    for i in range(min(n-j-1,j)+1):
        # print(j,i)
        # print(min(n-j-1,j))
        #
        # print(s[j-i],s[j],s[j+i])
        if s[j-i] != s[j] and s[j] != s[j+i] and s[j-i] != s[j+i]:
            # print('here')
            ans -= 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from copy import deepcopy

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

a = list(map(int, input().split()))
a_ = deepcopy(a)
ans = 1000000
for index in range(len(a)):
    temp = max(a) - min(a)
    a[index] = a[index] + k
    if ans > temp:
        ans = temp

for index in reversed(range(len(a))):
    # print(a_, temp, max(a_), min(a_))
    temp = (max(a_) - min(a_))
    # print(temp)
    a_[index] -= k
    if ans > temp:
        ans = temp

print(ans)


Fixed submission:
from copy import deepcopy

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

a = list(map(int, input().split()))
a = sorted(a)
max_ = max(a)
min_ = min(a)
a_ = deepcopy(a)
ans = 100000000000
for index in range(len(a)):
    # temp = max(a) - min(a)
    # print(max_,min_)
    temp = max_ - min_
    max_ = min_ + k
    if index != len(a)-1:
        min_ = a[index+1]
    a[index] = a[index] + k
    # print(temp)
    if ans > temp:
        ans = temp

max_ = max(a_)
min_ = min(a_)

for index in reversed(range(len(a))):
    # print(a_, temp, max(a_), min(a_))
    # temp = (max(a_) - min(a_))
    # print(max_,min_)
    temp = max_-min_
    min_ = max_ -k
    if index != 0:
        max_ = a_[index-1]
    # print(temp)
    # a_[index] -= k
    if ans > temp:
        ans = temp

print(ans)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())	

# even + even 
ans = x*(x – 1) / 2

# odd + odd
ans += y*(y-1) / 2

print(ans)


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

# even + even
ans = x*(x-1) / 2

# odd + odd
ans += y*(y-1) / 2

print(int(ans))