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

from heapq import *

class UnionFind():
    def __init__(self,n):
        self.n=n
        self.parents=[-1]*n
    def find(self,x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        if self.parents[x]>self.parents[y]:
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i)==root]
    def roots(self):
        return [i for i,x in enumerate(self.parents) if x<0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

n=int(input())
X=[[0,0] for i in range(n)]
Y=[[0,0] for i in range(n)]
edge=[[0,0] for i in range(n)]
for i in range(n):
  x,y=map(int,input().split())
  X[i]=[x,i]
  Y[i]=[y,i]
  edge[i]=[x,y]
X.sort()
Y.sort()
hq=[]
heapify(hq)
for i in range(n-1):
  x1,j1=X[i]
  x2,j2=X[i+1]
  y1,k1=Y[i]
  y2,k2=Y[i+1]
  heappush(hq,(x2-x1,j1,j2))
  heappush(hq,(y2-y1,k1,k2))
ans=0
uf=UnionFind(n)
while hq:
  w,s,t=heappop(hq)
  if uf.find(s)!=uf.find(t):
    uf.unite(s,t)
    ans+=w
print(ans)

### FIXED CODE ###

from heapq import *

class UnionFind():
    def __init__(self,n):
        self.n=n
        self.parents=[-1]*n
    def find(self,x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        if self.parents[x]>self.parents[y]:
            x,y=y,x
        self.parents[x]+=self.parents[y]
        self.parents[y]=x
    def size(self, x):
        return -self.parents[self.find(x)]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i)==root]
    def roots(self):
        return [i for i,x in enumerate(self.parents) if x<0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

n=int(input())
X=[[0,0] for i in range(n)]
Y=[[0,0] for i in range(n)]
edge=[[0,0] for i in range(n)]
for i in range(n):
  x,y=map(int,input().split())
  X[i]=[x,i]
  Y[i]=[y,i]
  edge[i]=[x,y]
X.sort()
Y.sort()
hq=[]
heapify(hq)
for i in range(n-1):
  x1,j1=X[i]
  x2,j2=X[i+1]
  y1,k1=Y[i]
  y2,k2=Y[i+1]
  heappush(hq,(x2-x1,j1,j2))
  heappush(hq,(y2-y1,k1,k2))
ans=0
uf=UnionFind(n)
while hq:
  w,s,t=heappop(hq)
  if uf.find(s)!=uf.find(t):
    uf.unite(s,t)
    ans+=w
print(ans)
### BUGGY CODE ###

import collections
n = int(input())
a = [int(i) for i in input().split()]
acc = [0]
for i in range(n):
    acc.append(acc[-1] + a[i])
dic = collections.defaultdict(int)
for i in range(n+1):
    dic[acc[i]] += 1
ans = 0
ls1 = [1]
for i in range(1,n+1):
    ls1.append(ls1[-1] * i)

for key in dic.keys():
    ans += ((dic[key] * (dic[key]-1)) /2)
print(int(ans))


### FIXED CODE ###

import collections
n = int(input())
a = [int(i) for i in input().split()]
acc = [0]
for i in range(n):
    acc.append(acc[-1] + a[i])
dic = collections.defaultdict(int)
for i in range(n+1):
    dic[acc[i]] += 1
ans = 0
for key in dic.keys():
    ans += ((dic[key] * (dic[key]-1)) / 2)
print(int(ans))
### BUGGY CODE ###

import math
N = int(input())


# if a * a + b * b + c * c + ab + bc + ac == i:
    
count = 0

for i in range(1, N + 1):
    if i < 6:
        print(0)
        continue
    for x in range(1, int(math.sqrt(i)) + 1):
        if x**2 > i:
            break
        for y in range(1, int(math.sqrt(i)) + 1):
            if x * x + y*y + x*y > i:
                break
            for z in range(1, int(math.sqrt(i)) + 1):
                 if (x + y + z) ** 2 -x*y -y*z -x*z == i:
                     count += 1
    print(count)
    count = 0

### FIXED CODE ###

import math
N = int(input())

ans = [0 for _ in range(10050)]


for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            a = x**2+y**2+z**2+x*y+y*z+z*x
            if  a < 10050:
                ans[a] +=1

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

n=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)
else:
    a=1
    for i in A:
        a=a*i
    if a>1000000000000000000:
      print(-1)
    else:
      print(a)


### FIXED CODE ###

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

ans=1

if 0 in A:
    print(0)
    exit()

for i in A:
   ans=ans*i
   if ans>10**18:
    print(-1)
    exit()


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

import numpy as  np
n=int(input())
b=[sorted(list(input())) for i in range(n)]
print(int(np.sum(list(map(lambda x:b.count(x)-1, b)))*0.5))

### FIXED CODE ###

import math
import collections

n=int(input())
a=[list(input()) for i in range(n)]
b=[str(sorted(list(i))) for i in a]
count=list(collections.Counter(b).values())
count=[i for i in count if i>1]
print(int(sum([math.factorial(x)/(math.factorial(x-2)*2) for x in count])))
### BUGGY CODE ###

n = int(input())

print(0, flush=True)
sex = input()
if sex == "Vacant":
    exit(0)
axis = sex

left = 1
right = n

while left + 1 < right:
    mid = (left + right) // 2
    print(mid, flush=True)
    sex = input()
    if sex == "Vacant":
        exit(0)
    elif sex == axis:
        left = mid
    else:
        right = mid

print(left, flush=True)
exit(0)


### FIXED CODE ###

def val(num):
    print(num, flush=True)
    sex = input()
    if sex == "Vacant":
        exit(0)
    return 1 if sex == "Male" else 0


n = int(input())

l_sex = val(0)
r_sex = val(n - 1)

left = 0
right = n - 1

while left < right:
    mid = (left + right) // 2
    sex = val(mid)
    if (mid - left) % 2 == 0 and sex != l_sex:
        right = mid
        r_sex = sex
    elif (mid - left) % 2 == 1 and sex == l_sex:
        right = mid
        r_sex = sex
    else:
        left = mid
        l_sex = sex

print(left, flush=True)
exit(0)
### BUGGY CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

print(0)
k = ns()
if k == 'Vacant':
    exit()

ok,ng = n,-1

def is_ok(p):
    print(p)
    q = ns()
    if q == 'Vacant':
        exit()
    return p%2 ^ (q == k)

while (abs(ok - ng) > 1):
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid


### FIXED CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = int(input())
print(0)
l = input()
r = l
if l == "Vacant":
    exit()

ng,ok = 0,n
while True:
    mid = (ng + ok) // 2
    print(mid)
    q = input()
    if q == "Vacant":
        exit()
    if (q == l) ^ ((mid - ng)%2 == 1):
        ng = mid
        l = q
    else:
        ok = mid
        r = q
### BUGGY CODE ###

a,b,c=map(int,input().split())
for i in range(c):
  if a>0:
    a-=1
  
  elif b>0:
    b-=1
  else:
    pass
print(a,b)
  
  

### FIXED CODE ###

A,B,K=map(int,input().split())
if A-K>=0:
  print(A-K,B)
else:
  B=B-(K-A)
  if B<=0:
    print(0,0)
  else:
    print(0,B)
### BUGGY CODE ###

MOD = 10**9 + 7
dp = [0] * 4
dp[0] = 1
idx = {'A': 1, 'B': 2, 'C': 3}
for c in input():
    if c == '?':
        N, A, AB, ABC = dp
        dp = [N * 3, A * 3 + N, AB * 3 + A, ABC * 3 + AB]
    else:
        dp[idx[c]] += dp[idx[c] - 1]
print(dp[3] % MOD)

### FIXED CODE ###

M = 10**9 + 7
dp = [0] * 4
dp[0] = 1
idx = {'A': 1, 'B': 2, 'C': 3}
for c in input():
    if c == '?':
        N, A, AB, ABC = dp
        dp = [(N * 3) % M, (A * 3 + N) % M, (AB * 3 + A) % M, (ABC * 3 + AB) % M]
    else:
        dp[idx[c]] += dp[idx[c] - 1]
print(dp[3] % M)
### BUGGY CODE ###

n = int(input())
s = list(input())
mn = 300000
for i in range(n):
    mn = min(mn, s[:i].count("W")+s[i+1:].count("E"))
print(mn)

### FIXED CODE ###

n = int(input())
s = list(input())
ans = s[1:].count("E")
tmp = ans

for i in range(1, n):
    if s[i]=="E": tmp -= 1
    if s[i-1]=="W": tmp += 1
    ans = min(tmp, ans)
print(ans)
### BUGGY CODE ###


from itertools import combinations_with_replacement

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

x = [_ for _ in range(1, M+1)]
#y = list(combinations(x, N))
y = list(combinations_with_replacement(x, N))

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

ans = 0
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans = max(ans, z)
    z = 0
print(ans)
    
            
    
    

### FIXED CODE ###

from itertools import combinations_with_replacement

N, M, Q = map(int,input().split())
x = [_ for _ in range(1, M+1)]
y = list(combinations_with_replacement(x, N))
l = [list(map(int, input().split())) for _ in range(Q)]

ans = []
z = 0
for i in range(len(y)):
    for j in range(Q):
        if y[i][l[j][1]-1] - y[i][l[j][0]-1] == l[j][2]:
            z += l[j][3]
        ans.append(z)
    z = 0
print(max(ans))
### BUGGY CODE ###

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

tmpx=float('inf')
x=abs(n-k)

while tmpx>x:
    tmpx=x
    x=abs(tmpx-k)

print(tmpx)


### FIXED CODE ###

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

print(min(n%k,abs(k-n%k)))
### BUGGY CODE ###

from math import gcd
from itertools import product

K = int(input())
n = range(1, K+1)
total = 0

for a,b,c in product(n,repeat=3):
    d = gcd(a,b)
    e = gcd(d,c)
    total += e

print(total)

### FIXED CODE ###

from math import gcd
from itertools import combinations_with_replacement as cwr

K = int(input())
n = range(1, K+1)
total = 0

for a,b,c in cwr(n,3):
    d = gcd(gcd(a,b),c)
    if a == b == c:
        total += d
    elif a != b != c:
        total += d*6
    else:
        total += d*3

print(total)
### BUGGY CODE ###

n=int(input())
a=list(map(int, input().split()))
for i in range(1,n+1):
    print(a.index(i)+1)

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split()))
ans=[0]*n
for i in range(n):
    ans[a[i]-1]=i+1
print(*ans)
### BUGGY CODE ###

n, m = list(map(int, input().split()))
cards = list(map(int, input().split()))
queries = []
for i in range(m):
    q = list(map(int, input().split()))
    queries.append(q)


for q in queries:
    cards.sort()
    b, c = q
    cnt = 0
    i = 0
    while cnt < b:
        if cards[i] <= c:
            cards[i] = c
            cnt += 1
        else:
            break
        i += 1

ans = 0
for p in cards:
    ans += p

print(ans)


### FIXED CODE ###

import heapq

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

queries = []
for i in range(m):
    q = list(map(int, input().split()))
    queries.append(q)
queries.sort(key=lambda x: x[1])
queries.reverse()

ans = 0
pos = 0
for q in queries:
    b, c = q
    if cards[min(pos+b-1, n-1)] < c:
        # print('a')
        pos = pos + b
        ans += c * (b - max(0, pos-n))
        if pos >= n:
            break
    else:
        for i in range(b):
            if cards[pos+i] < c:
                # print('b')
                ans += c
            else:
                # print('c')
                pos += i
                for j in range(pos, n):
                    ans += cards[j]

                pos = n
                break
        break

if pos < n:
    for j in range(pos, n):
        ans += cards[j]

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

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

n = int(input())
a = [list(map(int, input().split()))[::-1] for _ in range(n)]
#print(*a, sep="\n")
opponent = [-1 for _ in range(n)]
match = 0
day = 0
while match < n*(n-1)//2:
	approved = False
	for i in range(n):
		if a[i] != [] and opponent[i] == -1:
			opponent[i] = a[i].pop()-1
	#print(opponent)
	for i in range(n):
		if opponent[i] != -1 and opponent[opponent[i]] == i:
			approved = True
			match += 1
			opponent[opponent[i]] = -1
			opponent[i] = -1
	#print(opponent)
	if not approved:
		print(-1)
		sys.exit()
	day += 1
print(day)

### FIXED CODE ###

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

n = int(input())
a = [list(map(int, input().split()))[::-1] for _ in range(n)]
#print(*a, sep="\n")
opponent = [-1 for _ in range(n)]
match = 0
day = 0
start_time = time.time()
while match < n*(n-1)//2:
	approved = False
	for i in range(n):
		if a[i] != [] and opponent[i] == -1:
			opponent[i] = a[i].pop()-1
	#print(opponent)
	for i in range(n):
		if opponent[i] != -1 and opponent[opponent[i]] == i:
			approved = True
			match += 1
			opponent[opponent[i]] = -1
			opponent[i] = -1
	#print(opponent)
	if not approved:
		print(-1)
		sys.exit()
	now = time.time()
	#print(start_time, now, now - start_time)
	if now-start_time > 1.6:
		print(n*(n-1)//2)
		sys.exit()
	day += 1
print(day)
### BUGGY CODE ###

N,M = map(int,input().split())
def inc(a,b):
    h = []*(a-b)
    for p in range(a,b+1):
        if p <= b:
            h.append(p)
    return set(h)
for p in range(M):
    L,M  = map(int,input().split())
    if p == 0:
        ls = inc(L,M)
    else:
        ls = ls & inc(L,M)

print(len(ls))


### FIXED CODE ###

N,M = map(int,input().split())
ls_a = []
ls_b = []
for p in range(M):
    L,R  = map(int,input().split())
    ls_a.append(L)
    ls_b.append(R)
ans = min(ls_b)-max(ls_a)+1
if ans < 0:
    print(0)
else:
    print(ans)
### BUGGY CODE ###

import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

R, C, K = rl()
I = [[0]*(C+2) for _ in range(R+2)]
for i in range(K):
	r, c, v = rl()
	I[r][c] = v

dp = [[[0]*4 for _ in range(C+2)] for _ in range(R+2)]

for i in range(R+1):
	for j in range(C+1):
		for m in range(4):
			ni, nj = i, j+1
			dp[ni][nj][m] = max(dp[ni][nj][m], dp[i][j][m])
			if m < 3:
				dp[ni][nj][m+1] = max(dp[ni][nj][m+1], dp[i][j][m]+I[ni][nj])
			ni, nj = i+1, j
			dp[ni][nj][0] = max(dp[ni][nj][0], dp[i][j][m])
			dp[ni][nj][1] = max(dp[ni][nj][1], dp[i][j][m]+I[ni][nj])
ans = 0
for m in range(4):
	ans = max(ans, dp[R][C][m])
print(ans)


### FIXED CODE ###

import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)
 
R, C, K = rl()
I = [[0]*(C+2) for _ in range(R+2)]
for i in range(K):
	r, c, v = rl()
	I[r][c] = v
 
dp = [[0]*4 for _ in range(C+2)]
dp2 = [[0]*4 for _ in range(C+2)]
 
for i in range(R+1):
	for j in range(C+1):
		for m in range(4):
			ni, nj = i, j+1
			dp[nj][m] = max(dp[nj][m], dp[j][m])
			if m < 3:
				dp[nj][m+1] = max(dp[nj][m+1], dp[j][m]+I[ni][nj])
			ni, nj = i+1, j
			dp2[nj][0] = max(dp2[nj][0], dp[j][m])
			dp2[nj][1] = max(dp2[nj][1], dp[j][m]+I[ni][nj])
	dp = dp2
	dp2 = [[0]*4 for _ in range(C+2)]
ans = 0
for m in range(4):
	ans = max(ans, dp[C][m])
print(ans)
### BUGGY CODE ###


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

counts = [1 if s[i]=="A" and s[i+1]=="C" else 0 for i in range(n-1)]

l = [0]*q
r = [0]*q
for i in range(q):
  l[i],r[i] = map(int, input().split())
  print(sum(counts[l[i]-1:r[i]-1]))

### FIXED CODE ###

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

counts = [1 if s[i:i+2]=="AC" else 0 for i in range(n)]

cum_counts=[0]*n
for i in range(1,n):
  cum_counts[i]=cum_counts[i-1]+counts[i-1]

#print(counts)
#print(cum_counts)

for i in range(q):
  l,r = map(int, input().split())
  print(cum_counts[r-1] - cum_counts[l-1])
### BUGGY CODE ###

import sys
nk = input().split()
seisuuretu_2 = input().split()
nk1 = int(nk[1])
seisuuretu = [int(i) for i in seisuuretu_2]

list_max = set()
beautiful_list = []
for start in range(len(seisuuretu) + 1):
    for end in range(len(seisuuretu) + 1):
        if start < end:
            temp_pattern = bin(sum(seisuuretu[start:end]))[2:]
            beautiful_list.append(temp_pattern)
            list_max |= {len(temp_pattern),}

list_max = -max(list_max)

status = True
while status == True:
    temp = []
    count = 0
    len_all = 0
    for i in beautiful_list:
        try:
            if int(i[list_max]) == 1:
                count += 1
                temp.append(i)
        except:
            continue
    if count > nk1:
        list_max += 1
        beautiful_list = temp
    elif count == nk1:
        num_count = True
        for num in temp:
            if num_count == True:
                ronriseki = int(num, 2)
            else:
                ronriseki = ronriseki & int(num, 2)
            num_count = False
        print(ronriseki)
        sys.exit()
        status = False
    elif list_max == -1:
        num_count = True
        for num in beautiful_list:
            if num_count == True:
                ronriseki = int(num, 2)
            else:
                ronriseki = ronriseki & int(num, 2)
            num_count = False
        print(ronriseki)
        sys.exit()
        status = False
    else:
        list_max += 1


### FIXED CODE ###

nk = input().split()
seisuuretu_2 = input().split()
nk1 = int(nk[1])

#seisuuretu = [int(i) for i in seisuuretu_2]
seisuuretu = list(map(int, seisuuretu_2))

list_max = set()
beautiful_list = []
for start in range(len(seisuuretu) + 1):
    for end in range(len(seisuuretu) + 1):
        if start < end:
            temp_pattern = bin(sum(seisuuretu[start:end]))[2:]
            beautiful_list.append(temp_pattern)
            list_max |= {len(temp_pattern),}

list_max = -max(list_max)

status = True
while status == True:
    temp = []
    count = 0
    for i in beautiful_list:
        try:
            if i[list_max] == "1":
                count += 1
                temp.append(i)
        except:
            continue
    if count > nk1:
        list_max += 1
        beautiful_list = temp
    elif count == nk1:
        num_count = True
        for num in temp:
            if num_count == True:
                ronriseki = int(num, 2)
            else:
                ronriseki = ronriseki & int(num, 2)
            num_count = False
        print(ronriseki)
        exit()
        status = False
    elif list_max == -1:
        num_count = True
        for num in beautiful_list:
            if num_count == True:
                ronriseki = int(num, 2)
            else:
                ronriseki = ronriseki & int(num, 2)
            num_count = False
        print(ronriseki)
        exit()
        status = False
    else:
        list_max += 1
### BUGGY CODE ###

from collections import deque
H ,W = map(int, input().split())#↓H行数 →W列数
List = [list(str(input())) for i in range(H)]
#H=3
#W=3
#List=[['.', '.', '.'], ['.', '#', '.'], ['.', '.', '.']]
cheak=[['0' for i in range(W)] for j in range(H)]

q = deque([])

for h in range(H):
    for w in range(W):
        if List[h][w]=='#':
            cheak[h][w]='1'
            q.append([h,w])
#print(List)
#print(cheak)
move=[[1,0],[-1,0],[0,1],[0,-1]]
num=-1
#print(q)
while q:
    for rt in range(len(q)):
        i=q.popleft()
        for u in move:
            if 0<=i[0]+u[0]<=H-1 and 0<=i[1]+u[1]<=W-1 and cheak[i[0]+u[0]][i[1]+u[1]]=='0':
                q.append([i[0]+u[0],i[1]+u[1]])
                cheak[i[0]+u[0]][i[1]+u[1]]='1'
    #print(cheak)
    num+=1
print(num)        


### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline

H ,W = map(int, input().split())#↓H行数 →W列数
List = [list(str(input())) for i in range(H)]
#H=3
#W=3
#List=[['.', '.', '.'], ['.', '#', '.'], ['.', '.', '.']]
cheak=[['0' for i in range(W)] for j in range(H)]

q = deque([])

for h in range(H):
    for w in range(W):
        if List[h][w]=='#':
            cheak[h][w]='1'
            q.append([h,w])
#print(List)
#print(cheak)
move=[[1,0],[-1,0],[0,1],[0,-1]]
num=-1
#print(q)
while q:
    for rt in range(len(q)):
        i=q.popleft()
        for u in move:
            if 0<=i[0]+u[0]<=H-1 and 0<=i[1]+u[1]<=W-1 and cheak[i[0]+u[0]][i[1]+u[1]]=='0':
                q.append([i[0]+u[0],i[1]+u[1]])
                cheak[i[0]+u[0]][i[1]+u[1]]='1'
    #print(cheak)
    num+=1
print(num)
### BUGGY CODE ###

import bisect
n=int(input())
lists=list(map(int,input().split()))
listss=sorted(lists)
count=0
for i in range(n):
    for j in range(n):
        if i!=j:
            index1=bisect.bisect_left(listss, abs(listss[j]-listss[i])+1)
            index2=bisect.bisect_right(listss,listss[i]+listss[j]-1)
            count+=(index2-index1)
            x=abs(listss[j]-listss[i])
            if  x+1<=listss[i]:
                count-=1
            if x+1<=listss[j]:
                count-=1
print(count//6)

### FIXED CODE ###

import bisect
n=int(input())
lists=list(map(int,input().split()))
lists=sorted(lists)

cnt=0
import math
for i in range(n):
    for j in range(i+1,n):
        #i<j 
        x=lists[i]
        y=lists[j]
        left=i 
        right=j 
        index=bisect.bisect_right(lists,y-x)
        cnt+=min(j-i-1,j-index)

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

N, M = map(int, input().split())
A = []
for i in range(M):
    L, R = map(int, input().split())
    if i == 0:
        S = set(list(range(L, R + 1)))
    else:
        S = S & set(list(range(L, R + 1)))
        if len(S) == 0:
            break

# L = set(A[0])
# for i in range(1, M):
#     L = L & set(A[i])

print(len(S))


### FIXED CODE ###

N, M = map(int, input().split())
A = []
for i in range(M):
    L, R = map(int, input().split())
    if i == 0:
        Lmax = L
        Rmin = R
    else:
        Lmax = max(L, Lmax)
        Rmin = min(R, Rmin)

# L = set(A[0])
# for i in range(1, M):
#     L = L & set(A[i])

if Rmin-Lmax < 0:
    print(0)
else:
    print(Rmin-Lmax+1)
### BUGGY CODE ###

N, M = map(int, input().split())
ABs = [list(map(int, input().split())) for _ in range(N)]

ans = 0
for i in range(1, M + 1):
    max_ = [-1, 0]
    for AB in ABs:
        if AB[0] <= i and AB[1] > max_[1]:
            max_ = AB
    ans += max_[1]
    if max_[0] != -1:
        ABs.remove(max_)

print(ans)

### FIXED CODE ###

import heapq
N, M = map(int, input().split())
ABs = [list(map(int, input().split())) for _ in range(N)]

heapq.heapify(ABs)
availables = []
ans = 0
for i in range(1, M + 1):
    while ABs:
        a = heapq.heappop(ABs)
        if a[0] == i:
            heapq.heappush(availables, -a[1])
        else:
            heapq.heappush(ABs, a)
            break
    if availables:
        ans -= heapq.heappop(availables)

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

print(max(filter(lambda x:x**(1/2)%1==0,range(1,int(input())+1))))

### FIXED CODE ###

i=input;print(int(int(i())**0.5)**2)