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

def main():
    N = int(input())
    a = sorted(list(map(int,input().split())))
    cnt = 0

    for i in range(a[0],a[N-1]+1):
        cnt = max(a.count(i-1)+a.count(i)+a.count(i+1),cnt)
    print(cnt)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

def input():
    return sys.stdin.readline().strip()

def main():
    N = int(input())
    a = list(map(int,input().split()))
    cnt = [0] * (max(a) + 2)

    for i in a:
        if i != 0:
            cnt[i-1] += 1
        cnt[i] += 1
        cnt[i+1] += 1
    print(max(cnt))

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

r,g,b,n=map(int,input().split())
L=[r,g,b]
L.sort(reverse=True)
cnt=0
for i in range(n//L[0]+1):
    for j in range(n//L[1]+1):
        if (n-i*L[0]-j*L[1])%L[2]==0 and n-i*L[0]-j*L[1]>=0:
            cnt+=1
print(cnt)

### FIXED CODE ###

r,g,b,n=map(int,input().split())
cnt=0
for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-i*r-j*g)%b==0 and n-i*r-j*g>=0:
            cnt+=1
print(cnt)
### BUGGY CODE ###

import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

k,q=map(int,readline().split())
D=list(map(int,readline().split()))
NXM = map(int, read().split())

NXM=iter(NXM)
NXM=zip(NXM,NXM,NXM)

for n,x,m in NXM:
    tmpD=list(map(lambda x:x%m,D))
    SD=np.array([0]+tmpD,dtype=np.int64)
    SD=np.cumsum(SD)
    n-=1
    x=x%m
    x+=SD[-1]*(n//k)
    x+=SD[n%k]
    count=tmpD.count(0)*(n//k)
    count+=tmpD[:n%k].count(0)
    ans=n-x//m-count
    print(ans)

### FIXED CODE ###

import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

k,q=map(int,readline().split())
D=np.array(readline().split(),dtype=np.int64)
NXM = map(int, read().split())

NXM=iter(NXM)
NXM=zip(NXM,NXM,NXM)

for n,x,m in NXM:
    tmpD=D%m
    SD=np.hstack((np.zeros(1,dtype=np.int64), tmpD))#結合
    SD=np.cumsum(SD)
    n-=1
    x=x%m
    x+=SD[-1]*(n//k)
    x+=SD[n%k]
    count=(k-np.count_nonzero(tmpD))*(n//k)
    count+=n%k-np.count_nonzero(tmpD[:n%k])
    ans=n-x//m-count
    print(ans)
### BUGGY CODE ###

import math
import bisect
Q=int(input())

querys = [list(map(int,input().split())) for x in range(Q)]

def siever(x):
  nums = [a for a in range(2,x+1)]
  primes = []
  while nums[0] <= int(math.sqrt(x))+1:
    tmp = nums.pop(0)
    primes.append(tmp)
    for num in nums:
      if num%tmp == 0:
        nums.remove(num)
        continue
  
  return (primes+nums)

L = 0
for query in querys:
  L = max(L,query[1])
primes = siever(L)
L2017= []
for prime in primes:
  if (prime+1)//2 in primes:
    L2017.append(prime)
for query in querys:
  if query[0] == query[1]:
    if query[0] in L2017:
      print(1)
    else:
      print(0)
  else: 
    print(bisect.bisect_right(L2017,query[1]) - bisect.bisect_left(L2017,query[0]))

### FIXED CODE ###

import math
Q=int(input())
querys = [list(map(int,input().split())) for x in range(Q)]
large = max(q[1] for q in querys)
like2017 = [0]*(large+1)

#siever
cands = [False if (5 < i and (i%2)*(i%3)*(i%5) == 0) or (i < 2) or (i == 4) else True for i in range(large+1)]
if 5 <= large:
  for i in range(6,int(math.sqrt(large)+1)):
    if cands[i]:
      for j in range(i*i,large+1,i):
        if cands[j]:
          cands[j] = False

#find 2017-like-number          
for x in range(large+1):
  if cands[x] and cands[(x+1)//2]:
    like2017[x] = 1
for y in range(1,large+1):
  like2017[y] += like2017[y-1]

for q in querys:
  print(like2017[q[1]]-like2017[q[0]-1])
### BUGGY CODE ###

N = int(input())
num = list(map(int,input().split()))
if 0 in num:
  print(0)
else:
  a = 1
  for n in num:
    a = n*a
  if a> 10**18:
    a=-1
  print(a)


### FIXED CODE ###

import sys
N = int(input())
num = list(map(int,input().split()))
num.sort(reverse=True)
a = 1
if num[-1] == 0:
  print(0)
else:
  for n in range(N):
    a = num[n]*a
    if a> 10**18:
      print(-1)
      sys.exit()
  print(a)
### BUGGY CODE ###

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

def D159():
    N = int(input())
    A = input().split()
    #sum = 0
    for i in range(0, N):
        sum = 0
        A_ = copy.deepcopy(A)
        del A_[i]
        num = list(set(A_))
        num = [ _ for _ in num if A_.count(_) > 1]
        for j in num: # 全部回したら、タイムアウト
            sum += combinations_count(A_.count(j), 2)
        print(sum)

if __name__ == "__main__":
    D159()

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
import collections
A_count = collections.Counter(A)
 
import math
sum_ = 0
for ai in A_count:
    sum_ += (A_count[ai] * (A_count[ai] - 1)) // 2
 
for ai in A:
    #print(sum_ - (A_count[ai] * (A_count[ai] - 1)) // 2 + (A_count[ai] - 1) * (A_count[ai] - 2)) // 2
    l = A_count[ai] * (A_count[ai] - 1) // 2
    m = (A_count[ai] - 1) * (A_count[ai] - 2) // 2
    print(sum_ - l + m)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5+100)

def dfs(v):
    l = []
    
    for nv in G[v]:
        l.append(dfs(nv))
    
    l.sort(reverse=True)
    res = 0
    
    for i in range(len(l)):
        res = max(res, l[i]+i+1)
    
    return res

N = int(input())
G = [[] for _ in range(N)]

for i in range(1, N):
    a = int(input())
    G[a-1].append(i)

print(dfs(0))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5+100)

def dfs(v):
    l = []
    
    for nv in G[v]:
        l.append(dfs(nv))
    
    l.sort(reverse=True)
    res = 0
    
    for i in range(len(l)):
        res = max(res, l[i]+i+1)
    
    return res

N = int(input())
G = [[] for _ in range(N)]

for i in range(1, N):
    a = int(input())
    G[a-1].append(i)

print(dfs(0))
### BUGGY CODE ###

N=int(input())

ans=0
for i in range(1,N+1):
    for j in range(1,N):
        for k in range(1,N):
            for l in range(1,N):
                if l**2+j**2+k**2+l*j+j*k+k*l==i:
                    ans+=1
    print(ans)
    ans=0

### FIXED CODE ###

N=int(input())

ans=[0]*N

for i in range(1,int(N**0.5)):
    if i**2 >=N:
        break
    for j in range(1,int(N**0.5)):
            if i**2+j**2+i*j>=N:
                break
            for k in range(1,int(N**0.5)):
                    if i**2+j**2+k**2+i*j+j*k+k*i <=N:
                        ans[i**2+j**2+k**2+i*j+j*k+k*i-1] +=1

for i in range(N):
    print(ans[i])
### BUGGY CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w,k = map(int, input().split())
x1,y1,x2,y2 = map(lambda x: int(x)-1, input().split())
s = [None]*h
for i in range(h):
    s[i] = input()
    
from heapq import heappop as hpp, heappush as hp
q = []
hp(q, (0,x1,y1,(0,0),0))

dx = [0,1,0,-1]
dy = [1,0,-1,0]
dist = [[None]*w for _ in range(h)]
dist[x1][y1] = 0
done = [[0]*w for _ in range(h)]
done[x1][y1] = 15

while q:
    d, x, y, t, td = hpp(q)
    for i,(xx, yy) in enumerate(zip(dx,dy)):
        if (-xx,-yy)==t:
            continue
        nx, ny = xx+x, yy+y
        if nx<0 or nx>=h or ny<0 or ny>=w or s[nx][ny]=="@":
            continue
        if (xx,yy)==t and td<k:
            nd = d
            ntd = td+1
        else:
            nd = d+1
            ntd = 1
        if dist[nx][ny] is None or nd<dist[nx][ny]:
            hp(q, (nd,nx,ny,(xx,yy),ntd))
            dist[nx][ny] = nd
            done[nx][ny] = 1<<(i)
        elif nd==dist[nx][ny]and ((done[nx][ny]&1<<(i))==0):
            hp(q, (nd,nx,ny,(xx,yy),ntd))
            done[nx][ny] |= 1<<(i)
            
if dist[x2][y2] is None:
    print(-1)
else:
    print(dist[x2][y2])

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

h,w,k = map(int, input().split())
x1,y1,x2,y2 = map(lambda x: int(x)-1, input().split())
s = [None]*h
for i in range(h):
    s[i] = input()
    
from queue import deque
q0 = deque([(0,x1,y1,(0,0),0)])
q1 = deque()

dx = [0,1,0,-1]
dy = [1,0,-1,0]
# dist = [[None]*w for _ in range(h)]
dist = [None]*(w*h)
dist[x1*w+y1] = 0
# done = [[0]*w for _ in range(h)]
done = [0]*(w*h)
done[x1*w+y1] = 15

while q0 or q1:
    if not q0:
        q0 = q1
        q1 = deque()
    d, x, y, t, td = q0.popleft()
    for i,(xx, yy) in enumerate(zip(dx,dy)):
        if (-xx,-yy)==t:
            continue
        nx, ny = xx+x, yy+y
        if nx<0 or nx>=h or ny<0 or ny>=w or s[nx][ny]=="@":
            continue
        if (xx,yy)==t and td<k:
            nd = d
            ntd = td+1
            q = q0
        else:
            nd = d+1
            ntd = 1
            q = q1
        if dist[nx*w+ny] is None or nd<dist[nx*w+ny]:
            q.append((nd,nx,ny,(xx,yy),ntd))
            dist[nx*w+ny] = nd
            done[nx*w+ny] = 1<<(i)
        elif nd==dist[nx*w+ny]and ((done[nx*w+ny]&1<<(i))==0):
            q.append((nd,nx,ny,(xx,yy),ntd))
            done[nx*w+ny] |= 1<<(i)
            
if dist[x2*w+y2] is None:
    print(-1)
else:
    print(dist[x2*w+y2])
### BUGGY CODE ###

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

f=1
w=[]
d=set([])
t=[0]
chk=n
#while 1:
for i in range(m+1):
    f=pow(2,i)
    p=pow(x,f,m)
    if p in d: break
    d.add(p)
    w.append(p)
    t.append(t[-1]+p)
    #f*=2
    chk-=1
    if chk==0:
        print(t[-1])
        exit()
ans=0
a=w.index(p)
ans+=t[a]
n-=a
loo=len(w)-a
if n%loo==0:
    ans+=(t[-1]-t[a])*(n//loo)
else:
    ans+=(t[-1]-t[a])*(n//loo)
    ans+=t[a+n%loo]-t[a]
print(ans)


### FIXED CODE ###

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

f=1
w=[]
d=[0]*(m+2)
t=[0]
chk=n
p=x
for i in range(m+1):
    if i!=0: p=p*p%m
    if d[p]: break
    d[p]=1
    w.append(p)
    t.append(t[-1]+p)
    #f*=2
    chk-=1
    if chk==0:
        print(t[-1])
        exit()
ans=0
a=w.index(p)
ans+=t[a]
n-=a
loo=len(w)-a
if n%loo==0:
    ans+=(t[-1]-t[a])*(n//loo)
else:
    ans+=(t[-1]-t[a])*(n//loo)
    ans+=t[a+n%loo]-t[a]
print(ans)
### BUGGY CODE ###

K, S = map(int, input().split())
ct = 0
for X in range(K+1):
  if S - X > 0:
    for Y in range(K+1):
      if S - (X + Y) > 0:
        for Z in range(K+1):
          ct += (1 if X + Y + Z == S else 0)
      else:
        ct += (1 if X + Y == S else 0)
  else:
    ct += (1 if X == S else 0)
print(ct)

### FIXED CODE ###

K, S = map(int, input().split())
ct = 0
for X in range(K+1):
  for Y in range(K+1):
    if S - (X + Y) >= 0 and S - (X + Y) <= K :
        ct += 1 

print(ct)
### BUGGY CODE ###

ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,M=rl()

if M%N==0:
    print(M//N)
else:
    x = M//N
    ans = 1
    for i in range(x,0,-1):
        if M%i != 0:
            continue
        else:
            ans = i
            break
    print(ans)

### FIXED CODE ###

ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,M=rl()

if M%N==0:
    print(M//N)
else:
    x = M//N
    ans = 1
    for i in range(x,0,-1):
        if M%i != 0:
            continue
        else:
            ans = i
            break
    print(ans)
### BUGGY CODE ###

import collections

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

def comb(n):
    return n*(n-1)//2

L = collections.Counter(A)

for i in range(N):
    ans = 0
    for a in AS:
        if A[i] == a:
            ans += comb(L[a]-1)
        else:
            ans += comb(L[a])
    print(ans)


### FIXED CODE ###

import collections

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

def comb(n):
    return n*(n-1)//2

L = collections.Counter(A)

ans_tmp = 0
for a in AS:
    ans_tmp += comb(L[a])

for i in range(N):
    ans = ans_tmp
    ans += (comb(L[A[i]]-1) - comb(L[A[i]]))

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

N, W = map(int, input().split())

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cv, cw in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cv + v[i]] = min(
            dp.get(cv + v[i], float('inf')),
            cw + w[i])
print(max(dp))

### FIXED CODE ###

N, W = map(int, input().split())

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cv, cw in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cv + v[i]] = min(
            dp.get(cv + v[i], float('inf')),
            cw + w[i])
print(max(dp))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
dp=[0]*60
for i in range(60):
  for j in A:
    if j>>i&1==1:
      dp[i]+=1
      j+=1
ans=0
mod=10**9+7
for i in range(60):
  ans+=pow(2,i,mod)*dp[i]*(N-dp[i])
  ans%=mod
print(ans)

### FIXED CODE ###

def main():
  N=int(input())
  A=list(map(int,input().split()))
  mod=10**9+7
  ans=0
  for i in range(60):
    c=0
    for j in A:
      if j>>i&1:
        c+=1
    ans+=pow(2,i,mod)*c*(N-c)
    ans%=mod
  print(ans)
if __name__=='__main__':
  main()
### BUGGY CODE ###

n = int(input())
s = list(input() for _ in range(n))
ss = sorted(list(set(s)))
lens = len(ss)
l = [0]*lens
for i in range(n):
        l[ss.index(s[i])] += 1
for i in range(lens):
    if l[i] == max(l):
        print(ss[i])

### FIXED CODE ###

N = int(input())

d = {}
for _ in range(N):
    S = input()
    if S in d:
        d[S] += 1
    else:
        d[S] = 1

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
    print(s)
### BUGGY CODE ###

n, m = map(int, input().split())

neighbors = {}
for _ in range(m):
  a, b = map(int, input().split())
  if a not in neighbors.keys():
    neighbors.update({a:set()})
  if b not in neighbors[a]:
    neighbors[a].add(b)
  if b not in neighbors.keys():
    neighbors.update({b:set()})
  if a not in neighbors[b]:
    neighbors[b].add(a)
#print(neighbors)
lst = [0] * (n - 1) #部屋１を除く、すべての部屋の通り方を調べる、「通っていない」を0として定義
visited = set() #一度訪れた部屋は再度探索する必要はないので、それを省くための集合
queue = [[0, set([1])]]
while queue:
  #print(queue)
  pre_room, rooms = queue.pop(0) #左が今いる部屋、右が次に進む部屋
  #print(pre_room, rooms)
  for room in rooms:
    if room in visited:
      continue
    if lst[room - 2] == 0 and room != 1: #次に進む部屋が通っていないかどうか（と今いる部屋が１ではないこと）の確認
      lst[room - 2] = pre_room #部屋2の場合、lstのindexは0に相当するので-2する必要がある
    visited.add(room) #今いる部屋を訪れたので、集合に入れる
    next_rooms = set() #次に進む部屋を探索する
    for nei in neighbors[room]:
      next_rooms.add(nei)
    next_rooms = [room, next_rooms]
    queue.append(next_rooms)
if 0 in lst:
  print('No')
else:
  print('Yes')
  for i in range(n - 1):
    print(lst[i])


### FIXED CODE ###

n, m = map(int, input().split())

neighbors = {}
for _ in range(m):
  a, b = map(int, input().split())
  if a not in neighbors.keys():
    neighbors.update({a:set()})
  if b not in neighbors[a]:
    neighbors[a].add(b)
  if b not in neighbors.keys():
    neighbors.update({b:set()})
  if a not in neighbors[b]:
    neighbors[b].add(a)
#print(neighbors)
lst = [0] * (n - 1)
visited = set()
queue = [[0, set([1])]]
while queue:
  #print(queue)
  pre_room, rooms = queue.pop(0)
  #print(pre_room, rooms)
  for room in rooms:
    if room in visited:
      continue
    if lst[room - 2] == 0 and room != 1:
      lst[room - 2] = pre_room
    visited.add(room)
    next_rooms = set()
    for nei in neighbors[room]:
      next_rooms.add(nei)
    next_rooms = [room, next_rooms]
    queue.append(next_rooms)
if 0 in lst:
  print('No')
else:
  print('Yes')
  for i in range(n - 1):
    print(lst[i])
### BUGGY CODE ###

def mid(x, y, z):
    if x <= y <= z or z <= y <= x:
        return y
    elif y <= x <= z or z <= x <= y:
        return x
    return z

def test():
    from random import shuffle
    for _ in range(5):
        arr = [i for i in range(1, 11 + 1)]
        shuffle(arr)
        print(arr, end=" : ")
        while len(arr) > 1:
            tmp = [mid(arr[i], arr[i+1], arr[i+2]) for i in range(len(arr)-2)]
            arr = tmp
        print(arr[0])

def main():
    n, x = map(int, input().split())
    if x == 1 or x == 2*n-1:
        print("No")
    else:
        print("Yes")
        if n == 2:
            for i in range(1, 4):
                print(i)
        else:
            ans = [None]*(2*n - 1)
            st = set(i for i in range(1, 2*n))
            ans[n-1] = x
            st.remove(x)
            if x == 2:
                ans[n-3] = 4
                ans[n-2] = 1
                ans[n] = 3
                st.remove(1)
                st.remove(3)
                st.remove(4)
            else:
                ans[n-3] = x-2
                ans[n-2] = x+1
                ans[n] = x-1
                st.remove(x-2)
                st.remove(x+1)
                st.remove(x-1)
            for i in range(2*n-1):
                if ans[i] is None:
                    rm = -1
                    for v in st:
                        rm = v
                        break
                    ans[i] = rm
                    st.remove(rm)
            for v in ans:
                print(v)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def mid(x, y, z):
    if x <= y <= z or z <= y <= x:
        return y
    elif y <= x <= z or z <= x <= y:
        return x
    return z

def test():
    from random import shuffle
    for _ in range(5):
        arr = [i for i in range(1, 11 + 1)]
        shuffle(arr)
        print(arr, end=" : ")
        while len(arr) > 1:
            tmp = [mid(arr[i], arr[i+1], arr[i+2]) for i in range(len(arr)-2)]
            arr = tmp
        print(arr[0])

def main():
    n, x = map(int, input().split())
    if x == 1 or x == 2*n-1:
        print("No")
    else:
        print("Yes")
        if n == 2:
            for i in range(1, 4):
                print(i)
        else:
            ans = [None]*(2*n - 1)
            st = set(i for i in range(1, 2*n))
            ans[n-1] = x
            st.remove(x)
            if x == 2:
                ans[n-3] = 4
                ans[n-2] = 1
                ans[n] = 3
                st.remove(1)
                st.remove(3)
                st.remove(4)
            else:
                ans[n-3] = x-2
                ans[n-2] = x+1
                ans[n] = x-1
                st.remove(x-2)
                st.remove(x+1)
                st.remove(x-1)
            for i in range(2*n-1):
                if ans[i] is None:
                    ans[i] = st.pop()
            for v in ans:
                print(v)

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

from collections import deque

H, W = map(int, input().split())

def bfs(h, w):
    ls = deque([[h, w, 0]])
    direction = [[1,0], [-1,0], [0,1], [0,-1]]
    while len(ls) > 0:
        h, w, depth = ls.popleft()
        
        for dh, dw in direction:
            if h + dh < 0 or H-1 < h + dh: continue
            if w + dw < 0 or W-1 < w + dw: continue
            if depth + 1 < D[h+dh][w+dw] and G[h+dh][w+dw] != "#":
                ls.append([h+dh, w+dw, depth+1])
                D[h+dh][w+dw] = depth + 1

G = [[i for i in input()] for j in range(H)]
D = [[float("inf")] * W for i in range(H)]
for h in range(H):
    for w in range(W):
        if G[h][w] == "#":
            bfs(h, w)
            
ans = 0
for h in range(H):
    for w in range(W):
        if D[h][w] == float("inf"):
            continue
        ans = max(ans, D[h][w])
        
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

H, W = map(int, input().split())
G = [[i for i in input()] for j in range(H)]

ls = []
dp = [[-1 for i in range(W)] for j in range(H)]
for h in range(H):
    for w in range(W):
        if G[h][w] == "#":
            ls.append([h,w])
            dp[h][w] = 1

ans = -1
while len(ls) > 0:
    ans += 1
    temp = []
    for h, w in ls:
        if 0 <= h+1 <= H-1 and dp[h+1][w] == -1:
            dp[h+1][w] = 1
            temp.append([h+1,w])
        if 0 <= h-1 <= H-1 and dp[h-1][w] == -1:
            dp[h-1][w] = 1
            temp.append([h-1,w])
        if 0 <= w+1 <= W-1 and dp[h][w+1] == -1:
            dp[h][w+1] = 1
            temp.append([h,w+1])
        if 0 <= w-1 <= W-1 and dp[h][w-1] == -1:
            dp[h][w-1] = 1
            temp.append([h,w-1])
    ls = temp

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

k,s = map(int,input().split())

ans = 0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i + j + l == s:
                ans += 1
print(ans)

### FIXED CODE ###

k,s = map(int,input().split())

ans = 0
for i in range(k+1):
    for j in range(k+1):
        l = s - i - j
        if l <= k and l >= 0:
            ans += 1

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

n=int(input())
list1=[]
list2=[]
ans=[]
for i in range(n):
    list1.append(i+1)
#print(list1)
for i in range(n-1):
    list2.append(list1[i+1])
list2.append(1)

for i in range(n):
    ans.append(list1[i]%list2[i])
    #print(ans)
print(sum(ans))


### FIXED CODE ###

n=int(input())
ans=n*(n-1)//2
print(int(ans))
### BUGGY CODE ###

N=int(input())
total=0
for i in range(N):
    total+=i
print(total)

### FIXED CODE ###

N=int(input())
print(N*(N-1)//2 if N>2 else 1 if N==2 else 0)
### BUGGY CODE ###

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

dp = [0] * (mx+1)
for i in sorted(set(a)):
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and a.count(i) == 1:
        cnt += 1

print(cnt)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)
### BUGGY CODE ###

n = int(input())
s=input()

ans = 0
for i in range(1, n):
    l = s[:i]
    r = s[i:]
    if i < n/2:
        for j in range(len(l)):
            for k in range(j, len(l)+1):
                if k - j <= ans:
                    pass
                elif l[j:k] in r:
                    ans = k - j
    else:
        for j in range(len(r)):
            for k in range(j, len(r)+1):
                if k - j <= ans:
                    pass
                elif r[j:k] in l:
                    ans = k - j
print(ans)
        

### FIXED CODE ###

def z_algo(S):
    N = len(S)
    A = [0]*N
    i = 1; j = 0
    A[0] = l = len(S)
    while i < l:
        while i+j < l and S[j] == S[i+j]:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        k = 1
        while l-i > k < j - A[k]:
            A[i+k] = A[k]
            k += 1
        i += k; j -= k
    return A

n = int(input())
s = input()
def ceil(a, b):
   return a // b + (a % b > 0)
ans = 0
for i in range(n-1):
   for idx, j in enumerate(z_algo(s[i:])):
      ans = max(min(idx, j), ans)

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

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

cnt = 0
for i in range(N):
    for j in range(N):
        for k in range(N):
            if A[i] <B[j]:
                if B[j] < C[k]:
                    cnt += 1
print(cnt)

### FIXED CODE ###

from bisect import bisect_left, bisect

n=int(input())
la=sorted(list(map(int,input().split())))
lb=list(map(int,input().split()))
lc=sorted(list(map(int,input().split())))
ans=0
for i in lb:
    ans+=bisect_left(la,i)*(len(lc)-bisect(lc,i)) #iの挿入点つまりiより小さい値の数×(Cの総数-
print(ans)