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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s265475850 | p03627 | u536113865 | 1536448389 | Python | Python (3.4.3) | py | Runtime Error | 19 | 5156 | 390 | n = int(input())
a = input()
b = input()
ans = 3
i = 0
if a[0] != b[0]:
i += 1
ans += 3
while i < n-1:
if a[i]==b[i]:
if a[i+1]==b[i+1]:
ans *= 2
else:
ans *= 2
i += 1
else:
if a[i+1]==b[i+1]:
ans *= 1
else:
an... |
s255369447 | p03627 | u536113865 | 1535320125 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14352 | 124 | n = int(input())
a = list(map(int, input().split()))
u = list(set(a))
u = [i for i in u if a.count(i)>1]
print(u[-1]*u[-2])
|
s482739276 | p03627 | u598167418 | 1531005052 | Python | PyPy2 (5.6.0) | py | Runtime Error | 98 | 53612 | 282 | '''input
2 2
3
2 1 1
'''
from collections import Counter
n = input()
arr = map(int,raw_input().split())
c = Counter(arr)
li = []
for i in c:
if c[i] >= 2:
li.append(i)
li.sort()
if li == 1:
print li[-1]**2
else:
if c[li[-1]] >= 4:
print li[-1]**2
else:
print li[-1]*li[-2] |
s258351624 | p03627 | u598167418 | 1531004935 | Python | PyPy2 (5.6.0) | py | Runtime Error | 92 | 53740 | 176 | from collections import Counter
n = input()
arr = map(int,raw_input().split())
c = Counter(arr)
li = []
for i in c:
if c[i] >= 2:
li.append(i)
li.sort()
print li[-1]*li[-2]
|
s943313411 | p03627 | u672620970 | 1529969156 | Python | Python (3.4.3) | py | Runtime Error | 31 | 12576 | 713 | def check(i,j):
if i > 0:
k = S[j][i-1]
if k in checked and not k in C:
C.append(k)
if j > 0:
l = S[j-1][i]
if l in checked and not l in C:
C.append(l)
N = int(input())
S = [list(input()) for _ in range(2)]
ans = 1
checked = {}
for i in range(N):
for ... |
s781833096 | p03627 | u672620970 | 1529969065 | Python | Python (3.4.3) | py | Runtime Error | 31 | 13472 | 713 | def check(i,j):
if i > 0:
k = S[j][i-1]
if k in checked and not k in C:
C.append(k)
if j > 0:
l = S[j-1][i]
if l in checked and not l in C:
C.append(l)
N = int(input())
S = [list(input()) for _ in range(2)]
ans = 1
checked = {}
for i in range(N):
for ... |
s874805515 | p03627 | u872575323 | 1513390598 | Python | Python (3.4.3) | py | Runtime Error | 88 | 14252 | 365 | n =int(input())
nums = input().split(" ")
nums =[int(i) for i in nums]
nums_sort = sorted(nums, reverse=True)
multi_list =[]
cheak =-1
for i in nums_sort:
if cheak == i:
multi_list.append(i)
cheak =-1
if(len(multi_list)>=2):
break
continue
else:
cheak=i
... |
s093061841 | p03627 | u872575323 | 1513317997 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 331 | n =int(input())
nums = input().split(" ")
nums =[int(i) for i in nums]
nums_sort = sorted(nums, reverse=True)
for i in nums:
count =nums.count(i)
if(count > 1):
for j in range(count-1):
nums_sort.remove(i)
nums.remove(i)
else:
nums_sort.remove(i)
print(nums_sort[0]*nu... |
s986730538 | p03627 | u872575323 | 1513315586 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14252 | 223 | n =int(input())
nums = input().split(" ")
nums =[int(i) for i in nums]
num3=[]
for i in nums:
if(nums.count(i)>=2):
num3.append(i)
# nums.remove(i)
num2= sorted(num3, reverse=True)
print(num2[0]*num2[1]) |
s946255088 | p03627 | u872575323 | 1513315308 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14224 | 221 | n =int(input())
nums = input().split(" ")
nums =[int(i) for i in nums]
num3=[]
for i in nums:
if(nums.count(i)>=2):
num3.append(i)
nums.remove(i)
num2= sorted(num3, reverse=True)
print(num2[0]*num2[1]) |
s661937278 | p03627 | u582618615 | 1506521609 | Python | PyPy2 (5.6.0) | py | Runtime Error | 44 | 27884 | 415 | n = int(raw_input())
occ = {}
for i in map(int, raw_input().split()):
if not i in occ:
occ[i] = 0
occ[i] += 1
found = 0
rect = 1
for i in sorted(occ, reverse=True):
if occ[i] >= 4 and found < 1:
found += 2
rect *= i*i
elif occ[i] => 2:
found += 1
rect *= i
... |
s791372076 | p03627 | u582618615 | 1506521559 | Python | PyPy2 (5.6.0) | py | Runtime Error | 39 | 28012 | 401 | n = int(raw_input())
occ = {}
for i in map(int, raw_input().split()):
if not i in occ:
occ[i] = 0
occ[i] += 1
found = 0
rect = 1
for i in sorted(occ, reverse=True):
if occ[i] >= 4:
found += 2
rect *= i*i
elif occ[i] => 2:
found += 1
rect *= i
if found == ... |
s986020071 | p03627 | u045930594 | 1506119222 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 306 | = int(input())
a = list(map(int, input().split()))
bar_list = {}
for i in a:
if i in bar_list:
bar_list[i] += 1
else:
bar_list[i] = 1
saved = -1
ans = 0
for k, v in sorted(bar_list.items(), key=lambda x:x[1]):
if v > 1:
if saved < 0:
saved = k
else:
ans = saved * k
break
print(ans)
|
s810386982 | p03627 | u513786421 | 1504371573 | Python | Python (2.7.6) | py | Runtime Error | 2104 | 11320 | 374 | def checkio(data):
list = []
for i in data:
for x in range(data.index(i) + 1,len(data)):
if i == data[x]:
list.append(i)
break
return list
n = int(input())
list2 = checkio(map(int,raw_input().split()))
list2.sort()
if len(list2) < 3 == True:
print 0
e... |
s618945873 | p03627 | u686254986 | 1504342040 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 253 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
c = 0
for j in range(len(a)-1):
if(c => 2):
print(l[0] * l[1])
if(a[j] == a[j+1]):
del l[0]
l.append(a[j])
j += 1
c += 1 |
s835861431 | p03627 | u686254986 | 1504342013 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 257 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
c = 0
for j in range(len(a)-1):
if(count => 2):
print(l[0] * l[1])
if(a[j] == a[j+1]):
del l[0]
l.append(a[j])
j += 1
c += 1 |
s303184850 | p03627 | u686254986 | 1504341974 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 261 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
c = 0
for j in range(len(a)-1):
if(count => 2):
print(l[0] * l[1])
if(a[j] == a[j+1]):
del l[0]
l.append(a[j])
j += 1
count += 1 |
s054571230 | p03627 | u686254986 | 1504341940 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 265 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
count = 0
for j in range(len(a)-1):
if(count => 2):
print(l[0] * l[1])
if(a[j] == a[j+1]):
del l[0]
l.append(a[j])
j += 1
count += 1 |
s032912317 | p03627 | u686254986 | 1504341902 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 279 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
count = 0
for j in range(len(a)-1):
if(count => 2):
print(l[0] * l[1])
break
if(a[j] == a[j+1]):
del l[0]
l.append(a[j])
j += 1
count += 1 |
s023227086 | p03627 | u686254986 | 1504341829 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 280 | n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
l = [0,0]
count = 0
for j in range(len(a)-1):
if(count => 2):
print(l[0] * l[1])
exit()
if(a[j] == a[j+1]):
del l[0]
l.append(a[j])
j += 1
count += 1 |
s765804896 | p03627 | u352067440 | 1504241760 | Python | Python (3.4.3) | py | Runtime Error | 25 | 5744 | 663 | 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
eli... |
s466732822 | p03627 | u792078574 | 1504237415 | Python | Python (2.7.6) | py | Runtime Error | 16 | 11520 | 266 | raw_input()
ls = map(int, raw_input())
ls.sort()
ls.reverse()
i = 0
answer = []
while i < len(ls) - 1:
if ls[i] == ls[i+1]:
answer.append(ls[i])
if len(answer) >= 2:
break
i += 2
if len(answer) == 2:
print answer[0] * answer[1]
else:
print 0 |
s000383972 | p03627 | u946386741 | 1503415239 | Python | Python (3.4.3) | py | Runtime Error | 91 | 14252 | 324 | N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
res = [0]
tmp = -1
for a in A:
if a == tmp:
res.append(a)
tmp = -1
else:
tmp = a
if len(res) > 2:
break
res = sorted(res, reverse=True)
result = 1
for i in range(2):
result *= res[i]
print(resu... |
s606567510 | p03627 | u174404613 | 1503357036 | Python | Python (3.4.3) | py | Runtime Error | 16 | 2940 | 636 | #coding utf-8
_=input()
bars=[i for i in map(int,input().split())]
bars.sort(reverse=True)
stock=[]
ret=0
_old=-1
for bar in bars:
if bar=_old:
continue
_old=bar
count=bars.count(bar)
if count>=4:
if len(stock)!=0 and bar not in stock:
#print("ret bar bar")
ret=b... |
s153275624 | p03627 | u162202142 | 1503332540 | Python | Python (2.7.6) | py | Runtime Error | 14 | 3732 | 699 | a = []
x = input()
str1 = raw_input()
str2 = raw_input()
count = 0
while True:
if count>x-1:
break
if str1[count] == str2[count]:
a.append("v")
count+=1
else:
a.append("h")
count+=2
total = 1
if a[0] == "h":
total*=6
if a[0] == "v":
total*=3
for i in range(1, ... |
s536359407 | p03627 | u162202142 | 1503309448 | Python | Python (2.7.6) | py | Runtime Error | 102 | 19176 | 444 | x = input()
a = []
a = map(int, raw_input().split())
b = []
d = {}
for i in range(len(a)):
if a[i] in d:
d[a[i]]+=1
else:
d[a[i]] = 1
g = []
for key in d:
if d[key]>=2:
b.append(key)
if d[key]>=4:
g.append(key)
b.sort()
g.sort()
if len(b)<2 and len(g) == 0:
print 0
el... |
s384827264 | p03627 | u162202142 | 1503309428 | Python | PyPy2 (5.6.0) | py | Runtime Error | 97 | 54116 | 444 | x = input()
a = []
a = map(int, raw_input().split())
b = []
d = {}
for i in range(len(a)):
if a[i] in d:
d[a[i]]+=1
else:
d[a[i]] = 1
g = []
for key in d:
if d[key]>=2:
b.append(key)
if d[key]>=4:
g.append(key)
b.sort()
g.sort()
if len(b)<2 and len(g) == 0:
print 0
el... |
s855397125 | p03627 | u162202142 | 1503309307 | Python | PyPy2 (5.6.0) | py | Runtime Error | 82 | 54116 | 444 | x = input()
a = []
a = map(int, raw_input().split())
b = []
d = {}
for i in range(len(a)):
if a[i] in d:
d[a[i]]+=1
else:
d[a[i]] = 1
g = []
for key in d:
if d[key]>=2:
b.append(key)
if d[key]>=4:
g.append(key)
b.sort()
g.sort()
if len(b)<2 and len(g) == 0:
print 0
el... |
s925934328 | p03627 | u162202142 | 1503309262 | Python | PyPy2 (5.6.0) | py | Runtime Error | 80 | 54116 | 387 | x = input()
a = []
a = map(int, raw_input().split())
b = []
d = {}
for i in range(len(a)):
if a[i] in d:
d[a[i]]+=1
else:
d[a[i]] = 1
g = []
for key in d:
if d[key]>=2:
b.append(key)
if d[key]>=4:
g.append(key)
b.sort()
g.sort()
if len(b)<2 and len(g) == 0:
print 0
el... |
s806223039 | p03627 | u162202142 | 1503309214 | Python | PyPy2 (5.6.0) | py | Runtime Error | 35 | 27756 | 386 | x = input()
a = []
a = map(int, raw_input().split())
b = []
d = {}
for i in range(len(a)):
if a[i] in d:
d[a[i]]+=1
else:
d[a[i]] = 1
g = []
for key in d:
if d[key]>=2:
b.append(key)
if d[key]>=4:
g.append(key)
b.sort()
g.sort()
if len(b)<2 and len(g) == 0:
print 0
el... |
s738447966 | p03627 | u327466606 | 1503295598 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 206 | 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]) |
s030821061 | p03627 | u299869545 | 1503285290 | Python | Python (2.7.6) | py | Runtime Error | 80 | 11320 | 230 | input()
a = map(int, raw_input().split())
a.sort(reverse = True)
edge = []
p = 1
while p < a.size():
if a[p] == a[p-1]:
edge.append(a[p])
p += 2
else:
p += 1
edge.append(0)
edge.append(0)
print edge[0] * edge[1] |
s951323241 | p03627 | u299869545 | 1503285251 | Python | Python (2.7.6) | py | Runtime Error | 76 | 11320 | 230 | input()
a = map(int, raw_input().split())
a.sort(reverse = True)
edge = []
p = 1
while p < a.size():
if a[p] == a[p-1]:
p += 2
edge.append(a[p])
else:
p += 1
edge.append(0)
edge.append(0)
print edge[0] * edge[1] |
s834158049 | p03627 | u466826467 | 1503284303 | Python | Python (3.4.3) | py | Runtime Error | 1547 | 14224 | 411 | if __name__ == '__main__':
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
v = []
while len(A) != 0:
if len(v) == 2:
break
if A[0] == A[1]:
v.append(A[0])
A.pop(0)
A.pop(0)
else:
A.pop(0)... |
s421679380 | p03627 | u781758937 | 1503281670 | Python | Python (3.4.3) | py | Runtime Error | 353 | 31964 | 332 | import numpy as np
N = int(input())
A = np.array([int(i) for i in input().split()])
A.sort()
A = A[::-1]
l = []
for i in range(1,N):
cnt = 0
flg = 0
if A[i] == A[i-1] and flg == 0:
l.append(A[i].astype(np.int64))
flg = 1
else:
flg = 0
if len(l) >= 2:
break
print... |
s722156799 | p03627 | u556812955 | 1503281608 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38640 | 432 | H, W = map(int, input().split())
S = [input() for _ in range(H)]
ans = max(H, W)
f = [1] * W
for i in range(1, H):
f = [(f[j]+1) if (S[i-1][j:j+2] + S[i][j:j+2]).count('#') in [0,2,4] else 1 for j in range(W-1)] + [0]
stk = []
for j, v in enumerate(f):
while len(stk) > 0 and f[stk[-1]] >= v:
... |
s899015122 | p03627 | u781758937 | 1503281561 | Python | Python (3.4.3) | py | Runtime Error | 394 | 32092 | 323 | import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
A = A[::-1]
l = []
for i in range(1,N):
cnt = 0
flg = 0
if A[i] == A[i-1] and flg == 0:
l.append(A[i].astype(np.int64))
flg = 1
else:
flg = 0
if len(l) >= 2:
break
print(l[0]*l[1]... |
s122435087 | p03627 | u346308892 | 1503279477 | Python | Python (3.4.3) | py | Runtime Error | 107 | 14480 | 355 | 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
... |
s012867251 | p03627 | u346308892 | 1503279264 | Python | Python (3.4.3) | py | Runtime Error | 107 | 14224 | 334 | 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])
pri... |
s492505109 | p03627 | u419645731 | 1503279250 | Python | PyPy2 (5.6.0) | py | Runtime Error | 38 | 28396 | 791 | from __future__ import print_function
from collections import deque
from bisect import bisect_left as bl
input = raw_input
range = xrange
def goto(fr, to):
i = bl(occ[to], fr+1)
if i == len(occ[to]): return n+1
return occ[to][i]
s = [-1]+[ord(c)-97 for c in input()]
n = len(s)-1
occ = [[] for i in range(2... |
s478131883 | p03627 | u346308892 | 1503279064 | Python | Python (3.4.3) | py | Runtime Error | 102 | 14244 | 301 | 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])
|
s514570933 | p03627 | u346308892 | 1503277922 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 256 | 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]) |
s105356329 | p03628 | u788703383 | 1591495795 | Python | PyPy3 (2.4.0) | py | Runtime Error | 186 | 38640 | 275 | n = int(input())
*a, = map(int,input().split())
c = [0 for _ in range(10**5+1)]
for A in a:
c[A] += 1
ans = 0
l = len(c)
for i in range(l):
z = c[i]
if 0 <= i - 1 <l:
z += c[i-1]
if 0 <= i+1 <l:
z += c[i+1]
ans = max(ans, z)
print(ans)
|
s698548777 | p03628 | u778204640 | 1591144990 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 241 | M = 10**9+7
n = int(input())
s = input()
t = input()
ans = 3 if s[0] == t[0] else 6
for i in range(1, n):
if s[i-1] == s[i]:
continue
if s[i-1] == t[i-1]:
ans = ans * 2 % M
else if s[i] != t[i]:
ans = ans * 3 % M
print(ans) |
s290643770 | p03628 | u542190960 | 1590237047 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 603 | n = int(input())
s1 = str(input())
s2 = str(input())
cnt = 1
for i in range(n):
if i == 0:
if s1[i] == s2[i]:
cnt = cnt * 3
previous = 'tate'
else:
cnt = cnt * 6
previous = 'yoko1'
else:
if s1[i] == s2[i]: #tate
if previous ... |
s737083647 | p03628 | u545368057 | 1588849827 | Python | PyPy3 (2.4.0) | py | Runtime Error | 180 | 38256 | 593 | n = int(input())
s1 = input()
s2 = input()
mod = 10**9 + 7
ind = []
for i,(_s1,_s2) in enumerate(zip(s1,s2)):
if _s1 == _s2:
ind.append(i)
# print(ind)
cnt = 0
if ind[0] == 0:
d = 3
single = True
cnt = 1
else:
d = 6
single = False
cnt = 2
while cnt < n:
if cnt in ind: # ... |
s338002573 | p03628 | u988402778 | 1588824190 | Python | PyPy3 (2.4.0) | py | Runtime Error | 306 | 64236 | 18156 | def main(sample_file = ''):
""" convenient functions
# for i, a in enumerate(iterable)
# q, mod = divmod(a, b)
# divmod(x, y) returns the tuple (x//y, x%y)
# Higher-order function: reduce(operator.mul, xyz_count, 1)
# manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc... |
s662823205 | p03628 | u571969099 | 1588334124 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 532 | n, m, p = [int(i) for i in input().split()]
e = [[int(i) for i in input().split()] for _ in range(m)]
for i in e:
i[0] -= 1
i[1] -= 1
i[2] -= p
d = [0] * n
ok = [False] * n
ok[0] = True
for _ in range(n):
for a, b, c in e:
if ok[a]:
d[b] = max(d[b], d[a] + c)
ok[b] = T... |
s286322444 | p03628 | u246217175 | 1587942301 | Python | PyPy3 (2.4.0) | py | Runtime Error | 182 | 38384 | 395 | n = int(input())
s = input()
s = s + "0"
s2 = input()
MOD = 10**9 + 7
al = []
for i in range(n):
if s[i] != s[i+1]:
al.append(a0)
a0 = 1
else:
a0 += 1
if al[0] == 1:
ans = 3
else:
ans = 6
for i in range(len(al)-1):
if al[i] == 1:
ans = ans * 2 % MOD
else:
... |
s524971637 | p03628 | u349091349 | 1576097526 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 520 | N=int(input())
S=list(input())
T=list(input())
state=[]
lim=1000000007
i=0
while i<=N:
if S[i] == T[i]:
state.append(0)
i+=1
else:
state.append(1)
i+=2
ans=3
for i in range(1,len(state)):
if state[i] == 1 and state[i-1] == 1:
ans = (ans * 3) % lim
elif state[i... |
s694421291 | p03628 | u802963389 | 1573497843 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 443 | n = int(input())
U = list(input())
input()
mod = 1000000007
idx = 0
li = []
while idx < len(U) - 1:
if U[idx] == U[idx + 1]:
li.append(2)
idx += 1
else:
li.append(1)
idx += 1
if U[-1] != U[-2]:
li.append(1)
ans = 1
pre = li[0]
if pre == 1:
ans = ans * 3 % mod
else:
ans = ans * 6 % mod
for... |
s014195314 | p03628 | u393167737 | 1569958364 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 1058 | def f(horizontal_flag):
if horizontal_flag[0]:
if horizontal_flag[1]:
return 3
else:
return 1
else:
return 2
if N == 1:
print(3)
else:
if A[0] == A[1]:
counter = 6
initial_num = 2
horizontal_flag = [0,1]
else:
count... |
s009116644 | p03628 | u543954314 | 1553088181 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 364 | n = int(input())
s1 = input()
s2 = input()
mod = 10**9+7
b = 0
2did = 0
ans = 0
if s1[0] == s2[0]:
b = 1
ans += 3
else:
2did = 1
ans = 6
for i in range(1,n):
if s1[i] == s2[i]:
if b:
ans = ans*2%mod
b = 1
elif not 2did:
if b:
ans = ans*2%mod
else:
ans = ans*3%mod
2did =... |
s392668027 | p03628 | u631277801 | 1532479878 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 658 | MOD = 1000000007
N = int(input())
S = []
for i in range(2):
S.append(input())
# make XYline
xy = ""
for i in range(len(S[0])):
if S[0][i] == S[1][i]:
xy += "X"
elif S[0][i] == S[0][i+1]:
xy += "Y"
# proceed
if xy[0] == "X":
ans = 3
else:
ans = 6
if len(xy)==1:
pass
else:... |
s451964425 | p03628 | u612721349 | 1504674344 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38640 | 836 | def solve():
n = int(input())
pattern = [[a, b] for a, b in zip(list(input()), list(input()))]
pointer, ans = 0, 0
if pattern[0][0] == pattern[0][1]:
ans = 3
else:
ans = 6
while pointer < n - 1:
current = pattern[pointer][0]
if current == pattern[pointer][1]:
... |
s150998431 | p03628 | u352067440 | 1504240623 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3168 | 1059 | N = int(input())
l1 = input()
l2 = input()
result_f=[3,6]
result_g=[3,6]
def f(N, l1, l2):
if N==1:
return 3
if N==2:
return 6
else:
if l1[len(l1)-1]==l2[len(l2)-1]:
if l1[len(l1)-2]==l2[len(l2)-2]:
l1 = l1[:len(l1)-3]
l2 = l2[:len(l2)-3]
... |
s637437429 | p03628 | u796424048 | 1503510368 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 418 | N = int(input())
S1 = list(input())
S2 = list(input())
i = 0
if S1[i] != S2[i]:
res = 6
i+=2
rear = 1
else :
res = 3
i+=1
rear = 0
while i != (N-1):
if S1[i] != S2[i]:
if rear == 1:
res *= 3
else:
res *= 2
rear = 1
i += 2
else:
... |
s105952580 | p03628 | u796424048 | 1503510196 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3188 | 438 | N = int(input())
S1 = list(input())
S2 = list(input())
i = 0
if S1[i] != S2[i]:
res = 6
i+=2
rear = 1
else :
res = 3
i+=1
rear = 0
while i != (N-1):
if S1[i] != S2[i]:
if rear == 1:
res *= 3
else:
res *= 2
rear = 1
i += 2
else:
... |
s693306172 | p03628 | u712187387 | 1503348797 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 545 | INF = 1000000007
N = int(input())
S1 = input()
S2 = input()
tmp = []
flag = 0
for n in range(N):
if flag==1:
flag=0
continue
elif S1[n]==S2[n]:
tmp.append("type1")
elif S1[n]==S1[n+1]:
tmp.append("type2")
flag=1
if tmp[0]=="type1":
S = 3
elif tmp[1]=="type2":
S = 6
for s in range(1,len... |
s383242839 | p03628 | u712187387 | 1503348771 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3192 | 556 | INF = 1000000007
N = int(input())
S1 = input()
S2 = input()
tmp = []
flag = 0
for n in range(N):
if flag==1:
flag=0
continue
elif S1[n]==S2[n]:
tmp.append("type1")
elif S1[n]==S1[n+1]:
tmp.append("type2")
flag=1
print(tmp)
if tmp[0]=="type1":
S = 3
elif tmp[1]=="type2":
S = 6
for s in ... |
s951315793 | p03629 | u350674072 | 1589664746 | Python | PyPy3 (2.4.0) | py | Runtime Error | 178 | 38640 | 2048 | from sys import stdout
# from copy import copy, deepcopy
from functools import lru_cache
from string import ascii_lowercase
from math import inf
def noop(*object): pass
# print = noop # use print() to debug and uncomment this line to mute it
def main():
ans = solve_case()
stdout.write("{}\n".format(ans))
de... |
s389787460 | p03629 | u350674072 | 1589664545 | Python | Python (3.4.3) | py | Runtime Error | 29 | 4028 | 2038 | import sys
from copy import copy, deepcopy
from functools import lru_cache
from string import ascii_lowercase
from math import inf
def noop(*object): pass
# print = noop # use print() to debug and uncomment this line to mute it
def main():
ans = solve_case()
sys.stdout.write("{}\n".format(ans))
def solve_ca... |
s103585878 | p03629 | u350674072 | 1589664469 | Python | Python (3.4.3) | py | Runtime Error | 28 | 4028 | 2036 | import sys
from copy import copy, deepcopy
from functools import lru_cache
from string import ascii_lowercase
from math import inf
def noop(*object): pass
# print = noop # use print() to debug and uncomment this line to mute it
def main():
ans = solve_case()
sys.stdout.write("{}\n".format(ans))
def solve_ca... |
s490377160 | p03629 | u794173881 | 1580672695 | Python | PyPy3 (2.4.0) | py | Runtime Error | 400 | 91324 | 793 | a = input() + "$"
n = len(a)
alph = "abcdefghijklmnopqrstuvwxyz"
dp = [0] * (n + 1)
next_ = [[-1] * (n + 1) for i in range(26)]
for char in range(26):
tmp = - 1
for i in range(n)[::-1]:
if a[i] == alph[char]:
tmp = i + 1
next_[char][i] = tmp
# print(next_)
def solve(i):
if dp[... |
s408271928 | p03629 | u353797797 | 1575740965 | Python | Python (3.4.3) | py | Runtime Error | 153 | 14540 | 1141 | # numpyとか使って高速化お遊び
import sys
import numpy as np
def main():
inf = 10 ** 7
s = sys.stdin.readline()[:-1]
n = len(s)
s += "".join(chr(i + 97) for i in range(26))
# print(s)
# 次をその文字にした時の「長さ、位置」
size = np.zeros(26, "i8")
pos = [n + i for i in range(26)]
# 解答復元のための移動先
nxt = [-1] * ... |
s568690078 | p03629 | u532966492 | 1571586294 | Python | Python (3.4.3) | py | Runtime Error | 234 | 61236 | 907 | def main():
import sys
input=sys.stdin.readline
s=input()
alpha="abcdefghijklmnopqrstuvwxyz"
l=len(s)
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for i in range(l-1,-1,-1):
for x,y in alpha2.items()... |
s760666636 | p03629 | u532966492 | 1571586001 | Python | Python (3.4.3) | py | Runtime Error | 233 | 61236 | 908 | def main():
import sys
input=sys.stdin.readline
s=input()
alpha="abcdefghijklmnopqrstuvwxyz"
l=len(s)
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for i in range(l-1,-1,-1):
for x,y in alpha2.items()... |
s094610117 | p03629 | u532966492 | 1571585918 | Python | Python (3.4.3) | py | Runtime Error | 248 | 61236 | 917 | def main():
import sys
input=sys.stdin.readline
s=input()
alpha="abcdefghijklmnopqrstuvwxyz"
l=len(s)
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for i in range(l-1,-1,-1):
for x,y in alpha2.items()... |
s129459851 | p03629 | u532966492 | 1571585788 | Python | Python (3.4.3) | py | Runtime Error | 237 | 61236 | 908 | def main():
import sys
input=sys.stdin.readline
s=input()
alpha="abcdefghijklmnopqrstuvwxyz"
l=len(s)
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for i in range(l-1,-1,-1):
for x,y in alpha2.items()... |
s282288346 | p03629 | u532966492 | 1571585432 | Python | Python (3.4.3) | py | Runtime Error | 247 | 61236 | 908 | def main():
import sys
input=sys.stdin.readline
s=input()
alpha="abcdefghijklmnopqrstuvwxyz"
l=len(s)
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for i in range(l-1,-1,-1):
for x,y in alpha2.items()... |
s913750536 | p03629 | u532966492 | 1571585274 | Python | Python (3.4.3) | py | Runtime Error | 241 | 61236 | 913 | def main():
import sys
input=sys.stdin.readline
s=input()
alpha="abcdefghijklmnopqrstuvwxyz"
l=len(s)
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for i in range(l-1,-1,-1):
for x,y in alpha2.items()... |
s042951217 | p03629 | u532966492 | 1571581033 | Python | PyPy3 (2.4.0) | py | Runtime Error | 177 | 39024 | 968 | def main():
import sys
input=sys.stdin.readline
s=input()
l=len(s)
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for x,y in alpha2.items():
for i in range(l-1,-1,-1):
if s[i]==x:
... |
s878818354 | p03629 | u532966492 | 1571578340 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 69608 | 951 | def main():
import sys
input=sys.stdin.readline
s=input()
l=len(s)
alpha="abcdefghijklmnopqrstuvwxyz"
alpha2={j:i for i,j in enumerate(alpha)}
memo=[[0]*26 for _ in range(l,-1,-1)]
for i in range(26):
memo[l][i]=l+1
for x,y in alpha2.items():
for i in range(l-1,-1,-1)... |
s765794737 | p03629 | u848504701 | 1549151280 | Python | Python (3.4.3) | py | Runtime Error | 380 | 70640 | 1060 | abc="abcdefghijklmnopqrstuvwxyz"
A=str(input())
n=len(A)
#make matrix (a-z)*(n characters)
#次にchrが出てくるindex
word_pos=[]
ct=[n]*26
orda=ord("a")
for i in range(n-1,-1,-1):
ct[ord(A[i])-orda]=i
word_pos.append(ct.copy())
word_pos.reverse()
dp=[0]*n+[1,0]
j=n
sep=[]
#区切れめをマーク
for i in range(n-1,-1,-1):
ct=... |
s580595987 | p03629 | u848504701 | 1549151015 | Python | Python (3.4.3) | py | Runtime Error | 468 | 70640 | 964 | abc="abcdefghijklmnopqrstuvwxyz"
A=str(input())
n=len(A)
#make matrix (a-z)*(n characters)
#次にchrが出てくるindex
word_pos=[]
ct=[n]*26
orda=ord("a")
for i in range(n-1,-1,-1):
ct[ord(A[i])-orda]=i
word_pos.append(ct.copy())
word_pos.reverse()
dp=[0]*n+[1,0]
j=n
sep=[]
#区切れめをマーク
for i in range(n-1,-1,-1):
ct=... |
s149274279 | p03629 | u848504701 | 1549150864 | Python | Python (3.4.3) | py | Runtime Error | 493 | 70640 | 863 | abc="abcdefghijklmnopqrstuvwxyz"
A=str(input())
n=len(A)
#make matrix (a-z)*(n characters)
#次にchrが出てくるindex
word_pos=[]
ct=[n]*26
orda=ord("a")
for i in range(n-1,-1,-1):
ct[ord(A[i])-orda]=i
word_pos.append(ct.copy())
word_pos.reverse()
dp=[0]*n+[1,0]
j=n
sep=[]
#区切れめをマーク
for i in range(n-1,-1,-1):
ct=... |
s871282185 | p03629 | u848504701 | 1549143027 | Python | Python (3.4.3) | py | Runtime Error | 162 | 3628 | 805 | A=str(input())
memo=[]
count=0
ans=""
index=[]
for i in range(0,len(A)):
target=A[len(A)-1-i]
if(target not in memo):
memo.append(target)
count+=1
if(count==26):
count=0
memo=[]
index.append(len(A)-1-i)
for i in "abcdefghijklmnopqrstuvwxyz":
if(i not in memo):
... |
s721261204 | p03629 | u310790595 | 1521303446 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1201 | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <lim... |
s266098272 | p03629 | u934019430 | 1503281224 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 82152 | 904 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import *
import random
def readln():
return list(map(int,(input().split(" "))))
def get(p,c):
if c == 0: return ""
for i in range(M):
if F[p][i] == -1: return chr(i + ord('a'))
if C[F[p][i]] < C[p] :
return chr(i + ord... |
s956066914 | p03630 | u015768390 | 1556779358 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 1682 | #include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<complex>
#include<bitset>
#include<numeric>
#define int long long
using nam... |
s026576719 | p03630 | u205413199 | 1536861265 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 986 | #include <cstdio>
#include <cstring>
#define maxn 2010
int n, m, ans;
char s[maxn];
int p[maxn][maxn];
inline int max(int a, int b) {return a > b ? a : b;}
struct node {
int len, h;
void add(int _a, int _b) {len = _a, h = _b;}
} S[maxn];
int top;
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
... |
s563971879 | p03631 | u847033024 | 1600001997 | Python | Python (3.8.2) | py | Runtime Error | 27 | 8944 | 68 | a = int(input())
if a == a[::-1]:
print('Yes')
else:
print('No') |
s849080186 | p03631 | u847033024 | 1600001885 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9144 | 68 | a = int(input())
if a == a[::-1]:
print('Yes')
else:
print('No') |
s829774115 | p03631 | u904995051 | 1599441819 | Python | Python (3.8.2) | py | Runtime Error | 23 | 9084 | 70 | #ABC070A
n = input().split()
print("Yes" if (a[-1] == a[0]) else "No") |
s502995286 | p03631 | u642012866 | 1598898206 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9020 | 38 | print("YNeos"[s:=input()==s[::-1]]::2) |
s902815314 | p03631 | u435974296 | 1598745434 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9020 | 76 | A,B,C=map(int,input().split())
if A == C:
print('Yes')
else:
print('No') |
s772743090 | p03631 | u189806337 | 1598398365 | Python | Python (3.8.2) | py | Runtime Error | 20 | 9160 | 66 | n = int(input())
if n[0] == n[2]:
print('Yes')
else:
print('No') |
s208156662 | p03631 | u835575472 | 1598143567 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9020 | 64 | s - input()
if s[0] == s[-1]:
print("Yes")
else:
print("No") |
s439897051 | p03631 | u190385778 | 1598032233 | Python | Python (3.8.2) | py | Runtime Error | 24 | 8992 | 96 | n = list(int,input())
m = n.sort(reverse=True)
if n == m:
print("Yes")
else:
print("No") |
s462570826 | p03631 | u310381103 | 1597981224 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9076 | 97 | a=input()
b=""
for i in range(len(a),0,-1):
b+=a[i]
if a==b:
print("Yes")
else:
print("No") |
s185379094 | p03631 | u310381103 | 1597981174 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8988 | 92 | a=input()
b=""
for i in range(a,0,-1):
b+=a[i]
if a==b:
print("Yes")
else:
print("No") |
s360747790 | p03631 | u620846115 | 1597958383 | Python | Python (3.8.2) | py | Runtime Error | 24 | 9044 | 66 | x = int(input())
if x[0]==x[2]:
print("Yes")
else:
print("No") |
s594793903 | p03631 | u468972478 | 1597714843 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8952 | 55 | print("Yes" if input() == reversed((input()) else "No") |
s607580536 | p03631 | u714104087 | 1596649924 | Python | PyPy3 (7.3.0) | py | Runtime Error | 95 | 74656 | 48 | n = input()
print("Yes" if n[0]=n[2] else "No") |
s615811632 | p03631 | u739843002 | 1596219634 | Python | Python (3.8.2) | py | Runtime Error | 22 | 8980 | 74 | tmp = input().split(" ")
print("Yes") if tmp[0] == tmp[2] else print("No") |
s704151342 | p03631 | u433380437 | 1595122341 | Python | PyPy3 (7.3.0) | py | Runtime Error | 95 | 74796 | 112 | # その13
# A - Palindromic Number
N = int(input())
if N[0] == N[2]:
print('Yes')
else:
print('No')
|
s740818879 | p03631 | u433380437 | 1595122292 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 74544 | 111 | # その13
# A - Palindromic Number
N = int(input())
if N[0] = N[2]:
print('Yes')
else:
print('No')
|
s011250403 | p03631 | u185806788 | 1594368367 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9108 | 70 | N=list(int(input()))
if N[0]==N[2]:
print("Yes")
else:
print("No") |
s341590459 | p03631 | u598684283 | 1594307371 | Python | Python (3.8.2) | py | Runtime Error | 21 | 8984 | 103 | array = list(map(str, input().split()))
if array[0] == array[2]:
print("Yes")
else:
print("No") |
s291069738 | p03631 | u598684283 | 1594307267 | Python | Python (3.8.2) | py | Runtime Error | 22 | 9168 | 103 | array = list(map(int, input().split()))
if array[0] == array[2]:
print("Yes")
else:
print("No") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.