Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N = int(input())

inf = float('inf')

import heapq
def dijkstra(adj, n, st=1):
    dj = [inf] * (n + 1)
    paths = dict((x, [x]) for x in range(n + 1))
    dj[st] = 0
    q = []
    heapq.heappush(q, (0, st))
    while q:
        fc, fn = heapq.heappop(q)
        if dj[fn] < fc: continue
        for tn, lc in adj[fn]:
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                paths[tn] = paths[fn] + [tn]
                heapq.heappush(q, (dj[tn], tn))
    return dj, paths

adj = dict((x, []) for x in range(N + 1))
for _ in range(N - 1):
    a, b = map(int, input().split())
    adj[a].append((b, 1))
    adj[b].append((a, 1))

costs, paths = dijkstra(adj, N, 1)
main_street = paths[N]
import math
mid = math.ceil(len(main_street) / 2) - 1
mid_v0 = main_street[mid]
mid_v1 = main_street[mid + 1]
adj[mid_v0] = filter(lambda x: x[0] != mid_v1, adj[mid_v0])
adj[mid_v1] = filter(lambda x: x[0] != mid_v0, adj[mid_v1])

snuke = dijkstra(adj, N, 1)[0].count(inf)
fennec = dijkstra(adj, N, N)[0].count(inf)

print("Fennec" if fennec > snuke else "Snuke")

### FIXED CODE ###

N = int(input())

inf = float('inf')

import heapq
def dijkstra(adj, n, st=1):
    dj = [inf] * (n + 1)
    dj[st] = 0
    q = []
    heapq.heappush(q, (0, st))
    while q:
        fc, fn = heapq.heappop(q)
        if dj[fn] < fc: continue
        for tn, lc in adj[fn]:
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                heapq.heappush(q, (dj[tn], tn))
    return dj

adj = dict((x, []) for x in range(N + 1))
for _ in range(N - 1):
    a, b = map(int, input().split())
    adj[a].append((b, 1))
    adj[b].append((a, 1))

c_f = dijkstra(adj, N, 1)
c_s = dijkstra(adj, N, N)

score = 0
for i in range(1, N + 1):
    if c_f[i] > c_s[i]:
        score -= 1
    else:
        score += 1

print("Fennec" if score > 0 else "Snuke")
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1, max(a) + 1):
    temp = a.count(i)
    if temp > i:
        ans += temp - i
    elif temp < i:
        ans += temp

print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
dic = {}
for i in a:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1
ans = 0
for k, v in dic.items():
    if k > v:
        ans += v
    elif k < v:
        ans += v-k

print(ans)
### BUGGY CODE ###

n = int(input())
A = [list(map(int, input().split())) for i in range(n)]
A = [[j for j in range(n) if A[i][j]] for i in range(n)]
p = 10**9+7
DP = [0 for s in range(1 << n)]
DP[0] = 1
for s in range(1, 1 << n):
    l = bin(s).count('1')
    for i in A[l-1]:
        if (1 << i) & s:
            DP[s] = (DP[s]+DP[~(1 << i) & s]) % p
print(DP[(1 << n)-1])


### FIXED CODE ###

def main():
    n = int(input())
    A = [list(map(int, input().split())) for i in range(n)]
    p = 10**9+7
    DP = [0 for s in range(1 << n)]
    DP[0] = 1
    for s in range(1, 1 << n):
        l = bin(s).count('1')
        for i in range(n):
            if ((1 << i) & s) * A[l-1][i]:
                DP[s] += DP[~(1 << i) & s]
    print(DP[(1 << n)-1] % p)


main()
### BUGGY CODE ###

from collections import defaultdict
import math

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

MOD = 10 ** 9 + 7

primes = defaultdict(int)

for a in A:
    x = a
    p = 2
    for p in range(2, int(math.sqrt(a)) + 1):
        cnt = 0
        while x % p == 0:
            x //= p
            cnt += 1
        primes[p] = max(primes[p], cnt)
    if x > 1:
        primes[x] = max(primes[x], 1)

l = 1
for p in primes:
    l = (l * pow(p, primes[p], MOD)) % MOD

res = 0
for a in A:
    res = (res + (l * pow(a, MOD - 2, MOD) % MOD)) % MOD

print(res)


### FIXED CODE ###

from fractions import gcd
import sys

input = sys.stdin.readline

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

MOD = 10 ** 9 + 7


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


l = A[0]
for a in A:
    l = lcm(l, a)

res = 0
for a in A:
    res = (res + (l * pow(a, MOD - 2, MOD)) % MOD) % MOD
    # res = (res + l // a) % MOD

print(res)
### BUGGY CODE ###

#C - Build Stairs
N=int(input())
H=list(map(int, input().split()))
t=True
for i in range(1,N+1):
    M=max(H[:i])
    M_i=H.index(M)
    if M>min(H[M_i:])+1:
        print("No")
        t=False
        break
if t:
    print("Yes")

### FIXED CODE ###

#C - Build Stairs
N=int(input())
H=list(map(int, input().split()))
t=True
M=H[0]
for i in range(1,N):
    if M<H[i]:
        M=H[i]
    if M>H[i]+1:
        print("No")
        t=False
        break
if t:
    print("Yes")
### BUGGY CODE ###

import numpy as np
import sys

N, K = map(int, input().split())
K2 = K * 2

Mij = np.zeros((K2 + 1, K2 + 1), dtype=int)

diff = [
    [-2, 0],
    [-1, -1],
    [-1, 1],
    [0, 0],
    [1, -1],
    [1, 1],
]

def imos(i, j, i2, j2):
    Mij[i][j] += 1
    Mij[i2][j] -= 1
    Mij[i][j2] -= 1
    Mij[i2][j2] += 1

for _ in range(N):
    i, j, s = sys.stdin.readline().split()
    i = int(i) % K2
    j = int(j) % K2
    if s == "B":
        i = (i + K) % K2

    for y, x in diff:
        di = y * K
        dj = x * K
        i1 = max(i + di, 0)
        j1 = max(j + dj, 0)
        i2 = min(i + di + K, K2)
        j2 = min(j + dj + K, K2)
        if i1 >= K2 or j1 >= K2 or i2 <= 0 or j2 <= 0:
            continue
        imos(i1, j1, i2, j2)

# 累積和
for i in range(K2):
    Mij[i + 1, :] += Mij[i, :]
for j in range(K2):
    Mij[:, j + 1] += Mij[:, j]

print(Mij.max())

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
K2 = 2 * K
Mij = [[0 for _ in range(K2 + 1)] for _ in range(K2 + 1)]


def imos(x1, y1, x2, y2):
    Mij[y1][x1] += 1
    Mij[y2][x2] += 1
    Mij[y2][x1] -= 1
    Mij[y1][x2] -= 1

for _ in range(N):
    ls = input().split()
    x = int(ls[0]) % K2
    y = int(ls[1]) % K2
    if ls[2] == "B":
        y = (y + K) % K2
    x_ = x % K
    y_ = y % K

    if (x < K and y < K) or (K <= x and K <= y):
        imos(0, 0, x_ + 1, y_ + 1)
        imos(x_ + K + 1, 0, K2, y_ + 1)
        imos(0, y_ + K + 1, x_ + 1, K2)
        imos(x_ + K + 1, y_ + K + 1, K2, K2)
        imos(x_ + 1, y_ + 1, x_ + K + 1, y_ + K + 1)
    else:
        imos(x_ + 1, 0, x_ + K + 1, y_ + 1)
        imos(x_ + 1, y_ + K + 1, x_ + K + 1, K2)
        imos(0, y_ + 1, x_ + 1, y_ + K + 1)
        imos(x_ + K + 1, y_ + 1, K2, y_ + K + 1)

Mij = np.array(Mij)
for x in range(K2):
    Mij[:, x + 1] += Mij[:, x]
for y in range(K2):
    Mij[y + 1, :] += Mij[y, :]

print(Mij.max())
### BUGGY CODE ###

from collections import Counter
N = int(input())
S = input()
#c = Counter(S)
#print (c.most_common())
#ls = list(c.values())
ans = S.count('R') * S.count('G') * S.count('B')


for i in range(N):
    for j in range(1,N):
        a = i + j
        b = i + j + j
        if (b >= N):
            pass
        else:
            l = S[i]
            m = S[a]
            r = S[b]
            if l!=m and m!=r and r!=l:
                ans -= 1
        # if (i-j<0 or i+j>=N):
        #     break
        # l = S[i-j]
        # m = S[i]
        # r = S[i+j]
        # if l!=m and m!=r and r!=l:
        #     ans -= 1
print (ans)


### FIXED CODE ###

from collections import Counter
N = int(input())
S = input()
#c = Counter(S)
#print (c.most_common())
#ls = list(c.values())
ans = S.count('R') * S.count('G') * S.count('B')


for i in range(N):
    for j in range(1,N):
        if (i-j<0 or i+j>=N):
            break
        #print (i,j)
        #s = set([S[i-j],S[i],S[i+j]])
        l = S[i-j]
        m = S[i]
        r = S[i+j]

        if l!=m and m!=r and r!=l:
            ans -= 1
        # if len(s)==3:
        #     ans -= 1
print (ans)
### BUGGY CODE ###

#!/usr/bin/env python3
# 方針は分かったのでヨシ！バチャやって実装力つけたい
INF = float("inf")
import sys
input = sys.stdin.readline
from collections import*

def bfs():
    q = deque([(sx, sy)])
    dist = [[INF]*W for _ in range(H)]
    dist[sx][sy] = 0
    
    while q:
        x, y = q.popleft()
        if (x, y) == (gx, gy): return dist[gx][gy]
        for nx, ny in [(x-1, y), (x+1, y), (x, y-1), (x, y+1)]:
            if 0<=nx<H and 0<=ny<W and dist[nx][ny] > dist[x][y]:
                if c[nx][ny] == ".":
                    dist[nx][ny] = dist[x][y]
                    q.appendleft((nx, ny))
        for nx in range(x-2, x+3):
            for ny in range(y-2, y+3):
                if 0<=nx<H and 0<=ny<W and dist[nx][ny] > dist[x][y]:
                    if c[nx][ny] == ".":
                        dist[nx][ny] = dist[x][y] + 1
                        q.append((nx, ny)) 
    return -1
H, W = map(int, input().split())

cx, cy = map(int, input().split()); sx, sy = cx - 1, cy - 1
dx, dy = map(int, input().split()); gx, gy = dx - 1, dy - 1
c = [input()[:-1] for _ in range(H)]
ans = bfs()
print(ans if ans != INF else -1)


### FIXED CODE ###

#!/usr/bin/env python3
INF = 10**7
import sys
input = sys.stdin.readline
from collections import*

def bfs():
    q = deque([(sx, sy)])
    dist = [[INF] * W for _ in range(H)]
    dist[sx][sy] = 0
    
    while q:
        x, y = q.popleft()
        b = dist[x][y]
        if (x, y) == (gx, gy):
            return b
        for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
            nx, ny = x + dx, y + dy
            if 0 <= nx < H and 0 <= ny < W and dist[nx][ny] > b and c[nx][ny] == ".":
                dist[nx][ny] = b
                q.appendleft((nx, ny))
        B = b + 1
        for dx in range(-2, 3):
            for dy in range(-2, 3):
                nx, ny = x + dx, y + dy
                if 0 <= nx < H and 0 <= ny < W and dist[nx][ny] > B and c[nx][ny] == ".":
                    dist[nx][ny] = B
                    q.append((nx, ny)) 
    return -1

H, W = map(int, input().split())
cx, cy = map(int, input().split())
dx, dy = map(int, input().split())
sx, sy, gx, gy = cx - 1, cy - 1, dx - 1, dy - 1
c = [input()[:-1] for _ in range(H)]
ans = bfs()
print(ans if ans != INF else -1)
### BUGGY CODE ###

s=input()

k = 10**100
logk = k.bit_length()
lens = len(s)
doubling = [[0]*lens for _ in range(logk)]

for i in range(lens):
  if s[i] == 'R':
    doubling[0][i] = i + 1
  else:
    doubling[0][i] = i - 1

for i in range(1,logk):
  for j in range(lens):
    doubling[i][j] = doubling[i-1][doubling[i-1][j]]

for i in range(lens):
  print(doubling[logk-1].count(i))


### FIXED CODE ###

s=input()

logk = (10**100).bit_length()
lens = len(s)
logs = lens.bit_length()
doubling = [[0]*lens for _ in range(logk)]

for i in range(lens):
  if s[i] == 'R':
    doubling[0][i] = i + 1
  else:
    doubling[0][i] = i - 1

for i in range(1,logk):
  for j in range(lens):
    doubling[i][j] = doubling[i-1][doubling[i-1][j]]

from collections import Counter
result = Counter(doubling[logk-1])
for i in range(lens):
  print(result[i])
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
number = []

for i in range(N):
  n = A.count(i)
  number.append(n)

del number[0]
number.append(0)
for Answer in number:
  print(Answer)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
number = []
for i in range(N):
  number.append(0)

for i in range(N-1):
  n = A[i-1]*1
  number[n] = number[n] + 1

del number[0]
number.append(0)
for Answer in number:
  print(Answer)
### BUGGY CODE ###

import math

def isPrime(num):
    if num < 2:
        return False
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False

    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False
    return True


def find_all_prime(num):
    prime_list = [2]
    for i in range(3, num, 2):
        if isPrime(i):
            prime_list.append(i)

    return prime_list


if __name__ == "__main__":
    N = int(input())
    if isPrime(N):
        print(1)
    else:      
        prime_list = find_all_prime(2*10**6)
        count = 0  
        for i in prime_list:
            j = 1
            while N > 1:
                if N // i**j == 0:
                    break
                if N % i**j == 0:
                    N = N // i**j
                    count += 1
                j +=1
        
        print(count)

### FIXED CODE ###

def factorization(n):
    factorization_list = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            count = 0
            while temp % i == 0:
                count += 1
                temp //= i
            factorization_list.append([i, count])

    if temp != 1:
        factorization_list.append([temp, 1])

    if factorization_list==[]:
        factorization_list.append([n, 1])

    return factorization_list


if __name__ == "__main__":
    N = int(input())

    if N == 1:
        print(0)

    else:
        factorization_list = factorization(N)
        count = 0
        for factor in factorization_list:
            e = factor[1]
            i = 1
            while True:
                e -= i
                i += 1
                count += 1
                if e < i:
                    break
        print(count)
### BUGGY CODE ###

import sys

def is_ok(mid, gen=None, diff=0):
    print(mid, flush=True)
    res = input()
    if res == "Vacant":
        sys.exit()
    if gen is None:
        return res
    if diff % 2 == 0:
        return gen == res
    else:
        return gen != res


def meguru_bisect_kai(ng, ok, gen):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, gen, ok - mid):
            ok = mid
        else:
            ng = mid
            if gen == "Male":
                gen = "Female"
            else:
                gen = "Male"
    return ok


n = int(input())
gen = is_ok(0)
is_ok(n - 1)
meguru_bisect_kai(0, n - 1, gen)

### FIXED CODE ###

n = int(input())

print(0, flush=True)
res = input()
if res == "Vacant":
    exit()

left = 0
right = n
gen = res


while True:
    mid = (left + right) // 2
    print(mid, flush=True)
    res = input()

    if res == "Vacant":
        exit()

    if gen == res:
        if (mid - left) % 2:
            right = mid
        else:
            left = mid
    else:
        if (mid - left) % 2:
            left = mid
            gen = res
        else:
            right = mid
### BUGGY CODE ###

a,b,c,d = map(int,input().split())
total = b-a+1

def count(x):
    flag = False
    if x>b:
        x_count = 0
    else:
        for i in range(a,b+1):
            if i%x==0:
                x_begininng = i-a
                flag = True
                break
        else:
            x_count = 0

        if flag:
            x_count = 1 + (b-a-x_begininng)//x

    return x_count

def lcd(x,y):
    x,y = sorted([x,y])

    if x==1:
        gcd = 1
    elif x>1:
        gcd = 1
        for i in range(2,x+1):
            if x%i==0:
                if y%i==0:
                    gcd = i

    x_tmp = x//gcd
    y_tmp = y//gcd
    lcd = (gcd*x_tmp*y_tmp)

    return lcd


cd_count = count(c)+count(d)-count(lcd(c,d))
answer = (total-cd_count)

print(answer)

### FIXED CODE ###

import fractions

a,b,c,d = map(int,input().split())
total = b-a+1

def count(x):
    if x>b:
        x_count = 0
    elif x<a:
        if a%x==0:
            tmp = 1
        else:
            tmp = 0

        x_count = (b-x)//x - (a-x)//x +tmp

    else:
        x_count = 1 + (b-x)//x

    return x_count

def lcd(x,y):
    return(x*y//fractions.gcd(x,y))

cd_count  = count(c)+count(d)-count(lcd(c,d))
answer = total-cd_count

print(answer)
### BUGGY CODE ###

N = int(input())
al = list(map(int,input().split()))
sss=0
for i in range(N):
    sss+=(sum(al[0:i])%1000000007)*al[i]
print(sss%1000000007)

### FIXED CODE ###

N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()
sl = len(s)
ac_cnts = []
for i in range(1, sl+1):
    ac_cnts.append(len(s[:i].split('AC'))-1)
for i in range(q):
    l, r = map(int, input().split())
    print(ac_cnts[r-1]-ac_cnts[l-1])

### FIXED CODE ###

n, q = map(int, input().split())
s = input()
sl = len(s)
ac_cnts = [0]
cnt = 0
for i in range(0, sl-1):
    if s[i] == 'A' and s[i+1] == 'C':
        cnt += 1
    ac_cnts.append(cnt)
for i in range(q):
    l, r = map(int, input().split())
    print(ac_cnts[r-1]-ac_cnts[l-1])
### BUGGY CODE ###

n = int(input())
li_t = list()

for _ in range(n):
    li_t.append(int(input()))

li_sorted = sorted(li_t, reverse=True)
t_max = li_sorted.pop(0)


sec = 1
while(True):
    if all(map(lambda x: (t_max * sec) % x == 0, li_sorted)):
        print(sec * t_max)
        exit(0)
    else:
        sec += 1




### FIXED CODE ###

from fractions import gcd


n = int(input())
li_t = list()

for _ in range(n):
    li_t.append(int(input()))

# a * b = 最小公倍数 * 最大公約数


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

work = 1

for t in li_t:
    work = lcm(work, t)

print(work)
### BUGGY CODE ###

def main():
    H = int(input())
    n = 0
    ans = 0
    a = 1
    while a == 1:
        H = H // 2
        ans = ans + 2 ** n
        n += 1
        if H == 1:
            ans = ans + 2 ** n
            break
    print(ans)
main()


### FIXED CODE ###

def main():
    H = int(input())
    n = 1
    ans = 0
    a = 1
    while H != 1:
        H = H // 2
        n += 1
    print(2 ** n - 1)
main()
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 10**9+7
for i in range(60):
  j = 2**i
  cnt = 0
  for k in a:
    if j == k&j:
      cnt += 1
  ans += j*cnt*(len(a)-cnt)
  ans %= mod
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
mod = 10**9+7
for i in range(60):
  j = 1<<i
  cnt = sum((k & j) >> i for k in a)
  ans += (cnt*(n-cnt))<<i
  ans%= mod
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
#ABC147 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
a = [LI() for _ in range(h)]
b = [LI() for _ in range(h)]

dp = [[set() for _ in range(w)] for _ in range(h)]
dp[0][0].add((a[0][0],b[0][0]))
dp[0][0].add((b[0][0],a[0][0]))
for i in range(h):
    for j in range(w):
        for (k,l) in dp[i][j]:
            if i+1 < h:
                dp[i+1][j].add((k+a[i+1][j],l+b[i+1][j]))
                dp[i+1][j].add((k+b[i+1][j],l+a[i+1][j]))
            if j+1 < w:
                dp[i][j+1].add((k+a[i][j+1],l+b[i][j+1]))
                dp[i][j+1].add((k+b[i][j+1],l+a[i][j+1]))
ans = inf
for (i,j) in dp[-1][-1]:
    ans = min(ans,abs(i-j))
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC147 E

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h,w = LI()
a = [LI() for _ in range(h)]
b = [LI() for _ in range(h)]

dp = [[0 for _ in range(w)] for _ in range(h)]
lst = [[0]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        lst[i][j] = abs(a[i][j] - b[i][j])

dp[0][0] |= 1 << (6400+lst[0][0])
dp[0][0] |= 1 << (6400-lst[0][0])
for i in range(h):
    for j in range(w):
        t = dp[i][j]
        if i+1 < h:
            dp[i+1][j] |= t << lst[i+1][j]
            dp[i+1][j] |= t >> lst[i+1][j]
        if j+1 < w:
            dp[i][j+1] |= t << lst[i][j+1]
            dp[i][j+1] |= t >> lst[i][j+1]

x = dp[-1][-1]
for i in range(6401)[::-1]:
    if (x >> i) & 1:
        print(6400 - i)
        break
### BUGGY CODE ###

import sys

input = sys.stdin.readline
n,m = map(int, input().split())
A = list(map(int,input().split()))

for i in range(m):
    A.sort()
    b,c = map(int, input().split())
    if A[0] < c:
        for i in range(n):
            if A[i] < c and i < b:
                A[i] = c
            else:
                break


print(sum(A))


### FIXED CODE ###

import sys
import heapq

input = sys.stdin.readline
n,m = map(int, input().split())
A = list(map(int,input().split()))
d = [list(map(int,input().split())) for _ in range(m)]

d.sort(key=lambda x:-x[1])
total = sum(A)
heapq.heapify(A)

for i in range(m):
    for j in range(d[i][0]):
        tmp = heapq.heappushpop(A, d[i][1])
        if tmp < d[i][1]:
                total += (d[i][1] - tmp)
        else:
            break

print(total)
### BUGGY CODE ###

A=[['R','G','B'],['R','B','G'],['B','R','G'],['B','G','R'],['G','R','B'],['G','B','R']]
m=int(input())
N=input()
cnt=0
for i in range(6):
  for j in range(m):
    if N[j]==A[i][0]:
      for k in range(j+1,m):
        if N[k]==A[i][1]:
          for l in range(k+1,m):
            if N[l] == A[i][2]:
              if l-k != k-j:
                cnt+=1
print(cnt)
              

### FIXED CODE ###

m=int(input())
N=input()
cnt=N.count('R')*N.count('G')*N.count('B')
#print(cnt)
for i in range(m-2):
  #print(i,'*',int((m+i)/2))
  for j in range(i+1,int((m+i-1)/2)+1):
    k=2*j-i
    #print(i,j,k)
    if N[k] != N[j] and N[j] != N[i] and N[i] != N[k]:
      #print(i,j,k)
      cnt-=1
print(cnt)
### BUGGY CODE ###

n=int(input())
a=[int(i) for i in input().split()]
a.sort(reverse=True)
s=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if a[j]+a[k]>a[i]:
                s+=1
            else:
                break
print(s)
        

### FIXED CODE ###

n=int(input())
a=[int(i) for i in input().split()]
a.sort(reverse=True)
l=len(a)
ans=0
for i in range(l-2):
    e=l-1
    for j in range(i+1,l-1):
        if e<=j:
            break
        while a[i]-a[j]>=a[e] and e>j:
            ans+=(e-j)
            e-=1
ans=(n*(n-1)*(n-2))//6-ans
print(ans)