Harryxun/stf_run huggingface dataset:
A,B = input().split(" ")

def compare(A,B):
    if A == B:
        return 'EQUAL'
    if len(A) > len(B):
        return 'GREATER'
    if len(B) > len(A):
        return 'LESS'
    for i in range(len(A)):
        a = int(A[i])
        b = int(B[i])
        if a > b:
            return 'GREATER'
        if b > a:
            return 'LESS'

print(compare(A,B))

### FIXED CODE ###

A = input()
B = input()

def compare(A,B):
    if A == B:
        return 'EQUAL'
    if len(A) > len(B):
        return 'GREATER'
    if len(B) > len(A):
        return 'LESS'
    for i in range(len(A)):
        a = int(A[i])
        b = int(B[i])
        if a > b:
            return 'GREATER'
        if b > a:
            return 'LESS'

print(compare(A,B))
print input

### FIXED CODE ###

a = input()
print(a[0:3])
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(1+n)]
v=[0]*(1+n)
for i in range(m):
    if i==1:
        q=[a,b]
        v[a]=v[b]=1
    a,b=map(int,input().split())
    g[a].append(b)
    g[b].append(a)

p=deque(q[-1:])
path=[]
while p:
    cur=p.pop()
    path.append(cur)
    v[cur]=1
    flg=True
    for i in g[cur]:
        if v[i]==0:
            p.append(i)
            flg=False
    if flg:
        break
ans=path

p=deque(q[0:1])
path=[]
while p:
    cur=p.pop()
    path.append(cur)
    v[cur]=1
    flg=True
    for i in g[cur]:
        if v[i]==0:
            p.append(i)
            flg=False
    if flg:
        break
ans=path[::-1]+ans
print(len(ans))
print(*ans)

### FIXED CODE ###

from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(1+n)]
v=[0]*(1+n)
for i in range(m):
    a,b=map(int,input().split())
    g[a].append(b)
    g[b].append(a)
    if i==0:
        q=[a,b]
        v[a]=v[b]=1

p=[q[-1]]
path=[]
while p:
    cur=p.pop()
    path.append(cur)
    v[cur]=1
    flg=True
    for i in g[cur]:
        if v[i]==0:
            p.append(i)
            flg=False
    if flg:
        break
ans=path

p=[q[0]]
path=[]
while p:
    cur=p.pop()
    path.append(cur)
    v[cur]=1
    flg=True
    for i in g[cur]:
        if v[i]==0:
            p.append(i)
            flg=False
    if flg:
        break
ans=path[::-1]+ans
print(len(ans))
print(*ans)
import sys
a, b = map(int, input().split())
if a != 0 and a%3 = 0:
	print("Possible")
    sys.exit()
if b != 0 and b%3 = 0:
	print("Possible")
    sys.exit()
if a != 0 and b != 0 and (a+b)%3:
	print("Possible")
    sys.exit()

print("Impossible")


### FIXED CODE ###

import sys
a, b = map(int, input().split())
if a != 0 and a%3 == 0:
	print("Possible")
	sys.exit()
if b != 0 and b%3 == 0:
	print("Possible")
	sys.exit()
if a != 0 and b != 0 and (a+b)%3 == 0:
	print("Possible")
	sys.exit()

print("Impossible")
n, K = map(int, input().split())

mo = 10 ** 10 + 7
ret = 1
E = [[] for _ in range(n)]
def dfs(cur, pre, cand):
    global ret
    ret = ret * cand % mo
    cand = K - 1 - (pre != -1)
    for e in E[cur]:
        if e != pre:
            dfs(e, cur, cand)
            cand -= 1

for _ in range(n-1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

dfs(0, -1, K)
print(ret)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10**9)

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

mo = 1000000007
ret = 1
E = [[] for _ in range(n)]

def dfs(cur, pre, cand):
    global ret
    ret = (ret % mo * (cand % mo)) % mo
    k = 0
    if pre != -1:
        k = 1
    cand = K - 1 - k
    for e in E[cur]:
        if e != pre:
            dfs(e, cur, cand)
            cand -= 1

for _ in range(n-1):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

dfs(0, -1, K)
print(ret % mo)
d={}
d[a]=list(input())
d[b]=list(input())
d[c]=list(input())
now='a'
while True:
  if d[now]>1:
    now=d[now].pop(0)
  else:
    print(now.upper())
    exit()

### FIXED CODE ###

d={}
d['a']=list(input())
d['b']=list(input())
d['c']=list(input())
now='a'
while True:
  if len(d[now])>0:
    now=d[now].pop(0)
  else:
    print(now.upper())
    exit()
import sys
def input(): return sys.stdin.readline().rstrip()


from collections import deque
h, w = map(int, input().split())
a, b = map(int, input().split())
c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = [list(input()) for i in range(h)]
now = 0
dd = [(-1, 0), (1, 0), (0, 1), (0, -1)]

for i in range(h):
    for j in range(w):
        if s[i][j] == ".":
            de = deque([(i, j)])
            s[i][j] = now
            while de:
                x, y = de.popleft()
                for p, q in dd:
                    if 0 <= x + p < h and 0 <= y + q < w and s[x + p][y + q] == ".":
                        s[x + p][y + q] = now
                        de.append((x + p, y + q))
            now += 1
st = s[a][b]
en = s[c][d]
es = [set() for i in range(now)]
for i in range(h):
    for j in range(w):
        if s[i][j] != "#":
            for p in range(-2, 3):
                for q in range(-2, 3):
                    if 0 <= i + p < h and 0 <= j + q < w and s[i + p][j + q] != "#":
                        es[s[i][j]].add(s[i + p][j + q])
                        es[s[i + p][j + q]].add(s[i][j])
from heapq import heappush, heapify, heappop


def dijkstra(s):
    INF = 1 << 32
    d = [INF] * now  # 頂点sからの最短距離
    v = -1
    que = [(0, s)]
    heapify(que)
    d[s] = 0
    while que:
        p = heappop(que)
        v = p[1]
        if d[v] < p[0]:
            continue
        for e in es[v]:
            if d[e] > d[v] + 1:
                d[e] = d[v] + 1
                heappush(que, (d[e], e))
    return d[en] if d[en] < INF else -1


print(dijkstra(st))


### FIXED CODE ###

import sys
input = sys.stdin.readline
h, w, m = map(int, input().split())
a = [0] * h
b = [0] * w
H, W = [0] * m, [0] * m
for i in range(m):
    H[i], W[i] = map(int, input().split())
    H[i] -= 1
    W[i] -= 1
    a[H[i]] += 1
    b[W[i]] += 1
a1 = max(a)
a2 = max(b)
s = sum(i == a1 for i in a)
t = sum(i == a2 for i in b)
ans = 0
for i in range(m):
    if a[H[i]] == a1 and b[W[i]] == a2:
        ans += 1
print(a1 + a2 - 1 if ans == s * t else a1 + a2)
n, a, b = map(int, input())
print(min(n * a, b))

### FIXED CODE ###

n, a, b = map(int, input().split())
print(min(n * a, b))
X, N = map(int,input().split())
if N == 0:
    print(X)
    exit()
else:
    P = list(map(int,input().split()))
L = [i for i in range(1,100) if i not in P]


if X in L:
    ANS = X
else:
    L.append(X)
    L = sorted(L)
    n = L.index(X)
    l = len(L)

    if (0 < n < l):
        if (L[n+1]-L[n] < L[n] - L[n-1]):
            ANS = L[n+1]
        else:
            ANS = L[n - 1]
    elif (n == 0):
        ANS = L[1]
    elif (n == l):
        ANS = L[l - 1]

print(ANS)

### FIXED CODE ###

X, N = map(int,input().split())
if N == 0:
    print(X)
    exit()
else:
    P = list(map(int,input().split()))
L = [i for i in range(0,102) if i not in P]

if X in L:
    ANS = X
else:
    L.append(X)
    L = sorted(L)
    n = L.index(X)
    l = len(L) - 1


    if (0 < n < l):
        if (L[n+1]-L[n] < L[n] - L[n-1]):
            ANS = L[n+1]
        else:
            ANS = L[n - 1]
    elif (n == l):
        ANS = L[l - 1]

print(ANS)
a,b = map(int.input().split())
for i in range(b-a+1,b+a):
  print(i,end=' ')

### FIXED CODE ###

a,b = map(int,input().split())
for i in range(b-a+1,b+a):
  print(i)
n,k=map(int,input().split())
a=list(map(int,input().split()))
dp=[0]*(k+1+1234)

for i in range(0,k+1):
    if dp[i] == 0:
        for x in a:
            dp[i+x] =1

print("First" if dp[k] else "Second")

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
ans = [False]*(k+1)
for i in range(1,k+1):
    ok = False
    for j in a:
        if i-j<0:
            continue
        if ans[i-j] == False:
            ans[i] = True
            break

print('First' if ans[k] else 'Second')
def parse(l):
    name, time = l.split()
    return name, int(time)


n, quantum = map(int, input().split())
queue = list(parse(input()) for _ in range(n))
head, tail = 0, len(queue)


def enqueue(x):
    global queue, tail
    queue.append(0)
    queue[tail] = x
    tail += 1


def dequeue():
    global head
    head += 1


for i in range(n):
    int(queue[i][1])

total_time, count = 0, 0
while count < n:
    y = queue[head][1] - quantum
    if y < 0:
        print(str(queue[head][0]) + " " + str(total_time + queue[head][1]))
        dequeue()
        total_time += y
        count += 1
    else:
        queue[head][1] -= quantum
        enqueue(queue[head])
        dequeue()

    total_time += quantum



### FIXED CODE ###

def parse(l):
    name, time = l.split()
    a = [name, int(time)]
    return a


n, quantum = map(int, input().split())
queue = []
for i in range(n):
    queue.append(parse(input()))
head = 0


def enqueue(x):
    global queue
    queue.append(x)


def dequeue():
    global head
    head += 1


total_time, count = 0, 0
while count < n:
    y = queue[head][1] - quantum
    if y <= 0:
        print(str(queue[head][0]) + " " + str(total_time + queue[head][1]))
        dequeue()
        total_time += y
        count += 1
    else:
        queue[head][1] -= quantum
        enqueue(queue[head])
        dequeue()

    total_time += quantum
N = int(input())
X = list(map(int,input().split()))
Y = sorted([(x-1,i+1) for i,x in enumerate(X)])

ans = [None] * (N*N)
must = []
for i,n in Y:
    ans[i] = n
    must += [n]*(n-1)
must.reverse()

used = [0] * (N+1)
free = [1]
for i in range(N*N):
    if ans[i]:
        a = ans[i]
        if used[a] != a-1:
            print('No')
            exit()
        free += [a]*(N-a)
    elif must:
        a = must.pop()
        ans[i] = a
    else:
        if free:
            a = free.pop()
            ans[i] = a
        else:
            print('No')
            exit()
    used[ans[i]] += 1

for i in range(1,N+1):
    assert used[i] == N

print('Yes')
print(*ans)

### FIXED CODE ###

N = int(input())
X = list(map(int,input().split()))
Y = sorted([(x-1,i+1) for i,x in enumerate(X)])

ans = [None] * (N*N)
must = []
for i,n in Y:
    ans[i] = n
    must += [n]*(n-1)
must.reverse()

used = [0] * (N+1)
free = [1]
for i in range(N*N):
    if ans[i]:
        a = ans[i]
        if used[a] != a-1:
            print('No')
            exit()
        free += [a]*(N-a)
    elif must:
        a = must.pop()
        ans[i] = a
    else:
        if free:
            a = free.pop()
            ans[i] = a
        else:
            print('No')
            exit()
    used[ans[i]] += 1

for i in range(1,N+1):
    if used[i] != N:
        print('No')
        exit()

print('Yes')
print(*ans)
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans, kurikosi = 0, 0
for i in range(n+1):
    if a[i]<=kurikosi:
        ans += a[i]
        kurikosi = b[i]
    elif kurikosi < a[i] <= kurikosi+b[i]:
        ans += a[i]
        kurikosi = kurikosi+b[i] - a[i]
    else:
        ans += a[i] - (kurikosi+b[i])
        kurikosi = 0

print(ans)

### FIXED CODE ###

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

ans, kurikosi = 0, 0
for i in range(n+1):
    if i != n:
        ans += min(a[i], kurikosi+b[i])
        if a[i]<=kurikosi:
            kurikosi = b[i]
        elif kurikosi < a[i] <= kurikosi+b[i]:
            kurikosi = kurikosi+b[i] - a[i]
        else:
            kurikosi = 0
    else:
        ans += min(kurikosi, a[i])

print(ans)
import output
N = int(input())
A = [int(n) for n in input().split()]
output.print_1(A)
for i in range(1, N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    output.print_1(A)

### FIXED CODE ###

def print_1(array):
    for i in range(len(array)):
        if i == len(array) - 1:
            print(array[i])
        else:
            print(array[i], end=" ")

N = int(input())
A = [int(n) for n in input().split()]
print_1(A)
for i in range(1, N):
    v = A[i]
    j = i - 1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print_1(A)
import numpy as np

N = input()
# N = int(input())
# t = np.array(list(map(int, input().split())))
t = map(int, raw_input().split())

odd = t[0::2]
even = t[1::2]

rest = 0
aa = np.unique(odd, return_counts=True)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
from collections import Counter
N = input()
t = np.array(map(int, raw_input().split()))

odd = t[0::2]
even = t[1::2]
rest = 0

co = Counter(odd)
ce = Counter(even)

omc = co.most_common()
emc = ce.most_common()

if omc[0][0] == emc[0][0]:
    if len(omc) < 2 and len(emc) < 2:       # same
        rest = len(even)
    elif len(omc) < 2:
        rest = len(even)
    elif len(emc) < 2:
        rest = len(odd)
    else:
        or1 = len(odd) - co.most_common()[0][1]
        or2 = len(odd) - co.most_common()[1][1]
        er1 = len(even) - ce.most_common()[0][1]
        er2 = len(even) - ce.most_common()[1][1]

        if or1 + er2 > or2 + er1:
            rest = or2 + er1
        else:
            rest = or1 + er2
else:
    rest = len(odd) - co.most_common()[0][1] + len(even) - ce.most_common()[0][1]


print rest
n = int(input())

p = [None]*n

for i in range(n):
    p[i] = list(map(int,input().split()))

plan = [[0,0,0]]
plan.extend(p)

print('plan')
print(plan)

for i in range(n+1):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    print(diff)
    if abs(diff[1])+abs(diff[2])>diff[0]:
        print('No')
        break
    elif (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        break
    elif i==n-1:
        print('YES')

### FIXED CODE ###

n = int(input())

p = [None]*n

for i in range(n):
    p[i] = list(map(int,input().split()))

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        exit()

print('Yes')
s = str(input())
alphabet = ["a","b","c","d","e","f"
,"g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z"]

for i in s:
    if i in alphabet:
        alphabet.remove(i)
if len(alphabet)!=:
    print(alphabet[0])
else:
    print("Nome")
 


    

### FIXED CODE ###

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

if abs(x-a) < abs(x-b):
    print("A")
else:
    print("B")
s = str(input())
t = str(input())

count = 0

for i in range s:
  if s[i] != t[i]
  count += 1
  
print(count)

### FIXED CODE ###

s = str(input())
t = str(input())

sl = len(s)

count = 0

for i in range(0,sl):
  if s[i] != t[i]:
      count += 1

print(count)
#12:10
n,k = map(int,input().split())
v = list(map(int,input().split()))
can = []
for i in range(n):
  if i == 0:
    a = []
  elif i <= k:
    a.append(v[i-1])
  for j in range(n):
    if j == 0:
      b = []
    elif i + j <= n and i + j <= k:
      b.append(v[-j])
    rest = min(k-i-j,i+j)
    c = a + b
    c.sort()
    tmp = sum(c)
    for de in range(rest):
      if c[de] < 0:
        tmp -= c[de]
    can.append(tmp)
    #print(i,j,a,b,tmp)
print(max(can))

### FIXED CODE ###

#17:09
n,k = map(int,input().split())
v = list(map(int,input().split()))
'''
左からa個
右からb個
k-a-b個以内捨てて良し
'''
can = []
nk = min(n,k)
for a in range(nk+1):
  if a != 0:
    x.append(v[a-1])
  else:
    x = []
  for b in range(nk+1-a):
    if b != 0:
      y.append(v[-b])
    else:
      y = []
    z = x + y
    z.sort()
    r = k - a - b
    tmp = 0
    if r < a+b:
      if z[r] < 0:
        for i in range(r,a+b):
          tmp += z[i]
      else:
        for i in range(a+b):
          if z[i] >= 0:
            tmp += z[i]
    else:
      for i in range(a+b):
        if z[i] >= 0:
          tmp += z[i]
    can.append(tmp)
print(max(can))
k,s=map(int, input().split())
x+y+z=s
count=0
for x in range(k+1):
	for y in range(k+1):
    	for z in range(z+1):
        	if x+y+z=s:
            count+=1
print(count)

### FIXED CODE ###

k,s=map(int,input().split())
count=0
z=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if(0<=z)&(z<=k):
            count+=1
            
print(count)
def next_pos(D,L):
    return D+L
    
N, X = map(int,input().split(" "))
L = [int(i) for i in input().split(" ")]
D = 0
count = 0
i = 0

while(D<=X or i<N):
    D = next_pos(D,L[i])
    count+=1
    i+=1
    
print(count)

### FIXED CODE ###

N, X = map(int,input().split(" "))
L = [int(i) for i in input().split(" ")]
D = 0
count = 1
for i in range(N):
    D+=L[i]
    if D<=X:
        count+=1
    
print(count)
import math
n = int(input())
A = sorted(list(map(int, input().split())))

m_combo = 0
ai = 0
aj = 0

for i in range(n):
  a = A[i]
  val = bin_search(list[:i])
  combo = cal(a, val)
  if combo > m_combo:
    m_combo = combo
    ai = a
    aj = val

print('{} {}'.format(ai, aj))
  
def cal(n ,r):
  if n == r:
    return 1
  return math.factorial(n)/math.factorial(r) * math.factorial(n-r)

def bin_search(list, val):
  cnt = list.cnt
  mid = round(cnt/2)
  if cnt == 1:
    return val
  if list[mid] > val:
    bin_search(list[:mid], val)
  if list[mid] < val:
    bin_search(list[mid:], val)
  if list[mid] == val:
    return val

### FIXED CODE ###

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

ai = max(A)
A.remove(ai)

Asub = [abs(ai/2 -a) for a in A]
aj = A[Asub.index(min(Asub))]

print('{} {}'.format(ai, aj))
N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9+7

memo=[0]*(N+2)
def comb(x, y):
    if x == N-1 and dp[y] > 0:
        return memo[y]
    elif y > x:
        return 0
    elif y * 2 > x:
        y = x - y
    result = 1
    for j in range(1, y + 1):
        result *= (x + j - y) * pow(j, mod - 2, mod)
        result %= mod
    if x == N-1:
        memo[y] = result
    return result


dupl = sum(A)-N*(N+1)//2
ds = []
for _ in range(N+1):
    if A[_] == dupl:
        ds += [_]
i, j = ds

print(N)
for k in range(2, N+2):
    print((comb(N-1, k)+comb(N-1, k-2)+2*comb(N-1, k-1)-comb(N-j+i, k-1)) % mod)


### FIXED CODE ###

N = int(input())
A = [int(_) for _ in input().split()]
mod = 10**9 + 7

f = [1] * (N + 2)
fi = [1] * (N + 2)
for i in range(2, N + 2):
    f[i] = i * f[i - 1]
    f[i] %= mod
for i in range(2, N + 2):
    fi[i] = fi[i - 1] * pow(i, mod - 2, mod)
    fi[i] %= mod


def comb(n, r):
    if 0 <= n and 0 <= r and 0 <= n - r:
        return (f[n] * fi[r] * fi[n - r]) % mod
    else:
        return 0


b = set()
for a in A:
    if a in b:
        break
    b.add(a)
c = []
for i in range(N + 1):
    if A[i] == a:
        c += [i]
i, j = c
for x in range(1, N + 2):
    print((comb(N + 1, x) - (comb(N - j + i, x - 1))) % mod)
import math
a,b,c,d=map(int,input().split())
e=c//math.gcd(c,d)*d
print(b-b//c-b//d+b//e-(a-1-(a-1)//c-(a-1)//d+(a-1)//e))

### FIXED CODE ###

def ABC162C(a,b):#from:https://atcoder.jp/contests/abc162/submissions/11871774
    while b != 0:
        a %= b
        if a == 0:break
        b %= a
    return max(a,b)
    

a,b,c,d=map(int,input().split())
e=c//ABC162C(c,d)*d
print(b-b//c-b//d+b//e-(a-1-(a-1)//c-(a-1)//d+(a-1)//e))
N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3

def search_max(sorted_coord_list, M, key):
    len_list = len(sorted_coord_list)
    if M == len_list:
        total_x, total_y, total_z = 0, 0, 0
        for x, y, z in sorted_coord_list:
            total_x += x
            total_y += y
            total_z += z
        total = abs(total_x) + abs(total_y) + abs(total_z)
        return total
    elif M == 1:
        x, y, z = sorted_coord_list[0]
        total = abs(x) + abs(y) + abs(z)
        return total
        
    else:
        if sorted_coord_list[M - 1][key] == sorted_coord_list[M][key]:
            considering_val = coord_list[M - 1][key]
            current_idx = M - 1
            candidate_list = list()
            while coord_list[current_idx][key] == considering_val:
                candidate_list.append(sorted_coord_list[current_idx])
                current_idx += 1
            total_x, total_y, total_z = 0, 0, 0
            for x, y, z in sorted_coord_list[:M-1]:
                total_x += x
                total_y += y
                total_z += z

            max_total = 0
            for x, y, z in candidate_list:
                total = abs(total_x + x) + abs(total_y + y) + abs(total_z + z)
                max_total = max(max_total, total)
            return max_total
    
        else:
            total_x, total_y, total_z = 0, 0, 0
        for x, y, z in sorted_coord_list[:M]:
            total_x += x
            total_y += y
            total_z += z
        total = abs(total_x) + abs(total_y) + abs(total_z)
        return total


max_candidates = [0] * 6
for i in range(3):
    # sort coord_list: O(NlogN)
    sorted_coord_list = sorted(coord_list, key=lambda x: x[i])
    max_candidates[2 * i] = search_max(sorted_coord_list, M, i)
    max_candidates[2 * i + 1] = search_max(sorted_coord_list[::-1], M, i)

print(max(max_candidates))


### FIXED CODE ###

from itertools import product

N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3

max_total = 0
for f_x, f_y, f_z in product([-1, 1], repeat=3):
    sum_list = [(f_x * x + f_y * y + f_z * z, i) for i, (x, y, z) in enumerate(coord_list)]
    # sort with index
    sum_list = sorted(sum_list, key=lambda x: x[0])[::-1]
    total_x, total_y, total_z = 0, 0, 0
    for _, idx in sum_list[:M]:
        total_x += coord_list[idx][0]
        total_y += coord_list[idx][1]
        total_z += coord_list[idx][2]
    total = abs(total_x) + abs(total_y) + abs(total_z)
    max_total = max(total, max_total)

print(max_total)
import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2

while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for i in range(n-1,-1,-1):
    while p<n and a[i]+a[p]<=md:
        p+=1
    if p==n: break
    cnt+=n-p
    ans+=a[i]*(n-p)*2



try:
    ans+=(m-cnt)*md
    print(ans)
except:
    print(0)

### FIXED CODE ###

import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

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

l,r=a[0]*2,a[n-1]*2
md=(r+l)//2
while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n and a[q]+a[p]<=md:
            p+=1
    except:
        b=1
        while True:
            b+=1

    if p==n: break
    cnt+=n-p
    ans+=a[q]*(n-p)*2


ans+=(m-cnt)*md
print(ans)
L = map(int,input().split())
print((L/3)**3)

### FIXED CODE ###

L = (int(input()))
print((L/3)**3)
a, b = [int(i) for i in input().split()]
area = a * b
perimeter =  2 * (a + b)
print(area + " " + perimeter)

### FIXED CODE ###

a, b = [int(i) for i in input().split()]
area = a * b
perimeter = 2 * (a + b)
print(area, perimeter, sep=" ")
#input an interget
K=int(input())
#input an string
S=str(input())
#get the length of the string
x=int(len(str1))
#get the difference in length between k and s
i=x-k

#make a second string for the appending
S2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if i==0:
    print(S)
#if not, delete the last character of the string
else:
    while i>0:
        S=S[i]
        i+=1
#and then join the two strings together
    newstr="".join((S,S2))
    print(newstr)


### FIXED CODE ###

num=int(input()) #ask integer for limitation
s=input() #ask string
if len(s) > num:    #check if the length s exceeded num
    print(s[:num] + "...")  #print s with the limit "num"
else:   #if the string not exceeded num
    print(s)