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


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    a, b, c, d = list(map(int, _in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = -float('inf')
    cnt = max(cnt, a * c)
    cnt = max(cnt, a * d)
    cnt = max(cnt, b * c)
    cnt = max(cnt, b * d)
    ans = cnt
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

if a * b <= 0 or c * d <= 0:
    C.append(0)
kouho = []
for x in A:
    for y in C:
        kouho.append(x * y)
print(max(kouho))

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

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

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

Submission status: Accepted

Solution code:
#import 
#=input()
#=int(input())
a,b,c,d=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]

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

Submission status: Accepted

Solution code:
def ge():
    return map(int,input().split())
def main():
    a,b,c,d=ge()
    #a=list(map(int,input().split()))
    #a=input()
    #a=int(input())
    ans=max(a*c,a*d,b*c,b*d)
    print(ans)

main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if a<=0<=b:
    X=[a,0,b]
else:
    X=[a,b]

if c<=0<=d:
    Y=[c,0,d]
else:
    Y=[c,d]

M=[x*y for x in X for y in Y]
print(max(M))

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:
from sys import stdin
input = stdin.readline

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    ans = -INF

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    import sys
    a,b,c,d=list(map(int,sys.stdin.readline().split()))
    print(max(a*c,b*d,a*d,b*c))

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

Submission status: Accepted

Solution code:
from math import log10

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    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(' '))

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

Submission status: Accepted

Solution code:
def resolve():
    a, b, c, d = map(int, input().split())
    print(max(b*d, a*c, a*d, b*c))
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())
a = max(A*C,A*D)
b = max(B*C,B*D)
c = max(a,b)
print(c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

ans = -INF
for x in [a, b]:
    for y in [c,d]:
        ans = max(ans, x * y)
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
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:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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:
import sys
input = sys.stdin.readline

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

def main():
    mod=10**9+7
    a,b,c,d=MI()
    
    ans=max(a*c,a*d,b*c,b*d)
    print(ans)

main()

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


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

print(max(ans))

Submission status: Accepted

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

Submission status: Accepted

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


main()

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

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

Submission status: Accepted

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)


def main():
    a = list(map(int, input().split()))
    b = -inf
    for i in range(2):
        for j in range(2, 4):
            b = max(b, a[i] * a[j])
    print(b)
main()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a,b,c,d = na()

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

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:
a, b, c, d=map(int, input().split())
a1 = a*c
a2 = a*d
a3 = b*c
a4 = b*d
ans = max(a1, a2, a3, a4)
print(ans)

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

Submission status: Accepted

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log,floor
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a,b,c,d = MAP()

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

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

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

Submission status: Accepted

Solution code:
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    a,b,c,d=map(int,input().split())
    print(max(a*c,a*d,b*c,b*d))

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
# じょえチャンネルおもしろいよ～～～
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

a,b,c,d=map(int,input().split())
aa=[a,b]
if a<=0<=b:aa.append(0)
cc=[c,d]
if c<=0<=d:cc.append(0)
ans=-10**18
for i in aa:
  for j in cc:
    ans=max(ans,i*j)
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:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]
def SR(n):
    return [S() for _ in range(n)]
def LSR(n):
    return [LS() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,c,d = LI()
    ans = max(a*c,a*d,b*c,b*d)
    if ans < 0:
        if a <= 0 and 0 <= b:
            ans = 0
        if c <= 0 and 0 <= d:
            ans = 0
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys
# \n
def input():
    return sys.stdin.readline().rstrip()


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

Submission status: Accepted

Solution code:
from math import gcd

from math import factorial as f

from math import ceil, floor, sqrt
import math

import bisect
import re
import heapq

from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

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

yes = "Yes"
no = "No"


def main():
    a,b,c,d = mi()
    ans = -100000000000000000000
    ans = max(a*c,ans)
    ans = max(b*c,ans)
    ans = max(a*d,ans)
    ans = max(b*d,ans)
    print(ans)




main()

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

a, b, c, d = LI()


def main():
    ans = a * c
    ans = max(ans, a * d)
    ans = max(ans, b * c)
    ans = max(ans, b * d)
    print(ans)


if __name__ == "__main__":
    main()

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**20
for v1 in [a, b]:
    for v2 in [c, d]:
        ans = max(ans, v1 * v2)

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

Submission status: Accepted

Solution code:
import sys
import math
#from queue import *
#import random
#sys.setrecursionlimit(int(1e6))
input = sys.stdin.readline
 
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input()))
def inara():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
################################################################
############ ---- THE ACTUAL CODE STARTS BELOW ---- ############

a,b,c,d=invr()

p=a*c
q=a*d
r=b*c
s=b*d

print(max(p,q,r,s))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a,b,c,d=[int(i) for i in 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())
t = [a * c, a * d, b * c, b * d]
print(max(t))

Submission status: Accepted

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

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

Submission status: Accepted

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


main()

Submission status: Accepted

Solution code:
import sys


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 1
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

a,b,c,d =I()

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

Submission status: Accepted

Solution code:
# coding: utf-8
a, b, c, d = map(int,input().split())
print(max(a*c,a*d,b*c,b*d))

Submission status: Accepted

Solution code:
import collections
import fractions
import itertools
import functools
import bisect
import heapq
import math

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
# ===============================================================================================
# importing some useful libraries.
from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter  # Counter(list)  return a dict with {key: count}
from itertools import combinations as comb  # if a = [1,2,3] then print(list(comb(a,2))) -----> [(1, 2), (1, 3), (2, 3)]
from itertools import permutations as permutate
from bisect import bisect_left as bl
# If the element is already present in the list,

# the left most position where element has to be inserted is returned.
from bisect import bisect_right as br
from bisect import bisect

# If the element is already present in the list,
# the right most position where element has to be inserted is returned

# ==============================================================================================
# fast I/O region

BUFSIZE = 8192
from sys import stderr


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


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

# inp = lambda: sys.stdin.readline().rstrip("\r\n")

# ===============================================================================================
### START ITERATE RECURSION ###
from types import GeneratorType


def iterative(f, stack=[]):
    def wrapped_func(*args, **kwargs):
        if stack: return f(*args, **kwargs)
        to = f(*args, **kwargs)
        while True:
            if type(to) is GeneratorType:
                stack.append(to)
                to = next(to)
                continue
            stack.pop()
            if not stack: break
            to = stack[-1].send(to)
        return to

    return wrapped_func


#### END ITERATE RECURSION ####

# ===============================================================================================
# some shortcuts

mod = 1000000007


def inp(): return sys.stdin.readline().rstrip("\r\n")  # for fast input


def out(var): sys.stdout.write(str(var))  # for fast output, always take string


def lis(): return list(map(int, inp().split()))


def stringlis(): return list(map(str, inp().split()))


def sep(): return map(int, inp().split())


def strsep(): return map(str, inp().split())


def zerolist(n): return [0] * n


def nextline(): out("\n")  # as stdout.write always print sring.


def testcase(t):
    for p in range(t):
        solve()


def printlist(a):
    for p in range(0, len(a)):
        out(str(a[p]) + ' ')


def pow(x, y, p):
    res = 1  # Initialize result
    x = x % p  # Update x if it is more , than or equal to p
    if (x == 0):
        return 0
    while (y > 0):
        if ((y & 1) == 1):  # If y is odd, multiply, x with result
            res = (res * x) % p

        y = y >> 1  # y = y/2
        x = (x * x) % p
    return res


from functools import reduce


def factors(n):
    return set(reduce(list.__add__,
                      ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))


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


# =========================================================================================

def solve():
    a,b,c,d=sep()
    A=max(a*c,a*d,b*c,b*d)
    print(A)



solve()
# testcase(int(inp()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
## coding: UTF-8

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

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

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 1 << 60


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, C, D):
    ans = -INF
    ans = max(ans, A * C)
    ans = max(ans, A * D)
    ans = max(ans, B * C)
    ans = max(ans, B * D)


    return ans


def main():
    A, B, C, D = read_int_n()
    print(slv(A, B, C, D))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

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

# main()
print(main())

Submission status: Accepted

Solution code:
#create date: 2020-09-13 21:01

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    a, b, c, d = na()
    print(max(a*c, b*d, a*d, b*c))

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:
import sys
input = sys.stdin.readline

#l = list(map(int, input().split()))
#import numpy as np
#arr = np.array([int(i) for i in input().split()])
'''
a,b=[],[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

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