s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s678514857 | p03625 | u170183831 | 1580603131 | Python | Python (3.4.3) | py | Runtime Error | 91 | 24096 | 383 | from collections import Counter
def solve(n, A):
c = Counter(A)
cands = sorted(filter(lambda kv: kv[1] >= 2, c.items()), key=lambda kv: -kv[0])
ret = 0
if cands[0][1] >= 4:
ret = cands[0][0] * cands[0][0]
elif len(cands) >= 2:
ret = cands[0][0] * cands[1][0]
return ret
_n = in... |
s928686315 | p03625 | u695079172 | 1580013257 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 424 | line1 = 0
line2 = 0
n = int(input())
lines = list(map(int,input().split()))
lines.sort()
mx1,mx2 = 0,0
temp = 0
streak = 0
for l in lines:
if l != temp:
temp = l
streak = 0
elif l == temp and streak = 0:
streak += 1
elif l == temp and streak == 1 and l > mx1:
mx2 = mx1
mx1 = l
streak = ... |
s163356699 | p03625 | u261891508 | 1579677344 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 9 | 4
1 2 3 4 |
s942458907 | p03625 | u261891508 | 1579676900 | Python | Python (3.4.3) | py | Runtime Error | 101 | 21384 | 332 | n=int(input())
a=list(map(int,input().split()))
from collections import Counter
a=Counter(a).most_common()
li=[]
li4=[]
for x,y in a:
if y>=4:
li4.append(x)
elif y>=2:
li.append(x)
li.sort()
li4.sort()
if len(li4)<1 and len(li)<2:
print(0)
exit()
x=0
if li4:
x=(li4[-1])**2
y=li[-1]*li[-2]
pri... |
s356432782 | p03625 | u578953945 | 1579227577 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 269 | iimport collections
N=int(input())
L=list(map(int,input().split()))
ANS=[0,0]
c = collections.Counter(L).most_common()
for k,v in c:
if v <= 1:
break
if v >= 4:
ANS.append(k)
ANS.append(k)
else:
ANS.append(k)
Z=sorted(ANS)
print(Z[-1]*Z[-2]) |
s945766021 | p03625 | u404556828 | 1578422487 | Python | Python (3.4.3) | py | Runtime Error | 103 | 14224 | 257 | n = int(input())
list1 = [int(x) for x in input().split()]
list2 = list(reversed(sorted(list1)))
m = list2[0]
ans = []
for i in range(1, len(list2)):
if list2[i] == m:
ans.append(m)
if len(ans) == 2:
break
m = list2[i]
print(ans[0] * ans[1]) |
s697264976 | p03625 | u404556828 | 1578420351 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14224 | 352 | n = int(input())
list1 = [int(x) for x in input().split()]
set1 = set(list1)
listans = []
for i in set1:
if list1.count(i) > 1 and list1.count(i) < 4:
listans.append(i)
elif list1.count(i) >3:
listans.append(i)
listans.append(i)
listasn = sorted(listans)
if len(listansn) < 2:
print(0)
else:
... |
s462876006 | p03625 | u196697332 | 1577401871 | Python | Python (3.4.3) | py | Runtime Error | 93 | 18600 | 472 | from collections import Counter
import sys
N = int(input())
A = [int(_) for _ in input().split()]
key_val_lis = []
for key, value in Counter(A).items():
if value >= 2:
key_val_lis.append((key, value))
ans_lis = sorted(key_val_lis, key=lambda x: -x[0])
if len(ans_lis) == 1 and ans_lis[0][1] < 4:
print... |
s870516712 | p03625 | u196697332 | 1577401697 | Python | Python (3.4.3) | py | Runtime Error | 93 | 18600 | 516 | from collections import Counter
import sys
N = int(input())
A = [int(_) for _ in input().split()]
key_val_lis = []
for key, value in Counter(A).items():
if value >= 2:
key_val_lis.append((key, value))
ans_lis = sorted(key_val_lis, key=lambda x: -x[0])
if ans_lis[0] is None:
print(0)
sys.exit()
i... |
s853079001 | p03625 | u196697332 | 1577401267 | Python | Python (3.4.3) | py | Runtime Error | 90 | 18600 | 434 | from collections import Counter
import sys
N = int(input())
A = [int(_) for _ in input().split()]
key_val_lis = []
for key, value in Counter(A).items():
if value >= 2:
key_val_lis.append((key, value))
ans_lis = sorted(key_val_lis, key=lambda x: -x[0])
if len(ans_lis) == 1 and ans_lis[0][0] < 4:
print... |
s057881570 | p03625 | u169138653 | 1577066353 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 21384 | 471 | n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
d={}
for i in range(n):
if a[i] not in d:
d[a[i]]=1
else:
d[a[i]]+=1
lis=sorted(d.items(),reverse=True)
for i in range(len(lis)):
if lis[i][1]<2:
lis.remove(lis[i])
lis.sort(reverse=True)
if len(lis)>=2:
if lis[0][1]>=4:
print(... |
s459253829 | p03625 | u169138653 | 1577064133 | Python | Python (3.4.3) | py | Runtime Error | 122 | 14672 | 249 | n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
k=0
i=0
cnt=0
lis=[]
while i<=n-2 or cnt<2:
if a[i]==a[i+1] and a[i]!=k:
lis.append(a[i])
k=a[i]
cnt+=1
i+=1
if len(lis)>=2:
print(lis[0]*lis[1])
else:
print(0) |
s577980302 | p03625 | u921168761 | 1576789149 | Python | Python (3.4.3) | py | Runtime Error | 104 | 14252 | 282 | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
r = []
i = 0
while i < n:
if a[i] == a[i + 1]:
r.append(a[i])
i += 2
else:
i += 1
if len(r) == 2:
break
if len(r) == 2:
print(r[0] * r[1])
else:
print(0) |
s718369771 | p03625 | u305366205 | 1576625722 | Python | Python (3.4.3) | py | Runtime Error | 41 | 14244 | 291 | n = int(input())
a = list(map(int, input().split()))
candidate = []
for i in range(n):
dd[str(a[i])] += 1
for k in dd.keys():
if dd[k] >= 2:
candidate.append(int(k))
candidate.sort(reverse=True)
if len(candidate) < 2:
print(0)
else:
print(candidate[0] * candidate[1]) |
s635915896 | p03625 | u135847648 | 1575785541 | Python | Python (3.4.3) | py | Runtime Error | 81 | 21668 | 327 | import collections
n = int(input())
a = list(map(int,input().split()))
c = dict(collections.Counter(a))
d1 = []
d2 = []
for num,v in c.items():
if v >= 2:
d1.append(num)
if v >= 4:
d2.append(num)
d1.sort()
d2.sort()
if d2:
ans = max(d2[-1]**2, d1[-1]*d1[-2])
print(ans)
else:
print(d1[-1]*d1[-2... |
s777961840 | p03625 | u797994565 | 1575750158 | Python | Python (3.4.3) | py | Runtime Error | 96 | 18216 | 362 | N = int(input())
A = list(map(int,input().split()))
from collections import defaultdict
D = defaultdict(int)
for e in A:
D[e] += 1
l1 = []
l2 = []
for key,value in D.items():
if value > 1:
l1.append(key)
if value > 3:
l2.append(key)
if len(l1) < 2:
print(0)
exit()
l1.sort()
l2.sort... |
s585626824 | p03625 | u797994565 | 1575749528 | Python | Python (3.4.3) | py | Runtime Error | 97 | 18316 | 349 | N = int(input())
A = list(map(int,input().split()))
from collections import defaultdict
D = defaultdict(int)
for e in A:
D[e] += 1
possible_length = []
for key,value in D.items():
if value > 1:
possible_length.append(key)
if len(possible_length) < 2:
print(0)
possible_length.sort()
print(possible_le... |
s285054612 | p03625 | u836737505 | 1575658683 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 184 | n = int(input())
a = sorted(list(map(int, input().split())))[::-1]
l = []
for i in range(n-1):
if a[i] == a[i+1] and a[i] not in l:
l.append(a[i])
print(l[0]*l[1]) |
s358524883 | p03625 | u018679195 | 1575143828 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 14244 | 154 | n=input()
l=[int(x) for x in input().split()]
temp=list(set(x for x in l if l.count(x)>1))
if temp==[]:
print("0")
else:
y.sort()
print(a[n]*a[n-1])
|
s528867415 | p03625 | u089230684 | 1575139610 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14244 | 200 | n=input()
l=[int(x) for x in input().split()]
temp=list(set(x for x in l if l.count(x)>1))
y=max(temp)
lar=sec=0
if l.count(y)>3:
lar=sec=y
else:
lar=y
temp.remove(y)
sec=max(temp)
print(lar*sec)
|
s882131808 | p03625 | u816631826 | 1575139448 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 190 | n=input()
l=[int(x) for x in input().split()]
temp=list(set(x for x in l if l.count(x)>1))
y=max(temp)
if l.count(y)>3:
lar=sec=y
else:
lar=y
temp.remove(y)
sec=max(temp)
print(lar*sec)
|
s860913084 | p03625 | u089230684 | 1575102867 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 292 | n=int(input())
ls=[]
temp=[]
temp= list((for x in input().split()))
temp=list(set([x for x in l if l.count(x)>1]))
for x in l:
if (l.count(x)>3):
ls.append(x)
temp+=list(set(ls))
if len(temp)<2:
print(0)
else:
temp=[int(x) for x in temp]
x=max(temp)
temp.remove(x)
print(x*max(temp))
|
s556381072 | p03625 | u816631826 | 1575102743 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 262 | n=int(input())
ls=[]
temp=[]
temp= list((for x in input().split()))
temp=list(set([x for x in l if l.count(x)>1]))
for x in l:
if (l.count(x)>3):
ls.append(x)
temp+=list(set(ls))
if len(temp)<2:
print(0)
else:
x=max(temp)
temp.remove(x)
print(x*max(temp)) |
s704930178 | p03625 | u863370423 | 1575101173 | Python | Python (3.4.3) | py | Runtime Error | 23 | 5152 | 532 | lst = []
N = int(input("Enter number of elements : "))
for i in range(0,N):
lst.append(int(input()))
temp = [x for x in lst if lst.count(x)>1]
list_set = set(temp)
# convert the set to the list
dups = (list(list_set))
n=len(dups)
if (n<2):
print('0\nNo rectangle can be formed')
else:
a = dups[0]
b = dups... |
s013785142 | p03625 | u816631826 | 1575100473 | Python | Python (3.4.3) | py | Runtime Error | 23 | 5744 | 526 | lst = []
N = int(input("Enter number of elements : "))
for i in range(0,N):
lst.append(int(input()))
temp = [x for x in lst if lst.count(x)>1]
list_set = set(temp)
dups = (list(list_set))
if (len(dups)<2):
print('0')
print('No rectangle can be formed')
else:
a = dups[0]; b = dups[1]
n=len(dups)
... |
s448095883 | p03625 | u353919145 | 1575099032 | Python | Python (3.4.3) | py | Runtime Error | 23 | 5156 | 547 | lst = []
N = int(input("Enter number of elements : "))
for i in range(0,N):
lst.append(int(input()))
temp = [x for x in lst if lst.count(x)>1]
list_set = set(temp)
# convert the set to the list
dups = (list(list_set))
if (len(dups)<2):
print('0')
print('No rectangle can be formed')
else:
a = dups[... |
s408718295 | p03625 | u816631826 | 1575097621 | Python | Python (3.4.3) | py | Runtime Error | 44 | 14252 | 353 | n=int(input())
arr = list(map(int,input().split()))
arrr = [0]*(max(arr)+2)
for i in arr:
arrr[i]+=1
s1=0
s2=0
#print(arrr)
for j in range(max(arr),0,-1):
#print(j)
if arrr[j]>=2:
arrr[j]-=2
s1=j
break
for j in range(max(arr),0,-1):
if arrr[j]>=2:
arrr[j]-=2
... |
s177697382 | p03625 | u816631826 | 1575097372 | Python | Python (3.4.3) | py | Runtime Error | 44 | 14244 | 341 | n=int(input())
arr = list(map(int,input().split()))
arrr = [0]*(max(arr)+2)
for i in arr:
arrr[i]+=1
s1=0
s2=0
for j in range(max(arrr),0,-1):
if arrr[j]>=2:
arrr[j]-=2
s1=j
for j in range(max(arrr),0,-1):
if arrr[j]>=2:
arrr[j]-=2
s2=j
if s1==0 or s2==0:
print(0)
e... |
s024628520 | p03625 | u089230684 | 1575097368 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 362 | n = int(input())
a = list(map(int, input().split()))
tmp = []
from collections import Counter
c = Counter(a)
for k in c.keys():
if c[k] >= 2:
tmp.append(k)
if c[k] >= 4:
tmp.append(k)
tmp.sort()
if len(tmp) >= 2:
print(tmp... |
s297397996 | p03625 | u353919145 | 1575097313 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 416 | n = int(input())
vals = list(map(int, input().split()))
d= {}
s = [0, 0]
for i in range(n):
if(vals[i] in d.keys()):
d[vals[i]] += 1
else:
d[vals[i]] = 1
for i in d.keys():
if(d[i] >= 4):
s.append(i)
s.appe... |
s789683201 | p03625 | u089230684 | 1575097235 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 416 | k = int(input())
vals = list(map(int, input().split()))
d= {}
a = [0, 0]
for i in range(k):
if(vals[i] in d.keys()):
d[vals[i]] += 1
else:
d[vals[i]] = 1
for i in d.keys():
if(d[i] >= 4):
a.append(i)
a.appe... |
s835313348 | p03625 | u353919145 | 1575095084 | Python | Python (3.4.3) | py | Runtime Error | 138 | 18316 | 290 | n = int(input())
a = list(map(int, input().split()))
b = dict()
c = list()
for i in a:
if i not in b:
b[i] = 1
else:
b[i] = b[i]+1
for i in b:
b[i] = int(b[i]/2)
for i in b:
for j in range(0, b[i]):
c.append(i)
c.sort()
print(c[len(c)-1]*c[len(c)-2]) |
s356646614 | p03625 | u424763114 | 1574992435 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38256 | 469 | from sys import stdin
input = stdin.readline
def main():
n = int(input())
a = list(map(int, input().split()))
if 4 <= n and n <= 10**5:
for i in a:
if not (1 <= i and i <= 10**9 and type(i) == int:
return
j = [x for x in a if a.count(x) > 1]
j.... |
s533988666 | p03625 | u325282913 | 1574135223 | Python | Python (3.4.3) | py | Runtime Error | 125 | 14252 | 399 | N = int(input())
array = list(map(int,input().split()))
array.sort(reverse=True)
array2 = []
tmp = array[0]
for i in range(1,N):
if tmp == array[i]:
array2.append(array[i])
tmp = array[i]
if array2.count(max(array2)) >= 4:
print(max(array2)**2)
exit()
array3 = list(set(array2))
array3.sort(rever... |
s983468031 | p03625 | u527261492 | 1573955642 | Python | Python (3.4.3) | py | Runtime Error | 103 | 21412 | 356 | import collections
n=int(input())
a=list(map(int,input().split()))
b=collections.Counter(a)
c=list(b.items())
d=[]
e=[]
for i in range(len(c)):
if c[i][1]>3:
d.append(int(c[i][0]))
elif c[i][1]>1:
e.append(int(c[i][0]))
d.sort(reverse=True)
e.sort(reverse=True)
if len(d)<1 and len(e)<2:
print(0)
else:
p... |
s797606590 | p03625 | u527261492 | 1573955554 | Python | Python (3.4.3) | py | Runtime Error | 108 | 21412 | 354 | import collections
n=int(input())
a=list(map(int,input().split()))
b=collections.Counter(a)
c=list(b.items())
d=[]
e=[]
for i in range(len(c)):
if c[i][1]>3:
d.append(int(c[i][0]))
elif c[i][1]>1:
e.append(int(c[i][0]))
d.sort(reverse=True)
e.sort(reverse=True)
if len(d)<1 and len(e)<2:
print(0)
else:
p... |
s065715937 | p03625 | u662613022 | 1573267642 | Python | Python (3.4.3) | py | Runtime Error | 101 | 14252 | 299 | N = int(input())
li = list(map(int,input().split()))
li.sort()
a = 0
b = 0
while len(li) >= 1:
if li[-1] == li[-2] and a == 0:
a = li[-1]
del li[-1]
elif li[-1] != li[-2] or a != 0 and a == li[-1]:
del li[-1]
elif li[-1] == li[-2] and a != 0:
b = li[-1]
break
print(a * b) |
s820681853 | p03625 | u662613022 | 1573267535 | Python | Python (3.4.3) | py | Runtime Error | 95 | 14252 | 298 | N = int(input())
li = list(map(int,input().split()))
li.sort()
a = 0
b = 0
for i in range(N):
if li[-1] == li[-2] and a == 0:
a = li[-1]
del li[-1]
elif li[-1] != li[-2] or a != 0 and a == li[-1]:
del li[-1]
elif li[-1] == li[-2] and a != 0:
b = li[-1]
break
print(a * b) |
s455216649 | p03625 | u537962130 | 1571943443 | Python | PyPy3 (2.4.0) | py | Runtime Error | 164 | 38512 | 248 | def resolve():
n=int(input())
a=list(map(int,input().split()))
s=list(set(a))[::-1]
l=[0]*3
k=0
for i in s:
if a.count(i)>=4:
l[k],l[k+1]=i,i
k+=2
elif a.count(i)>=2:
l[k]=i
k+=1
if k>1:
break
print(l[0]*l[1])
resolve(): |
s446541126 | p03625 | u593590006 | 1571881132 | Python | PyPy3 (2.4.0) | py | Runtime Error | 237 | 68760 | 223 | n=int(input())
l=[int(i) for i in input().split()]
from collections import Counter
c=Counter(l)
arr=[i for i in c if c[i]>=2]
arr.sort(reverse=1)
if len(arr)==1 and c[arr[0]]>=4:
print(0)
else:
print(arr[0]*arr[1]) |
s342433697 | p03625 | u593590006 | 1571881057 | Python | PyPy3 (2.4.0) | py | Runtime Error | 238 | 68760 | 206 | n=int(input())
l=[int(i) for i in input().split()]
from collections import Counter
c=Counter(l)
arr=[i for i in c if c[i]>=2]
arr.sort(reverse=1)
if len(arr)==1:
print(0)
else:
print(arr[0]*arr[1]) |
s874554424 | p03625 | u187857228 | 1571779293 | Python | Python (3.4.3) | py | Runtime Error | 106 | 14252 | 310 | def test():
n = int(input())
a = list(map(int,input().split()))
a.sort()
print(a)
b = []
i = 0
while i + 1 < n:
if a[i] == a[i+1]:
b.append(a[i])
i += 2
else:
i += 1
print(b[-1]*b[-2])
if __name__ == "__main__":
test()
|
s622955904 | p03625 | u527261492 | 1570587608 | Python | Python (3.4.3) | py | Runtime Error | 76 | 21024 | 300 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
if b[i]>1:
c=Counter(a).keys()
lst.append(int(c[i]))
Lst=list(set(lst.sort(reverse=True)))
if len(Lst)<2:
print(0)
else:
print(Lst[0]*Lst[1])
|
s961886968 | p03625 | u527261492 | 1570586830 | Python | Python (3.4.3) | py | Runtime Error | 74 | 21024 | 300 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
if b[i]>1:
c=Counter(a).keys()
lst.append(int(c[i]))
Lst=list(set(lst.sort(reverse=True)))
if len(Lst)<2:
print(0)
else:
print(Lst[0]*Lst[1])
|
s243515549 | p03625 | u527261492 | 1570586636 | Python | Python (3.4.3) | py | Runtime Error | 76 | 21024 | 309 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
if b[i]>1:
lst.append(int(Counter(a).keys()[i]))
Lst=set(lst)
lst.sort(reverse=True)
Lst_2=set(lst)
if len(Lst)<2:
print(0)
else:
print(Lst_2[0]*Lst_2[1])
|
s670034169 | p03625 | u527261492 | 1570586505 | Python | Python (3.4.3) | py | Runtime Error | 72 | 21024 | 276 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
if b[i]>1:
lst.append(int(Counter(a).keys()[i]))
lst.sort(reverse=True)
if len(lst)<2:
print(0)
else:
print(lst[0]*lst[1])
|
s612891166 | p03625 | u395202850 | 1570306478 | Python | Python (3.4.3) | py | Runtime Error | 100 | 14252 | 267 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
swi = 0
s = [0, 0]
i = 0
while i < len(a):
if a[i] == a[i + 1]:
s[swi] = a[i]
i += 1
swi += 1
if swi == 2:
break
i += 1
print(s[0] * s[1])
|
s038165995 | p03625 | u033606236 | 1569861988 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 262 | b = -1
ans = [0,0]
count = 0
for i in range(n+1):
count += 1
if b != a[i]:
if count >= 2:
if ans[0]:
ans[1] = b
break
else: ans[0] = b
b = a[i]
count = 0
print(ans[0]*ans[1]) |
s562906002 | p03625 | u027929618 | 1569295301 | Python | Python (3.4.3) | py | Runtime Error | 44 | 14252 | 230 | n=int(input())
A=list(map(int,input().split()))
c=[0]*(n+1)
for i in A:
c[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
if c[j]>=2 and cnt==0:
ans=j
cnt+=1
elif c[j]>= 2 and cnt==1:
ans*=j
break
print(ans) |
s177094517 | p03625 | u027929618 | 1569292806 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14224 | 230 | n=int(input())
A=list(map(int,input().split()))
C=[0]*(n+1)
for i in A:
C[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
if C[j]>=2 and cnt==0:
ans=j
cnt+=1
elif C[j]>= 2 and cnt==1:
ans*=j
break
print(ans) |
s747341382 | p03625 | u027929618 | 1569292677 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14992 | 227 | n=int(input())
A=[0]*(n+1)
for i in list(map(int, input().split())):
A[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
if A[j]>=2 and cnt==0:
ans=j
cnt+=1
elif A[j]>= 2 and cnt==1:
ans*=j
break
print(ans) |
s466101238 | p03625 | u027929618 | 1569292623 | Python | Python (3.4.3) | py | Runtime Error | 43 | 15020 | 227 | n=int(input())
A=[0]*(n+1)
for i in list(map(int, input().split())):
A[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
if A[j]>=2 and cnt==0:
ans=j
cnt+=1
elif A[j]>= 2 and cnt==1:
ans*=j
break
print(ans) |
s049507522 | p03625 | u731368968 | 1569257432 | Python | Python (3.4.3) | py | Runtime Error | 96 | 14480 | 610 | n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
x, y = 0, 0
i = 0
while i < n - 1:
if a[i] == a[i + 1]:
x = a[i]
i += 2
break
i += 1
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
x, y = 0, 0
i = 0
while i < n - 1:
if a[i] == a... |
s031925853 | p03625 | u076917070 | 1568524039 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 553 | import sys
input=sys.stdin.readline
import collections
input = open(sys.argv[1], "r").readline
def main():
N = int(input())
A = list(map(int,input().split()))
d = collections.defaultdict(int)
for a in A:
d[a] += 1
for k,v in list(d.items()):
if v < 2:
d.pop(k)
d = s... |
s165363605 | p03625 | u830054172 | 1568517793 | Python | Python (3.4.3) | py | Runtime Error | 89 | 17960 | 393 | N = int(input())
A = list(map(int, input().split()))
dic = {}
for i in A:
if i in dic:
dic[i] += 1
else:
dic[i] = 1
two = []
four = []
for j, k in dic.items():
if k>=4:
four.append(j)
elif k>=2:
two.append(j)
two.sort(reverse=True)
four.sort(reverse=True)
if len(four) == 0:
if len(two) <= 1:
print(0)
e... |
s277269025 | p03625 | u845442154 | 1568494092 | Python | Python (3.4.3) | py | Runtime Error | 41 | 14252 | 317 | N = int(input())
A = list(map(int, input().split(' ')))
a = sorted(a, reverse=True)
count = 0
edge = []
i = 0
for i in range(n-1):
if a[i] == a[i+1]:
count = count + 1
edge.append(a[i])
i = i + 1
if count == 2:
break
s = edge[0]*edge[1] if count == 2 else 0
print(s) |
s231624303 | p03625 | u845442154 | 1568493617 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 442 | N = int(input())
A = list(map(int, input().split(' ')))
rect_long = 0
rect_small = 0
while A != []:
long_max = max(A)
if A.count(long_max) >= 2:
rect_long += long_max
A.remove(long_max)
A.remove(long_max)
break
A.remove(long_max)
while A != []:
small_max = max(A)
if A.c... |
s611898673 | p03625 | u845442154 | 1568493061 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 408 | N = int(input())
A = list(map(int, input().split(' ')))
rect_long = 0
rect_small = 0
while rect_long == 0:
a_max = max(A)
if A.count(a_max) >= 2:
rect_long += a_max
elif A.count(a_max) >= 4:
rect_small += a_max
A.remove(a_max)
while rect_small == 0:
b_max = max(A)
if A.count(b_m... |
s126271870 | p03625 | u185948224 | 1568170959 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 297 | input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
l = collections.Counter(A)
l24 =list([int(l1[0]) for l1 in l.items() if l1[1]>=2])
l24.sort(reverse=True)
if l24==[]:print(0)
elif l[l24[0]]>=4:print(l24[0]**2)
elif len(l24)>=2:print(l24[0]*l24[1])
else:print(0) |
s055053185 | p03625 | u214434454 | 1568060015 | Python | Python (3.4.3) | py | Runtime Error | 102 | 21128 | 446 | n = int(input())
a = list(map(int, input().split()))
table = {}
for i in range(n):
if a[i] not in table:
table[a[i]] = 1
else:
table[a[i]] = table[a[i]] + 1
table = sorted(table.items(), key=lambda x: x[1], reverse=True)
x = 0
y = 0
for i in table:
if table[i] >= 4:
if x == 0:
x = i
y = i
... |
s484205522 | p03625 | u214434454 | 1568059567 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14252 | 343 | n = int(input())
a = list(map(int, input().split()))
table = [0] * (10**9 + 1)
for i in range(n):
table[a[i]] += 1
x = 0
y = 0
for i in range(10**9, 0, -1):
if table[i] >= 4:
if x == 0:
x = i
y = i
else:
y = i
break
elif table[i] >= 2:
if x == 0:
x = i
else:
y = i... |
s930800352 | p03625 | u598229387 | 1567875737 | Python | Python (3.4.3) | py | Runtime Error | 82 | 18600 | 344 | from collections import Counter
n=int(input())
a=[int(i) for i in input().split()]
dic =Counter(a)
li=[]
li2=[]
for i,j in dic.items():
if j>=2:
li.append(i)
if j>=4:
li2.append(i)
li.sort()
li2.sort()
if len(li)==1 and len(li2)==1:
print(li2[0]**2)
else:
print(li[-1]*max(li[-2],li2[-1... |
s876645089 | p03625 | u266874640 | 1567792323 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3056 | 231 | import collections
N = int(input())
A = list(map(int,input().split())), reverse = True
B = collections.Couter(A)
C = []
for a,c in B.items():
C += [a] * c//2
C.sort()
if len(C) >= 2:
print(C[-1]*C[-2])
else:
print(0)
|
s880269283 | p03625 | u228223940 | 1566753718 | Python | Python (3.4.3) | py | Runtime Error | 192 | 14224 | 443 | n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse= True)
cnt = 0
top = []
for i in range(n):
if len(top) == 2:
break
for j in range(4):
if a[i] == a[i+1+j]:
if len(top) == 2:
break
if j == 1:
top.append(a[i])
... |
s052565075 | p03625 | u994988729 | 1566682782 | Python | Python (3.4.3) | py | Runtime Error | 90 | 18592 | 246 | from collections import Counter
n=int(input())
l=list(map(int,input().split()))
c=Counter(l)
edges=[]
for k,v in c.items():
if v>=2:
for i in range(v//2):
edges.append(k)
edges.sort(reverse=True)
print(edges[0]*edges[1])
|
s613715719 | p03625 | u666198201 | 1566442098 | Python | Python (3.4.3) | py | Runtime Error | 109 | 14480 | 415 | N=int(input())
A=list(map(int,input().split()))
A.sort()
a=0
B=[]
C=[]
count=1
for i in range(len(A)):
if A[i]==a:
count+=1
else:
if count>=2:
B.append(A[i-1])
if count>=4:
C.append(A[i-1])
a=A[i]
count=1
if count>=2:
B.append(A[N-1])
if len(B)... |
s570158674 | p03625 | u627530854 | 1566260299 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 801 | #include <iostream>
#include <map>
using namespace std;
void AssignWherePossible(int &a, int &b, int value)
{
if (a == 0) {
a = value;
} else if (b == 0) {
b = value;
}
}
int main()
{
int n;
cin >> n;
map<int, int> count;
for (auto i = 0; i < n; i += 1) {
int leng... |
s080918127 | p03625 | u037221289 | 1566010606 | Python | Python (3.4.3) | py | Runtime Error | 183 | 25508 | 424 | import collections
N = int(input())
A = list(map(str,input().split(' ')))
C = collections.Counter(A)
L = sorted(C.items(),key=lambda x:x[0],reverse=True)
ans = []
count = 0
for X in L:
if count == 2:
break
if X[1] >= 2:
ans.append(X)
count += 1
if X[1] >= 4:
print(max(int(X[0]**2),int(ans[0][0]) *... |
s423378688 | p03625 | u533039576 | 1565620489 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 329 | from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for ai in a:
d[ai] += 1
cand = [k for k, v in d.items() if v >= 2]
cand.sort()
ans = 0
if len(cand) >= 1 and d[cand[-1]] >= 4:
and = cand[-1] ** 2
if len(cand) >= 2:
ans = cand[-1] * cand[-2]
pr... |
s866834692 | p03625 | u066455063 | 1565230788 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14252 | 326 | N = int(input())
A = list(map(int, input().split()))
A = sorted(reverse=True)
height = 0
width = 0
for i in range(N-1):
if A.count(A[i]) >= 2:
height = A[i]
continue
for i in range(N):
if A[i] != height:
if A.count(A[i]) >= 2:
width = A[i]
break
print(height*w... |
s688076591 | p03625 | u626337957 | 1564672735 | Python | Python (3.4.3) | py | Runtime Error | 82 | 21128 | 497 | N = int(input())
sticks = list(map(int, input().split()))
s_dict = {}
for stick in sticks:
if stick in s_dict:
s_dict[stick] += 1
else:
s_dict[stick] = 1
sorted_dict = sorted(s_dict.items(), key=lambda:-x[0])
side1 = 0
side2 = 0
for elem in sorted_dict:
if elem[1] >= 4:
side1 = side2 = elem[0]
elif ... |
s695732531 | p03625 | u285443936 | 1563937369 | Python | Python (3.4.3) | py | Runtime Error | 166 | 21540 | 331 | import collections
N = int(input())
A = [int(i) for i in input().split()]
A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[0],reverse = True)
e = []
for k,v in A:
if v >= 4:
e.append([k]*2)
elif v >= 2:
e.append(k)
if len(e) >= 2:
break
if len(e) < 2:
ans = 0
else:
ans = e[0]*e[1]... |
s252528933 | p03625 | u668503853 | 1563334113 | Python | Python (3.4.3) | py | Runtime Error | 64 | 18600 | 302 | import collections
N=int(input())
A=[int(x) for x in input().split()]
C=collections.Counter(A)
li=[]
for i,j in C:
if j>=4:
li.append(i)
break
if j>=2:
li.append(i)
if len(li)==2:
break
if len(li)==0:
print(0)
if len(li)==1:
print(li[0]**2)
if len(li)==2:
print(li[0]*li[1]) |
s338002853 | p03625 | u668503853 | 1563333483 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14224 | 277 | N=int(input())
A=[int(x) for x in input().split()]
AA=sorted(set(A),reverse=True)
li=[]
for aa in AA:
if A.count(aa)>=4:
print(a**2)
break
if A.count(aa)>=2:
li.append(aa)
if len(li)==2:
break
if len(li)==0:
print(0)
if len(li)==2:
print(li[0]*li[1])
|
s781134151 | p03625 | u069450081 | 1562867830 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1427 | #include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define S... |
s772867431 | p03625 | u379959788 | 1562678875 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 15276 | 1020 | # ABC071-C
import collections
N = int(input())
A_list = sorted(list(map(int, input().split())), reverse = True)
A_set = set(A_list)
A_set = sorted(A_set, reverse=True)
ans_list = [0]
ans_rectangle_list = [] # 長方形を作る辺を入れる
rec_counter = 0 # 大きい辺を入れる回数,二回入れば良い
for i in range(len(A_set)): # 大きい順に取っていき,リストで個数を確認する
... |
s255463678 | p03625 | u654470292 | 1562121628 | Python | PyPy3 (2.4.0) | py | Runtime Error | 241 | 62832 | 253 | n=int(input())
a=list(map(int,input().split()))
list=[0]*(10**9+1)
for i in range(n):
list[a[i]]+=1
one=0
two=0
for i in range(10**9+1):
if one==0 and list[i]>1:
one=i
elif list[i]>1:
two=one
one=i
print(one*two) |
s890481567 | p03625 | u654470292 | 1562121580 | Python | PyPy3 (2.4.0) | py | Runtime Error | 216 | 62832 | 253 | n=int(input())
a=list(map(int,input().split()))
list=[0]*(10**5+1)
for i in range(n):
list[a[i]]+=1
one=0
two=0
for i in range(10**5+1):
if one==0 and list[i]>1:
one=i
elif list[i]>1:
two=one
one=i
print(one*two) |
s917370101 | p03625 | u223646582 | 1561561060 | Python | Python (3.4.3) | py | Runtime Error | 193 | 24104 | 423 | N=int(input())
from collections import defaultdict
d = defaultdict(int)
for i in input().split():
d[int(i)] += 1
d_sorted = sorted(d.items(), key=lambda x:x[0], reverse=True)
longest=0
for length, n in d_sorted:
if n>=2 and longest!=0:
print(longest*length)
exit()
elif n>=4 and logest==0... |
s447697828 | p03625 | u845620905 | 1561499979 | Python | Python (3.4.3) | py | Runtime Error | 53 | 22828 | 311 | n = int(input())
tables = [0] * (1100000)
a = list(map(int, input().split()))
lines = []
for i in a:
tables[i] = tables[i] + 1
if(tables[i] >= 2):
lines.append(i)
lines = list(set(lines))
lines = sorted(lines, reverse=True)
if(len(lines) >= 2):
print(lines[0] * lines[1])
else:
print(0) |
s335758386 | p03625 | u845620905 | 1561499933 | Python | Python (3.4.3) | py | Runtime Error | 43 | 15148 | 310 | n = int(input())
tables = [0] * (110000)
a = list(map(int, input().split()))
lines = []
for i in a:
tables[i] = tables[i] + 1
if(tables[i] >= 2):
lines.append(i)
lines = list(set(lines))
lines = sorted(lines, reverse=True)
if(len(lines) >= 2):
print(lines[0] * lines[1])
else:
print(0) |
s270792844 | p03625 | u360116509 | 1561395678 | Python | Python (3.4.3) | py | Runtime Error | 97 | 15020 | 301 | def main():
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
i = 0
d = []
while N - 1 > i:
if len(d) == 2:
break
if A[i] == A[i + 1]:
d.append(A[i])
i += 1
i += 1
print(d[0] * d[1])
main()
|
s301924858 | p03625 | u227170240 | 1561002897 | Python | Python (3.4.3) | py | Runtime Error | 180 | 16172 | 357 | n = int(input())
a = list(map(int, input().split()))
deta = [0] * (10 ** 6)
for i in a:
deta[i] += 1
h = 0
w = 0
hind = True
for now in range(len(deta)):
if deta[now] > 3:
h = w = now
elif deta[now] > 1:
if hind:
h = now
hind = False
else:
w = now
... |
s837104975 | p03625 | u227170240 | 1561002849 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14252 | 357 | n = int(input())
a = list(map(int, input().split()))
deta = [0] * (10 ** 5)
for i in a:
deta[i] += 1
h = 0
w = 0
hind = True
for now in range(len(deta)):
if deta[now] > 3:
h = w = now
elif deta[now] > 1:
if hind:
h = now
hind = False
else:
w = now
... |
s243793642 | p03625 | u227170240 | 1561002785 | Python | PyPy3 (2.4.0) | py | Runtime Error | 220 | 62704 | 357 | n = int(input())
a = list(map(int, input().split()))
deta = [0] * (10 ** 5)
for i in a:
deta[i] += 1
h = 0
w = 0
hind = True
for now in range(len(deta)):
if deta[now] > 3:
h = w = now
elif deta[now] > 1:
if hind:
h = now
hind = False
else:
w = now
... |
s750980071 | p03625 | u584174687 | 1560634062 | Python | PyPy3 (2.4.0) | py | Runtime Error | 341 | 72216 | 535 |
from collections import Counter
def main():
num = int(input())
data = Counter(list(map(int, input().split())))
score_sorted = sorted(data.items(), key=lambda x: -x[0])
ans = []
for ele, kosuu in score_sorted:
if kosuu >= 2:
if len(ans) == 0 and kosuu >= 4:
ans ... |
s553204626 | p03625 | u797550216 | 1559765057 | Python | Python (3.4.3) | py | Runtime Error | 112 | 14252 | 523 | n = int(input())
length = list(map(int,input().split()))
length = sorted(length)
length.append(0)
temp = length[0]
c = 1
unique_n = []
square = []
for i in range(n):
if temp == length[i+1]:
c += 1
else:
if c >= 2 :
unique_n.append(length[i-1])
if c >= 4:
... |
s363737802 | p03625 | u172035535 | 1559732360 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 311 | from collections import Counter
n = int(input())
a = list(map(int,input().split()))
ac = Counter(a)
cur_a = 0
cur_c = 0
res = 0
for a,c in ac.items():
if c < 2:
break
if c >= 4:
res = max(res,a*a)
if cur_c == c
res = max(res,cur_a*a)
cur_a = max(cur_a,a)
else:
cur_a = a
cur_c = c
print(res) |
s747293030 | p03625 | u167681750 | 1559443502 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14252 | 206 | n = int(input())
a = list(map(int, input().split()))
sorted_a = sorted([i[0]for i in Counter(a).most_common() if i[1] >= 2], reverse=True)
print(sorted_c_a[0] * sorted_c_a[1] if len(sorted_c_a) >= 2 else 0) |
s679181936 | p03625 | u063052907 | 1558228225 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14224 | 361 | N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []
for a in lst_A:
lst_rod_num[a] += 1
cnt = 0
for i in range(N, -1, -1):
if cnt == 2:
a = lst_ans[0]
b = lst_ans[1]
break
if lst_rod_num[i] >= 2:
lst_ans.append(i)
... |
s970029062 | p03625 | u063052907 | 1558228035 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14252 | 365 | N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []
for a in lst_A:
lst_rod_num[a] += 1
cnt = 0
for i in range(N - 1, -1, -1):
if lst_rod_num[i] >= 2:
lst_ans.append(i)
cnt += 1
if cnt == 2:
a = lst_ans[0]
b = lst_... |
s858017577 | p03625 | u063052907 | 1558227742 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14244 | 361 | N = int(input())
lst_A = list(map(int, input().split()))
lst_rod_num = [0] * (N + 1)
a, b = 0, 0
lst_ans = []
for a in lst_A:
lst_rod_num[a] += 1
cnt = 0
for i in range(N, -1, -1):
if lst_rod_num[i] >= 2:
lst_ans.append(i)
cnt += 1
if cnt == 2:
a = lst_ans[0]
b = lst_ans[... |
s590511990 | p03625 | u603745966 | 1556566823 | Python | Python (3.4.3) | py | Runtime Error | 176 | 25464 | 1815 | from functools import reduce
import collections
import math
def main():
# 文字列の2進数を数値にする
# '101' → '5'
# 文字列の頭に'0b'をつけてint()にわたす
# binary = int('0b'+'101',0)
# 2進数で立っているbitを数える
# 101(0x5) → 2
# cnt_bit = bin(5).count('1')
# N! を求める
# f = math.factorial(N)
# N の逆元
# N_i... |
s504911184 | p03625 | u442030035 | 1556028760 | Python | Python (3.4.3) | py | Runtime Error | 163 | 21412 | 391 | from collections import Counter
N = int(input())
A = [int(i) for i in input().split()]
ct = list(Counter(A).items())
flg = 0
ct. sort(key=lambda x: x[0], reverse=True)
for i in ct:
if i[1] >= 4 and flg == 0:
ans = i[0]**2
break
if i[1] >= 2 and flg == 0:
flg = 1
ans = i[0]
el... |
s793299314 | p03625 | u163320134 | 1555644339 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 283 | n=int(input())
arr=list(map(int,input().split()))+[0]
arr=sorted(arr, reverse=True
ans1=0
ans2=0
count=1
for i in range(n):
if arr[i]!=arr[i+1]:
if count>=2:
if ans1==0:
ans1=arr[i]
else:
ans2=arr[i]
count=1
else:
count+=1
print(ans1*ans2) |
s334544432 | p03625 | u013629972 | 1555163724 | Python | Python (3.4.3) | py | Runtime Error | 127 | 20492 | 1041 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
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()... |
s706792621 | p03625 | u013629972 | 1555163672 | Python | Python (3.4.3) | py | Runtime Error | 129 | 20492 | 1014 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
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()... |
s824454789 | p03625 | u013629972 | 1555162847 | Python | Python (3.4.3) | py | Runtime Error | 122 | 20488 | 893 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
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()... |
s727063257 | p03625 | u013629972 | 1555162747 | Python | Python (3.4.3) | py | Runtime Error | 112 | 20484 | 886 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
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()... |
s221344037 | p03625 | u445624660 | 1554936537 | Python | Python (3.4.3) | py | Runtime Error | 46 | 15080 | 692 | # カウントしていっていけるやつで比較
# 2つ以上の最大のやつと2番目に大きいやつ vs 4つ以上の最大のやつ
n = int(input())
arr = [0 for _ in range(10**5)]
for i in list(map(int, input().split())):
arr[i - 1] += 1
ans = 0
overtwo = []
overfour = []
for idx, a in enumerate(arr):
if a >= 4:
overfour.append(idx + 1)
elif a >= 2:
overtwo.appe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.