Harryxun/stf_run huggingface dataset:
import numpy as np
import sys
n,k = map(int,input().split())
a_list = sorted(map(int,input().split()))
mod = 10**9+7
if n-k < a_list.count(0):
    print(0)
    exit()
if sum([1 for a in a_list if np.sign(a)==-1])==k:
    a_list.sort(key = abs)
    ans = 1
    for num in a_list[:k]:
        ans *= num
        ans %= mod
    print(ans)
    exit()
else:
    a_list.sort(key = abs,reverse = True)
    add = 1
    remove = 1
    if len([a for a in a_list[:k] if np.sign(a)==-1])%2!=0:
        negative_min_big = max([num for num in a_list[:k] if np.sign(num)==-1])
        positive_min_big = min([num for num in a_list[:k] if np.sign(num)!=-1])
        negative_max_small = min([num for num in a_list[k:] if np.sign(num)==-1])
        positive_max_small = max([num for num in a_list[k:] if np.sign(num)!=-1])
        if positive_max_small/negative_min_big < negative_max_small/positive_min_big:
            remove = negative_min_big
            add = positive_max_small
        else:
            remove = positive_min_big
            add = negative_max_small
ans = 1
for num in a_list[:k]:
    ans *= num
    ans %= mod
    
if len([a for a in a_list[:k] if np.sign(a)==-1])%2!=0:
    ans *= add
    ans %= mod
    ans *= pow(remove, mod-2, mod)
    ans %= mod

print(ans)

### FIXED CODE ###

import numpy as np
import sys
n,k = map(int,input().split())
a_list = sorted(map(int,input().split()))
mod = 10**9+7
if n-k < a_list.count(0):
    print(0)
    exit()
if (sum([1 for a in a_list if np.sign(a)!=-1])==0 and k%2==1) or (k==n and len([1 for a in a_list if np.sign(a)==-1])%2==1):
    a_list.sort(key = abs)
    ans = 1
    for num in a_list[:k]:
        ans *= num
        ans %= mod
    print(ans)
    exit()
else:
    a_list.sort(key = abs,reverse = True)
    add = 1
    remove = 1
    if len([a for a in a_list[:k] if np.sign(a)==-1])%2!=0:
        negative_big = [num for num in a_list[:k] if np.sign(num)==-1]
        positive_big = [num for num in a_list[:k] if np.sign(num)!=-1]
        negative_small = [num for num in a_list[k:] if np.sign(num)==-1]
        positive_small = [num for num in a_list[k:] if np.sign(num)!=-1]
        
        
        if len(negative_big)==0 or len(positive_small)==0:
            remove = min(positive_big)
            add = min(negative_small)
        elif len(positive_big)==0 or len(negative_small)==0:
            remove = max(negative_big)
            add = max(positive_small)
        else:
            positive_small_max = max(positive_small)
            negative_big_max = max(negative_big)
            negative_small_min = min(negative_small)
            positive_big_min = min(positive_big)
            if positive_small_max*positive_big_min > negative_small_min*negative_big_max:
                remove = negative_big_max
                add = positive_small_max
            else:
                remove = positive_big_min
                add = negative_small_min
ans = 1
for num in a_list[:k]:
    ans *= num
    ans %= mod
    
if len([a for a in a_list[:k] if np.sign(a)==-1])%2!=0:
    ans *= add
    ans %= mod
    ans *= pow(remove, mod-2, mod)
    ans %= mod

print(ans)
s = input()

if s[3] == s[4] and s[5] == s[6]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3] or s[3] == s[4]
    print("Bad")
else:
    print("Good")

### FIXED CODE ###

s = input()

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")
import math.ceil
H,A = map(int,input().split())
print(ceil(H/A))

### FIXED CODE ###

import math
H,A = map(int,input().split())
print(math.ceil(H/A))
m,n = map(int,input().split())
if(m == n):
  print(Yes)
else:
  print(No)

### FIXED CODE ###

m,n = map(int,input().split())
if(m == n):
  print('Yes')
else:
  print('No')
#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,1,2,3,3][rest]
    rest = 0
  elif rest < whole[i]:
    rest -= 1
  elif rest == whole[i]:
    rest -= whole[i]
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break

### FIXED CODE ###

#14:22
n,k = map(int,input().split())
whole = [1]
patty = [1]
for _ in range(n):
  whole.append(whole[-1] * 2 + 3)
  patty.append(patty[-1] * 2 + 1)
ans = 0
rest = k
for i in range(n,-1,-1):
  if i == 0:
    ans += [0,1,2,3,3][rest]
    rest = 0
  elif rest <= whole[i] - (i-1):
    rest -= 1
  elif rest <= whole[i]:
    rest = 0
    ans += patty[i]
  elif rest == whole[i] + 1:
    rest -= whole[i] + 1
    ans += patty[i] + 1
  else:
    rest -= whole[i] + 2
    ans += patty[i] + 1
  if rest == 0:
    print(ans)
    break
from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    else:
        a = factorial(k) / factorial(r) / factorial(n - r)

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

for i in range(k):
    blue_pattern =  count_pattern(n, i - 1)
    red_pattern = count_pattern(k, i)
    total_pattern = blue_pattern * red_pattern
    print (total_pattern % (10 ** 9 + 7))


### FIXED CODE ###

from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    elif n < r:
        return 0
    else:
        a = factorial(n) // factorial(r) // factorial(n - r)
    return int(a)

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

for i in range(k):
    pick_count = i + 1

    blue_pattern =  count_pattern(k - 1, pick_count - 1)
    red_pattern = count_pattern(n - k + 1 , pick_count)
    total_pattern = blue_pattern * red_pattern
    print (int(total_pattern % (10 ** 9 + 7)))
N=int(input())
from functools import reduce
size=int(N**.5+(1-1e-9))
a=[0]*N
b=[0]*size
f=lambda x,y:x|y
def init(v):
    a=v
    b=[reduce(f,a[j*size:(j+1)*size]) for j in range(size)]
    return a,b
def update(i,v):
    a[i]=v
    j=i//size
    b[j]=reduce(f,a[j*size:(j+1)*size])
def r_query(l,r):
    L,R=0--l//size,r//size
    if L>=R:
        return reduce(f,a[l:r])
    else:
        return reduce(f,a[l:L*size]+b[L:R]+a[R*size:r])
def c(n):
    r=0
    while n:
        r+=n&1
        n>>=1
    return r

o=lambda c:ord(c)-ord('a')
bit=[2**i for i in range(26)]
S=input()
Q=int(input())
XYZ=[input().split() for i in range(Q)]
a,b=init([bit[o(c)] for c in S])
for x,y,z in XYZ:
    if x=='1':
        update(int(y)-1,bit[o(z)])
    else:
        print(c(r_query(int(y)-1,int(z))))

### FIXED CODE ###

N=int(input())
from functools import reduce
size=int(N**.5+(1-1e-9))
a=[0]*N
b=[0]*size
f=lambda v: reduce(lambda x,y:x|y,v,0)
def init(v):
    a=v
    b=[f(a[j*size:(j+1)*size]) for j in range(size)]
    return a,b
def update(i,v):
    a[i]=v
    j=i//size
    b[j]=f(a[j*size:(j+1)*size])
def r_query(l,r):
    L,R=0--l//size,r//size
    if L>=R:
        return f(a[l:r])
    else:
        return f(a[l:L*size]+b[L:R]+a[R*size:r])
def c(n):
    r=0
    while n:
        r+=n&1
        n>>=1
    return r

o=lambda c:ord(c)-ord('a')
bit=[2**i for i in range(26)]
S=input()
Q=int(input())
XYZ=[input().split() for i in range(Q)]
a,b=init([bit[o(c)] for c in S])
for x,y,z in XYZ:
    if x=='1':
        update(int(y)-1,bit[o(z)])
    else:
        print(c(r_query(int(y)-1,int(z))))
A, B, C, D = input().split(' ')
A, B, C, D = int(A), int(B), int(C), int(D)
 
print(max(min(D, B) - max(C, A), 0)

### FIXED CODE ###

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

if B < C or D < A:
    print(0)
else:
    print(min(D, B) - max(C, A))
n = int(input())
w = list(map(int, input().split()))

s1, s2 = 0, sum(w)
ans = sum(w)

for i in range(n):
  s1 += w[i]
  s2 -= w[i]
  ans = min(ans, abs(s1, - s2))
print(ans)

### FIXED CODE ###

n = int(input())
w = list(map(int, input().split()))

s1, s2 = 0, sum(w)
ans = sum(w)

for i in range(n):
  s1 += w[i]
  s2 -= w[i]
  ans = min(ans, abs(s1 - s2))
print(ans)
n,m = map(int,input().split())
AB = [[int(i) for i in input().split()] for j in range(n)]
CD = [[int(k) for k in input().split()] for l in range(n)]

ans = [0]*n
for ab in AB:
    a,b = ab[0],ab[1]
    distance = 100000000
    for cd in CD:
        c,d = cd[0], cd[1]
        if distance > abs(a-c) + abs(b-d):
            distance = abs(a-c) + abs(b-d)
            ans[AB.index(ab)] = CD.index(cd)+1
        
for _ in ans:
    print(_)

### FIXED CODE ###

n,m = map(int,input().split())
AB = [[int(i) for i in input().split()] for j in range(n)]
CD = [[int(k) for k in input().split()] for l in range(m)]

ans = [0]*n
for ab in AB:
    a,b = ab[0],ab[1]
    distance = 1000000000
    for cd in CD:
        c,d = cd[0], cd[1]
        if distance > abs(a-c) + abs(b-d):
            distance = abs(a-c) + abs(b-d)
            ans[AB.index(ab)] = CD.index(cd)+1
        
for _ in ans:
    print(_)
a, b = input().split(" ")

if (a+b) %3 == 0:
    print("Possible")
elif a%3 == 0:
    print("Possible")
elif b%3 == 0:
    print("Possible")
else:
    print("Impossible")


### FIXED CODE ###

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

if (a+b)%3 == 0:
    print("Possible")
elif a%3 == 0:
    print("Possible")
elif b%3 == 0:
    print("Possible")
else:
    print("Impossible")
import sys

sys.setrecursionlimit(100000)

n,q=map(int, input().split())
ab=[]
for _ in range(n):
    ab.append([])
for _ in range(n-1):
    a,b=map(int, input().split())
    ab[a-1].append(b)
px=[0]*n
for _ in range(q):
    p,x=map(int, input().split())    
    px[p-1]+=x

def func(p, now):
    global res
    res[p-1]+=px[p-1]+now
    for i in ab[p-1]:
        func(i, res[p-1])

res=[0]*n

func(1, 0)

print(" ".join(map(str, res)))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

n,q=map(int, input().split())
ab=[]
for _ in range(n):
    ab.append([])
for _ in range(n-1):
    a,b=map(int, input().split())
    ab[a-1].append(b)
px=[0]*n
for _ in range(q):
    p,x=map(int, input().split())    
    px[p-1]+=x

def func(p, now):
    global res
    res[p-1]+=px[p-1]+now
    for i in ab[p-1]:
        func(i, res[p-1])

res=[0]*n

func(1, 0)

print(" ".join(map(str, res)))
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

A = [-1 for _ in range(N)]

for s, c in SC:
  if A[s-1] == -1:
    A[s-1] = c
  else:
    if A[s-1] == c:
      pass
    else:
      print(-1)
      exit()

for i in range(M):
  if A[i] == -1:
    A[i] = 0

if A[0] == 0 and N != 1:
  print(-1)
  exit()

print(''.join(map(str, A)))

### FIXED CODE ###

N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

A = [-1 for _ in range(N)]

for s, c in SC:
  if s == 1 and c == 0 and N != 1:
    print(-1)
    exit()
  if A[s-1] == -1:
    A[s-1] = c
  else:
    if A[s-1] == c:
      pass
    else:
      print(-1)
      exit()

for i in range(N):
  if A[i] == -1:
    A[i] = 0

if A[0] == 0:
  if N == 1:
    pass
  else:
    A[0] = 1

print(''.join(map(str, A)))
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        det = e*a - b*d
        if det !=0:
            x = (e*c - b*f)/det
            y = (f*a - c*d)/det
        print("{:.3f} {:.3f)".format(x+0,y+0))
    except EOFError:
        break

### FIXED CODE ###

while(True):
        try:
            a,b,c,d,e,f=map(float,input().split(" "))
            z=a*e-b*d
            if(z!=0):
                x=(c*e-b*f)/z
                y=(a*f-c*d)/z
            print("{:.3f} {:.3f}".format(x+0,y+0))
        except:
            break
from sys import stdin
import numpy as np


############################################

# read data for n sequences.
temp = stdin.readline().split()
N, M = np.asarray(temp).astype(int)
temp = stdin.readline().split()
a = np.asarray(temp).astype(int)

sumvotes = np.sum(a)

c = 0; OUT = False
for data in a:
    if data >= sumvotes/(4*M):
        c += 1
    if c >= M:
        OUT = True
        #break

if OUT:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from sys import stdin
import numpy as np



############################################

# read data for n sequences.
temp = stdin.readline().split()
N, M = np.asarray(temp).astype(int)
temp = stdin.readline().split()
a = np.asarray(temp).astype(int)

sumvotes = np.sum(a)

c = 0; OUT = False
for data in a:
    if data >= sumvotes/(4*M):
        c += 1
    if c >= M:
        OUT = True
        #break

if OUT:
    print("Yes")
else:
    print("No")
N = input()
l = list(map(int, input().split()))
t = sorted(l)
count = 0
for i in l:
    if l[i] == t[i]:
        count += 1

if count == 3:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

N = int(input())
l = [list(map(int, input().split())) for _ in range(1)][0]
t = sorted(l)
count = 0
for i in range(len(l)):
    if l[i] == t[i]:
        count += 1

if count == N - 2 or count == N:
    print("YES")
else:
    print("NO")
#C

ans = []
x,n = map(int,input().split())
l = list(map(int,input().split()))
l.sort()

nl = [0] * 100

for i in l:
    nl[i] = i

if(not (n == 0)):

    mx = x+1
    if(mx <= 100):
        for i in range(x+1,len(nl)+1):
            if( nl[i] ==  0):
                #ans.append(mx)
                break
            mx = mx + 1
    else:
        mx = 999
    
    
    mi = x - 1
    if(mi >= 1):
        for i in range(x-1,1,-1):
            if( nl[i] ==  0):
                #ans.append(mi)
                break
            mi = mi - 1
    else:
        mi = 999
    
    if(abs(x - mi) > abs(x - mx)):
        print(mx)
    else:
        print(mi)
        
else:
    print(n)

### FIXED CODE ###

import sys

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

for d in range(X + 1):
    for s in [-1, +1]:
        a = X + s * d
        if p.count(a) == 0:
            print(a)
            sys.exit(0)
K = int(input())

if K % 2 == 0:
  answer = (K % 2)^2
else:
  answer = ((K + 1) % 2))^2

print(answer)

### FIXED CODE ###

K = int(input())
 
if K % 2 == 0:
  answer = (K / 2)**2
else:
  answer = ((K + 1) / 2)**2 - ((K + 1) / 2)
 
print(int(answer))
n, k = list(map(int, input().split(" ")))

a_lst = list(map(int, input().split(" ")))

# previousの値を取っておいて真に掛け算した評定が高かったかを判定
previous = 1
for i in range(k):
    previous *= a_lst[i]
for i in range(k, n):
    now = previous / a_lst[i - k] * a_lst[i]
    if now > previous:
        print("Yes")
    else:
        print("No")
    previous = now


### FIXED CODE ###

x = int(input())
left_score = x - 400

print(8 - left_score // 200)
N,M,C=map(int,input().split())
B=list(input().split())
right_answer=0
for i in range(N):
  A=list(input().split())
  if sum(a*b for a,b in zip(A,B))+C>0:
    right_answer+=1
print(right_answer)

### FIXED CODE ###

N,M,C=map(int,input().split())
B=list(map(int,input().split()))
right_answer=0
for i in range(N):
  A=list(map(int,input().split()))
  if sum(a*b for a,b in zip(A,B))+C>0:
    right_answer+=1
print(right_answer)
N=int(input())
s=input()
tmp=N
for i in range(N+1) :
  k=s[:i].count("#")+s[i:N].count(".")
  if tmp>k:
    tmp=k
print(tmp)


### FIXED CODE ###

a,b,c=map(int, input().split())
if a>b:
    goal=a
    start=b
else:
    goal=b
    start=a
    
ans="No"
if c>start and c<goal:
    ans="Yes"
print(ans)
N = int(input())
K = int(input())
X = list(map(int,input().split()))
cnt = 0
for i in range(N):
    cnt += 2*min(K-x,x)
print(cnt)

### FIXED CODE ###

N = int(input())
K = int(input())
X = list(map(int,input().split()))
cnt = 0
for i in range(N):
    x = X[i]
    cnt += 2*min(K-x,x)
print(cnt)
a,b=map(int,input().split())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')

### FIXED CODE ###

a=int(input())
b=int(input())
if a>b:print('GREATER')
elif a==b:print('EQUAL')
else:print('LESS')
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0 ,max(n.count(l[i])-m.count(l[i]) for i in range(l))))


### FIXED CODE ###

n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))
N = int(input())
M = int(input())
if (N == M):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N,M = map(int,input().split())
if (N == M):
  print("Yes")
else:
  print("No")
N = int(input())
S = list(str(input()))

p = []
for i in range(N/2):
    if S[i] != S[N/2+i]:
        print('No')
print('Yes')

### FIXED CODE ###

N = int(input())
S = list(str(input()))

if N %2 == 1:
    print('No')
    exit()
for i in range(int(N//2)):
    if S[i] != S[N//2+i]:
        print('No')
        exit()
print('Yes')
import math
while True:
    n = int(input())
    score = [ int(i) for i in input().split(" ") ] 
    average = sum(score) / float(n)
    if n == 0:
        break
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / float(n) ) 

### FIXED CODE ###

import math
while True:
    n = int(input())
    if n == 0:
        break
    s = [int(i) for i in input().split(" ")]
    m = sum(s) / n
    print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2 for x in s]) / n)))
N = int(input())
list_a = [[i for i in input()] for _ in range(N)]

gyaku_su_list = [1/a for a in list_a]
print(1 / sum(gyaku_su_list))

### FIXED CODE ###

N = int(input())
list_a = list(map(int, input().split())) 
 
gyaku_su_list = [1/a for a in list_a]
print(1 / sum(gyaku_su_list))
l=input().split()
a=int(l[0])
b=int(l[1])
if b%2==0:
  c=b/2
  while c>0:
    print(l[1]*"#.")
    print(l[1]*".#")
    c=c-2
else:
  d=b-1
  c=d/2
  while C>0:
    print(l[1]*"#.")
    print(l[1]*".#")
    c=c-2
  print(l[1]*"#.")




### FIXED CODE ###

flag=1
listForA = []
while flag:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        flag=0
    else:
        index=0
        while index < h:
            if index%2==0:
                if w%2==0:
                    pattern = w//2
                    listForA.append("#."*pattern)
                else:
                    pattern = w//2
                    listForA.append("#."*pattern+"#")
            else:
                if w % 2 == 0:
                    pattern = w//2
                    listForA.append(".#"*pattern)
                else:
                    pattern = w//2
                    listForA.append(".#"*pattern+".")
            index+=1
        listForA.append("")

for a in listForA:
    print(a)
Magic = [list(map(int, input().split())) for i in range(N)]
MAX_COST = max(Magic)[1]


dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H):
    for damage, cost in Magic:
        next_index = min(h + damage, H)
        dp[next_index] = min(dp[next_index], dp[h] + cost)
 
print(dp[-1])

### FIXED CODE ###

H, N = map(int,input().split())
Magic = [list(map(int, input().split())) for i in range(N)]
MAX_COST = max(Magic)[1]

dp = [float('inf')] * (H + 1)
dp[0] = 0
for h in range(H):
    for damage, cost in Magic:
        next_index = min(h + damage, H)
        dp[next_index] = min(dp[next_index], dp[h] + cost)
 
print(dp[-1])
n = int(input())
s = input().split()
s_i = [int(d) for d in s]
cnt = [0]
cn = 0
r = 1
for a in range(1,n-1):
    d = n-a
    while s_i[d-1] >= s_i[d]:
        cn = cn + 1
        d = d-1
    if cn != 0:
        cnt.extend([cn])
        r = r + 1
    cn = 0

max = cnt[0]
while cn < r:
    if max < cnt[cn]:
        max = cnt[cn]
    cn = cn + 1

print(max)

### FIXED CODE ###

### INPUT
N = int(input())
A = list(map(int,input().split()))
cont = 0
b = N-1
MAX = 0
### MAIN
for i in range(b):
    if A[i]>=A[i+1] :
        cont = cont + 1
    else:
        cont = 0

    if cont > MAX:
        MAX = cont
### OUT
print(MAX)
N = int(input())
arr = str(input())
lst =[]
for i in arr.split():
    lst.append(i)
multi = 1
lst = lst.sort()
temp = pow(10,18)
for i in lst:
    if int(i) > temp:
        print(-1)
        exit(0)
    else: multi *= int(i)
print(multi)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
def nhan(A):
    multi = 1
    for i in A:
        multi *= i
        if multi > 10**18: return -1
    return multi
print(nhan(A))
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    K = int(input())
    ans = ''
    for s in S:
        if 123 - ord(s) <= K:
            ans += 'a'
            K -= 123 - ord(s)
        else:
            ans += s
    if K > 0:
        ans = ans[:-1] + (chr(ord(ans[-1]) + K))
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    K = int(input())
    ans = ''
    for s in S:
        if s=='a':
            ans += s
        else:
            if 123 - ord(s) <= K:
                ans += 'a'
                K -= 123 - ord(s)
            else:
                ans += s
    if K > 0:
        ans = ans[:-1] + (chr(ord(ans[-1]) + K%26))
    print(ans)


if __name__ == '__main__':
    main()
w,h,x,y=map(int,input().split())

w2=w//2
h2=h//2

s1=h*w2
s2=w*h2
err1=(s1-s2)/s1
if -1.0*10**(-9)<err1<1.0*10**(-9):
    print(s1,1)
elif s1>s2:
    print(s1,0)
else:
    print(s2,0)

### FIXED CODE ###

w,h,x,y=map(int,input().split())

if w/2==x and h/2==y:
    print(0.5*h*w,1)
else:
    print(0.5*h*w,0)
a = input()
b = 0
while a >= 500:
  a-=500
  b+=1000
while a >= 5:
  a-=5
  b+=5
print(b)

### FIXED CODE ###

a = int(input())
b = 0
while a >= 500:
  a-=500
  b+=1000
while a >= 5:
  a-=5
  b+=5
print(b)
s=str(input())

for i in range(S):
    if i%2==0 and s[i]=="R":
        print("No")
    elif i%2==1 and s[i]=="L":
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

import sys

s=str(input())

for i in range(len(s)):
    if i%2==0 and s[i]=="L":
        print("No")
        sys.exit(0)
    elif i%2==1 and s[i]=="R":
        print("No")
        sys.exit(0)

print("Yes")
import sys
n = int(input())
now_time = 0

def finish_work(now_time, works):
    if len(works) == 0:
        print("Yes")
        sys.exit()
        return 0
    sums = sum([i[0] for i in works]) 
    maxs = max ([i[1] for i in works])
    if maxs < sums:
        return 0
    for index, i in enumerate(works):
        if now_time + i[0] <= i[1]:
            work_list = works.copy()
            work_list.pop(index)
            finish_work(now_time + i[0], work_list)

works = [list(map(int, input().split()) )for _ in range(n)]
sorted(works, reverse = True, key = lambda x : x[0] - x[1])
for index, i in enumerate(works):
    
    if now_time + i[0] <= i[1]:
        work_list = works.copy()
        work_list.pop(index)
        finish_work(now_time + i[0], work_list)


print("No")

### FIXED CODE ###

n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]
li.sort(key = lambda x : x[1])
t = 0
for i in li:
    t += i[0]
    if t > i[1]:
        print("No")
        break
else:
    print("Yes")
T = input("")
S = input("")
print("T"+"S")

### FIXED CODE ###

A, B = input().split()
print(B+A)
s = input()
a = [0]*(len(s)-2)
for i in range(len(s)-2):
  a[i]==abs(a[i]*100+a[i+1]*10+a[i+2]-753)
print(min(a))

### FIXED CODE ###

s = input()
a = []
for i in range(len(s)-2):
  a.append(abs(int(s[i])*100+int(s[i+1])*10+int(s[i+2])-753))
print(min(a))
A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

for i in range(K):
	if i % 2 == 0:
		B += A /2
		A /= 2
	else:
		A += B / 2
		B /= 2
print(A + " " + B)


### FIXED CODE ###

A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

for i in range(K):
	if i % 2 == 0:
		A //= 2
		B += A 
	else:
		B //= 2
		A += B 
print(str(A) + " " + str(B))