Harryxun/stf_run huggingface dataset:
h,w = map(int, input().split(' '))
tbl = [list(map(int, input().split(' '))) for i in range(10)]
wf = [[10**18 for i in range(10)] for j in range(10)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            wf[i][j] = min(tbl[i][j], tbl[i][k]+tbl[k][j])
wall = [list(map(int, input().split(' '))) for i in range(h)]
ans = 0
for i in range(h):
    for j in range(w):
        num = wall[i][j]
        if num == -1:
            continue
        else:
            ans += wf[num][1]
print(ans)

### FIXED CODE ###

n=input()
if int(n[:3])%111==0 or int(n[1:])%111==0:
  print("Yes")
else:
  print("No")
from math import log, ceil
r = 26
ab = "abcdefghijklmnopqrstuvwxyz"
input = raw_input
n = int(input())

def answer(n):
    m = int(ceil(log(n*(r-1) + r, r))) - 1

    cur = r ** (m-1)
    out = ""
    for i in range(m):
        i = n // cur
        out = out + ab[i-1]
        n -= i * cur
        cur //= r
    return out

out = answer(n)
print(out)

### FIXED CODE ###

from math import log, ceil
r = 26
ab = "abcdefghijklmnopqrstuvwxyz"
input = raw_input
n = int(input())

def answer(n):
    m = int(ceil(log(n*(r-1) + r, r))) - 1

    #cur = r ** (m-1)
    out = ""

    sub = (r ** m - r) // (r-1)
    n = n - sub - 1
    for i in range(m):
        i = n % r
        out = ab[i] + out
        n //= r
        #i = n // cur
        #out = out + ab[i-1]
        #n -= i * cur
        #cur //= r
    return out

#for n in range(1, 676 + 26 + 2):
if True:
    out = answer(n)
    #print(n, out)
    print(out)
import math

a,b = map(int, input().split())
av = num =  a
n = 1
while num =< b:
  n+=1
  num = num+av-1
print(n)

### FIXED CODE ###

import math

a,b = map(int, input().split())
av = a
n = 0
num = 1
while num < b:
  n += 1
  num += av-1
print(n)
n=int(input())
x=""
While n != 0:
    x = str(n%2) + x
    n = -(n//2)
print(0 if x == "" else x)


### FIXED CODE ###

n=int(input())
x=""
while n != 0:
    x = str(n%2) + x
    n = -(n//2)
print(0 if x == "" else x)
import collections
def f(s):
  h = {('R','G'): 'B', ('B','G'): 'R', ('R','B'): 'G',('R','G')[::-1]: 'B', ('B','G')[::-1]: 'R', ('R','B')[::-1]: 'G', }

  c = collections.Counter()
  cc = [None] * (len(s)+1)
  cc[-1] = c
  for jj in range(len(s)-1,-1,-1):
    c[s[jj]]+=1
    cc[jj] = c
    res = 0
    for i in range(len(s)):
      for j in range(i+1, len(s)):
        if s[j] != s[i]:
          res += cc[j+1][h[(s[i],s[j])]]

  return res
raw_input()
print f(raw_input())


### FIXED CODE ###

import copy
import collections
def f(s):
    h = {('R','G'): 'B', ('B','G'): 'R', ('R','B'): 'G',('R','G')[::-1]: 'B', ('B','G')[::-1]: 'R', ('R','B')[::-1]: 'G', }
    c = collections.Counter()
    cc = [None] * (len(s)+1)
    cc[-1] = copy.deepcopy(c)
    for jj in range(len(s)-1,-1,-1):
        c[s[jj]]+=1
        cc[jj] = copy.deepcopy(c)


    res = 0
    for i in range(len(s)):
        for j in range(i + 1, len(s)):
            if s[j] != s[i]:
                res += cc[j+1][h[(s[i],s[j])]] 
                
                k = j + (j - i)
                if k < len(s) and s[k] == h[(s[i],s[j])]:
                    res -=1
    return res
raw_input()
print f(raw_input())
n=int(input())
l=list(map(int,input().split()))
b=True
for i in range(1,n):
  if l[-i]>=l[-i-1]:
    pass
  elif l[-i]=l[-1-i]+1:
    l[-1-i]=l[-1-i]-1
  else:
    b=False
    break
if b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
b=True
for i in range(1,n):
  if l[n-i]>=l[n-i-1]:
    pass
  elif l[n-i]==l[n-1-i]-1:
    p=l[n-1-i]
    l[n-1-i]=p-1
  else:
    b=False
    break
if b:
  print("Yes")
else:
  print("No")
x, n = map(int, input().split())
p = list(map(int, input().split()))
ans = 9999999999
lists = []
if n == 0:
    print(x)
    exit()
for i in range(1, 101):
    if not i in p:
        print(i)
        lists.append(i)
for i in lists:
    if ans > abs(x - i):
        ans = abs(x-i)
        m = i

print(m)


### FIXED CODE ###

x,n = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
li = []
ans = []
Min_sa = 9999999999
for i in range(-200,201):
    if i not in p:
        li.append(i)
for i in li:
     Min_sa = min(Min_sa,abs(x-i))
for i in li:
    if abs(x-i) == Min_sa:
        ans.append(i)
print(min(ans))
n = int(input())
a = list(map(int,input().split()))
al = [0 for i in range(n)]

for i in a:
    al[a[i]-1] += 1
for i in range(n):
    print(al[i])

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
al = [0 for i in range(n)]

for i in a:
    al[i-1] += 1
for i in range(n):
    print(al[i])
import math

N=int(input())
x=1
for i in range(N):
    t=int(input())
    x=(x*t)//math.gcd(x,t)
print(x)

### FIXED CODE ###

def gcd(a,b):
    #print(a)
    #print(b)
    if b==0:
        return a
    #a=a%b
    #b=a
    return gcd(b,a%b)

N=int(input())
x=1
for i in range(N):
    t=int(input())
    x=(x*t)//gcd(x,t)
print(x)
a = list(map(int,input().split()))
l = a[0] + a[1]
r = a[2] + a[3]
if l > r:
  print("Left")
elif l = r:
  print("Balanced")
else:
  print("Right")

### FIXED CODE ###

a = list(map(int,input().split()))
l = a[0] + a[1]
r = a[2] + a[3]
if l > r:
  print("Left")
elif l == r:
  print("Balanced")
else:
  print("Right")
N, Q = list(map(int, input().split()))
s = input()
lr = [list(map(int, input().split())) for i in range(Q)]

L = [0] * (N + 1)

for i in range(len(s)):
  if s[i] == "A" and s[i + 1] == "C":
      L[i + 1] = 1 + L[i]
  else:
      L[i + 1] = L[i]


for i in range(Q):
    print(L[lr[i][1] - 1] - L[lr[i][0] - 1])

### FIXED CODE ###

N, Q = list(map(int, input().split()))
s = input()
lr = [list(map(int, input().split())) for i in range(Q)]

L = [0] * (N + 1)

for i in range(N - 1):
  if s[i] == "A" and s[i + 1] == "C":
      L[i + 1] = 1 + L[i]
  else:
      L[i + 1] = L[i]


for i in range(Q):
    print(L[lr[i][1] - 1] - L[lr[i][0] - 1])
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
n = int(input())
print(lcm_base(2,n))

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
n = int(input())
print(lcm(2,n))
a = input().split()
if (a[0]*a[1])%2==0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a =input()
s =a.split()
if (int(s[0])*int(s[1]))%2==0:
    print("Even")
else:
    print("Odd")
import math
a, b, x = map(int, input().split())
h = x/a**2
tanth = a / (b - h) / 2
theta = math.degrees(math.atan(tanth))
print(90 - theta)

### FIXED CODE ###

import math
a, b, x = map(int, input().split())
h = x/a**2

if b == h:
    print(0)
elif h >= b/2:
    tanth = a / (b - h) / 2
    theta = math.degrees(math.atan(tanth))
    print(90 - theta)
else:
    tanth = 2 * a * h / b**2
    theta = math.degrees(math.atan(tanth))
    print(90 - theta)
n,q = [int(i) for i in input().split()]
s = input()
ac_loc = []
for i in range(n):
  if s[i] =='A':
    if s[i+1] == 'C':
      ac_loc.append(i)
      i+=1 

for i in range(q):
  l, r = [int(j) for j in input().split()]
  l -= 1
  r -= 1
  ans = sum((l<=j and j+1<=r) for j in ac_loc)
  print(ans)

### FIXED CODE ###

n,q = [int(i) for i in input().split()]
s = input()
l = []
r = []
for i in range(q):
  l_tmp, r_tmp = [int(j) for j in input().split()]
  l.append(l_tmp-1)
  r.append(r_tmp-1)
  
ac_cnt = s.count('AC')
r_cnt = [ac_cnt]
l_cnt = [0]
for i in range(1,n):
  if s[i-1:i+1] == 'AC':
    r_cnt.append(r_cnt[i-1]-1)
    l_cnt.append(l_cnt[i-1]+1)
  else:
    r_cnt.append(r_cnt[i-1])
    l_cnt.append(l_cnt[i-1])
    
for i in range(q):
  ans = r_cnt[l[i]] + l_cnt[r[i]] - ac_cnt
  print(ans)
n , k , q = map(int,input().split())
a = [int(input()) for x in range(q)]
P = [k-q]*n
for x in a:
    P[x] +=1

ans = '\n'.join('No'if x <=0 else 'Yes' for x in P[1:])
print(ans)


### FIXED CODE ###

n , k , q = map(int,input().split())
a = [int(input()) for x in range(q)]
P = [k-q]*(n+1)
for x in a:
    P[x] +=1

ans = '\n'.join('No'if x <=0 else 'Yes' for x in P[1:])
print(ans)
while 1:
	H, W = map(int, raw_input().split())
	if H == 0 and W == 0:
		print
		break
	if counter > 0:
		print
	for i in xrange(H):
		for j in xrange(W):
			if j == (W - 1):
				print '#'
			else:
				print '#',
	print

### FIXED CODE ###

data = []
while 1:
	H, W = map(int, raw_input().split())
	if H == 0 and W == 0:
		break
	data.append([H, W])

for h, w in data:
	for i in xrange(h):
		print '#' * w
	print
n=input()
n.remove('Buzz')
n.remove('Fizz')
n.remove('FizzBuzz')
print(sum(n))

### FIXED CODE ###

n=int(input())
a=1
b=0
while True:
	if a%3!=0 and a%5!=0:
		b+=a
	if a==n:
		break
	a+=1
print(b)
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

dish = [a,b,c,d,e]
result=0

mx=-1

for dd in dish:
    for i in range(1,10):
        if (dd+i) % 10 == 0:
            tmp=i
            break
    if tmp >= mx:
        mx = tmp
        buf=dd

dish.remove(buf)

for i in range(4):
    result+=dish[i]
    for j in range(1,10):
        if result % 10 ==0:
            break
        result+=1

print(result+buf)

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

dish = [a,b,c,d,e]
result=0

mx=-1

for dd in dish:
    for i in range(0,10):
        if (dd+i) % 10 == 0:
            tmp=i
            break
    if tmp > mx:
        mx = tmp
        buf=dd

dish.remove(buf)

for dd in dish:
    result+=dd
    for i in range(1,10):
        if result % 10 == 0:
            break
        result+=1
        
print(result+buf)
a,b=input()
print(a*b if a<10 and b<10 else -1)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b if a<10 and b<10 else -1)
n=int(input())
a = []
for i in range(n):
    a.append(input())
a_count = [a.count(i) for i in a]
print('\n'.join(sorted(set([a[i] for i in range(len(a_count)) if a_count[i] == max(a_count)])))



### FIXED CODE ###

d=dict()
for i in range(int(input())):
    s=input()
    if s not in d:
        d[s]=1
    else:
        d[s]+=1
max_v = max(d.values())
print(*sorted([kv[0] for kv in d.items() if kv[1] == max_v]))
import numpy as np
def input_one_number():
    return int(input())
 
def input_multiple_number():
    return map(int, input().split())
 
def input_multiple_number_as_list():
    return list(map(int, input().split()))

a,b,h,m=input_multiple_number()

rad=np.deg2rad(min(abs(h*30-m*5.5),360-(abs(h*30-m*5.5))))

ans=np.sqrt(pow(a,2)+pow(b,2)-2*a*b*np.cos(rad))
print(ans)

### FIXED CODE ###

import numpy as np
def input_one_number():
    return int(input())
 
def input_multiple_number():
    return map(int, input().split())
 
def input_multiple_number_as_list():
    return list(map(int, input().split()))

a,b,h,m=input_multiple_number()

rad=np.deg2rad(min(abs(h*30-m*5.5),360-(abs(h*30-m*5.5))))

ans=np.sqrt(pow(a,2)+pow(b,2)-2*a*b*np.cos(rad))
print(ans)
N = int(input())
a = [int(i) for i in input().split()]
b = [0] * N
for i in range(N):
    b[a[i]] += 1

ans = 0

for i in range(N):
    if b[i] < i:
        ans += b[i]
    else:
        ans+= b[i] - i
print(ans)

### FIXED CODE ###

N = int(input())
a = [int(i) for i in input().split()]
b = [0] * (N + 1)
ans = 0
for i in range(N):
    if a[i] <= N:
        b[a[i]] += 1
    else:
        ans += 1

for i in range(N + 1):
    if b[i] < i:
        ans += b[i]
    else:
        ans+= b[i] - i
print(ans)
a = int(intput())

print(a + a*a + a*a*a)

### FIXED CODE ###

a = int(input())

print(a + a*a + a*a*a)
a,b,c=map(int,input().split())
if (a,b)==(0,0):
  print(a,b)
  exit(0)
if(a-k<0):
  print(0,max(k-abs(a-b))
else:
        print(a,b)

### FIXED CODE ###

a, b, k = map(int, input().split())
if (a, b) == (0, 0):
    print(0, 0)
    exit(0)
if a - k < 0:
    print(0, max(0, b - (k-a)))
else:
    print(a-k, b)
import heapq
n, q = map(int, input().split())
event = []
for _ in range(n):
    s, t, x = map(int, input().split())
    event.append((s-x, 1, x))
    event.append((t-x, -1, x))

event.sort(key=lambda y: y[0])
heap = []
xs = set([])

d = [int(input()) for _ in range(q)]
ans = [-1] * q
index = 0
for t, query, x in event:
    if d[index] < t:
        if not xs:
            pass
        else:
            while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(tmp)
                    ans[index] = tmp
                    break
            print("----------")
        index += 1
        if index == q:
            break

    if query == 1:
        xs.add(x)
        heapq.heappush(heap, x)
    else:
        
        xs.remove(x)
    

print("\n".join(map(str, ans)))





### FIXED CODE ###

import heapq
n, q = map(int, input().split())
event = []
for _ in range(n):
    s, t, x = map(int, input().split())
    event.append((s-x, 1, x))
    event.append((t-x, -1, x))

event.sort()
heap = []
xs = set([])

d = [int(input()) for _ in range(q)] + [10**9 + 7]
ans = [-1] * q
index = 0
for t, query, x in event:
    while d[index] < t:
        if not xs:
            pass
        else:
            while heap:
                tmp = heapq.heappop(heap)
                if tmp in xs:
                    heapq.heappush(heap, tmp)
                    ans[index] = tmp
                    break
        index += 1

    if query == 1:
        xs.add(x)
        heapq.heappush(heap, x)
    else:
        xs.remove(x)


while index < q:
    while heap:
        tmp = heapq.heappop(heap)
        if tmp in xs:
            heapq.heappush(heap, tmp)
            ans[index] = tmp
            break
    index += 1

print("\n".join(map(str, ans)))
N = int(input())
ls = [0]*10000


for i in range(1,42):
    for j in range(1,42):
        for k in range(1,42):
            t = i**2 + j**2 + k**2 + i*j + j*k + k*i 
            ls[t-1] = ls[t-1] + 1

for p in range(0,N):
    print(ls[p])

### FIXED CODE ###

N = int(input())
ls = [0]*(N+2)

for i in range(1,151):
    for j in range(1,151):
        for k in range(1,151):
            t = i*i + j*j + k*k + i*j + j*k + k*i 
            if t <= N :
                ls[t] += 1

for p in range(1,N+1):
    print(ls[p])
n=int(input())
p=sorted(list(map(int,input().split())))
s=[]
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
flag = True
for x in p:
    if prev == x and flag:
        s.pop()
        flag = False
        continue
    if a[x]:
        s.append(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x
    flag = True

print(len(s))

### FIXED CODE ###

n=int(input())
p=sorted(list(map(int,input().split())))
s=set()
m = 10**6+1
a=[True for _ in range(m)]
prev = 0
for x in p:
    if prev == x:
        s.discard(x)
        continue
    if a[x]:
        s.add(x)
    i = 2
    y = i*x
    while y<m:
        a[y] = False
        i+=1
        y = i*x
    prev=x

print(len(s))
A, B = map(int, input().split())
print(max(A- 2*b, 0))

### FIXED CODE ###

A, B = map(int, input().split())
print(max(A- 2*B, 0))
a = [list(map(int, input().split())) for i in range(2)]
k = a[0][1]

num_list = a[1]

positive_list = []
negative_list = []

ans_positive = []
ans_negative = []

ans_list = []

for _ in num_list:
    if _ > 0:
        positive_list.append(_)
    elif _ < 0:
        negative_list.insert(0, _)
    else:
        if num_list != [0]:
        k -= 1

for _ in list(range(len(positive_list))):
    if not 0 <= k - _ - 2 < len(negative_list):
        continue
    ans_positive.append(2 * positive_list[_] - negative_list[k - _ - 2])

for _ in list(range(len(negative_list))):
    if not 0 <= k - _ - 2 < len(positive_list):
        continue
    ans_negative.append(-2 * negative_list[_] + positive_list[k - _ - 2])

if ans_positive:
    ans_list.append(min(ans_positive))

if ans_negative:
    ans_list.append(min(ans_negative))

if k <= len(positive_list):
    ans_list.append(positive_list[k - 1])

if k <= len(negative_list):
    ans_list.append(-1 * negative_list[k - 1])

if ans_list == []:
    print(0)

else:
    print(min(ans_list))

### FIXED CODE ###

a = [list(map(int, input().split())) for i in range(2)]
k = a[0][1]

num_list = a[1]

positive_list = []
negative_list = []

ans_positive = []
ans_negative = []

ans_list = []

for _ in num_list:
    if _ > 0:
        positive_list.append(_)
    elif _ < 0:
        negative_list.insert(0, _)
    else:
        if num_list != [0]:
            k -= 1

for _ in list(range(len(positive_list))):
    if not 0 <= k - _ - 2 < len(negative_list):
        continue
    ans_positive.append(2 * positive_list[_] - negative_list[k - _ - 2])

for _ in list(range(len(negative_list))):
    if not 0 <= k - _ - 2 < len(positive_list):
        continue
    ans_negative.append(-2 * negative_list[_] + positive_list[k - _ - 2])

if ans_positive:
    ans_list.append(min(ans_positive))

if ans_negative:
    ans_list.append(min(ans_negative))

if k <= len(positive_list):
    ans_list.append(positive_list[k - 1])

if k <= len(negative_list):
    ans_list.append(-1 * negative_list[k - 1])

if ans_list == []:
    print(0)

else:
    print(min(ans_list))
S = input()

keyword = 'keyence'
cnt = 0
for moji in S:
    if moji == keyword[0]:
        cnt += 1
        keyword = keyword[1:]

if cnt == 7:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

S = input()

keyword = 'keyence'
if (S[:7] == keyword) or (S[-7:] == keyword):
    print('YES')
    exit()

f, b = 0, 0
# forward
for i, (key, s) in enumerate(zip(keyword, S)):
    if key != s:
        f = i
        break
    else:
        # keyword = keyword[1:]
        pass
# print(keyword)
# backward
for i, (key, s) in enumerate(zip(keyword[::-1], S[::-1])):
    # print(key, s)
    if key != s:
        b = i
        break
    else:
        keyword = keyword[1:]

# print(f, b)
if f + b > 6:
    print('YES')
else:
    print("NO")
import sys
input = sys.stdin.readline

N, M, K = map(int, input().split())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))

time = 0
A_num = 0
B_num = 0
A_len = len(A_list)
B_len = len(B_list)
while (time <= K) and (A_num != A_len or B_num != B_len):
    if A_num >= A_len:
        B = B_list[B_num]
        time += B
        B_num += 1

    elif B_num >= B_len:
        A = A_list[A_num]
        time += A
        A_num += 1
    else:
        A = A_list[A_num]
        B = B_list[B_num]
        if A < B:
            time += A
            A_num += 1

        elif A > B:
            time += B
            B_num += 1

        else:
            add = 1
            time += A
            while (A_list[A_num + add] == B_list[B_num + add]) and \
                  (time < K):
                time += A_list[A_num + add]
                add += 1
            if A_list[A_num + add] < B_list[B_num + add]:
                A_num += add
            else:
                B_num += add
    print(time)
print(A_num + B_num)

### FIXED CODE ###


import sys
import numpy as np
input = sys.stdin.readline

N, M, K = map(int, input().split())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))


A_list.insert(0, 0)
B_list.insert(0, 0)
A_cumsum = np.cumsum(A_list)
B_cumsum = np.cumsum(B_list)

time = B_cumsum[-1]
ans, j = 0, M



for i in range(N+1):
    if A_cumsum[i] > K:
        break
    while B_cumsum[j] > K - A_cumsum[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
from bisect import bisect_left

n = input()
ls = list(map(int, input().split())).sort()
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

### FIXED CODE ###

import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n - 2):
  for j in range(i + 1, n - 1):
    bi = bisect.bisect_left(li, li[i] + li[j])
    count += bi - j - 1
print(count)
#include<cstdio>
using namespace std;
 
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if((a<b)&&(b<c))puts("Yes");
else puts("No");
return 0;
 
}

### FIXED CODE ###

a,b,c=map(int,raw_input().split())
if a<b<c:
    print "Yes"
else :
    print "No"
N = input()
N = int(N)

if N ==1:
    print(N) 
elif N%2 == 0:
    a = 0.5
    a = float(a)
elif N % 2 == 1:
    a = (N/2 + 1)/N

print(a)
    

### FIXED CODE ###

A = input()
N = int(A)


if N ==1:
    a = 1
elif N%2 == 0:
    a = 0.5
    a = float(a)
elif N%2 == 1:
    a = (N//2 + 1)/N

print(a)
while True:
    #審判の数
    n = int(input())
    if n == 0:
        break
    while n >= 3 and n <= 100: #審判の数は３〜１００人
        a = [0]*n               #空いてる配列
        for i in range(n):       #空いてる配列に点数を入れる
            s = int(input())
            a[i] = s
        tensu = (sum(a) - min(a) -max(a))/(len(a)-2) #一番でかい点数と一番小さい点数は一つずつ引いて平均
        print(int(tensu))        #平均点！


### FIXED CODE ###

while True:
    #審判の数
    n = int(input())
    if n == 0:
        break
    a = [0]*n               #空いてる配列
    for i in range(n):       #空いてる配列に点数を入れる
        s = int(input())
        a[i] = s
    tensu = (sum(a) - min(a) -max(a))/(len(a)-2) #一番でかい点数と一番小さい点数は一つずつ引いて平均
    print(int(tensu))        #平均点！
N=input()
brac = raw_input()
ans = brac

while '()' in brac:
	brac=brac.replace('()','')

left=brac.count('(')
right=brac.count(')')

print '('*right +ans +')'*left

### FIXED CODE ###

if int(('').join(raw_input().split(' ')))%4==0:
	print('YES')
else:
	print('NO')
a, b = (int, input().split())
print("Even" if a * b % 2 == 0 else "Odd")

### FIXED CODE ###

a, b = map(int, input().split())
print("Even" if a * b % 2 == 0 else "Odd")
miu = input().split()
sella = input()

for x in sella:
	if x == int(miu[1]):
		print(x.lower(), end='')
    else:
		print(x, end='')

### FIXED CODE ###

miu = input().split()
sella = input()

for x in range(0, int(miu[0])):
	if x == int(miu[1])-1:
		print(sella[x].lower(), end='')
	else:
		print(sella[x], end='')
s = input()

char_number = len(s)

start = s[0]
end   = s[-0]

answer = start + str(char_number - 2)in + end
print(answer)

### FIXED CODE ###

s = input()

char_number = len(s)

start = s[0]
end   = s[-1]

answer = start + str(char_number - 2) + end
print(answer)
import string
l = string.ascii_uppercase

N = int(input())
S = input()

ans = []
plusNumber = N % 26
for c in S :
    ans.append(l[l.index(c) + plusNumber])
print("".join(ans))

### FIXED CODE ###

import string
l = string.ascii_uppercase

N = int(input())
S = input()

ans = []
for c in S :
    plusNumber = (l.index(c) + N) % 26
    ans.append(l[plusNumber])
print("".join(ans))
N = int(input())
A = list(map(int,input().split()))
x = [0 for _ in range(N)]
for i in range(1,N):
  if A[i] < A[i-1] + x[i-1]:
    x[i] = A[i-1] + x[i-1] - A[i]
print(sum(x_list))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
x = [0 for _ in range(N)]
for i in range(1,N):
  if A[i] < A[i-1] + x[i-1]:
    x[i] = A[i-1] + x[i-1] - A[i]
print(sum(x))
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve( lst_a, lst_b,n):
    if n.count("-")==1:
        answer= "No"
    else:
        N,NN=n.split("-")
        if lst_a == len(N) and lst_b == len(NN):
            answer = "Yes"
        else:
            answer = "No"
    return answer

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve( lst_a, lst_b,n):
    if n.count("-")!=1:
        answer= "No"
    else:
        N,NN=n.split("-")
        if lst_a == len(N) and lst_b == len(NN):
            answer = "Yes"
        else:
            answer = "No"
    return answer

# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line1 = sys.stdin.readline().rstrip()
    [str_n, str_i] = line1.split(' ')
    line2 = sys.stdin.readline().rstrip()
    return (int(str_n), int(str_i), line2)

def main():
    n, i, s = readQuestion()
    answer = solve(n, i, s)
    print(answer)
    
if __name__ == '__main__':
    main()