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:
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
# from fractions import *
# from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
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")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=10**9+7
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]


#-------------------------code---------------------------#
#vsInput()


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

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

print(ans)

Submission status: Accepted

Solution code:


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

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:
l = list(map(int,input().split()))
mx = float('-inf')

for i in range(2):
  for j in range(2,4):
    mx = max(mx,l[i]*l[j])
print(mx)

Submission status: Accepted

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

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

max = ac
if max<ad:
  max = ad
if max<bc:
  max = bc
if max<bd:
  max = bd
      
print(max)

Submission status: Accepted

Solution code:
def ri():
    return int(input())


def rii():
    return [int(v) for v in input().split()]


def solve(*args):
    a, b, c, d = args
    return max(a * c, a * d, b * c, b * d)


if __name__ == "__main__":
    print(solve(*rii()))

Submission status: Accepted

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

  max1 = max(a[0], a[1])
  min1 = min(a[0], a[1])
  max2 = max(a[2], a[3])
  min2 = min(a[2], a[3])
  result = [max1 * max2, max1 * min2, min1 * max2, min1 * min2]

  return max(result)

if __name__ == '__main__':
  print(a())

Submission status: Accepted

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

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

b = []
b.append(A[0]*A[2])
b.append(A[1]*A[2])
b.append(A[0]*A[3])
b.append(A[1]*A[3])

print(max(b))

Submission status: Accepted

Solution code:
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()

    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
rrmm = lambda n: [rrm() for _ in xrange(n)]

####
MOD = 10**9 + 7
YES, NO, IMP = "YES", "NO", "IMPOSSIBLE"
from collections import defaultdict as ddic

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

Submission status: Accepted

Solution code:
# B 
z = list(map(int, input().split(" ")))
maxnum = z[0]*z[2]
for i in range(2):
    for j in range(2):
        x = z[i]
        y = z[j+2]
        prod = x*y
        # print(x, y, prod, maxnum, prod > maxnum)
        if prod > maxnum:
            maxnum = prod
print(maxnum)

Submission status: Accepted

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

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

print(mx)

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

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

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

print(ans)

Submission status: Accepted

Solution code:
#解説配信メモ　ac,ad,bc,bdの最大を出力すればOK
def get_int():
  return list(map(int,input().split()))
a,b,c,d=get_int()
ans=max(a*c,a*d,b*c,b*d)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
'''
Problem Link - https://atcoder.jp/contests/abc178/tasks/abc178_b
'''
from sys import stdin,stdout
from math import *
from collections import *

mod = 1000000007

def gcd(a,b):
	while b:
		a,b = b,a%b
	return a

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

def set_bits(X):
	c = 0
	while X:
		X &= (X-1);c += 1
	return c

def compute_MOD(N,M): return (N%M + M) % M

def get_array(): return list(map(int, stdin.readline().split()))
 
def get_ints(): return map(int, stdin.readline().split())

def get_int(): return int(stdin.readline())

def get_input(): return stdin.readline().strip()

def main():
	a,b,c,d = get_ints()
	stdout.write(str(max(a*c,a*d,b*c,b*d))+'\n')

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin
readline = stdin.readline

def i_input(): return int(readline().rstrip())
def i_map(): return map(int, readline().rstrip().split())
def i_list(): return list(i_map())

def main():
    A, B, C, D = i_map()
    print(max([A * C, A * D, B * C, B * D]))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main() -> None:
    a, b, c, d = map(lambda x: int(x), 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())
maxxy=max(a*c,a*d,b*c,b*d)
print(maxxy)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a, b, c, d = map(int, input().split())
 
# 最大値の候補は {ac, ad, bc, bd} の４通り
print(max(max(a*c, a*d), max(b*c, b*d)))

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

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

Submission status: Accepted

Solution code:
import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline

# input functions
I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda: list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
# This code is generated by [Atcoder_base64](https://github.com/kyomukyomupurin/AtCoder_base64)
# Original source code : 

"""
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

#define all($) begin($), end($)
#define rall($) rbegin($), rend($)

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int64 a, b, c, d; cin >> a >> b >> c >> d;
  cout << max({a * c, a * d, b * c, b * d}) << endl;

  return 0;
}

"""

import base64
import subprocess
import zlib


exe_bin = "c$~die{5UD9Y5P~;<Sn5h89B0R<ER5QWO)nX>iwd#7^8kZ%*2#4(k~0^~HATM;$w|pTX(a<|zfu3t<srsA$@Rs5F7JA0Qz#ZAeQS1lz>4^p9;!FsV#{5(Fbt`O&d8-uLd^+3%g-8w^dm$oby)bKmdx?!Nc?`@R{D?zh`)h$jd70;1eHjUQn6!j`HCU;)$&|38IpK#jmR=;TCt#b%_gYCW1>z^?Hky#X1iO-G%`I$dcoQiQx!J<`@xtA?gpy$1R?tGB~x)Uz|a64NU&c}@}2<COQWf&F3(7wHf((gsEky{;xm{-O06FH$SL!=TrQK7R5rI?C#^^2=G)UQYQq+?-a%`}=NACwkIKrcmrD2KsyY`+WJVZzpY&hshoo8Kd%Kyt%7L`9_A3@|8y}w|?-M*tzoUC$>f3yYR#l6TjR^WZkGXZeY=F15G!xvGHunVE*AIZn7>t1;2I^{I?ePC{(n~1Rt}I58KS~J`4OU3p*|g`K^f0Kx2|E<UJPhdoA!sEZXA*`x{UP8t`aZ9yZ|fNW)KT(C`jE5nvwV)kOTJo5<MrBaBZ@W-~ai$~hHdgd?$GoJi)9CzZUK%*BQW)7eZiCXc6+TA6vt?MKwUWG0c0#E+<ce>^4Uu$q$<H6MwG!=r%h8kh4*9B1=tE-6n&VmQ`|!$<ltRoxX=GLRWLq6U;~9)oDIFOpHzA%FNTif8xWVXS2G$($M~5`)<o78Lxu^V69)zFSdK(3ymi4Uba^#or6M$s#l-&XkqWI&E6rpjI7pC7vy)#8GkXBXCdr6pp7(;R#tu0}wCDSXProMP<x{l9AKOY48Omip-&tGW6^~G!h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u"], shell=True)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(10000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

if __name__ == "__main__":
    a,b,c,d = map(int,input().split())
    e = a*c
    f = a*d
    g = b*c
    h = b*d
    ans = max(e,f)
    ans = max(ans,g)
    ans = max(ans,h)
    print(ans)

Submission status: Accepted

Solution code:
#import sys
#input = sys.stdin.readline
def main():
    a, b ,c, d = map( int, input().split())
    A = [a*c, a*d, b*c, b*d]
    if a < b:
        A.append((a+1)*c)
        A.append((b-1)*c)
        A.append((a+1)*d)
        A.append((b-1)*d)

    if c < d:
        A.append(a*(c+1))
        A.append(a*(d-1))
        A.append(b*(c+1))
        A.append(b*(d-1))

    if a < b and c < d:
        A.append((a+1)*(c+1))
        A.append((a+1)*(d-1))
        A.append((b-1)*(c+1))
        A.append((b-1)*(d-1))

    print(max(A))
        
            


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

x = [a, b]
y = [c, d]
if a <= 0 <= b:
    x.append(0)
if c <= 0 <= d:
    y.append(0)

ans = -10 ** 19
for p in x:
    for q in y:
        ans = max(ans, p * q)

print(ans)

Submission status: Accepted

Solution code:
import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


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


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


def MF(): return map(float,input().split())


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


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	a,b,c,d=MI()
	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())
x = a*c
if b*d > x:
  x = b*d
if a*d > x:
    x = a*d
if b*c > x:
    x = b*c
print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    a, b, c, d = list(map(int, input().split()))
    ans = - 10 ** 19

    for x in (a, b):
        for y in (c, d):
            ans = max(ans, x * y)

    print(ans)

resolve()

Submission status: Accepted

Solution code:

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

    res1 = a * c
    res2 = a * d
    res3 = b * c
    res4 = b * d

    print(max(res1, res2, res3, res4))


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
# B 
a, b, c, d = list(map(int, input().split(" ")))
numlist = [a*c, a*d, b*c, b*d]
maxnum = max(numlist)
print(maxnum)

Submission status: Accepted

Solution code:
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    a, b, c, d = map(int, input().split())
    print(max(a * c, a * d, b * c, b * d))
resolve()

Submission status: Accepted

Solution code:
a,b,c,d = map(int,input().split())
A = set()
B = set()
A.add(a)
A.add(b)
B.add(c)
B.add(d)
for i in {-1,0,1}:
    A.add(i)
    B.add(i)

o = set()
for j in A:
    for k in B:
        if a <= j <= b and c <= k <= d:
            o.add(j*k)
print(max(o))

Submission status: Accepted

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

Submission status: Accepted

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

hoge = []
hoge.append(a*c)
hoge.append(a*d)
hoge.append(b*c)
hoge.append(b*d)

print(max(hoge))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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]
ans=-10**30
for x in X:
    for y in Y:
        if ans<x*y:
            ans=x*y
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([a*c, b*d, a*d, b*c]))

Submission status: Accepted

Solution code:
def resolve():
    a, b, c, d = map(int, input().split())
    ans = [a * c, b * d]
    if (a <= 0) ^ (0 <= b):
        ans.append(b * c)
        ans.append(a * d)
    else:
        ans.append(0)
    if (c <= 0) ^ (0 <= d):
        ans.append(b * c)
        ans.append(a * d)
    else:
        ans.append(0)
    print(max(ans))


if __name__ == '__main__':
    resolve()

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())
ac = a * c
ad = a * d
bc = b * c
bd = b * d
ans_1 = max(ac,ad)
ans_2 = max(bc, bd)
ans = max(ans_1, ans_2)
print(ans)

Submission status: Accepted

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

import itertools

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

print(max_xy)

Submission status: Accepted

Solution code:
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


ans = n[1] * n[3]
ans = max(n[0]*n[2],ans)
ans = max(n[0]*n[3],ans)
ans = max(n[1]*n[2],ans)
ans = max(n[1]*n[3],ans)
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)

z1 = a*c
z2 = a*d
z3 = b*c
z4 = b*d

l = [z1, z2, z3, z4]
max_value = max(l)
print(max_value)

Submission status: Accepted

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

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

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)

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)

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

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

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

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    a, b, c, d = map(int, input().split())
    if a >= 0:
        if b >= 0:
            if c >= 0:
                return b * d
            
            if d >= 0:
                return max(a*c, b*d)
            return a * d
    else:
        if b >= 0:
            if c >= 0:
                return b * d
            if d >= 0:
                return max(a*c, b*d)
            return a * c
        if c >= 0:
            return b * c
        if d >= 0:
            return a * c
        return a * c

if __name__ == "__main__":
    print(main())

Submission status: Accepted

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

M = max(a*c, a*d, b*c, b*d)
print(str(M))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

r = [ i[0]*i[2], i[1]*i[2], i[0]*i[3], i[1]*i[3] ]

print(max(r))

Submission status: Accepted

Solution code:
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:
array = list(map(int, input().strip().split()))
l = len(array)
list = []
if(l==4):
	ac=array[0]*array[2]
	ad=array[0]*array[3]
	bc=array[1]*array[2]
	bd=array[1]*array[3]

	list.append(ac)
	list.append(ad)
	list.append(bc)
	list.append(bd)

	print(max(list))

else:
  print("")

Submission status: Accepted

Solution code:
nums=[int(e) for e in input().split()]
if nums[0]>=0 and nums[1]>=0 and nums[2]>=0 and nums[3]>=0:
    print(nums[1]*nums[3])
elif nums[0]>=0 and nums[1]>=0 and nums[2]<0 and nums[3]>=0:
    print(nums[1]*nums[3])
elif nums[0]>=0 and nums[1]>=0 and nums[2]<0 and nums[3]<0:
    print(nums[0]*nums[3])
elif nums[0]<0 and nums[1]>=0 and nums[2]>=0 and nums[3]>=0:
    print(nums[1]*nums[3])
elif nums[0]<0 and nums[1]>=0 and nums[2]<0 and nums[3]>=0:
    if abs(nums[0])*abs(nums[2]) > abs(nums[1])*abs(nums[3]):
        print(nums[0]*nums[2])
    elif abs(nums[0])*abs(nums[2]) <= abs(nums[1])*abs(nums[3]):
        print(nums[1]*nums[3])
elif nums[0]<0 and nums[1]>=0 and nums[2]<0 and nums[3]<0:
    print(nums[0]*nums[2])
elif nums[0]<0 and nums[1]<0 and nums[2]>=0 and nums[3]>=0:
    print(nums[1]*nums[2])
elif nums[0]<0 and nums[1]<0 and nums[2]<0 and nums[3]>=0:
    print(nums[0]*nums[2])
elif nums[0]<0 and nums[1]<0 and nums[2]<0 and nums[3]<0:
    print(nums[0]*nums[2])

Submission status: Accepted

Solution code:
import math

def a():
    x = int(input())
    if x == 0:
        print(1)
    else:
        print(0)


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



def c():
    pass



def d():
    pass


# a()
b()
# c()
# d()

Submission status: Accepted

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

a,b,c,d = mi()

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

print(max(l))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a, b, c, d = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
A = []
w = a * c
x = a * d
y = b * c
z = b * d
A.append(w)
A.append(x)
A.append(y)
A.append(z)
B = max(A)
print(B)

Submission status: Accepted

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

if b >= 0 and d >= 0 and a <= 0 and c <= 0:# - + - + = +
    e = b*d
    f = a*c
    if e > f:
        print(e)
    else:
        print(f)
elif a >= 0 and b >= 0 and c >= 0 and d >= 0: #+ + + +
    print(b*d)
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*d)
elif a >= 0 and b >= 0 and c <= 0 and d >= 0: # + + - +
    print(b*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: # - - - +
    print(a*c)
elif a <= 0 and b >= 0 and c >= 0 and d >= 0: # - + + +
    print(b*d)
elif a <= 0 and b >= 0 and c <= 0 and d <= 0: # - + - -
    print(a*c)

Submission status: Accepted

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

e = a * c
f = a * d
g = b * c
h = b * d
num_max = max([e, f, g, h])
print(num_max)

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