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

# encoding][utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math

N,C = map(int,input().split())
tv_times = [[int(j) for j in input().split()] for i in range(N)]
# print(tv_times)

channells = {}
for i in range(N):
    s,g,c = tv_times[i]
    if c in channells.keys():
        channells[c] += [s,g]
    else:
        channells[c] = [s,g]

tv_times = []
for cha in channells.keys():
    remove_list = []
    time = channells[cha]
    time.sort()
    for i in range(len(time)-1):
        if time[i] == time[i+1]:
            remove_list.append(time[i])
    for j in range(len(remove_list)):
        time.remove(remove_list[j])
        time.remove(remove_list[j])

    for i in range(len(time)//2):
        tv_times.append([time[2*i],time[2*i+1]])


# print(channells)


max_end = -1
# print(tv_times)
for i in range(len(tv_times)):
    max_end = max(tv_times[i][1],max_end)

# print(tv_times)
# print(max_end)
count = [0 for i in range(max_end)]
for ni in range(len(tv_times)):
    for time in range(max(tv_times[ni][0]-1,0),tv_times[ni][1]):
        count[time] += 1

# print(count)
print(max(count))


### FIXED CODE ###

N,C = map(int,input().split())
tv_times = [[int(j) for j in input().split()] for i in range(N)]

channells = {}
for i in range(C+1):
    channells[i] = []
max_end = -1

for i in range(N):
    s,g,c = tv_times[i]
    max_end = max(max_end,g)
    channells[c] += [s,g]

tv_times = []
f = [0 for i in range(max_end+1)]
for cha in channells.keys():
    remove_list = []
    time = channells[cha]
    time.sort()
    for i in range(1,len(time)-1):
        if time[i] == time[i+1]:
            remove_list.append(time[i])
    time = list(set(time)-set(remove_list))
    time.sort()
    for i in range(len(time)//2):
        f[max(time[2*i]-1,0)] += 1
        f[time[2*i+1]] -= 1
ans = -1
for i in range(1,max_end+1):
    f[i] += f[i-1]
    if ans < f[i]:
        ans = f[i]

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

N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    count = A.count(i)
    print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = [0]*N

for i in A:
    ans[i-1] += 1

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

x,k,d=map(int,input().split())
sa=abs(x)//d
ans=x
pbk,mbk=0,0
if sa>=k:
  ans=abs(x)-d*k
else:
  for i in range(k-sa):
    if abs(ans-d)<abs(ans+d):
      ans=abs(ans-d)
    elif abs(ans-d)>abs(ans+d):
      ans=abs(ans+d)
    else:
      if (k-i)%2==1:
        ans=d
      break
    if abs(ans-d)>abs(ans+d):
      if pbk==abs(ans-d) and mbk==abs(ans+d):
        if (k-i)%2==1:
          ans=mbk
          break
      pbk=abs(ans-d)
      mbk=abs(ans+d)
    else:
      if pbk==abs(ans+d) and mbk==abs(ans-d):
        if (k-i)%2==1:
          ans=mbk
          break
      pbk=abs(ans+d)
      mbk=abs(ans-d)
print(ans)

### FIXED CODE ###

x,k,d=map(int,input().split())
x=abs(x)
sa=x//d
ans=x
pbk,mbk=0,0
bk1,bk2,bk3=1,1,1
mansbk,pansbk=0,0
if sa>=k:
  ans=x-d*k
else:
  ans=x-d*sa
  k=k-sa
  for i in range(k):
    mansbk=abs(ans-d)
    pansbk=abs(ans+d)
    if mansbk!=pansbk:
      ans=min(mansbk,pansbk)
      if bk3!=1:
        bk1=min(mansbk,pansbk)
        bk2=max(mansbk,pansbk)
        ans=mbk if (k-i)%2==0 else bk1
        break
      else:
        bk3=max(mansbk,pansbk) 
    else:
      ans=0 if (k-i)%2==0 else d
      break
    pbk=max(mansbk,pansbk)
    mbk=min(mansbk,pansbk)
print(ans)
### BUGGY CODE ###

def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a,a)

K = input()
K = int(K)
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += gcd(a,gcd(b,c))

print(ans)

### FIXED CODE ###

def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a,a)

K = input()
K = int(K)
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            ans += gcd(a,gcd(b,c))

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

import sys
def input(): return sys.stdin.readline().rstrip()

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

L = []
R = []
for i in range(K):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

dp = [0] * (N+1)
dp[1] = 1

for i in range(2,N+1):
    count = 0
    for l,r in zip(L,R):
        if l < i and i - r > 1:
            count += dp[i-l] - dp[i-r-1]
        elif l < i:
            count += dp[i-l]
    dp[i] = dp[i-1] + count

print((dp[N] - dp[N-1])% 998244353)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()

mod = 998244353
N, K = map(int, input().split())

L = []
for i in range(K):
    l, r = map(int, input().split())
    L.append((l,r))

L.sort()

dp = [0] * (N+1)
dp[1] = 1

for i in range(2,N+1):
    count = 0
    for l,r in L:
        if l >= i:
            break
        elif l < i and i - r > 1:
            count += dp[i-l] - dp[i-r-1]
        else:
            count += dp[i-l]
    dp[i] = (dp[i-1] + count) % mod

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

def mahou(p2, p1):
    return abs(p2[0] - p1[0]) + abs(p2[1] - p1[1])

H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for i in range(H)]
Q = int(input())
LR = [list(map(int, input().split())) for i in range(Q)]

Map = [[0, 0] for i in range(H * W + 1)]
for i in range(len(A)):
    for j in range(len(A[i])):
        Map[A[i][j]] = [i + 1, j + 1]
        
for l, r in LR:
    ans = 0
    for i in range(l, r, D):
        ans += mahou(Map[i + D], Map[i])
    print(ans)

### FIXED CODE ###

def mahou(p2, p1):
    return abs(p2[0] - p1[0]) + abs(p2[1] - p1[1])

H, W, D = map(int, input().split())
A = [list(map(int, input().split())) for i in range(H)]
Q = int(input())
LR = [list(map(int, input().split())) for i in range(Q)]

Map = [[0, 0] for i in range(H * W + 1)]
for i in range(len(A)):
    for j in range(len(A[i])):
        Map[A[i][j]] = [i + 1, j + 1]

keiro = [[0 for i in range(D)] for j in range(H * W // D + 1)]

for i in range(D, H * W):
    keiro[i // D][i % D] = mahou(Map[i + 1], Map[i + 1 - D]) + keiro[i // D - 1][i % D]
        
for l, r in LR:
    print(keiro[(r - 1) // D][(r - 1) % D] - keiro[(l - 1) // D][(l - 1) % D])
### BUGGY CODE ###

a = [list(map(str,input().split()))]
while True:
  h = int(len(a)/2)
  for i in range(h-1):
    if a[i] !=a[i+h]:
      break
    elif all(a[i]==a[i+h]):
      print(len(a))
      exit()
  a[:-1]

### FIXED CODE ###

n = input()
num = len(n)-2
for i in range(num,0,-2):
  f = int(i/2)
  if n[:f]==n[f:i]:
    print(i)
    break
### BUGGY CODE ###

from itertools import permutations

N, K = map(int, input().split())
inputs = [[int(i) for i in input().split()] for _ in range(N)]

ans = 0
for items in permutations(inputs, K):
    tmp = 0
    sets = set()
    for i in range(K):
        tmp += items[i][1]
        sets.add(items[i][0])
    tmp += len(sets) * len(sets)
    ans = max(ans, tmp)

print(ans)


### FIXED CODE ###

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

inputs = []
priority_queue = []
queue = []
sets = set()

for _ in range(N):
    key, value = map(int, input().split())
    inputs.append((value, key))

inputs.sort(reverse=True) # valueで降順のソートをかけてる

for i in range(K):
    value, key = inputs[i]
    if key in sets:
        queue.append(value)
    else:
        priority_queue.append(value)
        sets.add(key)

sum_priority_queue = sum(priority_queue)
sum_queue = sum(queue)
kinds = len(sets)
ans = sum_priority_queue + sum_queue + kinds ** 2
for i in range(K, N):
    if not queue:
        break
    value, key = inputs[i]
    if key in sets:
        continue
    sets.add(key)
    sum_queue -= queue.pop()
    sum_priority_queue += value
    kinds += 1
    ans = max(ans, sum_priority_queue + sum_queue + kinds ** 2)

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

N = int(input())

s = []
for i in range(N):
    x = sorted(input())
    s.append(x)

count = 0
for j in range(N):
    if s.count(s[j]) > 1:
        count += s.count(s[j])-1

print(count//2)

### FIXED CODE ###

N = int(input())
s = [''.join(sorted(input())) for _ in range(N)]

from collections import Counter
counter = Counter(s)
ans = sum(n*(n-1)//2 for n in counter.values())
print(ans)
### BUGGY CODE ###

x = int(input())
n = x
j = 0
while j == 0:
  a = int(n/2) + 1
  i = 2
  while i < a:
    if i == a-1:
      j = 1
      i = a
    elif n % i != 0:
      i += 1
    else:
      i = a
      n += 1
print(n)

### FIXED CODE ###

x = int(input())
if x <= 3:
  n = x
elif x == 4:
  n = 5
else:
  n = x
  j = 0
  while j == 0:
    a = int(n/2) + 1
    i = 2
    while i < a:
      if i == a-1:
        j = 1
        i = a
      elif n % i != 0:
        i += 1
      else:
        i = a
        n += 1
print(n)
### BUGGY CODE ###

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

for i in range(K):
    if A>=1:
        A-=1
    elif B>=1:
        B-=1
    else:
        continue

print(str(A)+' '+str(B))

### FIXED CODE ###

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

if A>=1:
    if K>=A:
        K=K-A
        if K>=B:
            B=0
            print('0 0')
        elif K<B:
            B=B-K
            print('0 '+str(B))
    elif K<A:
        A=A-K
        print(str(A)+' '+str(B))
else:
    if K>=B:
        print('0 0')
    else:
        print('0 '+str(B-K))
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
answer = 1
for i in A:
    answer = answer * i
if answer <= 10**18 :
    print(answer)
else:
    print("-1")

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
answer = 1
if not 0 in A:
    for i in A:
        answer = answer * i
        if answer > 10**18:
            print("-1")
            break
    if answer <= 10**18:
        print(answer)
else:
    print("0")
### BUGGY CODE ###

H, W = map(int, input().split())
S = [None] * H
for i in range(H):
  S[i] = input()

up = [[0 for w in range(W)] for h in range(H)]
down = [[0 for w in range(W)] for h in range(H)]
left = [[0 for w in range(W)] for h in range(H)]
right = [[0 for w in range(W)] for h in range(H)]

for h in range(H):
  for w in range(W):
    # up
    if h-1 >= 0:
      if S[h-1][w] == "#":
        up[h][w] = 0
      else:
        up[h][w] = up[h-1][w] + 1
    # left
    if w-1 >= 0:
      if S[h][w-1] == "#":
        left[h][w] = 0
      else:
        left[h][w] = left[h][w-1] + 1

    _h = H-1-h
    _w = W-1-w
    # down
    if _h+1 <= H-1:
      if S[_h+1][_w] == "#":
        down[_h][_w] = 0
      else:
        down[_h][_w] = down[_h+1][_w] + 1
    # right
    if _w+1 <= W-1:
      if S[_h][_w+1] == "#":
        right[_h][_w] = 0
      else:
        right[_h][_w] = right[_h][_w+1] + 1

ans = 0
for h in range(H):
  for w in range(W):
    if S[h][w] == "#":
      continue
    masu = 1
    masu += up[h][w]
    masu += down[h][w]
    masu += left[h][w]
    masu += right[h][w]
    if masu > ans:
      ans = masu

print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
S = [None] * H
for i in range(H):
    S[i] = input()

up = [[0 for w in range(W)] for h in range(H)]
down = [[0 for w in range(W)] for h in range(H)]
left = [[0 for w in range(W)] for h in range(H)]
right = [[0 for w in range(W)] for h in range(H)]

# up and left
for h in range(H):
    for w in range(W):
        if S[h][w] == "#":
            up[h][w] = 0
            left[h][w] = 0
        else:
            # up
            if h == 0:
                up[h][w] = 1
            else:
                up[h][w] = up[h - 1][w] + 1
            # left
            if w == 0:
                left[h][w] = 1
            else:
                left[h][w] = left[h][w - 1] + 1

# down and right
for h in reversed(range(H)):
    for w in reversed(range(W)):
        if S[h][w] == "#":
            down[h][w] = 0
            right[h][w] = 0
        else:
            # down
            if h == H - 1:
                down[h][w] = 1
            else:
                down[h][w] = down[h + 1][w] + 1
            # right
            if w == W - 1:
                right[h][w] = 1
            else:
                right[h][w] = right[h][w + 1] + 1


ans = 0
for h in range(H):
    for w in range(W):
        masu = -3
        masu += up[h][w]
        masu += down[h][w]
        masu += left[h][w]
        masu += right[h][w]
        if masu > ans:
            ans = masu

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

N = int(input())
AN = list((map(int,input().split(" "))))
 
AN.sort(reverse=True)
 
num = 0
count = 0
 
def bbb(ccc):
    ddd = ccc
    while True:
        if ddd == 2:
            return True
        ddd = ddd / 2
        if ddd % 2 != 0:
            return False
 
while True:
 
    if len(AN) == 0:
        break
 
    A = AN.pop(num)
 
    for i in range(len(AN)):
        n = A + AN[i]
        if (n & (n - 1) == 0):
            AN.pop(i)
            count += 1
            break
 
print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split(" ")))
A.sort()
used = [0] * N
pow2_set = reversed([ 1<<i for i in range(36)])
ans = 0
for pow2 in pow2_set:
    l,r = 0,N-1
    while l < r:
        if A[l] + A[r] < pow2:
            l += 1
        elif A[l] + A[r] == pow2:
            if used[l] == 0 and used[r] == 0:
                ans += 1
                used[l],used[r] = 1,1
            else:
                if used[l] == 1:
                    l += 1
                if used[r] == 1:
                    r -= 1
        else:
            r -= 1
 
print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
p = [int(a) for a in input().split()]

B = [0]*(N-K+1)
for i in range(N-K+1):
    B[i] = sum(p[i:i+K])

max_ind = B.index(max(B))

ep = 0
for i in range(K):
    ep += (p[max_ind+i]*(p[max_ind+i]+1))/(2*p[max_ind+i])

print(ep)


### FIXED CODE ###

N, K = map(int, input().split())
p = [int(a) for a in input().split()]

B = [0]*(N-K+1)
B[0] = sum(p[0:K])
for i in range(1, N-K+1):
    B[i] = B[i-1] - p[i-1] + p[i+K-1]
    
max_ind = B.index(max(B))

ep = 0
for i in range(K):
    ep += (p[max_ind+i]*(p[max_ind+i]+1))/(2*p[max_ind+i])

print(ep)
### BUGGY CODE ###

import copy

def judge1(masu,h,w):
    if (masu[0]>=0)&(masu[0]<h)&(masu[1]>=0)&(masu[1]<w):
        return True
    else:
        return False
    
def judge2(masu,s):
    if s[masu[0]][masu[1]] == '.':
        return True
    else:
        return False
    
def tsugi(i,j,h,w,s2):
    ans=[]
    for masu in [(i-1,j),(i+1,j),(i,j-1),(i,j+1)]:
        if judge1(masu,h,w):
            if judge2(masu,s2):
                ans.append(masu)
    return ans
    


def solve(i,j,s,h,w):
    ma = 0
    s2 = copy.deepcopy(s)
    if s2[i][j]=='.':
        s2[i][j]='#'
        nex = tsugi(i,j,h,w,s2)
        flag=1
        while len(nex)!=0 :
            ma+=1
            #flag= 0
            nex2=[]
            for n in nex:
                nex2[len(nex2):] = tsugi(n[0],n[1],h,w,s2)
                s2[n[0]][n[1]]='#'
            nex = nex2
    return ma


h,w=map(int,input().split())
s = []
ma = 0
for i in range(h):
    s.append(list(input()))
for i in range(h):
    for j in range(w):
        ans = solve(i,j,s,h,w)
        ma = max(ma,ans)
print(ma)

### FIXED CODE ###

import copy

def judge1(masu,h,w):
    if (masu[0]>=0)&(masu[0]<h)&(masu[1]>=0)&(masu[1]<w):
        return True
    else:
        return False
    
def judge2(masu,s):
    if s[masu[0]][masu[1]] == '.':
        return True
    else:
        return False
    
def tsugi(i,j,h,w,s2):
    ans=[]
    for masu in [(i-1,j),(i+1,j),(i,j-1),(i,j+1)]:
        if judge1(masu,h,w):
            if judge2(masu,s2):
                ans.append(masu)
    return ans
    


def solve(i,j,s,h,w):
    ma = 0
    s2 = copy.deepcopy(s)
    if s2[i][j]=='.':
        s2[i][j]='#'
        nex = tsugi(i,j,h,w,s2)
        while len(nex)!=0 :
            ma+=1
            nex2=[]
            for n in nex:
                nex2[len(nex2):] = tsugi(n[0],n[1],h,w,s2)
                s2[n[0]][n[1]]='#'
            nex = set(nex2)
    return ma


h,w=map(int,input().split())
s = []
ma = 0
for i in range(h):
    s.append(list(input()))
for i in range(h):
    for j in range(w):
        ans = solve(i,j,s,h,w)
        ma = max(ma,ans)
print(ma)
### BUGGY CODE ###


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

ans = 0

from itertools import combinations

l = list(range(1, N+1))
c = combinations(l, 3)

def cond2(a,b,c):
    a -= 1
    b -= 1
    c -= 1
    if b-a == c-b:
        return False
    return True

ll = []
for v in c:
    if cond2(v[0], v[1], v[2]):
        ll.append(v)

ans = 0
for t in ll:
    x, y, z = t[0], t[1], t[2]
    x -= 1
    y -= 1
    z -= 1
    if S[x] == S[y] or S[x] == S[z] or S[y] == S[z]:
        continue
    ans += 1

print(ans)

### FIXED CODE ###


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

r = S.count("R")
g = S.count("G")
b = S.count("B")

all_case = r*g*b

excluded_case = 0
for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]: continue
        k = j*2-i
        if k>= N or S[k] == S[i] or S[k] == S[j]: continue
        excluded_case += 1

print(all_case-excluded_case)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
from math import factorial
from collections import Counter
def solve(N: int, S: str):
    counter = dict(Counter(S))
    values = list(counter.values())
    LEN = len(counter)
    answer = 0        
    for i in range(1,2**LEN):
        b = format(i,'b').zfill(LEN)
        an = 1
        for j in range(LEN):
            if b[j] == '1':
                an *= values[j]
        answer += an
        answer %= MOD

    print(answer)


    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
from collections import Counter
from itertools import product
def solve(N: int, S: str):
    counter = dict(Counter(S))
    values = list(counter.values())
    LEN = len(values)
    answer = values[0]+1
    if LEN >= 2:
        for i in range(1,LEN):
            answer *= values[i]+1
            answer%=MOD
    print(answer-1)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

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

n, a, b = list(map(int, input().split()))
extra = n % (a +b)
roop = n // (a +b)
result = a*roop
cycle = [1 for _ in range(a)] +  [0 for _ in range(b)]
if extra != 0:
  for i in range(extra):
    result += cycle[i]
print(result)

### FIXED CODE ###

n, a, b = list(map(int, input().split()))
result = 0
if a + b != 0:
  roop = n // (a +b)
  extra = n - roop*(a+b)
  result = a*roop
  if extra >= a:
    result += a
  else:
    result += extra
print(result)
### BUGGY CODE ###

A,B,K = list(map(int,input().split()))
for i in range(K):
  if A != 0:
    A -= 1
  elif A == 0 and B != 0:
    B -= 1
print('{} {}'.format(A,B))

### FIXED CODE ###

A,B,K = list(map(int,input().split()))
if K <= A:
  print('{} {}'.format(A-K,B))
if A < K <= A+B:
  print('{} {}'.format(0,A+B-K))
if A+B < K:
  print('{} {}'.format(0,0))
### BUGGY CODE ###

import math
from sys import stdin


def get_result(data):
    A, B, N = data
    x = [B*(i+1)-1 for i in range(N//B+1)]
    ans = []
    for val in x:
        if val > N:
            val = N
        ans.append(math.floor(A*val/B) - A*math.floor(val/B))
    return max(ans)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)


### FIXED CODE ###

import math
from sys import stdin


def get_result(data):
    A, B, N = data
    if B == 1:
        return 0
    length = N//B+1
    x = [B*(i+1)-1 for i in range(length)]
    ans = []
    for val in x:
        if val > N:
            val = N
        ans.append(math.floor(A*val/B) - A*math.floor(val/B))
    return max(ans)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)
### BUGGY CODE ###

x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ll=[]
for i in range(len(a)):
    for j in range(len(b)):
        for l in range(len(c)):
            ll.append(a[i]+b[j]+c[l])
ll.sort(reverse=True)
for i in range(k):
    print(ll[i])


### FIXED CODE ###

x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=sorted(list(map(int,input().split())),reverse=True)
ab=[]
for i in a:
    for j in b:
        ab.append(i+j)
ab.sort(reverse=True)
ans=[]
for i in range(min(k,len(ab))):
    for j in range(min(k,len(c))):
        ans.append(ab[i]+c[j])
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
### BUGGY CODE ###

x, y, z, k = map(int, input().split())

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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

bc = []

for b in B:
    for c in C:
        bc.append(b+c)

bc.sort(reverse=True)
cnt = 0
cand = []

for a in A:
    cnt = 0
    for i in bc:
        cnt += 1
        cand += [a + i]
        if cnt == 3000:
            break

cand.sort(reverse=True)
cnt = 0
for i in cand:
    print(i)
    cnt += 1
    if cnt == k:
        break


### FIXED CODE ###

x, y, z, k = map(int, input().split())

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

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

bc = []

for b in B:
    for c in C:
        bc.append(b+c)

bc.sort(reverse=True)
t = min(len(bc), 3333)
bc = bc[:t]
cnt = 0
cand = []

for a in A:
    cnt = 0
    for i in bc:
        cnt += 1
        cand += [a + i]
        if cnt == 3000:
            break

cand.sort(reverse=True)
cnt = 0
for i in cand:
    print(i)
    cnt += 1
    if cnt == k:
        break
### BUGGY CODE ###

import itertools


def d():
    _ = int(input())
    ls = list(map(int, input().split()))
    combs = list(itertools.combinations(ls, 2))
    count = 0
    a = 0
    b = 1
    visited = set()

    for comb in combs:
        for l in ls:
            if {comb[a], comb[b], l} not in visited:
                visited.add(frozenset({comb[a], comb[b], l}))
                if l != comb[a] and l != comb[b] and abs(comb[a] - comb[b]) < l < comb[a] + comb[b]:
                    count += 1

    print(count)


if __name__ == '__main__':
    d()


### FIXED CODE ###

def d():
    n = int(input())
    ls = list(map(int, input().split()))
    ls.sort()
    count = 0
    for i in range(n-1):
        k = i + 2
        for j in range(i+1, n-1):
            while k < n and ls[i] + ls[j] > ls[k]:
                k += 1
            count += k - j - 1

    print(count)


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

r=lambda x:p[x]>=0and r(p[x])or x
(n,m,k),*t=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
s=[-1]*-~n
for a,b in t:
 x,y=sorted((r(a),r(b)))
 if(x!=y)*m>0:p[x]+=p[y];p[y]=x
 if m>0or x==y:s[a]-=1;s[b]-=1
 m-=1
print(*[s[i+1]-p[r(i+1)]for i in range(n)])

### FIXED CODE ###

def root(x):
  while par[x]>=0:x=par[x]
  return x
def unite(x,y):
  x,y=root(x),root(y)
  if x!=y:
    if x>y:x,y=y,x
    par[x]+=par[y]
    par[y]=x
def same(x,y):
  return root(x)==root(y)
def size(x):
  return-par[root(x)]
n,m,k,*t=map(int,open(0).read().split())
par=[-1]*n
f=[set()for _ in range(n)]
for a,b in zip(*[iter(t[:m*2])]*2):
  a-=1
  b-=1
  unite(a,b)
  f[a].add(b)
  f[b].add(a)
a=[size(i)-len(f[i])-1for i in range(n)]
for c,d in zip(*[iter(t[m*2:])]*2):
  c-=1
  d-=1
  if same(c,d):
    a[c]-=1
    a[d]-=1
print(*a)