Harryxun/stf_run huggingface dataset:
X, Y, Z = map(int, input().split())
print(Z,X,Y)

### FIXED CODE ###

X, Y, Z = map(int, input().split())
print(Z,X,Y)
N = int(input())
*A, = map(int,input().split())

if N%3:
    ans = True
    for a in A:
        if a:ans=False;break
else:
    B = set(A)
    l = len(B)
    ans = True
    if l>3 or l==2:ans = False
    elif l==1:
        for b in B:
            if b:ans=False;break
        1/0
    else:
        a,b,c = B
        ans = ans and (A.count(a)==A.count(b)==A.count(c)==N//3) and (a^b==c)
        
if ans:print("Yes")
else:print("No")

### FIXED CODE ###

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

if N%3:
    ans = True
    for a in A:
        if a:ans=False;break
else:
    B = set(A)
    l = len(B)
    ans = True
    if l>3:
        ans = False
    elif l==1:
        for b in B:
            if b:ans=False;break
    else:
        if l==3:
            a,b,c = B
            l,m,n = (A.count(x) for x in (a,b,c))
        if l==2:
            a,b = B
            l,m = (A.count(x) for x in (a,b))
            if l>=m:
                c=a
                n=l//2
                l-=n
            else:
                c=b
                n=m//2
                m-=n
        ans = ans and (l==m==n==N//3) and (a^b==c)
        
if ans:print("Yes")
else:print("No")
n,k=map(int,input().split())
a=[]
for i in range(n):
 a+=map(input().split())
a.sort()
ans=0
for i in range(k):
 ans+=a[i]
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(k):
 ans+=a[n-1-i]
print(ans)
a, b = (int(i) for i in input().split())  
  
if a/b % 0:
	c = a + b
else:
	c = b - a
    
print(c)


### FIXED CODE ###

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

if b%a == 0:
	c = a + b
else:
	c = b - a
    
print(c)
S = input()
dig = 0
dig_pre = 0
flag = True


for i in range(4):
    dig = S % 10
    if i>0:
        if(dig == dig_pre):
            flag = False
            break
    dig_pre = dig
    S = S/10

if flag == True:
    print ("Good")
else:
    print("Bad")


### FIXED CODE ###

S = raw_input()
flag = True
for i in range(3):
    if (S[i+1] == S[i]):
        flag = False
        break

if flag == True:
    print ("Good")
else:
    print("Bad")
# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

# 1000円札なら何枚か
sen = y//1000

# 減らさなきゃいけない枚数
# 1万円札なら9枚，5千円札なら4枚減る
target = sen - n

if target < 0:
    print('-1 -1 -1')
else:
    iti_man = target // 9
    go_sen = target % 9 // 4

    if target % 9 % 4:
        print('-1 -1 -1')
    else:
        sen = sen - iti_man*10 - go_sen*5
        print('{} {} {}'.format(iti_man, go_sen, sen))
Collapse





### FIXED CODE ###

# coding:utf-8

n, y = [int(x) for x in input().split(' ')]

max_iti_man = y // 10000

for iti_man in range(max_iti_man + 1):
    for go_sen in range(int(n) - iti_man + 1):
        itigo = 5000 * go_sen + 10000 * iti_man
        sen = n - iti_man - go_sen
        if 1000 * sen + itigo == y:
            print("{} {} {}".format(iti_man,go_sen,sen))
            exit()

print("-1 -1 -1")
from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split(' '))
ss, cc = 0, {0: 1}
rs = 0
for k in a:
  ss += k
  cc[k] += 1
  rs += cc[k] - 1

print rs

### FIXED CODE ###

from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split(' '))
ss, cc = 0, {0: 1}
rs = 0
for k in a:
  ss += k
  cc[ss] = cc.get(ss, 0) + 1
  rs += cc[ss] - 1

print rs
k, n = map(int, input().split())
a = list(map(int, input().split())) + [k + a[0]]
print(k - max([a[i + 1] - a[i] for i in range(n)]))

### FIXED CODE ###

k, n = map(int, input().split())
a = [int(i) for i in input().split()]
diff_a = [0] * n
diff_a[0] = (a[0] + k) - a[n - 1]
for i in range(1, n):
    diff_a[i] = a[i] - a[i - 1]
print(k - max(diff_a))
N=int(input())
a=list(map(int, input().split()))
c=[0]*9
for i in range(N):
  c[a[i]//400]+=1
  
temp=[1 for i in range(8) if c[i]>0]
x=len(temp)
y=min(8, x+c[8])

print(x, y)

### FIXED CODE ###

N=int(input())
a=list(map(int, input().split()))
c=[0]*9
for i in range(N):
  c[min(a[i]//400, 8)]+=1
  
temp=[1 for i in range(8) if c[i]>0]
x=len(temp)
y=x+c[8]
 
print(max(x, 1), y)
n = int(input())
h = list(map(int, input().split()))

a = 0
move = []

for i in range(n-1):
  if h[i] >= h[i+1]:
    a += 1
  else:
    move += a
    a = 0

print(max(move))

### FIXED CODE ###

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

a = 0
move = []

for i in range(n-1):
  if h[i] >= h[i+1]:
    a += 1
  else:
    move.append(a)
    a = 0
move.append(a)

print(max(move))
a_set = {}
a_set.add(int(input()))
a_set.add(int(input()))

all_set = {1,2,3}
print(all_set.difference(a_set)[0])


### FIXED CODE ###

a_list = []
a_list.append(int(input()))
a_list.append(int(input()))

if 1 not in a_list:
  print(1)
elif 2 not in a_list:
  print(2)
else:
  print(3)
X, N = list(map(int,input().split()))
if N == 0:
  print(X)
  exit()
p = list(map(int,input().split()))
if N == 1:
  if p[0] == X:
    print(X-1)
  else:
    print(X)

MAX = 0
for i in range(N):
  if MAX < X - p[i]:
    MAX = X - p[i]
    
for i in range(MAX):
  if X - i not in p:
    ans = X - i
    break
for i in range(MAX):
  if X + i not in p:
    ans = min(X - ans, ans - X) + X
    break
print(ans)

### FIXED CODE ###

X, N = map(int, input().split())
p = list(map(int, input().split()))

p = set(p)
for i in range(200):
    if X - i not in p:
        print(X - i)
        break
    if X + i not in p:
        print(X + i)
        break
import sys

sys.setrecursionlimit(10 ** 5 + 1)

def dfs(i, n, a, L):
    # x + y = n - 1
    # x - y = a
    # x = (n - 1 + a) / 2
    # y = (n - 1 - a) / 2
    if i == n:
        return 1
    if a [i] == 0:
        x = [(n - 1 + a[i]) // 2]
    else:
        x = [(n - 1 + a[i]) // 2, (n - 1 - a[i]) // 2]
    t = 0
    MOD = 10 ** 9 + 7
    for xi in x:
        if L[xi] == 0:
            L[xi] = i + 1
            t += dfs(i + 1, n, a, L)
            L[xi] = 0
    return t % MOD

n = int(input())
a = list(map(int, input().split()))
L = [0 for _ in range(n)]
ans = dfs(0, n, a, L)
print(ans)


### FIXED CODE ###

from collections import defaultdict

MOD = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for ai in a:
    d[ai] += 1
ans = 1
if n % 2:
    for k, v in d.items():
        if k > 0 and v == 2:
            ans *= 2
        elif k == 0 and v == 1:
            ans *= 1
        else:
            ans = 0
            break
        ans = ans % MOD
else:
    for v in d.values():
        if v == 2:
            ans *= 2
        else:
            ans = 0
            break
        ans = ans % MOD
print(ans)
from dateutil.relativedelta import relativedelta

x = int(raw_input())
x = "{0.hours}:{0.minutes}:{0.seconds}".format(relativedelta(seconds=x))
print(x)


### FIXED CODE ###

x = int(raw_input())
m = x/60
h = m/60
m = m%60
s = x%60
print(str(h)+":"+str(m)+":"+str(s))
from sys import stdin

INFTY = 1 << 21
WHITE = 0
GRAY = 1
BLACK = 2

n = int(stdin.readline())
M = [[INFTY for i in range(n)] for j in range(n)]

for u in range(n):
    U = list(map(int, stdin.readline().split()[2:]))
    for j in range(0, len(U), 2):
        M[u][U[j]] = U[j+1]

d = [INFTY for i in range(n)]
color = [WHITE for i in range(n)]

def dijkstra():
    global n
    d[0] = 0
    color[0] = GRAY
    while(1):
        minv = INFTY
        u = -1
        for i in range(n):
            if (minv > d[i] and color[i] != BLACK):
                u = i
                minv = d[i]
        if (u == -1):
            break
        color[u] = BLACK
        for v in range(n):
            if (color[v] != BLACK and M[u][v] != INFTY):
                if(d[v] > d[u] + M[u][v]:)
                    d[v] = d[u] + M[u][v]
                    color[v] = GRAY
    for i in range(n):
        print(i, (-1 if d[i] == INFTY else d[i]))
dijkstra()

### FIXED CODE ###

from sys import stdin

INFTY = 1 << 21
WHITE = 0
GRAY = 1
BLACK = 2

n = int(stdin.readline())
M = [[INFTY for i in range(n)] for j in range(n)]

for u in range(n):
    U = list(map(int, stdin.readline().split()[2:]))
    for j in range(0, len(U), 2):
        M[u][U[j]] = U[j+1]

d = [INFTY for i in range(n)]
color = [WHITE for i in range(n)]

def dijkstra():
    global n
    d[0] = 0
    color[0] = GRAY
    while(1):
        minv = INFTY
        u = -1
        for i in range(n):
            if (minv > d[i] and color[i] != BLACK):
                u = i
                minv = d[i]
        if (u == -1):
            break
        color[u] = BLACK
        for v in range(n):
            if (color[v] != BLACK and M[u][v] != INFTY):
                if(d[v] > d[u] + M[u][v]):
                    d[v] = d[u] + M[u][v]
                    color[v] = GRAY
    for i in range(
n):
        print(i, (-1 if d[i] == INFTY else d[i]))
dijkstra()
n = int(input())
a = list(map(int,input().split()))

a_min = min(a)
ans = 0
for x in range(2,1000000,2):
    if a_min%2 == 0 and a_min > 0:
        ans += 1
        a_min = a_min//2
        contnue
    else:
        break

for y in a:
    if y%2==1:
        ans -= 100000000
        continue



if ans > 0:
    print(ans)
else:
    print(0)

### FIXED CODE ###


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

l = []
ans = 0

for x in range(n):
    for _ in range(10000000):
        if a[x]%2 == 0 and a[x] > 0:
            a[x] = a[x]//2
            ans += 1
            continue
        else:
            l.append(ans)
            ans = 0
            break

print(min(l))
from collections import*
from copy import *
n=int(input())
d=defaultdict(list)

q=[]
for i in range(n-1):
    a,b=map(int,input().split())
    d[a].append(b)
    d[b].append(a)
    q.append(tuple(sorted([a,b])))
    
#print(d)
m=max(map(len,d.values()))
print(m)

dcolars={}

def BFS(d,point,c):
    colar=deque(range(1,m+1))
    for i in d[point]:
        if tuple(sorted([point,i])) not in dcolars:
            ckamo=colar.pop()
            if c==ckamo:
                csave=deepcopy(ckamo)
                ckamo=colar.pop()
                colar.append(csave)
            dcolars[tuple(sorted([point,i]))]=ckamo
            BFS(d,i,ckamo)
    return dcolars

ans=BFS(d,1,0)

for i in q:
    print(ans[i])

### FIXED CODE ###

from collections import*
import sys
sys.setrecursionlimit(10**8)
input=sys.stdin.readline

n=int(input())
d={}

q=[]
for i in range(n-1):
    a,b=map(int,input().split())
    if a not in d:
        d[a]=[]
    if b not in d:
        d[b]=[]
    d[b].append(a)
    d[a].append(b)        
    q.append(tuple(sorted([a,b])))

m=max(map(len,d.values()))
print(m)

dcolars={}

def BFS(d,point,c):
    for i in d[point]:
        if tuple(sorted([point,i])) not in dcolars:
            c+=1
            if c==m+1:
                c=1
            dcolars[tuple(sorted([point,i]))]=c
            BFS(d,i,c)
    return dcolars

ans=BFS(d,1,0)

for i in q:
    print(ans[i])
>>> a,b=(int(x) for x in input().split())
tap = 1
count = 0

while tap < b:
    tap = tap + a - 1
    count = count + 1
    
print(count)

### FIXED CODE ###

a,b=(int(x) for x in input().split())
tap = 1
count = 0

while tap < b:
    tap = tap + a - 1
    count = count + 1
    
print(count)
a,b = input().split()
print("Even" if (a*b)//2 == 0 else "Odd")


### FIXED CODE ###

a,b = map(int, input().split())
print("Even" if ( a * b ) % 2 == 0 else "Odd")
def main():
    a, b, c = list(map(int, input().split()))
    ret = 'bust' if sum(a,b,c) >= 22 else 'win'
    print(ret)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    a = list(map(int, input().split()))
    ret = 'bust' if sum(a) >= 22 else 'win'
    print(ret)

if __name__ == "__main__":
    main()
N=int(input())
value=0
if N==1:
    print(A)
    exit()
if N==2:
    print(0)
    exit()
for i in range(1,int(N**.5+10)):
    if N%i==0 and N//i>=i+1:
        value+=N//i-1
print(value)


### FIXED CODE ###

N=int(input())
value=0
if N==1:
    print(0)
    exit()
if N==2:
    print(0)
    exit()
for i in range(1,int(N**.5+10)):
    if N%i==0 and N//i>=i+2:
        value+=N//i-1
print(value)
inf = float('inf')
 
n, m, r = map(int, input().split())
rs = [r-1 for r in list(map(int, input().split()))]
 
 
ds = [[inf] * n for _ in range(n)]
for i in range(n):
  ds[i][i] = 0
 
for mm in range(m):
  a, b, c = map(int, input().split())
  a, b = a-1, b-1
  ds[a][b] = c
  ds[b][a] = c
 
## warshall floyd
for k in range(n):
  for i in range(n):
    for j in range(n):
      ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j])
 
 
#def dfs(dist, before, remain, ds):
#  print(f'dfs({dist}, {before}, {remain})')
#  if remain == []:
#    return dist
#  dd = []
#  for r in remain:
#    if before is not None:
#      dist += ds[before][r]
#    dd.append(dfs(dist, r, list(set(remain) - set([r])), ds))
#  return min(dd)    
#
#print(dfs(0, None, rs, ds))
 
 
import itertools
dds = []
for i in itertools.permutations(rs, len(rs)):
  d = 0
  for j in range(len(rs)-1):
    dd = ds[i[j]][i[j+1]]
    d += dd
    #print(f'added {dd}')
  dds.append(d)
print(min(dds))
inf = float('inf')

n, m, r = map(int, input().split())
rs = [r-1 for r in list(map(int, input().split()))]


ds = [[inf] * n for _ in range(n)]
for i in range(n):
  ds[i][i] = 0

for mm in range(m):
  a, b, c = map(int, input().split())
  a, b = a-1, b-1
  ds[a][b] = c
  ds[b][a] = c

## warshall floyd
for k in range(n):
  for i in range(n):
    for j in range(n):
      ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j])


#def dfs(dist, before, remain, ds):
#  print(f'dfs({dist}, {before}, {remain})')
#  if remain == []:
#    return dist
#  dd = []
#  for r in remain:
#    if before is not None:
#      dist += ds[before][r]
#    dd.append(dfs(dist, r, list(set(remain) - set([r])), ds))
#  return min(dd)    
#
#print(dfs(0, None, rs, ds))


import itertools
dds = []
for i in itertools.permutations(rs, len(rs)):
  d = 0
  for j in range(len(rs)-1):
    dd = ds[i[j]][i[j+1]]
    d += dd
    #print(f'added {dd}')
  dds.append(d)
print(min(dds))


### FIXED CODE ###

#import time
#t = time.time()
inf = float('inf')

n, m, r = map(int, input().split())
rs = [r-1 for r in list(map(int, input().split()))]


ds = [[inf] * n for _ in range(n)]
for i in range(n):
  ds[i][i] = 0

for mm in range(m):
  a, b, c = map(int, input().split())
  a, b = a-1, b-1
  ds[a][b] = c
  ds[b][a] = c

## warshall floyd
for k in range(n):
  for i in range(n):
    for j in range(n):
      ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j])

#print(f'wf finished {time.time() - t}')
#t = time.time()

#def dfs(dist, before, remain, ds):
#  print(f'dfs({dist}, {before}, {remain})')
#  if remain == []:
#    return dist
#  dd = []
#  for r in remain:
#    if before is not None:
#      dist += ds[before][r]
#    dd.append(dfs(dist, r, list(set(remain) - set([r])), ds))
#  return min(dd)    
#
#print(dfs(0, None, rs, ds))


import itertools
dds = []
for i in itertools.permutations(rs, len(rs)):
  d = 0
  for j in range(len(rs)-1):
    dd = ds[i[j]][i[j+1]]
    d += dd
    #print(f'added {dd}')
  dds.append(d)
print(min(dds))

#print(f'search finished {time.time() - t}')
#t = time.time()
n, m = map(int, input().split())
d = {i: 0 for i in range(1, n+1)}
for _ in range(n):
    a, b = map(int, input().split())
    d[a] += 1
    d[b] += 1
for k, v in d.items():
    if v % 2:
        print('NO')
        break
else:
    print('YES')


### FIXED CODE ###

n, m = map(int, input().split())
d = {i: 0 for i in range(1, n+1)}
for _ in range(m):
    a, b = map(int, input().split())
    d[a] += 1
    d[b] += 1
for k, v in d.items():
    if v % 2:
        print('NO')
        break
else:
    print('YES')
import collections

N = int(input())
S = list(input())
Q = int(input())
for _ in range(Q):
    Q1, Q2, Q3 = map(int, input().split())
    if Q1 == '1':
        S[int(Q2)-1] = ord(Q3)
    else:
        print(len(collections.Counter(S[int(Q2)-1: int(Q3)])))

### FIXED CODE ###

import bisect

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

def ordN(x):
  return ord(x) - ord('a')

li = [[] for _ in range(26)]
for i,s in enumerate(S):
  li[ordN(s)].append(i)

for i in range(int(input())):
  Q1, Q2, Q3 = input().split()
  if Q1 == "1":
    Q2 = int(Q2) - 1
    if S[Q2] != Q3:
      I = bisect.bisect_left(li[ordN(S[Q2])], Q2)
      li[ordN(S[Q2])].pop(I)
      bisect.insort(li[ordN(Q3)], Q2)
      S[Q2] = Q3
  else:
    Q2, Q3 = int(Q2)-1, int(Q3)-1
    count = 0
    for j in range(26):
      I = bisect.bisect_left(li[j], Q2)
      if I < len(li[j]) and li[j][I] <= Q3:
        count += 1
    print(count)
def main28():
    import sys
    N, M = (int(x) for x in input().split())

    if N >= M:
        S = input()
        T = input()
    else:
        T = input()
        S = input()

    def lcm(n, m):
        gcd = 0
        for i in range(1, min(n, m)):
            if n % i == 0 and m % i == 0:
                gcd = i

        return int(n * m / gcd)

    LCM = lcm(N, M)
    a = int(LCM / max(N, M))
    b = int(LCM / min(N, M))

    for i in range(min(N, M)):
        small_index = i * b
        if int(small_index % a) == 0:
            if S[int(small_index / a)] != T[i]:
                print("-1")
                sys.exit()
    print(LCM)

main28()

### FIXED CODE ###

def main28():
    import sys
    N, M = (int(x) for x in input().split())

    if N >= M:
        S = input()
        T = input()
    else:
        T = input()
        S = input()

    def lcm(n, m):
        gcd = 0
        for i in range(1, min(n, m) + 1):
            if n % i == 0 and m % i == 0:
                gcd = i

        return int(n * m / gcd)

    LCM = lcm(N, M)

    a = int(LCM / max(N, M))
    b = int(LCM / min(N, M))

    for i in range(min(N, M)):
        small_index = i * b
        if int(small_index % a) == 0:
            if S[int(small_index / a)] != T[i]:
                print("-1")
                sys.exit()
    print(LCM)

main28()
N,M=map(int,input().split())
foods=[0]*M

for i in range(N):
  KA=list(map(int,input().split())


  for a in KA[1:]:
    foods[a-1]+=1

cnt=0
for j in foods:
  if j==N:
    cnt+=1

print(cnt)


### FIXED CODE ###

N,M = map(int,input().split())
foods = [0]*M
 
for i in range(N):
  KA = list(map(int,input().split()))
  
  for a in KA[1:]:
    foods[a-1] += 1
  
cnt = 0
for j in foods:
  if j == N:
    cnt += 1
    
print(cnt)
from numpy import *
N,W=map(int,input().split())
dp=zeros(W+1)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=maximum(dp[w:],dp[:-w]+v)
print(int(max(dp)))

### FIXED CODE ###

from numpy import *
N,W=map(int,input().split())
dp=zeros(W+1)
for i in range(N):
    w,v=map(int,input().split())
    dp[w:]=maximum(dp[w:],dp[:-w]+v)
print(int(max(dp)))
#coding: utf-8

print(23 - M + 24)

### FIXED CODE ###

#coding: utf-8

a = int(input())

print(24 - a + 24)
n = input()

a = map(int, raw_input().split())

a.sort()
f = 1
tmp = [0]
ct = 0

key = a.pop(len(a) - 1)
while len(a) != 0:
    nxt = a.pop(len(a) - 1)
    if key == nxt:
        tmp.append(key)
	ct += 1
        if ct == 2:
            print tmp[1] * tmp[2]
            break
    key = a.pop(len(a) - 1)

if len(tmp) < 2:
    print 0
    

### FIXED CODE ###

n = int(input())
tmp = raw_input()

As = [int(a) for a in tmp.split()]

dic = {}
maxes = [0, 0]
for a in As:
    if a not in dic:
        dic[a] = 0
    dic[a] += 1
    if dic[a] % 2 == 0:
        if maxes[0] < a:
            maxes[0], maxes[1] = a, maxes[0]
        elif maxes[1] < a:
                maxes[1] = a

print (maxes[0] * maxes[1])
n = int(input())
a = list(map(int,input().split()))
spl = [[] for i in range(n)]
ans = 0
check = [0] * n

for i in range(n):
    kakunin = a.copy()
    kakunin.remove(a[i])
    
    p = min(int(a[i] ** 0.5), max(kakunin))
    for j in range(1, p + 1):
        if a[i] % j == 0:
            spl[i].append(j)
            if  j != a[i] // j and j != 1:
                spl[i].append(a[i] // j)
for i in range(n):
    if any(spl[i][j] in a for j in range(len(spl[i]))):
        pass
    else:
        ans += 1
        check[i] = 1
for i in range(n):
    list = a
    if check[i] == 1 and a.count(a[i]) > 1:
        ans -= 1
print(ans)

        
            

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
amax = max(a)
ans = 0
numlist = [0] * amax

for i in range(n):
    if numlist[a[i]-1] != 0:
        numlist[a[i]-1] = 2
        continue
    else:
        for j in range(1, amax // a[i] + 1):
            numlist[a[i] * j - 1] += 1
for i in range(n):
    if numlist[a[i]-1] == 1:
        ans += 1
        
print(ans)
import numpy as np

n = int(input())
x,y = np.array([list(map(int,input().split())) for _ in range(n)]).T


# 内積が0以上かを判定する
def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0 : return 1
    else: return 0

ans = []
for i in range(n):
    v1 = np.array([y[i], - x[i]]) # 法線ベクトル
    if i < n-1 : v2 = np.array([(y[i]+y[i+1])/2, (x[i]+x[i+1])/2])
    else: v2 = v1
    total1,total2 = np.array([0, 0]), np.array([0, 0])
    tmp1,tmp2,v3 = [],[],[]
    for j in range(n):
        v3.append(np.array([x[j], y[j]]))
        if isin90deg(v1, v3[j]): total1 += v3[j] ; tmp1.append(j)
        if isin90deg(v2, v3[j]): total2 += v3[j] ; tmp2.append(j)
    start1, end1 = min(tmp1), max(tmp1)
    start2, end2 = min(tmp2), max(tmp2)
    ans.append(np.linalg.norm(total1, ord=2)) # ord2でユークリッド距離
    ans.append(np.linalg.norm(total1 - v3[start1], ord=2))
    ans.append(np.linalg.norm(total1 - v3[end1], ord=2))
    ans.append(np.linalg.norm(total2, ord=2))
    ans.append(np.linalg.norm(total2 - v3[start2], ord=2))
    ans.append(np.linalg.norm(total2 - v3[end2], ord=2))

print(max(ans))



### FIXED CODE ###

import numpy as np

n = int(input())
x,y = np.array([list(map(int,input().split())) for _ in range(n)]).T

# 内積が0以上かどうか
def isin90deg(v1, v2):
    if np.dot(v1, v2) >= 0 : return 1
    else: return 0

# 内積が0かどうか
def is90deg(v1, v2):
    if np.dot(v1, v2) == 0 : return 1
    else: return 0

ans = []
for i in range(n):
    # tangent-vector, normal-vector
    tv, nv1 = np.array([x[i],y[i]]), np.array([y[i],-x[i]])
    nv2 = - nv1
    # tvから時計回り180度エリアにおけるベクトル和を考える
    # ただし、tvに平行なベクトル群（posi/nega）だけ例外処理
    for nv in [nv1, nv2]:
        sum,posi,nega = np.array([0,0]), np.array([0,0]), np.array([0,0])
        for j in range(n):
            v = np.array([x[j],y[j]])
            if isin90deg(v,nv): sum += v
            if is90deg(v,nv) and isin90deg(v,tv): posi += v
            if is90deg(v,nv) and not isin90deg(v,tv): nega += v
        # ユークリッド距離
        ans.append(np.linalg.norm(sum, ord=2))
        ans.append(np.linalg.norm(sum - posi, ord=2))
        ans.append(np.linalg.norm(sum - nega, ord=2))

print(max(ans))
N, K = map(int, input().split())
X = list(map(int, input().split()))

x_minus = [a for a in X if a < 0]
x_plus = [a for a in X if a >= 0]

ans = float("inf")
for i in range(K+1):
    if i == 0:
        if len(x_plus) >= K:
            dis = x_plus[K - 1]
            ans = min(ans, dis)
        else:
            continue
    if i != 0:
        if len(x_minus) > i and len(x_plus) >= K - i:
            dis = 2 * abs(x_minus[-i]) + x_plus[K - i - 1]
            ans = min(ans, dis)
        else:
            continue


print(ans)


### FIXED CODE ###

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

x_minus = [a for a in X if a < 0]
x_plus = [a for a in X if a >= 0]

ans = float("inf")
for i in range(K+1):
    if i == 0:
        if len(x_plus) >= K:
            dis = x_plus[K - 1]
            ans = min(ans, dis)
        else:
            continue
    elif 1 <= i <= K - 1:
        if len(x_minus) >= i and len(x_plus) >= K - i:
            dis = 2 * abs(x_minus[-i]) + x_plus[K - i - 1]
            ans = min(ans, dis)
            dis = 2 * x_plus[K - i - 1] + abs(x_minus[-i])
            ans = min(ans, dis)
        else:
            continue
    elif i == K:
        if len(x_minus) >= K:
            dis = abs(x_minus[-K])
            ans = min(ans, dis)


print(ans)