Harryxun/stf_run huggingface dataset:
n, m = map(int, input().split())

tmp = ["0" for i in range(n)]
digit = [[] for i in range(n)]
for i in range(m):
  s, c= map(str, input().split())
  digit[int(s)-1].append(c)
for i in range(n):
  if len(digit[i]) == 0:
    digit[i].append("0")
  

ans = []
if n == 3:
  for i in range(len(digit[0])):
    for j in range(len(digit[1])):
      for k in range(len(digit[2])):
        t = int(digit[0][i] + digit[1][j]+digit[2][k])
        if len(str(t)) == n:
          ans.append(t)  
if n ==2:
  for i in range(len(digit[0])):
    for j in range(len(digit[1])):
      t = int(digit[0][i] + digit[1][j]+digit[2][k])
      if len(str(t)) == n:
        ans.append(t)
if n == 1:
  for i in range(len(digit[0])):
    t = int(digit[0][i])
    ans.append(t)
    
if len(ans) == 0:
  print(-1)
else:
  print(min(ans))
  


### FIXED CODE ###

n, m = map(int, input().split())
digit = [list(map(int, input().split())) for _ in range(m)]

for i in range(10**n):
  tmp = str(i)
  if len(tmp) == n:
    flag = True
    for s, c in digit:
      if tmp[s-1] != str(c):
        flag = False
        break
    if flag:
      print(i)
      exit()
print(-1)
n=int(input())
a=[i for i in input().split()]

print('YES' if len(set(a)==n) else 'NO')

### FIXED CODE ###

s,t =map(str,input().split())
a,b =map(int,input().split())
u=input()
if u==s:
    print(a-1,b)
else:
    print(a,b-1)
n , m , k = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
su = 0
at=0
bt=0
ans=0
while su <= k:
    if a[at]<=b[bt]:
        su+=a[at]
        ans+=1
        at+=1
    else:
        su+=b[bt]
        ans+=1
        bt+=1
print(ans-1)


### FIXED CODE ###

import bisect
n , m , k = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ax = [0]*(n+1)
bx = [0]*(m+1)
for i in range(1,n+1):
    ax[i]=ax[i-1]+a[i-1]
for i in range(1,m+1):
    bx[i]=bx[i-1]+b[i-1]

c = bisect.bisect_right(ax,k)
ma = 0
for i in range(c):
    d = bisect.bisect_right(bx,k-ax[i])
    ma = max(ma,i+d-1)
print(ma)
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N, C):
    last = [-1] * N
    pairs = []
    for i, c in enumerate(C):
        prev = last[c - 1]
        if prev >= 0 and prev < i - 1:
            pairs.append((last[c - 1], i))
        last[c - 1] = i
    pairs.sort()
    count = [0] * N
    count[0] = 1
    idx = 0
    for i in range(N):
        if i > 0:
            count[i] += count[i - 1]
        while idx < len(pairs) and pairs[idx][0] == i:
            count[pairs[idx][1]] += count[i]
            idx += 1
    print(count[N - 1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, C)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
MAX_N = 200000

def solve(N, C):
    last = [-1] * MAX_N
    pairs = []
    for i, c in enumerate(C):
        try:
            prev = last[c - 1]
        except:
            if c >= N:
                return
            else:
                raise Exception()
        if prev >= 0 and prev < i - 1:
            pairs.append((prev, i))
        last[c - 1] = i
    pairs.sort()
    count = [0] * N
    count[0] = 1
    idx = 0
    for i in range(N):
        if i > 0:
            count[i] += count[i - 1]
            count[i] %= MOD
        while idx < len(pairs) and pairs[idx][0] == i:
            count[pairs[idx][1]] += count[i]
            count[pairs[idx][1]] %= MOD
            idx += 1
    print(count[N - 1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, C)

if __name__ == '__main__':
    main()
X = int(input())

dp = [0] * (100000)
dp[0] = 1

for i in range(X + 1):
    if dp[i] == 1:
        for j in range(6):
            dp[i + 100 + j] = 1
            if i + 100 + j == X:
                print(1)
                exit()
print(0)


### FIXED CODE ###

X = int(input())

x = X % 100
tmp = (x // 5) * 105
if x % 5 != 0:
    tmp += 100 + (x % 5)
if tmp > X:
    print(0)
else:
    print(1)
def main():
    a,b,c = list(map(int,input().split(' ')))
    #a,b,c = list(map(lambda x:abs(int(x)),input().split(' ')))
    # if (a**0.5 + b**0.5) < (c**0.5):
    #     print('Yes')
    # else:
    #     print('No')

    if c < 0:
        print('No')
        return
    if (4*a*b) < ((c-a-b)**2):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    K = int(input())
    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]
    print(List[K-1])

if __name__ == '__main__':
    main()
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
  a, b, c = map(int, input().split())
  a-=1
  b-=1
  graph[a].append((b, c))
  graph[b].append((a, c))
q, k = map(int, input().split())
k-=1
seen = [False]*n
l = [0]*n
def DFS(node, length):
  l[node] = length
  seen[node] = True
  for i, j in graph[node]:
    if seen[i]:
      continue
    DFS(i, length+j)

DFS(k, 0)
for _ in range(q):
  x, y = map(int, input().split())
  print(l[x-1]+l[y-1])

### FIXED CODE ###

import sys
n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n-1):
    a, b, c = map(int, input().split())
    a-=1
    b-=1
    graph[a].append((b, c))
    graph[b].append((a, c))
q, k = map(int, input().split())
k -= 1
xy = []
for _ in range(q):
    x, y = map(int, input().split())
    x-=1
    y-=1
    xy.append((x, y))

def DFS(node, p_node, length):
    l[node] = length
    for i, j in graph[node]:
        if i==p_node:
            continue
        DFS(i, node, length+j)
sys.setrecursionlimit(2 * n)
l = [0]*n
DFS(k, -1, 0)
for x, y in xy:
    print(l[x]+l[y])
N, M = map(int, input().split())
X = [0 for _ in range(N)]
if N % 2 == 0:
    l, r = 1, 2
    for i in range(M):
        X[l-1] = 1
        X[r-1] = 1
        print(l, r)
        while X[l-1] != 0:
            l += 1
        r = l + i + 2
else:
    for i in range(M):
        print(N-i-1, i+1)

### FIXED CODE ###

N, M = map(int, input().split())
X = [0 for _ in range(N)]
if N % 2 == 0:
    X = [0 for _ in range((N-1)//2)]
    l, r = 1, N // 2
    for i in range((N//2)//2):
        X[i] = [l, r]
        l += 1
        r -= 1
    l, r = N, N // 2 + 2
    for i in range((N-1)//2-(N//2)//2):
        X[i+(N//2)//2] = [l, r]
        l -= 1
        r += 1
    for i in range(M):
        print(X[i][0], X[i][1])
else:
    for i in range(M):
        print(N-i, i+1)
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]
## 種類数の求め方
# 1. A内の要素を取り出して、それがA内に存在するとき：種類＋１
# 2. その要素を重複数だけAから削除してループ

kinds = 0
A = sorted(A)
duplicatedList = []
while len(A) > 0:
    if A[0] in A:
        kinds += 1
        duplicatedList.append(A.count(A[0]))
        for j in range(A.count(A[0])):
            A.remove(A[0])

if kinds <= K:
    print('0')
elif kinds > K:
    duplicatedList = sorted(duplicatedList)
    tmp = 0
    for i in range(kinds-K):
        tmp += duplicatedList[i]
    print(tmp)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
d={}
l=[]
for i in range(n):
    try:
        l[d[a[i]]]+=1
    except:
        d[a[i]]=len(l)
        l.append(1)
ans=0
l.sort()
for i in range(len(l)-k):
    ans+=l[i]
print(ans)
n=int(input())
v=list(map(int,input().split()))
temp1=[]
temp2=[]
for i in range(0,n):
  if i%2==0:
    temp1.append(v[i])
  else:
    temp2.append(v[i])
count=0
from collections import Counter
c1=Counter(temp1)
mode1=c1.most_common()[0][1]
mode1s=c1.most_common()[1][1]
c2=Counter(temp2)
mode2=c2.most_common()[0][1]
mode2s=c2.most_common()[1][1]
if c1.most_common()[0][0]==c2.most_common()[0][0]:
  if mode1s>=mode2s:
    count=len(temp1)-mode1s
  else:
    count=len(temp2)-mode2s
else:
  count=len(temp1)-mode1+len(temp2)-mode2
print(count)

### FIXED CODE ###

n=int(input())
v=list(map(int,input().split()))
temp1=[]
temp2=[]
for i in range(0,n):
  if i%2==0:
    temp1.append(v[i])
  else:
    temp2.append(v[i])
count=0
from collections import Counter
c1=Counter(temp1)
values1,counts1=zip(*c1.most_common())
counts1=list(counts1)
mode1=counts1[0]
if len(counts1)>1:
  mode1s=counts1[1]
c2=Counter(temp2)
values2,counts2=zip(*c2.most_common())
counts2=list(counts2)
mode2=counts2[0]
if len(counts2)>1:
  mode2s=counts2[1]
if len(counts1)==1 and len(counts2)==1 and c1.most_common()[0][0]==c2.most_common()[0][0]:
  count=min(mode1,mode2)
elif c1.most_common()[0][0]==c2.most_common()[0][0]:
  if len(temp1)-mode1s>=len(temp2)-mode2s:
    count=len(temp1)-mode1+len(temp2)-mode2s
  else:
    count=len(temp2)-mode2+len(temp1)-mode1s
else:
  count=len(temp1)-mode1+len(temp2)-mode2
print(count)
s=[i for i in input()]
l=[]
cnt=0
for i in s:
  if i=="A" or i=="T" or i=="C" or i=="G" or i==" ":
    cnt+=1
  else:
    l.append(cnt)
    cnt=0
print(max(l))    

### FIXED CODE ###

s=[i for i in input()]
l=[]
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="T" or s[i]=="C" or s[i]=="G" or s[i]==" ":
    cnt+=1
    if i==len(s)-1:
      l.append(cnt)
  else:
    l.append(cnt)
    cnt=0  
print(max(l) if len(l)>1 else l[0])
import collections
s=input()
t=input()
s = collections.Count(s)
t = collections.Count(t)
if sorted(s.values()) == sorted(t.values()):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

li=list(map(int,input().split()))
li.sort()
print(li[0]+li[1]+li[2]*10)
a,b,c=input().split()
ls=[a,b,c]
ls.sort()
print(ls[0]*ls[1])

### FIXED CODE ###

a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
ls=[a,b,c]
ls.sort()
print(int(ls[0]*ls[1]/2))
N, M = list(map(int, input().split(" ")))
A = [1] * (N+1)
for i in range(M):
    A[int(input())] = -1
for i in range(2, N + 1):
    if(A[i] == -1):
        A[i] = 0
    else:
        A[i] = A[i-1] + A[i-2]
print(A[-1] % 1000000007)


### FIXED CODE ###

import itertools
pqr = list(map(int,input().split(" ")))
print(sum(min(list(itertools.combinations(pqr, 2)), key=lambda x:sum(x))))
import sys
sys.setrecursionlimit(10 ** 9)
                      
h,w,k = map(int,input().split())
x1,y1,x2,y2 = map(int,input().split())
c = []
for i in range(h):
  c.append(list(input()))

def dfs(x,y,kk,d,a):
  #print(kk,d)
  if c[x][y] == '.':
    c[x][y] = a
  else:
    c[x][y] = min(c[x][y],a)
  for dx,dy in ((-1,0),(1,0),(0,-1),(0,1)):
    if 0 <= x+dx < h and 0 <= y+dy < w and (c[x+dx][y+dy] == '.' or (c[x+dx][y+dy] != '@' and c[x+dx][y+dy] > a)):
      if kk == -1:
        kk = k-1
        a = 1
      elif kk == 0 or d != (dx,dy):
        kk = k
        a += 1
      else:
        kk -= 1
      dfs(x+dx,y+dy,kk,(dx,dy),a)

dfs(x1-1,y1-1,-1,(),0)
print(-1 if c[x2-1][y2-1] == '.' else c[x2-1][y2-1])
#print(c)


### FIXED CODE ###

h,w,k = map(int,input().split())
x1,y1,x2,y2 = map(int,input().split())
c = []
for i in range(h):
  c.append(list(input()))

q = [(1,x1-1,y1-1)]
c[x1-1][y1-1] = 0
while(q):
  qq = []
  for a,x,y in q:
    for dx,dy in ((0,-1),(0,1),(-1,0),(1,0)):
      for kk in range(1,k+1):
        xx = x+dx*kk
        yy = y+dy*kk
        if not (0 <= xx < h) or not (0 <= yy < w) or c[xx][yy] == '@' or (c[xx][yy] != '.' and c[xx][yy] < a):
          break
        if c[xx][yy] == '.' or (c[xx][yy] != '.' and c[xx][yy] > a):
          c[xx][yy] = a
          qq.append((a+1,xx,yy))
  #print(qq)
  q = qq[:]

print(-1 if c[x2-1][y2-1] == '.' else c[x2-1][y2-1])
#print(c)
N = int(input())
SP = []
for i in range(N):
  S,P = map(int,input().split())
  P = int(P)
  SP.append(S,P,i+1)
SP.sort()
for a,b,c in SP:
  print(c)

### FIXED CODE ###

N = int(input())
SP = []
for i in range(N):
  S,P = input().split()
  P = int(P)
  SP.append((S,-P,i+1))
SP.sort()
for a,b,c in SP:
  print(c)
x = input()
y = input()
print( ( x + y ) / 2 )

### FIXED CODE ###

r = input()
g = input()
print( 2*int(g) - int(r) )
n, a, b = map(int, input().split())
x = int(n / (a + b))
y = n - ((a + b) / x)
if y >= a:
    z = a
else:
    z = y
print(int(a * x + z))

### FIXED CODE ###

n, a, b = map(int, input().split())
x = int(n / (a + b))
y = n - ((a + b) * x)
if y >= a:
    z = a
else:
    z = y
print(int((a * x) + z))
import math

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

mod = 10**9+7

def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
# ax ≡ 1 (mod m)
def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m

def lcm(x, y):
    tmp = modinv(math.gcd(x,y),mod)
    # print(mod)
    return ((x * y)  )* tmp

l = 1
for k in a:
    l = lcm(l,k)

l = l % mod

mod = 10**9+7
res = 0
for k in a:
    tmp = modinv(k, mod)
    res = (res + l * tmp % mod) % mod

res = res % mod
print(res)

# print(a)

# ans = 1

# if n == 1:
#     print(1)
#     exit
# elif n == 2:
#     l = lcm(a[0], a[1])
#     print(l//a[0]+ l//a[1])
#     exit

# print(10)

# ans = 1
# for i in range(n):
#     tmp = lcm(l, i)
#     ans/(n-1)
#     l = lcm(l, a[i])
    




### FIXED CODE ###

from fractions import gcd

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

l = a[0]
for k in a:
  l = ( l * k ) // gcd(l, k)

mod = 10 ** 9 + 7
ans = 0
for k in a:
  ans += l // k

print( int(ans) % mod )
import collections
def main():
    N, M = map(int, input().split())
    bridges = []
    for _ in range(M):
        a, b = map(int, input().split())
        bridges.append([a, b])
    bridges = bridges[::-1]
    parent = [i for i in range(N+1)]
    count = dict()
    for i in range(N+1): count[i] = 1

    def find(i):
        if parent[i] != i:
            parent[i] = find(parent[i])
        return parent[i]

    def union(i, j):
        pi, pj = find(i), find(j)
        df = 0
        if pi != pj:
            parent[pj] = pi
            df += count[pi] * count[pj]
            count[pi] += count[pj]
            del count[pj]
        return df

    ans = [N*(N-1)//2]
    for a, b in bridges[:-1]:
        d = union(a, b)
        ans.append(ans[-1] - d)
    return ans[::-1]

if __name__ == '__main__':
    output = main()
    for v in output:
        print(v)

### FIXED CODE ###

import collections
def main():
    N, M = map(int, input().split())
    bridges = []
    for _ in range(M):
        a, b = map(int, input().split())
        bridges.append([a, b])
    bridges = bridges[::-1]
    parent = [i for i in range(N+1)]
    count = dict()
    for i in range(N+1): count[i] = 1

    def find(i):
        if parent[i] != i:
            parent[i] = find(parent[i])
        return parent[i]

    def union(i, j):
        pi, pj = find(i), find(j)
        df = 0
        if pi != pj:
            if count[pi] > count[pj]:
                parent[pj] = pi
                df += count[pi] * count[pj]
                count[pi] += count[pj]
                del count[pj]
            else:
                parent[pi] = pj
                df += count[pi] * count[pj]
                count[pj] += count[pi]
                del count[pi]                
        return df

    ans = [N*(N-1)//2]
    for a, b in bridges[:-1]:
        d = union(a, b)
        ans.append(ans[-1]-d)
    return ans[::-1]

if __name__ == '__main__':
    output = main()
    for v in output:
        print(v)
N = int(input())
An = list(map(int, input().split()[0:N]))

An_pos = [ a for a in An if a >= 0]
An_neg = [ a for a in An if a < 0]

ans = sum(An_pos) - sum(An_neg)

if len(An_neg) % 2 == 1:
    min_abs = min(min(An_pos), -max(An_neg))
    ans -= 2 * min_abs
    pass

print(ans)


### FIXED CODE ###

from itertools import chain

N = int(input())
An = list(map(int, input().split()[0:N]))

An_pos = [ a for a in An if a >= 0]
An_neg = [ -a for a in An if a < 0]

ans = sum(An_pos) + sum(An_neg)

if len(An_neg) % 2 == 1:
    ans -= 2 * min(chain(An_pos, An_neg))
    pass

print(ans)
input()
A = list(map(int, input().split())
print(min(A),max(A),sum(A))

### FIXED CODE ###

input()
a = list(map(int, input().split()))
print(min(a) ,max(a) ,sum(a))
s = input()

dic = {'SUN' : 6, 'MON' : 5, 'WED' : 4, 'THU' : 3, 'FRI' : 2, 'SAT' : 1}

print(dic[s])


### FIXED CODE ###

s = input()

dic = {
    'SUN' : 7, 'MON' : 6, 'TUE' : 5, 'WED' : 4, 'THU' : 3, 'FRI' : 2, 'SAT' : 1
}

print(dic[s])
n = int(input())

ans = 0
x = 1

while x < n:
    if n % x == 0:
        m = n // x - 1
        if m <= x:
            break
        else:
            ans += m
    x += 1

print(ans)

### FIXED CODE ###

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

print(n - k + 1)
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()

a.sort(reverse=True)

def nibu(left,right):
	l = (right-left)//2+left
	ans = 0
	for i in a:
		ans+=math.floor(i/l)
	#print(l, ans, left, right)

	if left<right-1:
		if ans<=k:
			return nibu(left,right-(right-l))
		else:
			return nibu(left+(l-left), right)
	else:
		return left


print(nibu(0,a[0])+1)


### FIXED CODE ###

from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,k = readInts()
a = readInts()

a.sort(reverse=True)

if n==1:
	print(math.ceil(a[0]/(k+1)))
	exit()

def get(left, right):
	l = (right-left)//2+left
	ans = 0
	for i in a:
		ans+=math.ceil(i/l)-1
	#print(l, ans, left, right)
	return ans,l

def nibu(left,right):
	ans,l = get(left, right)

	if left<right:
		if ans<=k:
			return nibu(left,l)
		else:
			return nibu(l+1, right)
	else:
		return right


print(nibu(1,a[0]))
from bisect import *
n, k = map(int,input().split())
d = list(map(int,input().split()))

use_num = []
for i in range(10):
    if i in d:continue
    use_num.append(i)

str_n = str(n)
res = 0
for i in str_n:
    temp = bisect_left(use_num, int(i))
    res = res * 10 + use_num[temp]
print(res)

### FIXED CODE ###

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

num=[]
for i in range(10):
    if i not in d:
        num.append(i)
#print(num)
num.sort()
digit=len(str(n))
ns=str(n)

ans=''
cnt=0
while cnt<digit:

    for i in num:
        if int(ns[cnt])>i:continue
        if int(ns[cnt])==i:
            ans+=str(i)
            break
        else:
            ans+=str(i)+(digit-cnt-1)*str(num[0])
            cnt=digit
            break
    else:
        ans=str(num[0]) if num[0]!=0 else str(num[1])
        ans+=str(num[0])*digit
        cnt=digit
    cnt+=1
print(ans)
def f(n):
    return(int(n/x)+1 if n >=0 else 0)
    
a, b, x = list(map(int, input().split()))
print(max(f(b)-f(a-1)),0)

### FIXED CODE ###

a, b, x = map(int, input().split())
print(b//x - (a-1)//x)
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(b))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))
h,w=map(int,input().split())

l=[list(input()) for i in range(h)]
ans=[[0]*w for i in range(h)]

for i in range(h):
  for j in range(w):
    if l[i][j]=="#":
      ans[i][j]=="#"
    else:
      for a in range(-1,2):
        for b in range(-1,2):
          if i+a<h and j+b<w ansl[i+a][j+b]=="#":
            ans[i][j]+=1
            
for i in range(h):
  print(*ans[i])


### FIXED CODE ###

h,w=map(int,input().split())
l=[list(input()) for i in range(h)]

ans=[[0]*w for i in range(h)]

for i in range(h):
  for j in range(w):
    if l[i][j]=='#':
      ans[i][j]='#'
    else:
      for p in range(-1,2):
        for q in range(-1,2):
          if 0<=i+p<h and 0<=j+q<w and l[i+p][j+q]=='#':
            ans[i][j]+=1
            
for i in range(h):
  print(*ans[i],sep='')
o = str(input())
e = str(input())
s = []
for i in range(len(e)):
    s.append(o[i])
    s.append(e[i])
if len(o) - len(e) = 1:
    s.append(o[-1])
print(*s, sep = "")


### FIXED CODE ###

o = str(input())
e = str(input())
s = []
for i in range(len(e)):
    s.append(o[i])
    s.append(e[i])
if len(o) > len(e):
    s.append(o[-1])
print(*s, sep = "")
import numpy
n= int(input())
Number=list(map(int,input().split())
print(numpy.prod(Number)
            

### FIXED CODE ###

n = int(input())
nums = list(map(int,input().split()))
limit = 10**18
res = 1
i = 0
if 0 in nums:
    print(0)
    exit()
while i<n:
    res *= nums[i]
    i += 1
    if res > limit:
        res = -1
        break
print(res)
def printing(m, G, cnt, A):
    print(m)
    for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

    print(cnt)
    for i in A:
        print(i)

def insertionSort(A, n, g, cnt):
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return cnt


def shellSort(A, n, cnt):

    m = 2
    G = [4, 1]
    for i in range(0, m):
        cnt = insertionSort(A, n, G[i], cnt)

    printing(m, G, cnt, A)


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

cnt = 0
shellSort(inputList, N, cnt)


### FIXED CODE ###

def printing(m, G, cnt, A):
    print(m)
    for i in range(len(G)):
        if i != len(G) - 1:
            print(G[i], end=' ')
        else:
            print(G[i])

    print(cnt)
    for i in A:
        print(i)

def insertionSort(A, n, g, cnt):
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return cnt


def shellSort(A, n, cnt):

    m = 0
    G = [1]
    while True:
        formulate = 3 * G[m] + 1
        if N > formulate:
            G.append(formulate)
        else:
            break
        m += 1

    for i in range(len(G) // 2):
        G[i], G[-1 - i] = G[-1 - i], G[i]

    for i in range(m + 1):
        cnt = insertionSort(A, n, G[i], cnt)

    printing(m + 1, G, cnt, A)


N = int(input())
inputList = []
for i in range(N):
    inputList.append(int(input()))

# inputList = list(map(int, '''5
# 5 1 4 3 2'''.split()))
# N = inputList.pop(0)

cnt = 0
shellSort(inputList, N, cnt)
import sys
sys.setrecursionlimit(50000)
N, Q = map(int, input().split())
a_b = [list(map(int, input().split())) for _ in range(N-1)]
p_x = [list(map(int, input().split())) for _ in range(Q)]
 
rin = [[] for _ in range(N)]
for v in a_b:
    rin[v[0]-1].append(v[1]-1)
    rin[v[1]-1].append(v[0]-1)
    
score = [0 for _ in range(N)]
for ele in p_x:
    score[ele[0]-1] +=ele[1]
#print(score)
 
def dfs(p, bp=-1):
    for c in rin[p]:
        if c != bp:
            #print(c)
            score[c]+= score[p]
            dfs(c, p)
 
 
 
 
dfs(0)
print(*score)


### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(1000000)

n,q = map(int, input().split())
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(n-1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(q)]

v = [deque([]) for i in range(n)]
for e in a_b:
    v[e[0]-1]+=[e[1]-1]
    v[e[1]-1]+=[e[0]-1]
score = [0 for i in range(n)]
for e in p_x:
    score[e[0]-1]+=e[1]
def dfs(p, bp=-1):
    while v[p]:
        c =v[p].popleft()
        if c ==bp:
            continue
        #print(p, c, bp)
        score[c]+=score[p]
        dfs(c, bp=p)
visited = [0]                
dfs(0)
print(*score)