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

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

Submission status: Accepted

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

a1 = a * c
a2 = a * d
b1 = b * c
b2 = b * d

print(max([a1, a2, b1, b2]))

Submission status: Accepted

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

ans = -float("inf")

ans = max(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())

l = [0]*4

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


print(max(l))

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
X=[ac,ad,bc,bd]

print(max(X))

Submission status: Accepted

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


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
b = l = [0] * 4
b[0] = a[0]*a[2]
b[1] = a[0]*a[3]
b[2] = a[1]*a[2]
b[3] = a[1]*a[3]
print(max(b))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

diff1 = b - a
diff2 = d - c
l1 = [a, b]
l2 = [c,d]
# if diff1 >= 0 and diff2 >= 0:
#     print(b * d)
# elif
m = 0
sl = []
for i in range(len(l1)):
    for j in range(len(l2)):
        s = l1[i] * l2[j]
        sl.append(s)
        m = max(m, s)
b = False
for l in sl:
    if l > 0:
        b = True

if b == False:
    print(max(sl))
else:
    print(m)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b, c, d = [int(i) for i in input().split()]
nums = [a, b, c, d]

if a < 0 and b < 0 and 0 < c and 0 < d:
  print(b * c)
  exit(0)
if c < 0 and d < 0 and 0 < a and 0 < b:
  print(d * a)
  exit(0)


minus_num = len([i for i in nums if i < 0])
if minus_num == 4:
  print(a * c)
  exit(0)
if minus_num == 1 or minus_num == 0:
  print(b * d)
  exit(0)

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())
res = []
res.append(a * c)
res.append(a * d)
res.append(b * c)
res.append(b * d)
print(max(res))

Submission status: Accepted

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

AB = [a, b]
CD = [c, d]

ans = -10 ** 19
for ab in AB:
    for cd in CD:
        ans = max(ans, ab * cd)
print(ans)

Submission status: Accepted

Solution code:
i = list(map(int,input().split()))
a = i[0]
b = i[1]
c = i[2]
d = i[3]
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:
    print(b * d)

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

elif a >= 0 and d <= 0:
    print(a * d)

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

Submission status: Accepted

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

    max_val = -10**18

    for i in [a,b]:
        for j in [c,d]:
            max_val = max(max_val,i*j)
    
    print(max_val)

solve()

Submission status: Accepted

Solution code:
def LI():
    return list(map(int, input().split()))


a, b, c, d = LI()

ans = a*c
ans = max(ans, a*d)
ans = max(ans, b*c)
ans = max(ans, b*d)
if a == 0:
    if b != 0:
        ans = max(ans, c)
        ans = max(ans, d)
if b == 0:
    if a != 0:
        ans = max(ans, -1*c)
        ans = max(ans, -1*d)
if c == 0:
    if d != 0:
        ans = max(ans, a)
        ans = max(ans, b)
if d == 0:
    if c != 0:
        ans = max(ans, -1*a)
        ans = max(ans, -1*b)

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

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*c,a*d,b*c,b*d]

print(max(x))

Submission status: Accepted

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

results = []
for i in [0, 1]:
    for j in [2, 3]:
        results.append(num_list[i] * num_list[j])

print(max(results))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, d = list(map(int, input().split()))
k = a * c
kk = a * d
kkk = b * c
kkkk = b * d
print(max(k,kk,kkk,kkkk))

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
a,b,c,d=map(int, input().split())

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

print(result)

Submission status: Accepted

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

if (a <= 0 and b >= 0) or (c <= 0 and d >= 0):
    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 = map(int, input().split())
x = [0,0,0,0]
x[0] = a * c
x[1] = a * d
x[2] = b * c
x[3] = b * d

print(max(x))

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline
# ~ T = int(input())
T = 1
for t in range(1,T + 1):
	a,b,c,d = map(int,input().split())
	print(max(a * c,max(b * d,max(a * d,b * c))))

Submission status: Accepted

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

Submission status: Accepted

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

l1 = a*c
l2 = a*d
l3 = b*c
l4 = b*d
l = [l1, l2, l3, l4]
max_l = max(l)

print (max_l)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
ans = -float('inf')
alist = [a,b]
blist = [c,d]
if a >= 0 and b <= 0:
    alist.append(0)
if a<= 0 and b >= 0:
    alist.append(0)
if c >= 0 and d <= 0:
    blist.append(0)
if c <= 0 and d >= 0:
    blist.append(0)
for i in [a,b]:
    for j in [c,d]:
        ans = max(ans,i*j)

print(ans)

Submission status: Accepted

Solution code:
str = input().split()
a,b,c,d = [int(i) for i in str]

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

print(max(ans_list))

Submission status: Accepted

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

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

Submission status: Accepted

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

XY=[]

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

print(max(XY))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    a,b,c,d = LI()

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



if __name__ == '__main__':
    main()

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:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

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

ans1 = a * c
ans2 = a * d
ans3 = b * c
ans4 = b * d
print(max(ans1, ans2, ans3, ans4))

Submission status: Accepted

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

s=[]

s.append(a*c)
s.append(a*d)
s.append(b*c)
s.append(b*d)
if (a<=0 and b>=0) or (c<=0 and d>=0):
  s.append(0)
s.sort()

print(s[-1])

Submission status: Accepted

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

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

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:
def solve():
    a, b, c, d = map(int, input().split())

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

    list = sorted(list)

   # print(list)

    print(list[3])


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

# a b c d
# - - - -
# - - - +
# - - + +
# - + - -
# - + - +
# - + + +
# + + - -
# + + - +
# + + + +

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=list(map(int,input().split()))
b=a[0]*a[2]
c=a[0]*a[3]
d=a[1]*a[2]
e=a[1]*a[3]
print(max(b,c,d,e))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

one = [a, b]
two = [c, d]

ans = a * c

for i in one:
    for j in two:
        ans = max(i*j, ans)
        
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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)
print(max(L))

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
list1=[a,b]
list2=[c,d]
ans=-1*10**100
tmp=0
for i in list1:
    for j in list2:
        tmp=i*j
        if ans<tmp:
            ans=tmp
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    probB()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = input()
arr = [int(i)  for i in a.split()]

sum = []
sum.append(arr[0]*arr[2])
sum.append(arr[0]*arr[3])
sum.append(arr[1]*arr[2])
sum.append(arr[1]*arr[3])
print(max(sum))

Submission status: Accepted

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

ans = -float('inf')
for x in [a, b]:
    for y in [c, d]:
        tmp = x * y
        if tmp > ans:
            ans = tmp
print(ans)

Submission status: Accepted

Solution code:
import sys


def main():
    a, b, c, d = map(int, sys.stdin.readline().rstrip().split())

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

    if (a <= 0 and 0 <= b) or (c <= 0 and 0 <= d):
        print(max(ac, bc, ad, bd, 0))
    else:
        print(max(ac, bc, ad, bd))


main()

Submission status: Accepted

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

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

Submission status: Accepted

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

# process
ans = -10**18
t = a*c
if ans < t:
    ans = t
t = a*d
if ans < t:
    ans = t
t = b*c
if ans < t:
    ans = t
t = b*d
if ans < t:
    ans = t

# output
print(ans)

Submission status: Accepted

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

print(max_value)

Submission status: Accepted

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

if 0 < a and 0 < c:
  # 両方正
  print(b * d)
elif b <= 0 and d <= 0:
  # 両方負
  print(a * c)
else:
  # 片方が負
  # 区間に0を含む場合
  print(max(a * c, a * d, b * c, b * d))

Submission status: Accepted

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

Submission status: Accepted

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

_list_multi = [_list[0]*_list[2], _list[0]*_list[3], _list[1]*_list[2], _list[1]*_list[3]]
print(max(_list_multi))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def p(val):
    print(val)


x =  list(map(int,input().split()))
a=[x[0],x[1]]
b=[x[2],x[3]]
a1 = max(a)
b1 = max(b)
c=[x[0]*x[2],x[0]*x[3],x[1]*x[2],x[1]*x[3]]
p(max(c))

Submission status: Accepted

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

A = max(a*c, a*d)
B = max(b*c, b*d)
print(max(A, B))

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:
import math

#N = int(input())
A = list(map(int, input().split()))
B = list()
for i in range(2):
    for j in range(2):
        B.append(A[i]*A[j+2])

print('{}'.format(max(B)))

Submission status: Accepted

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

ans.append(num[0]*num[2])
ans.append(num[0]*num[3])
ans.append(num[1]*num[2])
ans.append(num[1]*num[3])

print(max(ans))

Submission status: Accepted

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

ans = a*c

for i in [a,b]:
  for j in [c,d]:
    tmp = i*j
    if tmp > ans:
      ans = tmp
print(ans)

Submission status: Accepted

Solution code:
a,b,c,d = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
def MAX(n,m):
  if n >= m:
    return n
  else:
    return m
x1 = MAX(a*c,a*d)
x2 = MAX(b*c,b*d)
print(MAX(x1,x2))

Submission status: Accepted

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

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:
#!/usr/bin/env python3

import sys
input=sys.stdin.readline

a,b,c,d=map(int,input().split())
ans=-10**18
#x=0 or y=0
if a<=0<=b or c<=0<=d:
    ans=max(ans,0)
#x<0 and y>0
ans=max(ans,b*c)
#x>0 and y>0
ans=max(ans,b*d)
#x<0 and y<0
ans=max(ans,a*c)
#x>0 and y<0
ans=max(ans,a*d)
print(ans)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
ans = a*c
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())
x = [a*c,a*d,b*c,b*d]
x.sort(reverse=True)
print(x[0])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(1000000)
from collections import deque

# スペース区切りの整数の入力
a, b, c, d = map(int, input().split())

t1 = a*c
t2 = a*d
t3 = b*c
t4 = b*d

print(max(t1, t2, t3, t4))
# if b <= 0 and d <= 0:
#     print(a*c)
# elif b < 0 and d > 0:
#     print(b*c)
# elif b >0 and d < 0:
#     print(a*d)
# else:
#     print(b*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())
Max = max(a*c, a*d, b*c, b*d)
print(Max)

Submission status: Accepted

Solution code:
a,b,c,d = list(map(int,input().split()))
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:
a,b,c,d = map(int, input().split())
print(max(a*c,b*d,a*d,b*c))

Submission status: Accepted

Solution code:
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
mod = 10**9 + 7

#maincode-------------------------------------------------

a,b,c,d = inm()
x = [a,b]
y = [c,d]
ans = a*c
for i in x:
    for j in y:
        ans = max(ans,i*j)

print(ans)

Submission status: Accepted

Solution code:
# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop, heapify
import copy
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    a,b,c,d = map(int, input().split())
    max = -1000000000000000000000000000
    for x in [a, b]:
        for y in [c, d]:
            if x*y > max:
                max = x*y
    print(max)
        
        

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,c,d = map(int, input().split())
List = [a,b,c,d]
tmp = a*c
for i in range(0,2):
    for j in range(2,4):
        tmp= max(List[i]*List[j],tmp)

print(tmp)

Submission status: Accepted

Solution code:
import itertools

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

num = None
for x, y in itertools.product([a, b], [c, d]):
  if num == None:
    num = x * y
  else:
    num = max(num, x * y)

print(num)

Submission status: Accepted

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

max = li[0] * li[2]
for x in range(2):
    for y in range(2,4):
        if li[x] * li[y] > max:
            max = li[x] * li[y]
print(max)

Submission status: Accepted

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

x = a[0]
y = a[1]
z = a[2]
v = a[3]

A = x*z
B = x*v
C = y*z
D = y*v

A = max(A, B, C, D)
print(A)

Submission status: Accepted

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

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:
#!/usr/bin/env python3



numbers = input().split(" ")

x = [int(numbers[0]), int(numbers[1])]
y = [int(numbers[2]), int(numbers[3])]

if(int(numbers[0]) < 0 and int(numbers[1]) > 0):
    x.append(0)
if(int(numbers[2]) < 0 and int(numbers[3]) > 0):
    y.append(0)

xy = x[0] * y[0]

for xx in x:
    for yy in y:
        if xx * yy > xy:
            xy = xx * yy

print(xy)

Submission status: Accepted

Solution code:
a,b,c,d=map(int,input().split())
p=[a,b]
q=[c,d]
e=[]
for l in range(2):
    for k in range(2):
        e.append(p[l]*q[k])
print(max(e))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input().split()

a = int(N[0])
b = int(N[1])
c = int(N[2])
d = int(N[3])
q = a * c 

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

print(q)

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


            
print(max(A, B, C, D))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin,stdout
# n=int(stdin.readline())
a,b,c,d=list(map(int,stdin.readline().split()))
ans=max(a*c,a*d,b*c,b*d)
print(ans)

Submission status: Accepted

Solution code:
#coding: utf-8

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

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

if a <= 0 and b >= 0:
    ret = max(ret, 0)
if c <= 0 and d >= 0:
    ret = max(ret, 0)

print(ret)

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:
import sys

input = sys.stdin.readline

a, b, c, d= map(int, input().split())
ac = a*c
ad = a*d
bc = b*c
bd = b*d
max_1 = max(ac,ad)
max_2 = max(bc,bd)
ans = max(max_1,max_2)
print(ans)

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
ans1 = b*d
ans2 = a*c
ans3 = a*d
ans4 = b*c
ans = max(ans1,ans2,ans3,ans4,)
if 0 in range(a,b+1) or 0 in range(c,d+1):
  if 0 > ans:
    ans =0
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys


def main():
    a,b,c,d = list(map(int, sys.stdin.readline().split()))

    max_calc = -float("inf")

    for i in [a,b]:
        for j in [c,d]:
            max_calc = max(max_calc, i*j)
    
    
    print(max_calc)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = -(10 ** 18)
for i in range(2):
  for j in range(2):
    p = a[i] * a[j+2]
    ans = max(ans,p)

print(ans)

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
print(max(A,B,C,D))

Submission status: Accepted

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


num = a[0]*a[2]

if a[0]*a[3] > num:
  num = a[0]*a[3]

if a[1]*a[2] > num:
  num = a[1]*a[2]

if a[1]*a[3] > num:
  num = a[1]*a[3]


print(num)

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()))
res1 = a[0]*a[2]
res2 = a[0]*a[3]
res3 = a[1]*a[2]
res4 = a[1]*a[3]
res = [res1,res2,res3,res4]
print(max(res))

Submission status: Accepted

Solution code:
def main():
    a, b, c, d = map(int, input().split())
    top = b * d
    bottom = a * c
    crossA = a * d
    crossC = b * c
    print(max(top, bottom, crossA, crossC))
main()

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:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B_fix
# CreatedDate:  2020-09-13 21:10:13 +0900
# LastModified: 2020-09-13 21:11:45 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    a, b, c, d = map(int, input().split())
    unko = []
    unko.append(a*c)
    unko.append(a*d)
    unko.append(b*c)
    unko.append(b*d)
    print(max(unko))



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-

import sys

def main():
    a,b,c,d = map(int,input().split())
    print(max(a*c,a*d,b*c,b*d))
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split(' '))
# -100 100 	-200 200
# 0 100 	1 100
# -100 -50 	100 100
# -100 -50	-5 -10
r1 = a * c
r1 = max(r1, a * d)
r1 = max(r1, b * c)
r1 = max(r1, b * d)
print(r1)