Harryxun/stf_run huggingface dataset:
N, M = [int(x) for x in input().strip().split(" ")]

vs = set()
def dfs_w(v, d, t):
    # dfs while版 
    r = -1
    stack = [v]
    path = []
    while True:
        if len(stack) == 0:
            break
        v = stack.pop()
        if v < 0:
            path.pop()
        else:
            path.append(v)
            vs.add(v)
            for u in d[v]:
                if u == t:
                    #print(r,path)
                    if r != -1:
                        r = min(len(path)//3, r)
                    else:
                        r = len(path)//3
                    #continue
                if u in vs:
                    continue
                stack += [-v, u]
    return r

from collections import deque
def bfs(v,d,t,N):
    queue=deque([v])
    dist = [0] * (N+1)
    while True:
        if len(queue) == 0:
            break
        v = queue.popleft()
        for u in d[v]:
            if u in vs:
                continue
            dist[u] = dist[v] + 1
            if u == t:
                return dist[u]//3
            queue.append(u)
    return r

d = [set() for _ in range(3*N+1)]
for _ in range(M):
    a, b = [int(x) for x in input().strip().split(" ")]
    d[a].add(N+b)
    d[N+a].add(2*N+b)
    d[2*N+a].add(b)

s, t = [int(x) for x in input().strip().split(" ")]
print(bfs(s, d, t, 3*N+1))


### FIXED CODE ###

N, M = [int(x) for x in input().strip().split(" ")]
from collections import deque
vs = set()
def bfs(v,d,t,N):
    queue=deque([v])
    dist = [0] * (N+1)
    while True:
        if len(queue) == 0:
            break
        v = queue.popleft()
        for u in d[v]:
            if u in vs:
                continue
            vs.add(u)
            dist[u] = dist[v] + 1
            if u == t:
                return dist[u]//3
            queue.append(u)
    return -1

d = [set() for _ in range(3*N+1)]
for _ in range(M):
    a, b = [int(x) for x in input().strip().split(" ")]
    d[a].add(N+b)
    d[N+a].add(2*N+b)
    d[2*N+a].add(b)

s, t = [int(x) for x in input().strip().split(" ")]
print(bfs(s, d, t, 3*N+1))
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
ans=[a[0]]
ap=a[0]
for i in range(n-1):
    ap*=a[i+1]
    if i>=k-1:
        ans.append(ap/ans[i-k+1])
    else:
        ans.append(ap)
    

for i in range(n-k):
    if ans[i+k-1]>=ans[i+k]:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

n,k=map(int,input().split())
a=[int(i) for i in input().split()]
    

for i in range(n-k):
    if a[i]>=a[i+k]:
        print("No")
    else:
        print("Yes")
# -*- coding: utf-8 -*-
n, m = [int(i) for i in input().split()]
if 2 <= n and m <= 100:
    print(int((n - 1)(m - 1)))

### FIXED CODE ###

n,m = [int(i) for i in input().split()]
if 2 <= n and m <= 100:
    a = int((n - 1)*(m - 1))
    print(a)
n,k=map(int,input().split())
s=input()
lst=[1]
for i in range(1,n):
    if s[i]!=s[i-1]:
        lst.append(1)
    else:
        lst[-1]=lst[-1]+1
p=2*k
L=[0]
for i in lst:
  L.append(L[-1]+i)
l=len(L)
ans=0
if s=='1'*n:
    ans=n
else:
    if s[0]=='1':
        if l%2==0:
            q=(l-p)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
        else:
            L.append(0)
            q=(l-p+1)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
    else:
        L.insert(0,0)
        if l%2==1:
            L.insert(0,0)
            q=(l-p+1)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
        else:
            L.append(0)
            q=(l-p+2)//2
            for i in range(q):
                ans=max(ans,L[2*i+p+1]-L[2*i])
print(ans)
    


### FIXED CODE ###

a,b=map(int,input().split())
print(max(a+a-1,a+b,b+b-1))
import sys

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()
    A = in_nl()

    mod = 10**9 + 7
    num = [0] * 3
    ans = 1

    for i in range(N):
        min_j = 4
        count = 0
        for j in range(3):
            if num[j] == A[i]:
                count += 1
                min_j = min(min_j, j)
        num[min_j] += 1
        ans *= count
        ans %= mod

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

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()
    A = in_nl()

    mod = 10**9 + 7
    num = [0] * 3
    ans = 1

    for i in range(N):
        min_j = 4
        count = 0
        for j in range(3):
            if num[j] == A[i]:
                count += 1
                min_j = min(min_j, j)
        if min_j == 4:
            ans = 0
            break
        num[min_j] += 1
        ans *= count
        ans %= mod

    print(ans)


if __name__ == '__main__':
    main()
n,p = map(int, input().split())
s = input()

ans = 0
p0 = 0
dp = [0] * p
for i n range(s[::-1]):
    i = int(i)
    p0 = p0*10 % p
    dp[p0 + i] += 1
    ans += dp[p0]

print(ans)

### FIXED CODE ###

n,p = map(int, input().split())
s = input()

if(p==2)|(p==5):
    ans = 0
    for i in range(n):
        tmp = int(s[i])
        if(tmp%p == 0):
            ans += (i+1)

    print(ans)
    exit()

ans = 0
tmp = 0
rem = [0] * p
rem[0] = 1
for i in range(n):
    tmp = (tmp + int(s[-1 * (i+1)]) * pow(10, i, p)) % p
    ans += rem[tmp]
    rem[tmp] += 1

print(ans)
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """4"""
        output = """23"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """100"""
        output = """26879"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10000000"""
        output = """838627288460105"""
        self.assertIO(input, output)


if __name__ == "__main__":
    unittest.main()


### FIXED CODE ###

#!/usr/bin/python3
# import bisect
# from collections import Counter, deque, OrderedDict, defaultdict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    ll=[0]*(n+1)
    for i in range(1,n+1):
        for j in range(i,n+1,i):
            ll[j]+=1
    

    ans=0
    for i in range(1,n+1):
        ans+=i*ll[i]

    print(ans)
        

    
resolve()
N = int(input())

for i in range(1, 10):
  for k in range(1,10):
    if N == i * k:
      print("Yes")
      sys.exit()
print("No")


### FIXED CODE ###

import sys
N = int(input())

for i in range(1, 10):
  for k in range(1,10):
    if N == i * k:
      print("Yes")
      sys.exit()

print("No")
a b = list(map(int, input().split()))
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

a, b = list(map(int, input().split()))
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = input()
S = raw_input.split()
for i in range(N)
	if S[i] == 'Y':
		print('Four')
		N = -1
		break
if N = -1:print('Three')

### FIXED CODE ###

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

N = input()
S = raw_input().split()
for i in range(N):
	if S[i] == 'Y':
		print('Four')
		N = -1
		break
if N > -1:
	print('Three')
n,k = map(int, input().split())
p = list(map(int, input().split())) 
c = list(map(int, input().split()))
g = []
for i in range(n):
  ans=c[i]
  e =[ans]
  f = i
  a = 1
  while a<k:
    i = p[i]-1
    if i == f:
      break
    a+=1
    ans+=c[i]
    e.append(ans)
  if e[-1]>0 and a!=k:
    w = k%len(e)
    y = k//len(e)*e[-1]+max(e[:w])
    g.append(y)
  else:
    g.append(max(e))
print(max(g))

### FIXED CODE ###

n,k = map(int, input().split())
p = list(map(int, input().split())) 
c = list(map(int, input().split()))
r = -10**9
for i in range(n):
  ans=c[i]
  e =[ans]
  f = i
  a = 1
  while a<k:
    i = p[i]-1
    if i == f:
      break
    a+=1
    ans+=c[i]
    e.append(ans)
  if e[-1]>0 and a<k:
    w = k%len(e)
    if w!=0:
      y = k//len(e)*e[-1]+max(e[:w])
    else:
      y =( k//len(e)-1)*e[-1]+max(e)
    g=y
  else:
    g=max(e)
  r = max(r,g)
print(r)
s=input()
l=len(s)
q=int(input())
cnt=1

for _ in range(q):
	a=list(input().split())
	if len(a)==1:
		cnt*=(-1)
	else:
		if cnt==1:
			if a[1]=="1":
				s=a[2]+s
			else:
				s=s+a[2]
		else:
			if a[1]=="1":
				s=s+a[2]
			else:
				s=a[2]+s
				
if cnt==-1:
	s=s[::-1]
	
print(s)

### FIXED CODE ###

n,x,y=map(int,input().split())
d=[0]*(n-1)

for i in range(n-1):
	for j in range(i+1,n):
		d[min(j-i-1,abs(x-1-i)+abs(y-1-j))]+=1
		
for i in range(n-1):
	print(d[i])
n = int(input())
b = list(map, input().split())
print(sum(b) + b[0])

### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
ans = 0
ans = b[0] + b[n-2]
for i in range(1, n-1):
  ans += min(b[i-1], b[i])
print(ans)
V = []
C = []
N = 0
 
i = 0
ans = 0

str = input()
N = int(str)
 
str = input().split()
while i < N:
  V[i] = int(str[i])
  i = i+1
  
i=0
str = 0
str = input().split()
while i < N:
  C[i] = int(str[i])
 
while i<N:
  if V[i] > C[i]:
    ans = ans + V[i] - C[i]
    
    
print(ans)

### FIXED CODE ###

N = 0
V = []
C = []
 
i = 0
ans = 0

str = input()
N = int(str)
 
str = input().split()
while i < N:
  V.append(int(str[i]))
  i = i+1
  
i=0
str = 0
str = input().split()
while i < N:
  C.append(int(str[i]))
  i = i+1

i=0
while i<N:
  if V[i] > C[i]:
    ans = ans + V[i] - C[i]
  i = i+1
    
    
print(ans)
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W = LI()
    a = [LI() for _ in range(H)]

    ans = []
    for i in range(H):
        for j in range(W - 1):
            if a[i][j] % 2 == 1:
                a[i][j] -= 1
                a[i][j+1] += 1
                ans.append((i, j, i, j+1))

    for i in range(H - 1):
        if a[i][-1] % 2 == 1:
            a[i][-1] -= 1
            a[i+1][-1] += 1
            ans.append((i, j, i+1, j))

    print(len(ans))
    for i in ans:
        print(*i)

if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    H, W = LI()
    a = [LI() for _ in range(H)]

    ans = []
    # 奇数枚の山のコインを右の山に移動
    if W >= 2:
        for i in range(H):
            for j in range(W - 1):
                if a[i][j] % 2 == 1:
                    a[i][j] -= 1
                    a[i][j+1] += 1
                    ans.append((i + 1, j + 1, i + 1, j + 2))

    # 一番右の列の奇数枚の山のコインを下の山に移動
    if H >= 2:
        for i in range(H - 1):
            if a[i][-1] % 2 == 1:
                a[i][-1] -= 1
                a[i+1][-1] += 1
                ans.append((i + 1, W, i + 2, W))

    # for i in a:
    #     print(*i)

    print(len(ans))
    if ans:
        for i in ans:
            print(*i)

if __name__ == '__main__':
    resolve()
import math;r,p=int(input()),3.141592653589793238462643;print(p*(r**2),p*r*2)


### FIXED CODE ###

import math;r=float(input());print(math.pi*(r**2),math.pi*r*2)
import random
print(random.random(0,3))

### FIXED CODE ###

a = input()
print(a.count("1"))
#3????????°??¨10??§?????£????????????3??????????????????print?????????
#???????????????????????§??????????????????????????????
#???????????°????????\????????¨???????????????
#??????????????¨????????????????????¶??§???????????°????????????????????????????????????
#3????????°?????????3?¶?????????°?????\??????????¶?????????°?????????????????????????????§??????
#?????????????????????
#?????????10??§?????£????????????3??????????????????????????????????????????
#??\??????????????§??????????????????3?????¨?????????????????????????????????
#????????????????????¨21??§???????????????????????????
#????????????????????¨3?????¨?????¨????????????????????\??£???????????????
x = int(input())
i = 1
print(" ", end="")
while i <= x:
    
    if (i % 3) == 0:
        if (i + 3) <= x:
            print(i, end=" ")
        elif x > 3 and (x % 10) == 3:
            print(i, end=" ")
        else:
            print(i)
      
    elif (i % 10) == 3:
        if i != x:
            print(i, eqnd=" ")
        else:
            print(i)
    
    i += 1

### FIXED CODE ###

#????????§???????????????????????????????????????????????????????????¨???????????¨???????????????
#0????????£????????????????????????????????????
#?????????????????¨??¶???????°??????????
#????????????
#??????????????¢??°??????????????????????????????????????????????????????????????????????????\????????????????????????print??????????????????????????????????????????
#?????????????????????????????????????????????3????????°????¢???????????????£??????????????????????????????????????????????????????????????????
#?????????????????????
#?????????????????????????????????????????°???????????????????????????????????????????????¨?????????
#??????????????????????????¨??£????????????????????????????????????????¶??????????
x = int(input())

    
i = 1
y = i
n = []

#10??§?????£???3????????????3?????????????????????????????????????????????10??§???????¶???????1???????????§?¶???????
while i <= x:
    if y % 10 == 3 or y / 3 == 1:
        n.append(i)
        i += 1
        y = i
    else:
        y //= 10
        if y == 0:
            #?????????3????????°????????§??????????????????????????????
            if i % 3 == 0:
                n.append(i)
                i += 1
                y = i
            else:
                i += 1
                y = i
                
print("", end=" ")

i = 0
while i < int(len(n))-1:
    print(n[i], end=" ")
    i += 1
    
print(n[i])
#print("end")
S = input()

N = len(S) + 1
t = [0] * N
for i in range(N - 1):
    if S[i] == '<':
        t[i + 1] = t[i] * 1
for i in range(N - 1, -1, -1):
    if S[i] == '>':
        t[i] = max(t[i], t[i + 1] + 1)
print(sum(t))

### FIXED CODE ###

S = input()

N = len(S) + 1
t = [0] * N
for i in range(N - 1):
    if S[i] == '<':
        t[i + 1] = t[i] + 1
for i in range(N - 2, -1, -1):
    if S[i] == '>':
        t[i] = max(t[i], t[i + 1] + 1)
print(sum(t))
import fractions


def main():
    X_S = S_ni_naru([0]*L, S, L, N)
    X_T = T_ni_naru([0]*L, T, L, M)

    for s, t in zip(X_S, X_T):
        if (s != t) and (s != 0) and (t != 0):
            print(-1)
            exit()

    print(L)


def S_ni_naru(X_S, S, L, N):
    s_i = 0
    for i in range(N):
        if i == 0:
            idx = 0
        else:
            idx = L//N*i

        X_S[idx] = S[s_i]
        s_i = s_i + 1

    return X_S


def T_ni_naru(X_T, T, L, M):
    t_i = 0
    for i in range(M):
        if i == 0:
            idx = 0
        else:
            idx = L//M*i

        X_T[idx] = T[t_i]
        t_i = t_i + 1

    return X_T


if __name__ == "__main__":
    N, M = map(int, input().split())
    S = input()
    T = input()
    L = int((N*M) / fractions.gcd(N, M))
    main()


### FIXED CODE ###

import sys
import fractions
N, M = map(int, input().split())
S = input()
T = input()

g = fractions.gcd(N, M)
L = N * M // g

ss = L // N
ts = L // M
for i in range(N):
  if (i * ss) % ts == 0:
    j = (i * ss) // ts
    if S[i] != T[j]:
      print(-1)
      sys.exit()

for i in range(M):
  if (i * ts) % ss == 0:
    j = (i * ts) // ss
    if T[i] != S[j]:
      print(-1)
      sys.exit()

print(L)
import queue

H, W = map(int, input().split())
A = []
D = [[-1 for _ in range(W)] for _ in range(H)]
q = queue.Queue()
for i in range(H):
    S = input()
    for j in range(W):
        if S[j] == "#":
            q.put((i, j))
            D[i][j] = 0
    A.append(S)

ans = 0
while not q.empty():
    pos = q.get()
    py, px = pos[0], pos[1]
    ans = max(ans, D[py][px])
    for (y, x) in [(0, -1), (0, 1), (-1, 0), (1, 0)]:
        ny = py + y
        nx = px + x
        if nx < 0 or W <= nx or ny < 0 or H <= ny:
            if D[ny][nx] < 0:
                D[ny][nx] = D[py][px] + 1
                q.put((ny, nx))
print(ans)


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
A = []
D = [[-1 for _ in range(W)] for _ in range(H)]
q = deque([])
for i in range(H):
    S = input()
    for j in range(W):
        if S[j] == "#":
            q.append((i, j))
            D[i][j] = 0
    A.append(S)

while q:
    pos = q.popleft()
    py, px = pos[0], pos[1]
    for (y, x) in [(0, -1), (0, 1), (-1, 0), (1, 0)]:
        ny = py + y
        nx = px + x
        if nx < 0 or W <= nx or ny < 0 or H <= ny:
            continue
        if D[ny][nx] < 0:
            D[ny][nx] = D[py][px] + 1
            q.append((ny, nx))

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, D[i][j])
print(ans)
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

### FIXED CODE ###

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

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")
# coding: utf-8
import math 

N = int(input())
abcde = [int(input()) for _ in range(5)]

time = 0
n = N
last = 0 # 最後の1回で移動する人数
for i in range(5):
  time +=  math.ceil(n / abcde[i])
  last = n % abcde[i]
  if last == 0:
    last = abcde[i]
  if i < 4: 
    n = last + max((N-last) - (time-1) * abcde[i+1], 0)


print(time)

### FIXED CODE ###

# coding: utf-8

x, y, z, k = [int(i) for i in input().split()]

a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

ab = [ai + bi for ai in a for bi in b]
ab.sort(reverse=True)
ab = ab[:k]

abc = [abi + ci for abi in ab for ci in c]
abc.sort(reverse = True)

for i in range(len(abc)):
  if i < k:
    print(abc[i])
  else:
    break
A, B, C, D = map(int, input().split())

if (A+B < C+D):
	print("Right")
elif (A+B > C+D):
	print("Left")
else:
	print("Balanced")

hibiki@

### FIXED CODE ###

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

if (A+B < C+D):
	print("Right ")
elif (A+B > C+D):
	print("Left ")
else:
	print("Balanced ")
n = [int(i) for i in inpyt().split()]
n.sort()
print(int(n[2]-n[0]))

### FIXED CODE ###

n = list(map(int, input().split()))
n.sort()
print(n[2]-n[0])
import sys
from itertools import permutations
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    P=tuple(map(int,input().split()))
    Q=tuple(map(int,input().split()))
    p_list=list(permutations(range(1,n+1)))
    print(abs(p_list.index(Q)-p_list.index(P)))

if __name__=='__main__':
    main()

### FIXED CODE ###

k,x=map(int,input().split())
if 500*k>=x:print("Yes")
else:print("No")
def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcd(b,c)




def lcm(a,b):
    c=gcd(a,b);
    return a/c*b



N=input()

n=int(N)

ANS=input()
ans=int(ANS)

for lop in range(n-1):
    T=input()
    t=int(T)
    ans=lcm(ans,t)
print(int(ans))
print('\n')
quit()


### FIXED CODE ###

'''
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)
'''

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

def lcm(e,f):
    c=gcd(e,f)
    g=e*f
    return g//c



n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))
N = int(input())
A = list(map(int, input().split()))
k = 0
for i in A:
  if i%2 = 1:
    A.remove(i)
for j in A:
  if j%3 != 0 and j%5 != 0:
    k = 1
    break
if k == 0:
  print('APPROVED')
elif k == 1:
  print('DENIED')

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
k = 'APPROVED'
for i in A:
  if i % 2 == 0:
    if i % 3 == 0:
      pass
    elif i % 5 == 0:
      pass
    else:
      k = 'DENIED'
print(k)
N, W = map(int, input().split())
WV = [list(map(int,input().split())) for _ in range(N)]

dp = [[-1 for _ in range(W+1)] for _ in range(N)]

W0 = WV[0][0]
V0 = WV[0][1]

def initial(w):
    if w >= W0:
        return V0
    else:
        return 0
dp[0] = [initial(w) for w in range(W+1)]

def calcu(i,w):
    if dp[i][w] != -1:
        return dp[i][w]

    w_i = WV[i][0]
    if w >= w_i:
        res = max(calcu(i-1, w-w_i)+WV[i][1], calcu(i-1,w))

    else:
        res = calcu(i-1,w)
    dp[i][w] = res
    return res

calcu(N-1, W)
print(dp[-1][-1])

### FIXED CODE ###

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

dp = [0 for _ in range(N)]

for i in range(N): #0 <= i < N
    if i == 0:
        continue
    elif i == 1:
        dp[i] = abs(H[i]- H[i-1])
    else:
        dp[i] = min(dp[i-1]+ abs(H[i]-H[i-1]), dp[i-2]+ abs(H[i]- H[i-2]))

print(dp[-1])
import sys
input = sys.stdin.readline
n = int(input())
h = list(map(int,input().split()))

count_list = []
count = 0
i = n-1
while 0<i<n:
    if h[i-1]>=h[i]:
        count += 1
        i -= 1
    else:
        count_list.append(count)
        count = 0
        i = i-1
# print(count_list)
print(max(count_list))    

### FIXED CODE ###

# import sys
# input = sys.stdin.readline
n = int(input())
h = list(map(int,input().split()))
if n==1:
    print(0)
    exit()
else:
    count_list = []
    count = 0
    i = n-1
    while i<n:
        # print(i)
        if i>0 and h[i-1]>=h[i]:
            count += 1
            i -= 1
        else:
            count_list.append(count)
            count = 0
            if i>0:
                i = i-1
            elif i==0:
                break
print(max(count_list))
a,b,c,d = map(int,input().split())
print(max(min(b,d)-max(a,c),0)

### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a>=c and b>=d and d>a:
    print(d-a)
elif a<=c and b<=d and b>c:
    print(b-c)
elif a<c and d<b:
    print(d-c)
elif c<a and b<d:
    print(b-a)
else:
    print(0)
from math import factorial

num=int(input())
stl=[]

count=0

for i in range(num):
    str=input()
    str=''.join(sorted(str))
    stl.append(str)

duplicate=[x for x in set(stl) if stl.count(x) > 1]
if duplicate:
    for dup in duplicate:
        n=stl.count(dup)
        count += factorial(n) // ( factorial(n - 2) * 2 )
    
print(count)

### FIXED CODE ###

a,b=(int(x) for x in input().split())

c=a+b
d=a-b
e=a*b

print(max(c,d,e))