Harryxun/stf_run huggingface dataset:
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:
        break;
    elif x => y:
        print (y,x)
    elif x < y
        print (y,x)

### FIXED CODE ###

while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0 :
        break
    elif x <= y :
        print (x,y)
    else :
        print (y,x)
N = int(input())
ab = [tuple(map(int, input().split())) for i in range(N-1)]

abd = {}
for a, b in ab:
  abd[a] = abd.get(a,set())
  abd[a].add(len(abd[a]) + 1)
  
  abd[b] = abd.get(b,set())
  abd[b].add(len(abd[b]) + 1)

rk = max([len(x) for x in abd.values()])
print(rk)

for a, b in ab:
  c = abd[a].pop()
  abd[b].remove(c)
  print(c)

### FIXED CODE ###

from collections import deque

N = int(input())
edge = [set() for i in range(N+1)]
for i in range(N-1):
  a, b = map(int, input().split())
  edge[a].add((b, i))
  edge[b].add((a, i))

r = [0] * (N - 1)
q = deque([(0, 1)])

while q:
  preC, fromv = q.popleft()
  c = 0
  for tov, i in edge[fromv]:
    edge[tov].remove((fromv, i))
    c += 1 + (c + 1 == preC)
    q.append((c, tov))
    r[i] = c
print(max(r))
for x in r:
  print(x)
N, X = map(int, input().split())
Burger = ['P']
for i in range(1,N+1):
    Burger_ = 'B' + Burger[i-1] + 'P' + Burger[i-1] + 'B'
    Burger.append(Burger_)
print(Burger[N][0:X].count('P'))

### FIXED CODE ###

N, X = map(int, input().split())
Size = [1]
Patty = [1]

for i in range(51):
    Size.append(Size[-1] * 2 + 3)
    Patty.append(Patty[-1] * 2 + 1)


def count_p(n, x):
    if x == 0:
        return 0
    if n == 0:
        return min(x, 1)
    if (Size[n]+1) // 2 > x:
        return count_p(n-1, x-1)
    elif (Size[n]+1) // 2 == x:
        return Patty[n-1] + 1
    else:
        return Patty[n-1] + 1 + count_p(n-1, x - ((Size[n]+1) // 2))


print(count_p(N, X))
a=int(input)
b=int(input)
c=int(input)
print(a*b*h//2)

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
print((a+b)*c//2)
def main():
    import sys
    X, N = map(int, sys.stdin.readline().split())
    P = list(map(int, sys.stdin.readline().split()))
    ans = []
    for i in range(0, 101):
        if X-i<0:
            break
        if not (X-i) in P:
            ans +=[i]
            break
    for i in range(0, 101):
        if X+i >100:
            break
        if not (X+i) in P:
            ans +=[i]
            break
    
    if ans[0]-ans[1] !=0:
        print(min(ans)+X)
    else:
        print(ans[0])



if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    X, N = map(int, sys.stdin.readline().split())
    P = list(map(int, sys.stdin.readline().split()))
    
    i = 0
    while True:
        if X-i in P:
            pass
        else:
            print(X-i)
            break
        if X +i in P:
            pass
        else:
            print(X+i)
            break
        i+=1
    


if __name__=='__main__':
    main()
n=int(input())
dat=list(map(int, input().split()))

for e in dat:
       e = bin(e)[2:]
       e = list(e).reverse()

re=[]

for e in dat:
      try:
#          w=e.index('1')
 #         re.append(w)
       except ValueError:
          re.append(0)

print(min(re))

### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
print(''.swapcase(<1200))

### FIXED CODE ###

s = input()
print(s.swapcase())
a = int(inpput())
print(a**3)

### FIXED CODE ###

a = int(input())
print(a**3)
import sys
def input():
    return sys.stdin.readline()[:-1]

S = list(input())
K = int(input())
N = len(S)
ans = 0
last_same = False
if N==1:
    print(K//2)
    exit()
for i in range(1,N):
    if S[i]!=S[i-1]:
        break
else:
    print(N*K//2)
    exit()
pre = S[0]
p = False
for i in range(1,N):
    if p:
        pre = S[i]
        p = False
        continue
    s = S[i]
    if pre==s:
        ans += 1
        p = True
        if i==N-1:
            last_same = True
        elif i==N-2:
            if S[-1]==S[-2]:
                last_3_same = True
    pre = s

l_same = False
if not last_same:
    if not S[0]==S[1]:
        if S[0]==S[-1]:
            ans += 1
            l_same = True
    elif S[1]==S[2]:
        if last_3_same:
            ans += 1
            l_same = True

ANS = ans*K
if l_same:
    ANS -= 1
print(ANS)

### FIXED CODE ###

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

S = list(input())
K = int(input())
N = len(S)
ans = 0
last_same = False
if N==1:
    print(K//2)
    exit()
for i in range(1,N):
    if S[i]!=S[i-1]:
        break
else:
    print(N*K//2)
    exit()
p = False

#前からと後ろからで連続しているかずをかぞえあげる.
pre_num = 0
l_num = 1
if S[0]==S[-1]:
    pre_num = 1
    for i in range(1,N-1):
        if S[i]==S[i-1]:
            pre_num += 1
        else:
            break
    l_num = 1
    for i in range(N-1,0,-1):
        if S[i]==S[i-1]:
            l_num += 1
        else:
            break

for i in range(pre_num,N-l_num):
    if p:
        p = False
        continue
    if S[i]==S[i+1]:
        ans += 1
        p = True

ANS = (pre_num//2) + ans*K + ((pre_num+l_num)//2)*(K-1) + (l_num//2)

print(ANS)
s=input()
n=len(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    print(i+1,i+2)
    break
  elif i<n-1 and s[i]==s[i+2]:
    print(i+1,i+3)
    break
else:
  print(-1,-1)

### FIXED CODE ###

s=input()
n=len(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    print(i+1,i+2)
    break
  elif i<n-2 and s[i]==s[i+2]:
    print(i+1,i+3)
    break
else:
  print(-1,-1)
n, k = map(int, input().split())
C = [[1], [1,1]]
for i in range(2, n):
  C.append([1])
  for j in range(1, i):
    C[i].append(C[i-1][j-1] + C[i-1][j])
for i in range(1, k+1):
  print(C[n-k+1][i] * C[k-1,i-1])
  


### FIXED CODE ###

n, k = map(int, input().split())
mod = 10**9+7
C = [[1], [1,1]]
for i in range(2, n+10):
  C.append([1] + [(C[i-1][j-1] + C[i-1][j])%mod for j in range(1, i)] + [1])
for i in range(1, k+1):
  if n-k+1 < i or k < i:
    print(0)
  else:
    print((C[n-k+1][i] * C[k-1][i-1])%mod)
N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*(1+N+max(a))

for i in range(N):
  w.append(1+i+a[i])
  s.append(1+i-a[i])
  num[1+i+a[i]]+=1
for i in range(N):
  count+=num[w[i]]
print(count)

### FIXED CODE ###

N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*N
maxi=max(a)
for i in range(N):
  s.append(1+i-a[i])
  if 1+i+a[i]<N:
    num[1+i+a[i]]+=1
for i in range(N):
  if s[i]>=0:
    count+=num[s[i]]
print(count)
import numpy as np
a,b = input().split(" ")
ab = int(a+b)
if np.sqrt(ab) = int(np.sqrt(ab)):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

a,b = input().split(" ")
ab = int(a+b)
for i in range(1,400):
  if i**2 == ab:
    print("Yes")
    exit()
print("No")
from functools import lru_cache


@lru_cache(maxsize=10000000)
def get_ways(n):
    if n == 1 or n == 2:
        return n
    elif n == 0:
        return 1
    elif n == -1:
        return 0
    else:
        return get_ways(n - 2) + get_ways(n - 1)


N, M = map(int, input().split())
ans = 1
tmp = 0
for i in range(M):
    a = int(input())
    ans *= get_ways(a - tmp - 1)
    tmp = a + 1
ans *= get_ways(N - tmp)
print(ans % 1000000007)


### FIXED CODE ###

from functools import lru_cache
import sys
sys.setrecursionlimit(10**6)


@lru_cache(maxsize=1000000)
def get_ways(n):
    if n == 1 or n == 2:
        return n
    elif n == 0:
        return 1
    elif n == -1:
        return 0
    else:
        return get_ways(n - 2) + get_ways(n - 1)


N, M = map(int, input().split())
ans = 1
tmp = 0
for i in range(M):
    a = int(input())
    ans *= get_ways(a - tmp - 1)
    tmp = a + 1
ans *= get_ways(N - tmp)
print(ans % 1000000007)
n = int(input())
l = [input() for i in range(n)]

from collections import Counter
ans = 0
for w1,w2 in l:
  if Counter(w1) == Counter(w2):
    ans += 1
print(ans)

### FIXED CODE ###

N=int(input())
l=[]
from collections import Counter
for i in range(N):
  l.append(''.join(sorted(input())))
l1=Counter(l).values()
from math import factorial
ans=0
for a in l1:
  if a >= 2:
    ans+=int(factorial(a)/(factorial(a-2)*factorial(2)))
print(ans)
for x in range(int(input())):
  if x**2>n:
    print(x-1)
    break

### FIXED CODE ###

n=int(input())
for x in range(10**5):
  if x**2>n:
    print((x-1)**2)
    break
a,b = input().split()
A,B = int(a),int(b)
if(A>(B*2)):
	print(A-B*2)
else:
	print(0)

### FIXED CODE ###

a,b = input().split()
a,b = int(a),int(b)
print(max(a-2*b,0))
import math
ans = 10**12
n = int(input())
for a in range(1,int(math.sqrt(N)):
  for b in range(1,int(math.sqrt(N)):
    if a * b == n:
      ans_n = a + b -2
      if ans > ans_n:
        ans = ans_n
print(ans) 

### FIXED CODE ###

n = int(input())
ans = float('inf')
 
for i in range(1, 10**6+1):
    q, m = divmod(n, i)
    if m == 0:
        ans = min(ans, q+i)
 
print(ans-2)
n,k=map(int,input().split())
hList=[]
for i in range(n):
  hList.append(int(input()))
hList.sort()
//print(hList)
ans=100000000000000
for i in range(n-k+1):
  tmp=hList[i+k-1]-hList[i]
  if(ans>tmp):
    ans=tmp
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
hList=[]
for i in range(n):
  hList.append(int(input()))
hList.sort()
#print(hList)
ans=100000000000000
for i in range(n-k+1):
  tmp=hList[i+k-1]-hList[i]
  if(ans>tmp):
    ans=tmp
print(ans)
s = input()
t = input()
n = len(s)
m = len(t)
ans = []
for i in range(n-m+1):
    flag = True
    for j in range(m):
        if s[i+j]!="?" and s[i+j]!=t[j]:
            flag = False
            break
    if flag:
        tmp = (s[:i] + t + s[(i+m):]).raplace("?","a")
        ans.append(tmp)

ans.sort()

if len(ans)>0:
    print(ans[0])
else:
    print("UNRESTORABLE")

### FIXED CODE ###

s = input()
t = input()
n = len(s)
m = len(t)
ans = []
for i in range(n-m+1):
    flag = True
    for j in range(m):
        if s[i+j]!="?" and s[i+j]!=t[j]:
            flag = False
            break
    if flag:
        tmp = (s[:i] + t + s[(i+m):])
        a = []
        for j in range(n):
            if tmp[j]=="?":
                a.append("a")
            else:
                a.append(tmp[j])
        tmp = "".join(a)
        ans.append(tmp)

ans.sort()

if len(ans)>0:
    print(ans[0])
else:
    print("UNRESTORABLE")
import math
n = int(input())
a = list(map(int, input().split()))

this_gcd = max(a)
gcd_list = []

for i in a:
    this_gcd = math.gcd(this_gcd, i)

for I in range(len(a)):
    i = a[I]
    tmp = i // this_gcd
    key = 1
    for j in range(2, int(math.sqrt(tmp)) + 1):
        if tmp % j == 0:
            key = 0

    if key:
        del a[I]
        break

this_gcd = max(a)
for i in a:
    this_gcd = math.gcd(this_gcd, i)

print(this_gcd)

### FIXED CODE ###

import fractions
n = int(input())
a = list(map(int, input().split()))
if n <= 2:
    print(max(a))
else:
    gcd_left = [a[0]]
    gcd_right = [a[-1]]
    for i in range(1, n):
        gcd_left.append(fractions.gcd(a[i], gcd_left[-1]))
        gcd_right.append(fractions.gcd(a[n-i-1], gcd_right[-1]))
    gcd_right = gcd_right[::-1]
    # print(gcd_left, gcd_right)
    ans = max(gcd_left[-2], gcd_right[1])
    for i in range(n-2):
        ans = max(ans, fractions.gcd(gcd_right[i+2], gcd_left[i]))
    print(ans)
L, R, d = input().split()

L = int()
R = int()
d = int()

ans = 0

for i in range(L, R+1):
    if i % d == 0:
        ans = ans + 1
        
print(ans)

### FIXED CODE ###

L, R, d = map(int,input().split())



ans = 0

for i in range(L, R+1):
    if i % d == 0:
        ans = ans + 1
        
print(ans)
a = []
for i in range(3):
   	a.append(input())
o = a[0,0] + a[1,1] + a[2,2]
print(o)

### FIXED CODE ###

a = []
for i in range(3):
   	a.append(input())
o = a[0][0] + a[1][1] + a[2][2]
print(o)
i=1;count=1
while 1:
    i=input()
    if i==0:break
        
    print("case {0}: {1}".format(count,i))
    count+=1

### FIXED CODE ###

i=1;count=1
while 1:
    i=input()
    i=int(i)
    if i==0:
        break
    print("Case {0}: {1}".format(count,i))
    count+=1
N, K = map(int, input().split())
P = [int(i) - 1 for i in input().split()]
Q = [int(i) for i in input().split()]
ans = - float('inf')
for i in range(N):
    tmp = []
    now = i
    cnt = 0
    for j in range(1, N + 1):
        now = P[now]
        cnt += Q[now]
        tmp.append(cnt)
        if now == i:
            break
    if tmp[-1] < 0:
        ans = max(ans, max(tmp))
    else:
        v = (tmp[-1] * (K // j)) + max(tmp[:K % j])
        ans = max(ans, v)
print(ans)        

### FIXED CODE ###

N, K = map(int, input().split())
P = [int(i) - 1 for i in input().split()]
Q = [int(i) for i in input().split()]
ans = - float('inf')
for i in range(N):
    now = i
    cnt = 0
    span = 0
    while True:
        span += 1
        cnt += Q[now]
        now = P[now]
        if now == i:
            break
    point = 0
    now = i
    for j in range(1, span + 1):
        point += Q[now]
        now = P[now]       
        if j > K:
            break
        value = point + (max(cnt, 0) * ((K - j) // span))
        ans = max(ans, value)
print(ans)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from queue import deque

def main():
  h, w = map(int, input().split())
  grids = [list(input().strip()) for _ in range(h)]
  dq = deque()
  for i in range(w):
    for j in range(h):
      if grids[i][j] == '#':
        dq.append((0, i, j))
  
  mcnt = -1
  while dq:
    cnt, i, j = dq.popleft()
    mcnt = cnt if cnt > mcnt else mcnt
    for dx, dy in zip([-1, 0, 1, 0], [0, -1, 0, 1]):
      if 0 <= i+dx < h and 0 <= j+dy < w and grids[i+dx][j+dy] == '.':
        grids[i+dx][j+dy] = '#'
        dq.append((cnt+1, i+dx, j+dy))
  print(cnt)
  
if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

from queue import deque

def main():
  h, w = map(int, input().split())
  grids = [False] * (w * h)
  dq = deque()
  for i in range(h):
    for j, c in enumerate(list(input().strip())):
      if c == '#':
        grids[i*w + j] = True
        dq.append((0, i, j))
  
  while dq:
    cnt, i, j = dq.popleft()
    for dx, dy in zip([-1, 0, 1, 0], [0, -1, 0, 1]):
      if 0 <= i+dx < h and 0 <= j+dy < w and not grids[(i+dx)*w + (j+dy)]:
        grids[(i+dx)*w + (j+dy)] = True
        dq.append((cnt+1, i+dx, j+dy))
  print(cnt)
  
if __name__=='__main__':
  main()
import sys

N = int(input())

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

NList.sort()
result = 1
for i in range(N):
    result *= NList[i]

    if result > 10 ** 18:
        print('-1')
        sys.exit(1)

if result > 10 ** 18:
    print('-1')
    sys.exit(1)
else:
    print(result)

### FIXED CODE ###

N = int(input())

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

NList.sort()
result = 1
for i in range(N):
    result *= NList[i]

    if result > 10 ** 18:
        break

if result > 10 ** 18:
    print('-1')
else:
    print(result)
l = list(map(int, input().split()))
l1 = []
a, b, c = l[0], l[1], l[2]
m = min(a,b)

for i in range(1, m+1):
  if a%i==0 and b%i==0:
    l1.append(i)

print(sorted(set(l1))[c-1])

### FIXED CODE ###

l = list(map(int, input().split()))
a, b, c = l[0], l[1], l[2]

if b/a>c:
  print(c)
else:
  print(int(b/a))
n=int(input())
dat = list(map(int, input().split()))

for e in dat:
    e = str(bin(e))

for e in dat:
    e = e[::1]

#print(min(dat)-1)



### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
n = int(input())
X = input()
x = int(X,2)
bitx = bin(x).count('1')
 
ans = [0]*(bitx+1)
for i in range(1,len(ans)):
    ans[i] = 1 + ans[i%bin(i).count('1')]
#print(ans)
l = []
bitp = bitx + 1
bitm = bitx - 1
xmp = 0
xmm = 0
 
for i in range(n):
    if X[i] == '1':
        xmp += pow(2, n-(i+1), bitp)
        xmm += pow(2, n-(i+1), bitm)
        
for i in range(n):
    if X[i] == '1':
        if bitm == 0:
            l.append(str(0))
        else:
        	xm = (xmm - pow(2,n-i-1,bitm)) % bitm
        	l.append(str(1+ans[xm]))
    else:
        xm = (xmp + pow(2,n-i-1,bitp))%bitp
        l.append(str(1+ans[xm]))

    #print(1+ans[t])
print('\n'.join(l))


### FIXED CODE ###

n = int(input())
X = input()
x = int(X,2)
bitx = bin(x).count('1')
 
ans = [0]*(bitx+2)
for i in range(1,bitx+2):
    ans[i] = 1 + ans[i%bin(i).count('1')]
#print(ans)
l = []
bitp = bitx + 1
bitm = bitx - 1
xmp = 0
xmm = 0


if bitx != 1:
    for i in range(n):
        if X[i] == '1':
            xmp += pow(2, n-(i+1), bitp)
            xmm += pow(2, n-(i+1), bitm)
    for i in range(n):
        if X[i] == '1':
            xm = (xmm - pow(2,n-i-1,bitm)) % bitm
            l.append(str(1+ans[xm]))
        else:
            xm = (xmp + pow(2,n-i-1,bitp))%bitp
            l.append(str(1+ans[xm]))
 
else:
    for i in range(n):
        if X[i] == '1':
            xmp += pow(2, n-(i+1), bitp)
    for i in range(n):
        if X[i] == '1':
            l.append(str(0))
        else:
            xm = (xmp + pow(2,n-i-1,bitp))%bitp
            l.append(str(1+ans[xm]))
 
print('\n'.join(l))
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
if N==2:
    print(1,2)
    exit()
es = [[] for i in range(N)]
for a,b in AB:
    a,b = a-1,b-1
    es[a].append(b)
    es[b].append(a)

depth = [-1]*N
depth[0] = 0
def dfs(v,p=-1):
    for to in es[v]:
        if to==p: continue
        depth[to] = depth[v] + 1
        dfs(to,v)
dfs(0)

g1 = []
g2 = []
for i,d in enumerate(depth):
    if d%2:
        g2.append(i)
    else:
        g1.append(i)
if len(g1) < len(g2):
    g1,g2 = g2,g1

ans = [None] * N
if len(g2) <= N//3:
    for n in range(1,N+1):
        if n%3==0:
            if g2:
                i = g2.pop()
            else:
                i = g1.pop()
        else:
            i = g1.pop()
        ans[i] = n
else:
    for n in range(1,N+1):
        if n%3==1:
            i = g1.pop()
        elif n%3==2:
            i = g2.pop()
        else:
            if (n//3)%2:
                i = g1.pop()
            else:
                i = g2.pop()
        ans[i] = n
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N = int(input())
AB = [tuple(map(int,input().split())) for i in range(N-1)]
if N==2:
    print(1,2)
    exit()
es = [[] for i in range(N)]
for a,b in AB:
    a,b = a-1,b-1
    es[a].append(b)
    es[b].append(a)

depth = [-1]*N
depth[0] = 0
def dfs(v,p=-1):
    for to in es[v]:
        if to==p: continue
        depth[to] = depth[v] + 1
        dfs(to,v)
dfs(0)

g1 = []
g2 = []
for i,d in enumerate(depth):
    if d%2:
        g2.append(i)
    else:
        g1.append(i)
if len(g1) < len(g2):
    g1,g2 = g2,g1

ans = [None] * N
if len(g2) <= N//3:
    for n in range(1,N+1):
        if n%3==0:
            if g2:
                i = g2.pop()
            else:
                i = g1.pop()
        else:
            i = g1.pop()
        ans[i] = n
else:
    for n in range(1,N+1,3):
        i = g1.pop()
        ans[i] = n
    for n in range(2,N+1,3):
        i = g2.pop()
        ans[i] = n
    for n in range(3,N+1,3):
        if g1:
            i = g1.pop()
        else:
            i = g2.pop()
        ans[i] = n
print(*ans)
N,K = map(int,input().split())
A = list(map(int,input().split()))

nlist = [0] * N
for i in A:
    nlist[i] += 1

nlist.sort(reverse = True)
cnt = 0
for i in range(K,N):
    if nlist[i] == 0: break
    cnt += nlist[i]

print(cnt)

### FIXED CODE ###

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

nlist = [0] * N
for i in A:
    nlist[i-1] += 1

nlist.sort(reverse = True)
cnt = 0
for i in range(K,N):
    if nlist[i] == 0: break
    cnt += nlist[i]

print(cnt)
N = int(input())
A = map(int,input().split())
B = map(int,input().split())

ans = 0
for i in range(N):
    cur = 0
    for j in range(N):
        if j < i:
            cur += A[j]
        elif j == i:
            cur += A[j] + B[j]
        else:
            cur += B[j]
    ans = max(ans , cur)
print(ans)

### FIXED CODE ###

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

ans = 0
for i in range(N):
    cur = 0
    for j in range(N):
        if j < i:
            cur += A[j]
        elif j == i:
            cur += A[j] + B[j]
        else:
            cur += B[j]
    ans = max(ans , cur)
print(ans)
H, W = map(int, input().split())
for i in range(W):
    C = input()
    print(C)
    print(C)

### FIXED CODE ###

h,w = map(int, input().split())
stage = [list(input()) for i in range(h)]
ans = [0 for i in range(2*h)]
for i in range(h):
    ans[2*i] = stage[i]
    ans[2*i+1] = stage[i]
for i in ans:
    for j in i:
        print(j, end = "")
    print()
N = int(input())

if N % 2 == 0:
  print((N // 2) ** 2)
else:
  print((N // 2) * (N // 2 + 1)


### FIXED CODE ###

N = int(input())

if N % 2 == 0:
  print((N // 2) ** 2)
else:
  print((N // 2) * (N // 2 + 1))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
X = int(input())
def f(n):
  if (n = 3) or (n = 5)or (n = 7):
    print("YES")
  else:
    print("NO")
    
print("{}".format(f(X)))

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
X = int(input())
def f(n):
  if (n == 3)or(n == 5)or(n == 7):
    return "YES"
  else:
    return "NO"
    
print("{}".format(f(X)))
n,m=(int(x) for x in input().split())
a,A = (int(x) for x in input().split())
ans = max(n - (a+A), -1)
print(ans)

### FIXED CODE ###

n,m=(int(x) for x in input().split())
a = [int(x) for x in input().split()]
ans = max(n - sum(a), -1)
print(ans)
N = int(input())

def factorize(x):
    factor = {}
    for num in range(2, int(x**0.5)+1):
        while x % num == 0:
            x = x // num
            try:
                factor[num] += 1
            except:
                factor[num] = 1
        if x != 1:
            factor[x] = 1
        return factor

prime_factor_list = factorize(N)
# print(prime_factor_list)
ans = 0

for key in prime_factor_list.keys():
    key_num = prime_factor_list[key] #{2:6}なら6
    nokori = key_num
    for i in range(1, key_num+1): #1~6まで
        if nokori < i:
            break#次の素数へ
        nokori -= i
        if N % key**i == 0:
            N //= key**i
            ans += 1
        else:
            break
print(ans)


### FIXED CODE ###

N = int(input())

ans = 0

# if N % 2 == 0:
#     i = 1
#     while N % 2**i == 0:
#         N //= 2**i
#         ans += 1
#         i += 1

# if N % 3 == 0:
#     i = 1
#     while N % 3**i == 0:
#         N //= 3**i
#         ans += 1
#         i += 1

# if N % 5 == 0:
#     i = 1
#     while N % 5**i == 0:
#         N //= 5**i
#         ans += 1
#         i += 1

# if N % 7 == 0:
#     i = 1
#     while N % 7**i == 0:
#         N //= 7**i
#         ans += 1
#         i += 1

# if N % 11 == 0:
#     i = 1
#     while N % 11**i == 0:
#         N //= 11**i
#         ans += 1
#         i += 1

# if N % 13 == 0:
#     i = 1
#     while N % 13**i == 0:
#         N //= 13**i
#         ans += 1
#         i += 1

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return set(a)

prime_list = prime_factorize(N)

if prime_list:
    for prime_num in prime_list:
        if N % prime_num == 0:
            for j in range(1, 100):
                if N < prime_num**j:
                    break
                if N % prime_num**j == 0:
                    # print(prime_num, j)
                    N //= prime_num**j
                    ans += 1
# print(N)
# print(prime_list)
print(ans)