Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**7)

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)


def solve():
    N = int(input())
    a_list = list(map(int, input().split()))
    import numpy as np
    q = np.zeros(shape=(N, N))
    for i in range(N):
        for j in range(N):
            if i == j:
                q[i][j] = 1
            if i == N-1:
                q[i][0] = 1
            else:
                if i+1 == j:
                    q[i][j] = 1

    a = np.array(a_list)
    qinv = np.linalg.inv(q)
    dprint(q)
    x = 2 * np.dot(qinv, a)
    dprint(x)
    x = list(x.astype(int))
    print(" ".join([str(i) for i in x]))

solve()

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)

debug = True
debug = False


def dprint(*objects):
    if debug == True:
        print(*objects)


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

    def check(A, x):
        ans = [x]
        for i in range(1, N):
            tmp = A[i - 1] - ans[i - 1]
            if tmp < 0:
                if i % 2 == 1:
                    return 1, ans
                else:
                    return -1, ans
            else:
                ans.append(tmp)

        tmp = A[N - 1] - (ans[N - 1])
        if x > tmp:
            return 1, ans
        elif x < tmp:
            return -1, ans
        else:
            return 0, ans

    x = min(A[0], A[N - 1])
    jump = min(A[0], A[N - 1]) // 2

    # i = 0
    while True:
        # i += 1
        # if i > 10:
        #     break
        ret, ans = check(A, x)
        if ret == 1:
            x = x - jump
        elif ret == -1:
            x = x + jump
        else:
            dprint(x, ret, ans, jump)
            break
        jump = max(jump // 2, 1)
        dprint(x, ret, ans, jump)

    print(" ".join([str(i * 2) for i in ans]))


solve()
N = [int(i) in input().split()]
res = "NO"
if 1 in N and 9 in N and 7 in N and 4 in N:
  res = "YES"

print(res)

### FIXED CODE ###

N = [int(i)for i in input().split()]
res = "NO"
if 1 in N and 9 in N and 7 in N and 4 in N:
  res = "YES"

print(res)
import sys
 
a,b,h=map(int,input().split())

square = (a + b) * h / 2

print(int(square))

### FIXED CODE ###

import sys

a,b,h=[int(input()) for i in range(3)]

square = (a + b) * h / 2

print(int(square))
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a, b, c, d = map(int, input().split())
sa = b-a+1
a1 = int((sa + a%c)/c)
a2 = int((sa + a%d)/d)
a3 = int((sa + a%(lcm(c, d)))/(lcm(c, d)))
print(sa-a1-a2+a3)
#print(a1)
#print(a2)
#print(a3)
#print(lcm(c, d))
#31
# 12 18 24 30 36
# 16 24 32 40
#3+2-1 = 4
#9-4+1 - 4

### FIXED CODE ###

import math
def lcm(x, y):return (x * y) // math.gcd(x, y)
a,b,c,d=map(int,input().split())

e = lcm(c,d)
print(b-a+1-(b//c-(a-1)//c)-(b//d-(a-1)//d)+(b//e-(a-1)//e))
h,w = map(int, input().split())
k = [list(input()) for i in range(h)]

ans = True
for i in range(1,h):
    for j in range(1,w):
        if k[i][j] == "#" and k[i-1][j] =="." and k[i][j-1] =="." and k[i+1][j] =="." and k[i][j+1] =="." :
            ans = True

if ans:
    print('Yes')

else:
    print('No')

### FIXED CODE ###

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

ans = True
for i in range(1,h-2):
    for j in range(1,w-2):
        if k[i][j] == "#" and k[i-1][j] =="." and k[i][j-1] =="." and k[i+1][j] =="." and k[i][j+1] =="." :
            ans = False

if ans:
    print('Yes')

else:
    print('No')
print(eval(input().replace(" ", +) + "//2"))

### FIXED CODE ###

print(eval(input().replace(" ", "+") + "//2"))
N = int(input())
P = list(range(1,N))
print(sum(P))

### FIXED CODE ###

N = int(input())
print((N-1)*N//2)
A, B, C, K = map(int,input().split())

if K - A - B > 0:
    print(1 * A - (K - A - B) * 1)

elif K - A < 0:
    print(1 * K)

else K - A - B <= 0:
    print(1 * A)



### FIXED CODE ###

A, B, C, K = map(int,input().split())

if K - A - B > 0:
    print(1 * A - (K - A - B) * 1)

elif K - A < 0:
    print(1 * K)

elif K - A - B <= 0:
    print(1 * A)
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
pcount=0
qcount=0
rcount=0
ans=[]
for i in range(x):
  ans.append(p[-1-i])
for i in range(y):
  ans.append(q[-1-i])
ans.sort()
for i in range(c):
  if ans[i]<=r[-1-rcount]:
    ans[i]=r[-1-rcount]
    rcount+=1
print(sum(ans))
  

### FIXED CODE ###

x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
r.sort(reverse=True)
rcount=0
ans=[]
for i in range(x):
  ans.append(p[-1-i])
for i in range(y):
  ans.append(q[-1-i])
ans.sort()
for i in range(min(len(ans),c)):
  if ans[i]<=r[rcount]:
    ans[i]=r[rcount]
    rcount+=1
print(sum(ans))
a,b,c,d = list(input())
a,b,c,d = int(a), int(b), int(c), int(d)
mark = {"+":1,"-":-1}
e = 0
for i, i_ in mark.items():
    for j, j_ in mark.items():
        for k, k_ in mark.items():
            if (e==0)&(a + i_ * b + c * j_ + d * k_ == 7):
                print(f"{a}{i}{b}{j}{c}{k}{d}=7")
                e = 1
                break

### FIXED CODE ###

a,b,c,d = list(input())
a,b,c,d = int(a), int(b), int(c), int(d)
mark = {"+":1,"-":-1}
e = 0
for i, i_ in mark.items():
    for j, j_ in mark.items():
        for k, k_ in mark.items():
            if (e==0)&(a + i_ * b + c * j_ + d * k_ == 7):
                ans = str(a)+i+str(b)+j+str(c)+k+str(d)+"=7"
                print(ans)
                e = 1
                break
a, b, c = input().split()

if b-a == c - b:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

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

if b - a == c - b:
    print('YES')
else:
    print('NO')
N = int(input())
H = [int(x) for x in input().split()]
 cnt = 0
for i in range(N-1):
  if H[i]-H[i+1] > 1:
    cnt += 1
if cnt == 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

H.reverse()
#print(H)
cnt = 0
for i in range(1,N):
  if H[i]-H[i-1] == 1:
    H[i] = H[i]-1
  elif H[i]-H[i-1] > 1:
    cnt += 1
if cnt == 0:
  print('Yes')
else:
  print('No')
n = int(input())
a = input().split()
for i in range(n):
    a[i] = int(a[i])
a = sorted(a)
while len(a) > 1:
    for i in range(1,len(a)):
        if a[len(a)-1-i] % a[0] == 0:
            a.pop()
        else: a[len(a)-1-i] %= a[0]
    a = sorted(a)
print(a[0])

### FIXED CODE ###

n = int(input())
a = input().split()
for i in range(n):
    a[i] = int(a[i])
def gcm(a,b):
    if a >= b:
        if a % b == 0:
            return b 
        else:
            return gcm(b,a%b)
    else: return gcm(b,a)
for i in range(1,len(a)):
    a[0] = gcm(a[0],a[i])
print(a[0])
N, K = (int(i) for i in input().split())
H = list(map(int,input().split()))
ans = [1]*N
for m in range(M):
  a, b = (int(i) for i in input().split())
  if H[a-1] <= H[b-1]:
    ans[a-1] = 0
  elif H[a-1] > H[b-1]:
    ans[b-1] = 0
print(ans.count(1))

### FIXED CODE ###

n = input()
if n == "ABC":
  print("ARC")
else:
  print("ABC")
C = input().split()

A = int(C[0])
B = int(C[1]*100)



E = A*D

F = E/100

print(F)

### FIXED CODE ###

C = input().split()

A = int(C[0])
B = int(float(C[1])*100+0.5)



E = A*B



if E < 100:
    print(0)
elif E < 200:
    print(1)
elif E < 300:
    print(2)
else:
    F = str(E)
    print(F[0:len(F)-2])
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [0] * m
for i in range(m):
    ab[i] = list(map(int, input().split()))
check = [1] * n

for i in range(m):
    #低かったほうのチェックリストを0にしていく
    if h[ab[i][0]-1] = h[ab[i][1]-1]:
        check[ab[i][0]-1] = 0
        check[ab[i][1] - 1] = 0
    elif h[ab[i][0] - 1] < h[ab[i][1]-1]:
        check[ab[i][0] - 1] = 0
    else:
        check[ab[i][1]-1] = 0
print(sum(check))


### FIXED CODE ###

n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [0] * m
for i in range(m):
    ab[i] = list(map(int, input().split()))
check = [1] * n

for i in range(m):
    #低かったほうのチェックリストを0にしていく
    if h[ab[i][0]-1] == h[ab[i][1]-1]:
        check[ab[i][0]-1] = 0
        check[ab[i][1] - 1] = 0
    elif h[ab[i][0] - 1] < h[ab[i][1]-1]:
        check[ab[i][0] - 1] = 0
    else:
        check[ab[i][1]-1] = 0
print(sum(check))
n = int(input())
lis = list(map(int,input().split()))
lis.sort(reverse = True)
for i in range(n):
  if lis[i] < 0:
    lia = lis[:i]
    lib = lis[i:]
    break
  if i == n-1:
    lia = lis
    lib = []
num = 0
m = len(lia)
if m > 1:
  if m % 2 == 0:
    print(abs(sum(lia[:m//2]))-abs(sum(lia[m//2:])))-sum(lib)
    print(lia[0],lia[-1])
    num = lia[0]-lia[-1]
    for i in range(1,m//2):
      print(lia[-(i+1)],num)
      num = lia[-(i+1)]-num
      print(lia[i],num)
      num = lia[i]-num

  else:
    print(sum(lia[:m//2])-sum(lia[m//2+1:])+abs(lia[m//2]))-sum(lib)
    print(lia[-1],lia[0])
    num = lia[-1]-lia[0]
    for i in range(1,m//2):
      print(lia[i],num)
      num = lia[i]-num
      print(lia[-(i+1)],num)
      num = lia[-(i+1)]-num     
    print(lia[m//2],num)
elif m == 1:
  print(lia[0] -sum(lib))
  print(lia[0],lib[0])
  num = lia[0]-lib[0]
else:
  print(-sum(lib)+lib[0] * 2)
  num = lib[0]
for i in range(len(lib)-1):
  print(num,lib[i+1])
  num -= lib[i+1]

### FIXED CODE ###

n = int(input())
lis = list(map(int,input().split()))
minus,plus = [],[]
for num in lis:
    if num >= 0:
        plus.append(num)
    elif num < 0:
        minus.append(num)
plus.sort()
minus.sort(reverse=True)
ans = []
if len(plus) == 0:
    now = minus.pop(0)
    for num in minus:
        ans.append([now,num])
        now -= num
    print(now)
elif len(minus) == 0:
    now = plus.pop(0)
    last_num = plus.pop(0)
    for num in plus:
        ans.append([now,num])
        now -= num
    ans.append([last_num,now])
    last_num -= now
    print(last_num)
else:
    now = minus.pop(0)
    last_num = plus.pop(0)
    for num in plus:
        ans.append([now,num])
        now -= num
    for num in minus:
        ans.append([last_num,num])
        last_num -= num
    ans.append([last_num,now])
    last_num -= now
    print(last_num)
for i in range(n-1):
    print(*ans[i])
n = int(input())
px_up = math.ceil(n/1.08)
px_next = (n+1)/1.08
 
if px_up <= px_next:
  print(px_up)
else:
  print(":(")

### FIXED CODE ###

import math
n = int(input())
px_up = math.ceil(n/1.08)
px_next = (n+1)/1.08
 
if px_up < px_next:
  print(px_up)
else:
  print(":(")
def extgcd(a,b):
  r=[1,0,a]
  w=[0,1,b]
  while w[2]!=1:
    q=r[2]//w[2]
    r2=w
    w2=[r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
    r=r2
    w=w2
  return [w[0],w[1]]
def mod_inv(a,m):
  x=extgcd(a,m)[0]
  return (m+x%m)%m

def primes(n):
  is_prime=[True]*(n+1)
  is_prime[0]=False
  is_prime[1]=False
  for i in range(2,int(n**0.5)+1):
    if not is_prime[i]:
      continue
    for j in range(i*2,n+1,i):
      is_prime[j]=False
  return [i for i in range(n+1) if is_prime[i]]

prime=primes(int(10**3)+1)

def fact2(n):
  l=primes(int(n**0.5)+1)
  L=[]
  for i in range(len(l)):
    ct=0
    while n%l[i]==0:
      n=n//l[i]
      ct+=1
    if ct!=0:
      L.append((l[i],ct))
    if n==1:
      break
  if n!=1:
    L.append(n)
  return L

n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(10**6)]
mod=10**9+7
for i in range(n):
  x=fact2(a[i])
  for j in range(len(x)):
    l[x[j][0]]=max(l[x[j][0]],x[j][1])
lcm=1
for i in range(2,10**6):
  lcm*=(i**l[i])
  lcm%=mod
ans=0
for i in range(n):
  ans+=lcm*mod_inv(a[i],mod)
  ans%=mod
print(ans)

### FIXED CODE ###

from fractions import gcd
import collections

def lcm(x, y):
  return (x*y)//gcd(x, y)
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(10**6)]
mod=10**9+7
for i in range(n):
  x=factorize(a[i])
  for j in range(len(x)):
    l[x[j][0]]=max(l[x[j][0]],x[j][1])
lcm=1
for i in range(2,10**6):
  lcm*=(i**l[i])
  lcm%=mod
ans=0
for i in range(n):
  ans+=lcm*mod_inv(a[i],mod)
  ans%=mod
print(ans)
import re

S=input()
ans = sorted((re.findall("[AGCT]*", S)), reverse=True, key=len)
print(len(ans[0])

### FIXED CODE ###

S = str(input())
m=0
point=0
for i in S:
    if i == "A" or i == "G" or i == "C" or i == "T":
        point+=1
    else:
        point*=0
    m = max(m, point)
print(m)
n = int(input())
a = list(map(int, input().split()))

c = 0
while True:
    t = [int(x/2) for x in a if x%2 == 0]
    if len(t) == n:
        a = t
        count += 1
    else:
        break

print(c)

### FIXED CODE ###

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

def exec(a, n):
    if len([x for x in a if x%2 == 0]) == n:
        return [int(x/2) for x in a]
    return []

i = 0
while True:
    t = exec(a, n)
    if len(t):
        i += 1
        a = t
    else:
        break

print(i)
import numpy as np

card_num, gate_num = map(int,input().split())
d = np.zeros((gate_num,2))
card_valid = [0]*card_num

for i in range(gate_num):
    l, r = map(int, input().split())
    d[i,0] = l
    d[i,1] = r
for i in range(gate_num):
    for ii in range(card_num):
        if ii + 1 >= d[i][0] and ii + 1 <= d[i][1]:
            card_valid[ii] += 1
        else:
            card_valid[ii] += 0
counter = 0
for i in range(card_num):
    if card_valid[i] == gate_num:
        counter += 1
        
print(counter)

### FIXED CODE ###

import sys
from itertools import accumulate

def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    acc = [0] * (N+1)
    for _ in range(M):
        left, right = map(int, input().split())
        acc[left-1] += 1
        acc[right] -= 1

    cnt = 0
    for a in accumulate(acc):
        if a == M:
            cnt += 1

    return cnt


if __name__ == '__main__':
    print(main())
class UnionFind:
    def __init__(self, n: int) -> None:
        #マイナスならルートでその深さを表す。プラスならルートのノードを指す。
        self.nodes = [-1]*n
 
    def find_root(self, x: int) -> int:
        if self.nodes[x] < 0:
            return x
        else:
            self.nodes[x] = self.find_root(self.nodes[x])
            return self.nodes[x]
 
    def unite(self, x: int, y: int) -> None:
        x, y = self.find_root(x), self.find_root(y)
        #浅い方につなぐ
        if (x != y):
            if (x < y):
                self.nodes[y] += self.nodes[x]
                self.nodes[x] = y
            else:
                self.nodes[x] += self.nodes[y]
                self.nodes[y] = x
        
    def is_same(self, x: int, y: int) -> bool:
        return self.find_root(x) == self.find_root(y)

from operator import itemgetter

N = int(input())
G = [[i] + list(map(int, input().split())) for i in range(N)]

#X,Yそれぞれでソートして各都市の最短距離を求める
G_sorted_by_x = sorted(G, key=itemgetter(1))
G_sorted_by_y = sorted(G, key=itemgetter(2))
R = []
for i in range(N-1):
    i0, x0, _ = G_sorted_by_x[i]
    i1, x1, _ = G_sorted_by_x[i+1]
    R.append((x1-x0, i0, i1))
    i0, _, y0 = G_sorted_by_y[i]
    i1, _, y1 = G_sorted_by_y[i+1]
    R.append((y1-y0, i0, i1))

R_sorted_by_cost = sorted(R, key=itemgetter(0))

#print(R_sorted_by_cost)

uf = UnionFind(N)
total_cost = 0
for cost, i, j in R_sorted_by_cost:
    if (not uf.is_same(i, j)):
        uf.unite(i, j)
        total_cost += cost
    #print((cost, i, j))
print(total_cost)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

class UnionFind:
    def __init__(self, n: int) -> None:
        #マイナスならルートでその深さを表す。プラスならルートのノードを指す。
        self.nodes = [-1]*n
 
    def find_root(self, x: int) -> int:
        if self.nodes[x] < 0:
            return x
        else:
            self.nodes[x] = self.find_root(self.nodes[x])
            return self.nodes[x]
 
    def unite(self, x: int, y: int) -> None:
        x, y = self.find_root(x), self.find_root(y)
        #浅い方につなぐ
        if (x != y):
            if (x < y):
                self.nodes[y] += self.nodes[x]
                self.nodes[x] = y
            else:
                self.nodes[x] += self.nodes[y]
                self.nodes[y] = x
        
    def is_same(self, x: int, y: int) -> bool:
        return self.find_root(x) == self.find_root(y)

from operator import itemgetter

N = int(input())
G = [[i] + list(map(int, input().split())) for i in range(N)]

#X,Yそれぞれでソートして各都市の最短距離を求める
G_sorted_by_x = sorted(G, key=itemgetter(1))
G_sorted_by_y = sorted(G, key=itemgetter(2))
R = []
for i in range(N-1):
    i0, x0, _ = G_sorted_by_x[i]
    i1, x1, _ = G_sorted_by_x[i+1]
    R.append((x1-x0, i0, i1))
    i0, _, y0 = G_sorted_by_y[i]
    i1, _, y1 = G_sorted_by_y[i+1]
    R.append((y1-y0, i0, i1))

R_sorted_by_cost = sorted(R, key=itemgetter(0))

#print(R_sorted_by_cost)

uf = UnionFind(N)
total_cost = 0
for cost, i, j in R_sorted_by_cost:
    if (not uf.is_same(i, j)):
        uf.unite(i, j)
        total_cost += cost
    #print((cost, i, j))
print(total_cost)
N = int(input())
X = input()

def popcount(n):
    return bin(n).count('1')

def process(n):
    return n % popcount(n)

def func(n):
    ret = 0
    while n > 0:
        n = process(n)
        ret += 1
    return ret

pcnt = X.count('1')
mods_plus = []
totalmod_plus = 0
tmp_plus = 1
pp = pcnt+1
mods_minus = []
totalmod_minus = 0
tmp_minus = 1
pm = pcnt-1
for c in reversed(X):
    if c == '1':
        totalmod_plus += tmp_plus
        totalmod_plus %= pp
    mods_plus.append(tmp_plus)
    tmp_plus = tmp_plus*2 % pp
    if pcnt > 0:
        if c == '1':
            totalmod_minus += tmp_minus
            totalmod_minus %= pm
        mods_minus.append(tmp_minus)
        tmp_minus = tmp_minus*2 % pm

for i in range(N):
    if X[i] == '1':
        if pcnt == 1:
            print(0)
        else:
            mod = mods_minus[-i-1]
            print(func((totalmod_minus - mod) % pm) + 1)
    else:
        mod = mods_plus[-i-1]
        print(func((totalmod_plus + mod) % pp) + 1)


### FIXED CODE ###

N = int(input())
X = input()

def popcount(n):
    return bin(n).count('1')

def process(n):
    return n % popcount(n)

def func(n):
    ret = 0
    while n > 0:
        n = process(n)
        ret += 1
    return ret

pcnt = X.count('1')
mods_plus = []
totalmod_plus = 0
tmp_plus = 1
pp = pcnt+1
mods_minus = []
totalmod_minus = 0
tmp_minus = 1
pm = pcnt-1
for c in reversed(X):
    if c == '1':
        totalmod_plus += tmp_plus
        totalmod_plus %= pp
    mods_plus.append(tmp_plus)
    tmp_plus = tmp_plus*2 % pp
    if pcnt != 1:
        if c == '1':
            totalmod_minus += tmp_minus
            totalmod_minus %= pm
        mods_minus.append(tmp_minus)
        tmp_minus = tmp_minus*2 % pm

for i in range(N):
    if X[i] == '1':
        if pcnt == 1:
            print(0)
        else:
            mod = mods_minus[-i-1]
            print(func((totalmod_minus - mod) % pm) + 1)
    else:
        mod = mods_plus[-i-1]
        print(func((totalmod_plus + mod) % pp) + 1)
a = input()
b = input()
print('%d %d'%(int(a)*int(b),2*int(a)+2*int(b)))

### FIXED CODE ###

a,b = map(int,input().split())
print('%d %d'%(a*b,2*a+2*b))
import sys
input = sys.stdin.readline
n = int(input())
graph = {i:[] for i in range(n)}
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  graph[a].append(b)
  graph[b].append(a)
  
one = n//3 + bool(n%3)
two = n//3 + bool(n%3>1)
three = n//3
nums = [three+1,one,two]
perms = [0 for i in range(n)]



def dfs(i,n):
  global nums
  perms[i] = (nums[n]-1)*3 + n
  nums[n] -= 1 
  for node in graph[i]:
    if perms[node] == 0:
      next_n = (3-n)%3
      if nums[next_n] == 0:
        dfs(node,0)
      else:
        dfs(node,next_n)


for i in range(n):
  dfs(i,1)
  if sum(perms) == n*(n+1)//2:
    break
  perms = [0 for _ in range(n)]
  nums = [three+1,one,two]
print(*perms)

### FIXED CODE ###

S = input()
hi = ['hi','hihi','hihihi','hihihihi','hihihihihi']
print('Yes'if S in hi else 'No')
a=str(input())
b=0
for moji in a:
    if moji=="1"
    b+=1

print(b)


### FIXED CODE ###

a=str(input())
b=0
for moji in a:
    if moji=="1":
        b+=1

print(b)
H, W = map(int,input().split())
map = [input() for i in range(H)]

def drow(i,j, map = map):
  if j > 0 and map[i][j-1] == "#":
    return "YES"
  if j < W-1 and map[i][j+1] == "#":
    return "YES"
  if i > 0 and map[i-1][j] == "#":
    return "YES"
  if i < H -1 and map[i+1][j] == "#":
    return "YES"
  return "NO"
    

for i in range(H):
  for j in range(W):
    if map[i][j] == "#":
      ans = drow(i,j)
      if ans == "NO":
        break
print(ans)
    

### FIXED CODE ###

H, W = map(int,input().split())
map = [input() for i in range(H)]

def drow(i,j, map = map):
  if j > 0 and map[i][j-1] == "#":
    return "Yes"
  if j < W-1 and map[i][j+1] == "#":
    return "Yes"
  if i > 0 and map[i-1][j] == "#":
    return "Yes"
  if i < H -1 and map[i+1][j] == "#":
    return "Yes"
  return "No"

ans = "Yes"
for i in range(H):
  for j in range(W):
    if map[i][j] == "#":
      ans = drow(i,j)
      if ans == "No":
        print(ans)
        exit()
print(ans)
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！

def main():
    n,k=map(int,input().split())
    a=sorted(map(int,input().split()))
    b=sorted(map(int,input().split()),reverse=1)
    #print(a,b)
    ok=max(a)*max(b)
    ng=-1
    
    
            
    while abs(ok-ng)>1:
        mid=(ok+ng)//2
        if sum(a[i]-mid//b[i]for i in range(n) if a[i]*b[i]>mid)<=k:
            ok=mid
        else:
            ng=mid
    print(ok)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
 
def main():
    a,b=map(int,input().split())
    if a<10 and b< 10:
        print(a*b)
    else:
        print(-1)
if __name__ == '__main__':
    main()
while(1):
	H, W = map(int, input().split())
	if H == 0 and W == 0:
		break
	for i in range(H):
		for j in range(W):
			print("#", end='')
		if j == W-1
			print("")

### FIXED CODE ###

while(1):
	H, W = map(int, input().split())
	if H == 0 and W == 0:
		break
	for i in range(H):
		for j in range(W):
			print("#", end='')
		print("\n", end='')
	print("\n", end='')
n=int(input())
a=list(map(int, input().split()))
cnt_2=0
cnt_1=0
cnt_0=0

for num in a:
    if num%4==0:
        cnt_2+=1
    elif num%2==0:
        cnt_1+=1
    else:
        cnt_0+=1

if cnt_1=0:
    if cnt_2+1>=cnt_0:
        print("Yes")
    else:
        print("No")

else:
    if cnt_2>=cnt_0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split()))
cnt_2=0
cnt_1=0
cnt_0=0

for num in a:
    if num%4==0:
        cnt_2+=1
    elif num%2==0:
        cnt_1+=1
    else:
        cnt_0+=1

if cnt_1==0:
    if cnt_2+1>=cnt_0:
        print("Yes")
    else:
        print("No")

else:
    if cnt_2>=cnt_0:
        print("Yes")
    else:
        print("No")