Problem:


Score : 200 points

Problem Statement

Given are integers a,b,c and d.
If x and y are integers and a \leq x \leq b and c\leq y \leq d hold, what is the maximum possible value of x \times y?

Constraints

-10^9 \leq a \leq b \leq 10^9

-10^9 \leq c \leq d \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

a b c d

Output

Print the answer.

Sample Input 1

1 2 1 1

Sample Output 1

2

If x = 1 and y = 1 then x \times y = 1.
If x = 2 and y = 1 then x \times y = 2.
Therefore, the answer is 2.

Sample Input 2

3 5 -4 -2

Sample Output 2

-6

The answer can be negative.

Sample Input 3

-1000000000 0 -1000000000 0

Sample Output 3

1000000000000000000



Sample input:
1 2 1 1


Sample output:
2

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
x = [a*d,a*c,b*c,b*d]
ma =x[0]
for i in range(4):
    if ma<=x[i]:
        ma = x[i]
print(ma)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
ans1=a*c
ans2=a*d
ans3=b*c
ans4=b*d
print(max(max(max(ans1,ans2),ans3),ans4))

Submission status: Accepted

Solution code:
import math

all = list(map(int,input().split()))
a = all[0]
b = all[1]
c = all[2]
d = all[3]

if a >= 0 and c >= 0:
    print(b * d)
elif b <=0 and d <= 0:
    print(a * c)
elif a >= 0 and b >= 0 and c <= 0 and d <= 0:
    print(a * d)
elif a <= 0 and b <= 0 and c >= 0 and d >= 0:
    print(b * c)
elif a <= 0 and b >= 0 and c <= 0 and d >= 0:
    if a * c > b * d:
        print(a * c)
    else:
        print(b * d)
elif a <= 0 and b >= 0 and c <= 0 and d <= 0:
    if a * c > a * d:
        print(a * c)
    else:
        print(a * d)
elif a <= 0 and b <= 0 and c <= 0 and d >= 0:
    if a * c > b * c:
        print(a * c)
    else:
        print(b * c)
elif a <= 0 and b >= 0 and c >= 0 and d >= 0:
    if b * c > b * d:
        print(b * c)
    else:
        print(b * d)
elif a >= 0 and b >= 0 and c <= 0 and d >= 0:
    if a * d > b * d:
        print(a * d)
    else:
        print(b * d)

Submission status: Accepted

Solution code:
a,b,c,d= map(int,input().split())

x=a*c
y=a*d
z=b*c
xx=b*d


print(max(x,y,z,xx))

Submission status: Accepted

Solution code:

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


if a*b <= 0 and c*d <= 0:
    print(max([a*c, b*d]))
elif a*b <= 0 and c >= 0:
    print(b*d)
elif a*b <=0 and d <=0:
    print(a*c)
elif a>=0 and c*d<=0:
    print(b*d)
elif a>=0 and c>=0:
    print(b*d)
elif a>=0 and d<=0:
    print(a*d)
elif b<=0 and c*d<=0:
    print(a*c)
elif b<=0 and c>=0:
    print(b*c)
elif b<=0 and d<=0:
    print(a*c)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
  a, b, c, d = [int(a) for a in input().split()]
  # x = max(a, b)
  # y = max(c, d)
  # if (x < 0 and y < 0 ) or (x >= 0 and y >= 0):
  #   pass
  # elif x > 0 and y <= 0:
  #   x = min(a, b)
  # elif y > 0 and x <= 0:
  #   y = min(c, d)
  # ret = x * y
  print(max(a*c, a*d, b*c, b*d))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

# 最大値を出力すればよいが、候補は {ac, ad, bc, bd} のいずれか
print(max(a*c, a*d, b*c, b*d))

Submission status: Accepted

Solution code:
a, b, c, d = map(int,input().split())
L = [a * c, a * d, b * c, b * d]
print(max(L))

Submission status: Accepted

Solution code:
*X, = map(int, open(0).read().split())
print(max(X[0]*X[2],X[1]*X[2],X[0]*X[3],X[1]*X[3]))

Submission status: Accepted

Solution code:
def resolve():
    a, b, c, d = map(int, input().split())
    print(max(a * c, b * d, a * d, b * c))

resolve()

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
ans = a*c
if a*d > ans:
    ans = a*d
if b*c > ans:
    ans = b*c
if b*d > ans:
    ans = b*d
print (ans)

Submission status: Accepted

Solution code:
a, b, c, d = [int(x) for x in input().split()]
print(max(a*c, a*d, b*c, b*d))

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
max = -10 ** 25
for i in range(2):
  for j in range(2,4):
    p = a[i] * a[j]
    if max < p:
      max = p
print(max)

Submission status: Accepted

Solution code:

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline


def array(size, init=0):
    return [[init for j in range(size[1])] for i in range(size[0])]


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


def II():
    return int(input())


def nitti(x, y):
    count = 0
    for i in range(len(x)):
        if x[i] == y[i]:
            count += 1
    return count


x = acinput()


res = 10**20*(-1)

for i in range(2):
    for j in range(2, 4):
        res = max(res, x[i]*x[j])

print(res)

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())
l = [a*c, a*d, b*c, b*d]
print(max(l))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
print(max(a*c, b*d, a*d, b*c))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
 
if a>=0 and c>=0:
  print(b*d)
elif b<=0 and d<=0:
  print(a*c)
elif b<=0 and c>=0:
  print(b*c)
elif a>=0 and d<=0:
  print(a*d)
elif a<=0 and b>=0 and c<=0 and d>=0:
  print(max([a*c, b*d]))
elif b<=0 and c<=0 and d>=0:
  print(a*c)
elif a<=0 and b>=0 and d<=0:
  print(a*c)
elif a<=0 and b>=0 and c>=0:
  print(b*d)
elif a>=0 and c<=0 and d>=0:
  print(b*d)

Submission status: Accepted

Solution code:
a, b, c, d = map(int,input().split(" "))

Ns = [a*c, a*d, b*c, b*d]
print(sorted(Ns)[-1])

Submission status: Accepted

Solution code:
a,b,c,d=list(map(int,input().split()))
u=a*c
p=b*d
l=a*d
y=c*b
print(max(u,p,l,y))

Submission status: Accepted

Solution code:
a, b, c, d = map(int,input().split())
inf = -10**9
ans = max(a*c, a*d)
ans = max(ans, b*c)
ans = max(ans, b*d)
print(ans)

Submission status: Accepted

Solution code:
def f(a):
	r = [a[0]*a[2], a[0]*a[3], a[1]*a[2], a[1]*a[3]]
	return max(r)


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

print(f(arr))

Submission status: Accepted

Solution code:
a, b, c , d = map(int, input().split())

M = b * d;
if M < a * c:
    M = a*c;
if M < b * c:
    M = b*c;
if M < a * d:
    M = a * d;
    

print (M);

Submission status: Accepted

Solution code:
def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = None

def absmax(a, b):
    if abs(a) > abs(b): return a
    return b

def absmin(a, b):
    if abs(a) < abs(b): return a
    return b

a, b, c, d = m_in(int)
aa, bb, cc, dd = abs(a), abs(b), abs(c), abs(d)
x, y = 0, 0

abm = absmax(a, b)
cdm = absmax(c, d)
if (abm>0) == (cdm>0):
    ans = abm*cdm
else:
    abi = absmin(a, b)
    cdi = absmin(c, d)
    if (abi>0) == (cdm>0):
        k = abi*cdm
        if ans is None or k > ans: ans = k
    if (abm>0) == (cdi>0):
        k = abm*cdi
        if ans is None or k > ans: ans = k
    k = abi*cdi
    if ans is None: ans = k

print(ans)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())

f=1
g=1 
ans=1
print(max(a*c,a*d,b*c,b*d))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
x = [a, b]
y = [c, d]
print(max(i*j for i in x for j in y))

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())
ans = list()
ans.append(a*c)
ans.append(a*d)
ans.append(b*c)
ans.append(b*d)
print(max(ans))

Submission status: Accepted

Solution code:
nums = [int(e) for e in input().split()]
a=nums[0]
b=nums[1]
c=nums[2]
d=nums[3]
max = a*c
if a * d > max:
    max = a * d
if b * c > max:
    max = b * c
if b * d > max:
    max = b * d

print(max)

Submission status: Accepted

Solution code:
def main():
    data = list(map(int, input().split()))
    ans = [data[0]*data[2],data[0]*data[3],data[1]*data[2],data[1]*data[3],]
    print(max (ans))
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
e = a * c
f = a * d
g = b * c
h = b * d
l = [e, f, g, h]
print(max(l))

Submission status: Accepted

Solution code:
S=list(input().split())
A=[int(n) for n in S]
if A[0]<0 and A[1]<0 and A[2]<0 and A[3]<0:
    print(A[0]*A[2])
elif A[0]<=0 and A[1]<=0 and A[2]<=0 and A[3]>=0:
    print(A[0]*A[2])
elif A[0]<=0 and A[1]<=0 and A[2]>=0 and A[3]>=0:
    print(A[1]*A[2])
elif A[0]<=0 and A[1]>=0 and A[2]<=0 and A[3]<=0:
    print(A[0]*A[2])
elif A[0]<=0 and A[1]>=0 and A[2]<=0 and A[3]>=0:
    print(max(A[0]*A[2],A[1]*A[3]))
elif A[0]<=0 and A[1]>=0 and A[2]>=0 and A[3]>=0:
    print(A[1]*A[3])
elif A[0]>=0 and A[1]>=0 and A[2]<=0 and A[3]<=0:
    print(A[0]*A[3])
elif A[0]>=0 and A[1]>=0 and A[2]<=0 and A[3]>=0:
    print(A[1]*A[3])
elif A[0]>=0 and A[1]>=0 and A[2]>=0 and A[3]>=0:
    print(A[1]*A[3])

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

l = [a*c, a*d, b*c, b*d]
maxNum = max(l)

print(maxNum)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
e = []
for i in [a, b]:
    for j in [c, d]:
        e += [i * j]

print(max(e))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
e=max(a*c,a*d)
f=max(b*c,b*d)
print(max(e,f))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

if a>0 :
    if d<0 :
        print(a*d)
    else :
        print(b*d)
elif b<0 :
    if c>0 :
        print(b*c)
    else :
        print(a*c)
else :
    if c>0 :
        print(b*d)
    elif d<0 :
        print(a*c)
    else :
        if a*c<b*d :
            print(b*d)
        else :
            print(a*c)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
print(max(a*c,b*d,a*d,b*c))

Submission status: Accepted

Solution code:
E = input()
F = E.split(" ")

a=int(F[0])
b=int(F[1])
c=int(F[2])
d=int(F[3])

xy1 = a*c
xy2 = a*d
xy3 = b*c
xy4 = b*d

if xy1 >= xy2 and xy1 >= xy3 and xy1 >= xy4:
    print(xy1)

elif xy2 >= xy1 and xy2 >= xy3 and xy2 >= xy4:
    print(xy2)

elif xy3 >= xy1 and xy3 >= xy2 and xy3 >= xy4:
    print(xy3)

else: 
    print(xy4)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

print(max(a * c, a * d, b * c, b * d))

Submission status: Accepted

Solution code:
nums = [int(i) for i in input().split()]
a = nums[0]
b = nums[1]
c = nums[2]
d = nums[3]
ac = a*c
bd = b*d
if (ac<=0 and bd<=0):
  max = max(a*d, b*c)
elif (ac>=0 and bd>=0):
  max = max(ac, bd)
elif ac>=0:
  max = ac
elif bd>=0:
  max = bd
  
print(max)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split(' '))

ans = a * c
ans = max(ans, b * d)
ans = max(ans, b * c)
ans = max(ans, a * d)

print(ans)

Submission status: Accepted

Solution code:
a, b, c, d = map(int,input().split())
e1 = a*c
e2 = a*d
e3 = b*c
e4 = b*d

list = [e1, e2, e3, e4]
list.sort()

print(list[3])

Submission status: Accepted

Solution code:
a, b, c, d = map(int,input().split())

if a == c and b == d:
    print(max(a*c, b*d))
    exit()
else:
    print(max(a*c, a*d,b*c,b*d))

Submission status: Accepted

Solution code:
a, b, c, d = list(map(int, input().split()))
l = [a*c, a*d, b*c, b*d]
print(max(l))

Submission status: Accepted

Solution code:
import numpy as np

a, b, c, d = map(int,input().split())
print(max(a*c,a*d,b*c,b*d))

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())

ans = -10000000000000000000

if a*c>ans:
    ans = a*c
if b*d>ans:
    ans = b*d
if a*d>ans:
    ans = a*d
if c*b>ans:
    ans = c*b

print(ans)

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
answer = -10**18
answer = max(answer, a*c)
answer = max(answer, a*d)
answer = max(answer, b*d)
answer = max(answer, b*c)
print(answer)

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())

if a >= 0 and c >= 0 :
  print(b*d)
elif b <= 0 and d <= 0:
  print(a*c)
elif a>=0 and c <= 0:
  print(max(a*d,b*d))
elif a<=0 and c >= 0:
  print(max(c*b, b*d))
else:
  print(max(a*d,b*d,c*b,a*c))

Submission status: Accepted

Solution code:
a,b,c,d = (int(x) for x in input().split())

ac = a * c
ad = a * d
bc = b * c
bd = b * d

print(max([ac,ad,bc,bd]))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

a_b = [a, b]
c_d = [c, d]

multi = []

for i in a_b:
    for j in c_d:
        multi.append(i * j)

print(max(multi))

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
if a <= 0 <= b or c <= 0 <= d:
  print(max(0,a * c,a * d,b * c,b * d))
else:
  print(max(a * c,a * d,b * c,b * d))

Submission status: Accepted

Solution code:
ab = []
cd = []
abcd = list(map(int, input().split()))
ab.append(abcd[0])
ab.append(abcd[1])
cd.append(abcd[2])
cd.append(abcd[3])
ans = []
for i in ab:
    for j in cd:
        ans.append(i * j)
print(max(ans))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
xmx = max([a, b])
xmin = min([a, b])
#xabsmx = max([a, b], key = abs)
#xabsmin = min([a, b],key = abs)
ymx = max([c, d])
ymin = min([c, d])
#yabsmx = max([c,d], key = abs)
#yabsmin = min([c, d],key = abs)
if xmin >= 0:#all X plus
    if ymx <= 0:#all Y minas
        print(xmin * ymx)
    else:
        print(xmx * ymx)

elif xmx <= 0:#all X minas
    if ymin >= 0:#all Y plus
        print(xmx * ymin)
    else:
        print(xmin * ymin)
else:#X plus and minas
    if ymx <= 0:#all Y minas
        print(xmin * ymin)
    elif ymin >= 0:#all Y plus
        print(xmx * ymx)
    else:#Y plus and minas
        if xmx * ymx > xmin * ymin:
            print(xmx * ymx)
        else:
            print(xmin * ymin)

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())

l = [a*c, a*d , b*c, b*d]

print(max(l))

Submission status: Accepted

Solution code:
#[int(i) for i in input().split()]
a,b,c,d = [int(i) for i in input().split()]
x=y=0
print(max([a*c, a*d, b*c, b*d]))

Submission status: Accepted

Solution code:
a,b,c,d =map(int,input().split())

A=a*c
B=a*d
C=b*c
D=b*d

if A>=B and A>=C and A>=D:
    print(A)

elif B>=A and B>=C and B>=D:
    print(B)

elif C>=A and C>=B and C>=D:
    print(C)

elif D>=A and D>=B and D>=C:
    print(D)

Submission status: Accepted

Solution code:
a, b, c, d = list(map(int, input().split()))

print(max(max(min(a,b)*min(c,d), max(a,b)*max(c,d)), max(min(a,b)*max(c,d), max(a,b)*min(c,d))))

Submission status: Accepted

Solution code:
abcd = list(map(int,input().split(' ')))
a,b,c,d = abcd[0],abcd[1],abcd[2],abcd[3]

print(max(a*c,a*d,b*c,b*d))

Submission status: Accepted

Solution code:
x = list(map(int, input().split()))
l1 = x[:2]
l2 = x[2:]
final = []
for i in range(2):
    for j in range(2):
        final.append(l1[i]*l2[j])
print(max(final))

Submission status: Accepted

Solution code:
lines = map(int,input().split())
a,b,c,d = lines

print(max(a*c,a*d,b*c,b*d))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
if a < 0 and c < 0:
    if a*c > b*d:
        print(a*c)
    else:
        print(b*d)
elif a > 0 and c < 0:
    if a*d > b*d:
        print(a*d)
    else:
        print(b*d)
elif a < 0 and c > 0:
    if b*c > b*d:
        print(b*c)
    else:
        print(b*d)
else:
    print(b*d)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())

max=a*c
for i in  (a,b):
    for j in (c,d):
        if max < i*j:
            max = i*j

print(max)

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())

x = [a,b]
y = [c,d]
ans = []

for i in x:
  for j in y:
    A = i*j
    ans.append(A)
    
print(max(ans))

Submission status: Accepted

Solution code:

#!/usr/bin/python
# -*- coding: utf-8 -*-

# def
def int_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(map(int,input().split())))
    return np.array(x)

def str_mtx(N):
    x = []
    for _ in range(N):
        x.append(list(input()))
    return np.array(x)

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

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

def print_space(l):
    return print(" ".join([str(x) for x in l]))

# import
import numpy as np
import collections as col

a,b,c,d = int_map()

x1 = a*c
x2 = a*d
x3 = b*c
x4 = b*d

print(max(x1,x2,x3,x4))

Submission status: Accepted

Solution code:
a,b,c,d = list(map(int,input().split()))
if (a<=0 and 0<=b) or (c<=0 and 0<= d):
    ls = [0]
else:
    ls = []

ls.append(a*c)
ls.append(a*d)
ls.append(b*c)
ls.append(b*d)

ans = max(ls)
print(ans)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

print(max(a * c, a * d, b * c, b * d))

Submission status: Accepted

Solution code:
a, b, c, d = map(int,input().split())
x = [a,b]
y = [c,d]
xy = []

for i in x:
    for j in y:
        num = i*j
        xy.append(num)
ans = max(xy)
print(ans)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input(). split())
print(max(a * c, a * d, b * c, b * d))

Submission status: Accepted

Solution code:
lists = list(map(int,input().split()))
a = lists[0]
b = lists[1]
c = lists[2]
d = lists[3]
e = a*d
f = a*c
g = b*c
h = b*d
list2 = [e,f,g,h]
list2.sort()
print(list2[3])

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())
if 0 <= a :
  if 0 < d:
    print(b*d)
  else:
    print(a*d)
elif a < 0 and 0 < b:
  if 0 <= c:
    print(b*d)
  elif d < 0:
    print(a*c)
  else:
    print(max(a*c,b*d))
else: #b <= 0
  if c < 0:
    print(a*c)
  else:
    print(b*c)

Submission status: Accepted

Solution code:
a,b,c,d=map(int, input().split())

print(max(a*c,a*d,b*c,b*d))



# 2darray [[0] * 4 for i in range(3)]
# import itertools

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
#abcdをそれぞれ入力

K = a*c
L = a*d
M = b*c
N = b*d

A = max(K,L,M,N)

print(A)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
"""
if(b>0 and d>0):
    print(b*d)
    exit()
elif(b<0 and d<0):
    print(a*c)
    exit()
elif(b==0):
    if(c>0):
        print(0)
        exit()
    else:
        print(a*c)
        exit()
elif(d==0):
    if(a>0):
        print(0)
        exit()
    else:
        print(a*c)
        exit()
elif(b<0 and d>0):
    print(a*c)
    exit()
elif(d<0 and b>0):
    print(b*d)
    exit()
else:
    print(b*d)
    exit()
"""

ans1=a*c
ans2=a*d
ans3=b*c
ans4=b*d

print(max(max(ans1,ans2),max(ans3,ans4)))

Submission status: Accepted

Solution code:
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

a,b,c,d = (int(x) for x in input().split())
print(max([a*c,a*d,b*c,b*d]))

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
answer =0
if b < 0:
	if c < 0:
		answer = max(a*c,b*d)
	if c>=0:
		answer = max(a*c,b*d,b*c)
if b>=0:
	if a <0:
		answer = max(a*c ,b * d,0)
	if a >= 0:
		if d< 0:
			if a == 0:
				answer = 0
			else:
				answer = a*d
		if d>=0:
			answer = b*d
print(answer)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

def f(a: int, b: int, c: int, d: int) -> int:
    """
    >>> f(-2, -1, -2, -1)
    4
    >>> f(-2, -1, 1, 2)
    -1
    >>> f(1, 2, 1, 2)
    4
    >>> f(1, 2, -2, -1)
    -1
    """
    return max(a * c, a * d, b * c, b * d)


if __name__ == '__main__':
    a, b, c, d = map(lambda x: int(x), input().split())
    print(f(a, b, c, d))

Submission status: Accepted

Solution code:
L = list(map(int, input().split()))
a = L[0]
b = L[1]
c = L[2]
d = L[3]
list_n = []
list_n.append(a*c)
list_n.append(a*d)
list_n.append(b*c)
list_n.append(b*d)

print(max(list_n))

Submission status: Accepted

Solution code:
arr = list(map(int, input().split()))

possibleSolutions = []

possibleSolutions.append(arr[0] * arr[2])
possibleSolutions.append(arr[0] * arr[3])
possibleSolutions.append(arr[1] * arr[2])
possibleSolutions.append(arr[1] * arr[3])

print(max(possibleSolutions))

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
ans = []

ans.append(b * d)
ans.append(a * c)
ans.append(a * d)
ans.append(b * c)

print(max(ans))

Submission status: Accepted

Solution code:
a,b,c,d = [int(v) for v in input().split()]
print(max([a*c,a*d,b*c,b*d]))

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())

max_x = max(a,b)
min_x = min(a,b)
max_y = max(c,d)
min_y = min(c,d)


if max_x >= 0 and min_x >= 0:
    if max_y >= 0 and min_y >= 0:
        x = max_x
        y = max_y
    elif max_y >= 0 and min_y < 0:
        x = max_x
        y = max_y
    else:
        x = min_x
        y = max_y

elif max_x >= 0 and min_x < 0:
    if max_y >= 0 and min_y >= 0:
        x = max_x
        y = max_y
    elif max_y >= 0 and min_y < 0:
        if max_x * max_y >= min_x * min_y:
            x = max_x
            y = max_y
        else:
            x = min_x
            y = min_y
    else:
        x = min_x
        y = min_y
else:
    if max_y >= 0 and min_y >= 0:
        x = max_x
        y = min_y
    elif max_y >= 0 and min_y < 0:
        x = min_x
        y = min_y
    else:
        x = min_x
        y = min_y

print(x*y)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
m1 = a * c
m2 = a * d
m3 = b * c
m4 = b * d
print(max(m1, m2, m3, m4))

Submission status: Accepted

Solution code:
a = input()
l_si=a.split()
l_si_i = [int(s) for s in l_si]
print(max(l_si_i[0]*l_si_i[2],l_si_i[0]*l_si_i[3],l_si_i[1]*l_si_i[2],l_si_i[1]*l_si_i[3]))

Submission status: Accepted

Solution code:
a, b, c, d = input().split(" ")
a, b, c, d = int(a), int(b), int(c), int(d)

list_res = [a*c, a*d, b*c, b*d]

print(max(list_res))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())

if a >= 0:
  if c>=0:
    ans = b*d
  elif d >=0:
    ans=b*d
  else:
    ans=a*d
else:
  if b>=0:
    if c>=0:
      ans = b*d
    elif d >=0:
      if a*c < b*d:
        ans = b*d
      else:
        ans= a*c
    else:
      ans=a*c
  elif c>=0:
    ans=b*c
  else:
    ans= a*c
print(ans)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
X = [a, b]
Y = [c, d]
lst = [[x*y for x in X] for y in Y]
mylist=[]
for i in lst:
    for I in i:
        mylist.append(I)

mylist.sort()
print(mylist[-1])

Submission status: Accepted

Solution code:
a,b,c,d=(int(x) for x in input().split())
A = a*c
B = a*d
C = b*c
D = b*d
print(max(A,B,C,D))

Submission status: Accepted

Solution code:
import numpy as np
li= list(map(int,input().split()))
li_s= list(map(np.sign,li))

if li_s[0]==li_s[1] and li_s[2]==li_s[3] and li_s[0]*li_s[2]==-1:
    print(max(li[0]*li[3],li[1]*li[2]))
else:
    print(max(li[0]*li[2],li[1]*li[3]))

Submission status: Accepted

Solution code:
a,b,c,d=list(map(int,input().split()))
m=[]
m.extend([b*c,b*d,a*c,a*d])
print(max(m))

Submission status: Accepted

Solution code:
a,b,c,d = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if d < 0 and b > 0:
    if d > 0:
        d = c
    else:
        b = a
if d > 0 and b < 0:
    if d > 0:
        d = c
    else:
        b = a
if a < 0 and c < 0:
    if d * b < a * c:
        d = c
        b = a
print(b * d)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
    
if a == 0:
    if c >= 0:
        print(b * d)
    elif c < 0:
        if d >= 0:
            print(b * d)
        elif d < 0:
            print(0)
elif a > 0:
    if c >= 0:
        print(b * d)
    elif c < 0:
        if d >= 0:
            print(b * d)
        elif d < 0:
            print(a * d)
            
elif a < 0:
    if b >= 0:
        if c >= 0:
            print(b * d)
        elif c < 0:
            if d >= 0:
                if a * c > b * d:
                    print(a * c)
                else:
                    print(b * d)
            elif d < 0:
                print(a * c)
        
    elif b < 0:
        if c >= 0:
            print(b * c)
        elif c < 0:
            print(a * c)

Submission status: Accepted

Solution code:
numbers = list(map(int,input().split()))
ans = -float("INF")
n = 0

while n < len(numbers)-2:
    for i in range(2,4):
        tmp = numbers[n]*numbers[i]
        ans = max(ans,tmp)
    n += 1

print(ans)

Submission status: Accepted

Solution code:
l = []
a, b, c, d = map(int, input().split())

n2 = a * c
n3 = a * d
n4 = b * c
n5 = b * d

l.append(n2)
l.append(n3)
l.append(n4)
l.append(n5)

print(max(l))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
multinum=[a*c,a*d,b*c,b*d]
print(max(multinum))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# atcoder 
# Türkler var mı?
# Herkese memnün oldum
import sys
#from heapq import heapify, heappush, heappop
#from heapq import nlargest, nsmallest

iimr = lambda: map(int, sys.stdin.readline().rstrip().split())
readline = sys.stdin.readline
# puorquoi le sys.stdin.buffer.readline() fonctionne plus sur atcoder?
#sys.setrecursionlimit(10 ** 7)
#INF = 1 << 30 # 大体 1e9


def debug(*x):
    print(*x, file=sys.stderr)


# s == self
class atcoder():
    def __init__(s):
        s.A, s.B, s.C, s.D = map(int, sys.stdin.readline().split()) 
        

    def çözmek(s):
        
        res = []
        res.append(s.関数(s.A, s.B, s.C, s.D))
        print(*res)	
    
    def 関数(self, a, b, c, d):
        ac = a * c
        ad = a * d
        bc = b * c
        bd = b * d
        res = max(ac, ad, bc, bd)
        return res 

if __name__ == "__main__":
    ima = atcoder()
    ima.çözmek()

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))

if a[0] > 0:
	if a[3] < 0:
		print(a[0] * a[3])
	else:
		print(a[1] * a[3])

elif a[1] < 0:
	if a[2] < 0:
		print(a[0] * a[2])
	else:
		print(a[1] * a[2])
else:
	if a[3] < 0:
		print(a[0] * a[2])
	elif a[2] > 0:
		print(a[1] * a[3])
	else:
		if a[0] * a[2] > a[1] * a[3]:
			print(a[0] * a[2])
		else:
			print(a[1] * a[3])

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())

x1 = a*c
x2 = a*d
x3 = b*c
x4 = b*d

z = x1
if z < x2:
    z = x2
if z < x3:
    z = x3
if z < x4:
    z = x4

print(z)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
# print(a,b,c,d)
ans=-float('inf')
for i in (a,b):
    for j in (c,d):
        ans=max(ans,i*j)
print(ans)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
m = list()
m.append(a*c)
m.append(a*d)
m.append(b*c)
m.append(b*d)
print(max(m))

Submission status: Accepted

Solution code:
li = list(map(int,input().split()))

a = li[0]
b = li[1]
c = li[2]
d = li[3]


ac = a * c
bc = b * c
ad = a * d
bd = b * d
result = ac
if result < bc:
    result = bc
if result < ad:
    result = ad
if result < bd:
    result = bd
if a <= 0 and 0 <= b and result < 0:
    result = 0
if c <= 0 and 0 <= d and result < 0:
    result = 0
print(result)

Submission status: Accepted

Solution code:
# 
import sys

from sys import stdin
input = lambda: stdin.readline().rstrip()

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

ans = a * c
ans = max(ans, a*d)
ans = max(ans, b*c)
ans = max(ans, b*d)

print(ans)

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
print(max(a*c,b*d,a*d,b*c))

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
a_1,a_2 = [],[]
a_1.append(a[0])
a_1.append(a[1])
a_2.append(a[2])
a_2.append(a[3])

#print(a_1,a_2)
max_a = -(10**30)
for i in a_1:
    for l in a_2:
        if(i*l > max_a):
            max_a = i*l

print(max_a)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
res = max(a*c,a*d,b*c,b*d)
print(res)

Submission status: Accepted

Solution code:
import sys
from itertools import combinations
input = sys.stdin.readline

a,b,c,d = map(int,input().split())
h = []
h.append(a*c)
h.append(a*d)
h.append(b*c)
h.append(b*d)

print(max(h))

Submission status: Accepted

Solution code:
i = list(map(int,input().split()))
a = i[0]
b = i[1]
c = i[2]
d = i[3]

ret = 0
if b < 0:
    if d < 0: #-2 -1 -3 -2
        ret = a * c
    elif c < 0 and d >= 0: # -3 -2 -4 0, -3 -2 -2 2
        ret = a * c
    else: # -3 -2 0 3, -3 -2 3 9
        ret = b * c
elif a < 0 and b >= 0:
    if d < 0: # -3 0 -4 -3, -3 1 -4 -3
        ret = a * c
    elif c < 0 and d >= 0:
        ret = max(a*c, b*d)
    else:
        ret = b * d
else:
    if d < 0:
        ret = a * d
    elif c < 0 and d >= 0:
        ret = b * d
    else:
        ret = b * d

print(ret)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

answer = max([
    b*c,
    d*a,
    a*c,
    b*d ])
print(answer)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
if a*c>a*d:
  a1=a*c
else:
  a1=a*d
if b*c>b*d:
  a2=b*c
else:
  a2=b*d
if a1>a2:
  print(a1)
else:
  print(a2)

Submission status: Accepted

Solution code:
inp = list(map(int,input().split()))
ans = []
for i in range(2):
  for j in range(2,4):
    ans.append(inp[i] * inp[j])
    
print(max(ans))

Submission status: Accepted

Solution code:
a,b,c,d = map(int , input().split())

answer = a * c
if answer < a * d:
    answer = a * d
if answer < b * c:
    answer = b * c
if answer < b * d:
    answer = b * d
print(answer)

Submission status: Accepted

Solution code:
a,b,c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
if a>0:
  if d>0:
    print(b*d)
  else:
    print(a*d)
else:
  if b>0:
    if d>0:
      if b*d>a*c:
        print(b*d)
      else:
        print(a*c)
    else:
      print(a*c)
  else:
    if c>0:
      print(b*c)
    else:
      print(a*c)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())

if a == 0:
	if b == 0:
		print(0)
	elif d > 0:
		print(b * d)
	else:
		print(0)
elif c == 0:
	if d == 0:
		print(0)
	elif b > 0:
		print(d * b)
	else:
		print(0)
elif b == 0:
	if a == 0:
		print(0)
	elif c < 0:
		print(a * c)
	else:
		print(0)
elif d == 0:
	if c == 0:
		print(0)
	elif a < 0:
		print(a * c)
	else:
		print(0)
elif (a > 0 and d > 0) or (b > 0 and c > 0):
	print(b * d)
elif (b < 0 and c < 0) or (a < 0 and d < 0):
	print(a * c)
else:
	print(max([a*c,a*d,b*c,b*d]))

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())
l = []
l.append(a*c)
l.append(a*d)
l.append(b*c)
l.append(b*d)

l.sort()
print(max(l))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
l=[a*c, a*d, b*c, b*d]
print(max(l))

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))

result =[]
result.append(a[0] * a[2])
result.append(a[0] * a[3])
result.append(a[1] * a[2])
result.append(a[1] * a[3])
print(max(result))

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    a, b, c, d = map(int, input().split())
    x_list = [a, b]
    y_list = [c, d]
    ans = 0

    if x_list[0] <= 0 and x_list[1] <= 0 and y_list[0] >= 0 and y_list[1] >= 0:
        ans = max(x_list) * min(y_list)
    elif x_list[0] >= 0 and x_list[1] >= 0 and y_list[0] <= 0 and y_list[1] <= 0:
        ans = max(y_list) * min(x_list)
    elif (x_list[0] <= 0 or x_list[1] <= 0) and (y_list[0] <= 0 or y_list[1] <= 0):
        ans = max(min(x_list) * min(y_list), max(x_list) * max(y_list))
    else:
        ans = max(x_list) * max(y_list)

    print(ans)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split( ))
print(max(a*c, a*d, b*c, b*d))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
x1=a*c
x2=a*d
y1=b*c
y2=b*d
l=[x1,x2,y1,y2]
print (max(l))