Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1,11):
        for k in range(num):
            K = (k*2+1)<<(j-1)
            if K&ng != ng:
                K &= Num-1
                dp[i+1][K] += dp[i][k]
                dp[i+1][K] %= mod

print((10**N%mod-sum(dp[N])%mod)%mod)

Fixed submission:
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for k in range(Num):
        for j in range(1,11):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 1
for i in range(N):
    cnt *= 10
    cnt %= mod
for x in dp[N]:
    cnt -= x
    cnt %= mod
print(cnt)

Buggy python submission (verdict: Runtime Error):
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*(1<<l) for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1, 11):
        for k in range(Num):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 0
for x in dp[N]:
    cnt += x
    cnt %= mod
print((10**N%mod-cnt)%mod)

Fixed submission:
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for k in range(Num):
        for j in range(1,11):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 1
for i in range(N):
    cnt *= 10
    cnt %= mod
for x in dp[N]:
    cnt -= x
    cnt %= mod
print(cnt)

Buggy python submission (verdict: Runtime Error):
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*(1<<l) for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(1, 11):
        for k in range(Num):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][1] %= mod
print((10**N-sum(dp[N]))%mod)

Fixed submission:
mod = 10**9+7
N,X,Y,Z = map(int, input().split())
Num = 1<<(X+Y+Z-1)
ng = ((((1<<X)+1)<<Y)+1)<<(Z-1)

dp = [[0]*Num for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for k in range(Num):
        for j in range(1,11):
            a = (k<<j)|(1<<(j-1))
            if a&ng != ng:
                a &= Num-1
                dp[i+1][a] += dp[i][k]
                dp[i+1][a] %= mod
cnt = 1
for i in range(N):
    cnt *= 10
    cnt %= mod
for x in dp[N]:
    cnt -= x
    cnt %= mod
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
n = [i + 1 for i in range(N)]
print(sum(n) - max(n))

Fixed submission:
N = int(input())
print((N + 1) * N // 2 - N)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
n = [i + 1 for i in range(N)]
p = [i + 1 for i in range(N)]
p.append(1)
del(p[0])
ans = 0
for i in range(N):
    ans = ans + (n[i] % p[i])
print(ans)

Fixed submission:
N = int(input())
print((N + 1) * N // 2 - N)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
ans = 0
for i in range(N):
    tmp = list(input())
    tmp = sorted(tmp)
    s.append(tmp)
s.sort()
for i in range(N - 1):
    for j in range(N - i - 1):
        if s[i] == s[i + j + 1]:
            ans += 1
        else:
            break
print(ans)

Fixed submission:
N = int(input())
s = {}
ans = 0
for i in range(N):
    tmp = list(input())
    tmp = sorted(tmp)
    tmp = "".join(tmp)
    if tmp not in s:
        s[tmp] = 1
    else:
        ans += s[tmp]
        s[tmp] = s[tmp] + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
ans = 0
for i in range(N):
    tmp = list(input())
    tmp = sorted(tmp)
    s.append(tmp)
s.sort()
for i in range(N - 1):
    for j in range(N - i - 1):
        if s[i] == s[i + j + 1]:
            ans += 1
        else:
            break
print(ans)

Fixed submission:
N = int(input())
s = {}
ans = 0
for i in range(N):
    tmp = list(input())
    tmp = sorted(tmp)
    tmp = "".join(tmp)
    if tmp not in s:
        s[tmp] = 1
    else:
        ans += s[tmp]
        s[tmp] = s[tmp] + 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = []
R = []
ans = 0
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
for i in range(N):
    flg = 1
    if i+1 < max(L) or i+1 > min(R):
            flg = 0
    ans += flg
print(ans)

Fixed submission:
N, M = map(int, input().split())
L = 0
R = N
ans = 0
for i in range(M):
    l, r = map(int, input().split())
    if l > L:
        L = l
    if r < R:
        R = r
for i in range(N):
    flg = 1
    if i+1 < L or i+1 > R:
            flg = 0
    ans += flg
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = []
R = []
ans = 0
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
for i in range(N):
    flg = 1
    for j in range(M):
        if not (L[j] <= i+1 <= R[j]):
            flg = 0
            break
    ans += flg
print(ans)

Fixed submission:
N, M = map(int, input().split())
L = 0
R = N
ans = 0
for i in range(M):
    l, r = map(int, input().split())
    if l > L:
        L = l
    if r < R:
        R = r
for i in range(N):
    flg = 1
    if i+1 < L or i+1 > R:
            flg = 0
    ans += flg
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = []
R = []
ans = 0
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
for i in range(N):
    flg = 1
    for j in range(M):
        if not (L[j] <= i+1 <= R[j]):
            flg = 0
            break
    ans += flg
print(ans)

Fixed submission:
N, M = map(int, input().split())
L = 0
R = N
ans = 0
for i in range(M):
    l, r = map(int, input().split())
    if l > L:
        L = l
    if r < R:
        R = r
for i in range(N):
    flg = 1
    if i+1 < L or i+1 > R:
            flg = 0
    ans += flg
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())
 
ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
 
ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
 
ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
 
ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        tmp = i*R + j*G
        if tmp == N:
            ans += 1
        elif tmp < N and (N - (tmp)) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
 
ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if (i*R + j*G) == N:
            ans += 1
        if (i*R + j*G) < N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)

Fixed submission:
R, G, B, N = map(int, input().split())
 
ans = 0
for i in range(N//R + 1):
    for j in range(N//G + 1):
        if i*R + j*G > N:
            break
        if i*R + j*G <= N and (N - (i*R + j*G)) % B == 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
nums =[a, b, c, d, e]
tmp = [i % 10 for i in nums]
mm = [10 - i % 10 for i in nums]
mm = [x for x in mm if x != 10]
tmp = set(tmp)
tmp = list(tmp)
for i in range(5):
    if nums[i] % 10 == 0:
        ans += nums[i]
    else:
        ans += nums[i] + (10 - nums[i] % 10)
print(ans - max(mm))

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
nums =[a, b, c, d, e]
tmp = [i % 10 for i in nums]
if a % 10 == b % 10 == c % 10 == d % 10 == e % 10 == 0:
    print(a + b + c + d + e)
else:
    mm = [10 - i % 10 for i in nums]
    mm = [x for x in mm if x != 10]
    for i in range(5):
        if nums[i] % 10 == 0:
            ans += nums[i]
        else:
            ans += nums[i] + (10 - nums[i] % 10)
    print(ans - max(mm))
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = input()
S = S.replace('AC', 'aC')
for i in range(Q):
    l, r = map(int, input().split())
    print(S[l-1:r-1].count('a'))

Fixed submission:
#解説より
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
n, q = map(int, input().split())
s = input()

for i in range(q):
    l, r = map(int, input().split())
    moji = s[l-1:r]
    print(moji.count('AC'))

Fixed submission:
#解説より
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

if B - A + 1 < 2 * K:
    for i in range(A, B+1):
        print(i)
else:
    for i in range(A, B+1):
        if A <= i < A + K or B - K < i <= B:
            print(i)

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

if B - A + 1 < 2 * K:
    for i in range(A, B+1):
        print(i)
else:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
for i in range(A, B+1):
    if A <= i < A + K or B - K < i <= B:
        print(i)

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

if B - A + 1 < 2 * K:
    for i in range(A, B+1):
        print(i)
else:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
for i in range(A, B+1):
    if A <= i < A + K or B - K < i <= B:
        print(i)

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

if B - A + 1 < 2 * K:
    for i in range(A, B+1):
        print(i)
else:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
X, Y = map(int, input().split())
x = X
if X == Y:
    print(-1)
else:
    while X % Y == 0:
        X = X + x
    print(X)

Fixed submission:
X, Y = map(int, input().split())
x = X
if X % Y == 0:
    print(-1)
else:
    print(X)
Buggy python submission (verdict: Runtime Error):
r, g, b = map(int, input().split())
a = r * 100 + g * 10 + b
if a % 4 == 0:
    print('Yes')
else:
    pritn('No')

Fixed submission:
r, g, b = map(int, input().split())
a = r * 100 + g * 10 + b
if a % 4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
a, b, c = map(str, input().split())
if b - a == c - b:
    print('YES')
else:
    print('NO')

Fixed submission:
a, b, c = map(int, input().split())
if b - a == c - b:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif: a == b != C or b == c != a or c == a != b:
    print(2)
else:
	print(3)

Fixed submission:
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif a == b != c or b == c != a or c == a != b:
    print(2)
else:
	print(3)

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif: a == b or b == c or c == a:
    print(2)
else:
	print(3)

Fixed submission:
a, b, c = map(int, input().split())
if a == b == c:
    print(1)
elif a == b != c or b == c != a or c == a != b:
    print(2)
else:
	print(3)
Buggy python submission (verdict: Runtime Error):
s = [input() for i in range(3)]
flg = 1
while(True):
    if flg == 1:
        if s[0] == '':
            print('A')
            break
        elif s[0][0] == 'a':
            s[0] = s[0][1:]
            flg = 1
        elif s[0][0] == 'b':
            s[0] = s[0][1:]
            flg = 2
        elif s[0][0] == 'c':
            s[0] = s[0][1:]
            flg = 3
        
    elif flg == 2:
        if s[1] == '':
            print('B')
            break
        elif s[1][0] == 'a':
            s[1] = s[1][1:]
            flg = 1
        elif s[1][0] == 'b':
            s[1] = s[1][1:]
            flg = 2
        elif s[1][0] == 'c':
            s[1] = s[1][1:]
            flg = 3

    elif flg == 3:
        if s[0] == '':
            print('C')
            break
        elif s[2][0] == 'a':
            s[2] = s[2][1:]
            flg = 1
        elif s[2][0] == 'b':
            s[2] = s[2][1:]
            flg = 2
        elif s[2][0] == 'c':
            s[2] = s[2][1:]
            flg = 3

Fixed submission:
s = [input() for i in range(3)]
flg = 1
while(True):
    if flg == 1:
        if s[0] == '':
            print('A')
            break
        elif s[0][0] == 'a':
            s[0] = s[0][1:]
            flg = 1
        elif s[0][0] == 'b':
            s[0] = s[0][1:]
            flg = 2
        elif s[0][0] == 'c':
            s[0] = s[0][1:]
            flg = 3
        
    elif flg == 2:
        if s[1] == '':
            print('B')
            break
        elif s[1][0] == 'a':
            s[1] = s[1][1:]
            flg = 1
        elif s[1][0] == 'b':
            s[1] = s[1][1:]
            flg = 2
        elif s[1][0] == 'c':
            s[1] = s[1][1:]
            flg = 3

    elif flg == 3:
        if s[2] == '':
            print('C')
            break
        elif s[2][0] == 'a':
            s[2] = s[2][1:]
            flg = 1
        elif s[2][0] == 'b':
            s[2] = s[2][1:]
            flg = 2
        elif s[2][0] == 'c':
            s[2] = s[2][1:]
            flg = 3
Buggy python submission (verdict: Runtime Error):
A,B,C,K = map(int,input().split())

total = []
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if i + j + k == K:
        t = i - k
        total.append(t)

print(max(total))

Fixed submission:
S = input()
T = input()
print("Yes" if S == T[:-1] else "No")
Buggy python submission (verdict: Runtime Error):
S = input()
W = ["Sunny","Cloudy","Rainy"]
print(W[W.index(S)+1 % 3])

Fixed submission:
S = input()
W = ["Sunny","Cloudy","Rainy"]
print(W[(W.index(S)+1) % 3])
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	char a;
	cin >> a;
	if (isupper(a))cout << 'A';
	else
		cout << 'a';
}

Fixed submission:
a=input()
print('a' if a.islower() else 'A')
Buggy python submission (verdict: Runtime Error):
x,n=map(int,input().split())
a=set(map,int(input().split()))
print(min([i for i in range(102) if i not in a],key=lambda y:abs(x-y)))

Fixed submission:
x, n = map(int, input().split())
a = set(map(int, input().split()))
print(min([i for i in range(102) if i not in a], key=lambda y:abs(x-y)))
Buggy python submission (verdict: Time Limit Exceeded):
input()
A=map(int,input().split())
r=1
for a in A:
  r*=a
if r>10e17:
  print(-1)
else:
  print(r)

Fixed submission:
input()
A=list(map(int,input().split()))
r=1
if 0 not in A:
  for a in A:
    r*=a
    if r>10e17:
      print(-1)
      break
  else:
    print(r)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
input()
r=reduce(lambda a,b:eval(f'{a}*{b}'),input().split())
if 10e17<r:
  print(-1)
else:
  print(r)

Fixed submission:
input()
A=list(map(int,input().split()))
r=1
if 0 not in A:
  for a in A:
    r*=a
    if r>10e17:
      print(-1)
      break
  else:
    print(r)
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, input().split())
c = 0
t = -10
if N > 100000000:
    for i in range(100000000, N + 1):
        a = (i * A) // B - A * (i // B)
        c = max(c, a)
        if t > a or i > 1100000000:
            print(c)
            break
        t = a
    else:
        print(c)
else:
    for i in range(N + 1):
        a = (i * A) // B - A * (i // B)
        c = max(c, a)
        if t > a or i > 100000000:
            print(c)
            break
        t = a
    else:
        print(c)


Fixed submission:
A, B, N = map(int, input().split())
X = min(N, B - 1)
print(A * X // B - A * (X // B))

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = map(int, input().split())
c = 0
t = -10
for i in range(N + 1):
    a = (i * A) // B - A * (i // B)
    c = max(c, a)
    if t > a:
        print(c)
        break
    t = a
else:
    print(c)


Fixed submission:
A, B, N = map(int, input().split())
X = min(N, B - 1)
print(A * X // B - A * (X // B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
c = 0
for i in range(N):
    for j in range(i, N):
        for k in range(j, N):
            if len(set([S[i], S[j], S[k]])) == 3 and j - i != k - j:
                c += 1
print(c)


Fixed submission:
N = int(input())
S = input()
a = S.count("R") * S.count("G") * S.count("B")
c = 0
for i in range(N):
    for j in range(i + 1, N):
        k = 2 * j - i
        if k >= N:
            continue
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            c += 1
print(a - c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
c = 0
for i in range(N):
    for j in range(i, N):
        for k in range(j, N):
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k] and j - i != k - j:
                c += 1
print(c)


Fixed submission:
N = int(input())
S = input()
a = S.count("R") * S.count("G") * S.count("B")
c = 0
for i in range(N):
    for j in range(i + 1, N):
        k = 2 * j - i
        if k >= N:
            continue
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            c += 1
print(a - c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in l:
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in range(N + 1):
    i = l[i]
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
l = [0] * 100000
for i in A:
    l[i] += 1
c = 0
nums = [0] * N
for i in range(N):
    nums[i] = l[i] * (l[i] - 1) / 2
s = sum(nums)
for i in range(N):
    a = A[i]
    print(int(s - (l[a] * (l[a] - 1)) / 2 + (l[a] - 1) * (l[a] - 2) / 2))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in range(N + 1):
    i = l[i]
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
l = [0] * 100000
for i in A:
    l[i] += 1
c = 0
nums = [0] * N
for i in range(N):
    nums[i] = l[i] * (l[i] - 1) / 2
s = sum(nums)
for i in range(N):
    a = A[i]
    print(int(s - nums[a - 1] + (l[a] - 1) * (l[a] - 2) / 2))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in range(N + 1):
    i = l[i]
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))

Buggy python submission (verdict: Runtime Error):

N = int(input())
A = list(map(int, input().split()))
l = [0] * 100000
for i in A:
    l[i] += 1
c = 0
nums = [0] * N
for i in range(N):
    nums[i] = l[i] * (l[i] - 1) / 2
s = sum(nums)
for i in range(N):
    a = A[i]
    print(int(s - nums[a] + (l[a] - 1) * (l[a] - 2) / 2))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in range(N + 1):
    i = l[i]
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))
Buggy python submission (verdict: Runtime Error):
S = list(input())
Q = int(input())
for i in range(Q):
    query = input().split()
    if int(query[0]) == 1:
        S.reverse()
    else:
        if int(query[1]) == 1:
            S.insert(0, query[2])
        else:
            S.append(query[2])
print("".join(S))


Fixed submission:
S = input()
if len(set(S)) == 2:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
answer = 0
for i in range(N - K + 1):
    t = 0
    for j in range(i, i + K):
        j = P[j]
        t += (j * (j + 1) / 2) / j
    answer = max(answer, t)
print(answer)


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
t = [0] * 1000000
for i in range(N):
    t[i + 1] = t[i] + P[i] + 1
ans = 0
for i in range(N - K + 1):
    ans = max(ans, t[i+K] - t[i])
print(ans / 2)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))
answer = 0
for i in range(N - K + 1):
    t = 0
    for j in range(i, i + K):
        j = P[j]
        t += (j * (j + 1) / 2) / j
    answer = max(answer, t)
print(answer)


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
t = [0] * 1000000
for i in range(N):
    t[i + 1] = t[i] + P[i] + 1
ans = 0
for i in range(N - K + 1):
    ans = max(ans, t[i+K] - t[i])
print(ans / 2)

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))


def f(x):
    return sum(range(x + 1)) / x


s = []

for i in range(n-k):
    s.append(sum([sum(range(p[i + j] + 1)) / p[i + j] for j in range(k)]))

print("{:.13f}".format(max(s)))


Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
t = [0] * 1000000
for i in range(N):
    t[i + 1] = t[i] + P[i] + 1
ans = 0
for i in range(N - K + 1):
    ans = max(ans, t[i+K] - t[i])
print(ans / 2)