Harryxun/stf_run huggingface dataset:
n, m, k = map(int, input().split())
a = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
b = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
ans = 0
kazu = 0
c_a = 0
c_b = 0
time = 0
'''
a.append(10**9 + 1)
b.append(10**9 + 1)


while True:
    if time + min(a[c_a],b[c_b])>k:
        break
    if a[c_a]>b[c_b]:
        time += b[c_b]
        c_b += 1
    elif a[c_a]<b[c_b]:
        time += a[c_a]
        c_a += 1

    ans += 1
'''
a = [0]+a
b = [0]+b

for i in range(1,n+1):
    a[i]= a[i-1]+a[i]
for i in range(1,m+1):
    b[i]= b[i-1]+b[i]

for i in range(0,n+1):
    for j in range(min(0,kazu-i+1),m+1):
        time = a[i] + b[j]
        if time > k:
            break
        kazu = i + j

print(kazu)


### FIXED CODE ###

n, m, k = map(int, input().split())
a = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
b = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
kazu = 0
c_a = 0
c_b = 0
time = 0

a = [0]+a
b = [0]+b

for i in range(1,n+1):
    a[i]= a[i-1]+a[i]
for i in range(1,m+1):
    b[i]= b[i-1]+b[i]

for i in range(0,n+1):
    for j in range(max(0,kazu-i+1),m+1):
        time = a[i] + b[j]
        if time > k:
            break
        kazu = i + j

print(kazu)
n,q= [int(i) for i in input().split()]

edge = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)

def dfs(now, last, x):
    global node
    node[now]+=x
    for nxt in edge[now]:
        if nxt == last: continue
        if nxt > now: dfs(nxt, now, x)

node=[0] * (n)
for _ in range(q):
    p,x=[int(i) for i in input().split()]
    dfs(p-1, -1, x)
print(node)
    



### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1]

n , q = map(int,input().split())
point = [0] * n
edge = [[] for i in range(n)]

for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)

for _ in range(q):
    a , b = map(int,input().split())
    point[a-1] += b

def dfs(now, last=-1):
    for nxt in edge[now]:
        if nxt==last: continue
        point[nxt] += point[now]
        dfs(nxt, now)
dfs(0)
print(*point)
import math
import sys

n,m = map(int, input().split())
s = input()
t = input()

if s[0] != t[0]:
	print(-1)
	sys.exit()

GCD = math.gcd(n,m)

if GCD == 1:
	print(n*m)
	sys.exit()

LCM = n*m//GCD


s_k = LCM//m
t_k = LCM//n
for i in range(GCD):
	if s[i*s_k] != t[i*t_k]:
		print(-1)
		sys.exit()

print(LCM)

	

### FIXED CODE ###

import math
import sys

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


n,m = map(int, input().split())
s = input()
t = input()

if s[0] != t[0]:
	print(-1)
	sys.exit()

GCD = gcd(n,m)

if GCD == 1:
	print(n*m)
	sys.exit()

LCM = n*m//GCD


s_k = LCM//m
t_k = LCM//n
for i in range(GCD):
	if s[i*s_k] != t[i*t_k]:
		print(-1)
		sys.exit()

print(LCM)
N, M = input().split(" ")
N = int(N)
M = int(M)

list = [[] for i in range(N)]
# print(list)

for i in range(M):
    p, S = input().split(" ")
    p = int(p)
    if "AC" not in list[p-1]:
        list[p-1].append(S)
    else:
        pass
pe = 0
cl = 0
for l in list:
    if "AC" in l:
        for i in l:
            if i == "AC":
                cl += 1
            else:
                pe += 1
    else:
        pass
print(cl, pe)


### FIXED CODE ###

p = input()
print(chr(ord(p)+1))
import numpy as np
N = int(input())
x = [0]*N
u = [0]*N
for i in range(N):
    x[i], u[i]= map(input().split())

### FIXED CODE ###

import numpy as np
N = int(input())
x = [0]*N
u = [0]*N
for i in range(N):
    x[i], u[i]= map(str, input().split())
    
x_int = [float(j) for j in x]
u_replace = [1 if k =="JPY" else 380000.0 for k in u]

x_arr = np.array(x_int)
u_arr = np.array(u_replace).reshape(N, 1)

ans = np.dot(x_arr, u_arr)
print(ans[0])
N=int(input())
answer=""
for i in range(N):
	if answer!="":
		answer+="\n"
	a=map(int,input().split())
	a.sort()
	if a[0]**2+a[1]**2==a[2]**2:
		answer+="YES"
	else:
		answer+="NO"
print(answer)

### FIXED CODE ###

def d(a):
	return int(a)

N=int(input())
answer=""
for i in range(N):
	if answer!="":
		answer+="\n"
	a=input().split()
	
	a.sort(key=d)
	if int(a[0])**2+int(a[1])**2==int(a[2])**2:
		answer+="YES"
	else:
		answer+="NO"
print(answer)
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 <= 4.0 else False
 
def largestGroup(mtrx,num):
    mx = 1
    #ls = [num]
    #for i in mtrx[num]:
    #    if i == num:
    #    	continue
    #   	m = youKnow(mtrx,ls,i)
    #    mx = max(mx,m)
    return mx
 
def youKnow(mtrx,ls,num):
    mx = len(ls)
    if set(ls) <= set(mtrx[num]):
        if num not in ls:
            ls.append(num)
        for i in list(set(mtrx[num])-set(ls)):
            m = youKnow(mtrx,ls,i)
            mx = max(mx,m)
    return mx
 
while True:
    max_over = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
 
    overs = []
    for i in range(n):
        over = []
        for j in range(n):
            if isOver(seals[i],seals[j]):
                over.append(j)
        overs.append(over)
         
    ref = [i for i in range(n)]
    for i in ref:
       num_over = largestGroup(overs,i)
       for j in overs[i]:
           ref.remove(j)
       if num_over > max_over:
           max_over = num_over
    print max_over

### FIXED CODE ###

def isOver(array,x,y):
	return True if (array[0]-x)**2+(array[1]-y)**2 <= 1.01 else False
	
while True:
    mx = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
    x = 0
    while x < 10.0:
    	y = 0.0
    	while y < 10.0:
    		num = 0
    		for seal in seals:
    			if isOver(seal,x,y):
    				num += 1
    		mx = max(mx,num)
    		y += 0.1
        x += 0.1
    print mx
N = int(input())
vals = [int(v) for v in input().split()]

rslt = 1

for v in vals:
  rslt = rslt * v
  
  if rslt > 10 ** 18:
    print(-1)
	import sys
    sys.exit()
    
print(rslt)
    


### FIXED CODE ###

N = int(input())
vals = [int(v) for v in input().split()]

rslt = 1

if 0 in vals:
  rslt = 0

for v in vals:
  rslt = rslt * v
  
  if rslt > 10 ** 18:
    rslt = -1
    break

print(rslt)
c = [[int(input()) for i in range(3)] for i in range(3)]

if c[0][0]+c[1][0]-2*c[2][0]+c[0][1]+c[1][1]-2*c[2][1]-2*c[0][2]-2*c[1][2]+4*c[2][2] == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

c = [list(map(int, input().split())) for i in range(3)]

if c[0][0]+c[1][0]-2*c[2][0]+c[0][1]+c[1][1]-2*c[2][1]-2*c[0][2]-2*c[1][2]+4*c[2][2] == 0:
  print("Yes")
else:
  print("No")
N, K = map(int, input().split())
A = list(map(int, input().split()))

window = sum(A[0:K])
max_s = 0
for i in range(N - K):
    window -= A[i]
    window += A[i + K]
    sum_w = sum(window)
    if sum_w > max_s:
        max_s = sum_w
print((max_s+K) / 2)

### FIXED CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
s = [0] * 1000000
for i in range(N):
    s[i+1] = s[i] + A[i]

max_s = 0
for i in range(N):
    if max_s < s[i+K] - s[i]:
        max_s = s[i+K] - s[i]


print((max_s+K) / 2)
H, W = map(int, input().split(" "))

s = [list(input()) for _ in range(0, H)]

d = {}
def walk(i, j, c):
	if i < 0 or i >= H or j < 0 or j >= W:
		return
	if s[i][j] != ".":
		return
	if (i, j) in d and c >= d[(i, j)]:
		return

	d[(i, j)] = c
	for z in range(i-1, i+2):
		walk(z, j, c+1)
	for z in range(j-1, j+2):
		walk(i, z, c+1)

walk(0, 0, 1)
if (H-1, W-1) in d:
	print("".join(map(lambda x: "".join(x), s)).count(".") - d[(H-1, W-1)])
else:
	print(-1)


### FIXED CODE ###

INF=10*10
H,W=map(int, input().split())
s=[list(input()) for _ in range(H)]
wall=sum(map(lambda x: x.count("#"), s))
d=[[INF for _ in range(W)] for _ in range(H)]
def bfs(h, w, c):
	if d[h][w] <= c:
		return
	d[h][w] = c
	for dh,dw in [(0, -1), (-1, 0), (0, 1), (1, 0)]:
		if h+dh >= 0 and w+dw >= 0 and h+dh < H and w+dw < W and s[h+dh][w+dw] == ".":
			bfs(h+dh, w+dw, c+1)
bfs(0, 0, 1)
print(-1 if d[H-1][W-1] == INF else H*W - d[H-1][W-1] - wall)
def main():
    S = input()
    K = int(input())
    l = []
    t = 1
    m = S[0]
    if len(S) == 2:
        if S[0] == S[1]:
            print(K)
            return
        else:
            print(0)
            return
    if len(S) == 3:
        if S[0] == S[1] == S[2]:
            print(3*K//2)
            return
        elif S[0] == S[1] or S[1] == S[2]:
            print(K)
            return
        elif S[0] == S[2]:
            print(K-1)
            return
        else:
            print(0)
            return
    for v in S[1:]:
        if v == m:
            t += 1
        elif t != 1:
            l.append(t)
            t = 1
        m = v
    if t != 1:
        l.append(t)
    ls = 0
    if S[0] == S[-1]:
        if len(l) == 1:
            print(len(l)*K//2)
            return
        if S[0] == S[1] == S[-2]:
            ls = l[-1] + l[0]
            l = l[1:-1]
        elif S[-1] == S[-2]:
            ls = l[-1] + 1
            l = l[:-1]
        elif S[0] == S[1]:
            ls = l[0] + 1
            l = l[1:]
        else:
            ls = 2
    r = 0
    for i in l:
        if i % 2 == 0:
            r += i // 2
        else:
            r += (i - 1)//2
    r *= K
    if ls % 2 == 0:
        r += (K-1) * (ls // 2)
    else:
        r += (K-1) * ((ls - 1) // 2)
    if ls > 2 and ls % 2 == 0:
        r += ls  // 2
    elif ls > 2:
        r += (ls - 1) // 2
    print(r)
main()


### FIXED CODE ###

def main():
    S = input()
    K = int(input())
    l = []
    t = 1
    m = S[0]
    if len(S) == 1:
        print(K//2)
        return
    if len(S) == 2:
        if S[0] == S[1]:
            print(K)
            return
        else:
            print(0)
            return
    if len(S) == 3:
        if S[0] == S[1] == S[2]:
            print(3*K//2)
            return
        elif S[0] == S[1] or S[1] == S[2]:
            print(K)
            return
        elif S[0] == S[2]:
            print(K-1)
            return
        else:
            print(0)
            return
    for v in S[1:]:
        if v == m:
            t += 1
        elif t != 1:
            l.append(t)
            t = 1
        m = v
    if t != 1:
        l.append(t)
    ls = 0
    lsm = 0
    lsu = 0
    if S[0] == S[-1]:
        if len(l) == 1 and l[0] == len(S):
            print(l[0] * K//2)
            return
        elif len(l) == 1:
            print(((l[0] + 1)//2) *(K-1) + (l[0] // 2))
            return
        if S[0] == S[1] == S[-2]:
            ls = l[-1] + l[0]
            lsm = l[0]
            lsu = l[-1]
            l = l[1:-1]
        elif S[-1] == S[-2]:
            ls = l[-1] + 1
            lsu = l[-1]
            l = l[:-1]
        elif S[0] == S[1]:
            ls = l[0] + 1
            lsm = l[0]
            l = l[1:]
        else:
            ls = 2
    r = 0
    for i in l:
        r += i // 2
    r *= K
    r += (K-1) * (ls // 2)
    r += (lsm  // 2) + (lsu // 2)
    print(r)
main()
if __name__ == "__main__":
    n = input()
    F = []
    F.append(1)
    F.append(1)
    for i in range(2,n+1):
        F.append(F[i-1] + F[i-2])
        print(F[i])

    print(F[n])

### FIXED CODE ###

if __name__ == "__main__":
    n = input()
    F = []
    F.append(1)
    F.append(1)
    for i in range(2,n+1):
        F.append(F[i-1] + F[i-2])

    print(F[n])
if __name__ == '__main__':
    A, B, C, D = map(int, input().split())

    if B <= C or D <= A:
        print(0)
    else:
        if A < C:
            print(B-C)
        elif A > C
            print(D - A)
        else:
            if B < D:
                print(B-A)
            else:
                print(D-A)

### FIXED CODE ###

if __name__ == '__main__':
    A, B, C, D = map(int, input().split())

    if B <= C or D <= A:
        print(0)
    else:
        if A < C:
            if B < D:
                print(B-C)
            else:
                print(D-C)
        elif A > C:
            if B < D:
                print(B-A)
            else:
                print(D-A)
        else:
            if B < D:
                print(B-A)
            else:
                print(D-A)
N, M = map(int, input().split())
P = [[] for i in range(N)]
L = [[] for i in range(M)]
for i in range(N):
    I = list(map(int, input().split()))
    for l in I[1:]:
        P[i].append(l-1)
        L[l-1].append(i)

P_visited = [0] * N
L_visited = [0] * M


# flgが立っていれば、人を見ているとする
def dfs(n, flg):
    if flg:
        P_visited[n] = 1
        for l in P[n]:
            if not L_visited[l]:
                dfs(l, flg ^ 1)
    else:
        L_visited[n] = 1
        for p in L[n]:
            if not P_visited[p]:
                dfs(p, flg ^ 1)


dfs(0, 1)
print("YES" if all(P_visited) else "NO")


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N, M = map(int, input().split())
P = [[] for i in range(N)]
L = [[] for i in range(M)]
for i in range(N):
    I = list(map(int, input().split()))
    for l in I[1:]:
        P[i].append(l-1)
        L[l-1].append(i)

P_visited = [0] * N
L_visited = [0] * M


# flgが立っていれば、人を見ているとする
def dfs(n, flg):
    if flg:
        P_visited[n] = 1
        for l in P[n]:
            if not L_visited[l]:
                dfs(l, flg ^ 1)
    else:
        L_visited[n] = 1
        for p in L[n]:
            if not P_visited[p]:
                dfs(p, flg ^ 1)


dfs(0, 1)
print("YES" if all(P_visited) else "NO")
n = input()
chars=input().split()
myset=set()
for char in chars:
    myset.add(char)

print(len(myset))

### FIXED CODE ###

print(int(input())//3)
num   = input()
num[3] = "8"
print(num)

### FIXED CODE ###

#日付
num = list(input())
num[3] = "8"
print("".join(num))
N, K = map(int, input().split())
S = input()

before = S[0]
zeros = []
ones = []
zero_cnt = 0
one_cnt = 0
for char in S:
  if char == before:
    if char == '0':
      zero_cnt += 1
    else:
      one_cnt += 1
    before = char
  else:
    if char == '0':
      ones.append(one_cnt)
      zero_cnt = 1
    else:
      zeros.append(zero_cnt)
      one_cnt = 1
    before = char
if S[-1] == '0':
  zeros.append(zero_cnt)
elif S[-1] == '1':
  ones.append(one_cnt)
if len(zeros) <= K:
  print(N)
else:
  if S[1] == '0':
    sum_temp = sum(zeros[:K]) + sum(ones[:K])
    sum_o = sum_temp
    for i in range(len(zeros)-K+1):
      sum_temp = sum_temp - zeros[i] + zeros[i+K] - ones[i] + ones[i+K]
      sum_o = max(sum_o, sum_temp)
    print(sum_o)
  else:
    sum_temp = sum(zeros[:K]) + sum(ones[:K+1])
    sum_o = sum_temp
    for i in range(len(zeros)-K+1):
      sum_temp = sum_temp - zeros[i] + zeros[i+K] - ones[i] + ones[i+K+1]
      sum_o = max(sum_o, sum_temp)
    print(sum_o)
  
    


### FIXED CODE ###

N, K = map(int, input().split())
S = input()

before = S[0]
cnt = 0
same_nums = []
if S[0] == '0':
  same_nums.append(0)
for i in range(N):
  if S[i] == before:
    cnt += 1
  else:
    same_nums.append(cnt)
    before = S[i]
    cnt = 1
same_nums.append(cnt)
if S[-1] == '0':
  same_nums.append(0)
  
sum_nums = sum(same_nums[:2*K+1])
ans = sum_nums
for i in range(0, len(same_nums)-2*K, 2):
  sum_nums = sum_nums - sum(same_nums[i:i+2]) + sum(same_nums[i+2*K+1:i+2*K+3])
  ans = max(ans, sum_nums)
print(ans)
# coding: utf-8


def solve(*args: str) -> str:
    n, m, q = map(int, args[0].split())
    ABCD = [tuple(map(int, abcd.split())) for abcd in args[1:]]

    ret = 0
    stack = [(0, '')]
    while stack:
        d, s = stack.pop()
        S = s+str(d)
        if len(S) == m:
            ret = max(
                ret,
                sum([d for a, b, c, d in ABCD if int(S[b-1])-int(S[a-1]) == c])
            )
            continue

        for i in range(d, 10):
            stack.append((i, S))

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


### FIXED CODE ###

# coding: utf-8


def solve(*args: str) -> str:
    n, m, q = map(int, args[0].split())
    ABCD = [tuple(map(int, abcd.split())) for abcd in args[1:]]

    ret = 0
    stack = [(i, '') for i in range(10)]
    while stack:
        t, s = stack.pop()
        S = s+str(t)
        if len(S) == n:
            ret = max(
                ret,
                sum([d for a, b, c, d in ABCD if int(S[b-1])-int(S[a-1]) == c])
            )
            continue

        for i in range(t, m):
            stack.append((i, S))

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
# -*- coding:utf-8

X = amp(int, raw_input().split())
R = X[0]*X[1]
P = 2*X[0]+2*X[1]
A = str(R)+" "+str(P)
print(A)


### FIXED CODE ###

# -*- coding: utf-8

x = input()
y = x*x*x
print(y)
a, b = map(int, input().split())
c = 0
for i in range(a, b+1):
  if i[0] == i[4] and i[1] == i[3]:
    c += 1
print(c)

### FIXED CODE ###

a, b = map(int, input().split())
c = 0
for i in range(a, b+1):
    i = str(i)
    if i[0] == i[4] and i[1] == i[3]:
        c += 1
print(c)
a=int(input())
b=int(input())
while(a>=b):
	a=abs(a-b)
print(a)

### FIXED CODE ###

n, k = map(int, input().split())
j = n % k
print(j if k-j > j else k-j )
n=int(input())
v=list(map(int,input().split()))
ans1=[0]*(10**5+1)#偶数
ans2=[0]*(10**5+1)#奇数
for i in v[0::2]:
  ans1[i]+=1
for i in v[1::2]:
  ans2[i]+=1
m1=max(ans1)
m2=max(ans2)
flag=False
for i in range(10**5+1):
  if ans1[i]==m1 and ans2[i]==m2:
    flag=True
    ans1.sort()
    ans2.sort()
    m12=ans1[-2]
    m22=ans2[-2]
    break
print(m1,m12,m2,m22)
if len(set(v))==1:
  print(n//2)
elif flag==True:
  print(n-max(m12+m2,m1+m22))
else:
  print(n-m1-m2)

### FIXED CODE ###

n=int(input())
v=list(map(int,input().split()))
ans1=[0]*(10**5+1)#偶数
ans2=[0]*(10**5+1)#奇数
for i in v[0::2]:
  ans1[i]+=1
for i in v[1::2]:
  ans2[i]+=1
m1=max(ans1)
m2=max(ans2)
flag=False
for i in range(10**5+1):
  if ans1[i]==m1 and ans2[i]==m2:
    flag=True
    ans1.sort()
    ans2.sort()
    m12=ans1[-2]
    m22=ans2[-2]
    break
if len(set(v))==1:
  print(n//2)
elif flag==True:
  print(n-max(m12+m2,m1+m22))
else:
  print(n-m1-m2)
[h,w,k]=list(map(int,input().split()))
cake=[]
for i in range(h):
	cake.append(list(map(int,input().split())))
ans=[[0 for i in range(w)]for j in range(h)]
num=1
ichigo=[]
for i in range(h):
	for j in range(w):
		if cake[i][j]=="#":
			ans[i][j]=num
			ichigo.append([i,j,num])
			num+=1
for i in range(len(ichigo)):
	yoko=ichigo[i][1]+1
	while True:
		if yoko==h:
			break
		elif ans[ichigo[i][0]][yoko]==0:
			ans[ichigo[i][0]][yoko]=ichigo[i][2]
			yoko+=1
		else:
			break
for i in range(len(ichigo)):
	left=ichigo[i][1]-1
	while True:
		if left<0:
			break
		elif ans[ichigo[i][0]][left]==0:
			ans[ichigo[i][0]][left]=ichigo[i][2]
			left-=1
		else:
			break

for i in reversed(range(ichigo[0][0])):
	for j in range(w):
		if ans[i][j]==0:
			ans[i][j]=ans[i+1][j]

for i in range(ichigo[0][0],h):
	for j in range(w):
		if ans[i][j]==0:
			ans[i][j]=ans[i-1][j]

for i in range(h):
	for j in range(w):
		print(ans[i][j], end=" ")
	print( )
	

### FIXED CODE ###

[h,w,k]=list(map(int,input().split()))
cake=[]
for i in range(h):
	cake.append(list(input()))
ans=[[0 for i in range(w)]for j in range(h)]
num=1
ichigo=[]
for i in range(h):
	for j in range(w):
		if cake[i][j]=="#":
			ans[i][j]=num
			ichigo.append([i,j,num])
			num+=1
for i in range(len(ichigo)):
	yoko=ichigo[i][1]+1
	while True:
		if yoko==w:
			break
		elif ans[ichigo[i][0]][yoko]==0:
			ans[ichigo[i][0]][yoko]=ichigo[i][2]
			yoko+=1
		else:
			break
for i in range(len(ichigo)):
	left=ichigo[i][1]-1
	while True:
		if left<0:
			break
		elif ans[ichigo[i][0]][left]==0:
			ans[ichigo[i][0]][left]=ichigo[i][2]
			left-=1
		else:
			break

for i in reversed(range(ichigo[0][0])):
	for j in range(w):
		if ans[i][j]==0:
			ans[i][j]=ans[i+1][j]

for i in range(ichigo[0][0],h):
	for j in range(w):
		if ans[i][j]==0:
			ans[i][j]=ans[i-1][j]

for i in range(h):
	for j in range(w):
		print(ans[i][j], end=" ")
	print( )
import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

h,w,a,b=mp()
if h==1 and b==0:
    print("1"*a+"0"*(5-a))
elif w==1 and a==0:
    for i in range(b):
        print("1")
    for i in range(h-b):
        print("0")
elif a*h==b*w:
    for i in range(h//b):
        for k in range(b):
            print("0"*(i*a)+"1"*a+"0"*((h//b-i-1)*a))
else:
    print("No")

### FIXED CODE ###

import sys
from collections import Counter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

h,w,a,b=mp()
for i in range(b):
    print("1"*a+"0"*(w-a))
for i in range(h-b):
    print("0"*a+"1"*(w-a))
import copy

s = input()
X, Y = list(map(int, input().split()))

#少なくとも、右にx,↑にy進まなきゃいけない
# Fはくっつけられる
# s < 8000 よって N^2くらいならok
# Tが1回→左右 2回→前か後ろ 3回→左右
# この性質から、左右は左右のみで考えればいい
# x方向の数字N個をつかって、xを作成する 足し引きのみ 2^N xを加えて0にできるかどうか

s += "T"

now = 1
# 1はx方向、-1はy方向とする
start = 0
go = 0
x = []
y = []
for i in s:
    if i == "T":
        if start == 0:
            X = X - go
            go = 0
            start = 1
        else:
            if go != 0:
                if now == 1:
                    x.append(go)
                else:
                    y.append(go)
                go = 0
        now *= -1
    if i == "F":
        go += 1

X = abs(X)
Y = abs(Y)
x_use = sum(x) - X
y_use = sum(y) - Y
if x_use % 2 == 1 or y_use % 2 == 1 or x_use < 0 or y_use < 0:
    print("No")
    exit()
x_use = x_use//2
y_use = y_use//2


def solve(integer_list, target_sum,  i=0, sum=0):
    if sum > target_sum:
        return False
    if i == len(integer_list):
        return sum == target_sum
    if (solve(integer_list, target_sum, i + 1, sum)):
        return True
    if (solve(integer_list, target_sum, i + 1, sum + integer_list[i])):
        return True
    return False

if solve(x, x_use) and solve(y, y_use):
    print("Yes")
else:
    print("No")




### FIXED CODE ###

import copy

s = input()
X, Y = list(map(int, input().split()))

#少なくとも、右にx,↑にy進まなきゃいけない
# Fはくっつけられる
# s < 8000 よって N^2くらいならok
# Tが1回→左右 2回→前か後ろ 3回→左右
# この性質から、左右は左右のみで考えればいい
# x方向の数字N個をつかって、xを作成する 足し引きのみ 2^N xを加えて0にできるかどうか

s += "T"

now = 1
# 1はx方向、-1はy方向とする
start = 0
go = 0
x = []
y = []
for i in s:
    if i == "T":
        if start == 0:
            X = X - go
            go = 0
            start = 1
        else:
            if go != 0:
                if now == 1:
                    x.append(go)
                else:
                    y.append(go)
                go = 0
        now *= -1
    if i == "F":
        go += 1
x.sort()
y.sort()
x = x[::-1]
y = y[::-1]
X = abs(X)
Y = abs(Y)
x_use = sum(x) - X
y_use = sum(y) - Y
if x_use % 2 == 1 or y_use % 2 == 1 or x_use < 0 or y_use < 0:
    print("No")
    exit()
x_use = x_use//2
y_use = y_use//2


def solve(integer_list, target_sum,  i=0, sum=0):
    if sum > target_sum:
        return False
    if sum == target_sum:
        return True
    if i == len(integer_list):
        return sum == target_sum
    if (solve(integer_list, target_sum, i + 1, sum)):
        return True
    if (solve(integer_list, target_sum, i + 1, sum + integer_list[i])):
        return True
    return False

#if solve(x, x_use) and solve(y, y_use):
#    print("Yes")
#else:
#    print("No")


def part_sum0(a,A):
    #初期化
    N=len(a)
    dp=[[0 for i in range(A+1)] for j in range(N+1)]
    dp[0][0]=1

    #DP
    for i in range(N):
        for j in range(A+1):
            if a[i]<=j: #i+1番目の数字a[i]を足せるかも
                dp[i+1][j]=dp[i][j-a[i]] or dp[i][j]
            else: #入る可能性はない
                dp[i+1][j]=dp[i][j]
    return dp[N][A]
 
if part_sum0(x,x_use) and part_sum0(y, y_use):
    print("Yes")
else:
    print("No")
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
count = 0
for j in range(len(a)-1):
    if(count => 2):
        print(l[0] * l[1])
    if(a[j] == a[j+1]):
        del l[0]
        l.append(a[j])
        j += 1
        count += 1

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
c = 0
i = 0
while(i < len(a)-1):
    if(a[i] == a[i+1]):
        del l[0]
        l.append(a[i])
        i += 1
        c += 1
    if(c >= 2 or i == len(a)-2):
        i = len(a)-1
        print(l[0] * l[1])
    i += 1