Harryxun/stf_run huggingface dataset:
H, W = map(int, input().split())
A = tuple(tuple(input()) for _ in range(H))
next_q = [(i, j) for i in range(H) for j in range(W) if A[i][j] == '#']
L = [[0] * W for _ in range(H)]

res = 0
while len(next_q) != 0:
    q, next_q = next_q[:], []
    while len(q) != 0:
        y, x = q.pop(0)
        if y > 0 and L[y - 1][x] == 0:
            L[y - 1][x] = 1
            next_q.append((y - 1, x))
        if y < W - 1 and L[y + 1][x] == 0:
            L[y + 1][x] = 1
            next_q.append((y + 1, x))
        if x > 0 and L[y][x - 1] == 0:
            L[y][x - 1] = 1
            next_q.append((y, x - 1))
        if x < H - 1 and L[y][x + 1] == 0:
            L[y][x + 1] = 1
            next_q.append((y, x + 1))
    if len(next_q) == 0: break
    res += 1
print(res)


### FIXED CODE ###

from collections import deque
import copy
H, W = map(int, input().split())
A = tuple(tuple(input()) for _ in range(H))
L=[[0]*W for _ in range(H)]
next_q=deque()

for i in range(H):
    for j in range(W):
        if A[i][j]=='#':
            L[i][j]=1
            next_q.append((i,j))

q=deque()

res = 0
while len(next_q) != 0:
    q=copy.copy(next_q)
    next_q.clear()
    while q:
        y, x = q.popleft()
        if y > 0 and L[y - 1][x] == 0:
            L[y - 1][x] = 1
            next_q.append((y - 1, x))
        if y < H - 1 and L[y + 1][x] == 0:
            L[y + 1][x] = 1
            next_q.append((y + 1, x))
        if x > 0 and L[y][x - 1] == 0:
            L[y][x - 1] = 1
            next_q.append((y, x - 1))
        if x < W - 1 and L[y][x + 1] == 0:
            L[y][x + 1] = 1
            next_q.append((y, x + 1))
    if len(next_q)==0: break
    res += 1
print(res)
N,L=map(int,input().split())
S = [input() for i in range(N)]
S.sort()
for s in S:
  print(s,end=“”)

### FIXED CODE ###

n,l=map(int,input().split())
a=[]
for i in range(n):
	a.append(str(input()))

a.sort()
ans=''
for i in a:
	ans+=i
print(ans)
n,k,m=map(int, input().split())
for i in range(n-1):
  a[i]=int(input()) 
  Sum+=a[i]
if (Sum+k)/n<m:
  print(-1)
  break
else:
  print(n＊m-Sum)

### FIXED CODE ###

print(chr(ord(input())+1))
import sys
input = sys.stdin.readline
def solve():
  n,z,w = (int(i) for i in input().split())
  a = list(int(i) for i in input().split())
  if n == 1:
    ans = abs(w-a[0])
  else:
    ans = 0
    #最小化する方向に動く
    tmp = abs([n-2]-a[n-1])
    tmp2 = abs(a[n-1]-w)
    ans = max(tmp,tmp2)
  print(ans)
solve()
  

### FIXED CODE ###

import sys
input = sys.stdin.readline
def solve():
  n,z,w = (int(i) for i in input().split())
  a = list(int(i) for i in input().split())
  if n == 1:
    ans = abs(w-a[0])
  else:
    ans = 0
    #最小化する方向に動く
    tmp = abs(a[n-2]-a[n-1])
    tmp2 = abs(a[n-1]-w)
    ans = max(tmp,tmp2)
  print(ans)
solve()
N,Q=list(map(int,input().split()))
cnt=[0]*N
dic={}
for _ in range(N-1):
    temp=list(map(int,input().split()))
    dic.setdefault(temp[0],[]).append(temp[1])
p=[]
X=[]
for _ in range(Q):
    temp2=list(map(int,input().split()))
    p.append(temp2[0])
    X.append(temp2[1])
k=dic.keys()

def tree(o):
    cnt[o]+=add
    for y in dic[o]:
        if y in k:
            tree(y)

for x in range(Q):
    add=X[x]
    cnt[p[x]]+=add
    if p[x] in k:
        tree(p[x])

print(*cnt)

### FIXED CODE ###

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

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)
O = input()
E = input()
Ans = []

for i in range(len(O)):
  Ans.append(O[i])
  Ans.append(E[i])
  
mojiretu = ''.join(Ans)
print(mojiretu)

### FIXED CODE ###

O = input()
E = input()
Ans = []

if len(O) - len(E) == 0:
  for i in range(len(O)):
  	Ans.append(O[i])
  	Ans.append(E[i])
else:
  for i in range(len(E)):
    Ans.append(O[i])
    Ans.append(E[i])
  Ans.append(O[len(O)-1])
  
print(''.join(Ans))
def resolve():
    K = int(input())
    temp = 0
    for i in range(1, K + 1, 1):
        for j in range(1, K + 1, 1):
            for k in range(1, K + 1, 1):
                Result = fractions.gcd(i, j)
                temp += fractions.gcd(Result, k)
    print(temp)
resolve()

### FIXED CODE ###

import math
def resolve():
    K = int(input())
    temp = 0
    for i in range(1, K + 1, 1):
        for j in range(1, K + 1, 1):
            for k in range(1, K + 1, 1):
                Result = math.gcd(i, j)
                temp += math.gcd(Result, k)
    print(temp)


resolve()
print("APPROVED" if int(input()) == xsum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)]) else "DENIED")

### FIXED CODE ###

n = int(input())
x = sum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)])
print("APPROVED" if n == x else "DENIED")
N, K = map(int, input().split())
H = list(map(int, input().split())
num = 0
for i in H:
    if i >= K:
        num += 1

print(num)


### FIXED CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
num = 0
for i in H:
    if i >= K:
        num += 1

print(num)
# -*- coding: utf-8 -*-
# 整数の入力
A=input()
B=input()
ans=str()
if len(A)==len(B):
  for i in range (0,len(A)):
    ans+=A[i]+B[i]
else:
  for i in range (0,len(A)):
    ans+=A[i]+B[i]
  ans+=A[-1]
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
A=input()
B=input()
ans=str()
if len(A)==len(B):
  for i in range (0,len(A)):
    ans+=A[i]+B[i]
else:
  for i in range (0,len(A)-1):
    ans+=A[i]+B[i]
  ans+=A[-1]
print(ans)
n = int(input())
ls = list(map(int,input().split()))
a = [0 for j in range(n)]
for i in range(n):
    a[i] = [ls[i],str(i+1)]
a.sort()
for k in range(n):
    print(a[k][1],end=' ')

### FIXED CODE ###

n = int(input())
if n % 2 == 0:
    print(0.5)
else:
    print((int(n/2)+1)/n)
n = int(input())
a = list(map(int,input().split()))
ball = [0 for i in range(n)]
count = 0
index = []

for i in range(n-1, (n+1)//2 +1 , -1):
    if a[i] == 1:
        ball[i] = 1
        count += 1
        index.append(i+1)
for i in range((n+1)//2, -1, -1):
    if ball[i + (i+1)] % 2 != a[i]:
        ball[i] = ball[i + (i+1)] + 1
        count += 1
        index.append(i+1)
    else:
        ball[i] = ball[i + (i+1)]
        
ans = ""
for i in range(len(index)):
    if i < len(index)-1:
        ans += str(index[i]) + " "
    else:
        ans += str(index[i])
print(count)
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ball = [0 for i in range(n)]
count = 0 #ボールが入ってる箱の数
index = [] #ボールが入ってる番号

for i in range(n-1, -1, -1):
    balls = 0
    j = i
    while j +(i+1) < n:
        j += i + 1
        balls += ball[j]
    
    if a[i] != balls%2:
        ball[i] = 1
        count += 1
        index.append(i+1)
        
ans = ""
for i in range(len(index)):
    if i < len(index)-1:
        ans += str(index[i]) + " "
    else:
        ans += str(index[i])
print(count)
print(ans)
N = int(input())
A = int(input())
B = int(input())

if N = 2:
  print(A+B)
elif N =1:
  print("Hello World")

### FIXED CODE ###

N = int(input())
if N ==1:
  print("Hello World")
elif N == 2:
  A = int(input())
  B = int(input())
  print(A+B)
H, W = map(int, input().split())
A = [list(input().split()) for _ in range(H)]

ans = "Impossible"
d = [(1, 0), (0, 1)]


def f(y, x):
    if y == H-1 and x == W-1:
        global ans
        ans = "Possible"
        return
    elif not (0 <= y < H and 0 <= x < W):
        return
    elif A[y][x] == ".":
        return
    
    f(y+1, x)
    f(y, x+1)


f(0, 0)
print(ans)

### FIXED CODE ###

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

ans = "Impossible"

cnt = 0
for a in A:
    cnt += a.count("#")

if cnt == H + W - 1:
    ans = "Possible"

print(ans)
import numpy as np

N = int(input())
A = list(map(int, input().split()))
arr_A = np.array(A)

ans = np.prod(A)

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
ans = 1
flag = 1
if 0 in A:
    ans = 0
else:
    for i in range(N):
        ans *= A[i]
        if ans > 10 ** 18:
            flag = 0
            break

if flag == 0:
    print(-1)
else:
    print(ans)
nm_lst = list(map(int, input().split()))
city_lst = [list(map(int, (str(i)+' '+input()).split())) for i in range(nm_lst[1])]

city_lst = sorted(city_lst, key = lambda x: x[1]*10**7 + x[2])

ans_lst = []
num_num = 0
for n, city in enumerate(city_lst):
    prefec_num = city[1]
    if len(str(prefec_num)) < 6:
        prefec_str = '0' * (6-len(str(prefec_num))) + str(prefec_num)
    if prefec_num != city_lst[n-1][1]:
        num_str = '000001'
        num_num = 1
    else:
        num_num += 1
        num_str = '0' * (6-len(str(num_num))) + str(num_num)
    ans_lst.append([city[0], prefec_str, num_str])
    
ans_lst = sorted(ans_lst, key = lambda x:x[0])

for city in ans_lst:
    print(city[1]+city[2])

### FIXED CODE ###

nm_lst = list(map(int, input().split()))
city_lst = [list(map(int, (str(i)+' '+input()).split())) for i in range(nm_lst[1])]

city_lst = sorted(city_lst, key = lambda x: x[1]*(10**12) + x[2])

ans_lst = []
num_num = 0
for n, city in enumerate(city_lst):
    prefec_num = city[1]
    prefec_str = '0' * (6-len(str(prefec_num))) + str(prefec_num)
    if n == 0 or (prefec_num != city_lst[n-1][1]):
        num_num = 1
    else:
        num_num += 1
    num_str = '0' * (6-len(str(num_num))) + str(num_num)
    ans_lst.append([city[0], prefec_str, num_str])
    
ans_lst = sorted(ans_lst, key = lambda x:x[0])

for city in ans_lst:
    print(city[1]+city[2])
8
WWWWWEEE


### FIXED CODE ###

from itertools import accumulate

n = int(input())
s = [c == 'W' for c in input()]
l = accumulate([0] + s[:-1])
r = accumulate([0] + [not c for c in reversed(s[1:])])
print(min(e + w for e, w in zip(l, reversed(list(r)))))
import sys
import itertools
import bisect

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

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()
    comb = itertools.product([0, 1], repeat=15)

    p = []
    m = []
    for c in comb:
        pt, mt = 0, 0
        for i in range(len(c)):
            pt += c[i] * (4 ** i)
            mt += c[i] * 2 * (4 ** i)
        p.append(pt)
        m.append(mt)

    p.sort()
    m.sort()

    for i in range(len(p)):
        if p[i] < N:
            continue
        else:
            pred_m = -(N - p[i])
            j = bisect.bisect_left(m, pred_m)
            if m[j] == pred_m:
                pred_p = p[i]
                break

    ans = pred_p | pred_m
    print(bin(ans)[2:])


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import itertools
import bisect

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

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    N = in_n()
    comb = itertools.product([0, 1], repeat=16)

    p = []
    m = []
    for c in comb:
        pt, mt = 0, 0
        for i in range(len(c)):
            pt += c[i] * (4 ** i)
            mt += c[i] * 2 * (4 ** i)
        p.append(pt)
        m.append(mt)

    p.sort()
    m.sort()

    for i in range(len(p)):
        if p[i] < N:
            continue
        else:
            pred_m = -(N - p[i])
            j = bisect.bisect_left(m, pred_m)
            if m[j] == pred_m:
                pred_p = p[i]
                break

    ans = pred_p | pred_m
    print(bin(ans)[2:])


if __name__ == '__main__':
    main()
import numpy as np
from statistics import median
N = int(input())
A = list(map(lambda x:int(x),input().split(" ")))
npA = np.array(A)
B = npA-(1+np.arange(len(npA)))
opt_b = median(B)
print(int(np.sum(np.abs(B-opt_b))))

### FIXED CODE ###

N = int(input())
if N%2 == 0:
    ans = N
else:
    ans = N*2
print(ans)
n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total2)
    else:
        print(total)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
total = 0
for i in range(n):
    a[i] = a[i] - (i + 1)
if n == 1:
    print(0)
    exit()
a.sort()
if n % 2 == 0:
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    print(total)
else:
    total2 = 0
    ave = a[int(n/2)]
    for i in range(n):
        total += abs(a[i] - ave)
    ave = a[int((n + 1)/2)]
    for i in range(n):
        total2 += abs(a[i] - ave)
    if total2 >= total:
        print(total)
    else:
        print(total2)
n = int(input())
if n % 2 != 0:
    print(0)
    exit()

m = 10
a = []
b = []
while m <= n:
    a.append(n // m)
    m *= 5
    if len(a) > 1:
      b.append(a[-2] - a[-1])
b.append(a[-1])

ans = 0
for i in range(len(b)):
    ans += (i+1)*b[i]
print(ans)

### FIXED CODE ###

n = int(input())
if n % 2 != 0:
    print(0)
    exit()

m = 10
a = []
b = []
while m <= n:
    a.append(n // m)
    m *= 5
    if len(a) > 1:
      b.append(a[-2] - a[-1])
if a:
    b.append(a[-1])

ans = 0
for i in range(len(b)):
    ans += (i+1)*b[i]
print(ans)
# -*- coding:utf-8 -*-

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

    tree = [[] for _ in range(N)]  # 木構造
    anss = [0 for _ in range(N)]
    for _ in range(N-1):
        a, b = list(map(int, input().split()))
        tree[a-1].append(b-1)

    def dfs(a, x):
        anss[a] += x

        for b in tree[a]:
            dfs(b, x)

    for _ in range(Q):
        p, x = list(map(int, input().split()))
        dfs(p-1, x)

    print(" ".join(map(str, anss)))


if __name__ == "__main__":
    solve()


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
N, Q = map(int, sys.stdin.readline().split())
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(N-1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]

rin = [[] for _ in range(N)]
for v in a_b:
    rin[v[0]-1].append(v[1]-1)
    rin[v[1]-1].append(v[0]-1)

score = [0 for _ in range(N)]
for ele in p_x:
    score[ele[0]-1] +=ele[1]
#print(score)

def dfs(p, bp=-1):
    for c in rin[p]:
        if c != bp:
            #print(c)
            score[c]+= score[p]
            dfs(c, p)

dfs(0)
print(*score)
n = int(input())

if n in '9':
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = str(input())

if N[0] == '9' or N[1] == '9':
  print('Yes')
else:
  print('No')
sum = 0
zero = 0
for i in range(3):
	tmp = input().split()
	for j in range(3):
    	if int(tmp[j]) == 0:
    		zero += 1
        else:
        	sum += int(tmp[j])    
if sum%3 ==0 and zero%3 ==0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

sum = 0
list = [[0 for x in range(3)] for y in range(3)]
for i in range(3):
    tmp = input().split()
    list[i] = tmp
    sum += int(tmp[0]) + int(tmp[1]) + int(tmp[2])

flg = True
if sum%3 ==0:
    for n in range(2):
        for m in range(2):
            if (int(list[n][m]) + int(list[n+1][m+1]))!=(int(list[n+1][m])+int(list[n][m+1])):
                flg = False
                break
    if flg:
        print('Yes')
    else:
        print('No')
else:
  print('No')
# https://atcoder.jp/contests/abc070/tasks/abc070_c

from functools import reduce
import math

# 最小公倍数を求める問題だ！！
# 参考：
# https://note.nkmk.me/python-gcd-lcm/
# 上記リンク先に最大公約数も載ってた

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def lcm_base(x, y):
    return (x * y // math.gcd(x, y))

def lcm_list(list):
    return reduce(lcm_base, list, 1)

lcm = lcm_list(T)

print(lcm)


### FIXED CODE ###

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        x, y = y, x % y
    return y


ans = T[0]
for i in range(1, N):
    ans *= T[i] // gcd(ans, T[i])

print(ans)
if __name__ == '__main__':
    '''
    doc
    '''
    pattern_sum = 0
    a_list = input().split()
    while a_list[0]!='0' or a_list[1]!='0':
        for i in range(1,int(a_list[0])-1):
            for j in range(i+1,int(a_list[0])):
                for k in range(j+1,int(a_list[0])+1):
                    if i+j+k == int(a_list[1]):
                        pattern_sum+=1

        print(pattern_sum)
        a_list = input().split()

### FIXED CODE ###

if __name__ == '__main__':
    a_list = [int(f) for f in raw_input().split()]
    while a_list[0]!=0 or a_list[1]!=0:
        pattern_sum = 0
        for i in range(1,a_list[0]-1):
            for j in range(i+1,a_list[0]):
                for k in range(j+1,a_list[0]+1):
                    if i+j+k == a_list[1]:
                        pattern_sum+=1
        print pattern_sum
        a_list = [int(f) for f in raw_input().split()]
H,W = map(int, input().split())
h,w = map(int, input().split())
answer = (H-h)*(W-w)
print(ans)

### FIXED CODE ###

H,W = map(int,input().split())
h,w = map(int,input().split())
ans = (H-h)*(W-w)
print(ans)
for i in input():
	print(Case i: int(input()))


### FIXED CODE ###

c=0
while True:
	x = int(input())
	c+=1
	if x ==0:
		break
	print("Case {}: {}".format(c,x))
x,t=input().split()
 
print(max(x-t,0))

### FIXED CODE ###

x,t=map(int, input().split())

print(max(x-t,0))
import math
a,b,c,d = map(int, raw_input())

length = math.sqrt((a - c) ** 2 + (b - d) ** 2)
print length

### FIXED CODE ###

import math
a,b,c,d = map(float, raw_input().split())

length = math.sqrt((a - c) ** 2 + (b - d) ** 2)
print length
MOD=1000000007
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
pos=[]
neg=[]
nzero=0
for i in a:
    if i>0:
        pos.append(i)
    elif i<0:
        neg.append(-i)
    else:
        nzero+=1
if nzero+k>n:
    print(0)
elif len(pos)==0:
    res=1
    if k%2:
        neg.sort()
        for i in range(k):
            res*=MOD-neg[i]
            res%=MOD
    else:
        neg.sort(reverse=True)
        for i in range(k):
            res*=MOD-neg[i]
            res%=MOD
    print(res)
elif len(neg)==0:
    res=1
    pos.sort(reverse=True)
    for i in range(k):
        res*=pos[i]
        res%=MOD
    print(res)
else:
    pos.sort(reverse=True)
    neg.sort(reverse=True)
    ruip=[1 for i in range(len(pos)+1)]
    ruin=[1 for i in range(len(neg)+1)]
    for i in range(len(pos)):
        ruip[i+1]=ruip[i]*pos[i]
        ruip[i+1]%=MOD
    for i in range(len(neg)):
        ruin[i+1]=ruin[i]*neg[i]
        ruin[i+1]%=MOD
    np=0
    if len(pos)>=k:
        np=k
    elif (k-len(pos))%2:
        np=len(pos)-1
    else:
        np=len(pos)
    while np>=2 and (pos[np-1]*pos[np-2]<neg[k-np-1]*neg[k-np-2]):
        np-=2
        if np+len(neg)<n:
            np+=2
            break
    print((ruip[np]*ruin[k-np])%MOD)


### FIXED CODE ###

MOD=1000000007
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
pos=[]
neg=[]
nzero=0
for i in a:
    if i>0:
        pos.append(i)
    elif i<0:
        neg.append(-i)
    else:
        nzero+=1
if nzero+k>n:
    print(0)
elif nzero+k==n and len(pos)>0 and len(neg)>0:
    if nzero==0:
        res=1
        for i in pos+neg:
            res*=i
            res%=MOD
        if len(neg)%2:
            res*=-1
            res+=MOD
        print(res)
    elif len(neg)%2:
        print(0)
    else:
        res=1
        for i in pos+neg:
            res*=i
            res%=MOD
        print(res)
elif len(pos)==0:
    res=1
    if k%2 and nzero>0:
        print(0)
    elif k%2:
        neg.sort()
        for i in range(k):
            res*=MOD-neg[i]
            res%=MOD
        print(res)
    else:
        neg.sort(reverse=True)
        for i in range(k):
            res*=MOD-neg[i]
            res%=MOD
        print(res)
elif len(neg)==0:
    res=1
    pos.sort(reverse=True)
    for i in range(k):
        res*=pos[i]
        res%=MOD
    print(res)
else:
    pos.sort(reverse=True)
    neg.sort(reverse=True)
    ruip=[1 for i in range(len(pos)+1)]
    ruin=[1 for i in range(len(neg)+1)]
    for i in range(len(pos)):
        ruip[i+1]=ruip[i]*pos[i]
        ruip[i+1]%=MOD
    for i in range(len(neg)):
        ruin[i+1]=ruin[i]*neg[i]
        ruin[i+1]%=MOD
    np=0
    if len(pos)>=k:
        np=k
    elif (k-len(pos))%2:
        np=len(pos)-1
    else:
        np=len(pos)
    while np>=2 and (pos[np-1]*pos[np-2]<neg[k-np+1]*neg[k-np]):
        np-=2
        if len(neg)-1<k-np+1:
            break
    print((ruip[np]*ruin[k-np])%MOD)
# coding: utf-8
# Here your code !
x = input('The Integer is ')
# x = input('The Integer is ')
h = int(x) / 3600
m = (int(x) % 3600) / 60
s = int(x) - int(h) * 3600 - int(m) * 60
print(int(h)+':'+int(m)+':'+int(s))

### FIXED CODE ###

# coding: utf-8
# Here your code !
x = input()
h = int(x) / 3600
m = (int(x) % 3600) / 60
s = int(x) - int(h) * 3600 - int(m) * 60
print('%d:%d:%d'%(h,m,s))
N = int(input())
A = list(int(i) for i in input().split())
B = list(int(i) for i in input().split())
C = list(int(i) for i in input().split())
A.sort()
B.sort()
C.sort()
sum = 0
for j in range(N):
    low = low2 = 0
    high = high2 = N
    b = B[j]
    #print(b)
    while(high>low):
        mid = (high + low)//2
        if b > A[mid]:
            low = mid +1
        else:
            high = mid
    acount = mid
    while (high2>low2):
        mid2 = (high + low)//2
        if b < C[mid2]:
            high2 = mid2
        else:
            low = mid2 + 1
    ccount=N-mid2
    sum += acount*ccount
print(sum)

### FIXED CODE ###

N = int(input())
A = list(int(i) for i in input().split())
B = list(int(i) for i in input().split())
C = list(int(i) for i in input().split())
A.sort()
B.sort()
C.sort()
sum = 0
for j in range(N):
    low = low2 = 0
    high = high2 = N
    b = B[j]
    mid = mid2 = 0
    #print(b)
    while(high>low):
        mid = (high + low)//2
        if b > A[mid]:
            low = mid +1
        else:
            high = mid
    acount = low
    while (high2>low2):
        mid2 = (high2 + low2)//2
        if b < C[mid2]:
            high2 = mid2
        else:
            low2 = mid2 + 1
    ccount=N-low2
    sum += acount*ccount
print(sum)
A, B, K = map(int, input().split())
if K <= A:
  print(*[A-K, B])
elif K <= A + B:
  print(*[0, B-(K-A)])
else:
  print(*[0, 0])


### FIXED CODE ###

T, S = map(str, input().split())
print(S + T)
n,k = map(int, input(),split())

if n%k == 0 or k%n == 0:
  print(0)
  
else:
  print(1)

### FIXED CODE ###

N,K = map(int,input().split())
if N % K == 0:
  print(0)
else:
  print(1)
nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)


### FIXED CODE ###

nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)