Harryxun/stf_run huggingface dataset:
from collections import Counter
import math
def comb(n, r):
    # print(n, r)
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
combination = Combination(n-1)

# All combination
total = 0
for (key, val) in c.items():
    # print('\n', key, val)
    total += comb(val, 2)

# print('all:', total)

for i in range(n):
    num = a[i]
    org = c[num]

    # total - orgC2 + (org-1)C2
    if org > 2:
        ans = total - comb(org, 2) + comb(org-1, 2)
    else:
        ans = total - comb(org, 2)
    print(ans)


'''
5
1 1 2 1 2
'''

### FIXED CODE ###

from collections import Counter
import math
def comb(n, r):
    # print(n, r)
    return (n * (n-1))//2
    # return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)

# All combination
total = 0
for (key, val) in c.items():
    # print('\n', key, val)
    if val > 1:
        total += comb(val, 2)

# print('all:', total)

for i in range(n):
    num = a[i]
    org = c[num]
    # print(org)
    # total - orgC2 + (org-1)C2
    if org > 2:
        ans = total - comb(org, 2) + comb(org-1, 2)
    elif org == 1 or org == 0:
        ans = total
    else:
        ans = total - comb(org, 2)
    print(ans)
if a[0] == 0:
    print(a[len(a) - 1] - a[1])
else:
    print(a[len(a) - 1] - a[0])

### FIXED CODE ###

import numpy as np

k, n = map(int,input().split())
a = np.array(list(map(int, input().split())))
diff = a[1:] - a[:-1]
diff = np.append(diff, k - a[-1] + a[0])
if np.argmax(diff) == len(a) - 1:
    print(a[-1] - a[0])
else:
    print(k - a[np.argmax(diff) + 1] + a[np.argmax(diff)])
#差がC以下はダメ（Cもダメ）
N,K,C=map(int,input().split())
S=input()
X=[]
for i in range(N):
    if S[i]=="o":
        X.append(i+1)
M=len(X)
#例外処理（M=1のとき）
#ACしたので試験的にコメントアウト
'''
if M==1:
    #このときK==1
    print(X[0])
    exit()
'''
#X[i]日に働くとき、その直前or直後で働ける最も近い日のindex
L=[-1 for i in range(M)]
R=[-1 for i in range(M)]
j=1
for i in range(M-1):
    while(j<M):
        if X[j]-X[i]>=C+1:
            R[i]=j
            break
        else:
            j+=1
j=M-2
for i in range(M-1,0,-1):
    while(j>=0):
        if X[i]-X[j]>=C+1:
            L[i]=j
            break
        else:
            j-=1
LD=[-1 for i in range(M)]
RD=[-1 for i in range(M)]
def Ldfs(i):
    if LD[i]!=-1:
        return LD[i]
    if L[i]==-1:
        LD[i]=1
        return 1
    else:
        LD[i]=Ldfs(L[i])+1
        return Ldfs(L[i])+1
def Rdfs(i):
    if RD[i]!=-1:
        return RD[i]
    if R[i]==-1:
        RD[i]=1
        return 1
    else:
        RD[i]=Rdfs(R[i])+1
        return Rdfs(R[i])+1
for i in range(M):
    Ldfs(i)
    Rdfs(M-1-i)
Y=[0 for i in range(M)]
Y[0]=RD[1]
Y[-1]=LD[-2]
for i in range(1,M-1):
    Y[i]=LD[i-1]+RD[i+1]
for i in range(M):
    if Y[i]<K:
        print(X[i])


### FIXED CODE ###

#差がC以下はダメ（Cもダメ）
N,K,C=map(int,input().split())
S=input()
X=[]
for i in range(N):
    if S[i]=="o":
        X.append(i+1)
M=len(X)
#例外処理（M=1のとき）
if M==1:
    #このときK==1
    print(X[0])
    exit()

#X[i]日に働くとき、その直前or直後で働ける最も近い日のindex
L=[-1 for i in range(M)]
R=[-1 for i in range(M)]
j=1
for i in range(M-1):
    while(j<M):
        if X[j]-X[i]>=C+1:
            R[i]=j
            break
        else:
            j+=1
j=M-2
for i in range(M-1,0,-1):
    while(j>=0):
        if X[i]-X[j]>=C+1:
            L[i]=j
            break
        else:
            j-=1
LD=[-1 for i in range(M)]
RD=[-1 for i in range(M)]
def Ldfs(i):
    if LD[i]!=-1:
        return LD[i]
    if L[i]==-1:
        LD[i]=1
        return 1
    else:
        LD[i]=Ldfs(L[i])+1
        return Ldfs(L[i])+1
def Rdfs(i):
    if RD[i]!=-1:
        return RD[i]
    if R[i]==-1:
        RD[i]=1
        return 1
    else:
        RD[i]=Rdfs(R[i])+1
        return Rdfs(R[i])+1
for i in range(M):
    Ldfs(i)
    Rdfs(M-1-i)
Y=[0 for i in range(M)]
Y[0]=RD[1]
Y[-1]=LD[-2]
for i in range(1,M-1):
    Y[i]=LD[i-1]+RD[i+1]
for i in range(M):
    if Y[i]<K:
        print(X[i])
list_ = input().split()
remain_quant = int(list_[0] - list_[1])
if remain_quant >= int(list_[2]):
  print(0)
else:
  print(int(list_[2] - remain_quant)

### FIXED CODE ###

list_ = input().split()
remain_quant = int(list_[0]) - int(list_[1])
if remain_quant >= int(list_[2]):
  print(0)
else:
  print(int(list_[2]) - remain_quant)
a=int(input())
b=int(input())
print(a*b-a-b+1)

### FIXED CODE ###

a,b=map(int,input().split())
ans=a*b-a-b+1
print(ans)
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #整数1つinput
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii())
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #文字列1つinput
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

n,w = mii()
wei,val= [0],[0]
for _ in range(n):
    p,q=mii()
    wei.append(p)
    val.append(q)

dp = [[0]*(w+1) for _ in range(n+1)]

for i in range(1,n+1):
    for j in range(1,w+1):
        if wei[i] > j:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j-wei[i]]+val[i],dp[i-1][j])


print(dp[-1][-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #整数1つinput
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii())
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #文字列1つinput
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

n,w = mii()
wei=[]
val=[]
for i in range(n):
    ww,vv=map(int,input().split())
    wei.append(ww)
    val.append(vv)
#dp[i][j]:i番目まで選んで、価値がj以上となる最小の重さ
dp=[[10**10]*(sum(val)+1) for i in range(n+1)]
dp[0][0]=0
for i in range(n):
    for j in range(sum(val)+1):
        if j>=val[i]:
            dp[i+1][j]=min(dp[i][j-val[i]]+wei[i],dp[i][j])
        else:
            dp[i+1][j]=dp[i][j]
ans=[]
for i in range(sum(val)+1):
    if dp[n][i]<=w:
        ans.append(i)
print(max(ans))
N = int(input())
p = list(map(int,input().split()))

ans = 0
for i in range(1,N+1):
    if i == p[i-1]:
        ans += 1

k = 0
for i in range(1,N):
    i += k
    if i == p[i-1] and i+1 == p[i]:
        ans -= 1
        k += 1
print(ans)


### FIXED CODE ###

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

ans = 0
for i in range(1,N+1):
    if i == p[i-1]:
        ans += 1

k = 0
for i in range(1,N):
    i += k
    if i >= N:
        break
    if i == p[i-1] and i+1 == p[i]:
        ans -= 1
        k += 1
print(ans)
x = input()
big = x // 500
small = x % 500 // 5
grace = big + small
print(grace)

### FIXED CODE ###

x = int(input())
big = x // 500
small = x % 500 // 5
grace = big*1000 + small*5
print(grace)
W. H, x, y, = [int(i) for i in input().aplit()]

if x + r <= W and y - r >= 0 and x -r >= 0 and y + <= H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

W, H, x, y, r = [int(i) for i in input().split()]
 
if x - r >= 0 and x + r <= W and y + r <= H and y - r >=0:
   print("Yes")
 
else:
   print("No")
import sys
input = sys.stdin.buffer.readline
from operator import itemgetter
import heapq

def main():
    N,Q = map(int,input().split())
    event = []
    
    for _ in range(N):
        s,t,x = map(int,input().split())
        event.append((s-x,0,x))
        event.append((t-x,1,x))
        
    for i in range(Q):
        a = int(input())
        event.append((a,2,-1))
    
    event.sort(key=itemgetter(0))
    
    use = set()
    stop = []
    heapq.heapify(stop)
    
    for a,b,c in event:
        if b == 0:
            use.add(c)
            heapq.heappush(stop,c)
        elif b == 1:
            use.remove(c)
        else:
            while stop and stop[0] not in use:
                heapq.heappop(stop)
            if stop == []:
                print(-1)
            else:
                print(stop[0])

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from heapq import heappop,heappush

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x))
  task.append((s-x,1,x))

for i in range(Q):
  d = int(input())
  task.append((d,2,i))
answer = [-1]*Q

task.sort()

se = set()
se_hp = []
for a,b,c in task:
  if not b:
    se.remove(c)
  elif b&1:
    se.add(c)
    heappush(se_hp,c)
  else:
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))
N,A,B = map(int,input().split())
ab = A+B

qaws = ""
c = 0
while(N >= c):
  qaws = qaws + "B"*A
  qaws = qaws + "R"*B
  c += 1
print(qaws[:N].count("B"))

### FIXED CODE ###

n,a,b=map(int,input().split())
ans = n//(a+b)*a
r = n%(a+b)
print(min(r,a)+ans)
n, *H = map(int, open(0).read().split())

inc = True
maxes, mins = [], []
for h0, h1 in zip(H, H[1:]):
    if inc:
        if h0 > h1:
            maxes.append(h0)
            inc = False
    else:
        if h0 < h1:
            mins.append(h0)
            inc = True
if inc:
    maxes.append(h1)
print(sum(maxes)-sum(mins))

### FIXED CODE ###

n, *H = map(int, open(0).read().split())

inc = True
maxes, mins = [], []
for h0, h1 in zip(H, H[1:]):
    if inc:
        if h0 > h1:
            maxes.append(h0)
            inc = False
    else:
        if h0 < h1:
            mins.append(h0)
            inc = True
if inc:
    maxes.append(H[-1])
print(sum(maxes)-sum(mins))
[n,k]=list(map(int,input().split()))
ablist=[]
suretu=[]
for i in range(n):
    ab=list(map(int,input().split()))
    suretu+=[ab[0]]*ab[1]
    ablist.append(ab)
suretu.sort()
print(sort[k-1])

### FIXED CODE ###

[n,k]=list(map(int,input().split()))
ablist=[]
for i in range(n):
    ablist.append(list(map(int,input().split())))
ablist=sorted(ablist,key=lambda x:x[0])
bwa=[0]
for i in range(n):
    bwa.append(bwa[-1]+ablist[i][1])
ind=1
while True:
    if bwa[ind-1]<k<=bwa[ind]:
        break
    ind+=1
print(ablist[ind-1][0])
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
	H, W, K = MAP()
	cake = [list(input()) for _ in range(H)]
	cut = [[0 for _ in range(W)] for _ in range(H)]
	lis_0 = []
	lis_1 = []
	num = 1
	for i in range(H):
		if cake[i].count("#") > 0:
			lis_1.append(i)
		else:
			lis_0.append(i)

		ct = 0
		for j in range(W):
			if cake[i][j] == "#":
				ct += 1
				if ct < 2:
					cut[i][j] = num
				else:
					num += 1
					ct = 1
					cut[i][j] = num
			else:
				cut[i][j] = num

		num += 1

	# print(lis_0)
	# print(lis_1)

	for x in lis_0:
		ind = bisect(lis_1, x)
		if ind == H-1:
			ind -= 1
		cut[x] = cut[lis_1[ind]]
		# print("x", cut[x])
		# print("ind", cut[lis_1[ind]])

	for x in cut:
		print(*x)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


def MAP(): return map(int, input().split())


def LIST(): return list(map(int, input().split()))


def ZIP(n): return zip(*(MAP() for _ in range(n)))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
	H, W, K = MAP()
	cake = [list(input()) for _ in range(H)]
	cut = [[1 for _ in range(W)] for _ in range(H)]
	lis_0 = []
	lis_1 = []
	num = 1
	for i in range(H):
		if cake[i].count("#") > 0:
			lis_1.append(i)
		else:
			lis_0.append(i)
			continue

		ct = 0
		for j in range(W):
			if cake[i][j] == "#":
				ct += 1
				if ct < 2:
					cut[i][j] = num
				else:
					num += 1
					ct = 1
					cut[i][j] = num
			else:
				cut[i][j] = num

		num +=1

	# print(lis_0)
	# print(lis_1)

	for x in lis_0:
		ind = bisect(lis_1, x)
		# print(ind)
		if ind == len(lis_1):
			ind -= 1
		cut[x] = cut[lis_1[ind]]
		# print("x", cut[x])
		# print("ind", cut[lis_1[ind]])

	for x in cut:
		print(*x)


if __name__ == '__main__':
    main()
n, k = map(int, input().split())
 
x = [0]*n
 
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
      x[j]=x[j]+1
print(x.count(0))

### FIXED CODE ###

n, k = map(int, input().split())
 
x = [0]*n
 
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for j in a:
      x[j-1]=x[j-1]+1
print(x.count(0))
a[1] = input()
print a[0]*a[1]+' '+2*(a[0]+a[1])

### FIXED CODE ###

m = map(int,raw_input().split())
print m[0]*m[1],2*(m[0]+m[1])
n=int(input())
a=list(map(int,input().split()))
zerocounter=0
for i in range(n):
  if a[i]==0:
    zerocounter=1
    break
if zerocounter==1:
  print(0)
else:
  ans=1
  for i in range(n):
    ans=ans*a[i]
    if ans>10**18:
      ans=-1
      break
  print(ans)


### FIXED CODE ###

import math
a,b=map(str,input().split())
a=int(a)
d=int(b[0])*100+int(b[2])*10+int(b[3])
c=(a*d)//100
if (c+1)*100<=(a*d):
  c+=1
print(c)
#貪欲に埋める
from collections import deque
h,w,k = map(int,input().split( ))

s = []
ichigo = []
for i in range(h):
    si = input()
    si+="."
    s.append(si)
    for j in range(w):
        if si[j]=="#":
            ichigo.append((i,j))

Nm = [[-1]*w for _ in range(h)]
ichigo.sort()
tmp = 1
for ich in ichigo:
    Nm[ich[0]][ich[1]]=tmp
    tmp += 1
#print(Nm)
for ich in ichigo:
    Q = deque()
    Q.append(ich)
    #print(ich)
    now = Nm[ich[0]][ich[1]]
    while Q:
        b,c = Q.popleft()
        for i in range(c+1,w):
            if Nm[b][i]<0:
                Nm[b][i] = now
            else:
                i-=1##
                break

        for j in range(c-1,-1,-1):
            if Nm[b][j]<0:
                Nm[b][j] = now
            else:
                j+=1##
                break
        for u in range(b+1,h):
            flag = True
            for t in range(j,i+1):
                if Nm[u][t]>=0:
                    flag = False
                    break
            if flag:
                for t in range(j,i+1):
                    Nm[u][t] = now
            else:
                break
        for u in range(b-1,-1,-1):
            flag = True
            for t in range(j,i+1):
                if Nm[u][t]>=0:
                    flag = False
                    break
            if flag:
                for t in range(j,i+1):
                    Nm[u][t] = now
            else:
                break
            
for i in range(h):
    print(*Nm[i])

### FIXED CODE ###

h,w,k = map(int, input().split())
s = []
Nm = [[0]*w for i in range(h)]
nm = 1
Q = []
empty =[]
for i in range(h):
    si = input()
    s.append(si)
    berry = False
    for j in range(w):
        if si[j]=="#":
            berry = True
            Nm[i][j]=nm
            nm+=1
            Q.append((i,j))
    if not berry:
        empty.append(i)

for i,j in Q:#横に伸ばす
    for t in range(j+1,w):
        if Nm[i][t]==0:
            Nm[i][t]=Nm[i][j]
        else:
            break
    for t in range(j-1,-1,-1):
        if Nm[i][t]==0:
            Nm[i][t]=Nm[i][j]
        else:
            break
if not empty:
    for i in range(h):
        print(*Nm[i])
    exit()
j=0###
if 0 in empty:#下から延ばす必要がある場合
    j = 0
    while empty[j]==j:
        j+=1
        if j<len(empty):
            continue
        else:
            break
    for t in range(j):
        for s in range(w):
            Nm[t][s] = Nm[j][s]
#print(j)
for i in empty[j:]:#縦下に伸ばす
    for j in range(w):
        Nm[i][j] = Nm[i-1][j]

for i in range(h):
    print(*Nm[i])
def merge_sort(arr):
 if len(arr) <= 1:
  return arr
 mid = len(arr) // 2
# ここで分割を行う
 left = arr[:mid]
 right = arr[mid:]
# 再帰的に分割を行う
 left = merge_sort(left)
 right = merge_sort(right)
# returnが返ってきたら、結合を行い、結合したものを次に渡す
 return merge(left, right)
def merge(left, right):
 merged = []
 l_i, r_i = 0, 0
# ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
 while l_i < len(left) and r_i < len(right):
    # ここで=をつけることで安定性を保っている
  if left[l_i][1] <= right[r_i][1]:
   merged.append(left[l_i])
   l_i += 1
  else:
   merged.append(right[r_i])
   r_i += 1

# 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
 if l_i < len(left):
  merged.extend(left[l_i:])
 if r_i < len(right):
  merged.extend(right[r_i:])
 return merged
import sys
input = sys.stdin.readline
N=int(input())
lst=[0]*N
for i in range(N):
 lst=[list[map(int,input().split())] for i in range(n)]
lsta=merge_sort(lst)
ans=0
t=0
for i in range(N):
 t+=lsta[i][0]
 if t>lsta[i][1]:
  ans+=1
if ans==0:
 print("Yes")
else:
 print("No")


### FIXED CODE ###

def merge_sort(arr):
 if len(arr) <= 1:
  return arr
 mid = len(arr) // 2
# ここで分割を行う
 left = arr[:mid]
 right = arr[mid:]
# 再帰的に分割を行う
 left = merge_sort(left)
 right = merge_sort(right)
# returnが返ってきたら、結合を行い、結合したものを次に渡す
 return merge(left, right)
def merge(left, right):
 merged = []
 l_i, r_i = 0, 0
# ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
 while l_i < len(left) and r_i < len(right):
    # ここで=をつけることで安定性を保っている
  if left[l_i][0] <= right[r_i][0]:
   merged.append(left[l_i])
   l_i += 1
  else:
   merged.append(right[r_i])
   r_i += 1

# 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
 if l_i < len(left):
  merged.extend(left[l_i:])
 if r_i < len(right):
  merged.extend(right[r_i:])
 return merged
import sys
input = sys.stdin.readline
N=int(input())
lst=[0]*N
for i in range(N):
 A,B= map(int,input().split())
 lst[i]=[B,A]
lsta=merge_sort(lst)
ans=0
t=0
for i in range(N):
 t+=lsta[i][1]
 if t>lsta[i][0]:
  ans+=1
if ans==0:
 print("Yes")
else:
 print("No")
MOD = 10 ** 9 + 7
import numpy as np
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

# 前計算
for i in range(n - 1):
    x[i] = x[i + 1] - x[i]

for i in range(m - 1):
    y[i] = y[i + 1] - y[i]

N = [n - 1]
for i in range((n)//2 - 1):
    N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD)

M = [m - 1]
for i in range((m)//2 - 1):
    M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD)

if N[0] % 2 == 0:
    N += N[::-1]
elif N[0] != 1:
    N += N[1::-1]
if M[0] % 2 == 0:
    M += M[::-1]
elif M[0] != 1:
    M += M[1::-1]

# print (N)
# print (M)

N = np.array(N, dtype = 'int64')
M = np.array(M, dtype = 'int64')

X = np.array(x[:-1], dtype = 'int64')
Y = np.array(y[:-1], dtype = 'int64')

# print (N)
# print (M)
# print (X)
# print (Y)

X *= N
Y *= M

X %= MOD
Y %= MOD

# print (X)
# print (Y)
# print ((np.sum(X) * np.sum(Y)) % MOD)

X_sum = np.sum(X) % MOD
Y_sum = np.sum(Y) % MOD

print ((X_sum * Y_sum) % MOD)


### FIXED CODE ###

MOD = 10 ** 9 + 7
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

# 前計算
for i in range(n - 1):
    x[i] = x[i + 1] - x[i]

for i in range(m - 1):
    y[i] = y[i + 1] - y[i]

N = [n - 1]
for i in range(n - 3, 0, -2):
    N.append(N[-1] + i)
    # N.append((N[i] + (n - 1 - 2 * (i + 1))) % MOD)

M = [m - 1]
for i in range(m - 3, 0, -2):
    M.append(M[-1] + i)
    # M.append((M[i] + (m - 1- 2 * (i + 1))) % MOD)

if N[0] % 2 == 0:
    N += N[::-1]
elif N[0] != 1:
    N += N[-2::-1]

if M[0] % 2 == 0:
    M += M[::-1]
elif M[0] != 1:
    M += M[-2::-1]

# print (x)
# print (y)
# print (N)
# print (M)

if len(x) - 1 > len(N):
    while True:
        pass

if len(y) - 1 > len(M):
    while True:
        pass


X_sum = 0
for i in range(n - 1):
    X_sum += x[i] * N[i]
    X_sum %= MOD

Y_sum = 0
for i in range(m - 1):
    Y_sum += y[i] * M[i]
    Y_sum %= MOD

print ((X_sum * Y_sum) % MOD)
def main():
    x,y = map(int,input().split())
    p = list(map(int,input().split()))

    bigNumber = 0

    for i in range(x-y+1):

        number = sum(p[i:i+y])

        if number > bigNumber:
            bigNumber = number

    print((bigNumber + y) / 2)

main()


### FIXED CODE ###

S, T = map(str,input().split())
A, B = map(int,input().split())
U = str(input())

if U == S:
    A = A - 1
else:
    B = B - 1

print(A, B)