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

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,M = I()
links = [[] for _ in range(N)]
for i in range(M):
    x,y,z = I()
    links[x-1].append(y-1)
    links[y-1].append(x-1)
ans = 0
visited = [0]*N
def dfs(n):
    if visited[n]:
        return
    visited[n] = 1
    for l in links[n]:
        dfs(l)
for i in range(N):
    if not visited[i]:
        dfs(i)
        ans += 1
print(ans)

### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,M = I()
links = [[] for _ in range(N)]
for i in range(M):
    x,y,z = I()
    links[x-1].append(y-1)
    links[y-1].append(x-1)
ans = 0
visited = [0]*N
def dfs(n):
    if visited[n]:
        return
    visited[n] = 1
    for l in links[n]:
        dfs(l)
for i in range(N):
    if not visited[i]:
        dfs(i)
        ans += 1
print(ans)
### BUGGY CODE ###

n, q = map(int, input().split())
s = input()

for i in range(q):
  l, r = map(int, input().split())
  print(s[l-1:r].count('AC'))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
  t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
  l, r = map(int, input().split())
  print(t[r-1] - t[l-1])
### BUGGY CODE ###

N = int(input())
A_list = tuple(map(int, input().split(' ')))

# print(N)
# print(A_list)

ret = 0
now_sum = sum(A_list)
# print("スタート{}".format(now_sum))

for i in range(len(A_list)):
  now_sum -= A_list[i]
  multiple_base = A_list[i]
  # print('now_sumから{0}を引いて{1}'.format(A_list[i], now_sum))
  before_total = 0
  for q in range(i + 1, len(A_list)):
    before_total += A_list[q]
  # print("before_totalは{0}, multiple_baseは{1}, 掛け算で{2}".format(multiple_base, before_total, multiple_base * before_total))
  ret += multiple_base * before_total
  
print(ret % 1000000007)


### FIXED CODE ###

N = int(input())
A_list = tuple(map(int, input().split(' ')))

# print(N)
# print(A_list)

ret = 0
now_sum = sum(A_list)
# print("スタート{}".format(now_sum))

for i in range(len(A_list)):
  now_sum -= A_list[i]
  multiple_base = A_list[i]
  # print('now_sumから{0}を引いて{1}'.format(A_list[i], now_sum))
  before_total = 0
  # print("before_totalは{0}, multiple_baseは{1}, 掛け算で{2}".format(multiple_base, before_total, multiple_base * before_total))
  ret += multiple_base * now_sum
  
print(ret % 1000000007)
### BUGGY CODE ###

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

count=0
for i in range(n+1):
    for j in range(i+1,n+1):
        # print(aa[i:j], sum(aa[i:j]))
        summary = sum(aa[i:j])
        if summary==0:
            count+=1
print(count)

### FIXED CODE ###

from collections import Counter
from itertools import accumulate
n = int(input())
aa = list(map(int, input().split()))

s =[0] +  list(accumulate(aa))
# print(s)
ans=0
for x in Counter(s).values():
    ans+= x * (x-1) //2
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# from numpy import array, sum

MAX_DIVIDER = 32 # 32 ** 2 = 1024 > 1000

X =int(input())

li = set()

b = 1
while b < MAX_DIVIDER:
	c = b * b
	while c < 1000:
		li.add(c)
		c *= b

while X > 0:
	if X in li:
		print(X)
		break
	else:
		X -= 1

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# from numpy import array, sum

MAX_DIVIDER = 32 # 32 ** 2 = 1024 > 1000

X =int(input())

li = set()

li.add(1)

b = 2
while b < MAX_DIVIDER:
	c = b * b
	while c <= 1000:
		li.add(c)
		c *= b
	b += 1

while X > 0:
	if X in li:
		print(X)
		break
	else:
		X -= 1
### BUGGY CODE ###

import collections
import math
def combination(a, b):
    tmp = 1
    for i in range(a - b + 1, a + 1):
        tmp *= i
    return tmp // math.factorial(b)

N = int(input())
listA = list(map(int, input().split()))
# 各数字の出現回数をカウント
countA = dict(collections.Counter(listA).most_common())
countA_calc = {k: v * (v -1) // 2 for (k, v) in countA.items()}
countA_calc2 = {k: (v - 1) * (v -2) // 2 for (k, v) in countA.items()}
for i in listA:
    count = 0
    for x, y in countA.items():
        if x == i:
            count += countA_calc2[x]
        else:
            count += countA_calc[x]
    print(count)

### FIXED CODE ###

import collections
import math
def combination(a, b):
    tmp = 1
    for i in range(a - b + 1, a + 1):
        tmp *= i
    return tmp // math.factorial(b)
 
N = int(input())
listA = list(map(int, input().split()))
# 各数字の出現回数をカウント
countA = dict(collections.Counter(listA).most_common())
countA_calc = {k: v * (v -1) // 2 for (k, v) in countA.items()}
countA_calc2 = {k: (v - 1) * (v -2) // 2 for (k, v) in countA.items()}
summery = sum(countA_calc.values())
for i in listA:
    print(summery - countA_calc[i] + countA_calc2[i])
### BUGGY CODE ###

from collections import Counter
N = int(input())
S = list(input())

if len(S) <= 3:
    print(0)
    exit()

c = Counter(S)
# print('c', c, len(c))
if len(c) != 3:
    print(0)
    exit()

condition1 = 1
for v in c.values():
    condition1 *= v

# print('condition1', condition1)

condition2 = 0
for i in range(N):
    for d in range(N // 2 + 2):
        j = i + d
        k = j + d
        if j >= N or k >= N:
            continue
        # print('i, j, k', i, j, k)
        if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]):
            condition2 += 1
ans = condition1 - condition2
print(ans)


### FIXED CODE ###

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

if len(S) <= 3:
    print(0)
    exit()

sorted_S = sorted(S)
c = [0, 0, 0]
j = 0
for i in range(len(sorted_S) - 1):
    if sorted_S[i] != sorted_S[i + 1]:
        if j == 0:
            c[j] = i + 1
            j += 1
        else:
            c[j] = (i + 1) - c[j - 1]
            j += 1

# print('c', c, j)
if j != 2:
    print(0)
    exit()
c[2] = N - c[0] - c[1]

condition1 = c[0] * c[1] * c[2]
# print('condition1', condition1)

condition2 = 0
for i in range(N):
    for d in range(N // 2 + 2):
        j = i + d
        k = j + d
        if j >= N or k >= N:
            continue
        # print('i, j, k', i, j, k)
        if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]):
            condition2 += 1
ans = condition1 - condition2
print(ans)
### BUGGY CODE ###

def N():
    return int(input())
def L():
    return list(map(int,input().split()))
def NL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7
#import numpy
#import sympy
import math
md = 998244353

n,k = L()
lr = NL(k)
s = set()

for l,r in lr:
    s |= set(range(l,r+1))
l = [0]*(n+1)
l[1]=1

for i in range(1,n+1):
    for j in s:
        if i+j<n+1:
            l[i+j] = (l[i+j]+l[i])%md
    #print(l)
#print(l)
print(l[n]%md)

### FIXED CODE ###

def N():
    return int(input())
def L():
    return list(map(int,input().split()))
def NL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7
import numpy as np
#import sympy
import math
md = 998244353

n,k = L()
lr = NL(k)
s = set()

for l,r in lr:
    s |= set(range(l,r+1))


dp = [0]*(n+1)
dp[1]=1
#dp[2]=-1
c = [0]*(n+1)
for i in range(1,n+1):
    dp[i] = (dp[i]+dp[i-1])%md
    for l,r in lr:
        if i+l < n+1:
            dp[i+l] += dp[i]
            dp[i+l] %= md
            if i+r+1 < n+1:
                dp[i+r+1] -= dp[i]
                dp[i+r+1] %= md

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

n = int(input())
a = list(map(int,input().split()))
lcm = a[0]
for i in range(1,n):
  big,sml = lcm,a[i]
  while sml != 0:
    big,sml = sml,big%sml
  lcm *= a[i] // big
ans = 0
mod = 10 ** 9 + 7
for i in range(n):
  tmp = lcm // a[i]
  tmp %= mod
  ans += tmp
  ans %= mod
print(ans)
#print(lcm)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
mod = 10 ** 9 + 7
lcm = a[0]
for i in range(1,n):
  big,sml = lcm,a[i]
  while sml != 0:
    big,sml = sml,big%sml
  lcm *= a[i] // big
ans = 0
def inv(x):
  y = 1
  while x != 1:
    y *= mod // x + 1
    y %= mod
    x -= mod % x
  return y
#print(inv(5))
for i in range(n):
  ans += inv(a[i])
  ans %= mod
#print(ans)
ans *= lcm
ans %= mod
print(ans)
#print(lcm)
#print(1000000*999999*999998%mod)
### BUGGY CODE ###

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

good = [i for i in range(n)]

for i in range(m):
    a, b = map(int,input().split())
    if h[a-1] <= h[b-1] and a-1 in good:
        good.remove(a-1)
    if h[b-1] <= h[a-1] and b-1 in good:
        good.remove(b-1)

print(len(good))

### FIXED CODE ###

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

rem_list = []

for i in range(m):
    a, b = map(int,input().split())
    if h[a-1] <= h[b-1]:
        rem_list.append(a-1)
    if h[b-1] <= h[a-1]:
        rem_list.append(b-1)

print(n-len(set(rem_list)))
### BUGGY CODE ###

from collections import deque
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
def BFS(s):
	cnt = [0] * (N+1)
	flg = [-1] * (N+1)
	flg[s] = 0
	q = deque([s])
	while q:
		cp = q.popleft()
		for d in [-1,1]:
			if (0 <= cp + d < N) and (flg[cp + d] == -1):
				flg[cp + d] = flg[cp] + 1
				cnt[flg[cp+d]] += 1
				q.append(cp + d)
		if cp == X:
			if flg[Y] == -1:
				flg[Y] = flg[cp] + 1
				cnt[flg[Y]] += 1
				q.append(Y)
		if cp == Y:
			if flg[X] == -1:
				flg[X] = flg[cp] + 1
				cnt[flg[X]] += 1
				q.append(X)
	return cnt
ans = [0] * (N)
for i in range(N):
	C = BFS(i)
	for j in range(1,N):
		ans[j] += C[j]

for a in ans[1:]:
	print(a//2)

### FIXED CODE ###

N, X, Y = map(int, input().split())

ans = [0] * N

for i in range(1,N+1):
	q = [i]
	flg = [-1] * (N+1)
	flg[i] = 0
	while q:
		cp = q.pop(0)
		for d in [-1,1]:
			if 1 <= cp+d <= N:
				if flg[cp+d] == -1:
					flg[cp+d] = flg[cp]+1
					ans[flg[cp+d]] += 1
					q.append(cp+d)
		if cp == X:
			if flg[Y] == -1:
				flg[Y] = flg[cp]+1
				ans[flg[Y]] += 1
				q.append(Y)
		if cp == Y:
			if flg[X] == -1:
				flg[X] = flg[cp]+1
				ans[flg[X]] += 1
				q.append(X)

for i in range(1,N):
	print(ans[i]//2)
### BUGGY CODE ###

#dame datta
def main():
    N = int(input())
    A = list(map(int, input().split()))
    Al = [A[0]]
    r = (10**9)*(2*(10**5))
    for i in A[1:]:
        Al.append(Al[-1] + i)
    for t in range(2, N-1):
        t1 = -1
        m = (10**9)*(2*(10**5))
        for i in range(1,t):
            ii = abs(Al[t-1] - Al[i-1] - Al[i-1])
            if m > ii:
                t1 = i
                m = ii
        t2 = -1
        m = (10**9)*(2*(10**5))
        for i in range(t+1, N):
            ii = abs(Al[-1] - Al[i-1] - Al[i-1] + Al[t-1])
            if m > ii:
                t2 = i
                m = ii
        x = Al[-1] - Al[t2-1]
        y = Al[t2-1] - Al[t-1]
        z = Al[t-1] - Al[t1-1]
        w = Al[t1-1]
        r = min(max(x,y,z,w) - min(x,y,z,w), r)
    return r
print(main())


### FIXED CODE ###

#dame datta
def binsearch(l, r, fn):
    while r - l > 1:
        m = (l + r) // 2
        t = fn(m+1) - fn(m)
        if t == 0:
            return fn(m)
        if t < 0:
            l = m + 1
        else:
            r = m
    if fn(l) < fn(r):
        return l
    else:
        return r
def main():
    N = int(input())
    A = list(map(int, input().split()))
    Al = [A[0]]
    r = (10**9)*(2*(10**5))
    for i in A[1:]:
        Al.append(Al[-1] + i)
    for t in range(2, N-1):
        def fn1(i):
            return abs(Al[t-1] - Al[i-1] - Al[i-1])
        t1 = binsearch(1, t, fn1)
        def fn2(i):
            return abs(Al[-1] - Al[i-1] - Al[i-1] + Al[t-1])
        t2 = binsearch(t+1, N, fn2)
        x = Al[-1] - Al[t2-1]
        y = Al[t2-1] - Al[t-1]
        z = Al[t-1] - Al[t1-1]
        w = Al[t1-1]
        r = min(max(x,y,z,w) - min(x,y,z,w), r)
    return r
print(main())
### BUGGY CODE ###

l,r=map(int,input().split())
r=min(r,l+2020)
  
ans=10**9
c=0
for i in range(l,r+1):
    for j in range(l,r+1):
        if i!=j:
            ans=min(ans,(i*j)%2019)
        c+=1
print(ans)
    

### FIXED CODE ###

l,r=map(int,input().split())
r=min(r,l+2020)
  
ans=10**9
c=0
for i in range(l,r+1):
    for j in range(l,r+1):
        if i!=j:
            ans=min(ans,(i*j)%2019)
        c+=1
print(ans)
### BUGGY CODE ###

from sys import stdin
input = stdin.readline
#N = int(input())
#J,K = map(int,input().split())
#A = list(map(int,input().split()))
#A = [list(map(int,input().split())) for _ in range(N)]
#for i in range():

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
length = len(AB)
ans = [0]*(N-1)
seek = [1]
seeknext = [0]
while length > 0:
    i = 0
    delete = 0
    while i < length:
        if AB[i][0] in seek:
            if ans[AB[i][1]-2] == 0:
                ans[AB[i][1]-2] = AB[i][0]
            seeknext += [AB[i][1]]
            AB = AB[:i]+AB[i+1:]
            length-=1
        elif AB[i][1] in seek:
            if ans[AB[i][0]-2] == 0:
                ans[AB[i][0]-2] = AB[i][1]
            seeknext += [AB[i][0]]
            AB = AB[:i]+AB[i+1:]
            length-=1
        else:
            i += 1
    seek = seeknext
    seeknext = [0]
print("Yes")
for i in ans:
    print(i)
            
            



### FIXED CODE ###

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

ans =[[0,0] for _ in range(M)]

AB = [list(map(int,input().split())) for i in range(M)]

to_list = [[] for _ in range(N)]
prev = [0]*N
for a,b in AB:
  to_list[a-1].append(b-1)
  to_list[b-1].append(a-1)

que = [0]
marked = {0}
for i in que:
  for j in to_list[i]:
    if j in marked: 
      continue
    que.append(j)
    marked.add(j)
    prev[j] = i+1
print("Yes")
print(*prev[1:],sep = "\n")
### BUGGY CODE ###

N=int(input())
*L,=map(int,input().split())

L.sort()
from bisect import*
i=0
ans=0
while i<N:
    j=i+1
    while j<N:
        ans+=bisect_left(L[j:],L[i]+L[j])-1
        j+=1
    i+=1

print(ans)

### FIXED CODE ###

N=int(input())
*L,=map(int,input().split())

L.sort()
from bisect import*
i=0
ans=0
while i<N:
    j=i+1
    while j<N:
        ans+=bisect_left(L[j:],L[i]+L[j])-1
        j+=1
    i+=1

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

n,k = map(int,input().split())
A = sorted(list(map(int,input().split())))
F = sorted(list(map(int,input().split())),reverse=True)

low = -1
high = 10**12

while high - low > 1:
    score = (low+high)//2
    training = 0
    for i in range(n):
        if A[i]*F[i] > score:
            training += A[i] - score//F[i]
    if training <= k:
        high = score
    else:
        low = score
        
print(high)

### FIXED CODE ###

n,k = map(int,input().split())
A = sorted(list(map(int,input().split())))
F = sorted(list(map(int,input().split())),reverse=True)

low = -1
high = 10**12

while high - low > 1:
    score = (low+high)//2
    training = 0
    for i in range(n):
        if A[i]*F[i] > score:
            training += A[i] - score//F[i]
    if training <= k:
        high = score
    else:
        low = score
        
print(high)
### BUGGY CODE ###

#!/usr/bin/env python3
 
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)

S = input()
T = input()
lenS = len(S)
lenT = len(T)
F1 = [False]*26
F2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(lenS):
    F1[alpha.index(S[i])] = True
for i in range(lenT):
    F2[alpha.index(T[i])] = True
for i in range(26):
    if not F1[i] and F2[i]:
        print(-1)
        sys.exit()

ind = S.index(T[0])
ans = ind+1
for i in range(1,lenT):
    S = S[ind+1:] + S[:ind+1]
    ind = S.index(T[i])
    ans += ind+1

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC138 E

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
n = len(s)
m = len(t)
f = [False]*26
f2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    f[alpha.index(s[i])] = True
for i in range(m):
    f2[alpha.index(t[i])] = True
for i in range(26):
    if not f[i] and f2[i]:
        print(-1)
        quit()
ans = 0
inde = s.index(t[0])
ans += inde+1
for i in range(1,m):
    s = s[inde+1:] + s[:inde+1]
    inde = s.index(t[i])
    ans += inde+1
print(ans)
### BUGGY CODE ###

N = int(input())
n = N
mydict = {}
L = []
cnt = 0

for i in range(2, n+1):
    while n%i == 0:
        n = n/i
        cnt += 1
    if cnt != 0:
        mydict[i] = cnt
    cnt = 0

for i in range(2, N+1):
    if i in mydict:
        for j in range(mydict[i]):
            L.append(i)

print(str(N) + ': ' + ' '.join(map(str, L)))



### FIXED CODE ###

N = int(input())
n = N
m = N ** 0.5
L = []
i = 3

print(str(N) + ': ', end = '')

while n%2 == 0:
    n = n/2
    L.append(2)

while i <= m:
    while n%i == 0:
        n = n/i
        L.append(i)
    i += 2

if n not in L:
    L.append(int(n))  

if 1 in L:
    L.remove(1)

if len(L) == 0:
    L.append(N)

print(' '.join(map(str, L)))
### BUGGY CODE ###

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    N,K=MI()
    a=LI()#下位の連続するn枚が不要なはず
    a.sort(reverse = True)
    
    
    #i番目までを使ってjが作れるかどうか
    dp=[[False]*K for _ in range(N+1)]
    dp[0][0]=1
    for i in range(N):
        for j in range(K):
            if dp[i][j]==1:
                dp[i+1][j]=1
                jj=j+a[i]
                if jj<K:
                    dp[i+1][jj]=1
                    
                    
    #i番目以降を使ってjが作れるかどうか
    dp2=[[0]*K for _ in range(N+1)]
    dp2[-1][0]=True
    for i in range(N):
        for j in range(K):
            if dp2[-1-i][j]==True:
                dp2[-2-i][j]=True
                jj=j+a[-1-i]
                if jj<K:
                    dp2[-2-i][jj]=True
    
    #累積和チックに
    for i in range(N+1):
        for j in range(K-1):
            dp[i][j+1]+=dp[i][j]
                    
                    
    #x番目の数が必要かどうかの判定 
    #必要なものだけで構成された集合をもとに考えれば良いわけではない，不必要な分も考えなければならない             
    def ch(x):
        if a[x]>=K:
            return True
        else:
            #dp2でsを作り，dpで，K-s未満，K-a[x]-s以上のものが作れれば良い，
            #この範囲内で1が一つでもあれば良いので，累積和の差分が1以上ならok
            for s in range(K-a[x]):
                if dp2[x+1][s]==True:
                    if dp[x][K-s-1] - dp[x][K-a[x]-s-1]>=1:
                        return True
        return False
    
                        
    ng=N
    ok=-1
    while abs(ok-ng)>1:
        med=(ok+ng)//2
        
        if ch(med):
            ok=med
        else:
            ng=med
            
    print(N-(ok+1))
    
    
   
    
            
    
    
    

main()


### FIXED CODE ###

def main():
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    
    N,K=MI()
    a=LI()#下位の連続するn枚が不要なはず
    a.sort()
    for i in range(N):#K以上ならば必要
        if a[i]>=K:
            a=a[:i]
            break
    N=len(a)
                    
                    
    #x番目の数が必要かどうかの判定 
    #必要なものだけで構成された集合をもとに考えれば良いわけではない，不必要な分も考えなければならない             
    def ch(x):
        
        #使い回す，i番目まででjが作れるか
        dp=[0]*K
        dp[0]=1
        for i in range(N):
            if i==x:
                continue
            else:
                for j in range(K-1,a[i]-1,-1):
                    dp[j]|=dp[j-a[i]]
                
                        
        #K未満K-a[x]以上が作れれば良い    
        for j in range(K-a[x],K):
            if  dp[j]:
                return True
        return False
            
    
                        
    ng=-1
    ok=N
    while abs(ok-ng)>1:
        med=(ok+ng)//2
        
        if ch(med):
            ok=med
        else:
            ng=med
            
    print(ng+1)
    
    
 
    

main()
### BUGGY CODE ###

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


res = 0

for i in range(len(L_list)):
        for j in range(i+1,len(L_list)):
                for k in range(j+1,len(L_list)):
                        a= L_list[i]
                        b= L_list[j]
                        c= L_list[k]

                        if a<b+c and b<c+a and c<a+b:
                                res+=1

print(res)

### FIXED CODE ###

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

L_list.sort()
import bisect
res = 0
for i in range(N):
    a= L_list[i]
    for j in range(i+1,N):
        b= L_list[j]
        ind = bisect.bisect_left(L_list,a+b)
        res+=(ind-j-1)

print(res)
### BUGGY CODE ###

def func(x, nn):
    value = 0
    for id, i in zip(range(nn-1), x[:-1]):
        for j in x[id+1:]:
            value += i ^ j
    ans = value % (10 ** 9 + 7)
    return ans

n = int(input())
li = list(map(int, input().split()))
print(func(li, n))


### FIXED CODE ###

import numpy as np
n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    t = arr & 1
    c1 = np.count_nonzero((arr & 1))
    s += 2 ** i * c1 * (n - c1)
    arr >>= 1

print(s % mod)
### BUGGY CODE ###

from bisect import bisect as b

H,W=map(int,input().split())
S=[list(input()) for _ in range(H)]

X=[]
HL=[[] for _ in range(H)]
WL=[[] for _ in range(W)]
for h in range(H):
    for w in range(W):
        if S[h][w]=="#":
            HL[h].append(w)
            WL[w].append(h)

ans=0

for h in range(H):
    for w in range(W):
        if S[h][w]==".":
            if len(HL[h])==0:
                hol=W
            else:
                x=b(HL[h],w)
                N=len(HL[h])
                if x==0:
                    hol=HL[h][x]
                elif x==N:
                    hol=W-1-HL[h][-1]
                else:
                    hol=HL[h][x]-HL[h][x-1]-1

            if len(WL[w])==0:
                ver=H
            else:
                y=b(WL[w],h)
                M=len(WL[w])
                if y==0:
                    ver=WL[w][y]
                elif y==M:
                    ver=H-1-WL[w][-1]
                else:
                    ver=WL[w][y]-WL[w][y-1]-1
            ans=max(ans,ver+hol-1)
print(ans)

### FIXED CODE ###

from bisect import bisect as b

H,W=map(int,input().split())
S=[list(input()) for _ in range(H)]

X=[]
HL=[[] for _ in range(H)]
WL=[[] for _ in range(W)]
for h in range(H):
    for w in range(W):
        if S[h][w]=="#":
            HL[h].append(w)
            WL[w].append(h)

ans=0

for h in range(H):
    for w in range(W):
        if S[h][w]==".":
            if len(HL[h])==0:
                hol=W
            else:
                x=b(HL[h],w)
                N=len(HL[h])
                if x==0:
                    hol=HL[h][x]
                elif x==N:
                    hol=W-1-HL[h][-1]
                else:
                    hol=HL[h][x]-HL[h][x-1]-1

            if len(WL[w])==0:
                ver=H
            else:
                y=b(WL[w],h)
                M=len(WL[w])
                if y==0:
                    ver=WL[w][y]
                elif y==M:
                    ver=H-1-WL[w][-1]
                else:
                    ver=WL[w][y]-WL[w][y-1]-1
            ans=max(ans,ver+hol-1)
print(ans)