Harryxun/stf_run huggingface dataset:
import sys
from math import gcd
s = input()
t = input()
sl = len(s)
tl = len(t)


def min_circ(a):
    for i in range(1, len(a)+1):
        if len(a) % i == 0:
            if a[:i] * (len(a)//i) == a:
                return i


tc = min_circ(t)
if len(s) % tc == 0:
    if t[:tc]*(len(s)//min_circ(t)) == s:
        print(-1)
        sys.exit()


s *= tl//sl + 5
s *= 3

sl = len(s)
count = 0
ans = 0

r = 0
while r + tl <= sl-1:
    if s[r:r+tl] == t:
        count += 1
        ans = max(ans, count)
        r += tl
    else:
        count = 0
        r += 1

print(ans)


### FIXED CODE ###

import sys
import random
s = input()
t = input()
sl = len(s)
tl = len(t)

l = 0
r = 1500000//tl + 1
r2 = r
s *= 1499999//sl + 1
n = len(s)

base1 = 1007
mod1 = 10**9+7
modTank1 = [3000012541,3000012553,3000012563,3000012649,3000012683,3000012709]
mod1 = modTank1[random.randint(0,5)]
base1 = 1007
mod1 = 10**9+7
hash1 = [0]*(n+1)
power1 = [1]*(n+1)
for i,e in enumerate(s):
    hash1[i+1] = (hash1[i]*base1 + ord(e))%mod1
    power1[i+1] = (power1[i]*base1)%mod1

def rolling_hash(i, j):
    return (hash1[j]-hash1[i]*power1[j-i]%mod1)%mod1


while r - l > 1:
    m = l + (r-l)//2
    lt = len(t)*m
    hash2 = [0]*(lt+1)
    power2 = [1]*(lt+1)
    for i,e in enumerate(t*m):
        hash2[i+1] = (hash2[i]*base1 + ord(e))%mod1
        power2[i+1] = (power2[i]*base1)%mod1
    r_hash = hash2[-1]%mod1

    lt = len(t)*m
    flag = 0
    for i in range(len(s)-lt+1):
        if r_hash == rolling_hash(i, i+lt):
            flag = 1
            break

    if flag == 1:
        l = m
    else:
        r = m

if l*tl >= 1000000:
    print(-1)
else:
    print(l)
c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
a = c1[0]+c2[1]+c3[2]
b = c1[1]+c2[2]+c3[0]
c = c1[2]+c2[0]+c3[1]
d = c1[0]+c2[1]+c3[2]
e = c1[1]+c2[2]+c3[0]
f = c1[2]+c2[0]+c3[1]
if a=b and b=c and c=d and d=e and e=f and f=a:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

c1 = list(map(int,input().split()))
c2 = list(map(int,input().split()))
c3 = list(map(int,input().split()))
a = c1[0]+c2[1]+c3[2]
b = c1[1]+c2[2]+c3[0]
c = c1[2]+c2[0]+c3[1]
d = c1[0]+c2[2]+c3[1]
e = c1[1]+c2[0]+c3[2]
f = c1[2]+c2[1]+c3[0]
if a==b==c==d==e==f:
  print('Yes')
else:
  print('No')
while True:
    x = input()
    if x == "0":
        break
    num = x.split("")
    print(sum(num))
     

### FIXED CODE ###

while True:
    x = input()
    if x == "0":
        break
    num = [int(i) for i in x]
    print(sum(num))
n, m = map(int, input().split())

a = [input().split() for i in range(m)]

s = []
c = []

for i in range(m):
    s.append(a[i][0])
    c.append(a[i][1])

S = [int(i) for i in s]
C = [int(i) for i in c]

x = 0
z = 0

for i in range(m):
    x += C[i] * (10 ** (n-S[i]))
    for k in range(m):
        if n >= 2 and S[i] == 1 and C[i] == 0:
            z += 1
            break
        if S[i] == S[k] and C[i] != C[k]:
            z += 1
            break
        if S[i] == S[k] and C[i] == C[k] and i > k:
            x -= C[i] * (10 ** (n-S[i]))
            break

if z == 0:
    if '1' in S or m == 0:
        print(x)
    else:
        print(x+10**(n-1))

else:
    print('-1')

### FIXED CODE ###

n = int(input())

print((n + 1) // 2)
m=24*60*60
while True:
	n=int(input())
	if n==0:break
	dp=[0]*(m+1)
	for _ in range(n):
		a,d=input().split()
		a,b,c=map(int,a.split(':'));
		d,e,f=map(int,d.split(':'));
		dp[a*3600+b*60+c]+=1
		dp[d*3600+e*60+f]-=1
	for i in range(m):
		dp[i+1]+=dp[i]
	print(max(dp))

### FIXED CODE ###

m=24*60*60
while True:
	n=int(raw_input())
	if n==0:break
	dp=[0]*(m+1)
	for _ in range(n):
		a,d=raw_input().split()
		a,b,c=map(int,a.split(':'));
		d,e,f=map(int,d.split(':'));
		dp[a*3600+b*60+c]+=1
		dp[d*3600+e*60+f]-=1
	for i in range(m):
		dp[i+1]+=dp[i]
	print(max(dp))
n=int(input())
a_s=list(map(int,input().split()))
while True:
    a_s=set(a_s)
    a_s.discard(0)
    a_s=list(a_s)
    index=a_s.index(min(a_s))
    for i in range(len(a_s)):
        if i!=index and min(a_s)!=0:
            a_s[i]=a_s[i]%min(a_s)
    if len(a_s)==1:
        break
print(sum(a_s))

### FIXED CODE ###

a,b=map(int,input().split())
print(a+b if b%a==0 else b-a)
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1,n-1):
  if (p[n] > p[n-1]) and (p[n] < [n+1]): cnt += 1
print(cnt)
    
  

### FIXED CODE ###

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

cnt = 0
for i in range(1,n-1):
  if (p[i] > p[i-1]) and (p[i] < p[i+1]): cnt += 1
  if (p[i] < p[i-1]) and (p[i] > p[i+1]): cnt += 1
print(cnt)
x = map(int,raw_input().split(' '))
	x.sort()
	if (x[0],x[1]) != (0,0):
		print x[0],x[1]
		continue
	else:
		break

### FIXED CODE ###

while True:
	x = map(int,raw_input().split(' '))
	if (x[0],x[1]) != (0,0):
		x.sort()
		print x[0],x[1]
	else:
		break
n, k, q = map(int, input().split())
l = [int(input()) for i in range(q)]

points = [k] * n
for i in range(q):
    points = map(lambda x: x - 1, points)
    points[l[i] - 1] += 2
for i in points:
    if i <= 0:
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

n, k, q = map(int, input().split())
l = [int(input()) for i in range(q)]

points = [k - q] * n
for i in range(q):
    points[l[i] - 1] += 1
for i in points:
    if i <= 0:
        print('No')
    else:
        print('Yes')
N = int(input())
if(N in [1, 2, 3, 4, 5, 6, 7 ,8 ,9,10, 12, 14, 15, 16, 18, 20, 21 ,24, 25, 27, 30, 32, 35, 36, 40,42,45, 48, 49, 54, 56, 63, 64 ,72, 81]):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A, B = map(int, input().split())
print(A*B if A <= 9 and B <= 9 else -1)
X = int(input())
c=1
for b in range(1,X):
    for p in range(2,X):
        if b**p<=x:c=max(c,b**p)
        else:break
print(c)

### FIXED CODE ###

X = int(input())
c=1
for b in range(1,X):
    for p in range(2,X):
        if b**p<=X:c=max(c,b**p)
        else:break
print(c)
x,y = map(int(input().split()))
print(x+y//2)

### FIXED CODE ###

x,y = map(int,input().split())
print(x+y//2)
from math import sqrt
a, b, c = map(int,input().split())
if a + b + 2*sqrt(a*b) < c: print("Yes")
else: print("No")


### FIXED CODE ###

list = [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]
K = int(input())

print(list[K-1])
n, x = map(int, input().split())

d = 0
for i, l in enumerate(input().split()):
  d += int(l)
  if d > x:
    print(i)
    break
else:
  prin(n)

### FIXED CODE ###

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

d = 0
for i, l in enumerate(input().split()):
  d += int(l)
  if d > x:
    print(i + 1)
    break
else:
  print(n + 1)
from collections import Counter

N = int(input())
points = [tuple(map(int, input().split())) for _ in range(N)]
counter = Counter()

for i, a in enumerate(points):
    for j in range(N):
        if j == i:
            continue
        b = points[j]
        dx = b[0] - a[0]
        dy = b[1] - a[1]
        counter[(dx, dy)] += 1

vec, _ = counter.most_common()[0]
dx, dy = vec
visited = set()
cost = 0

for p in points:
    if p in visited:
        continue
    x, y = p
    visited.add(p)
    if (x + dx, y + dy) in visited or (x - dx, y - dy) in visited:
        continue
    cost += 1

print(cost)


### FIXED CODE ###

from collections import Counter


def main():
    N = int(input())
    points = [tuple(map(int, input().split())) for _ in range(N)]
    counter = Counter()

    if N == 1:
        print(1)
        return

    for i in range(N):
        for j in range(N):
            if j == i:
                continue
            a = points[i]
            b = points[j]
            dx = b[0] - a[0]
            dy = b[1] - a[1]
            counter[(dx, dy)] += 1

    vec, _ = counter.most_common()[0]
    dx, dy = vec
    visited = set()
    pointset = set(points)
    cost = 0

    for p in points:
        if p in visited:
            continue
        visited.add(p)
        x, y = p
        cost += 1

        i = 1
        while True:
            n = (x + i * dx, y + i * dy)
            i += 1
            if n in pointset:
                visited.add(n)
            else:
                break
        i = 1
        while True:
            n = (x - i * dx, y - i * dy)
            i += 1
            if n in pointset:
                visited.add(n)
            else:
                break

    print(cost)


main()
# -*- coding: utf-8 -*-
x, n = map(int, input().split())
aa = 0
if n == 0:
  aa = 1
if aa == 0:
    p = list(map(int, input().split()))
    p.sort()
    i = 0
    flg = 0
    dis = []
    while flg == 0:
        if i > 100:
            flg = 1
        if i in p:
            dis.append(5000)
        else:
            dis.append(abs(x-i))
        i += 1
    for i in dis:
        if dis[i] == min(dis):
            print(i)
            break
else:
    print(x)

### FIXED CODE ###

# -*- coding: utf-8 -*-
x, n = map(int, input().split())
aa = 0
if n == 0:
   aa = 1
if aa == 0:
    p = list(map(int, input().split()))
    p.sort()
    i = 0
    flg = 0
    dis = []
    while flg == 0:
        if i > 100:
            flg = 1
        if i in p:
            dis.append(5000)
        else:
            dis.append(abs(x-i))
        i += 1
    for i in range(len(dis)):
        if dis[i] == min(dis):
            print(i)
            break
else:
    print(x)
while 1:
    n = int(raw_input())
    if not n: break
    cnt = 1
    t = [0 for i in xrange(24*60*60)]
    for i in xrange(n):
        a = raw_input().split()
        h,m,s = [0,0],[0,0],[0,0]
        for i in xrange(2):
            h[i],m[i],s[i] = map(int, a[i].split(':'))
        t1 = h[0]*60**2 + m[0]*60 + s[0]
        t2 = h[1]*60**2 + m[1]*60 + s[1]
        for i in xrange(t1,t2):
            t[i] += 1

    for i in xrange(24*60*60):
        cnt = max(t[i], cnt)

    print cnt

### FIXED CODE ###

while 1:
    n = int(raw_input())
    if not n: break
    cnt = 0
    m = cnt
    t = []
    for i in xrange(n):
        a = raw_input().split()
        t.append((a[0],2))
        t.append((a[1],1))
    t.sort()
    for i in xrange(len(t)):
        #print t[i]
        if t[i][1] is 2: cnt += 1
        else: cnt -= 1

        m = max(m, cnt)

    print m
*a=list(map(int, input());
print(a)

### FIXED CODE ###

a=list(int(input()) for _ in range(4))
print(min([a[0]+a[2],a[1]+a[2],a[0]+a[3],a[1]+a[3]]))
N,M = map(int,input().split())
print(N * (N -1) //　2 + M * (M - 1) // 2

### FIXED CODE ###

N,M = map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
print('ARC' if input() != 'ABC else 'ABC')

### FIXED CODE ###

S = input()
print('ARC' if S == 'ABC' else 'ABC')
n,m=map(int,input().split())
A=[]
B=list(map(int,input().split()))
for t in range(10):
     if t not in B:
         A.append(t)
A=set(list(map(str,A)))
for s in range(n,10001):
    if set(list(str(s)))<=A:
        print(s)
        exit()

### FIXED CODE ###

n,m=map(int,input().split())
A=sorted([input() for s in range(n)])
print("".join(A))
a,b,c=map(int,input().split())
if a+c==2*b:
  print(Yes)
else:
  print(No)

### FIXED CODE ###

a,b,c=map(int,input().split())
if a+c==2*b:
  print("YES")
else:
  print("NO")
t = int(input())
a = list(map(int, input().split()))

if t == 1:
    print(0)
elif t == 2:
    print(abs(a[0] - a[i]))

else:
    dp = [-1] * (t)
    dp[0] = 0
    dp[1] = abs(a[0] - a[1])
    for i in range(2, t):
        dp[i] = min(abs(a[i] - a[i - 1]) + dp[i - 1],
                    abs(a[i] - a[i - 2]) + dp[i - 2])


print(dp[t - 1])


### FIXED CODE ###

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

dp = [0] * n
dp[1] = abs(arr[1] - arr[0])

for i in range(1, n - 1):
    dp[i + 1] = min(dp[i - 1] + abs(arr[i + 1] - arr[i - 1]), dp[i] + abs(arr[i + 1] - arr[i]))

print(dp[-1])
from sys import stdin
 
readline = stdin.readline
 
def main():
    _, *A = map(int, open(0).read().split())
 
    B = tuple(map(abs, A))
    C = (a for a in A if a < 0)
    print(sum(B) - min(B)*2*(len(C)%2))
 
 
if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin

readline = stdin.readline

_, *aa = map(int, open(0).read().split())
r = 0
mi = 1000000000
m = 0
for a in aa:
    if a < 0:
        m += 1
    b = abs(a)
    r += b
    mi = min(b, mi)
print(r - mi * 2 * (m % 2))
def gcd(x,y):
    if x<y:
        x,y = y,x
    while y>0:
        x,y = y,x%y
    return x
N = int(input())
A = list(map(int,input().split()))
cmin = 10**9
a = A[0]
for i in range(1,N):
    b = A[i]
    a = gcd(a,b)
    if a<cmin:
        ind = i
        cmin = a
a = A[(ind+1)%N]
cmin = 10**9
for i in range(N):
    if i==ind:continue
    b = A[i]
    a = gcd(a,b)
    cmin = min(cmin,a)
a = A[1]
dmin = 10**9
for i in range(2,N):
    b = A[i]
    a = gcd(a,b)
    dmin = min(dmin,a)
print(max(cmin,dmin))

### FIXED CODE ###

def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x

N = int(input())
A = sorted(list(map(int,input().split())))
amin = A[0]
ind = 0
for i in range(1,N):
    a = gcd(amin,A[i])
    if a<amin:
        ind = i
        amin = a
a0 = A[1]
for i in range(2,N):
    a0 = gcd(a0,A[i])
a1 = A[0]
for i in range(2,N):
    a1 = gcd(a1,A[i])
a = A[0]
for i in range(1,N):
    if i != ind:
        a = gcd(a,A[i])
print(max(a0,a1,a))
max = 0
i = 0
j = 0
k = 0
n_max = 0

n_max = int(raw_input())
price = [1,2,3,4,5,6]
for i in range(6):
????for j in range(6):
????????????if max <= price[j] - price[i]:
????????????????????print max

### FIXED CODE ###

import sys

n = int(raw_input())

min_R = int(raw_input())
nums = map(int, sys.stdin.readlines())

ans = -10**9

for num in nums:
    if num - min_R > ans:
        ans = num - min_R
    if num < min_R:
        min_R = num
        
print ans
N = int(input())
a_list = [int(a) for a in input().split()]

if a[0] > 1:
    print(-1)
    exit()

ans = a_list[-1] + 1
temp1 = [""]*(N+1)
temp1[-1] = a_list[-1]
for n in range(N-1, 0, -1):
    temp1[n] = temp1[n+1]+a_list[n]
    
temp2 = 1
for n in range(1, N):
    temp2 = (temp2-a_list[n-1])*2
    ans_temp = min(temp2, temp1[n])
    
    if ans_temp < a_list[n]:
        print(-1)
        exit()
    
    ans += ans_temp
    
print(ans)

### FIXED CODE ###

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

sita_maxi = [0 for i in range(n+1)]
sita_maxi[n] = a[n]
for i in range(n-1, -1, -1):
    sita_maxi[i] = sita_maxi[i+1] + a[i]

if a[0] > 1:
    print(-1)
    exit()

lst = [1]
for i in range(1, n+1):
    lst.append(min((lst[i-1]-a[i-1])*2, sita_maxi[i]))
    if lst[-1] < a[i]:
        print(-1)
        exit()

print(sum(lst))
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    c=0
    for e in a:
        if a(i)+1==e:
            c+=1
    print(c)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append(0)
for i in a:
    b[i-1]+=1
for i in b:
    print(i)
import itertools

n, m = map(int, input().split())
a = [None] * n
b = [None] * n
c = [None] * n


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

wf = [[float('inf')] * n for _ in range(n)]
for i in range(n):
    wf[i][i] = 0
for i in range(m):
    wf[a[i]][b[i]] = wf[b[i]][a[i]] = c[i]

for k, i, j in itertools.product(range(n), repeat=3):
    wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j])

ans = 0
for x in range(m):
    used = False
    for i, j in itertools.product(range(n), repeat=2):
        if wf[i][a[x]] + c[x] + wf[b[x]][j] == wf[i][j] or wf[i][b[x]] + c[x] + wf[a[x]][j] == wf[i][j]:
            used = True
    
    if not used:
        ans += 1

print(ans)


### FIXED CODE ###

import itertools

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

wf = [[float('inf')] * n for _ in range(n)]
for a, b, c in d:
    wf[a][b] = wf[b][a] = c
for i in range(n):
    wf[i][i] = 0

for k, i, j in itertools.product(range(n), repeat=3):
    wf[i][j] = min(wf[i][j], wf[i][k] + wf[k][j])

ans = 0
for a, b, c in d:
    used = False
    for i in range(n):
        for j in range(i + 1, n):
            if wf[i][a] + c + wf[b][j] == wf[i][j] \
                    or wf[i][b] + c + wf[a][j] == wf[i][j] \
                    or wf[j][a] + c + wf[b][i] == wf[j][i] \
                    or wf[j][b] + c + wf[a][i] == wf[j][i]:
                used = True
            
    if not used:
        ans += 1

print(ans)
S = input()
if(S.isupper()):
    printf('A')
else:
    printf('a')

### FIXED CODE ###


S = input()
if(S.isupper()):
    print('A')
else:
    print('a')
n, m = map(int, input().split())
issafe = [True] * n + 1
for _ in range(m):
    a = int(input())
    issafe[a] = False
 
dp = [0] * n +1
dp[0] = 1
if issafe[1]:
    dp[1] = 1
 
for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])

### FIXED CODE ###

n, m = map(int, input().split())
issafe = [True] * (n +1)
for _ in range(m):
    a = int(input())
    issafe[a] = False

dp = [0] * (n + 1)
dp[0] = 1
if issafe[1]:
    dp[1] = 1

for i in range(2, n + 1):
    if  issafe[i - 1]:
        dp[i] = dp[i] + dp[i - 1]
    if issafe[i -  2]:
        dp[i] = dp[i - 2] + dp[i] 
    
    dp[i] %= 1000000007
    
print(dp[n])
N,M = map(int,input().split())
P,S = [map(int,input().split()) for i in range(M)]

a = [0]*N

ac = 0
wa = 0

for i in range(M):
  if a[P[i]-1] == 0:
    if S[i] == "AC":
      ac += 1
      a[P[i]-1] = 1
    else:
      wa += 1
print(ac + " " + wa)
  

### FIXED CODE ###

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

wa = [0]*N
ac = [0]*N

wac = 0
acc = 0

for i in range(M):
  p,s = input().split()
  p = int(p)
  if s == "AC":
    if ac[p-1] != 1:
      ac[p-1] = 1
      acc += 1
      wac += wa[p-1]
  else:
    if ac[p-1] == 0:
      wa[p-1] += 1
print(str(acc) +" "+ str(wac))
X=int(input())
list=[]
for i in range(1, X):
  for j in range(2, X):
    if i**j<=X:
      list.append(i**j)
print(max(list))

### FIXED CODE ###

X=int(input())
list=[1]
for i in range(1, X):
  for j in range(2, X):
    if (i**j)<=X:
      list.append(i**j)
    else:break
print(max(list))
from collections import deque

def doubly_lined_list(n, A):
	Q = deque()

	for i in range(n):
		if A[i][0] == 'insert':
			Q.appendleft(A[i][1])
		elif A[i][0] == 'delete':
			Q.remove(A[i][1])
		elif A[i][0] == 'deleteFirst':
			Q.popleft()
		elif A[i][0] == 'deleteLast':
			Q.pop()

	print(' '.join(Q))

if __name__ == '__main__':
	n = int(input())
	A = []

	for i in range(n):
		A.append(input().split())

	doubly_lined_list(n, A)

### FIXED CODE ###

import sys
from collections import deque

def doubly_lined_list():
	n = int(input())
	Q = deque()

	for i in range(n):
		line = sys.stdin.readline()
		command = line.split()[0]

		if command == 'insert':
			Q.appendleft(line.split()[1])
		elif command == 'delete':
			try:
				Q.remove(line.split()[1])
			except:
				pass
		elif command == 'deleteFirst':
			Q.popleft()
		elif command == 'deleteLast':
			Q.pop()

	print(' '.join(Q))

if __name__ == '__main__':
	doubly_lined_list()
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N,K=map(int,input().split())
A=[int(i) for i in input().split()]
gcd = gcd_list(A)

if K > max(A):
    print("IMPOSSIBLE")
elif K % gcd !=0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

### FIXED CODE ###

import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N,K=map(int,input().split())
A=[int(i) for i in input().split()]
gcd = gcd_list(A)

if K > max(A):
    print("IMPOSSIBLE")
elif K % gcd !=0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
w = input()
li = list(input().split().swapcase())
cnt = 0
for i in range(len(li)):
    if w ==li[i]:
        cnt +=1
print(cnt)


### FIXED CODE ###

w=input().lower()
c=[]
s=input()
while(s!='END_OF_TEXT'):
    c+=s.lower().split();
    s=input()
print(len([x for x in c if x==w]))
a,b,c=map(int,input().split())
if a==b==c:
    print(-1)

else:
    cnt=0
    while a%2==b%2==c%2==0:
        total=a+b+c
        a=total//2-a//2
        b=total//2-b//2
        c=total//2-c//2
        cnt+=1
print(cnt)

### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b==c and a%2==0:
    print(-1)
elif a==b==c and a%2==1:
    print(0)
    
else:
    cnt=0
    while a%2==b%2==c%2==0:
        total=a+b+c
        a=total//2-a//2
        b=total//2-b//2
        c=total//2-c//2
        cnt+=1
    print(cnt)
q = int(input())

def Longest_Common(q) :
    X = raw_input()
    Y = raw_input()
    dp = [ [0 for i in range( len(X) )] for j in range( len(Y) )] #???X??????Y?????????????????????
    
    for j in range( len(Y) ):
        if Y[j] == X[0] :
            dp[j][0] += 1
        if( j+1 <= len(Y) - 1 ) :
            dp[j+1][0] = dp[j][0]

    for i in range( 1,len(X) ):
        if X[i] == Y[0] :
            dp[0][i] += 1
        if( i+1 <= len(X) - 1 ) :
            dp[i+1][0] = dp[i][0]
        
    for i in range( 1,len(X) ): 
        for j in range( 1,len(Y) ):
            if X[i] == Y[j] : dp[j][i] = max( dp[j-1][i-1], dp[j-1][i], dp[j][i-1]) + 1 
            else : dp[j][i] = max( dp[j-1][i-1], dp[j-1][i], dp[j][i-1])
                
    print dp[ len(Y)-1 ][ len(X)-1 ]    
    
    if( q == 1 ) :
        return
    else :
        Longest_Common(q-1)
        
Longest_Common(q)

### FIXED CODE ###

def solve():
    seq1 = raw_input()
    seq2 = raw_input()
  
    a, b = len(seq1), len(seq2)
    x1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = seq1[i]
        x2 = x1+[]
        for j in range(b):
            if e1 == seq2[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1] < x1[j]:
                x1[j+1] = x1[j]
    return x1[-1]
  
n = input()
for i2 in range(n):
    print solve()
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)

count_m = 0
count_z = 0
count_p = 0
sum_abs = 0

for i in range(N):
    if A[i] < 0:
        count_m += 1
        sum_abs -= A[i]
    elif A[i] == 0:
        count_z += 1
    else:
        count_p += 1
        sum_abs += A[i]

if count_m + count_z == 0:
    print(sum_abs-2*min(A))
    tmp = A[0]
    for i in range(N-2):
        print(tmp, A[i+1])
        tmp -= A[i+1]
    print(A[-1], tmp)

elif count_p + count_z == 0:
    print(sum_abs+2*max(A))
    tmp = A[-1]
    for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i]

elif count_p + count_m == 0:
    print(0)
    for i in range(N-1):
        print(0, 0)

elif count_z > 0:
    print(A[2*N])
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    for i in range(count_p-1):
        print(tmp_2, A[i+cmz])
        tmp_2 -= A[i+cmz]
    print(tmp, tmp_2)

elif count_z == 0:
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    for i in range(count_p-1):
        print(tmp_2, A[i+cmz])
        tmp_2 -= A[i+cmz]
    print(tmp, tmp_2)

### FIXED CODE ###

N, K = map(int, input().split())
if K == 1:
    print(0)
else:
    print(N-K)
import sys

ans=0
g=set()
input()
for s in sys.stdin:
    for a in s.split():
        for u in [*g]:
            if a in u:
                g.discard(u)
                s+=u
    g.add(s)

print(max(len(set(t.split())) for t in g))



### FIXED CODE ###

import sys

n,m=map(int,next(sys.stdin).split())
adj=[[] for _ in range(n)]
for _ in range(m):
    ln=next(sys.stdin)
    a,b=map(int,ln.split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)