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

import sys


def Sieve(N, AList):
    AList.sort()
    N_NotDivisible = 0
    while( len(AList) > 0 ):
        if(len(AList) > 1):
            if(AList[0]!= AList[1]):
                N_NotDivisible+= 1
                value = AList[0]
                AList.pop(0)
                AList = [ i for i in AList if i % value != 0 ]
            else:
                indices_last = [i for i, x in enumerate(AList) if x == AList[0] ]
                Times = indices_last[-1]+1
                for i in range(Times):
                    AList.pop(0)

        else:
            N_NotDivisible+= 1
            break
    #print(Mins)
    return N_NotDivisible

if(__name__ == "__main__"):

    N = int( input().strip() )
    AList_str = input().strip().split()

    AList = [0] * N
    for i in range(N):
        AList[i] = int(AList_str[i])
    N_NotDivisible= Sieve(N, AList)
    print(N_NotDivisible)


### FIXED CODE ###

import sys

def Sieve2(N, AList, Bools, Max_A):
    N_NotDivisible = 0
    value = 0
    for i in range(N):
        if(AList[i]>value):
            value = AList[i]
            if(Bools[value]==True):
                N_NotDivisible += 1

            for j in range(2, Max_A//value+1, 1 ):
                Bools[j*value] = False
    #print(Mins)
    return N_NotDivisible


if(__name__ == "__main__"):

    N = int( input().strip() )
    AList_str = input().strip().split()
    Max = 0
    AList = [0] * N
    for i in range(N):
        AList[i] = int(AList_str[i])
        Max = max(AList[i], Max)
    Bools = [False] * (Max+1)
    AList.sort()
    Dups = []
    for Num in range(N):
        value = AList[Num]
        Bools[value] = True
        if(Num < N-1 and AList[Num] == AList[Num+1]):
            Dups.append(value)
    for Num in range(len(Dups)):
        value = Dups[Num]
        Bools[value] = False


    N_NotDivisible= Sieve2(N, AList, Bools, Max)
    print(N_NotDivisible)
### BUGGY CODE ###

x,n = list(map(int,input().split()))
while x >= n:
    x -= n
print(min(x,n-x))

### FIXED CODE ###

x,n = list(map(int,input().split()))
x = x % n
print(min(x,n-x))
### BUGGY CODE ###

MOD = 10**9 + 7
N, M = map(int, input().split())
S = [[N+1]*(N+1) for i in [0,1,2]]
T = [[0]*(N+1) for i in [0,1,2]]

C = [0]*(N+1)
for i in range(M):
    l, r, x = map(int, input().split())
    S[x-1][r] = min(S[x-1][r], l)
    T[x-1][r] = max(T[x-1][r], l)
    C[r] = 1

S0, S1, S2 = S
T0, T1, T2 = T

ok = 1
for i in range(N+1):
    if not T2[i] < S1[i] or not T1[i] < S0[i]:
        ok = 0
        break

if not ok:
    print(0)
    exit(0)

RM = [N+1]*(N+1); GM = [N+1]*(N+1)
for i in range(N-1, -1, -1):
    RM[i] = min(RM[i+1], S1[i+1])
    GM[i] = min(GM[i+1], S0[i+1])


X = {(0, 0): 3}
R = [0]*(N+1); R[0] = 3
G = [0]*(N+1); G[0] = 3
for b in range(1, N):
    t2 = T2[b+1]; s1 = S1[b+1]; t1 = T1[b+1]; s0 = S0[b+1]
    check = lambda r, g: t2 <= r < s1 and t1 <= g < s0

    if C[b+1]:
        Z = [0]*(N+1)
        if t1 <= b < s0:
            for z in range(t2, s1):
                Z[z] = R[z] + G[z]
        for (r, g), v in X.items():
            if not t2 <= r < s1 or not t1 <= g < s0:
                R[r] -= v
                G[g] -= v
        X = {(r, g): v for (r, g), v in X.items() if t2 <= r < s1 and t1 <= g < s0}
    else:
        Z = [R[z] + G[z] for z in range(N+1)]
    if b < GM[b]:
        rm = RM[b]
        for z, v in enumerate(Z):
            if v and z < rm:
                v %= MOD
                X[z, b] = v
                R[z] += v
                G[b] += v
print(sum(X.values()) % MOD)


### FIXED CODE ###

MOD = 10**9 + 7
N, M = map(int, input().split())
S = [[N]*(N+1) for i in [0,1,2]]
T = [[0]*(N+1) for i in [0,1,2]]

C = [0]*(N+1)
for i in range(M):
    l, r, x = map(int, input().split())
    S[x-1][r] = min(S[x-1][r], l)
    T[x-1][r] = max(T[x-1][r], l)
    C[r] = 1

S0, S1, S2 = S
T0, T1, T2 = T

ok = 1
for i in range(N+1):
    if not T2[i] < S1[i] or not T1[i] < S0[i]:
        ok = 0
        break

if not ok:
    print(0)
    exit(0)


X = {(0, 0): 3}
for b in range(1, N):
    t2 = T2[b+1]; s1 = S1[b+1]; t1 = T1[b+1]; s0 = S0[b+1]
    check = lambda r, g: t2 <= r < s1 and t1 <= g < s0

    Z = [0]*(N+1)
    if C[b+1]:
        if t1 <= b < s0:
            for (r, g), v in X.items():
                if t2 <= g < s1:
                    # r <- b+1
                    Z[g] += v
                if t2 <= r < s1:
                    # g <- b+1
                    Z[r] += v
        X = {(r, g): v for (r, g), v in X.items() if t2 <= r < s1 and t1 <= g < s0}
    else:
        Z = [0]*(N+1)
        for (r, g), v in X.items():
            # r <- b+1
            Z[g] += v
            # g <- b+1
            Z[r] += v;
    for z, v in enumerate(Z):
        if v:
            X[z, b] = v % MOD
print(sum(X.values()) % MOD)
### BUGGY CODE ###

#inport
import sys
import numpy as np

#input
N,M = map(int, sys.stdin.readline().split())
P = [list(map(int, sys.stdin.readline().split())) for i in range(M)]

#shori
##初期化
P = np.array(P)     
ans = np.zeros((N,2))
tmp_latest = np.zeros(1)
tmp_latest_tmp = np.zeros(1)
tmp_latest[0] = 1
pos_latest = 0
num_latest = 1
ans[0][1] = 1 #部屋1をてがかりありに
flg_pos = 1
flg_fale = 0
num_crew = 1
num_left_room = N-1
left_room = np.zeros(N)

for i in range(N):
    ans[i][0] = i + 1

while num_crew < N:
    if flg_pos == 0:
        flg_fale = 1
        break

    flg_pos = 0
    for i in range(num_latest):
        tmp_room_num = tmp_latest[i]
        tmp_root = P[np.any( P == int(tmp_room_num), axis = 1)]
        root_loop_n = int(np.size(tmp_root)/2)
        for j in range(root_loop_n):
            if tmp_root[j][0]==tmp_latest[i]:
                if(ans[tmp_root[j][1]-1][1]==0):
                    tmp_latest_tmp = np.insert(tmp_latest_tmp, 0, tmp_root[j][1])
                    ans[tmp_root[j][1]-1][1] = tmp_latest[i]
                    num_crew = num_crew + 1
                    flg_pos = 1
            elif tmp_root[j][1]==tmp_latest[i]:
                if(ans[tmp_root[j][0]-1][1]==0):
                    tmp_latest_tmp = np.insert(tmp_latest_tmp, 0, tmp_root[j][0])
                    ans[tmp_root[j][0]-1][1] = tmp_latest[i]
                    num_crew = num_crew + 1
                    flg_pos = 1               
        P = np.delete(P, np.where(P == int(tmp_room_num))[0], axis = 0)

    #Nループ終了時にtmp_latestを更新
    tmp_latest = np.insert(tmp_latest, num_latest, tmp_latest_tmp)
    for j in range(num_latest):
        tmp_latest = np.delete(tmp_latest,0)
    num_latest = np.size(tmp_latest)
    tmp_latest_tmp = np.zeros(1)

    
if flg_fale == 0:
    print('Yes')
    for i in range(N-1):
        print(int(ans[i+1][1]))
else:
    print('No')


### FIXED CODE ###

#inport
import sys
import numpy as np
from collections import deque


#input
N,M = [int(x) for x in sys.stdin.readline().split()]
g = [[] for _ in range(N+1)]

for _ in range(M):
    a, b = [int(x) for x in sys.stdin.readline().split()]
    g[a].append(b)
    g[b].append(a)



quetmp = deque([1])
d = [None] * (N+1)
d[1] = 0
num_crew = 1
while quetmp:
    v = quetmp.popleft()
    for i in g[v]:
        if d[i] is None:
            d[i] = v
            quetmp.append(i)
            num_crew = num_crew + 1

if num_crew == N:
    print('Yes')
    for i in range(N-1):
        print(d[i+2])
else:
    print('No')
### BUGGY CODE ###

def main():
    n = int(input())
    ans = 0
    cnt = [[[0]*80 for j in range(80)] for i in range(20)]
    for _ in range(n):
        a = list(map(str, input().split(".")))
        x = 0
        if len(a) == 1:
            x = int(a[0]) * 10**9
        else:
            x = int(a[0]) * 10**9 + int(a[1]) * pow(10, 9-len(a[1]))
        cnt_10, cnt_2, cnt_5 = 0, 0, 0
        while x % 10 == 0:
            cnt_10 += 1
            x //= 10
        while x % 2 == 0:
            cnt_2 += 1
            x //= 2
        while x % 5 == 0:
            cnt_5 += 1
            x //= 5
        for i in range(20):
            if i + cnt_10 >= 18:
                for j in range(80):
                    ans += sum(cnt[i][j])
            else:
                p = 18 - cnt_10 - i
                if cnt_2 >= p:
                    for j in range(p, 80):
                        ans += cnt[i][0][j]
                if cnt_5 >= p:
                    for j in range(p, 80):
                        ans += cnt[i][j][0]
        cnt[cnt_10][cnt_2][cnt_5] += 1
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
ans = 0
cnt = [[0]*20 for _ in range(45)]
for _ in range(n):
    a = list(map(str, input().rstrip().split(".")))
    x = 0
    if len(a) == 1:
        x = int(a[0]) * 10**9
    else:
        x = int(a[0]) * 10**9 + int(a[1]) * pow(10, 9-len(a[1]))
    cnt_2, cnt_5 = 0, 0
    while x % 2 == 0:
        cnt_2 += 1
        x //= 2
    while x % 5 == 0:
        cnt_5 += 1
        x //= 5
    for i in range(45):
        for j in range(20):
            if cnt_2 + i >= 18 and cnt_5 + j >= 18:
                ans += cnt[i][j]
    cnt[cnt_2][cnt_5] += 1
print(ans)
### BUGGY CODE ###

import numpy as np

h,w = map(int, input().split())
s = (np.array([input() for _ in range(h)]))
ans = [list() for i in range(h)]
for key_i,i in enumerate(s):
  m = 0
  for j in i:
    if j == ".":
      m += 1
    else:
      for k in range(m):
        ans[key_i].append(m)
      m = 0
      ans[key_i].append(m)
  for k in range(m):
    ans[key_i].append(m)

ans = np.array(ans)
ans = ans.T
ans2 = [list() for i in range(w)]
for key_i,i in enumerate(ans):
  m = 0
  for j in i:
    if j:
      m += 1
    else:
      for k in range(m):
        ans2[key_i].append(m)
      m = 0
      ans2[key_i].append(m)
  for k in range(m):
    ans2[key_i].append(m)
ans2 = np.array(ans2)
print(np.max(ans + ans2) - 1)

### FIXED CODE ###

import numpy as np 
H, W = map(int, input().split())
S = (np.array([list(input()) for _ in range(H)]) == '.')
 

up = np.zeros((H, W), dtype=int)
down = np.zeros((H, W), dtype=int)
left = np.zeros((H, W), dtype=int)
right = np.zeros((H, W), dtype=int)
 
for i in range(H):
    up[i] = (up[i-1] + 1) * S[i]
    down[-i-1] = (down[-i] + 1) * S[-i-1]
    
for i in range(W):
    left[:, i] = (left[:, i-1] + 1) * S[:, i]
    right[:, -i-1] = (right[:, -i] + 1) * S[:, -i-1]

print(np.max(up+down+left+right) - 3)
### BUGGY CODE ###

n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
for i in range(n):
    y=[]
    for j in range(n):
        if j!=i:
            y.append(x[j])
    y.sort()
    print(y[N-1])

### FIXED CODE ###

n=int(input())
x=list(map(int,input().split()))
N=int(n/2)
y=sorted(x)
a=y[N-1]
b=y[N]
for j in range(n):
    if x[j]<=a:
        print(b)
    else:
        print(a)
### BUGGY CODE ###

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

for i in range(min(41, k)):
    t = [0] * (n+1)
    for j in range(n):
        t[max(0, j-a[j])] += 1
        t[min(j+a[j]+1, n)] -= 1

    for j in range(1, n):
        t[j] += t[j-1]
    a = t[:n]

print(*a)

### FIXED CODE ###

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

for i in range(min(41, k)):
    t = [0] * (n+1)
    for j in range(n):
        t[max(0, j-a[j])] += 1
        t[min(j+a[j]+1, n)] -= 1

    for j in range(1, n):
        t[j] += t[j-1]
    a = t[:n]

print(*a)
### BUGGY CODE ###

def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()

from math import factorial
def comb(n):
    if n<=1:
        return 0
    if n==2:
        return 1
    return factorial(n)//(factorial(2)*factorial(n-2))

from collections import Counter
c=Counter(a)
d={i:comb(j) for i,j in c.items()}
s=sum(d.values())

for i in a:
    print(s-d[i]+comb(c[i]-1))

### FIXED CODE ###

def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()

def comb(n):
    if n<=1:
        return 0
    if n==2:
        return 1
    return (n*(n-1))//2

from collections import Counter
c=Counter(a)
# print(c)
d={i:comb(j) for i,j in c.items()}
# print(d)
s=sum(d.values())
# print(s)

for i in a:
    print(s-d[i]+comb(c[i]-1))
### BUGGY CODE ###


import heapq
x, y, z, k = [ int(v) for v in input().split() ]
x_list = sorted([ int(v) for v in input().split() ], reverse = True)
y_list = sorted([ int(v) for v in input().split() ], reverse = True)
z_list = sorted([ int(v) for v in input().split() ], reverse = True)
check_list = [ [ [ False for i in range(x) ] for j in range(y) ]  for l in range(z)]
cake_list = []
def maling_cake(a,b,c):
    d = x_list[a]+y_list[b]+z_list[c]
    return (-d,a,b,c)


for i in range(k):
    if i == 0:
        print(-maling_cake(0,0,0)[0])
        check_list[0][0][0] = True
        if x > 1: 
            heapq.heappush(cake_list, maling_cake(1,0,0))
            check_list[1][0][0] = True
        if y > 1: 
            heapq.heappush(cake_list, maling_cake(0,1,0))
            check_list[0][1][0] = True
        if z > 1: 
            heapq.heappush(cake_list, maling_cake(0,0,1))
            check_list[0][0][1] = True
        
    else:
        di, ai, bi, ci = heapq.heappop(cake_list)
        if ai < x - 1:
            if check_list[ai+1][bi][ci] == False:
                heapq.heappush(cake_list, maling_cake(ai+1,bi,ci))
                check_list[ai+1][bi][ci] = True
        if bi < y - 1:
            if check_list[ai][bi+1][ci] == False:
                heapq.heappush(cake_list, maling_cake(ai,bi+1,ci))
                check_list[ai][bi+1][ci] = True
        if ci < z - 1:
            if check_list[ai][bi][ci+1] == False:
                heapq.heappush(cake_list, maling_cake(ai,bi,ci+1))
                check_list[ai][bi][ci+1] = True

        print(-di)

### FIXED CODE ###


import heapq
x, y, z, k = [ int(v) for v in input().split() ]
x_list = sorted([ int(v) for v in input().split() ], reverse = True)
y_list = sorted([ int(v) for v in input().split() ], reverse = True)
z_list = sorted([ int(v) for v in input().split() ], reverse = True)

cake_list = []
num_set = set([0])

def hash2(a,b,c):
    return 10**8*a+10**4*b+c


def maling_cake(a,b,c):
    d = x_list[a]+y_list[b]+z_list[c]
    return (-d,a,b,c)

for i in range(k):
    if i == 0:
        print(-maling_cake(0,0,0)[0])
        if x > 1: 
            heapq.heappush(cake_list, maling_cake(1,0,0))
            num_set.add(hash2(1,0,0))
        if y > 1: 
            heapq.heappush(cake_list, maling_cake(0,1,0))
            num_set.add(hash2(0,1,0))
        if z > 1: 
            heapq.heappush(cake_list, maling_cake(0,0,1))
            num_set.add(hash2(0,0,1))
        
    else:
        di, ai, bi, ci = heapq.heappop(cake_list)
        if ai < x - 1:
            if hash2(ai+1,bi,ci) not in num_set:
                heapq.heappush(cake_list, maling_cake(ai+1,bi,ci))
                num_set.add(hash2(ai+1,bi,ci))
        if bi < y - 1:
            if hash2(ai,bi+1,ci) not in num_set:
                heapq.heappush(cake_list, maling_cake(ai,bi+1,ci))
                num_set.add(hash2(ai,bi+1,ci))
        if ci < z - 1:
            if hash2(ai,bi,ci+1) not in num_set:
                heapq.heappush(cake_list, maling_cake(ai,bi,ci+1))
                num_set.add(hash2(ai,bi,ci+1))
        print(-di)
### BUGGY CODE ###

N,K = map(int,input().split())
p = list(map(int,input().split()))

k = [0]*N

def kitaiti(n):
    sum = 0
    for i in range(1,n+1):
        sum += i
    return sum / n
"""    
for i in range(N):
    k[i] = kitaiti(p[i])
"""
ans = 0
index = 0
for i in range(N-K+1):
#    ans = max(ans,sum(p[i:i+K]))
    if ans < sum(p[i:i+K]):
        ans = sum(p[i:i+K])
        index = i

ans = 0
for i in range(K):
    ans += kitaiti(p[index + i])
print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
p = list(map(int,input().split()))

def kitaiti(n):
    return 0.5*n + 0.5

ans = 0

s=[0]*(N+1)
for i in range(N):
    s[i+1] = s[i] + p[i]

for i in range(N-K+1):
    val = s[K+i] - s[i]
    if ans<val:
        ans = val

print(kitaiti(ans)+0.5*(K-1))
### BUGGY CODE ###

N, M = map(int, input().split())
al = []
for i in range(M):
  al.append(input().split())
al_a = []
for a in al:
  if a[1] == 'AC':
    al_a.append(a[0])
r1 = len(set(al_a))
r2 = 0
for j in al:
  if j[1] == 'AC':
    al_a = [i for i in al_a if i != j[0]]
  elif j[0] in al_a:
    r2 += 1
    
print(int(r1) ,int(r2))

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    ac = [0] * n
    wanum = [0] * n
    for _ in range(m):
        p, s = input().split()
        p = int(p) - 1
        if ac[p]:
            continue
        else:
            if s == 'AC':
                ac[p] = 1
                wanum[p] *= -1
            else:
                wanum[p] -= 1
    wanum2 = [i for i in wanum if i > 0]
    print(sum(ac), sum(wanum2))

if __name__ == '__main__':
    main()
### BUGGY CODE ###

from heapq import heappop, heappush


def p_d():
    n, m = map(int, input().split())
    ab = [tuple(map(int, input().split())) for _ in range(n)]
    ans = 0

    for i in range(1, m + 1):
        H = []
        for j, e in enumerate(ab):
            if e[0] <= i:
                heappush(H, (-e[1], j))

        if H:
            e = heappop(H)
            ans -= e[0]
            ab.pop(e[1])

    print(ans)


if __name__ == '__main__':
    p_d()


### FIXED CODE ###

from heapq import heappop, heappush


def p_d():
    n, m = map(int, input().split())
    ab = [tuple(map(int, input().split())) for _ in range(n)]

    ab.sort()
    ans = 0
    j = 0
    H = []

    for i in range(1, m + 1):
        while j < n and ab[j][0] <= i:
            heappush(H, -ab[j][1])
            j += 1

        if H:
            ans -= heappop(H)

    print(ans)


if __name__ == '__main__':
    p_d()
### BUGGY CODE ###

#coding=UTF-8


mozir=input()
hyo=mozir.split(' ')

N=int(hyo[0])
M=int(hyo[1])

A=[]
B=[]
Cost=[]
for idx in range(0,M,1):
    mozir=input()
    hyo=mozir.split(' ')
    A.append(int(hyo[0])-1)
    B.append(int(hyo[1])-1)
    Cost.append(int(hyo[2]))
    
#先ず得点が正になるループを探す
eipap=False
for idx in range(0,N,1):
    tansaku=[(idx,0)]
    while len(tansaku) > 0:
        next_tansaku=[]
        for mono in tansaku:
            for idy in range(0,M,1):
                if A[idy]==mono[0]:
                    #add only if better
                    appendp=True
                    for butu in next_tansaku:
                        if B[idy] == butu[0]:
                            #already exsists
                            appendp=False
                            if butu[1] > mono[1]+Cost[idy]:
                                butu[1]=mono[1]+Cost[idy]
                    if appendp:
                        next_tansaku.append([B[idy],mono[1]+Cost[idy]])
        #print(next_tansaku)
        
        for tenn in next_tansaku:
            if tenn[0]==idx and tenn[1]>0:
                eipap=True
                break

        if eipap:
            break
        else:
            tansaku=next_tansaku

if eipap:
    print('inf')
else:
    #無ければ、普通の経路探索のようなことをする
    tmp_score=[None]*N #マイナス点のときもある
    tmp_score[0]=0
    tansaku=[0]
    while len(tansaku) > 0:
        next_tansaku=[]
        for mono in tansaku:
            for idy in range(0,M,1):
                if A[idy]==mono:
                    kouho_ten=tmp_score[mono]+Cost[idy]
                    if tmp_score[B[idy]] == None or kouho_ten > tmp_score[B[idy]]:
                        tmp_score[B[idy]]=kouho_ten
                        next_tansaku.append(B[idy])

        tansaku=next_tansaku

    print(tmp_score[N-1])


### FIXED CODE ###

#coding=UTF-8

#ゴールに関係無い袋小路で永パされると、探索が収束しない
#かつ答えがinfでないということで 修正

#表にあるかを尋ねるのが重いので
#データ構造を変えて回避する
mozir=input()
hyo=mozir.split(' ')

N=int(hyo[0])
M=int(hyo[1])

#idx番目の都市に繋っている道とコストのタプルを持つリスト
tuuro=[]
# [] はコピーがしんどいものだったりするので
# 参照でごまかしたりしてくる
# なので1個づつ書いている
for idx in range(0,N,1):
    tuuro.append([])


A=[]
B=[]

for idx in range(0,M,1):
    mozir=input()
    hyo=mozir.split(' ')
    tuuro[int(hyo[0])-1].append((int(hyo[1])-1,int(hyo[2])))

#print(tuuro)
#普通の経路探索のようなことをする
#永パ
tmp_score=[None]*N #マイナス点のときもある
tmp_score[0]=0
tansaku=[0]
loopconut=0
while len(tansaku) > 0:
    loopconut=loopconut+1
    next_tansaku=[]
    for mono in tansaku:
        for deru in tuuro[mono]:
            kouho_ten=tmp_score[mono]+deru[1]
            if tmp_score[deru[0]] == None or kouho_ten > tmp_score[deru[0]]:
                tmp_score[deru[0]]=kouho_ten
                next_tansaku.append(deru[0])

    tansaku=list(set(next_tansaku))
    if loopconut==N-1:
        tmp_ans=tmp_score[N-1] #cannot be None
    elif loopconut==2*N-1:
        #period must be eqal or less than N
        if tmp_score[N-1] > tmp_ans:
            print('inf')
            break
        else:
            #関係の無い無限ループ
            print(tmp_score[N-1])
            break
else:
    print(tmp_score[N-1])
### BUGGY CODE ###

import math
n,a,b = map(int,input().split())
n_fact = math.factorial(n)
print(int((2**n-n_fact/math.factorial(a)/math.factorial(n-a)-n_fact/math.factorial(b)/math.factorial(n-b)-1)%(10**9+7)))

### FIXED CODE ###

def mod_power(x,y,p):
    if y == 1:
        return x % p
    elif y % 2 == 0:
        return (mod_power(x,y/2,p)**2) % p
    else:
        return (mod_power(x,y-1,p) * x ) % p

def mod_inv(x,p):
    return mod_power(x,p-2,p)

def mod_nCa(n,a,p):
    num = 1
    den = 1
    for i in range(a):
        num = (num * (n-i)) % p
        den = (den * (a-i)) % p
    return (num * mod_inv(den,p)) % p


n,a,b = map(int,input().split())

m = 10**9 + 7

print((mod_power(2,n,m) - mod_nCa(n,a,m) - mod_nCa(n,b,m) - 1) % m)
### BUGGY CODE ###

s = input()
t = input()

def count_ans(a,b):    
    ans = 0
    for k in range(len(a)):
        for l in range(len(b)):
            if k==l and a[k]==b[l]:
                ans += 1
    return ans

ans = 0
for i in range(len(s)-len(t)+1):
    if ans < count_ans(s[i:i+len(t)],t):
        ans = count_ans(s[i:i+len(t)],t)

print(len(t)-ans)

### FIXED CODE ###

s = input()
t = input()

def count_ans(a,b):
    ans = 0
    for c1,c2 in zip(a, b):
        if c1 == c2:
            ans += 1
    return ans

ans = 0
for i in range(len(s)-len(t)+1):
    ans_ = count_ans(s[i:i+len(t)],t)
    if ans < ans_:
        ans = ans_

print(len(t)-ans)
### BUGGY CODE ###

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

from math import comb
# def comb(n,r):
#     if r==2:
#         return n*(n-1)//2
#     else:
#         return n*(n-1)*(n-2)//6
n=n0()
s=s0()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=0
for j in range(0,n):
    for i in range(1,(n-j)//2+1):
        if j+2*i>n-1:
            continue
        else:
            ans+=1
            if s[j]==s[j+i]==s[j+2*i]:
                ans-=1
            elif s[j]==s[j+i] or s[j]==s[j+2*i] or s[j+i]==s[j+2*i]:
                ans-=1
            
ans+=comb(r,3)+comb(g,3)+comb(b,3)+comb(r,2)*(g+b)+comb(g,2)*(r+b)+comb(b,2)*(r+g)
print(comb(n,3)-ans)

### FIXED CODE ###

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

# from math import comb
def comb(n,r):
    if r==2:
        return n*(n-1)//2
    else:
        return n*(n-1)*(n-2)//6
n=n0()
s=s0()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=0
for i in range(1,(n-1)//2+1):
    for j in range(0,n-2*i):
        ans+=1
        if s[j]==s[j+i]==s[j+2*i]:
            ans-=1
        elif s[j]==s[j+i] or s[j]==s[j+2*i] or s[j+i]==s[j+2*i]:
            ans-=1
            
ans+=comb(r,3)+comb(g,3)+comb(b,3)+comb(r,2)*(g+b)+comb(g,2)*(r+b)+comb(b,2)*(r+g)
print(comb(n,3)-ans)