Harryxun/stf_run huggingface dataset:
N = float(input())

q = N
r_s = []
while q!=1:
  hoge = (q-1) / (-2)
  if hoge.is_integer():
    r = int(1)
    q = float(hoge)
  else:
    r = int(0)
    q = float(q/(-2))
  
  r_s = r_s.append(r)
r_s = r_s[::-1]
for i in range(r_s):
  print(i, end="")


### FIXED CODE ###

N = float(input())

if N==0:
  print(0)
else:
  q = N
  r_s = []

  while q!=1:
    hoge = (q-1) / (-2)
    if hoge.is_integer():
      r = int(1)
      q = float(hoge)
    else:
      r = int(0)
      q = float(q/(-2))
  
    r_s.append(r)
  r_s.append(1)
  r_s = r_s[::-1]

  for i in range(len(r_s)):
    print(r_s[i], end="")
import statistics
N = int(input())
A = list(map(int, input().split()))

for i, a in enumerate(A):
    A[i] = a - (i+1)

tmp = int(statistics.median(A))

ans = 0
for i, a in enumerate(A):
    ans += abs(a - tmp)

print(ans)


### FIXED CODE ###

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

for i, a in enumerate(A):
    A[i] = a - (i+1)

tmp = int(statistics.median(A))

ans = 0
for i, a in enumerate(A):
    ans += abs(a - tmp)

print(ans)
import itertools
n, m = map(int, input().split())
hyoka = [""] * n
for i in range(n):
    hyoka[i] = input().split()
for i in range(n):
    hyoka[i] = [int(s) for s in hyoka[i]]
hyou = [""]
for iroiro in list(itertools.combination(hyoka, m)):
    sum_1 = sum[beau[1] for beau in iroiro]
    sum_1 = abs(sum_1)
    sum_2 = sum[beau[2] for beau in iroiro]
    sum_2 = abs(sum_2)
    sum_3 = sum[beau[3] for beau in iroiro]
    sum_3 = abs(sum_3)
    som = sum_1 + sum_2 + sum_3
    hyou = hyou.append(som)
print(max(hyou))

### FIXED CODE ###

P = [(1,1,1), (1,1,-1), (1,-1,1), (1,-1,-1), (-1,1,1), (-1,1,-1), (-1,-1,1), (-1,-1,-1)]
N, M = map( int, input().split())
X = [0]*N
Y = [0]*N
Z = [0]*N
ans = 0
for i in range(N):
    X[i], Y[i], Z[i] = map( int, input().split())
for i in range(8):
    a, b, c = P[i]
    W = [0]*N
    for j in range(N):
        W[j] = a*X[j] + b*Y[j] + c*Z[j]
    W.sort(key=None, reverse = True)
    ans = max( ans, sum(W[:M]))
print(ans)
#coding:utf-8
import numpy as np
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]

count = 0

for item in a:
    #A*Bについて、今回は行列の積を求めているのと同じ
    if np.dot(item, b) + c > 0:
        count += 1

print(count)

### FIXED CODE ###

#coding:utf-8
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for i in range(n)]

count = 0

for i in range(0, n):
    #n行ごとに答えを計算する。最初はcで初期化
    ans = c
    for j in range(0, m):
        ans += a[i][j] * b[j]
        #m列目になったら判定実施
        if j == m-1 and ans > 0:
            count += 1

print(count)
N = int(input())
s = map(str,input().split())
a = []
for i in range(N):
    a[s[i]] += 1
ans = 0
if a['P'] > 0:
    ans += 1
if a['W'] > 0:
    ans += 1
if a['G'] > 0:
    ans += 1
if a['Y'] > 0:
    ans += 1
if ans == 3:
    print("Three")
else :
    print("Four")



### FIXED CODE ###

N = int(input())
s = map(str,input().split())
if 'Y' in s:
    print("Four")
else:
    print("Three")
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
from decimal import *
 
# N以上でMを割り切ることができる最小の数nを求める　→ 答え M//n
N, M = MAP()

def make_divisors(n):  #約数列挙
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
    
divisors = make_divisors(M)
print(divisors)n = divisors[bisect_left(divisors, N)]
print(M//n)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#import numpy as np
from decimal import *
 
# N以上でMを割り切ることができる最小の数nを求める　→ 答え M//n
N, M = MAP()

m = [] #Mの約数を格納
for i in range(1, int(M**0.5)+1):
    if M%i == 0:
        m.append(i)
        if i != M//i:
            m.append(M//i)

m.sort()
n = m[bisect_left(m, N)]

print(M//n)
N,M = map(int,input().split())
E = [[0,0]for i in range(M)]
E_list = [[]for i in range(N)]

marks = [False for i in range(N)]

def dfs(n):
    global E_list
    global marks
    global N,M

    marks[n] = True

    steps = 1

    for nx in E_list[n]:
        if not marks[nx]:
            marks[nx] = True
            steps += dfs(nx)
    
    return steps



for i in range(M):
    E[i] = list(map(int, input().split()))
    E_list[E[i][0]-1].append(E[i][1]-1)
    E_list[E[i][1]-1].append(E[i][0]-1)

m = 1


for i in range(N):
    E_list[i] = list(set(E_list[i]))
for i in range(N):
    if not marks[i]:
        st = dfs(i)

    m = max(m,st)


print(m)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

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

E_list = [[]for i in range(N)]

marks = [False for i in range(N)]
m = 1
def dfs(n):
    global E_list
    global marks
    global N,M

    marks[n] = True

    steps = 1

    for nx in E_list[n]:
        if not marks[nx]:
            marks[nx] = True
            steps += dfs(nx)
    
    return steps



for i in range(M):
    e1,e2 = map(int, input().split())
   
    E_list[e1-1].append(e2-1)
    E_list[e2-1].append(e1-1)


for i in range(N):
    E_list[i] = list(set(E_list[i]))

for i in range(N):
    if not marks[i]:
        st = dfs(i)

    m = max(m,st)

print(m)
N=int(input())
Ls = list(map(int,input().split()))
score=0
for i in range(0,N-2):
  a = Ls[i]
  for j in range(i+1, N-1):
      b = Ls[j]
      for k in range(j+1, N):
        c = Ls[k]
        if ((a+b>c)&(a+c>b)&(b+c>a)&(a!=b)&(a!=c)&(b!=c)):
          score+=1
          L_list=[i,j,k]
          print(L_list)
print(score)

### FIXED CODE ###

N=int(input())
n= str(N)
total=0
for i in range(len(n)):
  k = n[i]
  k = int(k)
  total += k
  
if total%9==0:
  print("Yes")
else:
  print("No")
import random

S = input()
n = len(S)

i = 1+int(random.random()*(n-3))

print(S[i]+S[i+1]+S[i+2])

### FIXED CODE ###

import random


S = input()
n = len(S)
i = 0+int(random.random()*(n-3))
print(S[i]+S[i+1]+S[i+2])
def dfs(i, sum, count, unsolve):
 global ans
 if i == D:
  #G点に満たなければunsolveのうち最も大きいものを解く
  if sum < G:
   use = max(unsolve)
  #解く問題が問題数を超えないようにする
   N = min(pc[use-1][0], -(-(g-sum)//(100*use)))
   count += N 
   sum += N * 100 * use
  if sum > G:
   ans = min(ans, count)
 else:
 dfs(i + 1, sum, count, unsolve)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], unsolve - {i + 1})

d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)

### FIXED CODE ###

def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100))) #ムダに-演算子を重ねているのは切り上げしたいから
            count += n
            sum += n * use * 100
        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = float("inf")
dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math
mod=10**9+7
ferumaC=10000
fac=[0 for i in range(ferumaC)]
fac[0]=1
ifac=[0 for i in range(ferumaC)]
ifac[0]=1
def mpow(x,n):
    num=1
    while n > 0:
        if n&1:
            num=num*x%mod
        x=x*x%mod
        n=n>>1
    return(num)
for i in range(0,ferumaC-1):
    fac[i+1]=(fac[i]*(i+1))%mod
    ifac[i+1]=ifac[i]*mpow(i+1,mod-2)%mod
def comb(a,b):
    if a==0 and b==0:return(1)
    if a<b or a<0:return(0)
    tmp=ifac[a-b]*ifac[b]%mod
    return(tmp*fac[a]%mod)
N,M=map(int,input().split())
A=list(map(int,input().split()))
#A=[i%M for i in A]
data=[0 for i in range(N)]
data[0]=A[0]%M
for i in range(1,N):
    data[i]=(data[i-1]+A[i])%M
data.append(0)
data=Counter(data)
print(sum([comb(data[i],2) for i in data if data[i]>=2]))


### FIXED CODE ###

# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
# import functools
# import itertools
# import math

N,M=map(int,input().split())
A=list(map(int,input().split()))
#A=[i%M for i in A]
data=[0 for i in range(N)]
data[0]=A[0]%M
for i in range(1,N):
    data[i]=(data[i-1]+A[i])%M
data.append(0)
data=Counter(data)
print(sum([data[i]*(data[i]-1)//2 for i in data if data[i]>=2]))
#D問題
mod = 1000000007
S = str(input())


dp = [[0 for i in range(13)] for j in range(N+1)]
dp[0][0] = 1
for i,s in enumerate(S):
    if s == "?":
        for j in range(10):
            for k in range(13):
                ind = (10*k+j)%13
                dp[i+1][ind] += dp[i][k]
    else:
        j = int(s)
        for k in range(13):
            ind = (10*k+j)%13
            dp[i+1][ind] += dp[i][k]
            
    for k in range(13):
        dp[i+1][k]%=mod
            
print(dp[N][5]%mod)

### FIXED CODE ###

#D問題
mod = 1000000007
S = str(input())
N = len(S)


dp = [[0 for i in range(13)] for j in range(N+1)]
dp[0][0] = 1
for i,s in enumerate(S):
    if s == "?":
        for j in range(10):
            for k in range(13):
                ind = (10*k+j)%13
                dp[i+1][ind] += dp[i][k]
    else:
        j = int(s)
        for k in range(13):
            ind = (10*k+j)%13
            dp[i+1][ind] += dp[i][k]

    for k in range(13):
        dp[i+1][k]%=mod
            
print(dp[N][5]%mod)
from collections import deque
 
H,W = map(int,readline().split())
H += 2; W += 2
grid = '#' * W
for _ in range(H-2):
    grid += '#' + readline().rstrip().decode() + '#'
grid += '#' * W
 
def bfs(start):
    INF = 10 ** 9
    dist = [INF] * (H*W)
    dist[start] = 0
    q = deque([start])
    while q:
        v = q.popleft()
        dv = dist[v]
        for move in (-1,1,W,-W):
            w = v + move
            if grid[w] == '#':
                continue
            dw = dv + 1
            if dw >= dist[w]:
                continue
            dist[w] = dw
            q.append(w)
    return max(x for x in dist if x < INF)
 
answer = max(bfs(v) for v in range(H*W) if grid[v] != '#')
print(answer)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
from collections import deque
 
H,W = map(int,readline().split())
H += 2; W += 2
grid = '#' * W
for _ in range(H-2):
    grid += '#' + readline().rstrip().decode() + '#'
grid += '#' * W
 
def bfs(start):
    INF = 10 ** 9
    dist = [INF] * (H*W)
    dist[start] = 0
    q = deque([start])
    while q:
        v = q.popleft()
        dv = dist[v]
        for move in (-1,1,W,-W):
            w = v + move
            if grid[w] == '#':
                continue
            dw = dv + 1
            if dw >= dist[w]:
                continue
            dist[w] = dw
            q.append(w)
    return max(x for x in dist if x < INF)
 
answer = max(bfs(v) for v in range(H*W) if grid[v] != '#')
print(answer)
from collections import deque
N = int(input())
a = list(map(int,input().split()))
value = []
for i in range(2,N):
    x = sum(a[0:i])
    y = sum(a[i:N])
    value.append(abs(x-y))

print(min(value))


### FIXED CODE ###


N = int(input())
a = list(map(int,input().split()))
x = a[0]
y = sum(a[1:])
ans = abs(x-y)
for i in range(1,N-1):
    x += a[i]
    y -= a[i]
    ans = min(abs(x-y),ans)

print(ans)
n,m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

probcnt = p[0]
ACval = False
ACcnt = 0
wa = 0
for i in range(m):
    if probcnt == p[i]:
        if ACval == False:
            if s[i] == 'WA':
                wa += 1
            else:
                ACval = True
                ACcnt += 1
    else:
        ACval = False
        probcnt = p[i]
        if ACval == False:
            if s[i] == 'WA':
                wa += 1
            else:
                ACval = True
                ACcnt += 1

print(ACcnt, wa)

### FIXED CODE ###

n, m = map(int,input().split())
p = [0] * m
s = [0] * m
for i in range(m):
    p[i], s[i] = map(str, input().split())
for i in range(m):
    p[i] = int(p[i])

ans1 = 0
ans2 = 0

aclis = [0] * (n+1)
walis = [0] * (n+1)


for i in range(m):
    if s[i] == 'AC':
        aclis[p[i]] = 1



    elif aclis[p[i]] == 0 and s[i] == 'WA':
        walis[p[i]] += 1
ans1 = aclis.count(1)
#print(aclis)
#print(walis)

for i in range(n+1):
    if aclis[i] == 1:
        ans2 += walis[i]


print(ans1, ans2)
out = []
while True:
  n = int(raw_input())
  if n == 0: break
  trans = {}
  for i in range(n):
    k,v = raw_input().split()
    trans[k] = v.rstrip()
  cnt = int(raw_input())
  res = ""
  for j in range(n):
    a = raw_input().rstrip()
    if a in trans: a = trans[a]
    res += a
  out.append(a)
for o in out: print o

### FIXED CODE ###

out = []
while True:
  n = int(raw_input())
  if n == 0: break
  trans = {}
  for i in range(n):
    k,v = raw_input().split()
    trans[k] = v.rstrip()
  cnt = int(raw_input())
  res = ""
  for j in range(cnt):
    a = raw_input().rstrip()
    if a in trans: a = trans[a]
    res += a
  out.append(res)
for o in out: print o
s=input()
K=int(input())

sub_list=[]
i,j=0,1
while True:
    if(i+j>=len(s) and i==len(s)-1):
        break
    else:
        sub_list.append(s[i:i+j])
        if(j<=K):
            j+=1
        else:
            i+=1
            j=1
set_list=set(sub_list)

dict_list=list(set_list)
dict_list.sort(key=str)

print(dict_list[K-1])

### FIXED CODE ###

s=input()
K=int(input())

sub_list=[]
i,j=0,1
while True:
    if(i+j>=len(s) and i==len(s)):
        break
    else:
        sub_list.append(s[i:i+j])
        if(j<=K):
            j+=1
        else:
            i+=1
            j=1
set_list=set(sub_list)

dict_list=list(set_list)
dict_list.sort(key=str)

print(dict_list[K-1])
mod=10**9+7
n,k=map(int,input().split())
l=sorted(map(int,input().split()))
ans=0
ll=1
ans+=ll*l[k-1]%mod
b,s=1,1
for i in range(k,n):
  ll=ll*i//(i-k+1)
  ans+=l[i]*ll%mod
  s*=i
  b*=(i-k+1)
ml=s//b

ans-=ml*l[0]
ans%=mod
for i in range(1,n-k+1):
  ml=ml*(n-i-k+1)//(n-i)
  ans-=ml*l[i]%mod

print(ans%mod)


### FIXED CODE ###

s=input()
l="abcdefghijklmnopqrstuvwxyz"
print(l[l.index(s)+1])
N , M = map(int, input().rstrip().split())
 
pricelist = list(map(int, input().split()))
#moneylist = input().rstrip().split()
#pricelist.append(price)
 
for i in range(M):
  pricelist.sort()
  pricelist[N-1] = pricelist[N-1] // 2

print(sum(pricelist)) 

### FIXED CODE ###

weatherlist = ["Sunny", "Cloudy", "Rainy"]
 
weather = input().rstrip()
weathernum = weatherlist.index(weather)
 
tomorrownum = (weathernum +1) % 3

print(weatherlist[tomorrownum])
a, b = list(map(int, input().split()))
if a = 0:
	print("Zero")
elif a > 0:
	print("Positive")
else:
	if b >= 0:
		print("Zero")
	else:
		if (b - a) % 2 == 0:
			print("Negative")
		else:
			print("Positive")


### FIXED CODE ###

a, b = list(map(int, input().split()))
if a == 0:
	print("Zero")
elif a > 0:
	print("Positive")
else:
	if b >= 0:
		print("Zero")
	else:
		if (b - a) % 2 == 0:
			print("Negative")
		else:
			print("Positive")
import math
a,b = map(float, input().split())
print(math.floor((a*(b*100)/100)

### FIXED CODE ###

a,b = input().split()
intA = int(a)
intB = int(b.replace(".",""))
print(intA*intB // 100)
n = int(input())
a = []
nowmin = a[0]
for i in range(n):
  a.append(int(input()))
ans = a[1]-a[0]
for i in range(n-1):
 if a[i] < nowmin
  k = max(a[i+1:]) - a[i]
  if k > ans:
    ans =  k
    
print(ans)



### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
nowmin = a[0]
nowmax = max(a[1:])
ans = nowmax - nowmin
for i in range(n-1):
  if a[i] == nowmax:
    nowmax = max(a[i+1:])
  if a[i] < nowmin:
    k = nowmax - a[i]
    if k > ans:
      ans =  k
      nowmin = a[i]


print(ans)
n=int(input())
a=int(input())
x=n%a
print('Yes' if a<=x else 'No')

### FIXED CODE ###

n=int(input())
a=int(input())
print('Yes' if n%500 <= a else 'No')
n, m, k = map(int, input().split())
a_lst = list(map(int, input().split()))
b_lst = list(map(int, input().split()))

cost = 0
res = 0
while cost < k:
  if a_lst[0] < b_lst[0]:
    if a_lst[0] + cost > k:
      break
    cost += a_lst.pop(0)
    res += 1
  else:
    if b_lst[0] + cost > k:
      break
    cost += b_lst.pop(0)
    res += 1    
print(res)

### FIXED CODE ###

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

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
S=input()
N=Len(S)
ans=0
for i in range(N):
  if S[i]!=S[N-1-i]:
    S[i] =S[N-1-i]
    ans+=1
print(ans)

### FIXED CODE ###

S=input()
N=len(S)
ans=0
for i in range(N):
  if S[i]!=S[N-1-i]:
    ans+=1
print(ans//2)
N, L = [int(x) for x in input().split()]
S = []
for s in range(N):
    S.append(input())
print("".join(sorted(S)))

# %% [markdown]
#
# C
#

# %%
N, K = [int(x) for x in input().split()]
dislikes = [False] * 10
dislike_nums = [int(x) for x in input().split()]
for n in dislike_nums:
    dislikes[n] = True

# Add '0' in the beginning of N for carrying up
N = "0" + str(N)

# Create a list of numbers consists N
n_list = []
for n in N:
    n_list.append(int(n))
# Create a list of carrying up numbers
c_list = [0] * len(n_list)

# Create the smallest payment
payment = ""
for i in range(len(n_list) - 1, -1, -1):
    n = n_list[i] + c_list[i]
    if i == 0 and n == 0:
        break
    # Find an equal or larger number than n and not in dislikes
    x = -1
    for m in range(n, 10):
        if not dislikes[m]:
            x = m
            break
    if x >= 0:
        # found a number
        payment = str(m) + payment
        continue

    # Carry a number to the previous (x10) digit
    if i > 0:
        c_list[i - 1] += 1

    # Find a smaller number than n and not in dislikes
    for m in range(0, n):
        if not dislikes[m]:
            payment = str(m) + payment
            break
print(int(payment))


### FIXED CODE ###

N, K = [int(x) for x in input().split()]
dislikes = [False] * 10
dislike_nums = [int(x) for x in input().split()]
for x in dislike_nums:
    dislikes[x] = True

for n in range(N, N * 10):
    found = False
    for x in str(n):
        if dislikes[int(x)]:
            found = True
            break
    if not found:
        break
print(n)
A = int(input())
B = int(input())

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")
    

### FIXED CODE ###

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

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")
import numpy as np

import sys

N = int(input())
x = []
y = []
for i in range(N):
    a, b = map(int, input().split())
    x.append(a)
    y.append(b)

howmuch = np.zeros((N, N))

towngroup = np.array(list(range(N)))

for i in range(N):
    for j in range(i, N):
        howmuch[i][j] = min(abs(x[i] - x[j]), abs(y[i] - y[j]))

cheapbridge = np.argsort(howmuch.flatten())

cost = 0

for i in cheapbridge[(N*(N+1))//2:]:
    a = i // N
    b = i % N
    if towngroup[a] == towngroup[b]:
        continue

    cost += min(abs(x[a] - x[b]), abs(y[a] - y[b]))

    towngroup[towngroup == towngroup[b]] = towngroup[a]

    if len(set(towngroup)) == 1:
        print(cost)
        sys.exit()


### FIXED CODE ###

import sys

import numpy as np


class Graph:
    def __init__(self, N):
        self.townarrow = [i for i in range(N)]

    def find(self, x):
        if x == self.townarrow[x]:
            return x
        else:
            self.townarrow[x] = self.find(self.townarrow[x])
            return self.townarrow[x]

    def union(self, x, y):
        self.link(self.find(x), self.find(y))

    def link(self, x, y):
        self.townarrow[y] = x


N = int(input())
x = []
y = []
for i in range(N):
    a, b = map(int, input().split())
    x.append(a)
    y.append(b)

useful_road = []

l = sorted(range(N), key=lambda j: x[j])
for i in range(len(l) - 1):
    cost = min(abs(x[l[i]] - x[l[i + 1]]), abs(y[l[i]] - y[l[i + 1]]))
    useful_road.append((cost, l[i], l[i + 1]))

l = sorted(range(N), key=lambda j: y[j])
for i in range(len(l) - 1):
    cost = min(abs(x[l[i]] - x[l[i + 1]]), abs(y[l[i]] - y[l[i + 1]]))
    useful_road.append((cost, l[i], l[i + 1]))


m = 0
cost = 0
towngroup = Graph(N)
for c, i, j in sorted(useful_road):
    if towngroup.find(i) == towngroup.find(j):
        continue
    cost += c
    m += 1

    towngroup.union(i, j)

    if m == N - 1:
        print(cost)
        sys.exit()
import sys

n=int(input())

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

c=[0]*max(a)

for i in range(len(a)):
  c[a[i]]+=1

  if c[a[i]]>1:
    print("NO")
    sys.exit()

print("YES")


### FIXED CODE ###

import sys

n=int(input())

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

a.sort()

for i in range(len(a)-1):
  if a[i]==a[i+1]:
    print("NO")
    sys.exit()

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


def gcd_arr(a):
    ans = a[0]
    for i, a_i in enumerate(a):
        ans = gcd(ans, a_i)
    return ans

print(gcd_arr(A))

### FIXED CODE ###

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

ans = 10 ** 10
while min(A) != ans:
    ans = min(A)
    for i, a_i in enumerate(A):
        if a_i > ans:
            A[i] = a_i % ans
            if A[i] == 0:
                del A[i]

print(ans)
L, R, d= int(input().split())
counter=0
for i in range(R+1-L):
  num = i+L
  if num%d == 0:
    counter+=1
print(counter)

### FIXED CODE ###


L, R ,d= map(int,input().split())
counter=0
for i in range(R+1-L):
  num = i+L
  if num%d == 0:
    counter+=1
print(counter)
N = int(input())
C = [-1]

prev = -1
for _ in range(N):
    c = int(input())
    if c == prev:
        continue
    else:
        C.append(c)
        prev = c

MOD = 10**9+7
n = len(C)
dp = [0]*(n+2)
last = [-1]*(N*10)
dp[0] = 1
for i in range(1, n+1):
    if last[C[i]] == -1:
        last[C[i]] = i
        dp[i] = dp[i-1]
    else:
        dp[i] = dp[i-1]+dp[last[C[i]]]
        dp[i] %= MOD
        last[C[i]] = i
print(max(dp))


### FIXED CODE ###

N = int(input())
C = [-1]

for _ in range(N):
    c = int(input())
    if c == C[-1]:
        continue
    else:
        C.append(c)

MOD = 10**9+7
dp = 1
prev = [0]*(max(C)+1)

for c in C[1:]:
    dp = (dp+prev[c]) % MOD
    prev[c] = dp
print(dp)