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

N = int(input())
S = list(input())

from itertools import combinations

lis = list(range(1, N+1))
s = [1 for v in combinations(lis, 3)
     if v[1] - v[0] != v[2] - v[1] and S[v[0]-1] != S[v[1]-1] and S[v[0]-1] != S[v[2]-1] and S[v[1]-1] != S[v[2]-1]]

print(len(s))


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    N = int(input())
    S = list(input())
 
    c = [[] for _ in range(3)] #c = [[]] * 3 とすると全ての要素にappendされてしまうのでNG
    for i in range(len(S)):
        if S[i] == 'R':
            c[0].append(i)
        elif S[i] == 'G':
            c[1].append(i)
        else : # 'B'のとき
            c[2].append(i)
    total = len(c[0]) * len(c[1]) * len(c[2])

    reigai = 0 #先に条件2を満たすものを考えてから、条件1に当てはまるかを判定
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            k = j + (j - i)
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                reigai += 1
    print(total - reigai)


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

import sys
sys.setrecursionlimit(10**7)
import copy
def myhash(v):
    r = 0
    for i in v:
        r += pow(2, i)
    return r
def myhash2(r, N):
    vv = set()
    for i, v in enumerate(format(r, '0'+str(N)+'b')):
        if v == '1':
            vv.add(N-i-1)
    return vv
def main():
    N, M  = map(int, input().split())
    l = [[] for _ in range(N)]
    r = []
    for _ in range(M):
        a, b = map(int, input().split())
        l[a-1].append(b-1)
    a = set()
    def cyclic(n, l, r):
        ans = []
        r += pow(2, n)
        v = myhash2(r, N)
        for i in  l[n]:
            if i in v:
                a.add(r)
                return
                #return True, v
        for i in l[n]:
            cyclic(i, l, r)
        return
    for i in range(N):
        r = 0
        cyclic(i, l, r)
    if a:
        m = 100000
        rr = None
        for i in a:
            x = len(myhash2(i, N))
            if m > x:
                m = x
                rr = i
        print(m)
        for i in myhash2(rr, N):
            print(i+1)
    else:
        print(-1)
    return -1
main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def main():
    N, M = map(int, input().split())
    l = [[] for _ in range(N)]
    for _ in range(M):
        a, b = map(int, input().split())
        l[a-1].append(b-1)
    c = [0] * N
    loop = []
    def cyclic(n):
        if c[n] == 2:
            return False
        if c[n] == 1:
            loop.append(n)
            return True
        c[n] = 1
        for i in l[n]:
            if cyclic(i):
                loop.append(n)
                return True
        c[n] = 2
        return False
    for i in range(N):
        if cyclic(i):
            break
    if len(loop) == 0:
        print(-1)
        return
    print(0)
    return
main()
### BUGGY CODE ###

#!/usr/bin/env python3
import bisect


N = int(input().split()[0])
l_list = list(map(int, input().split()))
l_list = sorted(l_list)
p_list = []

for a_i, a in enumerate(l_list):
    for b_i, b in enumerate(l_list):
        if a_i == b_i:
            continue

        c_kouho = a + b
        c_i = bisect.bisect_left(l_list, c_kouho)
        p_list += [
            sorted([a, b, c])
            for c_i, c in enumerate(l_list[: c_i + 1])
            if c_i != a_i and c_i != b_i and abs(b - c) < a < b + c
        ]

p_list = ["{}_{}_{}".format(p[0], p[1], p[2]) for p in p_list]
ans = len(set(p_list))

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
import bisect


N = int(input().split()[0])
l_list = list(map(int, input().split()))
l_list = sorted(l_list)
total = 0

for a_i, a in enumerate(l_list):
    # 一番長い辺を固定
    for b_i, b in enumerate(l_list[:a_i]):
        # 2番目に長い辺を固定
        c_i = bisect.bisect_right(l_list, abs(a - b))
        total += max(b_i - c_i, 0)

ans = total
print(ans)
### BUGGY CODE ###

def main():
  N,K=map(int,input().split())
  A=list(map(int,input().split()))

  #行ったことある町リスト
  d=[1]
  for _ in range(K):
    T=A[d[-1]-1]
    if T in d:
      break
    d.append(T)
  F=d.index(T)
  LOOP_TOWN=d[F:]
  q=(K-F)%len(LOOP_TOWN)
  print(LOOP_TOWN[q])

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
  N,K=map(int,input().split())
  A=list(map(int,input().split()))
  n=[0]*N
  #行ったことある町リスト
  d=[1]
  for _ in range(K):
    T=A[d[-1]-1]
    if n[T-1]==1:
      break
    else:
      n[T-1]=1
    d.append(T)
  F=d.index(T)
  LOOP_TOWN=d[F:]
  q=(K-F)%len(LOOP_TOWN)
  print(LOOP_TOWN[q])

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

a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,int(n/c)+1):
  f=n-c*i
  for k in range(0,int(f/b)+1):
    g=f-b*k
    if g/a-int(g/a)==0:
        e=e+1
print(e)

### FIXED CODE ###

a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,n//c+1):
    for k in range(0,(n-c*i)//b+1):
        if ((n-c*i-b*k)%a)==0:
            e=e+1
print(e)
### BUGGY CODE ###

x=input()
n=len(x)
while True:
    x=x.replace("ST","")
    if n==len(x):
        break
    else:
        n=len(x)
print(n)

### FIXED CODE ###

x=input()
s,t=0,0
for i in x:
    if i=="S":
        s+=1
    else:
        if s>0:
            s-=1
        else:
            t+=1
print(s+t)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]


INF = float("inf")
MOD = 10**9 + 7
EPS = 1e-6
KETA = 10**7


def main():
    H, W, K = MAP()
    x1, y1, x2, y2 = LIST()
    c = [[-1] + [0 if c == "." else -1 for c in input()] + [-1]
         for i in range(H)]
    c = [[-1] * (W + 2)] + c + [[-1] * (W + 2)]
    c[x1][y1] = 0

    # 0123: 上下左右
    stack = [((x1 * KETA + y1) << 2) + 0, ((x1 * KETA + y1) << 2) + 1,
             ((x1 * KETA + y1) << 2) + 2, ((x1 * KETA + y1) << 2) + 3]
    DX = (1, 0, -1, 0)
    DY = (0, 1, 0, -1)
    head = 0
    while head < len(stack):
        b = stack[head]
        head += 1
        d = b % 4
        x, y = divmod(b >> 2, KETA)
        flag = True
        a = c[x][y] + 1
        for k in range(1, K + 1):
            xx, yy = x + k * DX[d], y + k * DY[d]
            if c[xx][yy] != 0 and c[xx][yy] != a:
                flag = False
                break
            stack.append(((xx * KETA + yy) << 2) + (d - 1) % 4)
            stack.append(((xx * KETA + yy) << 2) + (d + 1) % 4)
            c[xx][yy] = a
        if flag:
            stack.append(((xx * KETA + yy) << 2) + d)
        if c[x2][y2] > 0:
            print(c[x2][y2])
            return

    print(-1)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
INF = float("inf")


def main():
    H, W, K = map(int, input().split())
    x1, y1, x2, y2 = map(lambda x: int(x)-1, input().split())
    c = []
    for i in range(H):
        c.append(input())
    # 移動方法が4*K個考えられる無向グラフ
    # 到達可能性は最短経路を求めるだけでよい
    # 全ての箇所を探索するとO(H*W)必要に見える。
    # あれ、HW<=10^6がある。難しさは何？Kが大きいから枝が多すぎるということか。
    DX = [1, 0, -1,  0]
    DY = [0, 1, 0, -1]

    # 方向付きで、ダイクストラ法を使います。
    dist = [[-1]*W for _ in range(H)]
    dist[x1][y1] = 0
    Q = []                      # ヒープなんてもう知らない！
    M = 10**6
    Q.append((0, x1, y1, 0b1111))
    i = 0

    while i < len(Q):
        curr, x, y, DXY = Q[i]
        for j in range(4):
            if (DXY >> j) & 1 == 0:
                continue
            dx, dy = DX[j], DY[j]
            for k in range(1, K+1):
                X = x+k*dx
                Y = y+k*dy
                if not (0 <= X < H):
                    break
                if not (0 <= Y < W):
                    break
                if 0 < dist[X][Y] < curr+1:
                    break
                if dist[X][y] == curr+1:
                    continue
                if c[X][Y] == "@":
                    break
                dist[X][Y] = curr+1
                flag = (1 << ((j+1) % 4)) | (1 << ((j-1) % 4))
                if k != K:
                    Q.append((curr+1, X, Y, flag))
                else:
                    flag |= 1 << j % 4
                    Q.append((curr+1, X, Y, flag))
            if 0 < dist[x2][y2]:
                print(dist[x2][y2])
                return
        i += 1
    print(-1)
    return


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

from bisect import insort

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(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
for i in range(Z-1, 0, -1) :
    C[i] -= C[i-1]

n = []
for x in range(X) :
    for y in range(Y) :
        n.append((A[x]+B[y]+C[0], (x, y, 0)))
n.sort()

for _ in range(K) :
    cur, (x, y, z) = n.pop()
    print(cur)
    if z < Z - 1 :
        z += 1
        insort(n, (cur+C[z], (x, y, z)))

### FIXED CODE ###

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(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

s = []
for x in range(X) :
    for y in range(Y) :
        s.append(A[x]+B[y])
s.sort(reverse=True)

t = []
for k in range(min(K, len(s))) :
    for z in range(Z) :
        t.append(s[k]+C[z])
        
t.sort(reverse=True)

print("\n".join(map(str, t[:K])))
### BUGGY CODE ###

import copy
N = int(input())
lists = [0]*N
ans = []
for i in range(N):
    A = int(input())
    lists[i] = A
i = 0
while 1:
    if i == N:
        break
    tmp = copy.deepcopy(lists[i])
    lists[i] = 0
    print(max(lists))
    lists[i] = tmp
    i += 1


### FIXED CODE ###

import copy
N = int(input())
A = [int(input()) for i in range(N)]
set_A = list(set(A))
set_A.sort(reverse=True)
A_copy = copy.deepcopy(A)
A_copy.sort(reverse=True)
Max = max(A)
cnt = 0
for i in range(N):
    if A[i] == Max:
        cnt += 1
for i in range(N):
    if A[i] == Max:
        if cnt > 1:
            print(Max)
        else:
            print(set_A[1])
    else:
        print(Max)
### BUGGY CODE ###

import sys
inputs = sys.stdin.readline
N, Q= map(int,inputs().split())
V = [None]*N
E = []
for n in range(N):
	V[n] = list(map(int,inputs().split()))
	V[n][0] -= V[n][2]
	V[n][1] -= V[n][2]
	E.append([V[n][0],1,V[n][2]])
	E.append([V[n][1],-1,V[n][2]])
E.sort(key = lambda x:x[0])
d = int(inputs())
mini = 1000000001
kouho = [1000000001]
q = 0
flag = False
for e in E:
	while(e[0] > d):
		for k in kouho:
			mini = min(k,mini)
		if mini < 1000000001:
			print(mini)
			mini = 1000000001
		else:
			print(-1)
			mini = 1000000001
		if q < Q-1:
			q = q + 1
			d = int(inputs())
		else:
			flag = True
			q = q + 1
			break
	if flag == True:
		break
	if  e[1] == 1:
		kouho.append(e[2])
	elif e[1] == -1:
		kouho.remove(e[2])
for t in [None]*(Q-q):
	print(-1)

### FIXED CODE ###

import sys
from operator import itemgetter
def main():
	inputs = sys.stdin.readline
	N, Q= map(int,inputs().split())
	E = [None]*2*N
	for n in range(N):
		a,b,c = map(int,inputs().split())
		E[2*n] = (a - c, 1, c)
		E[2*n + 1] = (b - c, -1, c)
	E.sort(key=itemgetter(0))
	tuple(tuple(E))
	mini = 1000000001
	kouho = {1000000001}
	my_add = kouho.add
	my_discard = kouho.discard
	q = 0
	d = int(inputs())
	flag = False
	cont = False
	for e in E:
		while e[0] > d:
			if cont == True:
				print(mini-(mini//1000000001)*1000000002)
			else:
				mini = min(kouho)
				print(mini-(mini//1000000001)*1000000002)
			cont = True
			q = q + 1
			if q > Q-1:
				flag = True
				break
			d = int(inputs())
		if flag == True:
			break
		if e[1] == 1:
			my_add(e[2])
			if mini > e[2]:
				mini = e[2]
		elif e[1] == -1:
			my_discard(e[2])
			if mini == e[2]:
				cont = False
	for t in [None]*(Q-q):
		print(-1)
main()
### BUGGY CODE ###

S=input()
s=len(S)
dp=[[0,0,0,0]for i in range(s+1)]
dp[s][3]=1
for i in range(s-1,-1,-1):
    for j in[3,2,1,0]:
        dp[i][j]=(3 if S[i]=='?'else 1)*dp[i+1][j]
        if j!=3:dp[i][j]+=(1 if S[i]=='?'or S[i]=='ABC'[j]else 0)*dp[i+1][j+1]
print(dp[0][0]%(10**9+7))

### FIXED CODE ###

S=input()
s=len(S)
dp=[[0,0,0,0]for i in range(s+1)]
dp[s][3]=1
for i in range(s-1,-1,-1):
    for j in[3,2,1,0]:
        dp[i][j]=(3 if S[i]=='?'else 1)*dp[i+1][j]
        if j!=3:dp[i][j]+=(1 if S[i]=='?'or S[i]=='ABC'[j]else 0)*dp[i+1][j+1]
        dp[i][j]%=(10**9+7)
print(dp[0][0])
### BUGGY CODE ###

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

ans = 0
for x in range(n + 1):
    ans = max(ans, int(a / b * x) - a * int(x / b))

print(ans)

### FIXED CODE ###

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

x = min(n, b - 1)

print(int(a * x / b) - a * int(x / b))
### BUGGY CODE ###

from itertools import combinations

N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
cnt = 0
for x,y in combinations(A,2):
    z = x * y % mod
    cnt += z
print(cnt % mod)

### FIXED CODE ###

N = int(input())
A = [0] + list(map(int, input().split()))
mod = 10**9 + 7

t = sum(A)
ans = 0
for i in range(1,N+1):
    t -= A[i]
    ans += A[i] * t % mod
print(ans % mod)
### BUGGY CODE ###

import  math
k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans+=math.gcd(math.gcd(i,j),l)

print(ans)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
k=int(input())
ans=0
first=k*(k+1)//2
second=0

for i in range(1,k):
    for j in range(i+1,k+1):
        second+=gcd(i,j)*6

thir=0
for i in range(1,k-1):
    for j in range(i+1,k):
        for h in range(j+1,k+1):
            tmp=gcd(gcd(i,j),h)
            thir+=tmp*6

if k==1:
    print(first)
elif k==2:
    print(first+second)
else:
    print(first+second+thir)
### BUGGY CODE ###

def C():
    N = int(input())

    literals = []

    for i in range(N):
        word_vec = [0]*26
        word = input()
        for char in word:
            word_vec[ord(char) - 97] += 1
        literals.append(word_vec)

    answer = 0
    for i in range(N):
        target = literals.pop()
        answer += literals.count(target)

    print(answer)

if __name__ == '__main__':
  C()


### FIXED CODE ###

def C():
    N = int(input())

    word_dict = dict()
    count = 0

    for i in range(N):
        word = ''.join(sorted(input()))
        if word not in word_dict.keys():
            word_dict[word] = 1
        else:
            count += word_dict[word]
            word_dict[word] += 1

    print(count)

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

import math

def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

N = int(input())
arr = []
ans = 0
for _ in range(N):
    S = input()
    tmp_arr = []
    for i in range(10):
        tmp_arr.append(S[i])
    tmp_arr.sort()
    arr.append(tmp_arr)
# print(arr)

while len(arr) != 0:
    tmp = len(arr)
    item = arr[0]
    # print(tmp)
    # print(item)
    while item in arr:
        arr.remove(item)
    tmp_ans = tmp - len(arr)
    # print(tmp_ans)
    if tmp_ans - 2 >= 0:
        ans += C(tmp_ans,2)

print(ans)





### FIXED CODE ###

import math

def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

N = int(input())
arr = {}
ans = 0
for _ in range(N):
    S = input()
    tmp_arr = []
    for i in range(10):
        tmp_arr.append(S[i])
    tmp_arr.sort()
    moji_sorted = ''
    for i in tmp_arr:
        moji_sorted += i
    if moji_sorted in arr:
        arr[moji_sorted] += 1
    else:
        arr[moji_sorted] = 1
# print(arr)

for i in arr.values():
    if i-2 >= 0:
        ans += C(i,2)

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

from collections import Counter

N = int(input())
a = list(input().split())
A = [int(a[i]) for i in range(N)]
Q = int(input())
Query = [input().split() for i in range(Q)]
SUM = sum(A)
num = [A.count((i+1)) for i in range(100000)]

for i in range(Q):
    B = int(Query[i][0])
    C = int(Query[i][1])
    SUM += (C-B) * num[B-1]
    print(SUM)
    num[C-1] += num[B-1]
    num[B-1] = 0 

### FIXED CODE ###

from collections import Counter

N = int(input())
a = list(input().split())
A = [int(a[i]) for i in range(N)]
Q = int(input())
Query = [input().split() for i in range(Q)]
SUM = sum(A)
A_count = Counter(A)
num = [A_count[i+1] for i in range(100000)]

for i in range(Q):
    B = int(Query[i][0])
    C = int(Query[i][1])
    SUM += (C-B) * num[B-1]
    print(SUM)
    num[C-1] += num[B-1]
    num[B-1] = 0
### BUGGY CODE ###

while 1:
	try:
		s,t = raw_input(),raw_input()
		if len(s) < len(t): s,t = t,s
		ans = 0
		for L in range(len(t),0,-1):
			for sp in range(len(t)-L):
				if t[sp:sp+L] in s:
					ans = L
					break
			if ans > 0:
				break
		print ans
	except:
		break

### FIXED CODE ###

while 1:
	try:
		s,t = raw_input(),raw_input()
		if len(s) < len(t): s,t = t,s
		MAXL = sum(min(s.count(i),t.count(i)) for i in set(list(s))&set(list(t)))
		ans = 0
		for sp in range(len(t)):
			if len(t) - sp <= ans:
				break
			for L in range(ans+1,min(MAXL+1,len(t)-sp+1)):
				if t[sp:sp+L] in s:
					ans = L
				else:
					break
		print ans
	except:
		break
### BUGGY CODE ###

from collections import defaultdict
from functools import reduce
import sys
sys.setrecursionlimit(1000000)

v = defaultdict(list)
p = defaultdict(int)
mod = 10**9+7

N, K = map(int, input().split())
for _ in range(N-1):
    a, b = map(int, input().split())
    v[a].append(b)
    v[b].append(a)

visited = [False]*(N+1)
def dfs(pos, parent):
    visited[pos] = True
    p[pos] = K-sum(visited[i] for i in v[parent])
    for i in v[pos]:
        if visited[i]:continue
        visited[i] = True
        dfs(i, pos)

dfs(1, 0)
ans = reduce(lambda x,y:(x*y)%mod, p.values())
print(ans)

### FIXED CODE ###

from collections import defaultdict
v = defaultdict(list)
mod = 10**9+7

N, K = map(int, input().split())
for _ in range(N-1):
    a, b = map(int, input().split())
    v[a].append(b)
    v[b].append(a)

visited = [False]*(N+1)
ans = 1

q = [(1, 0, 0)]
while q:
    pos, parent, score = q.pop()
    visited[pos] = True
    ans *= (K-score)
    ans %= mod 
   
    a = 1 if pos==1 else 2
    b = 0

    for i in v[pos]:
        if visited[i]:continue
        q.append((i, pos, a+b))
        b += 1

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

import sys
input = sys.stdin.readline

def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
    
def same(x,y):
    return find(x) == find(y)

def size(x):
    return -par[find(x)]


n,m,k = map(int,input().split())
ab = [list(map(int,input().split()))for i in range(m)]
cd = [list(map(int,input().split()))for i in range(k)]

par = [-1]*(n+1)
for i in range(m):
    unite(ab[i][0],ab[i][1])

ablist = [set()for i in range(1+n)]
cdlist = [set()for i in range(n+1)]
for elem in ab:
    ablist[elem[0]].add(elem[1])
    ablist[elem[1]].add(elem[0])
for elem in cd:
    cdlist[elem[0]].add(elem[1])
    cdlist[elem[1]].add(elem[0])

all = set(range(1,n+1))
anslist = []
for i in range(1,n+1):
    cand = list(all-ablist[i]-cdlist[i]-{i})
    c = 0
    for j in range(len(cand)):
        if same(i,cand[j]):
            c += 1
    anslist.append(c)

for ans in anslist:
    print(ans, end = " ")



### FIXED CODE ###

import sys
input = sys.stdin.readline

def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True
    
def same(x,y):
    return find(x) == find(y)

def size(x):
    return -par[find(x)]

n,m,k = map(int,input().split())
ab = [list(map(int,input().split()))for i in range(m)]
cd = [list(map(int,input().split()))for i in range(k)]

friend = [0]*(n+1)
for i in range(m):
    friend[ab[i][1]] += 1
    friend[ab[i][0]] += 1

par = [-1]*(n+1)
for i in range(m):
    unite(ab[i][0],ab[i][1])

block = [0]*(n+1)
for i in range(k):
    if same(cd[i][0],cd[i][1]):
        block[cd[i][0]] += 1
        block[cd[i][1]] += 1
    #block[cd[i][0]].append(cd[i][1])
    #block[cd[i][1]].append(cd[i][0])



for i in range(1,n+1):
    print(size(i)-friend[i]-block[i]-1,end = " ")
### BUGGY CODE ###

n = int(input())
s = input()
l = []
res = 0

for i in range(0,n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if(s[i]+s[j]+s[k] not in l):
                l.append(s[i]+s[j]+s[k])
                res += 1
print(res)

### FIXED CODE ###

from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)
### BUGGY CODE ###

import math

def solve(n,m,k,a_lst,b_lst):
    #机ごと、読書時間の累積をリストにする。ただし、リスト化はk時間内で読める範囲とする
    aa_lst = make_sum_list(a_lst,k)
    bb_lst = make_sum_list(b_lst,k)
    len_aa = len(aa_lst)
    len_bb = len(bb_lst)

    #A,Bいずれかが一冊も読めないケースを考慮
    if len_aa == 0:
        if len_bb == 0: return 0
        else: return len_bb
    elif len_bb == 0: return len_aa
    
    #全て読めるケースを考慮
    if aa_lst[-1] + bb_lst[-1] <= k: return len_aa + len_bb 
    
    #A,Bいずれかのみ読むケースを考慮
    max_read = max(len_aa,len_bb)

    #リスト範囲でA+Bの最大値を探索する
    for i in reversed(range(len_aa)):
        time = aa_lst[i]
        read = i + 1
        if read + len_bb + 1 <= max_read:
            break

        for j in reversed(range(len_bb)):
            if read + j + 1 <= max_read:
                break
            if time + bb_lst[j] <= k:
                read += j + 1
                break
		
        max_read = max(read,max_read)

    return max_read

def make_sum_list(lst,max):
    sum_lst = []
    sum = 0
    for n in lst:
        sum += n
        if sum > max:
            break
        sum_lst.append(sum)
    return sum_lst

n,m,k = map(int, input().split())
a_lst = list(map(int, input().split()))
b_lst = list(map(int, input().split()))
ans = solve(n,m,k,a_lst,b_lst)
print(ans)

### FIXED CODE ###

import math

def solve(n,m,k,a_lst,b_lst):
    #机ごと、読書時間の累積をリストにする。ただし、リスト化はk時間内で読める範囲とする
    aa_lst = make_sum_list(a_lst,k)
    bb_lst = make_sum_list(b_lst,k)
    len_aa = len(aa_lst)
    len_bb = len(bb_lst)

    #A,Bいずれかが一冊も読めないケースを考慮
    if len_aa == 0:
        if len_bb == 0: return 0
        else: return len_bb
    elif len_bb == 0: return len_aa
    
    #全て読めるケースを考慮
    if aa_lst[-1] + bb_lst[-1] <= k: return len_aa + len_bb 
    
    #A,Bいずれかのみ読むケースを考慮
    max_read = max(len_aa,len_bb)

    #リスト範囲でA+Bの最大値を探索する。2分探索を用いる
    for i in reversed(range(len_aa)):
        time = aa_lst[i]
        read = i + 1
        if read + len_bb + 1 <= max_read:
            break
        imax = len_bb-1
        imin = 0
        imid = len_bb // 2
        while True:
            if time + bb_lst[imid] <= k:
                #OK。大を調べる
                if imax - imid <= 1:
                    #探査終了
                    if time + bb_lst[imax] <= k:
                        read += imax + 1
                    else:
                        read += imid + 1
                    break
                imin = imid
            else:
                #NG。小を調べる
                if imid - imin <= 1:
                    #探査完了
                    if time + bb_lst[imin] <= k:
                        read += imin + 1
                    break
                imax = imid
            imid = (imin + imax) // 2
        max_read = max(read,max_read)
    return max_read


def make_sum_list(lst,max):
    sum_lst = []
    sum = 0
    for n in lst:
        sum += n
        if sum > max:
            break
        sum_lst.append(sum)
    return sum_lst

n,m,k = map(int, input().split())
a_lst = list(map(int, input().split()))
b_lst = list(map(int, input().split()))
ans = solve(n,m,k,a_lst,b_lst)
print(ans)