Harryxun/stf_run huggingface dataset:
a=int(input())
b=list(map(int,input().split()))
c=sum(b)
d=0
e=0
for i in range(a):
  d=d+b[i]
  if d>=c/2:
    e=i
    break
for i in range(e):
  e=e+b[e]
if d-(c-d)<e-(c-e):
  print(d-(c-d))
else:
  print(e-(c-e))

### FIXED CODE ###

a=int(input())
b=list(map(int,input().split()))
c=sum(b)
d=0
e=0
f=0
for i in range(a):
  d=d+b[i]
  if d>=c/2:
    e=i
    break
for i in range(e):
  f=f+b[i]
if abs(d-(c-d))<abs(f-(c-f)):
  print(abs(d-(c-d)))
else:
  print(abs(f-(c-f)))
import numpy as np

n = int(input())
a = list(map(int, input().split()))
sum = 0
x = [-1 for i in range(n)]
for i in range(n):
    if a[i % n] == 0:
        x[i % n] = 0
        x[(i + 1) % n] = 0
i = 0
while (-1 in x):
    if a[i % n] == nun and a[i + 2] != -1:
        x[i] = a[i] * 2 - a[i + 1] * 2 - x[i + 2]
    i += 1
for i in x:
    print(i,end = "")
    print(" ", end = "")

### FIXED CODE ###

import numpy as np

n = int(input())
a = list(map(int, input().split()))
s = 0
x = [-1 for i in range(n)]
for i in range(1,n):
    if i % 2 == 1:
        s += a[i]
x[0] = sum(a) - s * 2
for i in range(1, n):
    x[i] = a[i - 1] * 2 - x[i - 1]
for i in x:
    print(i,end = "")
    print(" ", end = "")
w,a,b = map(int,input().split())
print(b-(a+W))

### FIXED CODE ###

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

if abs(a-b) <= w:
  print(0)
else:
  print(abs(a-b)-w)
i = map(int,input(),split())
if (i[0] == i[1] and i[0] != i[2]) or (i[0] == i[2] and i[0] != i[1])  or (i[1] == i[2] and i[1] != i[0]):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

i = list(map(int,input().split()))
if (i[0] == i[1] and i[0] != i[2]) or (i[0] == i[2] and i[0] != i[1])  or (i[1] == i[2] and i[1] != i[0]):
  print("Yes")
else:
  print("No")
N = int(input())
hList = list(map(int, input().split()))

if len(hList) == 1:
    print(hList[0])
    return

minimum = abs(hList[0] - hList[1])
for index in range(2, len(hList)):
    minimum = min(abs(hList[index] - hList[index-1]), abs(hList[index] - hList[index-2]))
print(minimum)

### FIXED CODE ###

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

dp = [0] * N
dp[1] = abs(hList[1] - hList[0])
for index in range(2, N):
    dp[index] = min(dp[index-1] + abs(hList[index] - hList[index-1]),
                    dp[index-2] + abs(hList[index] - hList[index-2]))
print(dp[-1])
r = input()

ans = 2*r*3.141
print(ans)

### FIXED CODE ###

import math

r = int(input())
ans = math.pi*(2*r)
print(ans)
s=[]
for p in input().split():
 if p in "+-*":
  b=s.pop()
  a=s.pop()
  s.append(str(eval(a+p+b)))
 else:
  s.append(c)
print(*s)


### FIXED CODE ###

s=[]
for p in input().split():
 s+=[str(eval(s.pop(-2)+p+s.pop()))if p in"+-*"else p]
print(*s)
#入力
N = int.input()
#出力
if N % 10 == 2, 4, 5, 7, 9
  print('hon')
elif N % 10 == 0, 1, 6, 8
  print('pon')
else:
  print('bon')

### FIXED CODE ###

x = int(input())
y = x%10
if y == 3:
  print("bon")
elif y == 0:
  print("pon")
elif y == 1:
  print("pon")
elif y == 6:
  print("pon")
elif y == 8:
  print("pon")
else:
  print("hon")
# -*- coding: utf-8 -*-

x = input()
y=[]
y=x.split(" ")
N=int(y[0])
M=int(y[1])

z=[]
for i in range(M):
	temp1=input()
	temp2=temp1.split(" ")
	for j in temp2:
		j=int(j)
		z.append(j)

dict={}
for i in range(N):
	i+=1
	dict[i]=0

for i in z:
	dict[i]=dict[i]+1

for i in range(N):
	i+=1
	print(dict[i])
	

### FIXED CODE ###

# -*- coding: utf-8 -*-
x=input()
y=[]
y=x.split(" ")

if int(y[2])>=int(y[0]) and int(y[2])<=int(y[1]):
	print("Yes")
else:
	print("No")
a,b,c=input().split(,)
print(a+" "+b+" "+c)

### FIXED CODE ###

s = input().split(',')
s = ' '.join(s)
print(s)
A,B=map(int, input().split())
if A-B>=1:
  print(2*A-1)
  break
elif A==B:
  print(A+B)
  break
else:
  print(2*B-1)
  break

### FIXED CODE ###

A,B=map(int, input().split())
if A-B>=1:
  print(2*A-1)
elif A==B:
  print(A+B)
else:
  print(2*B-1)
D, G = map(int, input().split())
P, C = [], []

for _ in range(D):
    p, c = map(int, input().split())
    P.append(p); C.append(c)

ans = float('inf')

for bit in range(2**D):
    score, solve_num = 0, 0
    for i in range(D):
        if (bit >> i) & 1:
            score += (100 * (i+1) * P[i] + C[i])
            solve_num += P[i]
            is_solve[i] += P[i]

    for i in range(D-1, -1, -1):
        if score >= G:
            break

        if (bit >> i) & 1:
            continue

        for j in range(p[i]):
            score += 100*(i+1)
            solve_num += 1

            if score >= G:
                break

    ans = min(ans, solve_num)

print(ans)


### FIXED CODE ###

D, G = map(int, input().split())
P, C = [], []

for _ in range(D):
    p, c = map(int, input().split())
    P.append(p); C.append(c)

ans = float('inf')

for bit in range(2**D):
    is_solve = [ 0 for _ in range(D) ]
    score, solve_num = 0, 0
    # i 番目の bit が立っている => 100(i+1)点をつけられた p_i 問を全完する
    for i in range(D):
        if (bit >> i) & 1:
            score += (100 * (i+1) * P[i] + C[i])
            solve_num += P[i]
            is_solve[i] += P[i]

    for i in range(D-1, -1, -1):
        if score >= G:
            break

        while is_solve[i] < P[i]:
            score += 100*(i+1)
            solve_num += 1
            is_solve[i] += 1
            if score >= G:
                break

    ans = min(ans, solve_num)

print(ans)
s = input()
b = len(s)
c = 0
f = 0
while True:
    if f == b:
        break
    elif b - f <= 2:
        f = 0
        b -= 1
    else:
        if int(s[f:b]) % 2019 == 0:
            c += 1
            f += 1
        else:
            f += 1
print(c)


### FIXED CODE ###

S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    print("safe")
s = input()

k = 'keyence'

ans = ''
j=0
for i, c in enumerate(s):
  if c == k[i]:
    pass
  else:
    ans = s[0:i]
    s = [i:]
    j=i
    break

for i, c in enumerate(s):
  if k[j] == c:
    j = i
    ans += s[i:]
    break

if ans == k:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

s = input()

k = 'keyence'

tmp = s
ans = ''
for i in range(len(s)-1):
  for j in range(i, len(s)):
    tmp = s
    tmp = tmp[0:i] + tmp[j:]
    if k == tmp:
      print('YES')
      exit(0)
print('NO')
n = int(input())
f = 0
for i in range(1, 9):
    for j in range(1, 9):
        if i*j == n:
            f = 1
if f == 0:
    print("No")
else:
    print("Yes")


### FIXED CODE ###

a = list(map(int, input().split()))
if 1<=a[0] and a[0]<=9:
    if 1<=a[1] and a[1]<=9:
        print(a[0]*a[1])
    else:
        print(-1)
else:
    print(-1)
N=int(input())
##c=list(map(int, input().split()))
a={}
b={}
for i in range(N):
    a.append(int(input()))
    b.append(int(input()))
k=float(0)
for i in range(N-1):
    for j in range(i,N):
        k=k+((a[i]-a[j])**2+(b[i]-b[j])**2)**0.5

k=float(k*2/N)
print(k)




### FIXED CODE ###

N=int(input())
##c=list(map(int, input().split()))

a = [list(map(int, input().split())) for _ in range(N)]

k=0
for i in range(N):
    for j in range(N):
        if(i!=j):
            k=k+((a[i][0]-a[j][0])*(a[i][0]-a[j][0])+(a[i][1]-a[j][1])*(a[i][1]-a[j][1]))**0.5

print(k/N)
N = int(input())
print(N**3

### FIXED CODE ###

N = int(input())
print(N**3)
Source Code 

Copy
Copy
N, M, K = [int(x) for x in input().strip().split()]
A = [int(x) for x in input().strip().split()]
B = [int(x) for x in input().strip().split()]
i = j = 0
ct = 0
while k > 0: 
  if i < N: 
    if A[i] < B[j] and k-A[i] >= 0: 
      ct +=1
      k -= A[i]
      i += 1
      continue
  if j < M: 
    if k-B[j] >= 0: 
      ct +=1
      k -= B[j]
      j +=1
    else: 
      break
  else: 
    break
print(ct)
print(ct)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
a, b = [0], [0]
for i in range(N):
	a.append(a[i]+A[i])
for i in range(M):
	b.append(b[i]+B[i])
	
ans, j = 0, M
for i in range(N+1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i+j)
	
print(ans)
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append((i * j) % 2019)
  res.sort
  if(3 in res and 673 in res):
    print(0)
  else:
    print(res[0] * res[1])

### FIXED CODE ###

l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(hoge != fuga and ans > ((hoge * fuga) % 2019)):
        ans = (hoge * fuga) % 2019
  print(ans)
a,b=map(int,input().split()) 
for i in range(21): 
	l=(b*2+1)*i 
		if l>=a: 
			print(i) 
			break 


### FIXED CODE ###

a,b=map(int,input().split()) 
for i in range(21): 
	l=(b*2+1)*i 
	if l>=a: 
		print(i) 
		break
mod = N % 2
if mod == 0:
    x = N // 2
else:
    x = N // 2 + 1

### FIXED CODE ###

N = input()
N = int(N)

mod = N % 2
if mod == 0:
    x = N // 2
else:
    x = N // 2 + 1
    
print(x)
a=int(input())
ans=0
for i in range(a):
  c,d=map(str,input().split())
  if d=="JPY":
    ans+=int(c)
  else:
    ans+=float(int(c)*380000)
print(ans)


### FIXED CODE ###

a=int(input())
ans=0
for i in range(a):
  c,d=map(str,input().split())
  if d=="JPY":
    ans+=int(c)
  else:
    ans+=float(c)*380000
print(ans)
x=input()
if x[0][0]==x[1][2] & x[0][1]==x[1][1] & x[0][2]==x[1][0]
    print YES
else
	print NO
end


### FIXED CODE ###

s = input()
t = input()
if s[0]==t[2] and s[1]==t[1] and s[2]==t[0]:
	print("YES")
else:
	print("NO")
a,b,c,k=map(int,input().split())
if(k>a+b):
    print(A-min(k-a-b,c))
elif(k>=a):
    print(a)
else:
    print(k)

### FIXED CODE ###

a,b,c,k=map(int,input().split())
if(k>a+b):
    print(a-min(k-a-b,c))
elif(k>=a):
    print(a)
else:
    print(k)
n=int(input())
s=list(input())
if s.count('R') > s.count('B'):
    print('Yes')
else:
    pritn('No')

### FIXED CODE ###

n=int(input())
s=list(input())
if s.count('R') > s.count('B'):
    print('Yes')
else:
    print('No')
S = input()
stack = []
cnt = 0

for s in S:
    if s == S[0]:
        stack.append(s)
    elif s != stack[-1]:
        stack.pop()
        cnt += 2
    else:
        stack.append(s)
        
print(cnt)
         

### FIXED CODE ###

s = input()
n = len(s)

one = s.count('1')
zero = s.count('0')

print(2*min(one, zero))
return ' '.join(s.split(','))

### FIXED CODE ###

s = input()
print(' '.join(s.split(',')))
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import numpy as np

N_s, M_s, C_s = input().split()
N = int(N_s)
M = int(M_s)
C = int(C_s)

B = [int(i) for i in input().split()]
A = []
for rows in range(0,N):
    tmp = [int(i) for i in input().split()]
    A.append(tmp)

B_array = np.array(B)
A_array = np.array(A)

val = np.dot(A_array, B_array) + C
print(np.sum(val>0))

### FIXED CODE ###

#!/usr/bin/env python
#-*- coding:utf-8 -*-

H_s,W_s = input().split()
h_s,w_s = input().split()

H = int(H_s)
W = int(W_s)
h = int(h_s)
w = int(w_s)

num_total    = H * W
num_black_h  = h * W
num_black_w  = H * w
num_black_hw = h * w
num_white = num_total - num_black_h - num_black_w + num_black_hw

print(num_white)
a, b , c = map(int, input().split(' '))
if a*c < b:
    print(c)
else:
    printn(int(b//a))

### FIXED CODE ###

a, b , c = map(int, input().split(' '))
if a*c < b:
    print(c)
else:
    print(int(b//a))
n,m,q = [int(i) for i in input().split()]
lr = [[int(x)-1 for x in input().split()] for i in range(m)]
pq = [[int(x)-1 for x in input().split()] for i in range(q)]
m = [[0]*500 for _ in range(500)]
for l,r in lr:
    m[0][r]+=1
    m[l+1][r]-=1
for i in range(500):
    for j in range(1,500):
        m[j][i]+=m[j-1][i]
for i in range(500):
    for j in range(1,500):
        m[i][j]+=m[i][j-1]
for p,q in pq:
    print(m[p][q])

### FIXED CODE ###

n,m,q = [int(i) for i in input().split()]
lr = [[int(x)-1 for x in input().split()] for i in range(m)]
pq = [[int(x)-1 for x in input().split()] for i in range(q)]
m = [[0]*501 for _ in range(501)]
for l,r in lr:
    m[0][r]+=1
    m[l+1][r]-=1
for i in range(500):
    for j in range(1,500):
        m[j][i]+=m[j-1][i]
for i in range(500):
    for j in range(1,500):
        m[i][j]+=m[i][j-1]
for p,q in pq:
    print(m[p][q])
S_d,T = list(input()),list(input())

if len(S_d) < len(T):
  print("UNRESTORABLE");exit()

flag = 1
for i in range(-len(T),-len(S_d)-1,-1):
  key = 0
  for j in range(len(T)):
    if S_d[i+j]=="?" or S_d[i+j]==T[j]:
      key+=1
    else:
      break
  if key == len(T):
    st=len(S_d)+i
    break
  else:
    st=-1

if st==-1:
  print(UNRESTORABLE)
else:
  for i in range(len(S_d)):
    if st <= i and i < st+len(T):
      print(T[i-st],end="")
    elif S_d[i]=="?":
      print("a",end="")
    else:
      print(S_d[i],end="")
      

### FIXED CODE ###

S_d,T = list(input()),list(input())

if len(S_d) < len(T):
  print("UNRESTORABLE");exit()

flag = 1
for i in range(-len(T),-len(S_d)-1,-1):
  key = 0
  for j in range(len(T)):
    if S_d[i+j]=="?" or S_d[i+j]==T[j]:
      key+=1
    else:
      break
  if key == len(T):
    st=len(S_d)+i
    break
  else:
    st=-1

if st==-1:
  print("UNRESTORABLE")
else:
  for i in range(len(S_d)):
    if st <= i and i < st+len(T):
      print(T[i-st],end="")
    elif S_d[i]=="?":
      print("a",end="")
    else:
      print(S_d[i],end="")
N,Q=map(int,(input()).split())
S=input()
l_list=[]
r_list=[]
for i in range(Q):
  l,r=input().split()
  l_list.append(int(l))
  r_list.append(int(r))
count=0
AC_count=[]
for i in range(1,N):
  if S[i-1:i+1]=="AC":
    count+=1
  AC_count.append(count)
k=0
for j in range(Q):
  k=AC_count[r_list[j]-1]-AC_count[l_list[j]-1]
  print(k)


### FIXED CODE ###

N,Q=map(int,(input()).split())
S=input()
l_list=[]
r_list=[]
for i in range(Q):
  l,r=input().split()
  l_list.append(int(l))
  r_list.append(int(r))
count=0
AC_count=[0]
for i in range(1,N+2):
  if S[i-1:i+1]=="AC":
    count+=1
  AC_count.append(count)
AC_count.append(count)
k=0
for j in range(Q):
  k=AC_count[r_list[j]-1]-AC_count[l_list[j]-1]
  print(k)
n =int(input("enter number of car_train. "))
i = int(input("enter ith from the front  of train . "))

if n == i:
    print (1)
else :
    print ((n-i)+1)




### FIXED CODE ###

k=list(map(int , input().split()))
N=k[0]
i=k[1]
print(N-i+1)
n, k = map(int, input().split())
a = [1] * n
for i in range(k):
    tmp = map(int, input().split())
    for j in tmp:
        a[j - 1] = 0
print(sum(a[j]))


### FIXED CODE ###

n, k = map(int, input().split())
a = [1] * n
for i in range(k):
    d = int(input())
    tmp = map(int, input().split())
    for j in tmp:
        a[j - 1] = 0
print(sum(a))
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

angle = abs((30 * h + m * 0.5) - m*6)

if angle > 180:
    angle = 360 - angle

cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))

### FIXED CODE ###

import math

a, b, h, m = map(int, input().split())
h=h*60+m

ang=abs(h*0.5-m*6)
if ang > 180:
  ang = 360-ang
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b-a))
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))
s=int(input())
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s=input()
if s[2]==s[3] and s[4]==s[5]:
    print("Yes")
else:
    print("No")
a,b = map(int, input().split())
if (a * b) % == 0:
  print("Evern")
else:
  print("Odd")

### FIXED CODE ###

a,b = map(int, input().split())
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")
0<=int(A)<=100
0<=int(B)<=100

if int(A)>int(B)*2:
  print(int(A)-int(B)*2)

else:
  print(0)
  

### FIXED CODE ###

A, B = [int(i) for i in input().split()]
0<=A<=100
0<=B<=100

if A>B*2:
  print(A-B*2)

else:
  print(0)
ABCD = list(map(int, input().split()))

for i in range(1 << 3):
    total = ABCD[0]
    equation = str(ABCD[0])
    for j in range(3):
        if i & (1 << j):
            total += ABCD[j+1]
            equation += "+"
        else:
            total -= ABCD[j+1]
            equation += "-"    
        equation += str(ABCD[j+1])
    if total == 7:
        equation += "=7"
        print(equation)
        break

### FIXED CODE ###

ABCD = input()

for i in range(1 << 3):
    total = int(ABCD[0])
    equation = ABCD[0]
    for j in range(3):
        if i & (1 << j):
            total += int(ABCD[j+1])
            equation += "+"
        else:
            total -= int(ABCD[j+1])
            equation += "-"    
        equation += ABCD[j+1]
    if total == 7:
        equation += "=7"
        print(equation)
        break
from collections import Counter


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

    cnt_a = Counter(lst_a)

    if len(cnt_a) > 3:
        print("No")
        exit()
    
    if len(cnt_a) == 1:
        print("Yes" if lst_a[0] == 0 else "No")
        exit()
    
    if N % 3:
        print("No")
        exit()
    
    if len(cnt_a) == 2:
        if cnt_a[0] != N//3:
            print("No")
        else:
            print("Yes")
    else:
        if any(v != N//3 for v in C.values()):
            print("No")
        else:
            x, y, z = list(cnt_a)
            print("Yes" if x ^ y ^ z == 0 else "No")


if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import Counter


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

    cnt_a = Counter(lst_a)

    if len(cnt_a) > 3:
        print("No")
        exit()
    
    if len(cnt_a) == 1:
        print("Yes" if lst_a[0] == 0 else "No")
        exit()
    
    if N % 3:
        print("No")
        exit()
    
    if len(cnt_a) == 2:
        if cnt_a[0] != N//3:
            print("No")
        else:
            print("Yes")
    else:
        if any(v != N//3 for v in cnt_a.values()):
            print("No")
        else:
            x, y, z = list(cnt_a)
            print("Yes" if x ^ y ^ z == 0 else "No")


if __name__ == "__main__":
    main()
import numpy as np
import sys
input2 = sys.stdin.read

n, c = map(int, input().split())
AV = np.array(list(map(int, input2().rsplit())), dtype=np.int64)
A, V = AV[::2], AV[1::2]
B = (c - A)[::-1]
XA = np.cumsum(V) - A
XB = np.cumsum(V[::-1]) - B
RSA, RSB = XA - A, XB - B

XRA, XRB = 0, 0
for i in range(n):
    if RSA[i] > 0:
        XRA = max(XRA, RSA[i] + XB[:n - 1 - i].max())
    else:
        break

for i in range(n):
    if RSB[i] > 0:
        XRB = max(XRB, RSB[i] + XA[:n - 1 - i].max())
    else:
        break

print(max(0, max(XA), max(XB), XRA, XRB))


### FIXED CODE ###

import numpy as np
import sys
input2 = sys.stdin.read

# A: Anti-clockwise, B: Clockwise, V: Values
n, c = map(int, input().split())
AV = np.array(list(map(int, input2().rsplit())), dtype=np.int64)
A, V = AV[::2], AV[1::2]
B = (c - A)[::-1]

XA = np.cumsum(V) - A
XB = np.cumsum(V[::-1]) - B
RXA, RXB = XA - A, XB - B    # Cumulative Values returning to Start
NMA, NMB = XA.max(), XB.max()


def ind(lis, maxi):
    for i, x in enumerate(lis):
        if x == maxi:
            return i


MRA2, MRB2 = max(RXA[:-1], default=0), max(RXB[:-1], default=0)
mrai = ind(RXA, MRA2)
mrbi = ind(RXB, MRB2)

if not mrai and not mrbi:
    mrai, mrbi = 0, 0

MA2 = max(0, max(XA[:n - 1 - mrbi], default=0))
MB2 = max(0, max(XB[:n - 1 - mrai], default=0))
res = max(NMA, NMB, MA2 + MRB2, MB2 + MRA2)


for k in range(-1, -10 if n > 10 else -2, -1):
    MA3, MB3 = max(XA[:k], default=0), max(XB[:k], default=0)
    mai3 = ind(XA, MA3)
    mbi3 = ind(XB, MB3)

    if not mai3 and not mbi3:
        mai3, mbi3 = 0, 0

    MRA3 = max(0, max(RXA[:n - 1 - mbi3], default=0))
    MRB3 = max(0, max(RXB[:n - 1 - mai3], default=0))

    res = max(res, MA3 + MRB3, MB3 + MRA3)
print(res)
A = [list(map(int, input().split())) for i in range(3)]

n = int(input())

for j in range(n):
    b = int(input())
    for j in range(3):
        if A[j][0] == b:
            A[j][0] = 0
        if A[j][1] == b:
            A[j][1] = 0
        if A[j][2] == b:
            A[j][2] = 0

if A[0][0]==A[1][1]==A[2][2]==0:
    print("Yes")
    exit
elif A[0][2]==A[1][1]==A[2][0]==0:
    print("Yes")
    exit
            
elif for k in range(3):
    if A[k][0]==A[k][1]==A[k][2]==0:
        print("Yes")
        exit
    elif A[0][k]==A[1][k]==A[2][k]==0:
        print("Yes")
        exit

else:
    print("No")

### FIXED CODE ###

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
n = int(input())

for i in range(n):
    b = int(input())
    for j in range(3):
        if A1[j] == b:
            A1[j] = 0
        if A2[j] == b:
            A2[j] = 0
        if A3[j] == b:
            A3[j] = 0

if A1[0]==A1[1]==A1[2]==0:
    print("Yes")
    exit
elif A2[0]==A2[1]==A2[2]==0:
    print("Yes")
    exit
elif A3[0]==A3[1]==A3[2]==0:
    print("Yes")
    exit

elif A1[0]==A2[0]==A3[0]==0:
    print("Yes")
    exit
elif A1[1]==A2[1]==A3[1]==0:
    print("Yes")
    exit
elif A1[2]==A2[2]==A3[2]==0:
    print("Yes")
    exit
    
elif A1[0]==A2[1]==A3[2]==0:
    print("Yes")
    exit
elif A1[2]==A2[1]==A3[0]==0:
    print("Yes")
    exit
else:
    print("No")
from fractions import gcd
import math
def lcm(a, b):
    return abs(a*b) // math.gcd(a, b)
a,b = list(map(int,input().split()))
print(lcm(a,b))



### FIXED CODE ###

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

def lcm(a,b): 
    return (a*b) / gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))
A = []
for i in range(3):
    line = list(map(int, input().split()))
    A.extend(line)
N = int(input())

bingo = [False] * 9

def num_check(num):
    for i in range(9):
        if A[i] == num:
            bingo[i] = True


for _ in range(N):
    num = int(input())
    num_check(num)

bingo_flag = False
# row check
if any([bingo[i] and bingo[i+1] and bingo[i+2] for i in range(0, 9, 3)]):
    bingo_flag = True

# col check
if any([bingo[i] and bingo[i+3] and bingo[i+6] for i in range(3)]):
    bingo_flag = True

# cross check
if (bingo[0] and bingo[4] and bingo[8]) or (bingo[2] and bing[4] and bingo[6]):
    bingo_flag = True

print("Yes") if bingo_flag else print("No")

### FIXED CODE ###

A = []
for i in range(3):
    line = list(map(int, input().split()))
    A.extend(line)
N = int(input())

bingo = [False] * 9

def num_check(num):
    for i in range(9):
        if A[i] == num:
            bingo[i] = True


for _ in range(N):
    num = int(input())
    num_check(num)

bingo_flag = False
# row check
if any([bingo[i] and bingo[i+1] and bingo[i+2] for i in range(0, 9, 3)]):
    bingo_flag = True

# col check
if any([bingo[i] and bingo[i+3] and bingo[i+6] for i in range(3)]):
    bingo_flag = True

# cross check
if (bingo[0] and bingo[4] and bingo[8]) or (bingo[2] and bingo[4] and bingo[6]):
    bingo_flag = True

print("Yes") if bingo_flag else print("No")
N, K = map(int, raw_input().split())

if N-2<=K<=(N-1)*(N-2)/2:
  exit(-1)
else:
  print "-1"


### FIXED CODE ###

N, K = map(int, raw_input().split())

if K<=(N-1)*(N-2)/2:
  E = []
  for i in range(N-1):
    for j in range(i):
      E += [(j, i)]
  E = E[:(N-1)*(N-2)/2-K]
  for i in range(N-1):
    E += [(i, N-1)]
  print len(E)
  for e in E:
    print e[0]+1, e[1]+1
else:
  print "-1"
N,A,B,K = map(int,input().split(" "))
mod = 998244353
ncr = [1]*(N+1)

def gcd(a,b):
	return a if b == 0 else gcd(b,a%b)
v = 1
for i in range(N):
	v = (v * ((N-i)%mod) * pow((i+1),mod-2,mod)) % mod
	ncr[i+1] = v%mod

g = gcd(max(A,B),min(A,B))
if K % g != 0:
	print(0)
	exit(0)

A //= g
B //= g
K //= g
pat = 0
for a in range(N):
	if (K - (a * A)) % B == 0:
		pat += ncr[a]*ncr[(K - (a * A))//B]
		pat %= mod

print(pat % mod)
	

### FIXED CODE ###

N,A,B,K = map(int,input().split(" "))
mod = 998244353
ncr = [1]*(N+1)
v = 1
for i in range(N):
	v = (v * ((N-i)%mod) * pow((i+1),mod-2,mod)) % mod
	ncr[i+1] = v%mod

pat = 0
for a in range(N+1):
	if (K - (a * A) < 0):
		break
	if (K - (a * A)) % B == 0 and ((K - (a * A))//B) <= N:
		pat += ncr[a]*ncr[(K - (a * A))//B]
		pat %= mod

print(pat % mod)
n = int(input())
a = [i in int(input())]
for  i in range(1,n+1):
    v  = a[i]
    j = i-1
    while a[j]>a[j+1] and j>=0:
        a[j+1] = a[j]
        a[j] = v
        j -=1


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
for  i in range(n):
    v  = a[i]
    j = i-1
    while a[j]>v and j>=0:
        a[j+1] = a[j]
        j -=1

    a[j+1] = v
    print(*a)