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:
nums = [int(x) for x in input().split()]

sign = [0] * 4
for x in range(4):
    if nums[x] < 0:
        sign[x] = 1

result = min(nums[0:2]) * min(nums[2:])

if sum(sign) == 1 or sum(sign) == 0:
    result = max(nums[0:2]) * max(nums[2:])

if sum(sign) == 2:
    if (sign[0] == 1 and sign[1]) or (sign[2] == 1 and sign[3] == 1):
        if sign[0] == 1:
             result = max(nums[0:2]) * min(nums[2:])
        elif sign[2] == 1:
             result = min(nums[0:2]) * max(nums[2:])
    else:
        cur1 = nums[0] * nums[2]
        cur2 = nums[1] * nums[3]
        if abs(cur1) > abs(cur2):
            result = cur1
        else:
            result = cur2
print(result)

Submission status: Accepted

Solution code:
a, b, c, d = [int(n) for n in input().split()]
ans = {0:b*d, 2:b*d, 3:a*d, 8:b*d, 10:max(a*c, b*d), 11:a*c, 12:b*c, 14:a*c, 15:a*c}
f = 0
if a<0:
    f += 8
if b<0:
    f += 4
if c<0:
    f += 2
if d<0:
    f += 1
print(ans[f])

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    a,b,c,d = MI()
    ans = max(a*c, a*d, b*c, b*d)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
if 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:
  print(a*c)
elif a<0 and b>=0 and c<0 and d<0:
  print(a*c)
elif a<0 and b<0 and c<0 and d<0:
  print(a*c)
elif a<0 and b>=0 and c<0 and d>=0 and abs(a*c)>=abs(b*d):
  print(a*c)
elif a>=0 and b>=0 and c<0 and d<0:
  print(a*d)
else:
  print(b*d)

Submission status: Accepted

Solution code:
num=input().split()
num=[int(a) for a in num]
numab=[abs(a) for a in num]
x=min(numab[0],numab[1])
y=min(numab[2],numab[3])


#+,+ and -,-
if (num[1]>=0 and num[3]>=0) or (num[0]<0 and num[2]<0):
  print(max(num[1]*num[3],num[0]*num[2]))
#+,- or-,+
else:
  print(-1*x*y)

Submission status: Accepted

Solution code:
inputs = input().split()
inputs = list(map(lambda x: int(x), inputs))
x_array = [inputs[0], inputs[1]]
y_array = [inputs[2], inputs[3]]
max = -1000000000000000000

for x in x_array:
    for y in y_array:
        if(max < x * y):
            max = x * y

print(max)

Submission status: Accepted

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

ab = a * b
cd = c * d

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
list_a_b = [a, b] 
list_c_d = [c, d]
max01, max02, min01, min02 = max(list_a_b), max(list_c_d), min(list_a_b), min(list_c_d)
print(max(max01 * max02, min01 * min02, max01 * min02, max02 * min01))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inputs = [int(x) for x in input().split()]
a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]

# Avoid using 0
if a == 0 and a + 1 <= b:
    a += 1
if b == 0 and b - 1 >= a:
    b -= 1
if c == 0 and c + 1 <= d:
    c += 1
if d == 0 and d - 1 >= c:
    d -= 1

if (a > 0 and b > 0 and c < 0 and d < 0) or (a < 0 and b < 0 and c > 0 and d > 0):
    # Return the max negative value
    print(-(min(abs(a), abs(b)) * min(abs(c), abs(d))))    
else:
    # Return the max positive value
    print(max(a * c, b * d))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b,c,d = map(int, 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())

s1 = a*c
s2 = a*d
s3 = b*c
s4 = b*d

score = [s1,s2,s3,s4]
max_score = max(score)
if a<=0<=b and c<=0<=d and max_score<0:
    print(0)
else:
  print(max_score)

Submission status: Accepted

Solution code:
import itertools

a, b, c, d = map(int,input().split())
ans = -10**19

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=(int(x) for x in input().split())
ac=a*c
ad=a*d
bc=b*c
bd=b*d

if(ac>ad):
    if(ac>bc):
        if(ac>bd):
            print(ac)
        else:
            print(bd)
    else:
        if(bc>bd):
            print(bc)
        else:
            print(bd)
else:
    if(ad>bc):
        if(ad>bd):
            print(ad)
        else:
            print(bd)
    else:
        if(bc>bd):
            print(bc)
        else:
            print(bd)

Submission status: Accepted

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

ab_min = min(a, b)
ab_max = max(a, b)
cd_min = min(c, d)
cd_max = max(c, d)

which = []
which.append(ab_max * cd_max)
which.append(ab_max * cd_min)
which.append(ab_min * cd_max)
which.append(ab_min * cd_min)

print(max(which))

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
i=max(e,f,g,h)
print(i)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

def ii():  return int(input())
def si():  return input()
def mi():  return map(int,input().strip().split(" "))
def li():  return list(mi())

def main():
    a,b,c,d = mi()

    p1 = max(a,b)*max(c,d)
    p2 = max(a,b)*min(c,d)
    p3 = min(a,b)*min(c,d)
    p4 = min(a,b)*max(c,d)

    print(max(p1,p2,p3,p4))
    # pass


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

print(max(list))

Submission status: Accepted

Solution code:
a,b,c,d = list(map(lambda x: int(x), input().split()))
ac, bc, bd, ad = a*c, b*c, b*d, a*d

e1 = ac if ac >= bc else bc
e2 = bd if bd >= ad else ad
ans = e1 if e1 >= e2 else e2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, d = map(int, 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:
if __name__ == "__main__":

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

    if b <= 0 :
        if d <= 0:
            xy = a * c
        elif d > 0:
            if c > 0:
                xy = b * c
            elif c == 0:
                xy = 0
            elif c < 0:
                xy = a * c
    elif b > 0:
        if a >= 0:
            if d <= 0:
                xy = a * d
            elif d > 0:
                xy = b * d
        elif a < 0:
            if d <= 0:
                xy = a * c
            elif d > 0:
                if c >= 0:
                    xy = b * d
                elif c < 0:
                    if abs(a * c) > abs(b * d):
                        xy = a * c
                    else:
                        xy = b * d

    print(xy)

Submission status: Accepted

Solution code:
A=input().split()
a=int(A[0])
b=int(A[1])
c=int(A[2])
d=int(A[3])
e=a*c
f=a*d
g=b*c
h=b*d
if e>f:
    f=e
if g>h:
    h=g
if f>h:
    h=f
print(h)

Submission status: Accepted

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


n_1 = a * c
n_2 = a * d
n_3 = b * c
n_4 = b * d

check = [n_1, n_2, n_3, n_4]
print(max(check))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

maxn = a*c

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

if maxn < x :
    maxn = x
if maxn < y :
    maxn = y
if maxn < z :
    maxn = z

print(maxn)

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:
lst = list(map(int, input().split()))
x_lst = []
y_lst = []
max_lst = []
for i in range(2):
  x_lst.append(lst[i])
  y_lst.append(lst[(i+1)*-1])
for j in range(len(x_lst)):
  for k in range(len(y_lst)):
    max_lst.append(x_lst[j] * y_lst[k])
print(max(max_lst))

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 = map(int, input().split())

if b < 0 and d < 0:
    print(a * c)
elif a < 0 and c < 0:
    if a < 0 and c < 0:
        if a * c < b * d:
            print(b * d)
        else:
            print(a * c)
    else:
        print(b * d)
elif b < 0:
    print(b * c)
elif d < 0:
    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
w=b*d
s=b*d
if(w<x and z<x and y<x):
  print(x)
elif(w<y and z<y and x<y):
  print(y)
elif(w<z and x<z and y<z):
  print(z)
elif(y<w and z<w and x<w):
  print(w)
else:
  print(s)

Submission status: Accepted

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

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 = max(a*c, a*d, b*c, b*d)
print(x)

Submission status: Accepted

Solution code:
a, b, c, d = list(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:
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())

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

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from math import gcd
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7



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

Submission status: Accepted

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

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

Submission status: Accepted

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


m = [a,b]
n = [c,d]

if a < 0 and 0 < b:
    m.append(0)

if c < 0 and 0 < d:
    n.append(0)

mx = -float('inf')

for ms in m:
    for ns in n:
        j = ms * ns
        if mx < j:
            mx = j



print(mx)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
x = [a, b]
y = [c, d]
maxVal = max(x)*max(y)
if min(x)*min(y) > maxVal and min(x)*min(y) > min(x)*max(y) and min(x)*min(y) > max(x)*min(y):
    res = min(x)*min(y)
elif min(x)*max(y) > maxVal and min(x)*max(y) > min(x)*min(y) and min(x)*max(y) > max(x)*min(y):
    res = min(x)*max(y)
elif max(x)*min(y) > maxVal and max(x)*min(y) > min(x)*max(y) and max(x)*min(y) > min(x)*min(y):
    res = max(x)*min(y)
else:
    res = maxVal
print(res)

Submission status: Accepted

Solution code:
s = input().split()
x_min = int(s[0])
x_max = int(s[1])

y_min = int(s[2])
y_max = int(s[3])

if(x_max>0 and y_max>0 and x_min>0 and y_min>0):
	print(x_max*y_max)
elif(x_max<0 and y_max < 0 and x_min<0 and y_min < 0):
  	print(x_min * y_min)
elif(x_max < 0 and y_min > 0):
  	print(x_max * y_min)
elif(x_min > 0 and y_max < 0):
  	print(x_min * y_max)
else:
	if(x_min * y_min > x_max * y_max):
		print(x_min * y_min)
	else:
		print(x_max * y_max)

Submission status: Accepted

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

one = list(i[:2])
two = list(i[2:])

tmp = -100000000000000000000

for i in one:
    for j in two:
        ans = i * j
        if ans > tmp:  
            tmp = ans

print(tmp)

Submission status: Accepted

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

ans = [0 for i in range(4)]
ans[0] = a * c
ans[1] = a * d
ans[2] = b * c
ans[3] = b * d
print(max(ans))

Submission status: Accepted

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

W = a*c

if(a*d >= W):
    W = a*d

if(b*c >= W):
    W = b*c

if(b*d >= W):
    W = b*d

print(W)

Submission status: Accepted

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

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

l = [A,B,C,D]
print(max(l))

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = []

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

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:
number = input().split(" ")
a = int(number[0])
b = int(number[1])
c = int(number[2])
d = int(number[3])

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

ans = [x,y,z,s]
ans.sort()
print(ans[3])

Submission status: Accepted

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

ans = []

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

print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__=="__main__":
  l=[int(i) for i in input().split()]
  print(max(l[0]*l[2],l[0]*l[3],l[1]*l[2],l[1]*l[3]))

Submission status: Accepted

Solution code:
n = input()

a, b, c, d = n.split(" ")
a = int(a)
b = int(b)
c = int(c)
d = int(d)

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())
ans = max(a*c, a*d, b*c, b*d)    
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = []

if b <= 0 and d <= 0:
    ans.append(a*c)
if b < 0 and d >= 0:
    ans.append(max(c,1)*b)
if b >= 0 and d < 0:
    ans.append(max(a,1)*d)

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

print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

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

p = [0] * 4

p[0] = a * c
p[1] = a * d
p[2] = b * c
p[3] = b * d

ans = max(p)

print(ans)

Submission status: Accepted

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

ab = [a, b]
cd = [c, d]
lst = []

for i in ab:
    for j in cd:
        lst.append(i * j)

print(max(lst))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
line = input().rstrip().split(" ")
a = int(line[0])
b = int(line[1])
c = int(line[2])
d = int(line[3])

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num = list(map(int, input().split(" ")))
if num[0] >= 0 and num[2] >= 0 or num[0] >= 0 and num[3] >=0 or num[2] >= 0 and num[1] >= 0:
    print(num[1]*num[3])
elif num[1] <= 0 and num[3] <= 0 or num[1] <= 0 and num[2] <=0 or num[0] <= 0 and num[3] <= 0:
    print(num[0]*num[2])
elif num[0] >= 0 and num[3] <= 0:
    print(num[0]*num[3])
elif num[1] <= 0 and num[2] >= 0:
    print(num[1]*num[2])
else:
    if num[0]*num[2] >= num[1]*num[3]:
        print(num[0]*num[2])
    else:
        print(num[1]*num[3])

Submission status: Accepted

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


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

ans=max(x2,x3,x4,x5)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

  a = list(map(int,input().split()))
  
  sum = a[0]*a[2]
  for i in range(0,2):
    for j in range(2,4):
      if sum < a[i]*a[j]:
        sum = a[i]*a[j]
        
  print(sum)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
if __name__ == "__main__":
    a, b, c, d=(int(x) for x in input().split())
    arr = np.array([a*c, a*d, b*c, b*d])
    print(arr.max())

Submission status: Accepted

Solution code:

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

dam=[]
dam.append(a*c)
dam.append(a*d)
dam.append(b*c)
dam.append(b*d)
print(max(dam))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
def main():
    l = list(map(int, input().split()))
    all_pair = []
    all_pair.append(l[0]*l[2])
    all_pair.append(l[0]*l[3])
    all_pair.append(l[1]*l[2])
    all_pair.append(l[1]*l[3])
    print(sorted(all_pair)[-1])
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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())

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

cross_list.sort()
print(cross_list[3])

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
l = [a, b]
k = [c, d]
g = a*c
for i in l:
    for j in k:
        if i*j > g:
            g = i*j
print(g)

Submission status: Accepted

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

print(max(combinations))

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = list(map(int, input().split()))
nums = list()
max_num = int(n[0]*n[3])
for i in range(2):
    for j in range(2):
        num = n[i]*n[j+2]
        if num >= max_num:
            max_num = num
print(max_num)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
l1=[a,b]
l2=[c,d]
ans=[]
for i in range(2):
  for j in range(2):
    ans.append(l1[i]*l2[j])
print(max(ans))

Submission status: Accepted

Solution code:
mod = 10**9 + 7
def C():
    N = int(input())
    ans = 10**N - 2*9**N + 8**N
    print(ans%mod)
def A():
    N = int(input())
    if( N == 0):
        print(1)
    else:
        print(0)
def B():
    a,b,c,d = map(int,input().split())
    print(max(a*c,a*d,b*c,b*d))
B()

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:
import math
a,b,c,d=list(map(int ,input().split()))
l=[]
first_pro=a*c
l.append(first_pro)

second_pro=b*d
l.append(second_pro)

second_pro1=a*d
l.append(second_pro1)

second_pro2=b*c
l.append(second_pro2)
print(int(max(l)))

Submission status: Accepted

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

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

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())
ans = max(a*c, b*c, a*d, b*d)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
a,b,c,d=input2()
x=[a,b]
y=[c,d]
ans=a*c
for i in x:
	for j in y:
		if i*j > ans:
			ans=i*j
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def product_max(lst):
  first = lst[0]*lst[2]
  second = lst[0]*lst[3]
  third = lst[1]*lst[2]
  fourth = lst[1]*lst[3]
  new_list = [first, second, third, fourth]
  return max(new_list)


a,b,c,d = map(int, input().split())
print(product_max([a,b,c,d]))

Submission status: Accepted

Solution code:
if __name__=='__main__':
  a,b,c,d=[int(_) for _ 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().strip().split(" ") ) ; 

v = max ( a* c , a* d , b* c , b * d ) ;
print ( v  ) ;

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 d<0:
    print(a*c)
  else:
    print(max(a*c,b*d))
else:
  if c>=0:
    print(b*c)
  else:
    print(a*c)

Submission status: Accepted

Solution code:
A, B, C ,D = map(int,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())

if a<=0<=b or c<=0<=d:
    print(max(a*c,a*d,b*c,b*d,0))
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()))
y = a*c
x = a*d
w = b*c
v = b*d
e = []
e.append(y)
e.append(x)
e.append(w)
e.append(v)
print(max(e))

Submission status: Accepted

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

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

ans = max(A)

print(ans)

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
if (a>=0) and (b>=0) and (c>=0) and (d>=0): #A
    ans=b*d
elif (b<=0) and (d<=0):#E
    ans=a*c
elif (a<=0) and (b>=0) and (c<=0) and (d>=0):#F
    tmp1=a*c
    tmp2=b*d
    if tmp1>tmp2:
        ans=tmp1
    else:
        ans=tmp2
elif (a>=0) and (b>=0) and (d<=0):#H
    ans=a*d
elif (c>=0) and (d>=0) and (b<=0):#C
    ans=b*c
elif (a<=0) and (b>=0) and (c<=0) and (d<=0):#I
    ans=a*c
elif (a<=0) and (b<=0) and (c<=0) and (d>=0):#D
    ans=a*c
elif (a>=0) and (b>=0) and (c<=0) and (d>=0):#G
    ans=b*d
elif (a<=0) and (b>=0) and (c>=0) and (d>=0):#B
    ans=b*d
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

h = (b*d)
ha=(a*d)
hi=(a*c)
hu=(b*c)

print(max(h,ha,hi,hu))

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,b,c,d = list(map(int , input().split()))
ans = []
ans.append(a*c)
ans.append(a*d)
ans.append(b*d)
ans.append(b*c)
print(max(ans))

Submission status: Accepted

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

for i in aa:
  for j in bb:
    pri.append(i*j)
    
print(max(pri))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

from typing import *



# def solve(a: int, b: int, c: int, d: int) -> int:
def solve(a, b, c, d):
    ans=[a*c, a*d, b*c, b*d]
    return max(ans)

def main():
    a, b, c, d = map(int, input().split())
    a1 = solve(a, b, c, d)
    print(a1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
L = list(map(int, input().split()))
X = L[:2]
Y = L[2:]

# ans = 0
ans_max = -10**20

for x in X:
    for y in Y:
        ans = x * y
        # print(x)
        # print(y)
        if ans > ans_max:
            ans_max = ans

print(ans_max)

Submission status: Accepted

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

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

print(max(tmp))