Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

MOD = 10 ** 9 + 7
s = input().strip()
if s[-1] == "?":
    tmp = [1 for i in range(10)] + [0 for i in range(3)]

else:
    tmp = [0 for i in range(13)]
    # print("-------------------")
    # print(s[-1])
    # print(int(s[-1]))
    tmp[int(s[-1])] = 1

keta = 1
for c in s[::-1][1:]:
    keta  = (keta * 10) % 13
    nw = [0 for i in range(13)]
    if c != "?":
        seni = int(c) * keta
        for j, num in enumerate(tmp):
            nw[(j+seni)%13] += num
    else:
        for isure in range(10):
            seni = int(isure) * keta
            for j, num in enumerate(tmp):
                nw[(j + seni) % 13] += num
    # print(nw)
    tmp = [num % MOD for num in nw]
    # tmp = nw
print(nw[5] % MOD)




### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)
 
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
 
MOD = 10 ** 9 + 7
s = input().strip()
n = len(s)
if s[-1] == "?":
    tmp = [1 for i in range(10)] + [0 for i in range(3+13*(n-1))]
 
else:
    tmp = [0 for i in range(13*n)]
    # print("-------------------")
    # print(s[-1])
    # print(int(s[-1]))
    tmp[int(s[-1])] = 1
# print(len(tmp))
keta = 1
for kt, c in enumerate(s[::-1][1:]):
    keta = (keta * 10) % 13
    
    if c != "?":
        seni = int(c) * keta
        for j in range(13):
            tmp[(j + seni) % 13 + (kt + 1) * 13] += tmp[kt * 13 + j] % MOD
    else:
        for isure in range(10):
            seni = isure * keta
            for j in range(13):
                tmp[(j + seni) % 13 + (kt + 1) * 13] += tmp[kt * 13 + j] % MOD
                # print(nw)
 
    # print(tmp[(13*kt):13*(kt+1)])
    # tmp = [num % MOD for num in nw]
    # tmp = nw
print(tmp[-8] % MOD)
N=int(input())
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
B1=[0*i for i in range(N)]
B2=[0*i for i in range(N)]

B1[0]=A1[0]
B2[0]=A2[0]
for i in range(0,N-1):
    B1[i+1]=B1[i]+A1[i+1]
    B2[i+1]=B2[i]+A2[i+1]
maximum=B1[0]+B2[N-1]
for i in range(1,N):
    point=B1[i]+(B2[N-1]-B2[i-1])
    maximum=max(maximum,point)
print(maximum)


### FIXED CODE ###

X=int(input())
A=int(input())
B=int(input())
X=X-A
while X>=B:
    X=X-B
print(X)
X = int(input())
item = [100, 101, 102, 103, 104, 105]
dp = [[False for _ in range(X//100+4)] for _ in range(X+2)]
dp[0][0] = True
for x in range(X+2):
    for n in range(X//100+4):
        for i in item:
            if dp[x-i][n-1]:
                dp[x][n] = True
if True in dp[x]:
    print(1)
else:
    print(0)

### FIXED CODE ###

X = int(input())
dp = [False for _ in range(X+1)]
dp[0] = True
for x in range(X+1):
    if x > 99:
        item = [100, 101, 102, 103, 104, 105]
        for i in item:
            if dp[x-i]:
                dp[x] = True
if dp[X]:
    print(1)
else:
    print(0)
from functools import lru_cache
N = int(input())
hap_list = [list(map(int, input().rstrip().split(' '))) for _ in range(N)]
@lru_cache(maxsize=None)
def happiness(days=N):
  if not days:
    return 0, 0, 0
  last_result = happiness(days-1)
  choice_a = hap_list[days-1][0] + max(last_result[1], last_result[2])
  choice_b = hap_list[days-1][1] + max(last_result[0], last_result[2])
  choice_c = hap_list[days-1][2] + max(last_result[0], last_result[1])
  return choice_a, choice_b, choice_c
print(max(happiness(N)))


### FIXED CODE ###

N = int(input().rstrip())
judge = []
for _ in range(N):
  hap_lst = list(map(int, input().rstrip().split(' ')))
  if not judge:
    judge = hap_lst
  else:
    a_0, b_0, c_0 = judge
    a_1, b_1, c_1 = hap_lst
    judge = [a_1 + max(b_0, c_0), b_1 + max(a_0, c_0), c_1 + max(a_0, b_0)]
print(max(judge))
S=input()

i=0
flag=0
while i<len(S):
    if S[i] == 'h' and S[i+1] == 'i':
        i=i+2
    else:
        print('No')
        flag=1
        i=len(S)

if flag==0:
    print('Yes')

### FIXED CODE ###

S=input()

i=0
flag=0
while i<len(S) and len(S)%2==0:
    if S[i] == 'h' and S[i+1] == 'i':
        i=i+2
    else:
        flag=1
        i=len(S)

if flag==0 and len(S)%2==0:
    print('Yes')
else:
    print('No')
import os
 
N = int(input())
 
def main(n, var):
    mylist = []
    dupliN = n
    for i in range(2, int(-(-n**0.5//var))+var):
        if dupliN%i==0:
            cnt=0
            while dupliN%i==0:
                cnt+=var
                dupliN //= i
            mylist.append([i, cnt])
 
    if dupliN!=1:
        mylist.append([dupliN, 1])
    if mylist==[]:
        mylist.append([n, 1])
    return mylist
if N == 1:
    print(0)
    os._exit()
f = main(N, 1)
ansval = 0
for extra, value in f:
    num = 1
    while True:
        value -= num
        if value < 0:
            break
        ansval += 1
        num += 1 
print(ansval)

### FIXED CODE ###

try: 
    N = int(input())
except:
    exit()
def main(n, var):
    mylist = []
    dupliN = n
    for i in range(2, int(-(-n**0.5//var))+var):
        if dupliN%i==0:
            cnt=0
            while dupliN%i==0:
                cnt+=var
                dupliN //= i
            mylist.append([i, cnt])
 
    if dupliN!=1:
        mylist.append([dupliN, 1])
    if mylist==[]:
        mylist.append([n, 1])
    return mylist
if N == 1:
    print(0)
    exit()
f = main(N, 1)
ansval = 0
for extra, value in f:
    num = 1
    while True:
        value -= num
        if value < 0:
            break
        ansval += 1
        num += 1 
print(ansval)
b = int(input())
print("A" if b=="T" else "T" if b=="A" else "G" if b=="C" else "C")

### FIXED CODE ###

b = input()
print("A" if b=="T" else "T" if b=="A" else "G" if b=="C" else "C")
d t s = map(int, input().split())
if d<t*s:
  print('Yes')
else:
  print('No')
  

### FIXED CODE ###

d, t, s = map(int, input().split())
if d<=t*s:
  print('Yes')
else:
  print('No')
N = int(input())
A = list(map(int, input().split()))

B = []

if N == 0:
    if A[0] != 1:
        print(-1)
        exit()
    else:
        print(1)
        exit()

else:
    if A[0] != 0:
        print(-1)
        exit()
    else:
        B.append(1)
        for i in range(1, N + 1):
            B.append((B[i - 1] - A[i - 1]) * 2)
            if (A[i] > B[i] or (A[i] == B[i] and i != N)):
                print(-1)
                exit()

        ans = 0
        ans += A[N]
        B[N] = A[N]
        for i in range(N, -1, -1):
            ans += min(B[i], B[i + 1] + A[i])
            B[i] = min(B[i], B[i + 1] + A[i])

        print(ans)
        exit()


### FIXED CODE ###

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

B = []

if N == 0:
    if A[0] != 1:
        print(-1)
        exit()
    else:
        print(1)
        exit()

else:
    if A[0] != 0:
        print(-1)
        exit()
    else:
        B.append(1)
        for i in range(1, N + 1):
            B.append((B[i - 1] - A[i - 1]) * 2)
            if (A[i] > B[i] or (A[i] == B[i] and i != N)):
                print(-1)
                exit()

        ans = 0
        ans += A[N]
        B[N] = A[N]
        for i in range(N - 1, -1, -1):
            ans += min(B[i], B[i + 1] + A[i])
            B[i] = min(B[i], B[i + 1] + A[i])

        print(ans)
        exit()
suuretu = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51,)
k = input()
suuretu[k+1]

### FIXED CODE ###

s=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(s[int(input())-1])
import math
A,B,C,D=map(int,input().split())
L=A*B//(math.gcd(A,B))
print(int(B-A+1-(B//C-A//C)-(B//D-A//D)+(B//L-A//L)))

### FIXED CODE ###

import fractions
A,B,C,D=map(int,input().split())
L=C*D//(fractions.gcd(C,D))
print(int(B-A+1-(B//C-((A-1)//C))-(B//D-((A-1)//D))+(B//L-((A-1)//L))))
from bisect import bisect_right
n,X = map(int,input().split())
a = sorted(list(map(int,input().split())))
ind = bisect_right(a,X)
if ind == 0:
    print(a[1]-X)
elif ind == n:
    print(X-a[ind-1])
else:
    print(min(a[ind]-X,X-a[ind-1]))


### FIXED CODE ###

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
n,X = map(int,input().split())
x = [abs(X-int(i)) for i in input().split()]
g = x[0]
for i in range(1,n):
    g = gcd(g,x[i])
print(g)
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=a[:min(k,len(a)]
b=b[:min(k,len(b)]
c=c[:min(k,len(c)]
d=[]
ans=[]
for i in a:
    for j in b:
        d.append(i+j)
d=d[:min(k,len(d)]
for i in c:
    for j in d:
        ans.append(i+j)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])


### 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)
if k>x: a=a[:k]
if k>y: b=b[:k]
if k>z: c=c[:k]
d=[]
ans=[]
for i in a:
    for j in b:
        d.append(i+j)
d.sort(reverse=True)
if len(d)>k: d=d[:k]
for i in c:
    for j in d:
        ans.append(i+j)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
import math
import itertools
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,k=map(int,input().split())
a=list(map(int, input().split()))
a=sorted(a)
mlist=[]
zlist=[]
plist=[]
for i in a:
  if i<0:
    mlist.append(i)
  elif i==0:
    zlist.append(i)
  else:
    plist.append(i)
mnum=len(mlist)
znum=len(zlist)
pnum=len(plist)
mans=mnum*pnum
zans=znum*(pnum+mnum)
if znum>=2:
  zans+=combinations_count(znum,2)
pans=0
if pnum>=2:
  pans+=combinations_count(pnum,2)
if mnum>=2:
  pans+=combinations_count(mnum,2)

if k<mans:
  ans=[]
  l=mlist[0]*plist[-1]
  r=mlist[-1]*plist[0]
  while True:
    x=(l+r)//2
    c=0
    for m in mlist:
      for p in plist[::-1]:
        if m*p<x:
          c+=1
        else:
          break
    if c<k:
      l=x
    else:
      r=x
    if r==l+1:
      break
  print(l)
elif k<mans+zans:
  print(0)
else:
  k=k-(mans+zans)
  mlist=mlist[::-1]
  if mnum<2:
    l=plist[0]*plist[1]
    r=plist[-1]*plist[-2]
  elif pnum<2:
    l=mlist[0]*mlist[1]
    r=mlist[-1]*mlist[-2]
  else:
    if mlist[0]*mlist[1]<plist[0]*plist[1]:
      l=mlist[0]*mlist[1]
    else:
      l=plist[0]*plist[1]
    if mlist[-1]*mlist[-2]>plist[-1]*plist[-2]:
      r=mlist[-1]*mlist[-2]
    else:
      r=plist[-1]*plist[-2]
  #print(k)
  while True:
    x=(l+r)//2
    c=0
    max=0
    if mnum>=2:
      for i,m in enumerate(mlist[:-1]):
        for j in mlist[i:]:
          n=m*j
          if n<x:
            c+=1
            if n>=max:max=n
          else:
            break
    if pnum>=2:
      for i,p in enumerate(plist[:-1]):
        for j in plist[i:]:
          n=p*j
          if n<x:
            c+=1
            if n>=max:max=n
          else:
            break
    #print("c"+str(c))
    if c<k:
      l=x
      #print("l"+str(l))
    else:
      r=x
      #print("r"+str(r))
    if r==l+1:
      break
    if c==k:break
  print(l)

### FIXED CODE ###

import numpy as np
import sys
 
n,k=map(int,sys.stdin.readline().split())
a=np.array(list(map(int, input().split())))
 
a.sort()
neg=a[a<0]
zero=a[a==0]
pos=a[a>0]
 
def count(x):
    cnt=0
    if x>=0:
        cnt+=len(zero)*n
    cnt+=np.searchsorted(a,x//pos,side='right').sum()
    cnt+=(n-np.searchsorted(a,(-x-1)//(-neg),side='right')).sum()
    cnt-=np.count_nonzero(a*a<=x)
    return cnt//2
 
 
left=-10**18
right=10**18
 
while left+1<right:
    x=(left+right)//2
    out=count(x)
    if out>=k:
        right=x
    if out<k:
        left=x
print(right)
n, a, b = map(int,input().split())

sum = ""
k = (n//(a+b)+1)
blue = "b"*a
red = "r"*b
sum = (blue + red) * k
ans = sum[:n].count("b")
print(ans)

### FIXED CODE ###

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

ans = a*(n//(a+b))+ min(a,n%(a+b))
print(ans)
A,B,C = map(int, input().split())
r = max(A,B,C)*9 + sum(A, B, C)
print(int(r))

### FIXED CODE ###

A,B,C = map(int, input().split())
r = max(A,B,C)*9 + A+B+C
print(int(r))
import numpy as np
import math
import collections
import bisect
import itertools
from collections import Counter

suf_xor_dict = {}
pre_xor_dict = {}


def suf_xor(N, p):
    # print(p)
    global xor_dict
    if N - len(p) + 1 in suf_xor_dict:
        # print("memo")
        return suf_xor_dict[N - len(p) + 1]
    if len(p) == 0:
        return 0
    if len(p) == 1:
        return p[0]
    if len(p) == 2:
        suf_xor_dict[N - 1] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[0] ^ suf_xor(N, p[1:])
        suf_xor_dict[N - len(p) + 1] = ret
        return ret


def pre_xor(N, p):
    global pre_xor_dict
    if N - len(p) + 1 in pre_xor_dict:
        # print("memo")
        return pre_xor_dict[N - len(p) + 1]
    if len(p) == 0:
        return 0
    if len(p) == 1:
        return p[0]
    if len(p) == 2:
        pre_xor_dict[N - 1] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[-1] ^ pre_xor(N, p[:-1])
        pre_xor_dict[N - len(p) + 1] = ret
        return ret


def main():
    N = int(input())
    a = list(map(int, input().split()))
    ans = []
    last = pre_xor(N, a[:N - 1]) ^ suf_xor(N, a[N:])
    for i in range(N - 1):
        ans.append(pre_xor(N, a[:i]) ^ suf_xor(N, a[i + 1:]))

    ans.append(last)
    for item in ans:
        print(item, end=' ')
    print('')


if __name__ == "__main__":
    main()


### FIXED CODE ###

import numpy as np
import math
import collections
import bisect
import itertools
from collections import Counter

suf_xor_dict = {}
pre_xor_dict = {}


def suf_xor(N, p):
    # print(p)
    global xor_dict
    if N - len(p) + 1 in suf_xor_dict:
        return suf_xor_dict[N - len(p) + 1]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        suf_xor_dict[N] = p[0]
        return p[0]
    if len(p) == 2:
        suf_xor_dict[N] = p[1]
        suf_xor_dict[N - 1] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[0] ^ suf_xor(N, p[1:])
        suf_xor_dict[N - len(p) + 1] = ret
        return ret


def pre_xor(N, p):
    global pre_xor_dict
    if len(p) in pre_xor_dict:
        return pre_xor_dict[len(p)]

    if len(p) == 0:
        return 0
    if len(p) == 1:
        pre_xor_dict[1] = p[0]
        return p[0]
    if len(p) == 2:
        pre_xor_dict[1] = p[0]
        pre_xor_dict[2] = p[0] ^ p[1]
        return(p[0] ^ p[1])
    else:
        ret = p[-1] ^ pre_xor(N, p[:-1])
        pre_xor_dict[len(p)] = ret
        return ret


def main():
    N = int(input())
    a = list(map(int, input().split()))
    ans = []
    pre_xor_list = [0]
    suf_xor_list = [0]
    for i in range(N):
        pre_xor_list.append(pre_xor_list[i] ^ a[i])
        suf_xor_list.append(suf_xor_list[i] ^ a[N - i - 1])

    pre_xor_list = pre_xor_list[1:]
    suf_xor_list = suf_xor_list[1:]

    for i in range(N):
        ans.append((0 if i - 1 < 0 else pre_xor_list[i - 1]) ^ (0 if i >= N - 1 else suf_xor_list[N - i - 2]))

    for item in ans:
        print(item, end=' ')
    print('')


if __name__ == "__main__":
    main()
# coding: utf-8
import math


n = int(input())

tops = list(map(int, input().split()))
middles = list(map(int, input().split()))
lowers = list(map(int, input().split()))

max_lower = max(lowers)
middles = list(filter(lambda x: x < max_lower, middles))

max_middle = max(middles)
tops = list(filter(lambda x: x < max_middle, tops))

counter = 0
for top in tops:
    for middle in middles:
        if middle <= top:
            continue

        for lower in lowers:
            if lower <= middle:
                continue
            
            counter += 1
            
            
print(counter)

### FIXED CODE ###

# coding: utf-8
import math
import bisect

def calc():
    n = int(input())
    tops = list(map(int, input().split()))
    middles = list(map(int, input().split()))
    lowers = list(map(int, input().split()))
 
    tops = sorted(tops)
    lowers = sorted(lowers)
 
    counter = 0
 
    for i in range(n):
        # A < B
        top_num = bisect.bisect_left(tops, middles[i])
        
        # B < C
        lower_num = n - bisect.bisect_right(lowers, middles[i])
        
        counter += top_num * lower_num
    
    return counter
 
print(calc())
ans = 0
for i in range(1<<n):
    # 全switch(n)のon/offパターン数
    sw = [False]*M
    # 各電球の点灯リストを作成
    for j in range(M):
        # 各電球について
        cnt = 0
        for k in range(1,len(s[j])):
            if i>>s[j][k]-1&1:
                cnt += 1
        if cnt%2==p[j]:
            sw[j]=True
    if all(sw):
        ans+=1
print(ans)

### FIXED CODE ###

n, m = map(int,input().split())
s = list(list(map(int, input().split())) for _ in range(m)) 
p = list(map(int,input().split()))
ans = 0
for i in range(1<<n):
    # 全switch(n)のon/offパターン数
    sw = [False]*m
    # 各電球の点灯リストを作成
    for j in range(m):
        # 各電球について
        cnt = 0
        for k in range(1,len(s[j])):
            if i>>s[j][k]-1&1:
                cnt += 1
        if cnt%2==p[j]:
            sw[j]=True
    if all(sw):
        ans+=1
print(ans)
import numpy as np

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

a_array = np.array(a)

ans_array = np.zeros((n//2, n), dtype = np.int)

if n >=4:

  ans_array[0, 0] = a_array[0]
  ans_array[0, 1] = a_array[1]
  ans_array[0, 2] = a_array[2]

  for i in range(1, n//2):
    j = 2*(i+1)
    # print(i, j)
    ans_array[i, j-2] = ans_array[i-1, j-4] + a_array[j-2]
    ans_array[i, j-1] = max(ans_array[i-1, j-4], ans_array[i-1, j-3]) + a_array[j-1]
    if j < n:
      ans_array[i, j]  = max(ans_array[i-1, j-3], ans_array[i-1, j-2]) + a_array[j]
  # print(ans_array)

  print(np.max(ans_array[-1, -3:]))

else:
  print(max(a_array))

### FIXED CODE ###

n = list(input())

# print(n)
ans = "No"

for i in range(3):
  if n[i] == '7':
    ans = 'Yes'

print(ans)
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

b_sum = 0
for i in range(M):
    b_sum += B[i]
    if b_sum > K:
        b_sum -= B[i]
        j = i - 1
        break
result = j + 1

a_sum = 0
for i in range(N):
    a_sum += A[i]
    if a_sum > K:
        break
    while a_sum + b_sum > K:
        b_sum -= B[j]
        j -= 1
    result = max(result, (i + 1) + (j + 1))
print(result)


### FIXED CODE ###

from itertools import accumulate
from bisect import bisect_left

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

a = list(accumulate(A))
b = list(accumulate(B))

result = 0
j = bisect_left(b, K)
if j == M:
  result = M
elif b[j] == K:
    result = j + 1
else:
    result = j
for i in range(N):
    t = K - a[i]
    if t < 0:
        break
    j = bisect_left(b, t)
    if j == M:
        result = max(result, i + 1 + M)
    elif b[j] == t:
        result = max(result, i + 1 + j + 1)
    else:
        result = max(result, i + 1 + j)
print(result)
MOD = 10**9 + 7
N, M = map(int, input().split())
stairs = [0]*(N+1)
for _ in range(M):
    stairs[int(input())] = 1
ans = [0]*(N+1)
ans[1] = 1 if stairs[1] == 0 else 0
ans[2] = 1 + ans[1] if stairs[2] == 0 else ans[1]
for i in range(3,N+1):
    if stairs[i] == 1:
        ans[i] = 0
        continue
    ans[i] = (ans[i-1] + ans[i-2]) % MOD
print(ans[N])

### FIXED CODE ###

import sys
N, M = map(int, input().split())
if N == 1:
    print(1)
    sys.exit()
ana = [0] * M
ans = [0] * N
mod = 10 ** 9 + 7
if M != 0:
    for i in range(M):
      ans[int(input())-1] = -1
if ans[0] == -1 and ans[1] == -1:
    print(0)
    sys.exit()
elif ans[0] == -1:
    ans[0] = 0
    ans[1] = 1
elif ans[1] == -1:
    ans[0] = 1
    ans[1] = 0
else:
    ans[0] = 1
    ans[1] = 2

if N != 2:
    for i in range(2,N):
        if ans[i] == -1:
            ans[i] = 0
        else:
            ans[i] = (ans[i-1]  + ans[i-2]) % mod
print(ans[N-1])
N = int(input())
S, T = input().split()
A = str()				# ""にするとREになる
 
for i in range(N):
    A += S[i]
    A += T[i]
    
print(A)

### FIXED CODE ###

A = int(input())
B = int(input())
 
print(6-A-B)	#和から誤答を引けば正答
n,k = int(input().split())
if n >= 10:
    print(k)
else :
    print(k+100*(10-n))    

### FIXED CODE ###

n,k = map(int,input().split())
if n >= 10:
    print(k)
else :
    print(k+100*(10-n))
n=int(input())
l=list(int,input())
ans=0
for i in range(0,len(l)):
  for j in range(i+1,len(l)):
    for k in range(j+1,len(l)):
      if l[i]>=l[j] and l[i]>=l[k]:
        if l[i]>l[j]+l[k]:
          ans+=1
        else:
          ans+=0
      if l[j]>=l[i] and l[j]>=l[k]:
        if l[j]>l[i]+l[k]:
          ans+=1
        else:
          ans+=0
      if l[k]>=l[i] and l[k]>=l[j]:
        if l[k]>l[i]+l[j]:
          ans+=1
        else:
          ans+=0   
print(ans)          


### FIXED CODE ###

import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)
n=input()
a=list(map(int,input().split()))
an=[]
def aaa(i):
        b=a[i:]
        c=a[:i]
        x=sum(b)
        y=sum(c)
        return x-y
for i in range(len(a)):
    an+=[aaa(i)]
an=[abs(x) for x in an]
print(min(an))


### FIXED CODE ###

a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print("Possible")
else:
    print("Impossible")
A, B, C = [int(x) for x in input()]

if A - B > C:
  print(C)
elif C > A - B:
  print(A - B)

### FIXED CODE ###

A, B, C = [int(x) for x in input().split()]

if A - B >= C:
  print(0)
elif C > A - B:
  print(C - (A - B))
S = [i for i in input()]
k = ['A', 'C', 'G', 'T']
count_res = []
count = 0
for i in S:
    if i in k:
        count = count + 1
    else:
        count_res.append(count)
        count = 0
count_res.sort()
print(count_res[-1])

### FIXED CODE ###

S=input()
L=["A","C","G","T"]
cnt=0
ans=0
for i in range(len(S)):
    if S[i] in L:
        cnt+=1
        ans=max(ans,cnt)
    else:
        cnt=0
    
print(ans)
import numpy as np

dic={'.':0,'#':1}
N=int(input())
S=np.array([dic[i] for i in input()])

arr=np.ones((N,N))
for i in range(N):
    arr[i,:N-i]=0

if S.sum()==0:
    print(0)
elif S.sum()==N:
    print(0)    
else:
    print(min((arr!=S).sum(axis=1)))

### FIXED CODE ###

N = int(input())
S = input()
 
left_black=0
right_white=S.count(".")
ans=left_black+right_white

for i in S:
    if i==".":
        right_white-=1
        ans=min(ans,left_black+right_white)
    else:
        left_black+=1
        ans=min(ans,left_black+right_white)
print(ans)
import re

s = input()

regex = re.compile('[ACGT]+')

l = 0

for i in range(len(s)):
    r1 = regex.match(s[:i])
    r2 = regex.match(s[i:])
    if r1 and r1[0]:
        l = max(l, len(r1[0]))
    if r2 and r2[0]:
        l = max(l, len(r2[0]))

print(l)


### FIXED CODE ###

s = input()

max_count = 0
count = 0

for i in s:
    if i not in ['A', 'C', 'G', 'T']:
        count = 0
        continue
    count += 1
    max_count = max(max_count, count)

print(max_count)
def management(N,array):
	res = []
	for i in range(N):
      res[array[i]] += 1
    for j in range(len(res)):
      print(res[j])
     
    
    
N = int(input())
array = list(map(int,input().split())
managememt(N,array))

### FIXED CODE ###

def management(N,array):
  res = [0]*N
  for i in range(len(array)):
    res[array[i]-1] += 1
  for j in range(len(res)):
    print(res[j])

if __name__ == '__main__':
  N = int(input())
  array = list(map(int,input().split()))
  management(N,array)