Harryxun/stf_run huggingface dataset:
"""
    Author : thekushalghosh
    Team   : CodeDiggers
"""
import sys,math,cmath,time
start_time = time.time()
################# ---- USER DEFINED INPUT FUNCTIONS ---- #################
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().split()))
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n = inp()
    c = 0
    for i in range(1,201):
        for j in range(1,201):
            for k in range(1,201):
                c = c + math.gcd(math.gcd(a,b),c)
    print(c)
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
ONLINE_JUDGE = __debug__
if not ONLINE_JUDGE:
    sys.stdin = open('input.txt','r')
    sys.stdout = open('output.txt','w')
else:
    input = sys.stdin.readline
t = 1
t = inp()
for tt in range(t):
    solve()
if not ONLINE_JUDGE:
    print("Time Elapsed:",time.time() - start_time,"seconds")
sys.stdout.close()


### FIXED CODE ###

"""
    Author : thekushalghosh
    Team   : CodeDiggers
"""
import sys,math,cmath,time
start_time = time.time()
################# ---- USER DEFINED INPUT FUNCTIONS ---- #################
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().split()))
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n = inp()
    c = 0
    for i in range(1,n + 1):
        for j in range(1,n + 1):
            for k in range(1,n + 1):
                c = c + math.gcd(math.gcd(i,j),k)
    print(c)
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
ONLINE_JUDGE = __debug__
if not ONLINE_JUDGE:
    sys.stdin = open('input.txt','r')
    sys.stdout = open('output.txt','w')
else:
    input = sys.stdin.readline
t = 1
for tt in range(t):
    solve()
if not ONLINE_JUDGE:
    print("Time Elapsed:",time.time() - start_time,"seconds")
sys.stdout.close()
a,b,q=map(int, input().split())

s=[-2*10**10]+[int(input()) for _ in range(a)]+[2*10**10]
t=[-2*10**10]+[int(input()) for _ in range(b)]+[2*10**10]
x=[int(input()) for _ in range(q)]

for i in range(q):
  j = bisect.bisect_left(s,x[i])
  al = x[i] - s[j-1]
  ar = s[j] - x[i]
  j = bisect.bisect_left(t,x[i])
  bl = x[i] - t[j-1]
  br = t[j] - x[i]
  l = min(max(al, bl), max(ar, br), 2*al+br, 2*ar+bl, 2*bl+ar, 2*br+al)
  print(l)


### FIXED CODE ###

import bisect

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

s=[-2*10**10]+[int(input()) for _ in range(a)]+[2*10**10]
t=[-2*10**10]+[int(input()) for _ in range(b)]+[2*10**10]
x=[int(input()) for _ in range(q)]

for i in range(q):
  j = bisect.bisect_left(s,x[i])
  al = x[i] - s[j-1]
  ar = s[j] - x[i]
  j = bisect.bisect_left(t,x[i])
  bl = x[i] - t[j-1]
  br = t[j] - x[i]
  l = min(max(al, bl), max(ar, br), 2*al+br, 2*ar+bl, 2*bl+ar, 2*br+al)
  print(l)
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = input()
print(arr[int(n)])

### FIXED CODE ###

arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = input()
print(arr[int(n)-1])
n = int(input())
s = input()

k = 0

for i in i <= n-3:
	if s[i]=A and s[i+1]=B and s[i+2]=C:
		k += 1
        
print(k)

### FIXED CODE ###

n = int(input())
s = input()

k = 0

for i in range(n-2):
	if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
		k += 1
        
print(k)
from collections import defaultdict
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

pc_memo = defaultdict(int)
memo = defaultdict(int)


def to_next(x):
    if x not in pc_memo.keys():
        pc_memo[x] = x % "{:b}".format(x).count('1')
    return pc_memo[x]


def f(x):
    if x == 0:
        return 0
    if x not in memo.keys():
        memo[x] = f(to_next(x))+1
    return memo[x]


for i in range(2*10**5):
    f(i)

n = int(input())
x = input()
one_cnt = x.count('1')

mod_minus = 0
mod_plus = 0
for i, a in enumerate(reversed(x)):
    if a == '1':
        mod_minus += pow(2, i, one_cnt-1)
        mod_minus %= one_cnt-1
        mod_plus += pow(2, i, one_cnt+1)
        mod_plus %= one_cnt+1


for i in range(n):
    if x[i] == '0':
        nx = mod_plus+pow(2, n-i-1, one_cnt+1)
        nx %= one_cnt+1
        print(f(nx)+1)
    else:
        nx = mod_minus-pow(2, n-i-1, one_cnt-1)
        nx %= one_cnt-1
        print(f(nx)+1)


### FIXED CODE ###

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

pc_memo = defaultdict(int)
memo = defaultdict(int)


def to_next(x):
    if x not in pc_memo.keys():
        pc_memo[x] = x % "{:b}".format(x).count('1')
    return pc_memo[x]


def f(x):
    if x == 0:
        return 0
    if x not in memo.keys():
        memo[x] = f(to_next(x))+1
    return memo[x]


for i in range(2*10**5):
    f(i)

n = int(input())
x = input().rstrip()
one_cnt = x.count('1')

mod_minus = 0
mod_plus = 0
for i, a in enumerate(reversed(x)):
    if a == '1':
        if 0 < one_cnt-1:
            mod_minus += pow(2, i, one_cnt-1)
            mod_minus %= one_cnt-1
        mod_plus += pow(2, i, one_cnt+1)
        mod_plus %= one_cnt+1


for i in range(n):
    if x[i] == '0':
        nx = mod_plus+pow(2, n-i-1, one_cnt+1)
        nx %= one_cnt+1
        print(f(nx)+1)
    else:
        if 0 < one_cnt-1:
            nx = mod_minus-pow(2, n-i-1, one_cnt-1)
            nx %= one_cnt-1
            print(f(nx)+1)
        else:
            print(0)
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    s = read_str()
    if s[0] == 'Y' and s[1] == 'A' and s[2] == 'K' and s[3] == 'I':
        print('Yes')
    else:
        print('No')


main()


### FIXED CODE ###

import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('a1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    s = read_str()
    if s[0:4] == 'YAKI':
        print('Yes')
    else:
        print('No')


main()
import math


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


def main():
	a,b = map(int, input().split())
	num = math.gcd(a,b)
	if num == 1:
		print(1)
		exit()
	result_list = factorize(num)
	print(len(set(result_list)) + 1)			
	


if __name__ == "__main__":
	main()


### FIXED CODE ###

from fractions import gcd
import math
a,b = map(int,input().split())
n = gcd(a,b)
if n == 1:
    print(1)
    exit()
count = 1
for i in range(2,math.ceil(math.sqrt(n))+1):
    if n % i == 0:
        count += 1
        while n % i == 0:
            n //= i
if n > 1:
    count += 1
print(count)
from math import pi
r=float(inport()???
print("{0:.5f} {1:.5f}".format(pi*r*r,2*pi*r)

### FIXED CODE ###

from math import pi
r=float(input())
print("{0:.5f} {1:.5f}".format(pi*r*r, 2*pi*r))
import sys
import numpy as np

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def MAP(): return [int(s) for s in input().split()]

n = int(input())
if n==1:
	print(0)
	sys.exit()

N = list(range(1,n))
print(np.cumsum(N)[-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N = INT()
	M = N-1
	ans = (1+M)*M//2
	print(ans)

if __name__ == '__main__':
	main()
# CODE FESTIVAL 2017 予選 A: A – Snuke's favorite YAKINIKU
s = input()
print('Yes' if len(s) >= 4 and s.index('YAKI') == 0 else 'No')

### FIXED CODE ###

# CODE FESTIVAL 2017 予選 A: A – Snuke's favorite YAKINIKU
s = input()
print('Yes' if s[:4] == 'YAKI' else 'No')
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
#dt = {k:v for k,v in sorted(x.items(), key=lambda i: i[1])}
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
mp = lambda :map(int,input().split())

from bisect import bisect_left as bs
dt = {}
x = []
for i in range(200):
    dt[i**5] = i
    x.append(i**5)
n = inp()
if n in dt:
    print(dt[n],0)
    exit()
i = bs(x,n)
a = x[i]
b = a - n
if b in dt:
    print(dt[a],dt[b])
else:
    a = x[i-1]
    b = n - a
    print(dt[a],-dt[b])



    

### FIXED CODE ###

#dt = {} for i in x: dt[i] = dt.get(i,0)+1
#dt = {k:v for k,v in sorted(x.items(), key=lambda i: i[1])}
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
mp = lambda :map(int,input().split())

dt = {}
x = []
for i in range(300):
    dt[i**5] = i
    x.append(i**5)
num = inp()
if num in dt:
    print(dt[num],0)
    exit()
n = len(x)
for i in range(n-1):
    for j in range(i+1,n):
        if x[i] + x[j] == num:
            print(dt[x[i]],-dt[x[j]])
            exit()
        elif x[j] - x[i] == num:
            print(dt[x[j]],dt[x[i]])
z = input()
a = list(map(int, z.split()))
print("{} {} {}"format(a[0] // a[1], a[0] % a[1], a[0] / a[1]))

### FIXED CODE ###

z = input()
a = list(map(int, z.split()))
print("{} {} {:.5f}".format(a[0] // a[1], a[0] % a[1], a[0] / a[1]))
import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)
#    if (x + (1 if y == 1 else -1) * T)%L == 52648:
#        print(x, y)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1

if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree <= 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree <= 0:
            max_i = i + 1
            break
    else:
        max_i = counter

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )
print(rep)


candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    if ree == 0:
        1/0
#    candidates[(start + j) % N + 1]
    print(candidates[(start + j) % N])


### FIXED CODE ###


import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1

if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree <= 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree <= 0:
            max_i = i + 1
            break
    else:
        max_i = counter

if ree == 0 and y0 == 2:
    max_i += 1

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )


candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    print(candidates[(start + j) % N])
a, b = int(input())

if(a > b);
    print('a > b')

if(a < b);
    print('a < b')

if(a == b);
    print('a == b')



### FIXED CODE ###

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

if a > b:
    print('a > b')
elif a < b:
    print('a < b')
else:
    print('a == b')
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
ans=[[] for i in range(k)]
for i in range(n):
    ans[i%k]+=[t[i]]
cnt=0
#print(ans)
for i in range(k):
    if ans[i][0]=="r":
        cnt+=p
        ans[i][0]="R"
    elif ans[i][0]=="s":
        cnt+=r
        ans[i][0]="S"
    elif ans[i][0]=="p":
        cnt+=s
        ans[i][0]="P"
    if ans[i][1]=="r" and ans[i][0]!="R":
        cnt+=p
        ans[i][1]="R"
    elif ans[i][1]=="s" and ans[i][0]!="S":
        cnt+=r
        ans[i][1]="S"
    elif ans[i][1]=="p" and ans[i][0]!="P":
        cnt+=s 
        ans[i][1]="P"
    for j in range(2,len(ans[i])):
        if ans[i][j]=="r" and ans[i][j-1]!="R":
            cnt+=p
            ans[i][j]="R"
        elif ans[i][j]=="s" and ans[i][j-1]!="S":
            cnt+=r
            ans[i][j]="S"
        elif ans[i][j]=="p" and ans[i][j-1]!="P":
            cnt+=s 
            ans[i][j]="P"
#print(ans)
print(cnt)

### FIXED CODE ###

n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
ans=[[] for i in range(k)]
for i in range(n):
    ans[i%k]+=[t[i]]
cnt=0
#print(ans)
for i in range(k):
    if ans[i][0]=="r":
        cnt+=p
        ans[i][0]="R"
    elif ans[i][0]=="s":
        cnt+=r
        ans[i][0]="S"
    elif ans[i][0]=="p":
        cnt+=s
        ans[i][0]="P"
    for j in range(1,len(ans[i])):
        if ans[i][j]=="r" and ans[i][j-1]!="R":
            cnt+=p
            ans[i][j]="R"
        elif ans[i][j]=="s" and ans[i][j-1]!="S":
            cnt+=r
            ans[i][j]="S"
        elif ans[i][j]=="p" and ans[i][j-1]!="P":
            cnt+=s 
            ans[i][j]="P"
#print(ans)
print(cnt)
from math import log2

def main():
    a, b = map(int, input().split())
    x = (b - a + 1) // 2 % 2
    for i in range(1, int(log2(b)) + 1):
        k = 0
        p = 2**i
        q = 2 * p
        pa, qa = a % p, a % q
        pb, qb = b % p, b % q
        if a % q >= p:
            k += q - qa
        if b % q >= p:
            k += qb - p + 1
        x += (k % 2) * p
    print(x)

if __name__ == '__main__':
    main()

### FIXED CODE ###

from math import log2

def main():
    a, b = map(int, input().split())
    if a == b:
        print(a)
        return
    if b == 0:
        print(0)
        return
    d = b - a + 1
    x = (d // 2 + (d % 2) * (a % 2)) % 2
    for i in range(1, int(log2(b)) + 1):
        k = 0
        p = 2**i
        q = 2 * p
        pa, qa = a % p, a % q
        pb, qb = b % p, b % q
        if a % q >= p:
            k += q - qa
        if b % q >= p:
            k += qb - p + 1
        x += (k % 2) * p
    print(x)

if __name__ == '__main__':
    main()
S = input()

while(len(s)!=0):
    if s[-5:] == 'dream' or s[-5:] == 'erase':
        s = s[:-5]
    elif s[-6:]== 'eraser':
        s = s[:-6]
    elif s[-7:]=='dreamer':
        s = s[:-7]
    else:
        print('N0')
        break
else:
    print('YES')
        

### FIXED CODE ###

S = input()
flag = True
while(flag):
    if(len(S)==0):
        flag = False
    if(S[-5:]=='dream' or S[-5:]=='erase'):
        S=S[:-5]
    elif(S[-6:]=='eraser'):
        S=S[:-6]
    elif(S[-7:]=='dreamer'):
        S=S[:-7]
    else:
        break
if(flag):
    print('NO')
else:
    print('YES')
#反省点
import sys
def input(): return sys.stdin.readline().strip()
N=int(input())
A=[int(input()) for i in range(N-1)]
c=[[] for i in range(N)]
for i,a in enumerate(A):
    c[a-1].append(i+1)
import sys
sys.setrecursionlimit(10**5+9)
def f(i):
    if len(c[i])==0:
        return 0
    return max([e+i+1 for i,e in enumerate(sorted([f(j) for j in c[i]],reverse=True))])
print(f(0))

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
N=int(input())
A=[int(input()) for i in range(N-1)]
c=[[] for i in range(N)]
for i,a in enumerate(A):
    c[a-1].append(i+1)
import sys
sys.setrecursionlimit(10**7)
def f(i):
    if len(c[i])==0:
        return 0
    return max([e+i+1 for i,e in enumerate(sorted([f(j) for j in c[i]],reverse=True))])
print(f(0))
_=input()
print('Three' if len(set(map(int, input().split())))==3 else 'Four')

### FIXED CODE ###

_=input()
print('Three' if len(set(map(str, input().split())))==3 else 'Four')
N = int(input())
H = list(map(int, input().split()))
ans = 1
for i,j,k in zip(H,H[1::],H[2::]):
    if i == j:
        if j > k:
            ans *= 0
        else:
            break
    else i > j+1:
        ans *= 0
print("Yes" if ans == 1 else "No")


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
for i in reversed(range(N-1)):
    if H[i]>H[i+1]:
        H[i] -= 1
        if H[i]>H[i+1]:
            print("No")
            exit()
print("Yes")
h, a = map(int, input().split())
  print((h+a-1)//a)

### FIXED CODE ###

h, a = map(int, input().split())
print((h+a-1)//a)
import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_rec(num):
    return reduce(lcm, num, 1)

N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())

ans = lcm_rec(T)
print(ans)


### FIXED CODE ###

import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_rec(num):
    return reduce(lcm, num, 1)

N = int(input())
T = [0]*N
for i in range(N):
    T[i] = int(input())

ans = lcm_rec(T)
print(ans)
#coding: UTF-8
import sys

r, c = map(int, input().split())
list = [[0 for i in range(r+1)] for j in range(c+1)]

a = [input().split() for k in range(c)]

for l in range(r):
    for m in range(c):
        list[l][c] += int(a[l][m])
        list[r][m] += int(a[l][m])
        list[l][m] = int(a[l][m])

for n in range(r):
    list[r][c] += list[n][c]

for o in range(r+1):
    for p in range(c+1):
        print(list[o][p], " ", end = '')
    print(" ")


### FIXED CODE ###

#coding: UTF-8
import sys

H, W = map(int, input().split())
table = [[0]*(W+1) for i in range(H+1)]
# list = [[0 for i in range(W+1)] for j in range(H+1)]

for row in range(H):
    pre_table = list(map(int, input().split()))
    for col in range(W):
        table[row][col] = pre_table[col]

for row in range(H):
    for col in range(W):
        table[row][W] += table[row][col]

for col in range(W+1):
    for row in range(H):
        table[H][col] += table[row][col]

for row in range(H+1):
    print("%d"%(table[row][0]), end="")
    for col in range(1, W+1):
        print(" %d"%(table[row][col]), end = "")
    print()
from operator import itemgetter

n,m = map(int, input().split())
al = list(map(int, input().split()))
bc = []
for _ in range(m):
    b,c = map(int, input().split())
    bc.append([b,c])


bc.sort(key=itemgetter(1), reverse=True)
al.sort()

i = 0
while len(bc)>0 and i<n:
    b,c = bc.pop(0)

    for j in range(b):
        if al[i+j]<c:
            al[i+j] = c
    i += b

print(sum(al))

### FIXED CODE ###

from operator import itemgetter

n,m = map(int, input().split())
al = list(map(int, input().split()))
bc = []
for _ in range(m):
    b,c = map(int, input().split())
    bc.append([b,c])


bc.sort(key=itemgetter(1), reverse=True)
al.sort()

i = 0
while len(bc)>0 and i<n:
    b,c = bc.pop(0)

    for j in range(b):
        if i+j<n and al[i+j]<c:
            al[i+j] = c
    i += b

print(sum(al))
print((n-1)*n//2)

### FIXED CODE ###

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()

print(n*(n-1)//2)
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
data = []
for _ in range(N):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
diff = []
for i in range(1,N):
    diff.append((data[i][0]-data[i-1][0],data[i][1]-data[i-1][1]))
d=Counter(diff)
ans = N - max(d.values())
print(ans)

### FIXED CODE ###

from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
data = [0] * N
if N != 1:
    for _ in range(N):
        A,B = [int(x) for x in stdin.readline().rstrip().split()]
        data[_] = (A,B)
    data=sorted(data)
    max_value = 0
    diff = []
    for j in range(0,N-1):
        for i in range(j+1,N):
            diff.append((data[j][0]-data[i][0],data[j][1]-data[i][1]))
    d=Counter(diff)
        #max_value = max(max_value,max(d.values()))
    print(N-max(d.values()))
else:
    print(1)
lines = []
def fi(i, x):
    a, b = lines[i]
    return a*x+b

def find(x):
    def f(i):
        return fi(i+1,x) > fi(i,x)
    mn, mx = -1, len(lines)-1
    idx = (mn+mx)//2
    while mx-mn>1:
        if f(idx):
            mx, idx = idx, (mn + idx)//2
            continue
        mn, idx = idx, (mx + idx)//2
    return fi(idx+1, x)

def find2(x):
    # x が単調増加
    I = find2.I
    u, v = lines[I]
    while I+1<len(lines):
        w, y = lines[I+1]
        if u*x+v < w*x+y:
            break
        u, v = w, y
        I += 1
    find2.I = I
    return u*x+v
find2.I = 0

def insert(a, b):
    pass

def insert2(a, b):
    # a が単調減少
    if not lines:
        lines.append((a,b))
        return
    (e, f) = lines[-1]
    while len(lines)-1:
        (c, d), (e, f) = (e, f), lines[-2]
        if (c-e)*(b-d) < (d-f)*(a-c):
            break
        lines.pop()
    lines.append((a, b))

N, C = map(int, input().split())
hs = map(int, input().split())
r = 0
lines = []
for i, h in enumerate(hs):
    if i!= 0:
        r = fi(find(h), h) + h**2+C
    insert(-2*h, r+h**2)
print(r)


### FIXED CODE ###

def fi(i, x):
    a, b = lines[i]
    return a*x+b

def find(x):
    if len(lines) == 1:
        return 0
    def f(i):
        # 0<=i<len(lines)-1
        return fi(i+1,x) > fi(i,x)
    mn, mx = 0, len(lines)-2
    idx = (mn+mx)//2
    if f(mn):
        return 0
    if not f(mx):
        return mx+1
    while mx-mn>1:
        if f(idx):
            mx, idx = idx, (mn + idx)//2
            continue
        mn, idx = idx, (mx + idx)//2
    return idx+1

def remove_lines():
    (x, y) = lines.pop()
    a, b  = x, y
    (e, f) = lines[-1]
    while len(lines)-1:
        (c, d), (e, f) = (e, f), lines[-2]
        if (c-e)*(b-d) < (d-f)*(a-c):
            break
        lines.pop()
    lines.append((x, y))

def insert(a, b):
    lines.append((a, b))
    if len(lines) >= 3:
        remove_lines()

N, C = map(int, input().split())
hs = map(int, input().split())
r = 0
lines = []
for i, h in enumerate(hs):
    if i!= 0:
        r = fi(find(h), h) + h**2+C
    insert(-2*h, r+h**2)
print(r)
inp = input()
H = inp.split()[0][0]
W = inp.split()[0][0]
l = []
for i in range(H):
    l.append(inp[i+1])

for i in range(H*2):
    line = []
    for j in range(W):
        line = line + inp[(i+2)/2][j]
    print(line)


### FIXED CODE ###

inp = input()
H = int(inp.split()[0])
W = int(inp.split()[1])
l = []
for i in range(H):
    l.append(list(input()))

for i in range(H*2):
    line = ""
    for j in range(W):
        line = line + l[int((i)/2)][j]
    print(line)