Harryxun/stf_run huggingface dataset:
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        print("1 2 3")
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if i == m-2:
                    i += 4
                if j == n-1:
                    ans += a
                    i -= 1
                else:
                    ans.append(i)

        for i in range(2*n-1):
            print(ans[i])





### FIXED CODE ###

import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        ans = [1,2,3]
        print(jo(ans))
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if j == n-2:
                    ans += a
                    i -= 1
                else:
                    if i == m-2:
                        i += 4
                    ans.append(i)
        print(jo(ans))
memo = {}

def solve(a, b, c, i, last_option):
	if (i, last_option) not in memo:
		if i == len(a):
			result = 0
		elif i == 0:
			result = max(a[i] + solve(a, b, c, i + 1, 1), b[i] + solve(a, b, c, i + 1, 2), c[i] + solve(a, b, c, i + 1, 3))
		else:
			if last_option == 1:
				result = max(b[i] + solve(a, b, c, i + 1, 2), c[i] + solve(a, b, c, i + 1, 3))
			elif last_option == 2:
				result = max(a[i] + solve(a, b, c, i + 1, 1), c[i] + solve(a, b, c, i + 1, 3))
			else:
				result = max(a[i] + solve(a, b, c, i + 1, 1), b[i] + solve(a, b, c, i + 1, 2))
		memo[(i, last_option)] = result
		return result
	else:
		return memo[(i, last_option)]

n = int(input())
a = [None for i in range(n)]
b = [None for i in range(n)]
c = [None for i in range(n)]
for i in range(n):
	a[i], b[i], c[i] = map(int, input().split())
print(solve(a, b, c, 0, 4))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

memo = {}

def solve(i, last_option):
	global a, b, c
	if (i, last_option) not in memo:
		if i == len(a):
			result = 0
		elif i == 0:
			result = max(a[i] + solve(i + 1, 1), b[i] + solve(i + 1, 2), c[i] + solve(i + 1, 3))
		else:
			if last_option == 1:
				result = max(b[i] + solve(i + 1, 2), c[i] + solve(i + 1, 3))
			elif last_option == 2:
				result = max(a[i] + solve(i + 1, 1), c[i] + solve(i + 1, 3))
			else:
				result = max(a[i] + solve(i + 1, 1), b[i] + solve(i + 1, 2))
		memo[(i, last_option)] = result
		return result
	else:
		return memo[(i, last_option)]

n = int(input())
a = [None for i in range(n)]
b = [None for i in range(n)]
c = [None for i in range(n)]
for i in range(n):
	a[i], b[i], c[i] = map(int, input().split())
print(solve(0, 4))
import numpy as np


def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    A = np.zeros((N, N), int)
    for i in range(M):
        pp, ss = map(int, input().split())
        ss -= 1
        pp -= 1
        A[pp][ss] = H[ss]
        A[ss][pp] = H[pp]

    ans = 0
    for j in range(N):
        np_max = A[j].max()

        now = H[j]
        if (np_max == 0 or now > np_max):
            ans += 1

    print(ans)


resolve()

### FIXED CODE ###

def resolve():
    n, m = map(int, input().split())
    hhh = list(map(int, input().split()))
    nice = [1] * n

    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        ha = hhh[a]
        hb = hhh[b]
        if ha <= hb:
            nice[a] = False
        if ha >= hb:
            nice[b] = False

    print(sum(nice))


resolve()
from bisect import bisect_right

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    a = sorted(a)
    b = sorted(b)
    c = sorted(c)

    ans = 0

    # まずあるbを選んだ時のcの組み合わせの数のリストを作る。
    clist = [0] * n
    clist[n-1] = n - bisect_right(c, b[n-1])
    for i in range(n-2, -1, -1):
        clist[i] = n - bisect_right(c, b[i]) + clist[i+1]

    for aa in a:
        b_pos = bisect_right(b, aa)
        ans += clist[b_pos]

    print(ans)


### FIXED CODE ###

from bisect import bisect_right

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    a = sorted(a)
    b = sorted(b)
    c = sorted(c)

    ans = 0

    # まずあるbを選んだ時のcの組み合わせの数のリストを作る。
    clist = [0] * n
    clist[n-1] = n - bisect_right(c, b[n-1])
    for i in range(n-2, -1, -1):
        clist[i] = n - bisect_right(c, b[i]) + clist[i+1]

    for aa in a:
        b_pos = bisect_right(b, aa)
        if b_pos != n:
            ans += clist[b_pos]

    print(ans)
from functools import reduce

N, Q = map(int, input())
S = input()
LR = [list(map(int, input())) for i in range(Q)]

P = []
before_a = False
for i in range(N):
  if before_a and S[i] == 'C':
    P.append(i)
    before_a = False
  elif S[i] == 'A':
    before_a = True
  else:
    before_a = False
for i in range(Q):
  ans = 0
  for num in P:
    if num-1 >= LR[i][0] and num >= LR[i][1]:
      ans += 1
  print(ans)
    


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
LR = [list(map(int, input().split())) for i in range(Q)]

P = [0] * (N)
before_a = False
cnt = 0
for i in range(N):
  if before_a and S[i] == 'C':
    cnt += 1
    before_a = False
  elif S[i] == 'A':
    before_a = True
  else:
    before_a = False
  P[i] = cnt
for i in range(Q):
  print(P[LR[i][1]-1] - P[LR[i][0]-1])
x = input().strip()
num = Case
 
for i in range(1,10001):
    print("{} {} : {}".format(num,i,x))
    i += 1

### FIXED CODE ###

i = 1
while True:
     x = int(input())
     if x == 0: break
     print('Case {}: {}'.format(i, x))
     i += 1
import math
T = int(input())

L = []
for i in range(0,T):
    L = list(map(int, input().split()))
    A = L[0]
    B = L[1]
    C = L[2]
    D = L[3]

    ans = "Yes"
    if A < B: #前提条件
        ans = "No"
    elif D < B: #前提条件
        ans = "No"
    elif B - C <= 1: #BとCの差が1より小さければ何が来てもOK
        ans = "Yes"
    elif C < B-math.gcd(B,D)+(A%math.gcd(B,D)):
        ans = "No"


    print(ans)
    L = []



### FIXED CODE ###

import fractions
T = int(input())

L = []
for i in range(0,T):
    L = list(map(int, input().split()))
    A = L[0]
    B = L[1]
    C = L[2]
    D = L[3]

    ans = "Yes"
    if A < B: #前提条件
        ans = "No"
    elif D < B: #前提条件
        ans = "No"
    elif B - C <= 1: #BとCの差が1より小さければ何が来てもOK
        ans = "Yes"
    elif C < B-fractions.gcd(B,D)+(A%fractions.gcd(B,D)):
        ans = "No"


    print(ans)
    L = []
from collections import*
n, m, *t = map(int, open("test").read().split())       
*w, s, t = [a-1for a in t]         
e = [[]for _ in range(n)]        
for u, v in zip(w[::2], w[1::2]):      
    e[u].append(v)

INF = 10**10
f = [[INF]*3for _ in range(n)]        
f[s][0] = 0        
q = deque([(s, 0)])           
while q:
    vi, j = q.popleft()         
    if vi == t and j == 0:
        print(f[vi][0]//3)
        break
    for ui in e[vi]:           
        if f[ui][(j+1)%3] < INF: continue           
        f[ui][(j+1)%3] = f[vi][j] + 1
        q.append((ui, (j+1)%3))
else:
    print(-1)

### FIXED CODE ###

from collections import*
n, m, *t = map(int, open(0).read().split())       
*w, s, t = [a-1for a in t]         
e = [[]for _ in range(n)]        
for u, v in zip(w[::2], w[1::2]):      
    e[u].append(v)

INF = 10**10
f = [[INF]*3for _ in range(n)]        
f[s][0] = 0        
q = deque([(s, 0)])           
while q:
    vi, j = q.popleft()         
    if vi == t and j == 0:
        print(f[vi][0]//3)
        break
    for ui in e[vi]:           
        if f[ui][(j+1)%3] < INF: continue           
        f[ui][(j+1)%3] = f[vi][j] + 1
        q.append((ui, (j+1)%3))
else:
    print(-1)
from collections import deque

n, k = map(int, input().split())
V = list(map(int, input().split()))

ans = 0
for t in range(k//2 + 1):
    hand = deque(V[:k-t])
    rest = deque(V[k-t:])
    cur_sum = sum(hand)

    for j in range(k-t+1):
        put_back = 0
        rev_hand = sorted(hand)

        for i in range(t):
            jewel = rev_hand[i]
            if jewel < 0:
                put_back -= jewel
            else:
                break

        candidate = cur_sum + put_back
        ans = max(candidate, ans)

        to_rest = hand.pop()
        to_hand = rest.pop()
        hand.appendleft(to_hand)
        rest.appendleft(to_rest)
        cur_sum += to_hand - to_rest

print(ans)

### FIXED CODE ###

from collections import deque

n, k = map(int, input().split())
V = list(map(int, input().split()))

ans = 0
for t in range(k//2 + 1):
    hand = deque(V[:k-t])
    rest = deque(V[k-t:])
    cur_sum = sum(hand)

    for j in range(k-t+1):
        put_back = 0
        rev_hand = sorted(hand)

        for i in range(t):
            jewel = rev_hand[i]
            if jewel < 0:
                put_back -= jewel
            else:
                break

        candidate = cur_sum + put_back
        ans = max(candidate, ans)

        to_rest = hand.pop()
        rest.appendleft(to_rest)
        to_hand = rest.pop()
        hand.appendleft(to_hand)

        cur_sum += to_hand - to_rest

print(ans)
from collections import deque
import numpy as np
n, m = map(int, input().split())
route = np.zeros((n, n), dtype = np.bool)
for _ in range(m):
    a, b = map(int, input().split())
    route[a-1][b-1] = True
    route[b-1][a-1] = True

q = deque()
visited = [0] * n
pre = [-1] * n
q.append(0)
visited[0] = 1
while q:
    # visitした
    v = q.popleft()
    for i in range(n):
        if visited[i] == 1 or route[v][i] == False: continue
        visited[i] = 1
        pre[i] = v
        q.append(i)
print("Yes")
for p in pre[1:]:
    p += 1
    print(p)

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
to = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    to[a].append(b)
    to[b].append(a)
q = deque()
visited = [0 for _ in range(n)]
pre = [-1 for _ in range(n)]
q.append(0)
visited[0] = 1
while q:
    # visitした
    v = q.popleft()
    for u in to[v]:
        if visited[u] == 1: continue
        visited[u] = 1
        pre[u] = v
        q.append(u)
print("Yes")
for p in pre[1:]:
    p += 1
    print(p)
l = map(int, raw_input().split())

print(l[0] + l[1]/2)

### FIXED CODE ###

x, y = map(int, input().split())
print(x + y//2)
A = input()
B = input()
C = input()

next = A.popleft()

while 1:
  if len(A)==0:
    print('A')
    break
  elif len(B)==0:
    print('B')
    break
  elif len(C)==0:
    print('C')
    break
    
  if next=='a':
    next = A.popleft()
  elif next=='b':
    next = B.popleft()
  else:
    next = C.popleft()

### FIXED CODE ###

A = list(input())
B = list(input())
C = list(input())

A = A[::-1]
B = B[::-1]
C = C[::-1]

next = A.pop()

while 1:    
  if next=='a':
    if len(A)==0:
      print('A')
      break
    next = A.pop()
  elif next=='b':
    if len(B)==0:
      print('B')
      break
    next = B.pop()
  else:
    if len(C)==0:
      print('C')
      break
    next = C.pop()
import numpy as np

if __name__=="__main__":
    inputs_number  = lambda : [int(x) for x in input().split()]
    N, Ma, Mb = inputs_number()
    drugs = np.array([inputs_number() for i in range(N)])

    inf = 100*N + 1
    dp = np.ones((N+1,N*10+1,N*10+1)) * inf
    dp[0,0,0] = 0
    for i in range(N):
	for ca in range(N*10+1):
            for cb in range(N*10+1):
		if(dp[i,ca,cb]==inf):
                    continue
		dp[i+1,ca,cb]=np.min([dp[i+1,ca,cb],dp[i,ca,cb]]);
		dp[i+1,ca+drugs[i,0],cb+drugs[i,1]]=np.min([dp[i+1,ca+drugs[i,0],cb+drugs[i,1]],dp[i,ca,cb]+drugs[i,2]]);

    ans = inf
    for ca in range(1, N*10+1):
        for cb in range(1, N*10+1):
	    if(Ma*cb == Mb*ca and dp[N,ca,cb] < ans):
            	ans = dp[N,ca,cb]
    if(ans==inf):
	ans = -1
    print(int(ans))

### FIXED CODE ###

import numpy as np
import copy

if __name__=="__main__":
    inputs_number  = lambda : [int(x) for x in input().split()]
    N, Ma, Mb = inputs_number()
    drugs = [inputs_number() for i in range(N)]
    inf = 100*N + 1
    dp = np.ones((2,N*10+1,N*10+1)).astype(np.int32) * inf
    dp = dp.tolist()
    dp[0][0][0] = 0.0

    for i in range(N):
        for ca in range(10*i+1):
            for cb in range(10*i+1):
                if(dp[0][ca][cb]==inf):
                    continue
                dp[1][ca][cb]=min([dp[1][ca][cb], dp[0][ca][cb]])
                dp[1][ca+drugs[i][0]][cb+drugs[i][1]]=min([dp[1][ca+drugs[i][0]][cb+drugs[i][1]], dp[0][ca][cb]+drugs[i][2]])
        dp[0] = copy.copy(dp[1])
        dp[1] = (np.ones((N*10+1,N*10+1)).astype(np.int32) * inf).tolist()
    ans = inf
    for ca in range(1, N*10+1):
        for cb in range(1, N*10+1):
            if(Ma*cb==Mb*ca and dp[0][ca][cb]<ans):
                ans = dp[0][ca][cb]
    if(ans==inf):
        ans = -1
    print(int(ans))
import fractions

N,M=map(int,input().split())
A=list(map(int,input().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
k=1
for a in A:
  k=lcm(k,a)

k/=2
  
if k<min(A):
  k*=2*1.5
print(int(M//k//2+M//k%2))



### FIXED CODE ###

import fractions

N,M=map(int,input().split())
A=list(map(int,input().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def kn(h):
  l=0
  while h%2==0:
    h=h//2
    l+=1
  return l
  
k=1
flag=kn(A[0]//2)
for a in A:
  a//=2
  k=lcm(k,a)
  if flag != kn(a):
    print(0);exit()
  
print(int(M//k//2+M//k%2))
import math

if __name__ == "__main__":

    N = int(input())

    P = (map(int,input().split()))

    mult = 1
    for i in P:
        mult *= i

    if(math.log10(mult) > 18):
        print(-1)
    else:
        print(mult)



### FIXED CODE ###

import sys

if __name__ == "__main__":
 
    N = int(input())
 
    P = list(map(int,input().split()))

    if(0 in P):
        print(0)
    else:
        P.sort()

        mult = 1
        for i in P:
            mult *= i 
            if (mult > 10 ** 18):
                print(-1)
                sys.exit()

        print(mult)
#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    absum=(a+b)*s
    n=n%(absum)#余り
    if n<a:
        print(s*a+n)
    else:
        print((s+1)*a)

### FIXED CODE ###

#B
import sys
n,a,b=map(int,input().split())
if a==0:
    print(0)
    sys.exit()
else:
    s=int(n/(a+b))
    if s==0:
        m=n
    else:
        absum=(a+b)*s
        m=n%(absum)#余り
    if m<a:
        print(s*a+m)
    else:
        print((s+1)*a)
import math;a = list(map(int,input().split()));b = a[1]//a[0];c = [];for i in range(1,int(math.sqrt(a[1]))+1):if a[1]%i==0 and i<=b:if a[1] // i <= b:c.append(a[1]//i);else:c.append(i);c.sort(reverse=True);print(c[0])

### FIXED CODE ###

import math
a = list(map(int,input().split()))

b = a[1]//a[0]

c = []

for i in range(1,int(math.sqrt(a[1]))+1):
    if a[1] % i == 0 and i <= b:
        if a[1] // i <= b:
            c.append(a[1] // i)
        else:
            c.append(i)
c.sort()
c.reverse()
print(c[0])
a = []
b = []
mem = {}
ans = 0
def flip(a,f):
    for i in range(len(a)):
        for j in range(3):
            if f & (1 << j) == 1:
                a[i][j] = - a[i][j]
def solve(n,m):
    if(mem.get((n,m))!=None):
        return mem[(n,m)]
    if m == 0:
        return 0
    if n == m:
        mem[(n,m)] = sum(b[:n])
        return mem[(n,m)]
    ans = max([solve(n-1,m-1) + b[n-1] , solve(n-1,m)])
    mem[(n,m)] = ans
    return ans
n,m = map(int,input().split())
for i in range(n):
    a.append(list(map(int,input().split())))
for f in range(8):
    b.clear()
    flip(a,f)
    for x in a:
        b.append(sum(x))
    mem.clear()
    ans = max([ans,solve(n,m)])
    flip(a,f)
print(ans)


### FIXED CODE ###

a = []
b = []
ans = 0
def flip(f):
    for i in range(len(a)):
        for j in range(3):
            if f & (1 << j) != 0:
                a[i][j] = - a[i][j]
n,m = map(int,input().split())
for i in range(n):
    a.append(list(map(int,input().split())))
for f in range(8):
    del(b[:])
    flip(f)
    for x in a:
        b.append(sum(x))
    b.sort(reverse = True)
    ans = max([ans,sum(b[:m])])
    flip(f)
print(ans)
S = int(input())
W = int(input())

if (S <= W) :
    print("unsafe")
else :
    print("safe")



### FIXED CODE ###

S,W = map(int,input().split())

if (S <= W) :
    print("unsafe")
else :
    print("safe")
N, k = [int(s) for s in input().split(' ')]
 
h = []
while len(h) != N:
    heapq.heappush(h, int(input()))
  
min_height = 1000000000
h.sort()
for start in range(0, N - k + 1):
    end = start + k - 1
    diff = h[end] - h[start]
    if diff < min_height:
        min_height = diff
print(min_height)

### FIXED CODE ###

import heapq
 
N, k = [int(s) for s in input().split(' ')]
 
h = []
while len(h) != N:
    heapq.heappush(h, int(input()))
  
min_height = 1000000000
h = heapq.nsmallest(N, h)
for start in range(0, N - k + 1):
    end = start + k - 1
    diff = h[end] - h[start]
    if diff < min_height:
        min_height = diff
print(min_height)
x,n=map(int,input().split())
import sys
if n==0:
    _=input()
    print(x)
    sys.exit()
    
p_list=list(map(int,input().split()))
r=list(range(100))
a=list(set(r)-set(p_list))

ans=100000
kkk=100000
for i in a:
    tem=abs(i-x)
    if ans>tem:
        ans=tem
        kkk=i
    
print(kkk)

### FIXED CODE ###

a=input().split()
for i in range(5):
    if a[i]=='0':
        print(i+1)
a,b,c,d = map(int,input().split())

print(min(a,b)+min(c,d))

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())


print(min(a,b)+min(c,d))
s = input()
n = len(s)

i = 0
is_r = True
rl_list = []
r, l = 0, 0
idx = None
for i in range(n)
  if s[i] == 'R':
    if not is_r:
      rl_list.append((r, l, idx))
      is_r = True
      r, l = 0, 0
    r += 1
  else:
    if is_r:
      is_r = False
      idx = i - 1
    l += 1
rl_list.append((r, l, idx))
children = [0] * n
for r, l, idx in rl_list:
  children[idx] = (r + 1) // 2 + l // 2
  children[idx + 1] = r // 2 + (l + 1) // 2
print(' '.join(map(str, children)))

### FIXED CODE ###

s = input()
n = len(s)

i = 0
is_r = True
rl_list = []
r, l = 0, 0
idx = None
for i in range(n):
  if s[i] == 'R':
    if not is_r:
      rl_list.append((r, l, idx))
      is_r = True
      r, l = 0, 0
    r += 1
  else:
    if is_r:
      is_r = False
      idx = i - 1
    l += 1
rl_list.append((r, l, idx))
children = [0] * n
for r, l, idx in rl_list:
  children[idx] = (r + 1) // 2 + l // 2
  children[idx + 1] = r // 2 + (l + 1) // 2
print(' '.join(map(str, children)))
def bfs_opt(s):
    signs[s] = 0
    Q.append(s)
    while len(Q) > 0:
        u = Q.popleft()
        for v in rooms[u]:
            if signs[v] == INFTY:
                signs[v] = u
                Q.append(v)


n, m = map(int, input().split())
rooms = [[] for i in range(n)]

# adjacent list
for i in range(m):
    a, b = map(int, input().split())
    rooms[a-1].append(b-1)
    rooms[b-1].append(a-1)

INFTY = float('inf')
signs = [INFTY] * n

# status を保持しなくても、signs == INFTY (== 未訪問) で訪問済みかどうかの判定は可能
# for bfs()
# NOT_VISITED = 0
# VISITING = 1
# VISITED = 2
# status = [NOT_VISITED] * n

Q = deque()

bfs_opt(0)

# ok = True
# for sign in signs:
#     if sign == INFTY:
#         ok = False

# ok にならない (No になる) ケースは存在しない
print('Yes')
signs = signs[1:]
for sign in signs:
    print(sign + 1)

### FIXED CODE ###

from collections import deque

def bfs(s):
    status[s] = VISITING
    signs[s] = 0
    Q.append(s)
    while len(Q) > 0:
        u = Q.popleft()
        for v in rooms[u]:
            if status[v] == NOT_VISITED:
                status[v] = VISITING
                signs[v] = u
                Q.append(v)
        status[u] = VISITED


n, m = map(int, input().split())
rooms = [[] for i in range(n)]

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

INFTY = float('inf')
signs = [INFTY] * n

NOT_VISITED = 0
VISITING = 1
VISITED = 2
status = [NOT_VISITED] * n
Q = deque()

bfs(0)
ok = True

for sign in signs:
    if sign == INFTY:
        ok = False

if ok:
    print('Yes')
    signs = signs[1:]
    for sign in signs:
        print(sign + 1)
N = eval(input())
M = eval(input())
user = list(eval(input().replace(" ",",")))
sum = 0
for i in user:
    sum = sum + i
result = N - sum
if result < 0:
    print(-1)
else:
    print(result)

### FIXED CODE ###

N,M = (input()).split()
task = input().split()
list1 = []
sum = 0
for i in task:
    list1.append(i)
for j in list1:
    sum = sum + int(j)
result = int(N) - sum
if result < 0:
    print(-1)
else:
    print(result)
n=int(input())

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

needsearch=[]

for i in range(n):
    a[i]-=(i+1)
    needsearch.append(-2*(i+1)-a[i])

counter=[0]*(2*(10**5))

for i in range(n):
    if 0<a[i]+10**5<2*(10**5):
        counter[a[i]+10**5]+=1

ans = 0
for i in range(len(needsearch)):
    ans += counter[needsearch[i]+10**5]



print(ans)


### FIXED CODE ###

n=int(input())

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

needsearch=[]

for i in range(n):
    a[i]-=(i+1)
    needsearch.append(-2*(i+1)-a[i])

counter=[0]*(2*(10**6))

for i in range(n):
    if 0<a[i]+10**6<2*(10**6):
        counter[a[i]+10**6]+=1

ans = 0
for i in range(len(needsearch)):
    if 0<needsearch[i]+10**6<2*(10**6):
        ans += counter[needsearch[i]+10**6]
    if 0<a[i]+10**6<2*(10**6):
        counter[a[i]+10**6]-=1


print(ans)
from decimal import Decimal
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
List=list(range(1,t+1))
if a==b:
    print("YES")
    exit()
elif v==w:
    print("NO")
    exit()
def binary_search(x, k, n):
 
  l = 1 #検索範囲の左端
 
  r = n #検索範囲の右端
 
 
 
  while r - l >= 1: #検索範囲がなくなったら処理を終了する
 
    i = (l + r) // 2 #iにデータの真ん中の位置を持たせる
 
    if k[i] == x:
 
      return True
 
    elif k[i] < x:
 
      l = i + 1
 
    else:
 
      r = i
 
 
 
  else:
 
    return False
    
if binary_search(Decimal(b-a)/Decimal(v-w), List, t)==True:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

from decimal import Decimal
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if v==w:
    print("NO")
    exit()
atai = Decimal(abs(b-a))/Decimal(abs(v-w))
if atai<=t and a+v*t>=b+w*t:
    print("YES")
else:
    print("NO")
n, m = map(int, input.split())
print((n - 1) * (m - 1))

### FIXED CODE ###

n, m = map(int, input().split())
print((n - 1) * (m - 1))