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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s029762137 | p03625 | u528825252 | 1503435859 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 805 | N = int(input())
A = list(map(int, input().split(' ')))
B = []
C = []
D = []
for a in A:
if a in B:
C[B.index(a)] += 1
else:
B.append(a)
C.append(1)
I = len(B)
for i in range(I):
D.append([B[i], C[i]])
... |
s554486796 | p03625 | u205803237 | 1503423427 | Python | Python (3.4.3) | py | Runtime Error | 83 | 11096 | 302 | N = input()
A = input().split()
A.sort()
A.reverse()
li = []
for i in range(N-1):
if A[i] == A[i+1]:
a = int(A[i])
li.append(a)
A.remove(a)
A.remove(a)
if len(li) == 2:
break
if len(li) > 1:
print( int(li[0]) * int(li[1]) )
else:
print("0") |
s953161369 | p03625 | u205803237 | 1503423285 | Python | Python (3.4.3) | py | Runtime Error | 84 | 11096 | 289 | N = input()
A = input().split()
A.sort()
A.reverse()
li = []
for i in range(N-1):
if A[i] == A[i+1]:
li.append(A[i])
A.remove(A[i])
A.remove(A[i])
if len(li) == 2:
break
if len(li) > 1:
print( int(li[0]) * int(li[1]) )
else:
print("0") |
s085574741 | p03625 | u163703551 | 1503286573 | Python | Python (3.4.3) | py | Runtime Error | 131 | 18600 | 1350 | import sys
from collections import Counter
# sys.stdin = open('c1.in')
def read_int_list():
return list(map(int, input().split()))
def read_str_list():
return input().split()
def read_int():
return int(input())
def read_str():
return input()
def main():
n = read_int()
a = read_int_lis... |
s312337612 | p03625 | u218984487 | 1503283168 | Python | Python (3.4.3) | py | Runtime Error | 78 | 18600 | 584 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c_dict = Counter(A)
B = []
C = []
for k, v in c_dict.items():
if v >= 4:
B.append(k)
elif v >= 2:
C.append(k)
B.sort(reverse=True)
C.sort(reverse=True)
print(B[0])
print(C[0])
if len(B) < 1 and len(C) < 2:
... |
s153131379 | p03625 | u528825252 | 1503283040 | Python | Python (3.4.3) | py | Runtime Error | 64 | 14244 | 413 | N = int(input())
A = list(map(int, input().split(' ')))
B = list(set(A))
while B:
b = max(B)
if A.count(b) >= 4:
print(b**2)
exit()
elif A.count(b) >=2:
B.remove(b)
while B:
c = max(B)
if A.count(c) >= 2:
print(b*c)
... |
s555558499 | p03625 | u255555420 | 1503282975 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14244 | 361 | N=int(input())
A = list(map(int, input().split()))
R=[]
for i in range(N):
if A.count(A[i])>=2:
R.append(A[i])
if R==[]:
print('0')
else:
R.sort(reverse=True)
if R.count(R[0])>=4:
print(R[0]*R[0])
else:
b = sorted(set(R), key=lambda x: R.index(x))
list(b)
b.... |
s066462093 | p03625 | u528825252 | 1503282521 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14672 | 466 | N = int(input())
A = list(map(int, input().split(' ')))
while not len(A) == 0:
a = max(A)
if A.count(a) >= 4:
print(a**2)
exit()
elif A.count(a) >=2:
while a in A:A.remove(a)
while not len(A) == 0:
a2 = max(A)
if A.count(a2) >= 2:
pr... |
s924152160 | p03625 | u662514021 | 1503282289 | Python | Python (3.4.3) | py | Runtime Error | 1829 | 171760 | 691 |
N = int(input())
x = list(map(int, input().split()))
def quicksort(x):
if x==[]: return []
smallerSorted = quicksort([a for a in x[1:] if a <= x[0]])
biggerSorted = quicksort([a for a in x[1:] if a > x[0]])
return(smallerSorted+[x[0]]+biggerSorted)
y = quicksort(x)
width=[0,0]
height=[0,0]
for i... |
s913218830 | p03625 | u735154525 | 1503282198 | Python | Python (2.7.6) | py | Runtime Error | 1547 | 11448 | 311 | n = input()
a = map(int, raw_input().split())
a.sort(reverse = True)
tmp = [0]
ct = 0
key = a.pop(0)
while len(a) != 1:
nxt = a.pop(0)
if key == nxt:
tmp.append(key)
ct += 1
if ct == 2:
break
key = a.pop(0)
if len(tmp) < 2:
print 0
else:
print tmp[1] * tmp[2] |
s658046514 | p03625 | u444856278 | 1503282039 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11096 | 363 | N = input()
A = input().split()
B = []
C = []
D = []
E = []
for i in A:
if i not in B:
B.append(i)
elif i not in C:
C.append(i)
elif i not in D:
D.append(i)
elif i not in E:
E.append(i)
F = list(map(int,C))
G = list(map(int,E))
F.sort(reverse = True)
G.sort(reverse = True... |
s049156356 | p03625 | u444856278 | 1503281979 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11096 | 405 | N = input()
A = input().split()
B = []
C = []
D = []
E = []
for i in A:
if i not in B:
B.append(i)
elif i not in C:
C.append(i)
elif i not in D:
D.append(i)
elif i not in E:
E.append(i)
F = list(map(int,C))
G = list(map(int,E))
F.sort(reverse = True)
G.sort(reverse = True... |
s700096426 | p03625 | u147628962 | 1503281864 | Python | Python (3.4.3) | py | Runtime Error | 44 | 14244 | 383 | maxi=1000000001
int(input())
l=[int(x) for x in input().split()]
arr=[0]*maxi
for i in l:
arr[i]+=1
max1=0
max2=-1
sqr=0
for i in range(maxi):
if arr[i]>=2:
if i > max1:
max1=i
if arr[i]>=4:
sol=i**2
if sqr < sol :
sqr=sol
for i in range(maxi):
if arr[i]>=2:
if i > max2 and i < max1:
max2=i
re... |
s746339451 | p03625 | u007808656 | 1503281849 | Python | Python (3.4.3) | py | Runtime Error | 79 | 14252 | 151 | n=int(input())
a=map(int, input().split())
a=sorted(a)[::-1]
n=int(myinput)
myinput="3 3 3 3 4 4 4 5 5 5"
a=map(int, myinput.split())
a=sorted(a)[::-1] |
s541898142 | p03625 | u821262411 | 1503281825 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14244 | 353 | n=int(input())
a=list(map(int,input().split()))
s=set(a)
sei=[]
cho=[]
for i in s:
x= a.count(i)
if x >= 4:
sei.append(i)
elif x >= 2:
cho.append(i)
cho2=sorted(cho,reverse=True)
if sei==[] and len(cho)<2:
print(0)
exit()
else:
print(max(max(sei)**2,c... |
s435865791 | p03625 | u735154525 | 1503281514 | Python | Python (2.7.6) | py | Runtime Error | 99 | 11320 | 338 | n = input()
a = map(int, raw_input().split())
a.sort()
f = 1
tmp = [0]
ct = 0
key = a.pop(len(a) - 1)
while len(a) != 0:
nxt = a.pop(len(a) - 1)
if key == nxt:
tmp.append(key)
ct += 1
if ct == 2:
print tmp[1] * tmp[2]
break
key = a.pop(len(a) - 1)
if len(tmp) < 2... |
s127546408 | p03625 | u218984487 | 1503281448 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 410 | N = int(input())
A = list(map(int, input().split()))
A.sort()
A.reverse()
que = []
def solve(i):
if len(que) == 2:
return True
num = A[i]
check = num in que
if A.count(num) > 1 and check == False:
que.append(num)
if i == N - 1:
return False
else:
return solve(i+1... |
s851172587 | p03625 | u735154525 | 1503281415 | Python | Python (2.7.6) | py | Runtime Error | 1555 | 11320 | 323 | n = input()
a = map(int, raw_input().split())
a.sort()
a.reverse()
f = 1
tmp = [0]
ct = 0
key = a.pop(0)
while len(a) != 0:
nxt = a.pop(0)
if key == nxt:
tmp.append(key)
ct += 1
if ct == 2:
print tmp[1] * tmp[2]
break
key = a.pop(0)
if len(tmp) < 2:
print 0
... |
s607951392 | p03625 | u444856278 | 1503281268 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14224 | 405 | N = input()
A = list(map(int,input().split()))
B = []
C = []
D = []
E = []
for i in A:
if i not in B:
B.append(i)
elif i not in C:
C.append(i)
elif i not in D:
D.append(i)
elif i not in E:
E.append(i)
else:
continue
C.sort(reverse = True)
E.sort(reverse = True... |
s321596938 | p03625 | u821262411 | 1503281239 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 14252 | 353 | n=int(input())
a=list(map(int,input().split()))
s=set(a)
sei=[]
cho=[]
for i in s:
x= a.count(i)
if x >= 4:
sei.append(i)
elif x >= 2:
cho.append(i)
cho2=sorted(cho,reverse=True)
if sei==[] and len(cho)<2:
print(0)
exit()
else:
print(max(max(sei)**2,cho... |
s184261316 | p03625 | u735154525 | 1503281179 | Python | Python (2.7.6) | py | Runtime Error | 1546 | 11320 | 321 | n = input()
a = map(int, raw_input().split())
a.sort()
a.reverse()
f = 1
tmp = [0]
ct = 0
key = a.pop(0)
while len(a) != 0:
nxt = a.pop(0)
if key == nxt:
tmp.append(key)
ct += 1
if ct == 2:
break
key = a.pop(0)
if len(tmp) > 2:
print tmp[1] * tmp[2]
else:
print 0
... |
s718187648 | p03625 | u260764548 | 1503280902 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 479 | # -*- coding:utf-8 -*-
N = int(input())
A = map(int,input().split())
A = sorted(A,reverse=True)
i = 0
check = 0
x = 0
y = 0
while(i<=N and check == 0):
count = A.count(A[i])
if(count>=4):
x = A[i]
y = A[i]
check = 1
elif(count>=2):
if(x == 0):
x = A[i]
... |
s315498878 | p03625 | u260764548 | 1503280824 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 501 | # -*- coding:utf-8 -*-
N = int(input())
A = map(int,input().split())
A = sorted(A,reverse=True)
print(A)
i = 0
check = 0
x = 0
y = 0
while(i<=N and check == 0):
count = A.count(A[i])
print(i)
if(count>=4):
x = A[i]
y = A[i]
check = 1
elif(count>=2):
if(x == 0):
... |
s823851106 | p03625 | u846372029 | 1503280597 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 294 | #Make a Rectangle
N = int(input())
A = list(map(int, input().split())
a = sorted(A, reverse=True)
b = []
i = 0
while i<N-2:
if ( a[i]==a[i+1] ):
b+=[a[i]]
i+=2
else:
i+=1
if (len(b)>=2):
break
if (len(b)<2):
print(0)
else:
print(b[0]*b[1]) |
s704782863 | p03625 | u174028570 | 1503280063 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3188 | 366 | edge=[]
edge=input().split()
e=[]
for i in range(len(edge)):
e.append(int[edge])
e.sort()
E=[0,0]
j=0
for i in range(len(e)-1,-1,-1):
if e[i]==e[i-1]:
E[j]=e[i]
j+=1
for k in range(i,-1,-1):
if e[i]==E[j]:
del e[i]
else:
break
... |
s022081222 | p03625 | u112581208 | 1503279866 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 348 | #include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;
int main() {
int N;
int A[100000];
cin >> N;
for(int i = 0; i < ... |
s881097733 | p03625 | u205803237 | 1503279782 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 11300 | 283 | N = input()
A = input().split()
li = []
for a in A:
if A.count(a) > 1:
li.append(a)
A.remove(a)
A.remove(a)
else:
A.remove(a)
if len(li) > 1:
x = int(max(li))
li.remove(x)
y = int(max(li))
print( x * y )
else:
print("0") |
s918009949 | p03625 | u845674689 | 1503279467 | Python | Python (3.4.3) | py | Runtime Error | 95 | 14252 | 599 | N = int(input())
A = list(map(int, input().split(' ')))
A = sorted(A)
A = A[::-1]
first_second_biggest_numpairs = []
flag = False
for i in range(N):
if flag == True:
flag = False
continue
if i < N:
if A[i] == A[i + 1]:
if len(first_second_biggest_numpairs) >= 2:
... |
s065403177 | p03625 | u676264453 | 1503279233 | Python | Python (3.4.3) | py | Runtime Error | 134 | 18060 | 534 | N = int(input())
l = list(map(int, input().split(' ')))
counter = {}
for i in l:
if i in counter:
counter[i] = counter[i] + 1
else:
counter[i] = 1
a = None
b = None
for k in sorted(counter.keys(), reverse=True):
if counter[k] >= 4 and a == None and b == None:
a , b = k
elif co... |
s906683700 | p03625 | u410717334 | 1503279096 | Python | Python (3.4.3) | py | Runtime Error | 86 | 14668 | 273 | N=int(input())
A=list(map(int,input().split()))
A=sorted(A,reverse=True)
if(len(A)%2==1):
A.append(0)
c=0
l=1
for i in range(0,len(A)+1,2):
if(c==2):
break
elif(A[i]==A[i+1]):
c+=1
l*=A[i]
if(c==2):
print(l)
else:
print(int(0)) |
s169384570 | p03625 | u638057737 | 1503278670 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 50856 | 685 | N = int(input())
def quicksort_reverse(lst):
if len(lst) < 2:
return lst
else:
less = []
more = []
pivot = lst[0]
for i in range(1,len(lst)):
if lst[i] < pivot:
less.append(lst[i])
else:
more.append(lst[i])
... |
s006086842 | p03625 | u845674689 | 1503278604 | Python | Python (3.4.3) | py | Runtime Error | 74 | 14252 | 451 | N = int(input())
A = list(map(int, input().split(' ')))
A.sort().reverse()
last_num = 0
first_second_biggest_numpairs = []
for i in range(N):
if A[i] == last_num:
if len(first_second_biggest_numpairs) >= 2:
break
first_second_biggest_numpairs.append(A[i])
last_num = A[i]
if len(fir... |
s733641879 | p03625 | u190952243 | 1503278499 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 339 | n = input()
bars = map(int,raw_input().split(' '))
bars.sort()
h1_cand=0
h2_cand=0
h1=0
h2=0
for i in range(n):
m = n-1-i
if h1 > 0:
if h2_cand == bars[m]:
h2 = h2_cand
break
else
h2_cand = bars[m]
else:
if h1_cand == bars[m]:
h1 = h1_cand
h1_cand = 0
else:
h1_cand = b... |
s549128096 | p03626 | u271064067 | 1599279741 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9224 | 575 | n = int(input())
s1 = str(input())
s2 = str(input())
mod = 10**9+7
def judge(x):
if s1[x] == s2[x]:
b = 1
if s1[x-1] == s2[x-1]:
a = 2
else:
a = 1
else:
b = 2
if s1[x-1] == s2[x-1]:
a = 2
else:
a = 3
return a, b... |
s041314315 | p03626 | u886459614 | 1596934984 | Python | Python (3.8.2) | py | Runtime Error | 31 | 9164 | 360 | n=int(input())
L=input()
S=input()
T=[]
i=0
while n-2>=i:
if L[i]==L[i+1]:
T.append(0)
i+=2
else:
T.append(1)
i+=1
def f(x,y):
if x==0 and y==1:
return 1
if x==0 and y==0:
return 3
if x==1 and y==1:
return 2
if x==1 and y==0:
return 2
if T[0]==0:
ans=3
else:
ans=6
for i in range(len(T)-1):
a... |
s857296679 | p03626 | u886459614 | 1596934948 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9104 | 367 | n=int(input())
L=input()
S=input()
T=[]
i=0
while n-2>=i:
if L[i]==L[i+1]:
T.append(0)
i+=2
else:
T.append(1)
i+=1
def f(x,y):
if x==0 and y==1:
return 1
if x==0 and y==0:
return 3
if x==1 and y==1:
return 2
if x==1 and y==0:
return 2
if T[0]==0:
ans=3
else:
ans=6
print(T)
for i in range(len(T... |
s713330433 | p03626 | u225388820 | 1596661383 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9128 | 445 | '''
∧_,,∧ 究極奥義「WAがACになーれ!!」
(`・ω・)つ━☆・*。
⊂ ノ ・゜+.
し’´J *・
'''
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... |
s548047814 | p03626 | u819135704 | 1595791538 | Python | Python (3.8.2) | py | Runtime Error | 29 | 9192 | 602 | N = int(input())
S1 = list(input())
S2 = list(input())
if len(S1) == 1:
print(3)
else:
if S1[0] != S2[0]:
t = 2
i = 2
a = 6
else:
t = 1
i = 1
a = 3
while True:
if S1[i] != S2[i]:
if t == 2:
a *= 3
else:
... |
s465871104 | p03626 | u860829879 | 1594613386 | Python | PyPy3 (7.3.0) | py | Runtime Error | 83 | 74900 | 461 | n=int(input())
mod=10**9+7
s1=input()
s2=input()
if n==1:
print(3)
exit(0)
if s1[0]==s1[1]:
l=1
ans=6
i=2
else:
l=0
ans=3
i=1
while True:
if i==n-1:
if l==0:
ans*=2
ans%=mod
break
if s1[i+1]==s1[i]:
c=1
i+=2
else:
... |
s016154693 | p03626 | u588794534 | 1589336120 | Python | PyPy3 (2.4.0) | py | Runtime Error | 165 | 38452 | 766 | n=int(input())
s1=input()
s2=input()
mod=1000000007
x=0
cnt=1
while x<3:
if x==0:
if s1[x]==s2[x]:
cnt*=3%mod
x+=1
else:
cnt*=6%mod
x+=2
else:
if s1[x-1]==s2[x-1]:
#x-1:AA
#x :BB CC
if s1[x]==s2[x]:
... |
s098214297 | p03626 | u478266845 | 1587855618 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 716 | n = int(input())
s1 = str(input())
s2 = str(input())
def mult(prev,now):
if (prev == 1)&(now==0:
return 1
else:
return 2
if n == 1:
ans = 3
elif n == 2:
ans = 6
else:
i = 0
flag = 0
ans = 6
while (i <= n - 1):
if s1[i] != s2[i]:
pat = 1
... |
s941403677 | p03626 | u411203878 | 1584823625 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 804 | N = int(input())
S1 = input()
S2 = input()
mod = 10 ** 9 + 7
if S1[0] == S2[0] :
ret = 3
pre = False
i = 1
else :
ret = 6
pre = True
i = 2
while i < N :
cur = (S1[i] != S2[i])
if not pre :
ret *= 2
elif pre and cur :
ret *= 3
ret %= mod
if cur :
... |
s809291056 | p03626 | u863442865 | 1583781991 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3444 | 1110 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect import bisect_left,bisect_... |
s030434156 | p03626 | u863442865 | 1583781727 | Python | Python (3.4.3) | py | Runtime Error | 22 | 3444 | 1010 | def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations
#from itertools import accumulate, product
from bisect import bisect_left,bisect_... |
s085106973 | p03626 | u226912938 | 1583074508 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 601 | n = int(input())
S = []
for _ in range(2):
s = str(input())
S.append(s)
count = 0
mod = (10**9) +7
if S[0][0] == S[1][0]:
ans = 3
else:
ans = 6
while count < n-1:
if (S[0][count] == S[1][count]) and (S[0][count+1] == S[1][count+1]):
ans = ans * 2
ans = ans % mod
count += 1... |
s809867322 | p03626 | u298297089 | 1581119022 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 467 | n = int(input())
s1 = input()
s2 = input()
mod = 10**9+7
dp = [-1] * (n)
if s1[0] == s2[0]:
dp[0] = 1
else:
dp[0] = 2
for i in range(n-1):
if dp[i] == -1:
continue
if s1[i] == s2[i]:
dp[i+1] = (dp[i] * 2) % mod
continue
if i+2 > n:
continue
if s1[i+2] == s2[i+2]:... |
s087253856 | p03626 | u520276780 | 1580583024 | Python | PyPy3 (2.4.0) | py | Runtime Error | 186 | 38384 | 555 | n = int(input())
s = input()
s2 = input()
if len(s)==2:
print(3)
exit()
i = 0
d = []#0が縦、1が横
while i<n:
try:
if s[i]==s[i+1]:
d.append(1)
i+=1
else:
d.append(0)
i+=1
except:
break
ans = 1
#print(d)
if d[0]==0:
ans = 3
else:
an... |
s245689059 | p03626 | u970899068 | 1572134127 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38384 | 378 | n=int(input())
s=list(input())
v=[]
for i in range(1,n):
if s[i]==s[i-1]:
del(v[-1])
v.append(1)
else:
v.append(0)
if v[0]==0:
ans=3
else:
ans=6
for i in range(1,len(v)):
if v[i-1]==0:
ans*=2
elif v[i]==1:
ans*=3
else:
continue
... |
s422177300 | p03626 | u625963200 | 1571777283 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 316 | n=int(input())
S1=input()
S2=input()
mod=1000000007
if n==1:
print(3)
else:
if S1[0]==S2[0]:
ans,i=3,1
else:
ans,i=6,2
while i<n:
if S1[i]==S2[i]:
ans *= 2%mod if S1[i-1]==S2[i-1] else 1%mod
i+=1
else:
ans *= 2%mod if S1[i-1]==S2[i-1] else 3%mod
i+=2
print(ans%(mod)) |
s136239380 | p03626 | u625963200 | 1571776966 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 292 | n=int(input())
S1=input()
S2=input()
if n==1:
print(3)
else:
if S1[0]==S2[0]:
ans,i=3,1
else:
ans,i=6,2
while i<n:
if S1[i]==S2[i]:
ans *= 2 if S1[i-1]==S2[i-1] else 1
i+=1
else:
ans *= 2 if S1[i-1]==S2[i-1] else 3
i+=2
print(ans%(1000000007)) |
s177081659 | p03626 | u223904637 | 1570765936 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 696 | n=int(input())
a=list(input())
b=list(input())
ans=1
i=0
f=0
mod=1000000007
while k!=n:
if i==0:
if a[i]==b[i]:
i+=1
ans*=3
ans%=mod
f=1
else:
i+=2
ans*=6
ans%=mod
f=2
else:
if a[i]==b[i] and ... |
s857018958 | p03626 | u672220554 | 1570564710 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 453 | n = int(input())
s1=input()
s2=input()
mod = 10**9+7
l = []
for i in range(0,n-1):
if s1[i] != s1[i+1]:
if s1[i] != s2[i]:
l.append(0)
else:
l.append(1)
if s1[n-1]==s2[n-1]: l.append(1)
if l[0]:
res = 3
else:
res = 6
for i in range(1,len(l)):
if l[i-1] and l[i]:
... |
s076005345 | p03626 | u172111219 | 1568508969 | Python | PyPy3 (2.4.0) | py | Runtime Error | 187 | 38384 | 660 | def main():
n = int(input())
ls1 = list(input())
ls2 = list(input())
if ls1[0]==ls2[0]:
ans = 3
i =1
flg = "b"
else:
ans = 3
flg = "a"
i =2
while 1:
if ls1[i]==ls2[i]:
if flg == "a":
flg = "b"
els... |
s227760229 | p03626 | u172111219 | 1568508930 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38384 | 680 | def main():
n = int(input())
ls1 = list(input())
ls2 = list(input())
if ls1[0]==ls2[0]:
ans = 3
i =1
flg = "b"
else:
ans = 3
flg = "a"
i =2
while 1:
if ls1[i]==ls2[i]:
if flg == "a":
flg = "b"
... |
s020488856 | p03626 | u123756661 | 1568005549 | Python | PyPy3 (2.4.0) | py | Runtime Error | 213 | 38640 | 276 | mod=1000000007
n=int(input())
s=input()
d=[0]
for i in range(1,n):
if s[i-1]==s[i]:
d[-1]+=1
else:
d.append(0)
ans=[3,6][d[0]]
for i in range(1,len(d)):
if d[i-1]==d[i]==1:
t=3
elif d[i-1]!=1:
t=2
ans=(ans*t)%mod
print(ans) |
s435399237 | p03626 | u123756661 | 1568005171 | Python | PyPy3 (2.4.0) | py | Runtime Error | 171 | 38640 | 298 | mod=1000000007
n=int(input())
a=input()
d=[0]
for i in range(1,n):
if s[i-1]==s[i]:
d[-1]+=1
else:
d.append(0)
ans=[3,6][d[0]]
for i in range(1,len(d)):
if d[i-1]==d[i]==1:
t=3
elif d[i-1]==1:
t=1
else:
t=2
ans=(ans*t)%mod
print(ans) |
s328730711 | p03626 | u366959492 | 1563047839 | Python | PyPy3 (2.4.0) | py | Runtime Error | 172 | 38256 | 1 | l |
s133989785 | p03626 | u069450081 | 1562869578 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 3931 | #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... |
s911845314 | p03626 | u955251526 | 1558420635 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3192 | 1137 | n = int(input())
s = [input() for _ in range(2)]
if n == 1:
print(3)
exit()
law = 10 ** 9 + 7
dp = [[0 for _ in range(2)] for _ in range(n)] # 直前の色と同じかどうか
dp[0][0] = 3
dp[0][1] = 0
dp[1][0] = 0
dp[1][1] = 6
sideway = s[0][1] == s[0][2]
for i in range(2, n):
if sideway:
sideway = False
if s[0... |
s821108321 | p03626 | u644778646 | 1556236795 | Python | PyPy3 (2.4.0) | py | Runtime Error | 181 | 38640 | 511 | N = int(input())
S1 = input()
S2 = input()
i = 1
if S1[0] == S2[0]:
ans = 3
state = 0
else:
i+= 1
ans = 6
state = 1
mod = 10**9 + 7
while N > i:
if S1[i] != S2[i] and state == 0:
ans *= 2
i+=2
state = 1
elif S1[i] != S2[i] and state == 1:
ans *= 3
i+... |
s673262830 | p03626 | u853900545 | 1551369764 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 453 | n = int(input())
s1 = input()
s2 = input()
cnt = 1
i = 0
while 1:
if i == 0:
if s1[i] == s2[i]:
cnt *= 3
s = 0
else:
cnt *= 6
i += 1
s = 1
elif s1[i] == s2[i]:
if s == 0:
cnt *= 2
else:
cnt *= 1
... |
s923846266 | p03626 | u426964396 | 1548466192 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 604 | N = int(input())
S = [input() for _ in range(2)]
M = 1000000007
if S[0][0] == S[1][0]:
last_kind = 0
ans = 3
i = 1
else:
last_kind = 1
ans = 6
i = 2
while i < N:
if last_kind == 0 and S[0][i] == S[1][i]:
ans *= 2
last_kind = 0
i += 1
elif last_kind == 1 and S[0][... |
s459634147 | p03626 | u309977459 | 1548291323 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 8944 | 609 | N = int(input())
S = [input() for _ in range(2)]
M = 1000000007
if S[0][0] == S[1][0]:
last_kind = 0
ans = 3
else:
last_kind = 1
ans = 6
i = 1
while i < N:
if last_kind == 0 and S[0][i] == S[1][i]:
ans *= 2
last_kind = 0
i += 1
elif last_kind == 0 and S[0][i] == S[0][i+1... |
s983030935 | p03626 | u309977459 | 1548286282 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 534 | N = int(input())
S = [input() for _ in range(2)]
M = 1000000007
if S[0][0] == S[1][0]:
last_kind = 0
ans = 3
else:
last_kind = 1
ans = 6
for i in range(1, N):
if last_kind == 0 and S[0][i] == S[1][i]:
ans *= 2
last_kind = 0
elif last_kind == 0 and S[0][i] == S[0][i+1]:
a... |
s500952575 | p03626 | u270681687 | 1538397192 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 813 | n = int(input())
s1 = input()
s2 = input()
mod = 10**9 + 7
# dp[i][j] : i番目まで見たときに、i番目の要素が j = 0 だと縦に、
# j = 1 だと横にブロックが並んでいた時の色の塗りかた (mod 10**9+7)
dp = [[0 for j in range(2)] for i in range(n+1)]
if s1[0] == s2[0]:
dp[1][0] = 3
i = 1
else:
dp[2][1] = 3 * 2
i = 2
while i < n:
if s1[i] == s2[i]:
... |
s890821016 | p03626 | u270681687 | 1538397081 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 756 | n = int(input())
s1 = input()
s2 = input()
mod = 10**9 + 7
# dp[i][j] : i番目まで見たときに、i番目の要素が j = 0 だと縦に、
# j = 1 だと横にブロックが並んでいた時の色の塗りかた (mod 10**9+7)
dp = [[0 for j in range(2)] for i in range(n+1)]
if s1[0] == s2[0]:
dp[1][0] = 3
i = 1
else:
dp[2][1] = 3 * 2
i = 2
while i < n:
if s1[i] == s2[i]:
... |
s859838804 | p03626 | u415905784 | 1536037791 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 357 | N = int(input())
S1 = input()
S2 = input()
p = 10 ** 9 + 7
dp = [0] * (N + 1)
if S1[0] == S2[0]:
dp[0] = 3
else:
dp[0] = 6
for i in range(1, N + 1):
if S1[i] == S1[i - 1]:
dp[i] = dp[i - 1]
elif S1[i - 1] == S2[i - 1]:
dp[i] = dp[i - 1] * 2 % p
elif S1[i] == S2[i]:
dp[i] = dp[i - 1]
else:
dp... |
s287141454 | p03626 | u827202523 | 1532160897 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 937 | N = int(input())
upper = list(input())
lower = list(input())
ans = 0
def count(upper, lower, state):
global ans
if upper[0] == lower[0]:
if state == 1:
ans *= 2
try:
count(upper[1:],lower[1:],state=1)
except:
return ans
if stat... |
s830104611 | p03626 | u004025573 | 1530633820 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 673 | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 3 10:58:30 2018
@author: ashida
"""
N=int(input())
S1=list(input())
S2=list(input())
if S1[0]==S1[1]:
st=2
ans=6
flag=1
else:
st=1
ans=3
flag=-1
while st<N:
if st+1<N:
if S1[st]==S1[st+1]:
if flag<0:
ans*... |
s018734872 | p03626 | u729707098 | 1523679262 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 308 | n = int(input())
x = input()
y = input()
place = 0
if x[0]==y[0]: num,flag = 3,True
else: num,flag = 6,False
while place<n-1:
if flag:
place += 1
num = (num*2)%(10**9+7)
if x[place]!=y[place]: flag = False
else:
place += 2
if x[place]==y[place]: flag=True
else: num=(num*3)%(10**9+7)
print(num) |
s140444997 | p03626 | u642905089 | 1504125413 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 823 | mod = 1000000007
n = int(input())
up = input()
dw = input()
arrays = 1
j = 0
justBefore = None
if up[j] == dw[j]:
arrays *= 3
j += 1
justBefore = "T"
else:
arrays *= 6
j += 2
justBefore = "Y"
while(j != len(up)-1):
if len(up)<3:break
if justBefore == "T":
if up[j] == dw[j]:
... |
s593188047 | p03626 | u642905089 | 1504124831 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 703 | mod = 1000000007
n = int(input())
up = input()
dw = input()
arrays = 1
j = 0
justBefore = None
if up[j] == dw[j]:
arrays *= 3
j += 1
justBefore = "T"
else:
arrays *= 6
j += 2
justBefore = "Y"
while(j != len(up)-1):
if len(up)<3:break
if justBefore == "T":
if up[j] == dw[j]:
... |
s243091597 | p03626 | u642905089 | 1504122411 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 684 | mod = 1000000007
n = int(input())
up = input()
dw = input()
arrays = 1
j = 0
justBefore = None
if up[j] == dw[j]:
arrays *= 3
j += 1
justBefore = 0
else:
arrays *= 6
j += 2
justBefore = 1
while(j != len(up)-1):
if len(up)<3:break
if justBefore:
if up[j] == dw[j]:
... |
s150395165 | p03626 | u642905089 | 1504122168 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 661 | mod = 1000000007
n = int(input())
up = input()
dw = input()
arrays = 1
j = 0
justBefore = None
if up[j] == dw[j]:
arrays *= 3
j += 1
justBefore = 0
else:
arrays *= 6
j += 2
justBefore = 1
while(j != len(up)-1):
if justBefore:
if up[j] == dw[j]:
arrays *= 1
... |
s304793746 | p03626 | u642905089 | 1504121339 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 640 | n = int(input())
up = input()
dw = input()
arrays = 1
j = 0
justBefore = None
if up[j] == dw[j]:
arrays *= 3
j += 1
justBefore = 0
else:
arrays *= 6
j += 2
justBefore = 1
while(j != len(up)-1):
if justBefore:
if up[j] == dw[j]:
arrays *= 1
j += 1
... |
s896096125 | p03626 | u233780116 | 1503284423 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 652 | mod = 1000000007
N = int(input())
S = input()
T = input()
a = 1
b = 0 ###前が横だったら0 縦だったら1
i = 0
while i < N:
if i == 0: ###初期処理
if N == 1:
a *= 3
break
else:
if S[0] == S[1]:
a *= 6
i += 2
b = 0
else:
a *= 3
i += 1
b = 1
if S[i] == S[i+1]:
if b == 0: ###前が横で次も横
a *= 3
i ... |
s371679963 | p03626 | u233780116 | 1503284054 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 817 | mod = 1000000007
N = int(input())
S = input()
T = input()
a = 1
b = 0 ###前が横だったら0 縦だったら1
i = 0
while i < N:
if i == 0: ###初期処理
if N == 1:
a *= 3
break
else:
if S[0] == S[1]:
a *= 6
i += 2
b = 0
else:
a *= 3
i += 1
b = 1
if i == N-1:
if b == 0: ###前が横で次が縦
a *= 1
i += 1
... |
s827309302 | p03626 | u233780116 | 1503283941 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 819 | mod = 1000000007
N = int(input())
S = input()
T = input()
a = 1
b = 0 ###前が横だったら0 縦だったら1
i = 0
while i < N:
if i == 0: ###初期処理
if N == 1:
a *= 3
break
else:
if S[0] == S[1]:
a *= 6
i += 2
b = 0
else:
a *= 3
i += 1
b = 1
if i == N-1:
if b == 0: ###前が横で次が縦
a *= 1
i += 1
... |
s449578014 | p03626 | u916637712 | 1503283465 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2692 | 740 | num=raw_input()
tmp=raw_input()
tmp2=raw_input()
bef="none"
n_state=0
af_state=0
if tmp[0]==tmp[1]:
out=6
else:
out=3
for i in range(1,len(tmp)):
if tmp[i]!=bef:
if i<int(num)-1:
if tmp[i]==tmp[i+1]:
if n_state==0:
out=out*2
else:
... |
s214498093 | p03626 | u341926204 | 1503283291 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3316 | 688 | def d():
N = int(input())
S1 = input()
S2 = input()
from collections import deque
s = deque(S1)
S = ''
for _ in range(N):
try:
if s[0] == s[1]:
S += 'Z'
s.popleft()
s.popleft()
else:
S += 'I'
... |
s713890386 | p03626 | u233780116 | 1503283200 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 755 | N = int(input())
S = input()
T = input()
a = float(1)
b = 0 ###前が横だったら0 縦だったら1
i = 0
while i < N:
if i == 0: ###初期処理
if N == 1:
a *= 3
break
else:
if S[0] == S[1]:
a *= 6
i += 2
b = 0
else:
a *= 3
i += 1
b = 1
if i == N-1:
if b == 0: ###前が横で次が縦
a *= 1
i += 1
b = 1
... |
s328008114 | p03626 | u845674689 | 1503282226 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 747 | N = int(input())
S = [[0 for i in range(N)] for j in range(2)]
S[0] = input()
S[1] = input()
x = 2
y = len(S[0])
patterns = 1
tate_flag = False
yoko_flag = False
last_state = ""
for i in range(y):
if skip is True:
skip = False
continue
if S[0][i] == S[1][i]:
if last_state == "":
... |
s922941800 | p03626 | u190952243 | 1503280451 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 602 | n = input()
st1 = raw_input()
st2 = raw_input()
m = 1
mod = 1000000007
pat = 0 # or 1,2
bl = False
for i in range(n):
if pat == 2 and bl:
bl = False
continue
if st1[i] == st2[i] and pat = 0:
m = m*3/mod
pat = 1
elif st1[i] == st2[i] and pat = 1:
m = m*2/mod
pat = 1
elif st1[i] == st2[i] and... |
s532303066 | p03627 | u801916231 | 1600906630 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8956 | 456 | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int mod = 998244353;
int main() {
int n;
cin >> n;
map<int, int> mp;
rep(i, n) {
int a;
cin >> a;
mp[a]++;
}
ll w = 0, h = 0;
for (auto a : mp) {
if (a.s... |
s360609494 | p03627 | u306412379 | 1600561986 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 19984 | 329 | 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)
p... |
s535415390 | p03627 | u620846115 | 1600492116 | Python | Python (3.8.2) | py | Runtime Error | 76 | 22044 | 250 | import collections
n = int(input())
alist = list(map(int,input().split()))
adic = collections.Counter(alist)
A = [0,0]
for i in adic:
if adic[i] > 1:
A.append(i)
if adic[i] > 3:
A.append(i)
sortedA = sorted(A)
print(sorted[-1]*sorted[-2]) |
s040708066 | p03627 | u620846115 | 1600491638 | Python | Python (3.8.2) | py | Runtime Error | 64 | 22140 | 287 | import collections
n = int(input())
alist = list(map(int,input().split()))
adic = collections.Counter(alist)
for k,v in adic.items():
if v == 1:
del(adic[k])
sort_adic = sorted(adic.items(), reverse = True, key = lambda x:x[1])
li = list(sort_adic.items())
print(li[0][0]*li[1][0]) |
s125358459 | p03627 | u620846115 | 1600491438 | Python | Python (3.8.2) | py | Runtime Error | 62 | 22212 | 287 | import collections
n = int(input())
alist = list(map(int,input().split()))
adic = collections.Counter(alist)
for k,v in adic.items():
if v == 1:
del(adic[k])
sort_adic = sorted(adic.items(), reverse = True, key = lambda x:x[1])
li = list(sort_adic.items())
print(li[0][1]*li[1][1]) |
s478643634 | p03627 | u620846115 | 1600491301 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8968 | 286 | import collections
n = int(input())
alist = list(map(int,input().split()))
adic = collections.Counter(alist)
for k,v in adic.items():
if v == 1:
del(adic[k])
sort_adic = sorted(adic.items(), reverse = True, key = lamda x:x[1])
li = list(sort_adic.items())
print(li[0][1]*li[1][1]) |
s888071492 | p03627 | u620846115 | 1600491263 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8896 | 281 | import collections
n = int(input())
alist = list(int,input().split())
adic = collections.Counter(alist)
for k,v in adic.items():
if v == 1:
del(adic[k])
sort_adic = sorted(adic.items(), reverse = True, key = lamda x:x[1])
li = list(sort_adic.items())
print(li[0][1]*li[1][1]) |
s313761894 | p03627 | u620846115 | 1600491169 | Python | Python (3.8.2) | py | Runtime Error | 19 | 8832 | 280 | import collections
n = int(input())
alist = list(int,input().split())
adic = collections.Counter(alist)
for k,v in adic.items():
if v == 1:
del(dic[k])
sort_adic = sorted(adic.items(), reverse = True, key = lamda x:x[1])
li = list(sort_adic.items())
print(li[0][1]*li[1][1]) |
s809559618 | p03627 | u080364835 | 1600388860 | Python | Python (3.8.2) | py | Runtime Error | 71 | 22232 | 477 | from collections import Counter
n = int(input())
A = list(map(int, input().split()))
c = Counter(A)
over4 = []
over2 = []
for k, v in c.items():
if v >= 4:
over4.append(k)
elif v >= 2:
over2.append(k)
over4.sort(reverse=True)
over2.sort(reverse=True)
s1, s2, s3 = 0, 0, 0
if len(over4) > 0:
... |
s823518403 | p03627 | u168416324 | 1600041735 | Python | PyPy3 (7.3.0) | py | Runtime Error | 114 | 85116 | 224 | n=int(input())
a=list(map(int,input().split()))
f=0
s=0
mx=max(a)
cnt=[0]*(mx+1)
for i in a:
cnt[i]+=1
for (j,i) in zip(cnt,range(mx+1)):
if j>=2:
if j>=4:
f=i
s=i
else:
s=f
f=i
print(f*s) |
s587794697 | p03627 | u624613992 | 1600009796 | Python | PyPy3 (7.3.0) | py | Runtime Error | 126 | 85476 | 293 | n = int(input())
a = sorted(list(map(int, input().split())))
lst = [0] * max(a)
l1 = 0
l2 = 0
for i in range(n):
lst[a[i] - 1] += 1
temp = lst[a[i] - 1]
if temp >= 4:
l1 = a[i]
l2 = a[i]
elif l1 != a[i] and temp >= 2:
l1, l2 = a[i], l1
print(l1 * l2) |
s014576866 | p03627 | u624613992 | 1600009695 | Python | Python (3.8.2) | py | Runtime Error | 69 | 19948 | 294 | n = int(input())
a = sorted(list(map(int, input().split())))
lst = [0] * max(a)
l1 = 0
l2 = 0
for i in range(n):
lst[a[i] - 1] += 1
temp = lst[a[i] - 1]
if temp >= 4:
l1 = a[i]
l2 = a[i]
elif l1 != a[i] and temp >= 2:
l1, l2 = a[i], l1
print(l1 * l2)
|
s320335566 | p03627 | u575956662 | 1599798116 | Python | Python (3.8.2) | py | Runtime Error | 2228 | 656732 | 344 | n = int(input())
an = list(map(int, input().split()))
a_max = max(an)
z = [0 for i in range(a_max)]
l = sorted(an, reverse=True)
l2 = []
flag = 0
for i in range(len(l)):
if z[l[i]-1]==1:
l2.append(l[i])
flag+=1
z[l[i]-1]+=1
else:
z[l[i]-1]+=1
if flag == 2:
break
Ans ... |
s752766385 | p03627 | u583507988 | 1599604575 | Python | Python (3.8.2) | py | Runtime Error | 67 | 19984 | 470 | n=int(input())
a=list(map(int,input().split()))
a.sort()
cnt=0
data=[0]*max(a)
while cnt<n-1:
if a[cnt]==a[cnt+1]:
data[a[cnt]-1]+=1
cnt+=2
else:
cnt+=1
data.reverse()
h=0
w=0
for i in range(len(data)):
if data[i]==0:
continue
elif data[i]==1:
if h==0:
h=len(data)-i
elif h!=0 and w... |
s185161481 | p03627 | u583507988 | 1599604158 | Python | PyPy3 (7.3.0) | py | Runtime Error | 121 | 85052 | 470 | n=int(input())
a=list(map(int,input().split()))
a.sort()
cnt=0
data=[0]*max(a)
while cnt<n-1:
if a[cnt]==a[cnt+1]:
data[a[cnt]-1]+=1
cnt+=2
else:
cnt+=1
data.reverse()
h=0
w=0
for i in range(len(data)):
if data[i]==0:
continue
elif data[i]==1:
if h==0:
h=len(data)-i
elif h!=0 and w... |
s378190233 | p03627 | u277104886 | 1598234881 | Python | Python (3.8.2) | py | Runtime Error | 76 | 22244 | 235 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
b1 = [i[0] for i in c.items() if i[1] >= 4]
b2 = [i[0] for i in c.items() if 4 >= i[1] >= 2]
b = b1 + b2
b.sort()
print(b[-1]*b[-2]) |
s029323765 | p03627 | u464205401 | 1596243141 | Python | Python (3.8.2) | py | Runtime Error | 134 | 25720 | 323 | import collections
n = int(input())
a = list(map(int,input().split()))
c = sorted(collections.Counter(a).items(),reverse = True)
num2=[]
num4=[]
for k in c:
if k[1]>=4:
num4.append(k[0])
if k[1]>=2:
num2.append(k[0])
if len(num2)>=2 or len(num4)>=1:
print(max(num2[0]*num2[1],num4[0]**2))
else:
print(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.