Harryxun/stf_run huggingface dataset:
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
 
if min(y)-max(x)>=2 and X<Y:
  if len(set(range(max(x)+1,min(y)))&set(range(X+1,Y+1)):
  	print('No War')
  else:
    print('War')
else:
  print('War')

### FIXED CODE ###

N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
 
if max(x)<min(y) and X<Y:
  if len(set(range(max(x)+1,min(y)+1))&set(range(X+1,Y+1)))>=1:
  	print('No War')
  else:
    print('War')
else:
  print('War')
N=int(input())
A=[map(int,input().split())]
A_sort=sorted(A)
Alice=[]
Bob=[]
if N%2==0:
    for i in range(int(N/2)):
        Alice.append(A_sort(2*i+1))
        Bob.append(A_sort(2*i))
else:
    for i in range(int(N/2+1)):
        Alice.append(A_sort(2*i))
    for i in range(int(N/2)):
        Bob.append(A_sort(2*i+1))
Alice_sum=sum(Alice)
Bob_sum=sum(Bob)
ans=Alice_sum-Bob_sum
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A_sort=sorted(A)
Alice=[]
Bob=[]
if N%2==0:
    for i in range(int(N/2)):
        Alice.append(A_sort[2*i+1])
        Bob.append(A_sort[2*i])
else:
    for i in range(int(N/2+1)):
        Alice.append(A_sort[2*i])
    for i in range(int(N/2)):
        Bob.append(A_sort[2*i+1])
Alice_sum=sum(Alice)
Bob_sum=sum(Bob)
ans=Alice_sum-Bob_sum
print(ans)
s = input()
N = len(s)
s_trim = ''.join([c for c in s if c != 'x'])
N_trim = len(s_trim)

def check_anagram():
    for i in range(N_trim):
        j = N_trim - 1 - i
        if s_trim[i] != s_trim[j]:
            return False
    return True

def solve():
    if not check_anagram():
        return -1

    # Center of anagram
    pr = N_trim // 2
    pl = pr
    if N_trim % 2 == 0:
        pl -= 1

    xl = 0
    tl = 0
    while xl < N:
        if s[xl] != 'x':
            assert s[xl] == s_trim[tl]
            if tl == pl:
                break
            tl += 1
        xl += 1

    if N_trim % 2 == 1:
        xr = xl
    else:
        xr = xl + 1
        while s[xr] == 'x':
            xr += 1

    cost = 0
    while True:
        assert s[xl] == s_trim[pl]
        assert s[xr] == s_trim[pr]
        # assert s[xl] == s[xr]
        if s[xl] != s[xr]:
            while True: pass
        assert s_trim[pl] == s_trim[pr]
        pl -= 1; pr += 1
        while True:
            xl -= 1; xr += 1
            if not (xl >= 0 and xr < N and s[xl] == 'x' and s[xr] == 'x'):
                break
        while xl >= 0 and s[xl] == 'x':
            cost += 1
            xl -= 1
        while xr < N and s[xr] == 'x':
            cost += 1
            xr += 1
        if pl < 0 and pr >= N_trim and xl < 0 and xr >= N:
            return cost

print(solve())


### FIXED CODE ###

s = input()
N = len(s)
s_trim = ''.join([c for c in s if c != 'x'])
N_trim = len(s_trim)

def check_anagram():
    for i in range(N_trim):
        j = N_trim - 1 - i
        if s_trim[i] != s_trim[j]:
            return False
    return True

def solve():
    if not check_anagram():
        return -1
    if N_trim == 0:
        return 0
    # Center of anagram
    pr = N_trim // 2
    pl = pr
    if N_trim % 2 == 0:
        pl -= 1

    xl = 0
    tl = 0
    while xl < N:
        if s[xl] != 'x':
            # assert s[xl] == s_trim[tl]
            if tl == pl:
                break
            tl += 1
        xl += 1

    if N_trim % 2 == 1:
        xr = xl
    else:
        xr = xl + 1
        while s[xr] == 'x':
            xr += 1

    cost = 0
    while True:
        # assert s[xl] == s_trim[pl]
        # assert s[xr] == s_trim[pr]
        # assert s[xl] == s[xr]
        # assert s_trim[pl] == s_trim[pr]
        pl -= 1; pr += 1
        while True:
            xl -= 1; xr += 1
            if not (xl >= 0 and xr < N and s[xl] == 'x' and s[xr] == 'x'):
                break
        while xl >= 0 and s[xl] == 'x':
            cost += 1
            xl -= 1
        while xr < N and s[xr] == 'x':
            cost += 1
            xr += 1
        if pl < 0 and pr >= N_trim and xl < 0 and xr >= N:
            return cost

print(solve())
def dot(a, b):
    return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
    return (a.real*b.imag - a.imag*b.real)

EPS = 10**(-7)

def isIntersectedLS(a1, a2, b1, b2):
    return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
            (cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)

while 1:
    try:
        x,y = [[0 for i in xrange(3)] for j in xrange(2)]
        a = []
        z = [0 for i in xrange(2)]
        x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, raw_input().split())
        for i in xrange(3):
            a.append((x[i]+(y[i])*1j))
        c = (sum(x)/3)+(sum(y)/3)*1j
        p = z[0]+z[1]*1j
            
        for i in xrange(3):
            #print a, c, p
            if isIntersectedLS(a[i-1], a[i], c, p) is True:
                print "NO"
                break
        else:
            print "YES"
            
    except EOFError:
        break

### FIXED CODE ###

def dot(a, b):
    return (a.real*b.real - a.imag*b.imag)
def cross(a, b):
    return (a.real*b.imag - a.imag*b.real)

EPS = 10**(-7)

def isIntersectedLS(a1, a2, b1, b2):
    return ((cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1)) < EPS and
            (cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1)) < EPS)

while 1:
    try:
        x,y = [[0. for i in xrange(3)] for j in xrange(2)]
        a = []
        z = [0. for i in xrange(2)]
        line = raw_input().split()
        if line == []: break
        x[0],y[0],x[1],y[1],x[2],y[2],z[0],z[1] = map(float, line)
        for i in xrange(3):
            a.append((x[i]+(y[i])*1j))
        c = (sum(x)/3)+(sum(y)/3)*1j
        p = z[0]+z[1]*1j
           
        for i in xrange(3):
            #print a, c, p
            if isIntersectedLS(a[i-1], a[i], c, p) is True:
                print "NO"
                break
        else:
            print "YES"
           
    except EOFError:
        break
h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

count = 0
for binh in range(2**h):
    for binw in range(2**w):
        redh, redw = bin(binh)[2:], bin(binw)[2:]  # remove suffix '0x'
        squares = [list(row) for row in c]
        for rh in redh:
            for wh in range(w):
                squares[rh][wh] = '*'
        for rw in redw:
            for hw in range(h):
                squares[rw][hw] = '*'
        count += sum(row.count('#') for row in squares) == k

print(k)


### FIXED CODE ###

import itertools
import numpy as np

h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

count = 0
for ph in itertools.product([0, 1], repeat=h):
    for pw in itertools.product([0, 1], repeat=w):
        squares = np.array([[1 if cell == '#' else -1 for cell in row] for row in c])
        squares[np.array(ph) == True, :] *= 0
        squares[:, np.array(pw) == True] *= 0
        if np.count_nonzero(squares == 1) == k:
            count += 1

print(count)
N, K = map(int, input().split())

N = N % K

if (N > abs(N - K)):
    N = abs(N - K)
else:
    print(N)
    break

### FIXED CODE ###

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

N = N % K

if (N == 0):
    print(N)
elif (N == K):
    print(0)
elif (K == 1):
    print(0)
else:
    while (N >= 0):
        if (N > abs(N - K)):
            N = abs(N - K)
        else:
            print(N)
            break
N,M=[int(i) for i in input().split()]
bridge=[]
for i in range(M):
  bridge.append([int(i)-1 for i in input().split()])
nod=[[i,[i]] for i in range(N)]
e=0
totale=int(N*(N-1)/2)


def joint(a,b,e):
  na=nod[a][0]
  nb=nod[b][0]
  if na==nb:
    return e
  else:
    e+=len(nod[na][1])*len(nod[nb][1])
    if na<=nb:
      nod[na][1].extend(nod[nb][1])
      for i in nod[nb][1]:
        nod[i][0]=na
      nod[nb][1]=0
    else:
      nod[nb][1].extend(nod[na][1])
      for i in nod[na][1]:
        nod[i][0]=na
      nod[na][1]=0
    return e
  


ans=[]
for i in range(M-1,-1,-1):
  ans.append(totale-e)
  e=joint(bridge[i][0],bridge[i][1],e)
  
for i in range(M-1,-1,-1):
  print(ans[i])

### FIXED CODE ###

N,M=[int(i) for i in input().split()]
bridge=[]
for i in range(M):
  bridge.append([int(i)-1 for i in input().split()])
nod=[[i,[i]] for i in range(N)]
e=0
totale=int(N*(N-1)/2)


def joint(a,b,e):
  na=nod[a][0]
  nb=nod[b][0]
  if na==nb:
    return e
  else:
    e+=len(nod[na][1])*len(nod[nb][1])
    if na<nb:
      nod[na][1].extend(nod[nb][1])
      for i in nod[nb][1]:
        nod[i][0]=na
    else:
      nod[nb][1].extend(nod[na][1])
      for i in nod[na][1]:
        nod[i][0]=nb
    return e
  


ans=[]
for i in range(M-1,-1,-1):
  ans.append(totale-e)
  e=joint(bridge[i][0],bridge[i][1],e)
  
for i in range(M-1,-1,-1):
  print(ans[i])
n,m=map(int,input().split())
mat=[]
dx=[0,0,-1,1]
dy=[1,-1,0,0]
for i in range(n):
    mat.append(list(input().strip()))
f=0 
for i in range(n):
    if f:
        break 
    for j in range(m):
        if mat[i][j]=='#':
            q=[[i,j]]
            f=1 
            vis=[[0 for j in range(m)]for i in range(n)]
            vis[i][j]=1 
            while q:
                t=q.pop(0)
                #print(t)
                x,y=t[0],t[1] 
                for k in range(4): 
                    if 0<=x+dx[k]<n and 0<=y+dy[k]<m and vis[x+dx[k]][y+dy[k]]==0 and mat[x+dx[k]][y+dy[k]]=='#': 
                        vis[x+dx[k]][y+dy[k]]=1 
                        q.append([x+dx[k],y+dy[k]])
            break 
for i in range(n):
    for j in range(m): 
        if vis[i][j]==0 and mat[i][j]=='#':
           # print(i,j)
            print('No')
            exit()
print('Yes')

### FIXED CODE ###

n,m=map(int,input().split())
mat=[]
dx=[0,0,-1,1]
dy=[1,-1,0,0]
for i in range(n):
    mat.append(list(input().strip()))
f=0 
for i in range(n):
    for j in range(m):
        if mat[i][j]=='#':
            f=0 
            for k in range(4): 
                if 0<=i+dx[k]<n and 0<=j+dy[k]<m and mat[i+dx[k]][j+dy[k]]=='#': 
                    f=1  
            if not f:
                print('No')
                exit()
print('Yes')
l.r = map(int,input().split())

mod = 2019
a = l%2019
b = l%2019

if r-l >= 2018:
  print(0)

else:
  if a < b:
    print(a*a+1)
  else:
    print(0)

### FIXED CODE ###

l,r = map(int,input().split())
mod = 2019
a = l%mod
b = r%mod

if r-l >= 2018:
    print(0)

else:
    if a > b:
        print(0)
    else:
        t = (a*(a+1))%mod
        for x in range(a,b):
            for y in range(x+1,b+1):
                if (x*y)%mod < t:
                    t = (x*y)%mod
        print(t)
n = int(input())
h = list(map(int, input().split()))
     
if n == 1:
	print("Yes")
else:
    for i in range(n-1):
    	if h[i+1] < h[i]:
        h[i+1] -= 1
    for i in range(n-1):
        if h[i+1] < h[i]:
          print("No")
          break
    else:
        print("Yes")

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
h[0] -= 1
             
if n == 1:
      print("Yes")
else:
      for i in range(n-1):
            if h[i] < h[i+1]:
                  h[i+1] -= 1
      for i in range(n-1):
            if h[i+1] < h[i]:
                  print("No")
                  break
      else:
            print("Yes")
n, m = map(int, input().split())


a = [[],[],[]]
for i in range(m):
    s, c = map(int, input().split())
    if not c in a[s-1]:
        a[s-1].append(c)
    
ans = 0
if m==0:
    if n==3:
        print(100)
    elif n==2:
        print(10)
    else :
        print(0)
elif (len(a[0]) > 1) or (len(a[1]) > 1) or (len(a[2]) > 1):
    print(-1)
elif (n==3 or n==2) and len(a[0]) == 0:
    a[0][0]=1
    if (n==3 or n==2) and a[0][0] == 0:
        print(-1)
    else:
        for i in range(n):
            if len(a[i]) == 1:
                ans += a[i][0] * (10**(n-1-i))
    print(ans)








### FIXED CODE ###

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


a = [[],[],[]]
for i in range(m):
    s, c = map(int, input().split())
    if not c in a[s-1]:
        a[s-1].append(c)
    
ans = 0
if m==0:
    if n==3:
        print(100)
    elif n==2:
        print(10)
    else :
        print(0)
elif (len(a[0]) > 1) or (len(a[1]) > 1) or (len(a[2]) > 1):
    print(-1)
else:
    if (n==3 or n==2) and len(a[0]) == 0:
        a[0].append(1)
    if (n==3 or n==2) and a[0][0] == 0:
        print(-1)
    else:
        for i in range(n):
            if len(a[i]) == 1:
                ans += a[i][0] * (10**(n-1-i))
        print(ans)
r1, c1, r2, c2 = map(int, input().split())

MOD = 10 ** 9 + 7
MAX = 10 ** 6 + 5
modinv = lambda a, mod=MOD: pow(a, -1, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])


def comb(n, k, error=0):
    if not 0 <= k <= n:
        return error
    return fac[n] * inv[k] * inv[n - k] % MOD


ans = comb(r2 + c2 + 2, r2 + 1) + comb(r1 + c1, r1) - comb(r1 + c2 + 1, r1) - comb(r2 + c1 + 1, c1)
ans %= MOD
print(ans)

### FIXED CODE ###

r1, c1, r2, c2 = map(int, input().split())

MOD = 10 ** 9 + 7
MAX = 2 * 10 ** 6 + 10
modinv = lambda a, mod=MOD: pow(a, mod - 2, mod)
fac, inv = [1] * MAX, [1] * MAX
for i in range(1, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = modinv(fac[i])


def comb(n, k, error=0):
    if not 0 <= k <= n:
        return error
    return fac[n] * inv[k] * inv[n - k] % MOD


ans = comb(r2 + c2 + 2, r2 + 1) + comb(r1 + c1, r1) - comb(r1 + c2 + 1, r1) - comb(r2 + c1 + 1, c1)
ans %= MOD
print(ans)
x = int(input())

m = 2*10**9
l = []

a = 0
b = 0
while b <= m:
  b = a**5
  l.append(b)
  a += 1
  
flg = 0
for i in range(len(l)):
  if flg == 1:
    break
  for j in range(i+1,len(l)):
    if l[i] + l[j] == x:
      res = [i,-j]
      flg = 1
      break
    elif l[i] - l[j] == x:
      res = [i,j]
      flg = 1
      break

print(res[0],res[1])
    

### FIXED CODE ###

x = int(input())

m = 2*10**9
l = []

a = 0
b = 0
p = 0
#while b <= m:
while p < 1000:
  b = a**5
  l.append(b)
  a += 1
  p += 1


flg = 0
for i in range(len(l)):
  
  if flg == 1:
    break
  for j in range(i+1,len(l)):
    if l[i] + l[j] == x:
      res = [i,-j]
      flg = 1
      break
    elif l[i] - l[j] == x:
      res = [i,j]
      flg = 1
      break
    elif -l[i] + l[j] == x:
      res = [-i,-j]
      flg = 1
      break
    elif -l[i] - l[j] == x:
      res = [-i,j]
      flg = 1
      break
      
      
print(res[0],res[1])
def make_prime(n):
    prime = []
    temp = n
    for i in range(2, n):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            prime.append([i, cnt])
    if temp!=1:
        prime.append([temp, 1])
    if prime==[]:
        prime.append([n, 1])

    return prime


from collections import defaultdict
d=defaultdict(lambda :1)
num = int(input())
w=10**9+7
for i in range(2,num+1):
    prime_num_list = make_prime(i)
    for j in range(len(prime_num_list)):
        key = prime_num_list[j][0]
        d[key] += prime_num_list[j][1]
cnt=1
for val in d.values():
    cnt*=val
print(cnt)

### FIXED CODE ###

sx, sy, tx, ty = map(int,input().split())
x,y=tx-sx,ty-sy
trail='U'*y + 'R'*x
trail+='D'*y + 'L'*x
trail+='L'+'U'*(y+1)+'R'*(x+1)+'D'
trail+='R'+'D'*(y+1)+'L'*(x+1)+'U'
print(trail)
n=int(input())
lst=[]
for i in range(n):
  a,b,c=map(int,input().split())
  lst.append([a,b,c])
C=[[float('inf')]*3]*n
C[0][0]=lst[0][0]
C[0][1]=lst[0][1]
C[0][2]=lst[0][2]
D=[0,1,2]
d=D
for i in range(1,n-1):
  for j in d:
    e=D.remove(j)
    C[i+1][j]=C[i][e[0]]+lst[i][e[0]]
    for k in range(1,len(e)):
      if C[i][e[k]]+lst[i][e[k]]>C[i+1][j]:
        C[i+1][j]=C[i][e[k]]+lst[i][e[k]]
print(max(C[n-1]))
      
    
  
  


### FIXED CODE ###

n=int(input())
lst=[]
for i in range(n):
  a,b,c=map(int,input().split())
  lst.append([a,b,c])
C=[]
for i in range(n):
    C.append([float('inf')]*3)
C[0][0]=lst[0][0]
C[0][1]=lst[0][1]
C[0][2]=lst[0][2]
D=[0,1,2]
for i in range(n-1):
  for j in [0,1,2]:
    del D[j]
    C[i+1][j]=max(C[i][D[0]]+lst[i+1][j],C[i][D[1]]+lst[i+1][j])
    D=[0,1,2]
print(max(C[n-1]))
p = 1
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	p *= a[i]
    if p > 10**18:
      return -1
    
return p

### FIXED CODE ###

def main ():
	n = int(input())
	a = list(map(int,input(). split ()))
    
	if 0 in a:
		print(0)
		return
	prod = 1
	for i in a:
		prod *= i
		if prod > 1000000000000000000:
			print(-1)
			return
	print(prod)
main ()
N=input()
L=[[0]*N for i in range(N)]
R,B,Y=1,2,3
C=R
for y in range(N/2+1):
    for x in range(y,N-y):
        L[y][x]=C
        L[N-y-1][x]=C
    C=C%3+1
C=R
for x in range(N/2+1):
    for y in range(x,N-x):
        L[y][x]=C
        L[y][N-x-1]=C
    C=C%3+1

for i in range(input()):
    a,b=map(int,raw_input().split())
    print L[b-1][a-1]

### FIXED CODE ###

N=input()
for i in range(input()):
    a,b=map(int,raw_input().split())
    print min(a-1,N-a,b-1,N-b)%3+1
import sys
input = sys.stdin.readline
import numpy as np

N, W = map(int, input().split())
dp = np.zeros(W+1, dtype=int)

for i in range(N):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np

N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
wv = np.array(wv)
V = max(wv[:, 1])
dp = np.array([float('inf')]*(N*V+1))

dp[0] = 0
for i in range(N):
    w, v = wv[i]
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(max(np.where(dp<=W)[0]))
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bellman_ford(N: int, edges: list, src: int) -> list:
    """ ベルマンフォード(頂点数, 辺集合(0-indexed), 始点) """

    # 頂点[ある始点からの最短距離] (経路自体を知りたい時はここに前の頂点も持たせる)
    res = [INF] * N
    res[src] = 0
    # 各辺によるコストの置き換えを頂点数N-1回繰り返す
    for _ in range(N-1):
        for src, dest, cost in edges:
            if res[dest] > res[src] + cost:
                res[dest] = res[src] + cost
    ans = res[N-1]
    # 負の閉路(いくらでもコストを減らせてしまう場所)がないかチェックする
    for _ in range(N-1):
        for src, dest, cost in edges:
            if res[dest] > res[src] + cost:
                res[dest] = res[src] + cost
    if ans != res[N-1]
        # あったら空リストを返却
        return []
    # 問題なければ頂点リストを返却
    return res

N, M = MAP()
edges = []
for i in range(M):
    a, b, c = MAP()
    a -= 1; b -= 1
    edges.append((a, b, -c))

res = bellman_ford(N, edges, 0)

if res:
    print(-res[N-1])
else:
    print('inf')


### FIXED CODE ###

# -*- coding: utf-8 -*-

"""
・ベルマンフォード
"""

import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)

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

edges = [None] * M
for i in range(M):
    a, b, c = map(int, input().split())
    # 0-indexed
    # コストの正負を逆転させれば最短経路問題として処理できる
    edges[i] = (a-1, b-1, -c)

def bellman_ford(N: int, edges: list, start: int) -> list:
    # 頂点[ある始点からの最短距離]
    # (経路自体を知りたい時はここに前の頂点も持たせる)
    verts = [float('inf')] * N
    verts[start] = 0
    # 各辺によるコストの置き換えを頂点数N-1回繰り返す
    for i in range(N-1):
        for src, dest, cost in edges:
            verts[dest] = min(verts[src] + cost, verts[dest])
    # 無限に減らせる場所がないか確認
    for i in range(N):
        for src, dest, cost in edges:
            if verts[src] + cost < verts[dest]:
                verts[dest] = verts[src] + cost
                if dest == N-1:
                    # 頂点Nがそれに該当していたら空リストを返却
                    return []
    # 問題なければ頂点リストを返却
    return verts

verts = bellman_ford(N, edges, 0)
if not verts:
    print('inf')
else:
    # 正負を戻して出力
    print(-verts[N-1])
N = int(input())
M = int(input())
a = N*(N-1)//2 + M*(M-1)//2
print(a)

### FIXED CODE ###

N,M = map(int,input().split())
print(N*(N-1)//2 + M*(M-1)//2)
def f(n):
  return '7' in n

print f(raw_input())



### FIXED CODE ###

def f(n):
  return '7' in n
 
print 'Yes' if f(raw_input()) else 'No'
a, b = map(int, input().split(''))

if a == 9 or b == 9:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

l = list(input())
for i in l:
    if i == "9":
        print("Yes")
        break
else:
    print("No")
from fractions import gcd
from functools import reduce

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

n, m = map(int, input().split())
a_str_list = input().split()

a_list = []

for item in a_str_list:
    a_list.append(int(item))

a_list = list(set(l))

step = lcm_list(a_list)
start = step // 2

if m - start < 0:
    print(0)
else:
    print(((m-start) // step)+1)


### FIXED CODE ###

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


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


def two(val):
    ret = 0
    tmp = val
    while True:
        if tmp != 0 and tmp % 2 == 0:
            ret += 1
            tmp = tmp // 2
        else:
            break
    return ret


n, m = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = []

for item in a_list:
    b_list.append(item // 2)

cnt = -1

for item in b_list:
    ret = two(item)
    if cnt == -1:
        cnt = ret
    elif cnt != ret:
        print(0)
        exit()

val = b_list[0]

for item in b_list:
    val = lcm(item, val)

ret = m // val

tmp1 = ret // 2
tmp2 = ret % 2

print(tmp1 + tmp2)
n, k = map(int, input().split())
a = list(map(int, input().split()))+[0]
s = [0 for _i in range(n+1)]
for i in range(n):
    s[max(0, i-a[i])] += 1
    s[min(n, i+a[i]+1)] -= 1   
a = s.copy()+[0]
for j in range(min(10**4, k-1)):
    t = [0 for _i in range(n+1)]
    for i in range(n):
        a[i] += a[i-1]
        t[max(0, i-a[i])] += 1
        t[min(n, i+a[i]+1)] -= 1
    a = t.copy()
for i in range(1, n):
    a[i] += a[i-1]
print(*a[:n])

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))+[0]
s = [0 for _i in range(n+1)]
for i in range(n):
    s[max(0, i-a[i])] += 1
    s[min(n, i+a[i]+1)] -= 1   
a = s.copy()+[0]
for j in range(min(100, k-1)):
    t = [0 for _i in range(n+1)]
    for i in range(n):
        a[i] += a[i-1]
        t[max(0, i-a[i])] += 1
        t[min(n, i+a[i]+1)] -= 1
    a = t.copy()+[0]
for i in range(1, n):
    a[i] += a[i-1]
print(*a[:n])
import math
r=int(input())
S=r*r*math.pi
L=2*r*math.pi
print('%.5f %.5f'%(S,L))

### FIXED CODE ###

import math
r=float(input())
S=r*r*math.pi
L=2*r*math.pi
print('%.5f %.5f'%(S,L))
N=int(input());t=[0]*N
for i in range(2,N+1):
    s=1
    while i>1:
        s+=1
        while i%s==0:
            i=i//s
            t[s-2]+=1
for j in range(N):
    q=q*(t[j]+1)%(10**9+7)
print(q)

### FIXED CODE ###

N=int(input())
q=1
t=[0]*N
for i in range(2,N+1):
    s=1
    while i>1:
        s+=1
        while i%s==0:
            i=i//s
            t[s-2]+=1
for j in range(N):
    q=q*(t[j]+1)%(10**9+7)
print(q)