Harryxun/stf_run huggingface dataset:
class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n)) #親ノード
        self.size = [1]*n #グループの要素数
 
    def root(self, x): #root(x): xの根ノードを返す．
        while self.parent[x] != x:
            self.parent[x] = self.parent[self.parent[x]]
            x = self.parent[x]
        return x 
 
    def merge(self, x, y): #merge(x,y): xのいる組とyのいる組をまとめる
        x, y = self.root(x), self.root(y)
        if x == y: return False
        if self.size[x] < self.size[y]: x,y=y,x #xの要素数が大きいように
        self.size[x] += self.size[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True
 
    def issame(self, x, y): #same(x,y): xとyが同じ組ならTrue
        return self.root(x) == self.root(y)
        
    def getsize(self,x): #size(x): xのいるグループの要素数を返す
        return self.size[self.root(x)]


# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n = int(readline())
xyi = []

for i in range(n):
    x,y = map(int,readline().split())
    xyi.append((x,y,i))

UF = UnionFind(n)
xyi.sort(key = lambda p:p[0])
#print(xyi)

q = []
for x,y,i in xyi:
    print(q)
    if q and q[-1][0] < y: Y,I = q[-1]
    else: Y,I = y,i
    while q and q[-1][0] < y:
        yy,ii = q.pop()
        UF.merge(i,ii)
    q.append((Y,I))
    #print(i,idx)

for i in range(n):
    print(UF.getsize(i))



### FIXED CODE ###

class UnionFind:
    def __init__(self, n):
        self.parent = list(range(n)) #親ノード
        self.size = [1]*n #グループの要素数
 
    def root(self, x): #root(x): xの根ノードを返す．
        while self.parent[x] != x:
            self.parent[x] = self.parent[self.parent[x]]
            x = self.parent[x]
        return x 
 
    def merge(self, x, y): #merge(x,y): xのいる組とyのいる組をまとめる
        x, y = self.root(x), self.root(y)
        if x == y: return False
        if self.size[x] < self.size[y]: x,y=y,x #xの要素数が大きいように
        self.size[x] += self.size[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True
 
    def issame(self, x, y): #same(x,y): xとyが同じ組ならTrue
        return self.root(x) == self.root(y)
        
    def getsize(self,x): #size(x): xのいるグループの要素数を返す
        return self.size[self.root(x)]


# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n = int(readline())
xyi = []

for i in range(n):
    x,y = map(int,readline().split())
    xyi.append((x,y,i))

UF = UnionFind(n)
xyi.sort(key = lambda p:p[0])
#print(xyi)

q = []
for x,y,i in xyi:
    #print(q)
    if q and q[-1][0] < y: Y,I = q[-1]
    else: Y,I = y,i
    while q and q[-1][0] < y:
        yy,ii = q.pop()
        UF.merge(i,ii)
    q.append((Y,I))
    #print(i,idx)

for i in range(n):
    print(UF.getsize(i))
import math
from math import ceil,sqrt,log,gcd,pi
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())

# for _ in range(ii()):
a,b=mi()
if((b+a)%2):
    print("IMPOSSIBLE")
else:
    x=abs(b+a)//2
    # print(abs(a-x),abs(b-x))
    if(abs(a-x)==abs(b-x)):
        print(abs(a-x))
    else:
        print(x)


### FIXED CODE ###

# from math import ceil,sqrt,log,gcd,pi
# def ii():return int(input())
# def si():return input()
# def mi():return map(int,input().split())
# def li():return list(mi())

# for _ in range(ii()):
a,b=map(int,input().split())
s=(a+b)
if(s==0 or s%2):
    print("IMPOSSIBLE")
else:
    x=0
    if(s!=0):
        x=abs(s)//2
    print(x)
def gcd(a,b):
    while b!=0:
        a,b = b,b%a
    return a
def lcm(a,b):
    return (a*b)//gcd(a,b)

N,X = map(int,input().split())
x = list(map(int,input().split()))
x = list(map(lambda q:abs(q-X),x))
ans = 1
for xx in x:
    ans = gcd(ans,xx)
print(ans)

### FIXED CODE ###

a,b = map(int,input().split())
if (a*b)%2:
    print("Yes")
else:
    print("No")
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M,K=map(int,input().split())
    A=list(range(0,N*M+1,N))
    s=set()
    for i in range(N+1):
        for j in range(M+1):
            if A[i]+(M-i*2)*j==K:
                YesNo(1)
                exit()
    YesNo(0)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M,K=map(int,input().split())
    A=list(range(0,N*M+1,N))
    s=set()
    for i in range(M+1):
        for j in range(N+1):
            if A[i]+(M-i*2)*j==K:
                YesNo(1)
                exit()
    YesNo(0)


if __name__ == '__main__':
    main()
n = list(input())
m = n.reverse()
print('Yes' if ''.join(n) == ''.join(m) else 'No')

### FIXED CODE ###

n = input()
if n == n[::-1]:
  print('Yes')
else:
  print('No')
a,b = map(int, input().split())
if a*b%100 == 1:
  print('Odd')
  else:
    print('Even')





### FIXED CODE ###

a,b = map(int, input().split())
if a*b%2 == 1:
  print('Odd')
else:
  print('Even')
s=input()
k=int(input())

tail = s[0]
if tail == s[-1]:
  tmp_cnt1 = 0
  tmp_cnt2 = 0
  for i in s:
    if tail == i:
      tmp_cnt1 += 1
    else:
      for i in s.reverse():
        if tail == i:
          tmp_cnt2 += 1
        else:
          break
      break
  if (tmp_cnt1 + tmp_cnt2) % 2 == 1:
    tail = ''

cnt=0
if len(s)==1:
  ret = k
else:
  tmp=s[0]
  tmp_cnt=0
  for i in s[1:]+tail:
    if tmp==i:
      tmp_cnt+=1
    else:
      cnt+=(tmp_cnt+1)//2
      tmp_cnt=0
    tmp=i
  cnt+=(tmp_cnt+1)//2
  ret=cnt*k
print(ret)

### FIXED CODE ###

s=input()
k=int(input())

tail = s[0]
plus = 0
flg = False
if tail == s[-1]:
  tmp_cnt1 = 0
  tmp_cnt2 = 0
  for i in s:
    if tail == i:
      tmp_cnt1 += 1
    else:
      break
  for i in s[::-1]:
    if tail == i:
      tmp_cnt2 += 1
    else:
      break
  if (tmp_cnt1 % 2) == 1 and (tmp_cnt2%2)==1:
    plus = 1
  if tmp_cnt1 == len(s):
    flg = True

cnt=0
if len(s)==1:
  ret = k//2
else:
  tmp=s[0]
  tmp_cnt=0
  for i in s[1:]:
    if tmp==i:
      tmp_cnt+=1
    else:
      cnt+=(tmp_cnt+1)//2
      tmp_cnt=0
    tmp=i
  cnt+=(tmp_cnt+1)//2
  ret=cnt*k
  if plus == 1:
    ret += k-1
  if flg:
    ret = len(s)*k//2
print(ret)
import math
import functools

def lcm(a,b):
    return  a*b/math.gcd(a,b)
    
n=int(input())
t=[int(input()) for i in range(n)]
if n==1:
    print(t[0])
else:
    anser=1
    for i in t:
        anser=lcm(anser,i)
    print(anser)

### FIXED CODE ###

def gcd(a,b):
    r=a%b
    while r!=0:
        a=b
        b=r
        r=a%b
    return b

def lcm(a,b):
    return  a*b//gcd(a,b)
    
n=int(input())
t=[int(input()) for i in range(n)]

anser=1
for i in t:
    anser=lcm(anser,i)
print(anser)
a,b=map(int,input().sprit())
if a>b:print('unsafe')
else:print('safe')

### FIXED CODE ###

a,b=map(int,input().split())
if a<=b: print('unsafe')
else: print('safe')
import sys

a = []
for l in sys.stdin:
    a.append(l)

_input = a[0]

def is_month(x):
    # x: 2桁の数字
    if 12 >= x > 0:
        return True
    else:
        return False

input_l = _input[:2]
input_r = _input[2:]

if is_month(input_l):
    if is_month(input_r):
        result = 'AMBIGUOUS'
    else:
        result = 'MMYY'
else:
    if is_month(input_r):
        result = 'YYMM'
    else:
        result = 'NA'
        
print(result)


### FIXED CODE ###

import sys

a = []
for l in sys.stdin:
    a.append(l)

_input = a[0]

def is_month(x):
    # x: 2桁の数字
    if 12 >= x > 0:
        return True
    else:
        return False


input_l = int(_input[:2])
input_r = int(_input[2:])

if is_month(input_l):
    if is_month(input_r):
        result = 'AMBIGUOUS'
    else:
        result = 'MMYY'
else:
    if is_month(input_r):
        result = 'YYMM'
    else:
        result = 'NA'

print(result)
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[-2])
d = int(abcd[-1])
if (a-b-c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a-b+c+d) == 7:
    print(f'{a}-{b}+{c}+{d}=7')
    exit()
if (a+b+c+d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a+b-c+d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a+b+c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a+b-c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a-b+c-d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()
if (a-b-c+d) == 7:
    print(f'{a}-{b}-{c}-{d}=7')
    exit()

### FIXED CODE ###

abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])
ans_list = []
if a+b+c+d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a-b+c+d == 7:
    print(str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
elif a+b-c+d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a+b+c-d == 7:
    print(str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
elif a-b-c+d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
elif a-b-c-d == 7:
    print(str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
elif a+b-c-d == 7:
    print(str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
else:
    print(str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
# -*- coding: utf-8 -*-

def main():
    s = input().split(" ")

    sl = list(s[0])
    prev = -1
    n = 0

    i = 0
    while True:
        if len(sl) <= i:
            break

        if (prev == 0 and sl[i] == '1') or (prev == 1 and sl[i] == '0'):
            # print(str(sl))
            # print("remove", i, prev, sl[i])
            del sl[i]
            del sl[i-1]
            n += 2
            if len(sl) <= i:
                break
            else:
                prev = int(sl[i-2])
                i = i-1
        else:
            prev = int(sl[i])
            i += 1

    print(n)

main()


### FIXED CODE ###

# -*- coding: utf-8 -*-

def main():
    s = input().split(" ")

    sl = list(s[0])
    prev = -1
    n = 0

    i = 0
    while True:
        if len(sl) <= i:
            break

        if (prev == 0 and sl[i] == '1') or (prev == 1 and sl[i] == '0'):
            # print(str(sl))
            # print("remove", i, prev, sl[i])
            del sl[i]
            del sl[i-1]
            n += 2
            if i-2 < 0:
                prev = -1
                i = 0
            else:
                prev = int(sl[i-2])
                i = i-1
        else:
            prev = int(sl[i])
            i += 1

    print(n)

main()
from collections import deque
from collections import defaultdict

n, m = map(int, input().split())
g = defaultdict(list)
s = set(list(range(1, n+1)))
ans = 0

for i in range(m):
    a, b = map(int, input().split())
    g[a].append(b)

while s:
    root = s.pop()
    q = deque()
    q.append(root)
    done = set()
    done.add(root)
    while q:
        node = q.popleft()
        for adj in g[node]:
            if adj not in done:
                done.add(adj)
                q.append(adj)
                s.remove(adj)
    ans += 1

print(ans - 1)


### FIXED CODE ###

from collections import deque
from collections import defaultdict

n, m = map(int, input().split())
g = defaultdict(list)
s = set(list(range(1, n+1)))
ans = 0

for i in range(m):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)

while s:
    root = s.pop()
    q = deque()
    q.append(root)
    done = set()
    done.add(root)

    while q:
        node = q.popleft()

        for adj in g[node]:
            if adj not in done:
                done.add(adj)
                q.append(adj)
                s.remove(adj)
    ans += 1

print(ans - 1)
import math
import itertools
#n = int(input())
#n, d = list(input().split())
n, k= list(map(int, input().split()))
p = list(map(int, input().split()))
point = []
rui = []

def s(n):
    if(n==1):
        return 1
    else:
        return n+s(n-1)


#for は一重まで
for i in range(n):
    point.append(s(p[i])/p[i])
    if i==0:
        rui.append(point[0])
    else:
        rui.append(rui[i-1]+point[i])


m = 0
a = 0
for i in range(n-k+1):
    if i==0:
        a = rui[i+k-1]
    else:
        a = rui[i+k-1]-rui[i-1]
    
   # print(a)
    if a > m:
        m = a



#print(point)
#print(rui)
print(m)


### FIXED CODE ###

import math
import itertools
#n = int(input())
#n, d = list(input().split())
n, k= list(map(int, input().split()))
p = list(map(int, input().split()))
point = []
rui = []

def s(n):
    if(n==1):
        return 1
    else:
        return (n*(n+1))/2


#for は一重まで
for i in range(n):
    point.append(s(p[i])/p[i])
    if i==0:
        rui.append(point[0])
    else:
        rui.append(rui[i-1]+point[i])


m = 0
a = 0
for i in range(n-k+1):
    if i==0:
        a = rui[i+k-1]
    else:
        a = rui[i+k-1]-rui[i-1]
    
   # print(a)
    if a > m:
        m = a



#print(point)
#print(rui)
print(m)
import sympy as sym
(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) = sym.symbols('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')

A = sym.sequence(N*(N+1)/2,(n, 1, 100))
print([int(N) for in A])


### FIXED CODE ###

N = int(input())

print(int(N*(N+1)/2))
string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
H = LIST()
I = []
 
if N == 1:
  print(0)
  exit()
  
i = 0
 
while i < N :
  c = 0
  s = 1
  for j in range(N-i-1):
    if H[i+j] >= H[i+j+1]:
      s *= 1
      c += s
    else:
      s *= 0
      c += s
    I.append(c)
    i += c+1
    
print(int(max(I)))

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
H = LIST()
I = []

if N == 1:
  print(0)
  exit()
  
i = 0
 
while i < N :
  c = 0
  j = 0
  while j < N-i-1 and H[i+j] >= H[i+j+1] :
    c += 1
    j += 1
    
  I.append(c)
  i += c+1
  
print(int(max(I)))
from math import gcd


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


def greatLCM(a):
    ans = lcm(a[0], a[1])
    p = 2
    while p < len(a):
        ans = lcm(ans, a[p])
        p += 1
    return ans


n = int(input())
arr = list(map(int, input().split()))
g = greatLCM(arr)
answer = 0
for i in arr:
    answer += g / i
    answer %= 10 ** 9 + 7

print(int(answer))


### FIXED CODE ###

import fractions

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

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

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())
def main():
    import sys
    input = sys.stdin.readline
    
    n = int(input().split())
    arr = list(map(int, input().split()))
    
    ok = 1
    for i in reversed(range(n - 1)):
        if arr[i] > arr[i + 1]:
            arr[i] -= 1
        if arr[i] > arr[i + 1]:
            ok = 0
    
    if ok:
        print("Yes")
    else:
        print("No")
    
    return 0

main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    
    n = int(input())
    arr = list(map(int, input().split()))
    
    ok = 1
    for i in reversed(range(n - 1)):
        if arr[i] > arr[i + 1]:
            arr[i] -= 1
        if arr[i] > arr[i + 1]:
            ok = 0
    
    if ok:
        print("Yes")
    else:
        print("No")
    
    return 0

main()
from collections import deque
K = int(input()) - 1
todo = deque(range(1, 10))
ans = []
counter = 0
while counter <= K:
    seed = todo.pop(0)
    ans.append(seed)
    counter += 1
    last_dig = int(str(seed)[-1])
    for i in range(max(0, last_dig-1), min(10, last_dig+2)):
        todo.append(int(str(seed) + str(i)))
print(ans[-1])

### FIXED CODE ###

from collections import deque
counter = 0
todo = deque(range(1, 10))
ans = []
while counter < 10**5 + 500:
    seed = str(todo.popleft())
    ans.append(int(seed))
    counter += 1
    seed_last = seed[-1]
    for i in range(max(0, int(seed_last)-1), min(10, int(seed_last)+2)):
        todo.append(seed + str(i))

K = int(input())
print(ans[K-1])
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    DP = [[0] * (M + 1) for _ in range(N + 1)]

    for i in range(N):
        DP[i + 1][0] = DP[i][0] + A[i]
        if DP[i + 1][0] > K:
            DP[i + 1][0] = 0
            break
    for j in range(M):
        DP[0][j + 1] = DP[0][j] + B[j]
        if DP[0][j + 1] > K:
            DP[0][j + 1] = 0
            break

    for i in range(N):
        if DP[i + 1][0] == 0: break
        for j in range(M):
            if DP[i + 1][j] == 0: break
            DP[i + 1][j + 1] = DP[i + 1][j] + B[j]
            if DP[i + 1][j + 1] > K:
                DP[i + 1][j + 1] = 0
                break

    ans = 0
    for i in range(N + 1):
        MX = max(DP[i])
        if MX == 0: break
        j = DP[i].index(MX)
        ans = max(ans, i + j)

    print(ans)


if __name__ == '__main__':
    main()

exit()


### FIXED CODE ###

def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    SUMA = [0]
    for a in A:
        if SUMA[-1] + a > K: break
        SUMA.append(SUMA[-1] + a)
    SUMB = [0]
    for b in B:
        if SUMB[-1] + b > K: break
        SUMB.append(SUMB[-1] + b)

    if len(SUMA) == 1:
        ans = len(SUMB) - 1
    elif len(SUMB) == 1:
        ans = len(SUMA) - 1
    else:
        ans = 0
        i = len(SUMA)
        j = 1
        while i:
            i -= 1
            while SUMA[i] + SUMB[j] <= K:
                j += 1
                if j == len(SUMB): break
            j -= 1
            ans = max(ans, i + j)

    print(ans)


if __name__ == '__main__':
    main()

exit()
if __name__ == '__main__':
	l = input().split()

	for i in range(l):
		l[i] = int(l[i])
	(W, H, x, y, r) = (l[i] for i in range(5))

	if r <= x and x <= W - r and r <= y and y <= H - r:
		print("Yes")
	else:
		print("No")



### FIXED CODE ###

if __name__ == '__main__':
	l = input().split()

	for i in range(len(l)):
		l[i] = int(l[i])
	W, H, x, y, r = l[0], l[1], l[2], l[3], l[4]

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")
#保証されている
#分解するとa<10**3となる

x=int(input())

for b in range(10**3):
    a = int((x+b**5)**(1/5))
    for i in range(a-1,a+2):
        if a**5+b**5==x:
            print(a,-b)
            exit()
for b in range(10**3):
    a = int((x-b**5)**(1/5))
    if a<0:
        continue
    for i in range(a-1,a+2):
        if a**5+b**5==x:
            print(a,b)
            exit()


### FIXED CODE ###

#保証されている
#分解するとa<10**3となる...はずだが

x=int(input())

for b in range(10**3):
    a = int((x+b**5)**(1/5))
    for i in range(a-1000,a+1000):#小さい数でも漏れが出ている
        if i**5+b**5==x:
            print(i,-b)
            exit()
for b in range(10**3):
    a2=(x-b**5)
    if a2<0:
        continue
    a = int(a2**(1/5))
    
    for i in range(a-1000,a+1000):
        if i**5-b**5==x:
            print(i,b)
            exit()
stack = [[] for i in xrange(int(raw_input()))]
while True:
	s = map(str,raw_input().split())
	if s[0] == 'quit':
		break
	elif s[0] == 'push':
		stack[int(s[1])-1].append(s[2])
	elif s[0] == 'pop':
		print stack[int(s[i])-1].pop()
	elif s[0] == 'move':
		stack[int(s[2])-1].append(stack[int(s[1])-1].pop())

### FIXED CODE ###

n = int(raw_input())
stack = [[] for i in xrange(n)]
while True:
	s = map(str,raw_input().split())
	if s[0] == 'quit':
		break
	elif s[0] == 'push':
		stack[int(s[1])-1].append(s[2])
	elif s[0] == 'pop':
		print stack[int(s[1])-1].pop()
	elif s[0] == 'move':
		stack[int(s[2])-1].append(stack[int(s[1])-1].pop())
a,*b,c = input()
print(a+len(b)+c)

### FIXED CODE ###

a,*b,c = input()
print(a+str(len(b))+c)
N = int(input())
# N = 4n+7m 
if N % 4 == 0 or N % 7 ==　0 or N % 7 == 4:
  print("Yes")
else:
  print("No")



### FIXED CODE ###

N = int(input())
m = 0
for i in range(15):
  n = N-7*m
  if n < 0:
    print("No")
    break
  elif n % 4 == 0:
    print("Yes")
    break
  elif m == 14:
    print("No")
  m += 1
N,M,K=map(int,input().split())
G=[]
F=[set([]) for _ in range(N)]
B=[set([]) for _ in range(N)]
for _ in range(M):
  a,b=map(int,input().split())
  F[a-1].add(b)
  F[b-1].add(a)
  p,i=True,0
  for g in G:
    if a in g and b in g:
      i+=1
    elif (a in g or b in g) and p:
      g|={a,b}
      p=False
    elif a in g or b in g:
      G[j]|=g|{a,b}
      G.remove(g)
  if p:
    G.append({a,b})
for _ in range(K):
  a,b=map(int,input().split())
  B[a-1].add(b)
  B[b-1].add(a)
ans=[0]*N
for g in G:
  for i in g:
    ans[i-1]=len(g-F[i-1]-B[i-1]-{i})
print(*ans)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1]*n
        self.rank = [0]*n

    def find(self, x):
        if self.par[x-1] < 0:
            return x
        else:
            self.par[x-1] = self.find(self.par[x-1])
            return self.par[x-1]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x==y:
            return
        elif self.rank[x-1] > self.rank[y-1]:
            self.par[x-1] += self.par[y-1]
            self.par[y-1] = x
        else:
            self.par[y-1] += self.par[x-1]
            self.par[x-1] = y
            if self.rank[x-1] == self.rank[y-1]:
                self.rank[y-1] += 1

    def same(self, x, y):
        return self.find(x)==self.find(y)

    def count(self, x):
        return -self.par[self.find(x)-1]

from collections import deque

N,M,K=map(int,input().split())
U=UnionFind(N)
q=deque([])
for _ in range(M):
  a,b=map(int,input().split())
  U.union(a,b)
  deque.append(q,(a,b))
G=[set([]) for _ in range(N)]
for _ in range(M):
  a,b=deque.pop(q)
  if U.same(a,b):
    G[a-1].add(b)
    G[b-1].add(a)
for _ in range(K):
  a,b=map(int,input().split())
  if U.same(a,b):
    G[a-1].add(b)
    G[b-1].add(a)
ans=[0]*N
for i in range(1,N+1):
  ans[i-1]=U.count(i)-len(G[i-1])-1
print(*ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
 
p.sort()
 
i = 0
price = 0
while i < k:
  price += p[i]
  i ++
  
print(price)

### FIXED CODE ###

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

i = 0
price = 0
while i < k:
  price += p[i]
  i += 1
 
print(price)
row1 = input().split()
row2 = input().split()
row3 = input().split()
print(row1[0]+row2[1]+row3[2])

### FIXED CODE ###

row1 = input()
row2 = input()
row3 = input()
print(row1[0]+row2[1]+row3[2])
N = int(input())
A =[int(x) for x in input().split()]

sum = 0
for i in range(N):
  sum+=A[i]
X =[0 for x in range(N)]
sum2=0
i=1
while i < N:
  sum2+=A[i]
  i+=2
X[0]=sum-sum2

for i in range(1,N):
  X[i]=2*A[i-1]-X[i-1]
for i in range(N):
  X[i]=string(X[i])
print(" ".join(X))

### FIXED CODE ###

N = int(input())
A =[int(x) for x in input().split()]

sum = 0
for i in range(N):
  sum+=A[i]
X =[0 for x in range(N)]
sum2=0
i=1
while i < N:
  sum2+=A[i]
  i+=2
X[0]=sum-sum2*2

for i in range(1,N):
  X[i]=2*A[i-1]-X[i-1]
for i in range(N):
  X[i]=str(X[i])
print(" ".join(X))