peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt1=[0]*n
cnt2=[0]*n
for i in range(n):
    if a[i]>b[i]:
        cnt2[i]=a[i]-b[i]
    else:
        num4=b[i]-a[i]
        cnt1[i]=-(num4//-2)
        cnt2[i]=num4%2
num5=abs(sum(a)-sum(b))
if max(sum(cnt1),sum(cnt2))+abs(sum(cnt1)-sum(cnt2))<=num5:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = str(input().split())
i = 0 + 2
while True:
    if s[i] == s[i + 1]:
        print_ans = 'Bad'
        break
    else:
        print_ans = 'Good'
    i += 1
    if i == 3 + 2:
        break
    
print(print_ans)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
        print("Rainy")
else:
            print("Sunday")
# Judge status: Accepted
a, b = [int(i) for i in input().split()]

if a > 0:
    print("Positive")
elif a == 0:
    print("Zero")
else:
    if b >= 0:
        print("Zero")
    else:
        if (b - a) % 2 == 0:
            print("Negative")
        else:
            print("Positive")
# Judge status: Accepted
N = int(input())
ans = 0
for i in range(1, N):
  ans += (N-1) // i

print(ans)
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
if a > b :
         print(0)
         exit()
elif n == 1 and a != b:
         print(0)
         exit()
else:
         print((b-a)*2+1)
# Judge status: Wrong Answer
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
tmp=0
for a,b in ab:
  tmp+=b
  if tmp>=k:
    print(a) 
    exit()
# Judge status: Wrong Answer
n, k = map(int, input().split())
buff = n

while True:
  n -= k
  if n <= 0:
    n = abs(n)
    break

print(n)
# Judge status: Wrong Answer
N = int(input())
h = input().split()
h = [int(i) for i in h]
dp = [10**7] * 10**5
dp[0] = 0

for i in range(1, N):
    dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i-2]))
print(dp[N-1])
# Judge status: Accepted
a = input()
if a[0] == "7" or a[1] == "7" or a[2] == "7":
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b = map(int,input().split())
result =a+b

if result > 24:
    
    print(result-24)
else:
    print(result)
# Judge status: Accepted
def main():
    s = input().split()[1]
    print('A{}C'.format(s[0]))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
s = input()
s.replace('hi', '')
if s:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

a, b, c, d = map(int, input().split())

lcm = c * d // gcd(c, d)

b_c = b - b // c
b_d = b - b // d
b_cd = b - b // lcm
z_to_b = b_c + b_d - b_cd

am1 = a-1
a_c = am1 - am1 // c
a_d = am1 - am1 // d
a_cd = am1 - am1 // lcm
z_to_a = a_c + a_d - a_cd

print(z_to_b - z_to_a)
# Judge status: Wrong Answer
def main():

    N = int(input())
    A = list(map(int, input().split()))
    if len(A) == len(set(A)):
        return 'YES'
    return 'No'

if __name__ == '__main__':
    print(main())
# Judge status: Accepted
def main():
    from string import ascii_lowercase

    c = input()
    idx = ascii_lowercase.index(c)
    print(ascii_lowercase[idx + 1])


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()

# int(input())
# map(int, input().split())
# Judge status: Wrong Answer
def resolve():
    S = input()
    cnt = 0
    maxC = 0
    for s in S:
        if s in "ACGT":
            cnt += 1
        else:
            maxC = max(maxC, cnt)
            cnt = 0
    print(maxC)


resolve()
# Judge status: Wrong Answer
N, x = map(int, input().split())
A = list(map(int, input().split()))

if len(A) % 2 == 0:
    A = A + [0]
# print('A', A)

ans = 0
for i in range(1, N, 2):
    total = A[i - 1] + A[i]
    diff = total - x
    if diff <= 0:
        continue
    v1 = min(A[i], diff)
    v2 = diff - v1
    A[i] -= v1
    A[i - 1] -= v2
    ans += v1 + v2
    # print('A', A)
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
 
a.sort()
for i in range(n-1):
    a[i+1] = (a[i] + a[i+1] / 2)

print(a[-1])
# Judge status: Accepted
"""
input(): 入力を文字列として1行取ってくる
"文字列".split(): 文字列をパースする（空白などで分割する）
    例："2 3 4 5"　をsplitしたら、[2, 3, 4, 5] に分割する
map(型, list): list の中身をそれぞれ指定した型で変数に入れる
"""
N, M = map(int, input().split())

if N == M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    s = input()
    if s == "ABC":
        print("ARC")
    else:
        print("ABC")
main()
# Judge status: Wrong Answer
i, j = map(int, input().split())

if (i + j) % 3 != 0 or (max(i, j) / min(i, j) >= 2):
  print(0)
else:
  TW = (i + j) // 3
  W = (TW - (i-j)) // 2

  def mod_cmb(n, r, mod=10**9+7):
      r = min(r, n-r)
      res = 1
      for i in range(r):
          res = res * (n - i) % mod * pow(i+1, mod-2, mod) % mod
      return res

  print(mod_cmb(TW, W))
# Judge status: Wrong Answer
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=a+b
c.sort()
i=0
sum=0
flag=0
while i<(n+m):
  sum=sum+c[i]
  i=i+1
  if sum<=k:
    flag=flag+1
  else:
    break
print(flag)
# Judge status: Wrong Answer
s=input()
print(len(s))
for i in range(len(s)):
    if s[i]=="h":
        if i<len(s)-1:
            if s[i+1]=="i":
                print("Yes")
                break
print("No")
# Judge status: Wrong Answer
s=input()
res=0
t=1
p=[0]*2019
for i in map(int,s[::-1]):
  res+=i*t
  res%=2019
  p[res]+=1
  t*=10
  t%=2019
print(p[0]+sum((i*(i-1)//2) for i in p[1:]))
# Judge status: Accepted
from numba import njit


@njit
def main(X):
    for a in range(-2000, 2001):
        for b in range(-2000, 2001):
            if pow(a, 5) - pow(b, 5) == X:
                print(a, b)
                return


if __name__ == '__main__':
    X = int(input())
    main(X)
# Judge status: Accepted
a = set(list(map(int, input().split())))
print(len(a))
# Judge status: Accepted
#29 C - Flip,Flip, and Flip......
N,M = map(int,input().split())
N,M = min(N,M), max(N,M)

if N == 1 and M == 1:
    ans = 1
elif N == 1 and M != 1:
    ans = M - 2
elif N == 2 :
    ans = 0
else:
    ans = M*N - (2*M + 2*N) + 4
print(ans)
# Judge status: Accepted
n = int(input())

ans = 0
base = 1
n = -n
while (n != 0):
   p = abs(n % (-2))
   n = (n + p) // (-2)
   ans += p * base
   base *= 10

print(ans)
# Judge status: Wrong Answer
import sys, string
c = sys.stdin.readline().rstrip()
a = string.ascii_lowercase
i = a.index('c') + 1
print(a[i])
# Judge status: Accepted
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse=True)
t = 0
for i in range(n):
    t += a[i]

if a[m-1] >= t/(4*m):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s = input()
arr = ["SUN","Mon","TUE","WED","THU","FRI","SAT"]
for i in range(7):
    if s==arr[i]:
        print(7-i)
# Judge status: Accepted
from collections import deque
n,m=map(int,input().split())
node=[[] for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    node[b-1].append(a-1)
    node[a-1].append(b-1)
distance=[-1]*n
distance[0]=0

d=deque()
d.append(0)
while d:
    v=d.popleft()
    for i in node[v]:
        if distance[i]!=-1:
            continue
        distance[i]=v+1
        d.append(i)
print('Yes')
for i in range(1,n):
    print(distance[i])
# Judge status: Accepted
S = list(input())
S[3] = '8'
print(''.join(S))
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A,reverse=True)
for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])
# Judge status: Accepted
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
q,l,r = 0,0,0
for _ in range(n):
  b = int(input())
  for i in range(3):
    if b in a[i]:
      a[i][a[i].index(b)]=0
                
for i in range(3):
  l += a[i][i]
  t,y = 0,0
  for j in range(3):
    y += a[j][i]
    t += a[i][j]
    if i+j == 2:
      r += a[i][j]
  if not t or not y:
    q=1

print('Yes' if q or not l or not r else 'No')
# Judge status: Accepted
input()
L=sorted(map(int,input().split()))[::-1]
print("Yes" if L[0]<sum(L[1:]) else "No")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M, K = mapint()
s = set()
for i in range(N+1):
    for j in range(M+1):
        s.add(i*M+j*N-i*j*2)

if K in s:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x,y=map(int,input().split())
#x匹でy本
if y<2*x or 4*x>y:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
import math
S,A,B=map(int,input().split())

q=S//(A+B)
mod=S%(A+B)

if mod>=A:
    print(q*A+A)
else:
    print(q*A+mod)
# Judge status: Accepted
n, k = map(int, input().split())
h = [0] * n


for i in range(n):
    h[i] = int(input())


h.sort()
arr = []
for i in range(n-k+1):
    arr.append(abs(h[i] - h[i+k-1]))

print(min(arr))
# Judge status: Accepted
a, b, x = map(int, input().split())

#a to a+b
if x >= a and x <= a + b:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
a,b = input().split()
a = int(a)
b = int(b)
if(a==b):
    print("Yes")
else:
	print("No")
# Judge status: Accepted
p=0
n=int(input())
for i in range(1,50):
    p+=n//(2*(5**i))
print(p if n%2==0 else 0)
# Judge status: Accepted
import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a, b, c = sorted(a), sorted(b), sorted(c)

ans = 0
for i in b:
    up_index = bisect.bisect_left(a,i)
    down_index = bisect.bisect_right(c,i)
    ans += up_index * (n-down_index)

print(ans)
# Judge status: Accepted
s=str(input())
numbers=[]
for i in s:
    numbers.append(i)
    

##3print(numbers)

count=0
for number in numbers:
    if number=='1':
        count+=1
        
print(count)
# Judge status: Accepted
#abc171a
c=input()
if c.islower():
 print('a')
else:
 print('A')
# Judge status: Wrong Answer
mod = 10**9+7
N = int(input())
if N == 1:
    print(0)
    exit()
plus = 1
minus = 1
cap = 1
for _ in range(N):
    plus *= 10
    minus *= 9
    cap *= 8
    plus %= mod
    minus %= mod
    cap %= mod
print(plus-2*minus+cap)
# Judge status: Accepted
a = list(map(int, input().split()))
k = int(input())

a.sort()

print(sum(a[:-1]) + a[-1] * 2 ** k)
# Judge status: Accepted
X = int(input())

more_100 = X/100
under_100 = X%100
X2 = int(under_100 / 5)
X3 = under_100 % 5
if X3 != 0 and X2 + 1 <= more_100:
  print(1)
elif X3 == 0 and X2 <= more_100:
  print(1)
else:
  print(0)
# Judge status: Wrong Answer
S,W=map(int,input().split())
if (W>=S):
    print('Unsafe')
else:
    print('Safe')
# Judge status: Wrong Answer
INF = 10**6

H, N = map(int, input().split())
magics = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[INF]*(H+1) for _ in range(N+1)]
dp[0][0] = 0
for i, (a, b) in enumerate(magics):
    for j in range(H+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][min(H, j+a)] = min(dp[i+1][min(H, j+a)], dp[i+1][j] + b)
print(dp[N][H])
# Judge status: Accepted
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

# import numpy as np
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
SP = [(x.split()[0].decode('utf8'), int(x.split()[1])) for x in readlines()]
SPs = sorted((name, -pt, i + 1) for i, (name, pt) in enumerate(SP))
print('\n'.join(str(a[2]) for a in SPs))
# Judge status: Accepted
n = int(input())
a = [int(_) for _ in input().split()]

mode = 0
ans = 1
for i in range(0, n-1):
    if mode == 0:
        if a[i] < a[i+1]:
            mode = 1
        elif a[i] > a[i+1]:
            mode = 2
    elif mode == 1:
        if a[i] > a[i+1]:
            ans += 1
            mode = 0
    else:
        if a[i] < a[i+1]:
            ans += 1
            mode = 0

print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 18:54:16 2020

@author: Kanaru Sato
"""

n = int(input())
Dict = {}
ans = 0

for i in range(n):
    s = list(input())
    s.sort()
    s = "".join(s)
    if s in Dict:
        ans += Dict[s]
        Dict[s] += 1
    else:
        Dict[s] = 1

print(ans)
# Judge status: Wrong Answer
from collections import deque

S = deque(input())
T = deque(input())

for _ in range(len(S)):
    if S == T:
        print('Yes')
        break
else:
    print('No')
# Judge status: Wrong Answer
a=input()
if a[-1]==2 or a[-1]==4 or a[-1]==5 or a[-1]==7 or a[-1]==9:
    print('hon')
if a[-1]==0 or a[-1]==1 or a[-1]==6 or a[-1]==8:
    print('pon')
if a[-1]==3:
    print('bon')
# Judge status: Wrong Answer
N = int(input())
L = list(map(int, input().split()))
s = 0

nL = sorted(L)
print(nL)
for i in range(0, N-2):
	for j in range(i+1, N-1):
		s += sum(x<nL[i]+nL[j] for x in nL[j+1:])
		
print(s)
# Judge status: Wrong Answer
l=list(map(int,input().split()))
if l[1]<0 and l[3]<0:
	print(l[0]*l[2])
elif l[1]<0:
	print(l[1]*l[2])
elif l[3]<0:
	print(l[0]*l[3])
else:
	print(l[1]*l[3])
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
from collections import deque
def main():
    n = int(input())
    a = list(map(str, input().split()))
    b = deque([])
    for i in range(1,n+1):
        if i%2 == 1:
            b.append(a[i-1])
        else:
            b.appendleft(a[i-1])
    if n%2 == 1:
        print(" ".join(sorted(b, reverse = True)))
    else:
        print(" ".join(b))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
*A, = map(int, input().split())

Asum = [a for a in A]
for i in range(N-1, -1, -1):
    Asum[i] += Asum[i+1]

ans = 0
v = 1  # 子になれる頂点数
for i in range(N+1):
    if v < A[i]:
        ans = -1
        break

    ans += v
    p = v-A[i]
    if i < N:
        v = min(Asum[i+1], 2*p)

print(ans)
# Judge status: Wrong Answer
N,K=list(map(int,input().split()))
src=[n for n in range(N+1)]
t=sum(src[-K+1:])
m=sum(src[:K-1])-1
ans=0
for n in range(N+2-K):
  t+=src[-K-n]
  m+=src[K+n-1]
  a=t-m
  ans+=a
print(ans%(10**9+7))
# Judge status: Accepted
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]


for i in range(N):
    tmp = []
    for j in range(M):
        tmp.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))
    print(tmp.index(min(tmp))+1)
# Judge status: Accepted
from fractions import gcd
def main():
    n = int(input())
    m = int(input())
    for _ in range(n-1):
        t = int(input())
        m = m*t//gcd(m,t)

    print(m)

if __name__ == "__main__":
    main()
# Judge status: Accepted
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = [input() for _ in range(n)]
m = int(input())
b = [input() for _ in range(m)]
c = list(set(a))
ans = 0
for i in c:
    if a.count(i) > b.count(i): ans = max(ans,a.count(i) - b.count(i))
print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
*D,=input().split()
ok=1
while ok:
    ans=list(str(N))
    ok=0
    for a in ans:
        if a in D:
            ok=1
    N+=1
print(''.join(ans))
# Judge status: Accepted
a, b, c, d = map(int, input().split())

A = a*c
B = a*d
C = b*c
D = b*d


print(max([A, B, C, D]))
# Judge status: Accepted
def resolve():
    '''
    code here
    '''
    S = input()

    ans1 = 0
    res1 = 0
    ans2 = 1
    res2 = 0
    for item in S:
        item = int(item)
        if ans1%2 != item:
            res1 += 1
        if ans2%2 != item:
            res2 += 1

        ans1 += 1
        ans2 += 1

    print(min(res2, res1)) 


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    ans = int(N ** 0.5) ** 2
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
n, a, b = map(int, input().split())
strings = input()
lists = ['No'] * len(strings)
remain = a + b
b_remain = b
for i in range(len(strings)):
  if strings[i] == 'a':
    if remain > 0:
      lists[i] = 'Yes'
      remain = remain - 1
  elif strings[i] == 'b':
    if b_remain > 0:
      lists[i] = 'Yes'
      remain = remain - 1
      b_remain = b_remain - 1
  else:
    pass
for i in lists:
  print(i)
# Judge status: Accepted
import itertools

def main():
    N = int(input())
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))

    p = 0
    q = 0
    count = 0
    for i in itertools.permutations([i+1 for i in range(N)]):
        if P == list(i):
            p = count + 1
        if Q == list(i):
            q = count + 1
        count += 1
    print(abs(p-q))

    return 0
if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(int, input().split())
if a < 0:
    if b >= 0:
        print("Zero")
    else:
        if (a+b)%2:
            print("Positive")
        else:
            print("Negative")
elif a == 0:
    print("Zero")
else:
    print("Positive")
# Judge status: Wrong Answer
a,b=map(int,input().split())
s=0
for i in range(b-a+1):
  s=s+i
print(s-a)
# Judge status: Wrong Answer
N, A, B, C, D = map(int, input().split())
S = input()
if '##' in S:
    print('No')
    exit()
if C > D:
    if '...' in S[B-2:D + 1]:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")
# Judge status: Accepted
def main():
    N = int(input())
    words = list()
    rule = True
    for _ in range(N):
        word = input()
        if len(words) > 0:
            if words[-1][-1] != word[0]:
                rule = False
        if word not in words:
            words.append(word)
        else:
            rule = False
    if rule == True:
        print("Yes")
    else:
        print("No")
main()
# Judge status: Accepted
s,t = map(str,input().split())

print(t+s)
# Judge status: Wrong Answer
n = int(input())
_list = []

for _ in range(n):
    _list.append(int(input()))

_set = set(_list)
sort_list = sorted(list(_set))

if len(sort_list) != 1:
    first = sort_list[-1]
    second = sort_list[-2]

    for i in range(n):
        if _list[i] != first:
            print(first)
        else:
            print(second)

else:
    first = sort_list[0]

    for _ in range(n):
        print(first)
# Judge status: Accepted
n, m = map(int,input().split())
A = list(map(int,input().split()))

total = sum(A)

th = total/(4*m)
A = sorted(A,reverse=True)

ans = 'Yes'
for i in range(m):
  if A[i] >= th:
    continue
  else:
    ans = 'No'
  

print(ans)
# Judge status: Accepted
a, b, c, k = map(int,input().split())
print("Unfair" if abs(a-b) >= 1e18 else a-b if k % 2 == 0 else b-a)
# Judge status: Accepted
N = input()

f = int(N[0])
res = (len(N) - 1) * 9 + f - 1
s = 0
for i in N:
    s += int(i)

print(max(res, s))
# Judge status: Wrong Answer
n= int(input())
l=list(map(int, input().split()))
i = 1
c= 0
for a in l:
    if a==1:
        i+=1
    else:
        c+=1
print(c if c!=n else -1)
# Judge status: Wrong Answer
a,b = map(int,input().split())
ans = (a+b)/2
if ans%1==0:
  print(ans)
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
a,b,c,d = map(int,input().split())
if (abs(a-b) <= d and abs(b-c) <= d) or abs(a-c)<=d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
H,M,HH,MM,K=map(int,input().split())

hour = HH - H -1
minute=60+MM-M
time = hour * 60 + minute - K

print(time)
# Judge status: Accepted
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

# import numpy as np
import itertools

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N, X, *L = map(int, read().split())

Lcum = itertools.accumulate(L)

answer = sum(i <= X for i in Lcum)
print(answer + 1)
# Judge status: Wrong Answer
N = int(input())
A = [int(T) for T in input().split()]
L = [0]*(N+1)
R = [sum(A)]*(N+1)
for T in range(0,N):
    L[T+1] = L[T]+A[T]
    R[T+1] = R[T]-A[T]
MIN = 10**9
for T in range(1,N):
    if abs(L[T]-R[T])<MIN:
        MIN = abs(L[T]-R[T])
print(MIN)
# Judge status: Accepted
mod = 1e9+7
n, k = list(map(int, input().split()))
count = 0
for i in range(k, n+2):
    count += i*(2*n-i+1)//2 - (i*(i-1)//2-1)
print(int(count%mod))
# Judge status: Accepted
print('NO' if int(''.join(input().split())) % 4 else 'YES')
# Judge status: Accepted
input();s=t=input();l,r=p='()'
exec("t=t.replace(p,'');"*50)
c=t.count;print(l*c(r)+s+r*c(l))
# Judge status: Accepted
A,B = map(int,input().split())
if A==1 :
    A = 14
if B == 1:
    B = 14

if A>B:
    print("Alice")
elif A<B:
    print("Bob")
else:
    print("Draw")
# Judge status: Wrong Answer
N,K = map(int, input().split())
pi = list(map(int, input().split()))
#期待値列
E=[(p+1)/2 for p in pi]
F=[]
cal=0
for i in range(N-K+1):
    F.append(cal)
    cal=0
    for j in range(K):
        cal += E[i+j]
print(float(max(F)))
# Judge status: Accepted
N = int(input())
CSF = [list(map(int, input().split())) for i in range(N-1)]

ans = []
for i, (ci, si, fi) in enumerate(CSF):
  now = si + ci
  for j in range(i+1, N-1):
    cj, sj, fj = CSF[j]
    now = max((-(-now//fj))*fj, sj) + cj
  ans.append(now)

ans.append(0)
print(*ans, sep='\n')
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))

ans = 0
x = dict()
#O(N)
for i in range(N):
    if a[i] in x:
        x[a[i]] += 1
    else:
        x[a[i]] = 1
    if (a[i]-1) in x:
        x[a[i]-1] += 1
    else:
        x[a[i]-1] = 1
    if (a[i]+1) in x:
        x[a[i]+1] += 1
    else:
        x[a[i]+1] = 1
for idx in x:
    ans = max(ans,x[idx])

print(ans)
# Judge status: Wrong Answer
N = input()
l = list(map(int,N))
i = 0
#ans = l[0] - 1 + (len(l)-1)*9 #暫定の答え

while True:
    if l[i] < 9 and i < len(l)-2:
        spot = l[i] - 1
        break
    if i == len(l)-1:
        spot = l[i-1] -1
        break
    else:
        i += 1 
ans = spot + (len(l)-1)*9
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
print(sorted([str(a)*b, str(b)*a])[0])
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
import numpy
s = numpy.cumsum(A)
sA = s[-1]
ar = numpy.abs(sA-s-s)
print(min(ar))
# Judge status: Accepted
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, Q, *A = map(int, read().split())
point =[K-Q]*(N+1)

for i in A:
    point[i] += 1
print(*['Yes' if i > 0 else 'No' for i in point[1:]], sep='\n')
# Judge status: Wrong Answer
from sys import stdin

def main():
	l = stdin.readline().strip()
	print(chr(ord(l)+1))
	print(l + " is followed by " +chr(ord(l)+1)+".")
main()
# Judge status: Accepted
s = input()
'''
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i in range(len(s)):
    if (i+1) % 2 == 1:
        if s[i] not in odd:
            print('No')
            exit(0)
    else:
        if s[i] not in even:
            print('No')
            exit(0)

print('Yes')

'''

odd = s[::2]
even = s[1::2]

if 'L' in odd or 'R' in even:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
N,M=map(int,input().split())
c=input().split()
if sum(int(i) for i in c)>N:
    print(-1)
else:
    print(N-sum(int(i) for i in c))
# Judge status: Accepted
n = int(input())
w = list(input() for i in range(n))

back = w[0][-1]

for i in range(n):
    for j in range(i+1,n):
        if w[i] == w[j]:
            print("No")
            exit()

for i in range(1, n):
    pre = w[i][0]
    if pre != back:
        break
    back = w[i][-1]
    if i == n-1:
        print("Yes")
        exit()

print("No")
# Judge status: Accepted
S = input()
day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
print(7 - day.index(S))
# Judge status: Accepted
import fractions


N = int(input())
A = list(map(int, input().split()))
L, R = [0]*N, [0]*N
for i in range(1, N):
    L[i] = fractions.gcd(L[i-1], A[i-1])
    R[-i-1] = fractions.gcd(R[-i], A[-i])
ans = 0
for l, r in zip(L, R):
    ans = max(ans, fractions.gcd(l, r))
print(ans)
# Judge status: Accepted
print('YNEOS'['7 7'in input()::2])