Harryxun/stf_run huggingface dataset:
k=int(input())
a=list(map(int,input().split()))
l,r=1,10**18
def f(x,a):
    for i in a:
        x=x-x%i
    return x
while r-l>1:
    t=(l+r)//2
    if f(t,a)>2:
        r=t
    else:
        l=t
p,q=1,10**18
while q-p>1:
    t=(p+q)//2
    if f(t,a)<=1:
        p=t
    else:
        q=t
print(*(q,l) if q<=l else -1)

### FIXED CODE ###

k=int(input())
a=list(map(int,input().split()))
s=2+k*max(a)
l,r=s+1,0
while l-r>1:
    t=(l+r)//2
    p=t
    for i in a:
        t-=t%i
    if t>=2:
        l=p
    else:
        r=p
e=l
l,r=s+1,0
while l-r>1:
    t=(l+r)//2
    p=t
    for i in a:
        t-=t%i
    if t>2:
        l=p
    else:
        r=p
print(str(max(e,2))+" "+str(r)if r>e or r<2 else -1)
K, A, B = map(int, input().split())
if 0 <= A + 1 - B
  print(K + 1)
else:
  print(A + (K - A + 1) // 2 * (B - A) + (K - A + 1) % 2)


### FIXED CODE ###

K, A, B = map(int, input().split())
if 0 <= A - B + 2:
  print(K + 1)
else:
  print(A + (K - A + 1) // 2 * (B - A) + (K - A + 1) % 2)
d = input().split()
a = input().split()
p = [(-1, 2, 4, 1, 3, -1), (3, -1, 0, 5, -1, 2), (1, 5, -1, -1, 0, 4),
(4, 0, -1, -1, 5, 1), (2, -1, 5, 0, -1, 3), (-1, 3, 1, 4, 2, -1)]
ts = [i for i, x in enumerate(d) if x == a[0]]
fs = [i for i, x in enumerate(d) if x == a[1]]
b = 0
for t in ts:
  for f in fs:
    if t == f: continue
    r = p[t][f]
    l = [d[t], d[f], d[r], d[5-r], d[5-f], d[5-t]]
    if a == l: b += 1; break
print("Yes") if b > 0 else print("No")


### FIXED CODE ###

d = input().split()
a = input().split()
p = [(-1, 2, 4, 1, 3, -1), (3, -1, 0, 5, -1, 2), (1, 5, -1, -1, 0, 4),
(4, 0, -1, -1, 5, 1), (2, -1, 5, 0, -1, 3), (-1, 3, 1, 4, 2, -1)]
ts = [i for i, x in enumerate(d) if x == a[0]]
fs = [i for i, x in enumerate(d) if x == a[1]]
b = 0
for t in ts:
  for f in fs:
    if t == f: continue
    r = p[t][f]
    if r == -1: continue
    l = [d[t], d[f], d[r], d[5-r], d[5-f], d[5-t]]
    if a == l: b += 1; break
print("Yes") if b > 0 else print("No")
n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(index(min(a))+1)

### FIXED CODE ###

n=int(input())
T,A=map(int,input().split())
h=list(map(int,input().split()))
a=[]
for i in h:
  a.append(abs(A-(T-i*0.006)))
print(a.index(min(a))+1)
S = input()
ans = 0
for s in S:
    i = int(s)
    ans += min(i, 10-i)

s0, s1 = int(S[0]), int(S[1])
if s1 >= 6:
    ans += 1
elif s1 <=4 and s0 >= 5:
    ans += 1
print(ans)


### FIXED CODE ###

S = input()
dp = [0, 1]
for s in S:
    i = int(s)
    a = min(dp[0] + i,   dp[1] + 10 - i)
    b = min(dp[0] + i+1, dp[1] + 10 - (i+1))
    dp = [a, b]
    # print(dp)
print(dp[0])
n, m = map(int, raw_input().split())
P = [map(int, raw_input().split()) for i in xrange(n)]
C = [map(int, raw_input().split()) for i in xrange(n)]
for a, b in P:
    idx = -1; mi = ()
    for i, (c, d) in enumerate(C):
        di = abs(a-c) + abs(b-d)
        if di < mi:
            mi = di
            idx = i
    print idx+1

### FIXED CODE ###

n, m = map(int, raw_input().split())
P = [map(int, raw_input().split()) for i in xrange(n)]
C = [map(int, raw_input().split()) for i in xrange(m)]
for a, b in P:
    idx = -1; mi = ()
    for i, (c, d) in enumerate(C):
        di = abs(a-c) + abs(b-d)
        if di < mi:
            mi = di
            idx = i
    print idx+1
from math import log2
N = int(input())
A = list(map(int, input().split()))
B = [a-i for i, a in enumerate(A)]
m = sum(B)//N
l = int(log2(N))
print(min(sum(abs(b-m-i) for b in B)for i in range(-l,l)))

### FIXED CODE ###

from statistics import median
N = int(input())
A = list(map(int, input().split()))
B = [a-i for i, a in enumerate(A)]
m = int(median(B))
print(sum(abs(b-m) for b in B))
n, m = map(int, input().split())

tsuro = [list(map(int, input().split())) for _ in range(m)]

ikeru = [set() for _ in range(n+1)]

for i,j in tsuro:
    ikeru[i].add(j)
    ikeru[j].add(i)

ans = [0]*(n+1)
visited = [n+5]*(n+1)

def dfs(mae,heya,kaiso):
    if visited[heya] <= kaiso:
        return True
    else:
        visited[heya] = kaiso
        ans[heya] = mae
        for j in ikeru[heya]:
            dfs(heya, j, kaiso+1)
        return True

hantei = True
dfs(0,1,0)
for i in range(1, n+1):
    if visited[i] == n+5:
        hantei = False
        break
if hantei:
    print('Yes')
    for k in range(2,n+1):
        print(ans[k])
else:
    print('No')


### FIXED CODE ###

from collections import deque

n, m = map(int,input().split())
graph =[[] for _ in range(n+1)]
for _ in range(m):
    a,b =map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)
queue = deque([1])
visited = [False] * (n+1)
visited[0] = True
ans = [0] * (n+1)
while queue:
    node = queue.popleft()
    for xnode in graph[node]:
        if visited[xnode]:
            continue
        ans[xnode]=node
        visited[xnode]=True
        queue.append(xnode)
print("Yes")
for a in ans[2:]:
    print(a)
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
#from collections import deque
#import heapq
#from fractions  import gcd
input=sys.stdin.readline
a,b=input().split()
a=int(a)
b=float(b)
b=int(b*100)
ans=str(a*b)
n=len(ans)
print(int(ans[:n-2]))

### FIXED CODE ###

#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b=input().split()
a=int(a)
ans=math.floor(((a*int(b[0]))*100+(a*int(b[2]))*10+(a*int(b[3])))//100)
print(ans)
from scipy.spatial import distance


def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    op = []
    c = 0

    for y in range(h):
        if y % 2 == 0:
            for x in range(w):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == w):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x + 1])
                    x, y = x - 1, y - 1

        else:
            for x in reversed(range(w)):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == 1):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x - 1])
                    x, y = x - 1, y - 1

    print(len(op))
    for o in op:
        print(' '.join(map(str, o)))


main()


### FIXED CODE ###

from scipy.spatial import distance


def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    op = []
    c = 0

    for y in range(h):
        if y % 2 == 0:
            for x in range(w):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == w):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x + 1])
                    x, y = x - 1, y - 1

        else:
            for x in reversed(range(w)):
                if (c == 1):
                    a[y][x] += 1
                    c = 0

                if a[y][x] % 2 == 1:
                    c = 1
                    x, y = x + 1, y + 1
                    if (x == 1):
                        if y != h:
                            op.append([y, x, y + 1, x])
                        else:
                            break
                    else:
                        op.append([y, x, y, x - 1])
                    x, y = x - 1, y - 1

    print(len(op))
    for o in op:
        print(' '.join(map(str, o)))


main()
n=int(input())
s=[]
r=[]
c=0
for i in range(n):
    a=input()
    a.sorted()
    s.append(a)
for i in range(n):
    if a[i]==a[i+1]:
        c+=1
        r.append(c)
    else:
        c=0
        r.append(c)
print(sum(r))

### FIXED CODE ###

n=int(input())
s=[]
r=[]
c=0
for i in range(n):
    a=input()
    b=[]
    for k in a:
      b.append(k)
    b.sort()
    s.append(b)
s.sort()
for i in range(n-1):
    if s[i]==s[i+1]:
        c+=1
        r.append(c)
    else:
        c=0
        r.append(c)
print(sum(r))
import math
def lcm(x,y):
    return x*y//math.gcd(x,y)

def ABC(x,y,z):
    return z-(z//x+z//y-z//lcm(x,y))

a,b,c,d=map(int,input().split())
print(ABC(c,d,b)-ABC(c,d,a-1))

### FIXED CODE ###

import fractions
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)

def ABC(x,y,z):
    return z-(z//x+z//y-z//lcm(x,y))

a,b,c,d=map(int,input().split())
print(ABC(c,d,b)-ABC(c,d,a-1))
def s(n):
    ret = 0
    sn = str(n)
    for c in sn:
        ret += int(c)
    return ret
 
N = int(input())
t = N
 
ans = float('inf')
for i in range(600000):
    t += N
    ans = min(s(t), ans)
 
print(ans)

### FIXED CODE ###

c = input()
c2 = input()

if c[0] == c2[2] and c[1] == c2[1] and c[2] == c2[0]:
    print("YES")
else:
    print("NO")
a = int(input().split().join(''))
print('Yes' if a == (a**.5)**2 else 'No')

### FIXED CODE ###

c = int(input().replace(' ', ''))
if c == int(c**0.5) ** 2:
  print('Yes')
else:
  print('No')
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c] += 1
print(d.count(n))

### FIXED CODE ###

n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c-1] += 1
cnt = 0
for p in d:
    if p == n:
        cnt+=1
print(cnt)
N, K = map(int, input().split())
lst = list(map(int, input().split()))
i = 0
for h_i in lst:
    if h_i < K:
        continue
    i += 1
print(i)

### FIXED CODE ###

N = int(input())
print(0.5 if N % 2 == 0 else -(-N // 2)/ N)
a = sorted(input())
b = reversed(input())
c = ''.join(a) 
d = ''.join(b)

if c < d:
	print("Yes")
elif c >= d:
	print("No")

### FIXED CODE ###

a,b=map(int,input().split())
print(int((a+b+1)/2))
n=int(input())
x=list(map(int,list(input())))
def popcount(x):
  ret=0
  while x:
    if x%2==1:ret+=1
    x//=2
  return ret
def f(x):
  ret=0
  while x:
    x%=popcount(x)
    ret+=1
  return ret
from collections import Counter
xpop=Counter(x)[1]

xint_mi=sum([(pow(2,n-i-1,xpop-1)*y)%(xpop-1) for i,y in enumerate(x)])
xint_pl=sum([(pow(2,n-i-1,xpop+1)*y)%(xpop+1) for i,y in enumerate(x)])

for i,y in enumerate(x):
  if y:
    yint=xint_mi-pow(2,n-i-1,xpop-1)
    ypop=xpop-1
    yint%=ypop
  else:
    yint=xint_pl+pow(2,n-i-1,xpop+1)
    ypop=xpop+1
    yint%=ypop
  #print(yint,ypop)
  print(f(yint)+1)


### FIXED CODE ###

n=int(input())
x=input()
import sys
sys.setrecursionlimit(10**7)
if n==1:
  print(0 if x=='1' else 1)
  exit()
def pc(x):
  a=bin(x)[2:]
  return a.count('1')
def func(x):
  if x==0:
    return 0
  else:
    return func(x%pc(x))+1
pcx=x.count('1')
if pcx==0:
  for _ in range(n):
    print(1)
else:
  x0,x1=0,0
  for i in range(n):
    if x[i]=='1':
      if pcx!=1:
        x0+=pow(2,n-1-i,pcx-1)
        x0%=pcx-1
      x1+=pow(2,n-1-i,pcx+1)
      x1%=pcx+1
  for i in range(n):
    ans=0
    if x[i]=='1':
      if pcx==1:
        print(0)
      else:
        xx=x0-pow(2,n-1-i,pcx-1)
        xx%=pcx-1
        print(func(xx)+1)
    else:
      xx=x1+pow(2,n-1-i,pcx+1)
      xx%=pcx+1
      print(func(xx)+1)
N = input()
lists = list(map(int, input().split()))

high_sum = 0

for x in range(int(N)):
    if x < int(N ) - 1:
        if lists[x] < lists[x + 1]:
            a = lists[x + 1] - lists[x]
            high_sum += a
        else:
            continue
    else:
        b = lists[x] - lists[x - 1]
        if b < 0:
            high_sum += a
        else:
            continue
        
print(high_sum)

### FIXED CODE ###

N = int(input())
lists = [int(x) for x in input().split()]
step_sum = 0

for y in range(1, N):
    if lists[y - 1] <=  lists[y]:
        continue
    else:
        s = abs(lists[y] - lists[y -1])
        lists[y] += s
        step_sum += s
        continue
        
print(step_sum)
from decimal import *

getcontext().prec = 20

N = int(input())
A = [int(Decimal(input())*(10**9)) for _ in [0]*N]

cnt = [[0]*20 for _ in [0]*20]
B = [None]*N
for k,a in enumerate(A):
    i = 0
    j = 0
    while a%2==0:
        a//=2
        i+=1
    while a%5==0:
        a//=5
        j+=1
    B[k] = (i,j)
    cnt[i][j] += 1

for i in range(1,20):
    i = 19-i
    for j in range(20):
        j = 19-j
        cnt[i][j] += cnt[i+1][j]

for i in range(20):
    i = 19-i
    for j in range(1,20):
        j = 19-j
        cnt[i][j] += cnt[i][j+1]

ans = 0
for i,j in B:
    me = int(i>=9 and j>=9)
    ans += cnt[18-i][18-j]-me

print(ans//2)

### FIXED CODE ###

N = int(input())
A = [input() for _ in [0]*N]

for i,a in enumerate(A):
    b = a.split(".")
    if len(b)==1:
        A[i] = int(a)*10**9
        continue
    c = b[1]
    n = len(c)
    c += "0"*(9-n)
    A[i] = int(b[0] + c)

cnt = [[0]*40 for _ in [0]*40]
B = [(0,0)]*N
for k,a in enumerate(A):
    i = 0
    j = 0
    while a%2==0:
        a//=2
        i+=1
    while a%5==0:
        a//=5
        j+=1
    B[k] = (i,j)
    cnt[i][j] += 1

for i in range(1,40):
    i = 39-i
    for j in range(40):
        j = 39-j
        cnt[i][j] += cnt[i+1][j]

for i in range(40):
    i = 39-i
    for j in range(1,40):
        j = 39-j
        cnt[i][j] += cnt[i][j+1]

ans = 0
for i,j in B:
    me = int(i>=9 and j>=9)
    ans += cnt[max(0,18-i)][max(0,18-j)]-me

print(ans//2)
s=input()
def check(s):
    if s=="":
        return True
    else:
        if len(s)>=7:
            if s[-5:]=="dream" or s[-5:]=="erase":
                    return check(s[:-5])
                
            elif s[-7:]=="dreamer":
                    return check(s[:-7])
                
            elif s[-6:]=="eraser":
                    return check(s[:-6]) 
                
                
        elif len(s)==6:
            if s[-6:]=="eraser":
                return True
            
            else:
                return False
            
        elif len(s)==5:
            if s[-5:]=="dream" or s[-5:]=="erase":
                return True
            
            else:
                return False
            
        else:
            return False
        
if check(s):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

s=input()
length=len(s)

s=s[::-1]

s=s+"WWWWWWW"

index=0
flag=True
while index<length:
    if s[index]=="m" and s[index+1]=="a" and s[index+2]=="e" and s[index+3]=="r" and s[index+4]=="d":
        index+=5
    elif s[index]=="e" and s[index+1]=="s" and s[index+2]=="a" and s[index+3]=="r" and s[index+4]=="e":
        index+=5   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="m" and s[index+3]=="a" and s[index+4]=="e" and s[index+5]=="r" and s[index+6]=="d":
        index+=7   
    elif s[index]=="r" and s[index+1]=="e" and s[index+2]=="s" and s[index+3]=="a" and s[index+4]=="r" and s[index+5]=="e":
        index+=6
    else:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")
from bisect import bisect_left
def dfs(index):
    global ans
    if index == N:
        if blst.count(1) == K:
            tmp = a[bisect_left(blst, 1)]
            anstmp = 0
            for i in range(N):
                if blst[i] == 0:continue
                if tmp >= a[i]:
                    anstmp += tmp - a[i] + 1
                    tmp += 1
                else:
                    tmp = a[i]
            ans = min(ans, anstmp)
        return
    for i in range(2):
        blst[index] = i
        dfs(index + 1)
    return

N, K = map(int, input().split())
a = list(map(int, input().split()))
blst = [0] * N
ans = float('inf')
dfs(0)

print(ans - K)

### FIXED CODE ###

def dfs(index):
    global ans
    if index == N:
        if blst.count(1) >= K - 1:
            tmp = a[0]
            anstmp = 0
            for i in range(1, N):
                if blst[i - 1] == 0:
                    if tmp < a[i]:
                        tmp = a[i]
                    continue
                if tmp >= a[i]:
                    anstmp += tmp - a[i] + 1
                    tmp += 1
                else:
                    tmp = a[i]
            ans = min(ans, anstmp)
        return
    for i in range(2):
        blst[index - 1] = i
        dfs(index + 1)
    return

N, K = map(int, input().split())
a = list(map(int, input().split()))
blst = [0] * (N - 1)
ans = float('inf')
dfs(1)

print(ans)
mod = int(1e9) + 7


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y//2)**2 % mod
    else:
        return power(x, y//2)**2 * x % mod


fact = [1] * int(1e5+1)
for i in range(1, int(1e5+1)):
    fact[i] = (i * fact[i-1]) % mod
inv = [1] * int(1e5+1)
inv[int(1e5)] = power(fact[int(1e5)], mod-2) % mod
for i in range(int(1e5)-1, 0, -1):
    inv[i] = (inv[i+1] * (i+1)) % mod


def combination(n, r):
    return fact[n] * inv[r] * inv[n-r] % mod


def main():
    N = int(input())
    A = list(map(int, input().split()))
    idx = [-1] * (N+1)
    x = 0
    for i in range(N+1):
        if idx[A[i]] == -1:
            idx[A[i]] = i
        else:
            x = i - idx[A[i]]
    for i in range(1, N+2):
        ans = combination(N+1, i)
        if i <= (N+1-x):
            ans = (ans - combination(N+1-(x+1), i-1)) % mod
        print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

mod = int(1e9) + 7


def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, y//2)**2 % mod
    else:
        return power(x, y//2)**2 * x % mod


fact = [1] * int(1e5+2)
for i in range(1, int(1e5+2)):
    fact[i] = (i * fact[i-1]) % mod
inv = [1] * int(1e5+2)
inv[int(1e5+1)] = power(fact[int(1e5+1)], mod-2) % mod
for i in range(int(1e5), 0, -1):
    inv[i] = (inv[i+1] * (i+1)) % mod


def combination(n, r):
    return fact[n] * inv[r] * inv[n-r] % mod


def main():
    N = int(input())
    A = list(map(int, input().split()))
    idx = [-1] * (N+1)
    x = 0
    for i in range(N+1):
        if idx[A[i]] == -1:
            idx[A[i]] = i
        else:
            x = i - idx[A[i]]
    for i in range(1, N+2):
        ans = combination(N+1, i)
        if i <= (N+1-x):
            ans = (ans - combination(N+1-(x+1), i-1)) % mod
        print(ans)


if __name__ == "__main__":
    main()
n = int(input())
xyh_list = [list(map(int, input().split())) for _ in range(n)]
list_0_100 = [i for i in range(0, 101)]
possible_list = []
for i in range(len(xyh_list)):
    if xyh_list[i][2] != 0:
        x1 = xyh_list[i][0]
        y1 = xyh_list[i][1]
        h1 = xyh_list[i][2]
        break
for a in range(i+1, len(xyh_list)):
    x2 = xyh_list[a][0]
    y2 = xyh_list[a][1]
    h2 = xyh_list[a][2]
    break
    
for i in list_0_100:
    for j in list_0_100:
        if (h2 + abs(x2 - i) + abs(y2 - j)) == (h1 + abs(x1 - i) + abs(y1 - j)):
            possible_list.append([i, j])   # cx, cy 候補
pos_list = []
for i in range(a+1, n):
    if len(possible_list) == 1:
        break
    x = xyh_list[i][0]
    y = xyh_list[i][1]
    h = xyh_list[i][2]
    for j in range(len(possible_list)):  
        x_ = possible_list[j][0]
        y_ = possible_list[j][1]
        if (h + abs(x - x_) + abs(y - y_)) == (h2 + abs(x2 - x_) + abs(y2 - y_)):
            pos_list.append([x_, y_])
    possible_list = pos_list
    pos_list = []

print(possible_list[0][0], possible_list[0][1], \
      h2 + abs(x2 - possible_list[0][0]) + abs(y2 - possible_list[0][1]))


### FIXED CODE ###

n = int(input())
xyh_list = [list(map(int, input().split())) for _ in range(n)]
list_0_100 = [i for i in range(0, 101)]
possible_list = []
for a in range(len(xyh_list)):
    if xyh_list[a][2] != 0:
        x1 = xyh_list[a][0]
        y1 = xyh_list[a][1]
        h1 = xyh_list[a][2]
        break

for cx in list_0_100:
    for cy in list_0_100:
        H = h1 + abs(x1 - cx) + abs(y1 - cy)
        count = 0
        for i in range(n):
            x = xyh_list[i][0]
            y = xyh_list[i][1]
            h = xyh_list[i][2]
            if h == max(H - abs(x - cx) - abs(y - cy), 0):
                count += 1
        if count == n:
            ansx = cx
            ansy = cy
            ansH = H
print(ansx, ansy, ansH)
n = int(input())

a = list(range(1, n+1))
b = a[1:]+[1]
ans = 0

for i in range(n):
    ans += a[i] % b[i]

print(ans)


### FIXED CODE ###

n = int(input())


a = (1+n-1)*(n-1)//2
print(a)
from sys import stdin
W,H,x,y = [int(x) for x in stdin.readline().rstrip().split()]
if W == H and x == y == (W/2):
    print((W*H) / 2,1)
 
elif W == H and x == y and x != (W/2):
    print(min(x,W-x) * float(H),1)
    
elif (W/2) == x and (H/2) == y:
    print((W*H)/2,1)
 
elif x == W and y == 0:
    print((W*H)/2,0)
    
elif x == 0 and y == H:
    print((W*H)/2,0)
 
elif x == W and y == H:
    print((W*H)/2,0)
    
elif x == 0 and y == 0:
    print((W*H)/2,0)
 
elif (W/y) == (H/x):
    print((W*H)/2,0)
    
else:
    squ1 = min(x,W-x) * float(H)
    squ2 = min(y,H-y) * float(W)
    print(max(squ1,squ2),0)

### FIXED CODE ###

from sys import stdin
W,H,x,y = [int(x) for x in stdin.readline().rstrip().split()]
if (W / 2) == x and (H / 2) == y:
    print((W * H) / 2, 1)
else:
    print((W * H) / 2 ,0)
tmp =input().split()
H,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])

list = [[0 for x in range(W)] for y in range(H)]
dictx ={}
dicty ={}
for i in range(H):
    tmp = input().split()
    for d in range(W):
        dictx[tmp[d]] = i
        dicty[tmp[d]] = d
cost ={}
def calcost(R):
    if int(R)<=D:
        cost[R] = 0
        return 0
    else:
        costs = abs(dictx[R]-dictx[str(int(R)-D)]) + abs(dicty[R]-dicty[str(int(R)-D)])
        if str(int(R)-D) in cost:
            cost[R] = costs + cost[str(int(R)-D)]
            return cost[R]
        else:
            cost[R] = costs + calcost(str(int(R)-D))
            return cost[R]

for n in range(D+1,H*W+1):
    calcost(str(n))

Q = int(input())
for j in range(Q):
    tmp = input().split()
    print(str(cost[tmp[1]]-cost[tmp[0]]))

### FIXED CODE ###

tmp =input().split()
H,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])

list = [[0 for x in range(W)] for y in range(H)]
dictx ={}
dicty ={}
for i in range(H):
    tmp = input().split()
    for d in range(W):
        dictx[tmp[d]] = i
        dicty[tmp[d]] = d
cost ={}
def calcost(R):
    if int(R)<=D:
        cost[R] = 0
        return 0
    else:
        costs = abs(dictx[R]-dictx[str(int(R)-D)]) + abs(dicty[R]-dicty[str(int(R)-D)])
        cost[R] = costs + cost[str(int(R)-D)]
        return cost[R]

for n in range(1,H*W+1):
    calcost(str(n))
Q = int(input())
for j in range(Q):
    tmp = input().split()
    print(str(cost[tmp[1]]-cost[tmp[0]]))
k = int(input())
a, b = map(int, input().split());

x = 0;
for i in range(a,b+1);
    if i % k == 0:
        x += 1;

if x == 0:
    print('NG')
else:
    print('OK')

### FIXED CODE ###

c = int(input());
a, b = map(int, input().split())
d = 0;

while a <= b :
    if a % c == 0:
        d = d + 1;

    a = a + 1;
    
if d == 0:
    print("NG");

else:
    print("OK");
s,t = input().split()
    print(t+s)

### FIXED CODE ###

s,t = input().split()
print(t+s)
N = int(input())

if N == 1:
    print(1)
    sys.exit()

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


myans = 0
mymin = 9999999
for i in range(N):
    if mylist[i] < mymin:
        mymin = mylist[i]
        myans += 1
        
print(myans)

### FIXED CODE ###

N = int(input())


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


myans = 0
mymin = 9999999999
for i in range(N):
    if mylist[i] < mymin:
        mymin = mylist[i]
        myans += 1
        
print(myans)