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

# -*- coding: utf-8 -*-
# なんかおかしい！！
import math
import sys
import itertools
import numpy as np

 
# なんこか入力
x,y,z,k = map(int, input().split())
 
# 空白区切りの数列をリストに代入
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
 
a.sort()
b.sort()
c.sort()
#cake = [[0 for i in range(3)] for j in range(3000)]
#cake[0][0]=x-1
#cake[0][1]=y-1
#cake[0][2]=z-1
#print(a[x-1]+b[y-1]+c[z-1])
#print(a[cake[0][0]],b[cake[0][1]],c[cake[0][2]])
t = [[-1,-1,-1,-1] for i in range(3*k)]
t[0] = [a[x-1]+b[y-1]+c[z-1],x-1,y-1,z-1]
t_a = 1
#print(s)
 
for i in range(0,k):
    ma = 0
    ma_j = -1
    temp = [-1,-1,-1,-1]
    for j in range(len(t)):
        if ma <= t[j][0] :
            temp = t[j]
            ma = t[j][0]
            ma_j = j
#    print(temp)
    print(temp[0])
    t[ma_j][0]=0
#    print("s=",s)
#    print("t=",t)
#    print(temp)
    f =1
    if temp[1] > 0:
        for j in range(len(t)):
            if temp[1]-1 == t[j][1] and temp[2]==t[j][2] and temp[3]==t[j][3]:
                f = 0
                break
        if f == 1:
            t[t_a] = [a[temp[1]-1]+b[temp[2]]+c[temp[3]],temp[1]-1,temp[2],temp[3]]
            t_a += 1
    f =1
    if temp[2] > 0:
        for j in range(len(t)):
            if temp[1] == t[j][1] and temp[2]-1==t[j][2] and temp[3]==t[j][3]:
                f = 0
                break
        if f == 1:
            t[t_a] = [a[temp[1]]+b[temp[2]-1]+c[temp[3]],temp[1],temp[2]-1,temp[3]]
            t_a += 1
    f =1
    if temp[3] > 0:
        for j in range(len(t)):
            if temp[1] == t[j][1] and temp[2]==t[j][2] and temp[3]-1==t[j][3]:
                f = 0
                break
        if f == 1:
            t[t_a] = [a[temp[1]]+b[temp[2]]+c[temp[3]-1],temp[1],temp[2],temp[3]-1]
            t_a += 1


### FIXED CODE ###

# -*- coding: utf-8 -*-
# ヒープキューを使う

import math
import sys
import itertools
import numpy as np
import heapq
 
# なんこか入力
x,y,z,k = map(int, input().split())
 
# 空白区切りの数列をリストに代入
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

a.sort()
b.sort()
c.sort()

h = [] # heap
g = set() #使用済み

heapq.heappush(h,(-(a[x-1]+b[y-1]+c[z-1]),x-1,y-1,z-1))
g.add((x-1,y-1,z-1))

#print(h)

for i in range(k):
#    heapq.heapify(h)
    temp =[]
    temp = heapq.heappop(h)
    print(-temp[0])
    for j in range(3):
        if temp[j+1]==0:
            continue
        if j == 0:
            temp2 = (-(a[temp[1]-1]+b[temp[2]]+c[temp[3]]),temp[1]-1,temp[2],temp[3])
        elif j == 1:
            temp2 = (-(a[temp[1]]+b[temp[2]-1]+c[temp[3]]),temp[1],temp[2]-1,temp[3])
        else:
            temp2 = (-(a[temp[1]]+b[temp[2]]+c[temp[3]-1]),temp[1],temp[2],temp[3]-1)
        if (temp2[1],temp2[2],temp2[3]) in g:
            continue
        heapq.heappush(h,temp2)
        g.add((temp2[1],temp2[2],temp2[3]))
### BUGGY CODE ###

from collections import Counter,defaultdict,deque
import sys
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
def graphm():
    n=inp()
    g=[[] for _ in range(n)]
    for _ in range(n-1):
        a,b,w=inpm()
        a-=1
        b-=1
        g[a].append((b,w))
        g[b].append((a,w))
    return n,g

def dfs(start,goal,n,g):
    que = [start-1]
    dis = [0 for _ in range(n)]
    did = [False for _ in range(n)]
    did[start-1] = True
    if start == goal:
        return 0
    while que:
        tank = []
        for i in que:
            for j in range(len(g[i])):
                go = g[i][j][0]
                d = g[i][j][1]
                if did[go]:
                    continue
                dis[go] = dis[i] + d
                if goal-1 == go:
                    return dis[go]
                tank.append(go)
                did[go] = True
        que = tank
 
def main():
    n,graph = graphm()
    q,k = inpm()
    pre1 = []
    pre2 = []
    for i in range(n):
        pre1.append(dfs(i+1,k,n,graph))
        pre2.append(dfs(k,i+1,n,graph))
    for _ in range(q):
        x,y = inpm()
        print( pre1[x-1] + pre2[y-1] ) 

if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import Counter,defaultdict,deque
import sys
import copy
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n=int(input())
    graph = [[] for _ in range(n)]
    for _ in range(n-1):
        a,b,w=map(int,input().split())
        a-=1
        b-=1
        graph[a].append((b,w))
        graph[b].append((a,w))
    graph = tuple(graph)
    q,k = map(int,input().split())
    que = deque([k-1])
    dis = [-1 for _ in range(n)]
    dis[k-1]=0
    while que:
        i = que.pop()
        for j in range(len(graph[i])):
            go = graph[i][j][0]
            d = graph[i][j][1]
            if dis[go]==-1:
                dis[go] = dis[i] + d
                que.append(go)
    for _ in range(q):
        x,y = map(int,input().split())
        print( dis[x-1] + dis[y-1] ) 

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

import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = list(map(int, readline().split()))
p = []
S = []
for i in range(M):
    _p, s = readline().decode('utf-8').split()
    p.append(int(_p))
    S.append(s)
pset = list(set(p))

AC_cnt = 0
WA_cnt = 0

for i in pset:
    S_acc = [s for (s, p_) in zip(S, p) if p_ == i]
    if "AC" in S_acc:
        AC_cnt += 1
        idx = S_acc.index("AC")
        WA_cnt += idx

print(AC_cnt, WA_cnt)

### FIXED CODE ###

import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, M = list(map(int, readline().split()))
pS = [readline().decode('utf-8').split() for _ in range(M)]
cnt_list = [0] * (N + 1)
ACed_list = [0] * (N + 1)

for p_, s in pS:
    p_ = int(p_)

    if s == 'AC':
        if ACed_list[p_] == 0:
            ACed_list[p_] = 1
    else:
        if ACed_list[p_] == 0:
            cnt_list[p_] += 1

for i in range(N + 1):
    if ACed_list[i] == 0:
        cnt_list[i] = 0

print(sum(ACed_list), sum(cnt_list))
### BUGGY CODE ###

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

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans_x = 0
c = combinations_count(N*M-2, K-2)
for i in range(1, N+1):
    for j in range(i+1, N+1):
        ans_x += j-i
ans_x = M*M*ans_x*c

ans_y = 0
c = combinations_count(N*M-2, K-2)
for i in range(1, M+1):
    for j in range(i+1, M+1):
        ans_y += j-i
ans_y = N*N*ans_y*c
ans = (ans_x+ans_y)%(10**9+7)
print(ans)

### FIXED CODE ###

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

import math

from operator import mul
from functools import reduce
def combinations_count(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans_x = 0
c = combinations_count(N*M-2, K-2)
#for i in range(1, N+1):
#    ans_x += N*(N+1)//2-i*(i+1)//2-i*(N-i)
    #for j in range(i+1, N+1):
    #    ans_x += j-i
ans_x = (N*N*(N+1) + N*(N+1)*(2*N+1)//6 - (2*N+1)*N*(N+1)//2)//2
ans_x = M*M*ans_x*c

ans_y = 0
c = combinations_count(N*M-2, K-2)
#for i in range(1, M+1):
#    ans_y += M*(M+1)//2-i*(i+1)//2-i*(M-i)
    #for j in range(i+1, M+1):
    #    ans_y += j-i
ans_y = (M*M*(M+1) + M*(M+1)*(2*M+1)//6 - (2*M+1)*M*(M+1)//2)//2
ans_y = N*N*ans_y*c
ans = (ans_x+ans_y)%(10**9+7)
print(ans)
### BUGGY CODE ###

N, Q = map(int, input().split())
s = str(input())

t = []
d = []

for _ in range(Q):
    ti, di = map(str, input().split())
    t.append(ti)
    d.append(di)


def main_fanc(s, t, d, N):
    masu = []
    for si in s:
        masu.append({'key': si, 'val': 1})
        
    for ti, di in zip(t, d):
        if di == 'L':
            for i, m in enumerate(masu):
                if m['key'] != ti:
                    continue
                if i == 0:
                    masu[i]['val'] = 0
                else:
                    masu[i - 1]['val'] += masu[i]['val']
                    masu[i]['val'] = 0
                    
        if di == 'R':

            for i, m in enumerate(masu):
                if m['key'] != ti:
                    continue
                if i == N - 1:
                    masu[i]['val'] = 0
                else:
                    masu[i + 1]['val'] += masu[i]['val']
                    masu[i]['val'] = 0
    
    c = 0
    for m in masu:
        c += m['val']
    
    print(c)
                
main_fanc(s, t, d, N)

### FIXED CODE ###

N, Q = map(int, input().split())
s = str(input())

t = []
d = []

for _ in range(Q):
    ti, di = input().split()
    t.append(ti)
    d.append(di)
    
LEFT_DIE = -1
RIGHT_DIE = N

def is_dead(i):
    for ti, di in zip(t, d):
        if s[i] == ti:
            if di == 'L':
                i -= 1
            if di == 'R':
                i += 1
            if i == LEFT_DIE:
                return LEFT_DIE
            if i == RIGHT_DIE:
                return RIGHT_DIE
    return 0

low = -1
high = N;
# LEFT
while high - low > 1:
    mid = (low + high) // 2;
    if is_dead(mid) == LEFT_DIE:
        low = mid
    else:
        high = mid
left_edge = high

low = -1
high = N;
# RIGHT
while high - low > 1:
    mid = (low + high) // 2;
    if is_dead(mid) == RIGHT_DIE:
        high = mid
    else:
        low = mid
right_edge = low

#print(left_edge, right_edge)
ans_s = s[left_edge:right_edge+1]
#print(ans_s)
ans = len(ans_s)
print(ans)
### BUGGY CODE ###

n = int(input())
mt = 0
ma = 0
for i in range(n):
    t , a = map(int, input().split())
    if t>=mt and a>=ma:
        mt = t
        ma = a
    elif t<mt or a<ma:
        k=1
        while t*k<mt or a*k<ma:
            k+=1
        mt=t*k
        ma=a*k
print(mt+ma)


### FIXED CODE ###

n = int(input())
mt = 0
ma = 0
for i in range(n):
    t , a = map(int, input().split())
    if t>=mt and a>=ma:
        mt = t
        ma = a
    elif t<mt or a<ma:
        k1 = mt//t
        k2 = ma//a
        k=max(k1,k2)
        while t*k < mt or a*k <ma:
            k+=1
        mt=t*k
        ma=a*k
print(mt+ma)
### BUGGY CODE ###

N,K = map(int,input().split())
S = list(map(int,input()))
tmp = 1
tbl = []
cont = 0
for s in S:
    if s == tmp:
        cont += 1
    else:
        tbl.append(cont)
        cont = 1
        tmp = abs(tmp-1)
tbl.append(cont)
if len(tbl) % 2 == 0:
    tbl.append(0)
max = 0
for i in range(0,len(tbl),2):
    if sum(tbl[i:i+K*2+1]) > max:
        max = sum(tbl[i:i+K*2+1])
print(max)

### FIXED CODE ###

N,K = map(int,input().split())
S = list(map(int,input()))
tmp = 1
nums = []
cont = 0
for s in S:
    if int(s) == tmp:
        cont += 1
    else:
        nums.append(cont)
        cont = 1
        tmp = 1 - tmp
if cont != 0:
    nums.append(cont)
if len(nums) % 2 == 0:
    nums.append(0)
cml = [0]
for n in nums:
    cml.append(cml[-1]+n)
ans = []
for i in range(0,len(cml),2):
    ans.append(cml[min(len(cml)-1,i+K*2+1)]-cml[i])
print(max(ans))
### BUGGY CODE ###

from collections import Counter
n = int(input())
words = [input() for i in range(n)]

counter = Counter(words)
fin = [ii[0] for ii in counter.items() if ii[1] == max(counter.values())]

fin.sort()

for jj in fin:
    print(jj)

### FIXED CODE ###

from collections import Counter
n = int(input())
words = [input() for i in range(n)]

counter = Counter(words).most_common()
ans =[]
for i in range(int(len(counter))):
    if counter[0][1] > counter[i][1]:
        break
    ans.append(counter[i][0])
ans.sort()

for i in ans:
    print(i)
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
score=1
for i in range(k):
    score*=a[i]

for i in range(k,n):
    score_b = score
    score = score_b/a[i-k]*a[i]
    
    if score_b < score:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

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

for i in range(k,n):
    zenkai = a[i-k]
    konkai = a[i]
    if zenkai < konkai:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

f=lambda n:f(n-1)+f(n-2)if n>1 else 1
print(f(int(input())))


### FIXED CODE ###

p,n=(1+5**.5)/2,int(input())+1
print(int((p**n-(1-p)**n)/5**.5))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 998244353

n, s = map(int, input().split())
a = [int(item) for item in input().split()]
# dp[i-th item][j val] : tuple(cnt, used cnt)
dp = [[dict() for _ in range(s+1)] for _ in range(n + 1)]
dp[0][0][0] = 1

for i, item in enumerate(a):
    for j in range(s):
        for uc, c in dp[i][j].items():
            if uc not in dp[i+1][j]:
                dp[i+1][j][uc] = c
            else:
                dp[i+1][j][uc] += c
            if j + item > s:
                continue
            if uc + 1 not in dp[i+1][j + item]:
                dp[i+1][j + item][uc + 1] = c
            else:
                dp[i+1][j + item][uc + 1] += c

ans = 0
for dics in dp:
    for key, val in dics[-1].items():
        ans += pow(2, n - key, MOD) * val
        ans %= MOD
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 998244353

n, s = map(int, input().split())
a = [int(item) for item in input().split()]

dp = [[0] * (s + 1) for _ in range(n+1)]
dp[0][0] = 1

for i, item in enumerate(a):
    for j in range(s, -1, -1):
        if dp[i][j] == 0:
            continue
        if j + item <= s:
            dp[i+1][j+item] += dp[i][j] 
        dp[i+1][j] += dp[i][j] * 2
        dp[i+1][j] %= MOD

print(dp[-1][-1] % MOD)
### BUGGY CODE ###

n1, n2 = [int(i) for i in input().split()]

r1 = 2018
for i3 in range(n2 - n1):
    n4 = i3 + n1

    for i5 in range(n2 - n4):
        n5 = i5 + n4 + 1

        if ((n4 * n5) % 2019)  < r1:
            r1 = ((n4 * n5) % 2019)

print(r1)

### FIXED CODE ###

import sys

n1, n2 = [int(i) for i in input().split()]

r1 = 2018

if n2 - n1 >= 2019:
    print(0)
    sys.exit()


for i3 in range(n2 - n1):
    n4 = i3 + n1

    t1 = n2 - n4
    if t1 >= 2019:
        t1 = 2019
    for i5 in range(t1):
        n5 = i5 + n4 + 1

        if ((n4 * n5) % 2019)  < r1:
            r1 = ((n4 * n5) % 2019)

print(r1)
### BUGGY CODE ###

# coding: utf-8
S = input().split()
Q = int(input())

def pop(left, right, rev, f, c):
    left_ = left
    if rev == 1:
        if f == '1':
            left_ = left[::-1]
            left_.append(c)
            left_ = left_[::-1]
        else:
            right.append(c)
    else:
        if f == '1':
            right.append(c)
        else:
            left_ = left[::-1]
            left_.append(c)
            left_ = left_[::-1]
    return left_, right


left, right = [], []
rev = 1
for _ in range(Q):
    que = input().split()
    if que[0] == '1':
        rev *= -1
        continue
    if que[0] == '2':
        left, right = pop(left, right, rev, *que[1:])
print(''.join(left+S+right)[::rev])

### FIXED CODE ###

# coding: utf-8
S = input().split()
Q = int(input())

def pop(left, right, rev, f, c):
    if rev == 1:
        if f == '1':
            left.append(c)
        else:
            right.append(c)
    else:
        if f == '1':
            right.append(c)
        else:
            left.append(c)
    return left, right


left, right = [], []
rev = 1
for _ in range(Q):
    que = input().split()
    if que[0] == '1':
        rev *= -1
        continue
    if que[0] == '2':
        left, right = pop(left, right, rev, *que[1:])
print(''.join(left[::-1]+S+right)[::rev])
### BUGGY CODE ###

import fractions
from functools import reduce
m=int(input())
a=list(map(int,input().split()))
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)
#print(lcm_list(a))
mod=10**9+7
n=lcm_list(a)

ans=0
for i in range(m):
    ans=ans%(mod)+(n//a[i])%mod
print(ans%mod)

### FIXED CODE ###

import fractions
from functools import reduce
m=int(input())
a=list(map(int,input().split()))
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)
mod=10**9+7
n=lcm_list(a)
ans=0
for i in range(m):
    ans+=(n//a[i])
print(ans%mod)
### BUGGY CODE ###

n = int(input())
s = input()
cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            continue
        k = 2*j - i
        if j < k < n and len({s[i], s[j], s[k]}) == 3:
            cnt += 1
print(s.count('R') * s.count('G') * s.count('B') - cnt)

### FIXED CODE ###

n = int(input())
s = input()
cnt = s.count('R') * s.count('G') * s.count('B')
for i in range(n):
    for j in range(i + 1, n):
        k = 2*j - i
        if j < k < n and len({s[i], s[j], s[k]}) == 3:
            cnt -= 1
print(cnt)
### BUGGY CODE ###

n=int(input())
a=[int(x) for x in input().split()]
for i in range(n):
    print(a.count(i+1))

### FIXED CODE ###

n=int(input())
a=[int(x) for x in input().split()]
d=[0]*(n+1)
for i in range(n-1):
    d[a[i]]+=1
for i in range(1,len(d)):print(d[i])
### BUGGY CODE ###

A, B, K = map(int, input().split())
for i in range(A, B+1):
    if A <= i <= A+K-1 or B-K+1 <= i <= B:
        print(i)

### FIXED CODE ###

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

if K<(B-A)/2+1:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)
else:
    for i in range(A, B+1):
        print(i)
### BUGGY CODE ###

import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**9)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

x = INT()
l = [100,101,102,103,104,105]
flag = [False]

for i in l:
    if x/i==0:
        print(1)
        exit()

def dfs(cur):
    if cur==x:
        flag[0] = True
        return 0
    if cur>x:
        return 1

    if dfs(cur+100)==0:
        return 0
    if dfs(cur+101)==0:
        return 0
    if dfs(cur+102)==0:
        return 0
    if dfs(cur+103)==0:
        return 0
    if dfs(cur+104)==0:
        return 0
    if dfs(cur+105)==0:
        return 0

dfs(0)
if flag[0]:
    print(1)
else:
    print(0)

### FIXED CODE ###

import math
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**9)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

x = INT()

for i in range(1,10**6+1):
    if i*100<=x<=i*105:
        print(1)
        exit()
print(0)
### BUGGY CODE ###

def main():
  S=input()
  N=int(input())
  for i in range(N):
    tmp=[i for i in input().split() ]
    if tmp[0]=='1':
      S=''.join(list(reversed(S)))
    else:
      if tmp[1]=='1':
        new=tmp[2]+S
        S=new
      else:
        new=S+tmp[2]
        S=new
  print(S)
if __name__=='__main__':
  main()
   


### FIXED CODE ###

def main():
  S=input()
  N=int(input())
  cnt=0
  f=''
  b=''
  for i in range(N):
    tmp=[i for i in input().split() ]
    if tmp[0]=='1':
      cnt+=1
    else:
      if (cnt+int(tmp[1]))%2==1:
        f=tmp[2]+f
        
      else:
        b=b+tmp[2]
  ans=f+S+b        
  if cnt%2!=0:
    ans=''.join(list(reversed(ans)))

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

import sys

def main():
    n=int(input())
    s=input()
    ans=0
    d=dict()
    dr=[0]*n
    dg=[0]*n
    db=[0]*n
    mr=[0]*n
    mg=[0]*n
    mb=[0]*n

    for i in range(n):
        if s[i]=='R':
            dr[i]=1
            mr[i]=1
        if s[i]=='G':
            dg[i]=1
            mg[i]=1
        if s[i]=='B':
            db[i]=1
            mb[i]=1

    for i in range(n-1):
        mr[n-2-i]+=mr[n-1-i]
        mg[n-2-i]+=mg[n-1-i]
        mb[n-2-i]+=mb[n-1-i]

    for i in range(n-2):
        for j in range(i,n-1):
            #print(ans,i,j,s[i],s[j])
            k=3
            if s[i]==s[j]:
                continue
            if s[i]=='R' and s[j]=='G':
                k=1
            elif s[i]=='R' and s[j]=='B':
                k=2
            elif s[i]=='G' and s[j]=='R':
                k=1
            elif s[i]=='G' and s[j]=='B':
                k=0
            elif s[i]=='B' and s[j]=='R':
                k=2
            elif s[i]=='B' and s[j]=='G':
                k=0
            #print(k)
            
            if k==0:
                ans+=mr[j+1]
                if (j+(j-i))<n:
                    ans-=dr[j+(j-i)]
            if k==1:
                ans+=mb[j+1]
                if (j+(j-i))<n:
                    ans-=db[j+(j-i)]
            if k==2:
                ans+=mg[j+1]
                if (j+(j-i))<n:
                    ans-=dg[j+(j-i)]

    print(ans)
        



main()

### FIXED CODE ###

def main():
    n=int(input())
    s=input()
    ans=0
    d=dict()
    dr=[0]*n
    dg=[0]*n
    db=[0]*n
    mr=[0]*n
    mg=[0]*n
    mb=[0]*n

    for i in range(n):
        if s[i]=='R':
            dr[i]=1
            mr[i]=1
        if s[i]=='G':
            dg[i]=1
            mg[i]=1
        if s[i]=='B':
            db[i]=1
            mb[i]=1

    for i in range(n-1):
        mr[n-2-i]+=mr[n-1-i]
        mg[n-2-i]+=mg[n-1-i]
        mb[n-2-i]+=mb[n-1-i]

    for i in range(n-2):
        for j in range(i,n-1):
            if s[i]==s[j]:
                continue
            if s[i]=='R' and s[j]=='G':
                k=1
            elif s[i]=='R' and s[j]=='B':
                k=2
            elif s[i]=='G' and s[j]=='R':
                k=1
            elif s[i]=='G' and s[j]=='B':
                k=0
            elif s[i]=='B' and s[j]=='R':
                k=2
            elif s[i]=='B' and s[j]=='G':
                k=0
            #print(k)
            
            if k==0:
                ans+=mr[j+1]
                if (j+(j-i))<n:
                    ans-=dr[j+(j-i)]
            if k==1:
                ans+=mb[j+1]
                if (j+(j-i))<n:
                    ans-=db[j+(j-i)]
            if k==2:
                ans+=mg[j+1]
                if (j+(j-i))<n:
                    ans-=dg[j+(j-i)]

    print(ans)
        



main()
### BUGGY CODE ###

n,x,y = map(int,input().split())

def largest(a,b,c):
  if a <= b:
    if a<= c:
      return a
    else:
      return c
  else:
    if b<=c:
      return b
    else:
      return c
    
def absol(d):
  if d < 0:
    return -d
  else:
    return d
    
def dist(i,j):
  return largest(j-i, absol(x-i) + absol(y-j) + 1, absol(x-j) + absol(y-i) + 1)

listlist = []
for t in range(1,n):
  listlist.append([t,0])

for i in range(1,n):
  for j in range(i+1,n+1):
    distance = dist(i,j)
    listlist[distance-1][1] = listlist[distance-1][1] + 1

for t in range(0,n-1):
  print(listlist[t][1])


### FIXED CODE ###

n,x,y = map(int,input().split())

def dist(i,j):
  return min(j-i, abs(x-i) + abs(y-j) + 1, abs(x-j) + abs(y-i) + 1)

listlist = [0]*(n-1)

for i in range(1,n):
  for j in range(i+1,n+1):
    distance = dist(i,j)
    listlist[distance-1] = listlist[distance-1] + 1
    
for k in listlist:
  print(k)