TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
q, h, s, d = map(int, input().split())
n = int(input())
ql = 4*q
hl = 2*h
dl = d/2
print(n//2*2*(min(ql, hl, s, dl))+n%2*min(ql, hl, s))

q, h, s, d = map(int, input().split())
n = int(input())
ql = 4*q
hl = 2*h
dl = d/2
if n%2==0:
    print(n*(min(ql, hl, s, dl)))
else:
    print((n-1)*(min(ql, hl, s, dl))+min(ql, hl, s))

q, h, s, d = map(int, input().split())
n = int(input())
print(n//2*(min(8*q, 4*h, 2*s, d))+n%2*min(4*q, 2*h, s))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
Q,H,S,D = map(int,input().spllit())
N = int(input())

h = min(2*Q,H)
s = min(2*h,S)
d = min(2*s,D)

print((N//2)*d + (N%2)*s)

Q,H,S,D = map(int,input().spllit())
N = int(input())

h = min(H , 2*Q)
s = min(2*h,S)
d = min(2*s,D)

if N % 2 == 0:
  print((N//2 * d))
else:
  print((N//2)*d + s)

Q,H,S,D = map(int,input().spllit())
N = int(input())

h = min(H , 2*Q)
s = min(2*h,S)
d = min(2*s,D)

print((N//2)*d + (N%2)*s)

Q,H,S,D = map(int,input().spllit())
N = int(input())

h = min(H , 2*Q)
s = min(2*h,S)
d = min(2*s,D)

if N % 2 == 0:
  print((N//2 * d))
else:
  print((N//2)*d + s)

Q,H,S,D = map(int,input().split())
N = int(input())
h = min(2*Q,H)
s = min(2*h,S)
d = min(2*s,D)
print((N//2)*d + (N%2)*s)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())

if M[0]==min(M):
    print(N*M[0])
elif M[1]==min(M):
    print(N*M[1])
elif M[2]==min(M):
    print(N*M[2])
else:
    if N%2==0:
        print(int(N//2*int(M[3]*2))
    else:
        if M[0]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[0])
        elif M[1]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[1])
        elif M[2]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[2])


a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())

if M[0]==min(M):
    print(N*M[0])
elif M[1]==min(M):
    print(N*M[1])
elif M[2]==min(M):
    print(N*M[2])
else:
    if N%2==0:
        print(int(N*M[3]))
    else:
        if M[0]==min(M):
            print(N//2*int(M[3]*2)+M[0])
        elif M[1]==min(M):
            print(N//2*int(M[3]*2)+M[1])
        elif M[2]==min(M):
            print(N//2*int(M[3]*2)+M[2])


a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())

if M[0]==min(M):
    print(N*M[0])
elif M[1]==min(M):
    print(N*M[1])
elif M[2]==min(M):
    print(N*M[2])
else:
    if N%2==0:
        print(int(N//2*int(M[3]*2)))
    else:
        if M[0]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[0])
        elif M[1]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[1])
        elif M[2]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[2])


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
Q, H, S, D = map(int, input().split())
N = int(input())

A = min(Q*4, H*2, S)
if N % 2 == 0:
    print(min(A*N, D*N//2))
else:
    print(min(A*N, D*(N+1)//2, D*N//2+A))

Q, H, S, D = map(int, input().split())
N = int(input())

A = min(Q*4, H*2, S)
if N % 2 == 0:
    print(min(A*N, D*N//2))
else:
    if N == 1:
        print(A)
    else:
        print(min(A*N, D*(N//2)+A))


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
Q, H, S, D = map(int, input().split())
N = int(input())

ans = 0
for w in range(N//2+1):
    for z in range(N-2*w+1):
        for y in range(2*(N-2*w-z)+1):
            x = 4 * (N - 2*w - z - y//2)
            ans = min(ans, Q*x + H*y + S*z + D*w)

print(ans)


Q, H, S, D = map(int, input().split())
N = int(input())

two_l = min(8*Q, 4*H, 2*S, D)
one_l = min(4*Q, 2*H, S)

ans = (N//2)*two_l + (N%2)*one_l
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
q, h, s, d = map(int, input().split())
n = int(input())

Q = q / 0.25
H = h / 0.5
S = s
D = d / 2.0

if n == 1:
    print(min(Q, H, S))
else:
    if min(Q, H, S) <= D:
        print(n * min(Q, H, S))
    else:
        x, y = divmod(n, 2)
        print(x * 2 * D + y * min(Q, H, S))

q, h, s, d = map(int, input().split())
n = int(input())

Q = q * 4
H = h * 2
S = s
D = d / 2

if n == 1:
    print(int(min(Q, H, S)))
else:
    if min(Q, H, S) <= D:
        print(int(n * min(Q, H, S)))
    else:
        print((n // 2) * d + (n % 2) * min(Q, H, S))

Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
volume = [1,2,4, 8]
value = tuple(map(int, input().split())
N = int(input())

counts = [10**10 for _ in range(N*4 + 1)]
counts[0] = 0

for i in range(4):
    for n in range(volume[i], N*4+1):
        counts[n] = min(counts[n], counts[n-volume[i]] + value[i])

print(counts[-1])

# -*- coding: utf-8 -*-
def inpl(): return tuple(map(int, input().split()))

volume = [1, 2, 4, 8]
value = {k:v for k, v in zip(volume, inpl())}
cosp = {k:v/k for k, v in value.items()}
N = int(input())
N = N*4
res = 0

for k, _ in sorted(cosp.items(), key=lambda x: x[1]):
    res += (N // k)*value[k]
    N = N % k
print(int(res))

Verdicts: Runtime Error

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
# coding: utf-8
# Your code here!
cost=list(map(int,input().split()))

for i in range(4):
    cost[i]/=2**(i-2)

N=int(input())

if min(cost)==cost[3]:
    print(((N//2*2)*cost[3]+(N%2)*min(cost[:3])))
else:
    print((min(cost)*N))

# coding: utf-8
# Your code here!
Q,H,S,D=map(int,input().split())
N=int(input())
temp=min(4*Q,2*H,S,D/2)

if temp!=D/2:
    print(N*temp)
else:
    if N%2==1:
        print(((N-1)*temp+min(4*Q,2*H,S)))
    else:
        print((N*temp))

    



# coding: utf-8
# Your code here!
Q,H,S,D=map(int,input().split())
N=int(input())

n=N//2*2
ans=min(Q*4*n,H*2*n,S*n,D*n//2)

if N%2==1:
    ans+=min(Q*4,H*2,S)
    
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
price = [int(w) for w in input().split()]
n = int(input())
price[0]*4
price[1]*2
cheap = min(price[:3])

ans = n // 2 * min(cheap * 2, price[3])
ans += n % 2 * cheap


print(ans)


price = [int(w) for w in input().split()]
n = int(input())
price[0]*=4
price[1]*=2
cheap = min(price[:3])

ans = n // 2 * min(cheap * 2, price[3])
ans += n % 2 * cheap


print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
price=list[map(int,input().split())]
k=[0.25,0.5,1.0,2.0]

N=int(input())

from itertools import permutations
ans=float("Inf")
for x in permutations([0,1,2,3]):
  tmp=0
  n=N
  for y in x:
    tmp+= (n//k[y])*price[y]
    n=n%k[y]
  ans=min(tmp,ans)
  
print(ans)
  
  

from itertools import permutations
Q, H, S, D = map(int, input().split())
N = int(input())*4

ans = 0
s = [(Q, 1), (H, 2), (S, 4), (D, 8)]

ans = float("inf")
for x in permutations(s):
    tmp = 0
    n = N
    for a, b in x:
        tmp += (n // b)*a
        n %= b
    ans = min(ans, tmp)
print(ans)


Verdicts: Runtime Error

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
q, h, s, d = map(int, input().split())
n = int(input())

s = min(4 * h, 8 * q, s)
if s * 2 < d:
    print(s * n)
else:
    print((n//2) * d + (s if n % 2 else 0))


q, h, s, d = map(int, input().split())
n = int(input())

s = min(2 * h, 4 * q, s)
if s * 2 < d:
    print(s * n)
else:
    print((n//2) * d + (s if n % 2 else 0))


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
q,h,s,d=map(int,input().split())
n=int(input())
 
l=min(q*n*8,h*n*4,s*n*2,d*n)
if l != d*n:
    print(l/2)
else:
    m=min(q*4,h*2,s)
    print((d*(n-1)/2)+m if n%2==1 else l/2)

q,h,s,d=map(int,input().split())
n=int(input())
 
l=min(q*n*8,h*n*4,s*n*2,d*n)
if l != d*n:
    print (int(l//2))
else:
    m=min(q*4,h*2,s)
    print(int(d*(n-1)//2)+m if n%2==1 else int(l//2))


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
N = int(input())

PS = [[Q * 4, 0.25], [H * 2, 0.5], [S, 1], [D / 2, 2]]

PS.sort(key=lambda x: x[0])

# print(PS)

R = N
ans = 0
for i in range (4):
    if R == 0:
        break
    elif R >= PS[i][1]:
        ans += PS[i][0] * PS[i][1] * (R // PS[i][1])
        R = R % PS[i][1]
    # print("ans :", ans)

print(int(ans))

Q, H, S, D = map(int, input().split())
N = int(input())

ans = (N//2) * min(8 * Q, 4 * H, S * 2, D) + (N % 2) * min(4 * Q, 2 * H, S)

print(ans)

Verdicts: Runtime Error

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

Q, H, S, D = lr()
N = ir()

N = N * 4
cost = [2 << 31 for _ in range(N+1)]
cost[0] = 0
for n in range(N+1):
    if n >= 1:
        cost[n] = cost[n-1] + Q
    if n >= 2:
        cost[n] = min(cost[n], cost[n-1] + H)
    if n >= 4:
        cost[n] = min(cost[n], cost[n-4] + S)
    if n >= 8:
        cost[n] = min(cost[n], cost[n-8] + D)

print(cost[N])


import sys
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

Q, H, S, D = lr()
N = ir()

H = min(Q * 2, H)
S = min(H * 2, S)
if S * 2 <= D:
    print(S * N)
else:
    print((N // 2) * D + (N % 2) * S)


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
# 2019/08/08

Q,H,S,D=map(int,input().split())
n=int(input())

q=Q*4
h=H*2
s=S
d=D/2
ls=sorted([q,h,s,d])
if ls[0]==d and ls[1]!=d:
    if n%2:
        ans=D*(n//2)
    else:
        ans=D*(n//2)+ls[1]

else:
    ans=int(ls[0]*n)
print(ans)


# 2019/08/08

Q,H,S,D=map(int,input().split())
n=int(input())

ans=(n//2)*min(8*Q,4*H,2*S,D)+(n%2)*(min(4*Q,2*H,S))
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
q,h,s,d=map(int,input().split())
n=int(input())
l=[[0.25,q,q*4]]
l.append([0.5,h,h*2])
l.append([1,s,s])
l.append([2,d,d/2])
l=sorted(l,key=lambda x:x[2])
print(l)
c=0
i=0
while True:
  if i>=4 or int(n)<=0:
    break
  a=n//l[i][0]
  if a==0:
    i+=1
    continue
  c+=a*l[i][1]
  n-=a*l[i][0]
print(int(c))

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,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 LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  q,h,s,d=LI()
  n=I()

  q*=4
  h*=4
  s*=4
  d*=4
  n*=4

  l=[]
  l.append([q,1,q/1])
  l.append([h,2,h/2])
  l.append([s,4,s/4])
  l.append([d,8,d/8])

  l=sorted(l,key=lambda x:x[2])

  ans=0
  for x in l:
    if n%x[1]==0:
      ans+=(n//x[1])*x[0]
      return ans//4
    else:
      ans+=(n//x[1])*x[0]
      n%=x[1]

# main()
print(main())


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

Q, H, S, D, N = map(int, read().split())
H = min(Q * 2, H)
S = min(H *2 , S)

print(H, S, D)

if S * 2 < D:
    print(N * S)
else:
    print(N // 2 * D + N % 2 * S)

#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

Q, H, S, D, N = map(int, read().split())
H = min(Q * 2, H)
S = min(H *2 , S)

if S * 2 < D:
    print(N * S)
else:
    print(N / 2 * D + N % 2 * S)

#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

Q, H, S, D, N = map(int, read().split())
H = min(Q * 2, H)
S = min(H *2 , S)

if S * 2 < D:
    print(N * S)
else:
    print(N // 2 * D + N % 2 * S)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
a,b,c,d=map(int,input().split())
n=int(input())
if n == 1:
  print(min(a*4,b*2,c))
elif n%2 == 0:
  print(min(a*4*n,b*2*n,c*n,d*n//2))
else:
  print(min(a*4*n,b*2*n,c*n,d*n//2+min(a*4,b*2,c)))

a,b,c,d=map(int,input().split())
n=int(input())
if n == 1:
  print(min(a*4,b*2,c))
elif n%2 == 0:
  print(min(a*4*n,b*2*n,c*n,d*n//2))
else:
  print(min(a*4*n,b*2*n,c*n,n//2*d+min(a*4,b*2,c)))


Verdicts: Wrong Answer

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input)

    main(q, h, s, d, n)


def main(q: int, h: int, s: int, d: int, n: int):
    print((n // 2) * min(q * 8, h * 4, s * 2, d) + (n % 2) * min(q * 4, h * 2, s))


if __name__ == "__main__":
    q, h, s, d = map(int, input().split())
    n = int(input())

    main(q, h, s, d, n)


Verdicts: Runtime Error

Accepted
Problem: You've come to your favorite store Infinitesco to buy some ice tea.  The store sells ice tea in bottles of different volumes at different costs. Specifically, a 0.25-liter bottle costs Q yen, a 0.5-liter bottle costs H yen, a 1-liter bottle costs S yen, and a 2-liter bottle costs D yen. The store has an infinite supply of bottles of each type.  You want to buy exactly N liters of ice tea. How many yen do you have to spend?

Submission attempts (in order):
# A - Ice Tea Store

Q, T, S, D = map(int, input().split())
N = int(input())

for_1L = min(4*Q, 2*T, S)
for_2L = min(for_1L, D)

print((N//2)*for_2L + (N%2)*for_1L)

# A - Ice Tea Store

Q, T, S, D = map(int, input().split())
N = int(input())

for_1L = min(4*Q, 2*T, S)
for_2L = min(2*for_1L, D)

print((N//2)*for_2L + (N%2)*for_1L)

Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
import collections

n = int(input())
p = list(map(int,input().split()))
cnt = collections.Counter(p)

maxs = []
for k, v in cnt.items():
  if v > 1:
    maxs.append(k)
    
if len(maxs) > 1:
  maxs.sort()
  if len(maxs[-1]) > 3:
    print(maxs[-1] ** 2)
  else:
    print(maxs[-1] * maxs[-2])

else:
  print(0)

import collections

n = int(input())
p = list(map(int,input().split()))
cnt = collections.Counter(p)

maxs = []
for k, v in cnt.items():
  if v > 1:
    maxs.append(k)
    
if len(maxs) > 1:
  maxs.sort()
  if cnt[maxs[-1]] > 3:
    print(maxs[-1] ** 2)
  else:
    print(maxs[-1] * maxs[-2])

else:
  print(0)

Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
import collections
n = int(input())
l = map(int, input().split())
c = collections.Counter(l)
c = sorted(c.items(), key=lambda c:c[0], reverse=True)

ans = 1
cnt = 0

for key,val in c:
  if cnt=0 and val>=4:
    ans=key**2
    break
  if val>=2:
    ans*=key
    cnt+=1
  if cnt == 2:
    break
else:
  ans = 0
print(ans)

import collections
n = int(input())
l = map(int, input().split())
c = collections.Counter(l)
c = sorted(c.items(), key=lambda c:c[0], reverse=True)
 
ans = 1
cnt = 0
 
for key,val in c:
  if cnt==0 and val>=4:
    ans=key**2
    break
  if val>=2:
    ans*=key
    cnt+=1
  if cnt == 2:
    break
else:
  ans = 0
print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
from collections import Counter

N = int(input())
A=list(map(int,input().split()))
c=dict(Counter(A))
#print(c)
e=[]
f=[]

for i in c:
  if c[i]>1:
    e.append(i)
  if c[i]>=4:
    f.append(i)

e.sort(reverse=True)
f.sort(reverse=True)
if f[0]>=e[0]:
  print(f[0]**2)
else:
  if len(e)>=2:
    print(e[0]*e[1])
  else:
    print(0)

from collections import Counter

N = int(input())
A=list(map(int,input().split()))
c=dict(Counter(A))
#print(c)
e=[]
f=[]

for i in c:
  if c[i]>1:
    e.append(i)
  if c[i]>=4:
    f.append(i)

e.sort(reverse=True)
f.sort(reverse=True)
if len(f)>=1:
  if f[0]>=e[0]:
    print(f[0]**2)
  else:
    if len(e)>=2:
      print(e[0]*e[1])
    else:
      print(0)
else:
  if len(e)>=2:
    print(e[0]*e[1])
  else:
    print(0)  

Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
N = int(input())
A = [int(a) for a in input().split()]

dic = {}
for a in A:
  dic[a] = dic.get(a,0) + 1

p = []
ans = 0

for k in dic:
  if dic[k] >= 4:
    ans = max(ans,dic[k]**2)
  elif dic[k] >= 2:
    p.append(dic[k])
if len(p)>=2:
  p.sort(reverse=True)
  ans = max(ans,p[0]*p[1])
print(ans)

N = int(input())
A = [int(a) for a in input().split()]

dic = {}
for a in A:
  dic[a] = dic.get(a,0) + 1

B=[]
for k in dic:
  if dic[k]>=2:
    B.append(k)

B.sort()
if B>=2:
  print(B[-1]*B[-2])
else:
  print(0)

N = int(input())
A = [int(a) for a in input().split()]

A.sort()

print(A[-2]*A[-4])

N = int(input())
A = [int(a) for a in input().split()]

dic = {}
for a in A:
  dic[a] = dic.get(a,0) + 1

2p = []
ans = 0

for k in dic:
  if dic[k] >= 4:
    ans = max(ans,dic[k]**2)
  elif dic[k] >= 2:
    2p.append(dic[k])
if len(2p)>=2:
  2p.sort(reverse=True)
  ans = max(ans,2p[0]*2p[1])
print(ans)


N=int(input())
A = [int(a) for a in input().split()]

d = {}
for a in A:
  d[a] = d.get(a,0) + 1
B = [0,0]
for k in d:
  if d[k] >= 4:
    B.append(k)
    B.append(k)
  elif d[k] >=2:
    B.append(k)
B.sort()
print(B[-1]*B[-2])

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n = int(input())
lens = list(map(int,input().split()))

lens.sort(reverse = True)
cnt = 0
for i in lens:
  if l.count(i) >= 4 and cnt != 0:
    print(i*2)
    break
  elif l.count(i) >= 2 and cnt == 0:
    cnt = i
  elif l.count(i) >= 2 and cnt != 0:
    print(cnt * i)
    break
else:
  print(0)

n = int(input())
lens = list(map(int,input().split()))
items = set[lens]
items = list(items).sort(reverse = True)
cnt = 0
for j in items:
  if j >= 4 and cnt == 0:
    print(j**2)
    break
  elif j >= 2 and cnt == 0:
    cnt = j
  elif j >= 2 and cnt != 0:
    print(cnt * j)
    break
else:
  print(0)

import collections
 
n = int(input())
lens = list(map(int,input().split()))
lens = collections.Counter(lens)
lens = sorted(lens.items(), key=lambda x:x[0], reverse = True)
cnt = 0
for j in lens:
  if j[1] >= 4 and cnt == 0:
    print(j[0]**2)
    break
  elif j[1] >= 2 and cnt == 0:
    cnt = j[0]
  elif j[1] >= 2 and cnt != 0:
    print(cnt * j[0])
    break
else:
    print(0)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
N = int(input())
ma1 = 0
ma2 = 0
A = list(map(int,input().split()))
a = sorted(A,reverse = True)

hold = 0
count = 0

for i in a:
  if i == hold:
    count += 1
  else:
    if count > 3 and ma1 == 0:
      ma1 = hold
      ma2 = hold
    elif count > 1:
      if ma1 == 0:
        ma1 = hold
      elif ma2 == 0:
        ma2 = hold
    hold = i
    count = 1
    if ma1 != 0 and ma2 != 0:
      break
    

print(ma1*ma2)
    

N = int(input())
ma1 = 0
ma2 = 0
A = list(map(int,input().split()))
A.append(0)
a = sorted(A,reverse = True)

hold = 0
count = 0

for i in a:
  if i == hold:
    count += 1
  else:
    if count > 3 and ma1 == 0:
      ma1 = hold
      ma2 = hold
    elif count > 1:
      if ma1 == 0:
        ma1 = hold
      elif ma2 == 0:
        ma2 = hold
    hold = i
    count = 1
    if ma1 != 0 and ma2 != 0:
      break
    

print(ma1*ma2)
    


Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
#import pysnooper

from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

n=int(input().rstrip())
h,w=0,0
a=sorted(Counter([int(i) for i in input().split()]).most_common(),reverse=1)+[(0,0)]
print(a)
for i in range(len(a)-1):
    if a[i][1]>=4:
        print(a[i][0]**2)
        exit()
    elif a[i][1]>=2:
        if h==0:
            h=a[i][0]
        else:
            print(h*a[i][0])
            exit()
print(0)

#import pysnooper

from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

h,w=0,0
l=0
n=int(input().rstrip())
a=sorted(Counter([int(i) for i in input().split()]).most_common(),reverse=1)
#print(a)
for i in range(len(a)):
    if a[i][1]>=4:
        print(a[i][0]**2)
        exit()
    elif a[i][1]>=2:
        h=a[i][0]
        l=i+1
        break

for i in range(l,len(a)):
    if a[i][1]>=2:
        w=a[i][0]
        break
print(h*w)

Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n = input()
l = map(int, input().split())

d = {}
m = set()
for i in l:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1
        if d[i] > 2:
            m.add(i)
a = sorted(m, reverse=True)[:2]
if len(a) == 0:
    print(0)
    exit()
elif len(a) == 1 and d[a[0]] < 4:
    print(0)
    exit()
if d[a[0]] > 3:
    print(i*i)
    exit()
print(a[0]*a[1])

n = input()
l = list(map(int, input().split()))
w, h, temp = 0, 0, 0
cnt = 1
for i in sorted(l, reverse=True):
    if temp == i:
        cnt += 1
        if w == 0:
            w = i
        elif w != i:
            print(w*i)
            exit()
        if cnt == 4:
            print(w*w)
            exit()    
    else:
        cnt = 1
    temp = i
print(0)

Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
import sys
sys.setrecursionlimit(10**10)
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)


def chouhoukei(count, ans, num):
    if count == 4:
        return ans
    else:
        if num >= N:
            return 0
        if A[num] == A[num + 1]:
            return chouhoukei(count + 2, ans * A[num], num + 2)
        else:
            return chouhoukei(count, ans, num + 2)


print(chouhoukei(0, 1, 0))


import sys
sys.setrecursionlimit(10**9)
N = int(input())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)


def chouhoukei(count, ans, num):
    if count == 4:
        return ans
    else:
        if num >= N - 1:
            return 0
        if A[num] == A[num + 1]:
            return chouhoukei(count + 2, ans * A[num], num + 2)
        else:
            return chouhoukei(count, ans, num + 1)


print(chouhoukei(0, 1, 0))


Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):

import sys
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
x=0
y=a[0]
i=1
ans=1
while x<2 and i<n-1:
    if y==a[i]:
        ans*=y
        y=a[i+1]
        i+=2
        x+=1
    else:
        y=a[i]
        i+=1
if x<2:
    print(0)
else:
    print(ans)


import sys
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=1
cnt=0
i=0
while i<n-1 and cnt<2:
    if a[i]==a[i+1]:
        ans*=a[i]
        i+=2
        cnt+=1
    else:
        i+=1
if cnt==2:
    print(ans)
else:
    print(0)

Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
import collections
import sys

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
two = [k for k, v in c.items() if v > 1]
four = [k for k, v in c.items() if v > 3]
if len(two) < 2 and not four:
    print(0)
    sys.exit(0)
two.sort(reverse=True)
four.sort(reverse=True)
tmp = 1
for i in range(2):
    tmp *= two[i]
max_four = max(four)
print(tmp if tmp > max_four else max_four)


import collections
import sys

N = int(input())
A = list(map(int, input().split()))
c = collections.Counter(A)
two = [k for k, v in c.items() if v > 1]
four = [k for k, v in c.items() if v > 3]
if len(two) < 2 and not four:
    print(0)
    sys.exit(0)

St = 0
Sf = 0
if two:
    two.sort(reverse=True)
    St = 1
    for i in range(2):
        St *= two[i]
if four:
    Sf = max(four) ** 2
print(St if St > Sf else Sf)


Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
import collections
import copy
def main():
    ct=collections.Counter
    N=int(input())
    A=[int(i) for i in input().split()]
    B=ct(A)
    anum=sorted(B,reverse=True)
    tate=0
    yoko=0
    for _ in range(2):
        for k,a in enumerate(anum):
            if B[a]>=2 and tate==0:
                tate=a
            elif B[a]>2 and tate:
                if a==tate and B[a]<4:continue;
                else:
                    yoko=a;break;
    print(tate*yoko)
    
if __name__=="__main__":
    main()

import collections
import copy
def main():
    ct=collections.Counter
    N=int(input())
    A=[int(i) for i in input().split()]
    B=ct(A)
    anum=sorted(B,reverse=True)
    tate=0
    yoko=0
    for _ in range(2):
        for k,a in enumerate(anum):
            if B[a]>=2 and tate==0:
                tate=a
                break
            elif B[a]>=2 and tate:
                if a==tate and B[a]<4:continue;
                else:
                    yoko=a
                    break
    print(tate*yoko)
    
if __name__=="__main__":
    main()

Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
import collections
c=collections.Counter(a)
t=list(c.items())
t.sort(reverse=True)
if t[0][1]>=4:
  print(t[0][0]**2)
elif t[1][1]>=2:
  print(t[0][0]*t[1][0])
else:
  print(0)

n=int(input())
a=list(map(int,input().split()))
import collections
c=collections.Counter(a)
t=list(c.items())
t.sort(reverse=True)
s=c.most_common()
if s[0][1]<4 and s[1][1]<2:
  print(0)
  exit()
while t[0][1]<2:
  del t[0]
if t[0][1]>=4:
  print(t[0][0]**2)
else:
  while t[1][1]<2:
    del t[1]
  print(t[0][0]*t[1][0])

Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A = Counter(A)

p = []
l = []
for k, v in A.items():
    if v >= 4:
        p.append(k)
    if v >= 2:
        l.append(k)
if len(l) >= 2:
    p.sort()
    l.sort()
    print(max(l[-1] * l[-2], p[-1]**2))
else:
    print(0)

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
A = Counter(A)

p = []
l = []
for k, v in A.items():
    if v >= 4:
        p.append(k)
    if v >= 2:
        l.append(k)

ans = 0
if len(p) >= 1:
    p.sort()
    ans = p[-1]**2
if len(l) >= 2:
    l.sort()
    ans = max(l[-1] * l[-2], ans)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c:
  while l[i]>=2 and len(l1)<4:
    l1.append(l[i])
print(l1[-1]*l1[-2])

n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
sort.(l1)
print(l1[-1]*l1[-2])

n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
  if i[1]>=4 :
    l1.append(i[0])
l1.sort()
print(l1[-1]*l1[-2])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
cnt=0
d=[]
i=0
while i<n-1:
	if a[i]==a[i+1]:
		cnt+=1
	if cnt==1:
		d.append(a[i])
	elif cnt==3:
		d.append(a[i])
		d.append(a[i-2])
	if a[i]!=a[i+1]:
		cnt=0
	if len(d)==2:
		print(d[0]*d[1])
		exit()
	i+=1

print(0)



n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
cnt=0
x=0
d=[]
for i in range(n):
	if x==a[i]:
		cnt+=1
	else:
		x=a[i]
		cnt=0
	if cnt==1:
		d.append(a[i])
	if cnt==3:
		d.append(a[i])
	if len(d)==2:
		break
if len(d)<=1:
	print(0)
	exit()
print(d[0]*d[1])

Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n = int(input())
aa = list(map(int, input().split()))
bb = set()
cc = set()

for a in aa:
  if aa.count(a) > 1:
    bb.add(a)
  if aa.count(a) >3:
    cc.add(a)
    
m1 = max(bb)
bb.remove(m1)
m2 = max(bb)

if len(cc) > 0:
  y = max(cc)
else:
  y = 0

if len(bb) >= 2:
  ans = max(m1*m2, y*y)
else:
  ans = max(0, y*y)
print(ans)

import collections
n = int(input())
aa = list(map(int, input().split()))
ca = collections.Counter(aa)
la = sorted([a for a in ca.items()], key = lambda x:x[0], reverse=True)

list1 = []
list2 = []

for a in la:
  if a[1] > 1:
    list1.append(a)
  if a[1] >3:
    list2.append(a)
    
if len(list1) > 1:    
    xr = list1[0][0] * list1[1][0]
else:
  xr = 0
    
if len(list2) > 0:
  xs = list2[0][0] * list2[0][0]
else:
  xs = 0
  
ans = max(xr, xs)

print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n = int(input())
s = set()
q = [0,0]
import heaps as hq
for a in map(int, input().split()):
  if a > q[0]:
    if a in s:
      del s[a]
      hq.heapreplace(q, a)
    else:
      s.add(a)

print(q[0]*q[1])

n = int(input())
s = set()
q = [0,0]
import heapq as hq
for a in map(int, input().split()):
  if a > q[0]:
    try:
      s.remove(a)
      hq.heapreplace(q, a)
    except:
      s.add(a)

print(q[0]*q[1])


Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
def spaceinput():
    return list(map(int,input().split(" ")))


N=int(input())
a=spaceinput()


sa=sorted(a,reverse=True)
x=[]
i=0
while True:
    ssa=sa[i]
    if sa[i]==sa[i+1]:
        x.append(ssa)
        i+=2
        if len(x)==2:
            break

    i+=1
    if i>=len(sa):
        break

x.extend([0,0])

print(x[0]*x[1])


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


N=int(input())
a=spaceinput()


sa=sorted(a,reverse=True)
x=[]
i=0
while True:
    if i>=len(sa)-1:
        break
    ssa=sa[i]
    if sa[i]==sa[i+1]:
        x.append(ssa)
        i+=2
        if len(x)==2:
            break
        continueß

    i+=1


x.extend([0,0])

print(x[0]*x[1])

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


N=int(input())
a=spaceinput()


sa=sorted(a,reverse=True)
x=[]
i=0
while True:
    ssa=sa[i]
    if sa[i]==sa[i+1]:
        x.append(ssa)
        i+=2
        if len(x)==2:
            break

    i+=1

x.extend([0,0])

print(x[0]*x[1])


N=int(input())
a=spaceinput()


sa=sorted(a,reverse=True)
x=[]
for i in range(len(sa)-1):
    ssa=sa[i]
    if ssa in x:
        continue
    if sa[i]==sa[i+1]:
        x.append(ssa)
        if len(x)==2:
            break

x.extend([0,0])
print(x[0]*x[1])

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


N=int(input())
a=spaceinput()


sa=sorted(a,reverse=True)
x=[]
i=0
while True:
    if i>=len(sa)-1:
        break
    ssa=sa[i]
    if sa[i]==sa[i+1]:
        x.append(ssa)
        i+=2
        if len(x)==2:
            break
        continue

    else:
        i+=1


x.extend([0,0])

print(x[0]*x[1])

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
hen = [(key, val) for key, val in c.items() if val > 1]

l = max(hen) if hen else 0
if l != 0:
    if c[l] > 3:
        s = l
    else:
        hen.remove(l)
        s = max(hen) if hen else 0
else:
    s = 0

print(l * s)


from collections import Counter

N = int(input())
A = list(map(int, input().split()))

c = Counter(A)
hen = [key for key, val in c.items() if val > 1]

l = max(hen) if hen else 0
if l != 0:
    if c[l] > 3:
        s = l
    else:
        hen.remove(l)
        s = max(hen) if hen else 0
else:
    s = 0

print(l * s)


Verdicts: Runtime Error

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
n = int(input())
num_list = list(map(int, input().split()))

set_list = list(set(num_list))

for i in range(len(set_list)):
    num_list.remove(set_list[i])

num_list.sort()

print(num_list)

if len(num_list) >= 3:
    if num_list[-1] == num_list[-3]:
        print(num_list[-1]**2)
    elif num_list[-1] == num_list[-2]:
        print(num_list[-1]*num_list[-3])
    else:
        print(num_list[-1]*num_list[-2])
elif len(num_list) == 2:
    if num_list[-1] == num_list[-2]:
        print(0)
    else:
        print(num_list[-1]*num_list[-2])
else:
    print(0)

import collections
n = int(input())
aa = list(map(int, input().split()))
ca = collections.Counter(aa)
la = sorted([a for a in ca.items()], key = lambda x:x[0], reverse=True)

list1 = []
list2 = []

for a in la:
  if a[1] > 1:
    list1.append(a)
  if a[1] >3:
    list2.append(a)
    
if len(list1) > 1:    
    xr = list1[0][0] * list1[1][0]
else:
  xr = 0
    
if len(list2) > 0:
  xs = list2[0][0] * list2[0][0]
else:
  xs = 0
  
ans = max(xr, xs)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: We have N sticks with negligible thickness. The length of the i-th stick is A_i.  Snuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides. Find the maximum possible area of the rectangle.

Submission attempts (in order):
N = int(input())
s1 = input()
s2 = input()
sum = 1
mul = 1
flag = 0
i = 0

while True:
    if i >= N:
        print(sum%1000000007)
        break

    elif s1[i]==s2[i] and flag==0:
        sum = 3
        i += 1
        flag = 1
    elif s1[i]!=s2[i] and flag==0:
        sum = 6
        i += 2
        flag = 2
    elif s1[i]==s2[i] and flag==1:
        mul = 2
        i += 1
        flag = 1
    elif s1[i]!=s2[i] and flag==1:
        mul = 2
        i += 2
        flag = 2
    elif s1[i]==s2[i] and flag==2:
        mul = 1
        i += 1
        flag = 1
    elif s1[i]!=s2[i] and flag==2:
        mul = 3
        i += 2
        flag = 2
    sum = sum*mul


N = int(input())
bars = list(map(int,input().split()))

bars.sort(reverse=True)

flag = 0
l = 0
l1 = 0
l2 = 0

for x in bars:
    if flag==0:
        l = x
        flag = 1
    elif flag==1 and x==l and l1==0:
        l1 = x
        l = 0
        flag = 0
    elif flag==1 and x==l and l1!=0:
        l2 = x
        break
    else:
        l = x
        flag = 1

print(l1 * l2)


Verdicts: Runtime Error

Accepted