Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=str(input())
r=[]
g=[]
b=[]
for i in range (n):
    if s[i]=='R':
        r.append(i)
    if s[i]=='G':
        g.append(i)
    if s[i]=='B':
        b.append(i)
lr=len(r)
lg=len(g)
lb=len(b)
d=0
for x in range (lr):
    for y in range (lg):
        for z in range (lb):
            s=[r[x],g[y],b[z]]
            c=sorted(s)
            if c[2]-c[1]!=c[1]-c[0]:
                d+=1
print(d)



Fixed submission:
n=int(input())
s=str(input())
r=0
g=0
b=0
for x in range (n):
    if s[x]=='R':
        r+=1
    elif s[x]=='G':
        g+=1
    else:
        b+=1
rgb=r*g*b

for i in range (n):
    for j in range (i,n):
        k=j*2-i
        if k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                rgb=rgb-1
print(rgb)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=str(input())
d=0
for i in range (0,n-2):
    for j in range (i+1,n-1):
        if s[i]!=s[j]:
            for k in range(j+1,n):
                if j-i!=k-j and s[j]!=s[k] and s[k]!=s[i]:
                    d+=1
print(d)

Fixed submission:
n=int(input())
s=str(input())
r=0
g=0
b=0
for x in range (n):
    if s[x]=='R':
        r+=1
    elif s[x]=='G':
        g+=1
    else:
        b+=1
rgb=r*g*b

for i in range (n):
    for j in range (i,n):
        k=j*2-i
        if k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                rgb=rgb-1
print(rgb)

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

Fixed submission:
n=int(input())
s=str(input())
r=0
g=0
b=0
for x in range (n):
    if s[x]=='R':
        r+=1
    elif s[x]=='G':
        g+=1
    else:
        b+=1
rgb=r*g*b

for i in range (n):
    for j in range (i,n):
        k=j*2-i
        if k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                rgb=rgb-1
print(rgb)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A= list(map(int, input().split()))
for i in range (N):
    z=0
    for j in range (N):
        for k in range(N):
            if j!=i and k!=i and j<k and A[j]==A[k]:
                z+=1
    print(z)

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

d=[0]*(N+1)

for i in range (0,N):
    c=A[i]
    d[c]+=1
    
z=0

for x in range (1,N+1):
    z+=d[x]*(d[x]-1)//2
    
for y in range (0,N):
    r=A[y]
    print(z+1-d[r])
Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))
H=i[0]
W=i[1]
x=H*W 
if H==1 or W==1:
    print(1)
elif x%2==0:
    print(x//2)
else:
    print((x+1)//2)

Fixed submission:
N=int(input())
i=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(i[N-1])
Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))
H=i[0]
W=i[1]
x=H*W 
elif H==1 or W==1:
    print(1)
elif x%2==0:
    print(x//2)
else:
    print((x+1)//2)

Fixed submission:
i = list(map(int, input().split()))
H=i[0]
W=i[1]
x=H*W 
if H==1 or W==1:
    print(1)
elif x%2==0:
    print(x//2)
else:
    print((x+1)//2)
Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))
a=i[0]
b=i[1]
c=i[2]
import math

if a**0.5+b**0.5>c**0.5:
    print('No')
elif(math.isclose(a**0.5+b**0.5,c**0.5)):
    print('No')
else:
    print('Yes')
    

Fixed submission:
i = list(map(int, input().split()))
a=i[0]
b=i[1]
c=i[2]
if a+b>c:
    print('No')
elif a**2+b**2+c**2<=2*(a*c+a*b+b*c):
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
i=list(map(int, input().split()))
a=list(map(int, input().split()))
b=list(map(int, input().split()))
A=i[0]
B=i[1]
M=i[2]
x = []
y = []
c = []
for j in range(M):
    x1,y1,c1=[int(j) for j in input().split()]
    x.append(x1)
    y.append(y1)
    c.append(c1)
d=200001
e=100001
f=100001
for k in range (A):
    if a[k]<e:
        e=a[k]

for l in range (B):
    if b[k]<f:
        f=b[k]
d=e+f

for p in range (M):
    if a[x[p]-1]+b[y[p]-1]-c[p]<d:
        d= a[x[p]-1]+b[y[p]-1]-c[p]

print(d)

Fixed submission:
i=list(map(int, input().split()))
a=list(map(int, input().split()))
b=list(map(int, input().split()))
A=i[0]
B=i[1]
M=i[2]
x = []
y = []
c = []
for j in range(M):
    x1,y1,c1=[int(j) for j in input().split()]
    x.append(x1)
    y.append(y1)
    c.append(c1)
d=200001
e=100001
f=100001
for k in range (A):
    if a[k]<e:
        e=a[k]

for l in range (B):
    if b[l]<f:
        f=b[l]
d=e+f

for p in range (M):
    if a[x[p]-1]+b[y[p]-1]-c[p]<d:
        d= a[x[p]-1]+b[y[p]-1]-c[p]

print(d)

Buggy python submission (verdict: Runtime Error):
i=list(map(int, input().split()))
a=list(map(int, input().split()))
b=list(map(int, input().split()))
A=i[0]
B=i[1]
M=i[2]
x = []
y = []
c = []
for i in range(M):
    x1,y1,c1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
    c.append(c1)
d=200001
e=100001
f=100001
for k in range (A):
    if a[k]<e:
        e=a[k]

for l in range (B):
    if b[k]<f:
        f=b[k]
d=e+f

for n in range (M):
    if a[x[n]]+b[y[n]]-c[n]<d:
        d= a[x[n]]+b[y[n]]-c[n]
print(d)

Fixed submission:
i=list(map(int, input().split()))
a=list(map(int, input().split()))
b=list(map(int, input().split()))
A=i[0]
B=i[1]
M=i[2]
x = []
y = []
c = []
for j in range(M):
    x1,y1,c1=[int(j) for j in input().split()]
    x.append(x1)
    y.append(y1)
    c.append(c1)
d=200001
e=100001
f=100001
for k in range (A):
    if a[k]<e:
        e=a[k]

for l in range (B):
    if b[l]<f:
        f=b[l]
d=e+f

for p in range (M):
    if a[x[p]-1]+b[y[p]-1]-c[p]<d:
        d= a[x[p]-1]+b[y[p]-1]-c[p]

print(d)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
MOD = 1000000007
for i in range(n-1):
    for j in range(i+1, n):
      ans = ans + a[i]*a[j]
      ans = ans % MOD
print(ans)

Fixed submission:
# p = list(map(int, input().split()))
# a, b, c = map(int, input().split())
# n = int(input())
# s = input()
# print(i, end=" ")


n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 1000000007
sum = 0
for i in range(n):
    sum = sum + a[i]
    sum = sum % mod
    
for i in range(n):
    sum = sum - a[i]
    if sum < 0:
        sum = sum + mod
    ans = ans + a[i] * sum
    ans = ans % mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
k = int(input())
kx = k
if k % 2 == 1:
    while True:
        num = list(str(kx))
        if all(kx == "7" for kx in num):
            print(len(str(kx)))
            break
        kx = kx + k
else:
    print("-1")


Fixed submission:
# coding: utf-8
k = int(input())
ans = -1
x = 7

for i in range(k):
    if x % k == 0:
        ans = i + 1
        break
    x = (10 * x + 7) % k
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
n = int(input())
ans = 0

def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

for i in range(n):
    ans = ans + (1 + i) * len(divisor(i + 1))
print(ans)


Fixed submission:
# coding: utf-8
n_input = int(input())
ans = 0
for i in range(1, n_input + 1):
    n = n_input // i
    ans += n * (1 + n) * i // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
n = int(input())
ans = 0

def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

for i in range(n):
    ans = ans + (1 + i) * len(divisor(i + 1))
print(ans)


Fixed submission:
# coding: utf-8
n_input = int(input())
ans = 0
for i in range(1, n_input + 1):
    n = n_input // i
    ans += n * (1 + n) * i // 2
print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import sympy
n = int(input())
ans = 0

for i in range(n):
    list = sympy.divisors(i + 1)
    ans = ans + (1 + i) * len(list)
print(ans)


Fixed submission:
# coding: utf-8
n_input = int(input())
ans = 0
for i in range(1, n_input + 1):
    n = n_input // i
    ans += n * (1 + n) * i // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
ans = 0
for i in range(n):
    tmp = make_divisors(i + 1)
    ans = ans + (1 + i) * len(tmp)
print(ans)


Fixed submission:
# coding: utf-8
n_input = int(input())
ans = 0
for i in range(1, n_input + 1):
    n = n_input // i
    ans += n * (1 + n) * i // 2
print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import sympy
n = int(input())
ans = 0
for i in range(n):
    ans = ans + (1 + i) * sympy.divisor_count(i+1)
print(ans)


Fixed submission:
# coding: utf-8
n_input = int(input())
ans = 0
for i in range(1, n_input + 1):
    n = n_input // i
    ans += n * (1 + n) * i // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
a,b,c,k = map(int, input().split())
sum = 0
if b == 0 and c == 0:
    print(k)
else:
    for i in range(k):
        if a > 0:
           sum = sum + 1
           a = a - 1
        elif b > 0:
            b = b - 1
        elif c > 0:
            sum = sum - 1
            c = c - 1
    print(sum)

Fixed submission:
# coding: utf-8
import sys
# sys.exit()
a,b,c,k = map(int, input().split())
# sum = 0
if k <= a:
    sum = k
    print(sum)
    sys.exit()
else:
    sum = a
    k = k - a
if k <= b:
    print(sum)
    sys.exit()
else:
    k = k - b
    sum = sum - k
    print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
kaisuu = int(input())
getprizelist = []
for i in range(kaisuu):
    keihin = input()
    if keihin not in getprizelist:
        getprizelist.append(keihin)
print(len(getprizelist))


Fixed submission:
# coding: utf-8
kaisuu = int(input())
getprizelist = {}
for i in range(kaisuu):
    keihin = input()
    if keihin not in getprizelist:
        getprizelist[keihin] = i
print(len(getprizelist))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import math
n, k = map(int, input().split())
if n % k
print(int(math.log(n, k)) + 1)


Fixed submission:
# coding: utf-8
import math
n, k = map(int, input().split())
print(int(math.log(n, k)) + 1)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
a = list(map(int, input().split()))
if sum(a) > 21:
    print("bust")
else:
    print(win)

Fixed submission:
# coding: utf-8
a = list(map(int, input().split()))
if sum(a) > 21:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return
    x = 1
    for tmp in a:
        x *= tmp
        if x > 1000000000000000000:
            print(-1)
            return
    print(x)

solve()

Fixed submission:
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    if 0 in a:
        print(0)
        return
    x = 1
    for tmp in a:
        x *= tmp
        if x > 1000000000000000000:
            print(-1)
            return
    print(x)

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

count = [0] * (N)
E = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    E[a - 1].append(b - 1)
    E[b - 1].append(a - 1)
    count[a - 1] += 1
    count[b - 1] += 1

count_sum = 0
count4 = 0
count6 = 0
node = 0

check = [False] * N

for i, temp in enumerate(count):
    if temp % 2 == 1:
        print("No")
        exit()
    else:
        if temp >= 4:
            count4 += 1
            check[i] = True
            node = i
        if temp >= 6:
            count6 += 1
        count_sum += temp

def dfs(v, first, depth):
    global E, check

    ret = 0
    for next_v in E[v]:
        if depth >= 2 and next_v == first:
            return 1
        elif not check[next_v]:
            check[next_v] = True
            ret += dfs(next_v, first, depth + 1)

    return ret

if count4 >= 3 or count6 >= 1:
    print("Yes")
elif count4 == 2:
    ret = dfs(node, node, 0)
    if ret > 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
    


Fixed submission:
import sys
sys.setrecursionlimit(100000)

N, M = map(int, input().split())

count = [0] * (N)
E = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    E[a - 1].append(b - 1)
    E[b - 1].append(a - 1)
    count[a - 1] += 1
    count[b - 1] += 1

count_sum = 0
count4 = 0
count6 = 0
node = 0

check = [False] * N

for i, temp in enumerate(count):
    if temp % 2 == 1:
        print("No")
        exit()
    else:
        if temp >= 4:
            count4 += 1
            check[i] = True
            node = i
        if temp >= 6:
            count6 += 1
        count_sum += temp

def dfs(v, first, depth):
    global E, check

    ret = 0
    for next_v in E[v]:
        if depth >= 2 and next_v == first:
            return 1
        elif not check[next_v]:
            check[next_v] = True
            ret += dfs(next_v, first, depth + 1)

    return ret

if count4 >= 3 or count6 >= 1:
    print("Yes")
elif count4 == 2:
    ret = dfs(node, node, 0)
    if ret > 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
ans = [0] * M

parent = [-1] * (N + 1)
size = [1] * (N + 1)
combi = N * (N - 1) // 2
count = 0

def get_parent(a):
    global parent
    temp = parent[a]
    if temp == -1:
        return a
    else:
        temp = get_parent(temp)
        parent[a] = temp
        return temp

def union(a, b):
    global count, size
    parent_a = get_parent(a)
    parent_b = get_parent(b)

    if parent_a != parent_b:
        parent[parent_b] = parent_a
        count -= size[parent_a] * (size[parent_a] - 1) // 2
        count -= size[parent_b] * (size[parent_b] - 1) // 2
        size[parent_a] += size[parent_b]
        count += size[parent_a] * (size[parent_a] - 1) // 2

for i in range(M - 1, -1, -1):
    ans[i] = combi - count

    a, b = AB[i]
    union(a, b)

for temp in ans:
    print(temp)




Fixed submission:
import sys
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
ans = [0] * M

parent = [-1] * (N + 1)
size = [1] * (N + 1)
combi = N * (N - 1) // 2
count = 0

def get_parent(a):
    global parent
    temp = parent[a]
    if temp == -1:
        return a
    else:
        temp = get_parent(temp)
        parent[a] = temp
        return temp

def union(a, b):
    global count, size
    parent_a = get_parent(a)
    parent_b = get_parent(b)

    if parent_a != parent_b:
        parent[parent_b] = parent_a
        count -= size[parent_a] * (size[parent_a] - 1) // 2
        count -= size[parent_b] * (size[parent_b] - 1) // 2
        size[parent_a] += size[parent_b]
        count += size[parent_a] * (size[parent_a] - 1) // 2

for i in range(M - 1, -1, -1):
    ans[i] = combi - count

    a, b = AB[i]
    union(a, b)

for temp in ans:
    print(temp)
Buggy python submission (verdict: Runtime Error):
3
100000000 JPY
100.00000000 BTC
0.00000001 BTC

Fixed submission:
N = int(input())
ans = 0.0
for _ in range(N):
    x, u = input().split()
    if u == "JPY":
        ans += float(x)
    else:
        ans += float(x) * 380000.0
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

n = int(input())

xyh = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]

isOk = False
i = 0
j = 0
constant = -1

for i in range(101):
    for j in range(101):

        constant = -1
        for xyhTemp in xyh:
            if xyhTemp[2] != 0:
                temp = xyhTemp[2] + abs(i - xyhTemp[0]) + abs(j - xyhTemp[1])

                if constant == -1:
                    constant = temp

                if constant != temp:
                    break
        else:

            for p in xyh:
                if p[2] == 0 and constant - abs(i - p[0]) - abs(j - p[1]) > 0:
                    break
            else:
                isOk = True
                break
        
    if isOk:
        break

print(i, j, constant)
        


Fixed submission:
n = int(input())

if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)

Buggy python submission (verdict: Runtime Error):
n = int(input())

xyh = [list(map(int, input().split())) for _ in range(n)]

isOk = False
i = 0
j = 0
constant = -1

for i in range(101):
    for j in range(101):

        constant = -1
        for xyhTemp in xyh:
            if xyhTemp[2] != 0:
                temp = xyhTemp[2] + abs(i - xyhTemp[0]) + abs(j - xyhTemp[1])

                if constant == -1:
                    constant = temp

                if constant != temp:
                    break
        else:

            for p in xyh:
                if p[2] == 0 and constant - abs(i - p[0]) - abs(j - p[1]) > 0:
                    break
            else:
                isOk = True
                break
        
    if isOk:
        break

print(i, j, constant)
        


Fixed submission:
n = int(input())

if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)
Buggy python submission (verdict: Runtime Error):
n = int(input())

xyh = []

for i in range(n):
    xyh.append(list(map(int, input().split())))

isOk = False
i = 0
j = 0
constant = -1

for i in range(101):
    for j in range(101):

        constant = -1
        for xyhTemp in xyh:
            if xyhTemp[2] != 0:
                temp = xyhTemp[2] + abs(i - xyhTemp[0]) + abs(j - xyhTemp[1])

                if constant == -1:
                    constant = temp

                if constant != temp:
                    break
        else:

            for p in xyh:
                if p[2] == 0 and constant - abs(i - p[0]) - abs(j - p[1]) > 0:
                    break
            else:
                isOk = True
                break
        
    if isOk:
        break

print(i, j, constant)
        


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

ans = 100000
for i in range(N):
    c, t = list(map(int, input().split()))
    if t <= T and c <= ans:
        ans = c

if ans == 100000:
    print("TLE")
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))

sumList = [0] * n
sumList[0] = a[0] % m
number = {}

for i in range(1, n):
    sumList[i] = (sumList[i - 1] + a[i]) % m
    number[sumList[i]] = 0

for i in range(n):
    number[sumList[i]] += 1

ans = 0

for key, value in number.items():
    ans += value * (value - 1) // 2
    if key == 0:
        ans += value

print(ans)


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

sumList = [0] * n
sumList[0] = a[0] % m
number = {}
number[sumList[0]] = 0

for i in range(1, n):
    sumList[i] = (sumList[i - 1] + a[i]) % m
    number[sumList[i]] = 0

for i in range(n):
    number[sumList[i]] += 1

ans = 0

for key, value in number.items():
    ans += value * (value - 1) // 2
    if key == 0:
        ans += value

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

N, M = map(int, input().split())
ab = (tuple(map(int, line.split())) for line in sys.stdin.readlines())
ab.sort(key = lambda x : x[1])

ans = 0
last = -1
for a, b in ab:
    if a < last:
        continue
    else:
        ans += 1
        last = b

print(ans)

Fixed submission:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ab.sort(key = lambda x : x[1])

ans = 0
last = -1
for abTemp in ab:
    if abTemp[0] < last:
        continue
    else:
        ans += 1
        last = abTemp[1]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

l_dict = {}
r_dict = {}

for c in s:
	r_dict[c] = 0
	l_dict[c] = 0

for c in s:
	r_dict[c] += 1

ans = 0
for c in s:
	l_dict[c] += 1
	r_dict[c] -= 1

	count = 0
	for k, v in l_dict.items():
		if v > 0:
			if r_dict[k] > 0
				count += 1

	ans = max(ans, count)

print(ans)
	

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

l_dict = {}
r_dict = {}

for c in s:
	r_dict[c] = 0
	l_dict[c] = 0

for c in s:
	r_dict[c] += 1

ans = 0
for c in s:
	l_dict[c] += 1
	r_dict[c] -= 1

	count = 0
	for k, v in l_dict.items():
		if v > 0:
			if r_dict[k] > 0:
				count += 1

	ans = max(ans, count)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

count = 0

for i in range(n):
    temp = a[i]
    tempCount = 1

    j = i
    while j > 0:
        if temp & a[j - 1] != 0:
            count += tempCount
            break
        else:
            temp |= a[j - 1]
                
            tempCount += 1
            j -= 1
    else:
        count += tempCount

print(count)

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

r = 0
tempSum = 0
xor = 0
count = 0

for l in range(n):
    while r < n and (tempSum + a[r]) == (xor ^ a[r]):
        tempSum += a[r]
        xor ^= a[r]
        r += 1
    
    count += (r - l)

    tempSum -= a[l]
    xor ^= a[l]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
bit = [0] * 20

count = 0
l, r = 0, 0
isOk = True

while r < n:
    temp = a[r]
    r += 1

    bitCheck = 1
    for i in range(20):
        if (temp & bitCheck) > 0:
            bit[i] += 1

        if bit[i] >= 2:
            isOk = False
        
        bitCheck <<= 1
    
    if not isOk:
        while not isOk or l == r:
            isOk = True
            temp = a[l]
            l += 1
            bitCheck = 1
            for i in range(20):
                if (temp & bitCheck) > 0:
                    bit[i] -= 1

                if bit[i] >= 2:
                    isOk = False

                bitCheck <<= 1

    count += (r - l)

print(count)

    


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

r = 0
tempSum = 0
xor = 0
count = 0

for l in range(n):
    while r < n and (tempSum + a[r]) == (xor ^ a[r]):
        tempSum += a[r]
        xor ^= a[r]
        r += 1
    
    count += (r - l)

    tempSum -= a[l]
    xor ^= a[l]

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
bit = [0] * 20

count = 0
l, r = 0, 0
isOk = True

while r < n:
    temp = a[r]
    r += 1

    bitCheck = 1
    for i in range(20):
        if (temp & bitCheck) > 0:
            bit[i] += 1

        if bit[i] >= 2:
            isOk = False
        
        bitCheck <<= 1
    
    if not isOk:
        while not isOk:
            isOk = True
            temp = a[l]
            l += 1
            bitCheck = 1
            for i in range(20):
                if (temp & bitCheck) > 0:
                    bit[i] -= 1

                if bit[i] >= 2:
                    isOk = False

                bitCheck <<= 1

    count += (r - l)

print(count)

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

r = 0
tempSum = 0
xor = 0
count = 0

for l in range(n):
    while r < n and (tempSum + a[r]) == (xor ^ a[r]):
        tempSum += a[r]
        xor ^= a[r]
        r += 1
    
    count += (r - l)

    tempSum -= a[l]
    xor ^= a[l]

print(count)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
m = []
for i in range(n):
  m.append(int(input()))

x -= sum(m)
count = x // min(x) + n
print(count)

Fixed submission:
n, x = map(int, input().split())
m = []
for i in range(n):
  m.append(int(input()))

x -= sum(m)
count = x // min(m) + n
print(count)