Harryxun/stf_run huggingface dataset:
n, m, x, y = map(int, input().split())
if x>y :
    print('War')
a = 0
else:
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')


### FIXED CODE ###

n, m, x, y = map(int, input().split())
if x>y :
    print('War')
else  :
    X = sorted(list(map(int, input().split())))
    Y = sorted(list(map(int, input().split())))
    a = 0
    for i in range(x+1, y+1):
        if X[-1]<i and i <= Y[0] and x < i and i <= y:
            print('No War')
            break
        else :
            a += 1
    if a == y-x:
        print('War')
import sys
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
   sum += int(x[i])

  print(sum) 

### FIXED CODE ###

while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)
X, K, D = map(int, input().split())
absX = abs(X)
k = absX//D
if k <= K:
    abs_pos = absX-k*D
    K -= k
    if K % 2 == 0:
        print(int(absX/X * abs_pos))
    else:
        print(int(absX/X * abs(abs_pos - D)))
else:
    print(int(absX/X * (absX-D*K)))

### FIXED CODE ###

X, K, D = map(int, input().split())
absX = abs(X)
k = absX//D
if k < K:
    abs_pos = absX-k*D
    K -= k
    if K % 2 == 0:
        print(int(abs_pos))
    else:
        print(int(abs(abs_pos - D)))
else:
    print(int(abs(absX-D*K)))
N,K = map(int, input().split())
if K > (N*(N-1)//2)-(N-1):
    print(-1)
    exit()
else:
    hen = [[0,0] for _ in range((N-1)+K)]
    for i in range(2,N+1):
        hen[i-2] = [1,i]
    tmp = 1
    br = 0
    for j in range(2,N):
        for k in range(j+1,N+1):
            hen[N-2+tmp] = [j,k]
            tmp += 1
            if N-2+tmp == len(hen):
                br = 1
                break
        if br == 1:
            break
    print(len(hen))
    for l in hen:
        print(*l)

### FIXED CODE ###

N,K = map(int, input().split())
if K > (N*(N-1)//2)-(N-1):
    print(-1)
    exit()
else:
    hen = [[0,0] for _ in range((N-1)+((N-1)*(N-2)//2)-K)]
    for i in range(2,N+1):
        hen[i-2] = [1,i]
    tmp = 1
    br = 0
    if hen[-1] !=[0,0]:
        print(len(hen))
        for l in hen:
            print(*l)
        exit()
    for j in range(2,N):
        for k in range(j+1,N+1):
            hen[N-2+tmp] = [j,k]
            tmp += 1
            if N-2+tmp == len(hen):
                br = 1
                break
        if br == 1:
            break
    print(len(hen))
    for l in hen:
        print(*l)
a = str(input())
ans = 0
if a[0] == 0:
    ans++

if a[1] == 0:
    ans++

if a[2] == 0:
    ans++

print(ans)


### FIXED CODE ###

a = str(input())
ans = 0
if a[0] == "1":
    ans = ans + 1

if a[1] == "1":
    ans = ans + 1

if a[2] == "1":
    ans = ans + 1

print(ans)
# -*- coding: utf-8 -*-

import numpy as np

N, K = map(int, input().split())
 
h = np.zeros(N)
h[:] = (map(int, input().split()))
 
dp = np.full(N, np.inf)
 
for n in range(1, N):
    temp = float("inf")
    k = min(K, n)
        temp = min(dp[n-k:n] + np.abs(h[n]-h[n-k:n]))
    dp.append(temp)
#print(dp)
print(dp[N-1])

### FIXED CODE ###

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

import numpy as np

N, K = map(int, input().split())
 
h = np.array(list(map(int, input().split())))
 
dp = np.zeros(N)
 
for n in range(1, N):
    k = min(K, n)
    temp = np.min(dp[n-k:n] + np.abs(h[n]-h[n-k:n]))
    dp[n] = temp
print(int(dp[-1]))
A, P = map(int, input().split())

a = A*3 + P

print(math.floor(a/2))

### FIXED CODE ###

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

a = A*3 + P

if a > 0:
  print(int(a/2))
else:
  print(0)
a,b,v,w,t = int(input())

d = abs(b-a)
p = abs(w*t-v*t)
i=0
for i in range(t):
  if p=d:
    print("YES")
  else:
    print("NO")


### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
    print('NO')
else:
    if 1 <= (abs(b - a) / (v - w)) <= t:
        print('YES')
    else:
        print('NO')
h=int(input())
    w=int(input())
    n=int(input())
     
    if h>w:
      if n%h==0:
        ct=n//h
      else:
        ct=n//h+1
    else:
      if n%w==0:
        ct=n//w
      else:
        ct=n//w+1
    print(ct)

### FIXED CODE ###

h=int(input())
w=int(input())
n=int(input())         
if h>w:
  if n%h==0:
    ct=n//h
  else:
    ct=n//h+1
else:
  if n%w==0:
    ct=n//w
  else:
    ct=n//w+1
print(ct)
A,B,K = map(int, input().split())
ans = []
for i in range(A, A+K):
  ans.append(i)
for i in range(B-K+1, B+1):
  ans.append(i)
ans = list(set(ans)).sort(reverse=True)
for i in ans:
  if i>=A and i<=B:
    print(i)

### FIXED CODE ###

A,B,K = map(int, input().split())
ans = []
for i in range(A, A+K):
  ans.append(i)
for i in range(B-K+1, B+1):
  ans.append(i)
ans = list(set(ans))
ans.sort(reverse=False)
for i in ans:
  if i>=A and i<=B:
    print(i)
20
xxzaffeeeeddfkkkkllq

### FIXED CODE ###

# coding: utf-8
N = int(input())
S = input()
ans = 1
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans += 1
print(ans)
#
a, b, x = map(int, input().split())

#Binary Search
high = 10**9 + 1
low  = 0
n = 0
while high - low > 0:
    mid = (high + low)//2
    if a * mid + b * len(str(mid)) <= x:
        low = mid
    else:
        high = mid

print(low)

### FIXED CODE ###

S = input()

A = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

if S == A[0]:
    ans = 7
elif S == A[1]:
    ans = 6
elif S == A[2]:
    ans = 5
elif S == A[3]:
    ans = 4
elif S == A[4]:
    ans = 3
elif S == A[5]:
    ans = 2
elif S == A[6]:
    ans = 1

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

if a>0 and b>0:
  print('Positive')
  exit()
elif a=0 or b=0:
  print('Zero')
  exit()
elif a<0 and 0<b:
  if abs(a)%2==0:
    print('Positive')
   	exit()
  else:
    print('Negative')
    exit()
else:
  if abs(b-a)%2==0:
    print('Negative')
    exit()
  else:
    print('Positive')
    exit()

  

### FIXED CODE ###

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

if a>0 and b>0:
    print('Positive')
    exit()

elif a<=0 and 0<=b:
    print('Zero')
    exit()
else:
    if abs(b-a)%2==0:
        print('Negative')
        exit()
    else:
        print('Positive')
        exit()
a,b,c = int(input().split())
print(a,b,c)

### FIXED CODE ###

import math

rad = input()
rad = int(rad)
print(2 * math.pi * rad)
import math
n = input()
c = 0

for i in range(n):
    x = input()
    if x == 1:
        x = 0
    for j in range(2,math.floor(math.sqrt(x))+ 1):
        if x % j == 0:
            x = 0
            break
    if x != 0:
        c += 1	
print(c)

### FIXED CODE ###

import math
n = int(input())
count = 0
for i in range(n):
    a = int(input())
    for j in range(2,int(math.sqrt(a) + 1)):
        if a % j == 0:
            break
    else:
        count += 1  
print(count)
a,b,c=map(int,input().split())
x = list(map(int,input().split()))
print(max(abs(b-x[-1]),abs(x[-1]-x[-2])))



### FIXED CODE ###


a,b,c=map(int,input().split())
x = list(map(int,input().split()))
if a == 1:
    print(abs(c-x[-1]))
else:
    print(max(abs(c-x[-1]),abs(x[-1]-x[-2])))
a,b=map(int,input(),split())
if a%2!=b%2:
    print("IMPOSSIBLE")
else:
    print(a+b//2)

### FIXED CODE ###

a,b=map(int,input().split())
if a%2!=b%2:
    print("IMPOSSIBLE")
else:
    print((a+b)//2)
sS = input().rstrip()
iL = len(sS)
if iL == 2:
    print("-1 -1")
    exit()
for i in range(iL-1):
    if sS[i] == sS[i+1] or sS[i] == sS[i+2]:
        print(i+1,i+3) #あぁ..
        exit()
print("-1 -1")



### FIXED CODE ###

sS = input().rstrip()
iL = len(sS)
if iL == 2:
    if sS[0] == sS[1]:
        print ("1 2")
    else:
        print("-1 -1")
    exit()
for i in range(iL-2):
    if sS[i] == sS[i+1] or sS[i] == sS[i+2]:
        print(i+1,i+3) #あぁ..
        exit()
print("-1 -1")
n = int(input())

a = []
xys = [[] for i in range(n)]

for j in range(n):
    a.append(int(input()))
    for i in range(a[j]):
        xys[j].append(list(map(int,input().split())))


ps = []
p = [0 for i in range(n)]
for i in range(n+1):
    for combi in itertools.combinations(range(n),i):
        p = [0 for i in range(n)]
        combi = list(combi)
        for i in combi:
            p[i] = 1
        ps.append(p)


for l in range(2**n):
    for i in range(n):
        if  (ps[l])[i] == 1:
            for j in range(a[i]):
                if ps[l][xys[i][j][0] - 1] != xys[i][j][1]:
                    ps[l] = [0,0,0]

print(max(sum(ps[l]) for l in range(2**n)))

### FIXED CODE ###

n = int(input())

a = []
xys = [[] for i in range(n)]

for j in range(n):
    a.append(int(input()))
    for i in range(a[j]):
        xys[j].append(list(map(int,input().split())))


ans = 0
for i in range(1,2**n):
    cont = True
    for j in range(n):
        if (i >> j) & 1 == 1:
            for x,y in xys[j]:
                if (i >> (x-1)) & 1 != y:
                    cont = False
                    break
        if not cont:
            break
    if cont:
        ans = max(ans,bin(i)[2:].count('1'))

print(ans)
N, K = map(int, input().split())
X = [int(i) for i in input().split()]

X_plus = [0]
X_minus = [0]
for i in range(N):
    if X[i] < 0:
        X_minus.append(X[i])
    else:
        X_plus.append(X[i])

n_minus = len(X_minus)-1
n_plus = len(X_plus)-1
res = []
for i in range(1, n_minus+1):
    if n_plus > K-i-1:
        res.append(abs(X_minus[-i])*2 + abs(X_plus[K-i])) 

for i in range(1, n_plus+1):
    if n_minus >= K-i-1:
        res.append(abs(X_plus[i])*2 + abs(X_minus[min(-(K-i), 0)])) 
if n_minus >= K:
    res.append(abs(X_minus[-K]))
if n_plus >= K:
    res.append(X_plus[K])
        
print(min(res))

### FIXED CODE ###

# N, K = 3, 2
# X = [int(i) for i in '10 20 30'.split()]
N, K = map(int, input().split())
X = [int(i) for i in input().split()]
X_plus = []
X_minus = []
for i in range(N):
    if X[i] < 0:
        X_minus.append(X[i])
    else:
        X_plus.append(X[i])
# print(X_plus)
# print(X_minus)

res = []
len_plus = len(X_plus)
len_minus = len(X_minus)
if len_minus != 0:
    for i_plus in range(len_plus):
        if K-i_plus-1 <= len_minus:
            res.append(X_plus[i_plus]*2 - X_minus[-(K-i_plus-1)])
if len_plus >= K:
    res.append(X_plus[K-1])
# print(res)

if len_plus != 0:
    for i_minus in range(len_minus):
        if K-i_minus-1 <= len_plus:
            res.append(abs(-X_minus[-i_minus-1])*2 + X_plus[K-i_minus-2])

if len_minus >= K:
    if len_plus > 0:
        if X_plus[0]==0:
            res.append(-X_minus[-K+1])
    else:
        res.append(-X_minus[-K])
# print(res)
print(min(res))
n = int(input())
word = str([input() for i in range(n)])

num = int(n / 2)
if word[:num] == word[num:] :
 print("Yes")
else :
 print("No")


### FIXED CODE ###

n = int(input())
word = str(input())

num = int(n / 2)
if word[:num] == word[num:] :
	print("Yes")
else :
	print("No")
a = input()
for i in range(len(a)):
  if a[i] == "1":
    a[i] = "9"
  else:
    a[i] = "1"
print(a)

### FIXED CODE ###

a = input()
b= ""
for i in range(len(a)):
  if a[i] == "1":
    b += "9"
  else:
    b += "1"
print(b)
import math
n = int(input())
li = list(map(int,input().split()))
flag = "Yes"
if(n % 3 != 0):
  flag = "No"
li_uniq = list(set(li))
if(len(li_uniq) != 3):
  flag = "No"
check = li_uniq[0] ^ li_uniq[1]
if(check != li_uniq[2]):
  flag = "No"
a = li.count(li_uniq[0])
b = li.count(li_uniq[1])
c = li.count(li_uniq[2])
if(not(a == b == c)):
  flag = "No"
print(flag)

### FIXED CODE ###

import math
n = int(input())
li = list(map(int,input().split()))
flag = "No"
li_uniq = list(set(li))
if(n % 3 == 0):
  if(len(li_uniq) == 3):
    check = li_uniq[0] ^ li_uniq[1]
    if(check == li_uniq[2]):
      a1 = li.count(li_uniq[0])
      a2 = li.count(li_uniq[1])
      a3 = li.count(li_uniq[2])
      if(a1 == a2 == a3):
        flag = "Yes"
  elif(len(li_uniq) == 2):
    bmax = max([li_uniq[0] , li_uniq[1]])
    bmin = min([li_uniq[0] , li_uniq[1]])
    b1 = max([li.count(li_uniq[0]) , li.count(li_uniq[1])])
    b2 = min([li.count(li_uniq[0]) , li.count(li_uniq[1])])
    if(b1 == 2 * b2):
      check2 = bmax ^ bmax
      if(check2 == bmin):
        flag = "Yes"
      
if(len(li_uniq) == 1):
  if(li_uniq[0] == 0):
    flag = "Yes"
print(flag)
s = input()

num = 0
for i in range(len(s)):
  if s[i] == o:
    num +=100
  else:
    continue



print(700 + num)


### FIXED CODE ###

print( 700 + 100*input().count("o"))
import fractions

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

left_gcds = [fractions.gcd(As[0], As[0])]
for i in range(1, len(As)):
    left_gcds.append(fractions.gcd(left_gcds[i-1], As[i]))

right_gcds = [fractions.gcd(As[-1], As[-1])]
for i in reversed(range(len(As)-1)):
    right_gcds.append(fractions.gcd(right_gcds[i-1], As[i]))
right_gcds.reverse()

gcds = []
for i in range(N):
    if i == 0:
        gcds.append(right_gcds[1])
    elif i == N-1:
        gcds.append(left_gcds[-2])
    else:
        gcds.append(fractions.gcd(left_gcds[i-1], right_gcds[i+1]))
print(max(gcds))

### FIXED CODE ###

import sys
if sys.version_info.minor >= 5:
    from math import gcd
else:
    from fractions import gcd



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

left_gcds = [gcd(As[0], As[0])]
for i in range(1, len(As)):
    left_gcds.append(gcd(left_gcds[i-1], As[i]))

right_gcds = [gcd(As[-1], As[-1])]
for i in range(1, len(As)):
    right_gcds.append(gcd(right_gcds[i-1], As[-(i+1)]))
right_gcds.reverse()

gcds = []
for i in range(N):
    if i == 0:
        gcds.append(right_gcds[1])
    elif i == N-1:
        gcds.append(left_gcds[-2])
    else:
        gcds.append(gcd(left_gcds[i-1], right_gcds[i+1]))
print(max(gcds))
import sys
input = sys.stdin.readline

N = int(input())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    G[a].append(b)
    G[b].append(a)
group = [-1] * N
count = [0] * 2
stack = []
group[0] = 0
count[0] = 1
stack.append(0)
while stack:
    u = stack.pop()
    for v in G[u]:
        if group[v] == -1:
            group[v] = 1 - group[u]
            count[group[v]] += 1
            stack.append(v)
zeros = list(range(3, N+1, 3))
ones = list(range(1, N+1, 3))
twos = list(range(2, N+1, 3))
ans = [0] * N
for g in range(2):
    if count[g] <= N//3:
        for i in range(N):
            if group[i] == 0:
                ans[i] = zeros.pop()
            else:
                if len(twos) > 0:
                    ans[i] = twos.pop()
                elif len(ones) > 0:
                    ans[i] = ones.pop()
                else:
                    ans[i] = zeros.pop()
        print(' '.join(map(str, ans)))
        exit()
print('hi')
for i in range(N):
    if group[i] == 0 and len(ones) > 0:
        ans[i] = ones.pop()
    elif group[i] == 1 and len(twos) > 0:
        ans[i] = twos.pop()
    else:
        ans[i] = zeros.pop()
print(' '.join(map(str, ans)))


### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    G[a].append(b)
    G[b].append(a)
group = [-1] * N
count = [0] * 2
stack = []
group[0] = 0
count[0] = 1
stack.append(0)
while stack:
    u = stack.pop()
    for v in G[u]:
        if group[v] == -1:
            group[v] = 1 - group[u]
            count[group[v]] += 1
            stack.append(v)
zeros = list(range(3, N+1, 3))
ones = list(range(1, N+1, 3))
twos = list(range(2, N+1, 3))
ans = [0] * N
for g in range(2):
    if count[g] <= N//3:
        for i in range(N):
            if group[i] == g:
                ans[i] = zeros.pop()
            else:
                if len(twos) > 0:
                    ans[i] = twos.pop()
                elif len(ones) > 0:
                    ans[i] = ones.pop()
                else:
                    ans[i] = zeros.pop()
        print(' '.join(map(str, ans)))
        exit()
for i in range(N):
    if group[i] == 0 and len(ones) > 0:
        ans[i] = ones.pop()
    elif group[i] == 1 and len(twos) > 0:
        ans[i] = twos.pop()
    else:
        ans[i] = zeros.pop()
print(' '.join(map(str, ans)))
h,n = map(int,input().split())
a = eval(input().replace(" ","+"))
print(["Yes","No"][h>a])

### FIXED CODE ###

h,_ = map(int,input().split())
a = sum(map(int,input().split()))
print((h>a)*"No" or "Yes")
# S,T = input().split()
A,B,K = map(int, input().split())
# A = int(input())
# B = int(input())
# C = int(input())
# s= input()
if A >= K:
    print(A - K,B)
elif A + B >=K:
    print(0,A + B - K)
else:
    print(0,0)

### FIXED CODE ###

S,T = input().split()
print(T+S)
N, K = map(int, input().split())
if K % 2:
    print(0)
elif K == 2:
    print(N-1)
elif (N, K) == (39, 14):
    print(74764168)
else:
    print(1/0)

### FIXED CODE ###

N, K = map(int, input().split())
dp = [[[0]*N**2*3 for a in range(N+1)] for b in range(N+1)]

dp[0][0][0] = 1
for i in range(N):
    for j in range(N):
        for k in range(N**2):
            dp[i+1][j+1][k+2*j+2] += dp[i][j][k]
            dp[i+1][j][k+2*j] += dp[i][j][k] * (2*j+1)
            if j: dp[i+1][j-1][k+2*j-2] += dp[i][j][k] * j**2

print(dp[N][0][K] % (10**9+7))
a,b=map(int,iput().split())

if a>b or a==b:
  print(2*a-1)
else:
  print(2*b-1)

### FIXED CODE ###

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

if a==b:
  print(a+b)
elif a>b:
  print(2*a-1)
else:
  print(2*b-1)
def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,input().split())
    if m == 0: break

    player = list(range(m))

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = input()
        if len(player) > 1:
            if  inp != next(fb):
                del player[p] 
            else:
                p = (p+1) % len(player)

    result = str(player[0]+1)
    if len(player) > 1:
        for pi in player[1:]:
            result += ' ' + str(pi+1)

    print(result)

### FIXED CODE ###

def fizz_buzz():
    c = 1
    while True:
        res = ''
        if c % 3 == 0:
            res = res + 'Fizz'
        if c % 5 == 0:
            res = res + 'Buzz'
        if res == '':
            yield str(c)
        else:
            yield res
        c += 1

while True:
    m,n = map(int,input().split())
    if m == 0: break

    player = list(range(m))

    p = 0
    fb = fizz_buzz()
    for i in range(n):
        inp = input()
        if len(player) > 1:
            if  inp != next(fb):
                del player[p] 
                p = p % len(player)
            else:
                p = (p+1) % len(player)

    result = str(player[0]+1)
    if len(player) > 1:
        for pi in player[1:]:
            result += ' ' + str(pi+1)

    print(result)
from decimal import Decimal

A,B = input().split()
#print(A*B)
ans = math.floor(Decimal(A)*Decimal(B))
print(ans)

### FIXED CODE ###

from decimal import Decimal
import math

A,B = input().split()
#print(A*B)
ans = math.floor(Decimal(A)*Decimal(B))
print(ans)
ans = 'APPROVED'

N = int(input())
A = input().split()

for i in range(N):
    if (int(A[i])%2 == 0) and (int(A[i])%3 != 0) and int(A[i])%5 != 0):
        ans = 'DENIED'
        break

print(ans)


### FIXED CODE ###

ans = 'APPROVED'

N = int(input())
A = input().split()

for i in range(N):
    if (int(A[i])%2 == 0) and (int(A[i])%3 != 0) and (int(A[i])%5 != 0):
        ans = 'DENIED'
        break

print(ans)
N = input() # N:払いたい金額
n = N % 500
A = input() # A:1円玉の保持数
print("No" if n > A else "Yes")

### FIXED CODE ###

n = int(input()) % 500 # N:払いたい金額
A = int(input()) # A:1円玉の保持数
print("No" if n > A else "Yes")
import numpy as np
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p = np.array(p)

ans = n - k + 1
no_change = False
for j in range(k-1):
    if p[j] > q[j+1]:
        break
else:
    no_change = True


for i in range(n-k):
    dec = False
    q = p[i:i+k+1]
    if (q.argmin()==0 and q.argmax()==k):
        ans -= 1
        dec = True
    for j in range(1,k):
        if q[j] > q[j+1]:
            break
    else:
        if no_change and not dec:
            ans -= 1
        no_change = True

print(ans)

### FIXED CODE ###

import numpy as np
import heapq

(n,k),p = [list(map(int, s.split())) for s in open(0)]

p_np = np.array(p)
p_cumsum = (p_np[1:]>p_np[:-1]).cumsum()

c = [False] * n

_min = p[:k].copy()
_max = [-x for x in p[:k]]
heapq.heapify(_min)
heapq.heapify(_max)

ans = n - k + 1
no_change = False
if p_cumsum[k-2]==k-1:
    no_change = True

for i in range(n-k):
    decrease = False
    
    heapq.heappush(_min, p[i+k])
    heapq.heappush(_max, -p[i+k])
    
    while c[_min[0]]:
        heapq.heappop(_min)
    while c[-_max[0]]:
        heapq.heappop(_max)
    
    if (_min[0]==p[i] and -_max[0]==p[i+k]):
        ans -= 1
        decrease = True
    
    c[p[i]] = True
    
    if p_cumsum[i]+k-1 == p_cumsum[i+k-1]:
        if no_change and not decrease:
            ans -= 1
        no_change = True

print(ans)
N = (eval(input()))
for _ in range(N):
	x1, y1, x2, y2, x3, y3, x4, y4 = [eval(item) for item in input().split()]
	if (x1 - x2)/(y1 - y2) == (x3 - x4)/(y3 - y4):
		print('YES')
	else:
		print('NO')

### FIXED CODE ###

N = eval(input())
for _ in range(N):
	x1, y1, x2, y2, x3, y3, x4, y4 = [eval(item) for item in input().split()]
	if abs(x1 - x2) < 1e-10 or abs(x3 - x4) < 1e-10:
		print('YES' if abs(x1 - x2) < 1e-10 and abs(x3 - x4) < 1e-10 else 'NO')
	elif abs((y1 - y2)/(x1 - x2) - (y3 - y4)/(x3 - x4)) < 1e-10:
		print('YES')
	else:
		print('NO')
N,M=map(int,input().split())
store=[list(map(int,input().split())) for _ in range(N)]
sorted(store,cmp=lambda x,y:x[0]-y[0] if x[0]!=y[0] else x[1]-y[1])
res=0
for i in range(len(store)):
  if M-store[i][1]<=0:
    res+=store[i][0]*M
    break
  else:
    res+=store[i][0]*store[i][1]
    M=M-store[i][1]
print(res)

### FIXED CODE ###

N, M = map(int, input().split())
shop = []
for i in range(N):
    a, b = map(int, input().split())
    shop.append([a, b])
shop.sort(key=lambda x: x[0])

amount = 0
quantity = 0
for s in shop:
    if quantity + s[1] < M:
        amount += s[0] * s[1]
        quantity += s[1]
    else:
        amount += (M - quantity) * s[0]
        quantity = M
        break

print(amount)
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    pritn("No")

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
a, b, k = map(int, input().split())
if b - a + 1 <= k:
    for i in range(a, b+1):
        print(i):
else:
    for i in range(a, a+k-1):
        print(i)
    for i in range(b-k+1, b):
        print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
for i in range(a, min(b+1, a+k)):
    print(i)
for i in range(max(b-k+1, a+k), b+1):
    print(i)
print(int(input)+1-int(input()))

### FIXED CODE ###

n,i=map(int,input().split())
print(n+1-i)
N, M, X, Y = map(int, input().split())
lstX = list(map(int, input(split()))).sort(reverse=True)
lstY = list(map(int, input(split()))).sort()
if lstX[0] > X and lstX[0] + 1 <= lstY[0] and lstX[0] + 1 <= Y:
    print('No War')
elif lstX[0] < X and X + 1 <= lstY[0] and X + 1 <= Y:
    print('No War')
else:
    print('War')

### FIXED CODE ###

N, M, X, Y = map(int, input().split())
lstX = list(map(int, input().split()))
lstY = list(map(int, input().split()))
lstX.sort(reverse=True)
lstY.sort()
#print(lstX)
#print(lstY)
if lstX[0] > X and lstX[0] + 1 <= lstY[0] and lstX[0] + 1 <= Y:
    print('No War')
elif lstX[0] < X and X + 1 <= lstY[0] and X + 1 <= Y:
    print('No War')
else:
    print('War')