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
s098695997
p03568
u711238850
1589823200
Python
Python (3.4.3)
py
Runtime Error
18
3060
201
import itertools n = int(input()) a = tuple(map(int,input().split())) ans = 0 for l in itertools.product([-1,0,1],n): t = 1 for i in range(n): t*=(a[i]+l[i]) if t%2==0: ans+=1 print(ans)
s027833728
p03568
u298633786
1586835824
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38256
328
N = int(input()) A = list(map(int, input().split())) ans = 0 even = [a % 2 == 0 for a in A] for i in range(2 ** N): tmp = even.copy() cnt = 0 for j in range(N): if ((i >> j) & 1): tmp[j] = not tmp[j] cnt += 1 if sum(tmp) > 0: ans += 2 ** cnt if i != 0 else 1 pri...
s219042125
p03568
u127499732
1580739819
Python
Python (3.4.3)
py
Runtime Error
17
2940
95
n=int(input()) a=list(map(int,input().split())) x,y=sum(x%2==0 for x in l),n-x print(3**n-2**x)
s222017078
p03568
u403331159
1577834525
Python
Python (3.4.3)
py
Runtime Error
17
2940
123
n=int(input()) a=list(map(int,input().split())) cnt=0 for i range(n): if a[i]%2==0: cnt+=1 ans=(3*n)-2*cnt print(ans)
s077347373
p03568
u518987899
1577770512
Python
PyPy3 (2.4.0)
py
Runtime Error
163
38384
153
N = int(input().strip()) A = list(map(int, input().strip().split(' '))) c_even = len(1 for a in A if a % 2 == 0) ans = 3**len(A) - 2**c_even print(ans)
s177395830
p03568
u008229752
1573687764
Python
Python (3.4.3)
py
Runtime Error
17
2940
2476
#include <iostream> #include <iomanip> #include <string> #include <stack> #include <vector> #include <math.h> #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <map> #include <set> #include <queue> #include <list> #include <regex> using namespace std; using pii = pair<int,int>; ...
s672389551
p03568
u936985471
1573490286
Python
Python (3.4.3)
py
Runtime Error
17
2940
137
n=inr(input()) a=list(map(int,input().split())) odd=True for p in a: if p%2==0: odd=False print(3**n-1-(1 if not odd else 0))
s077000690
p03568
u089668660
1572406370
Python
Python (3.4.3)
py
Runtime Error
18
2940
106
n = int(input()) l =0 for i in range(n): p=(int(input()) if p %2==0: l+=1 print(3**n-2**l)
s620607993
p03568
u089668660
1572406280
Python
Python (3.4.3)
py
Runtime Error
17
2940
105
n = int(input()) l =0 for i in range(n): p=(int(input()) if p %==0: l+=1 print(3**n-2**l)
s207653181
p03568
u777283665
1570484871
Python
Python (3.4.3)
py
Runtime Error
17
2940
85
for i in input().split(): if int(i) % 2 == 0: cnt *= 2 print(3**n - cnt)
s379569269
p03568
u564902833
1564201394
Python
Python (3.4.3)
py
Runtime Error
17
2940
1305
macro_rules! get { (Vec<$t:ty>) => { { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|t| t.parse::<$t>().unwrap()) .collect::<Vec<_>>() } }; ($t:ty) => { ...
s278423210
p03568
u167681750
1561429888
Python
Python (3.4.3)
py
Runtime Error
17
2940
107
print(3 ** int(input()) - reduce(lambda x,y: x*y, (1 if i % 2 == 1 else 2 for i in map(int, input().split()
s772642955
p03568
u167681750
1561429801
Python
Python (3.4.3)
py
Runtime Error
18
2940
100
print(3 ** int(input()) - reduce(mul, (1 if i % 2 == 1 else 2 for i in map(int, input().split()))))
s437172935
p03568
u576434377
1559165618
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38640
459
N = int(input()) As = list(map(int,input().split())) def dfs(A_s, index,Bss): if index == N: tmp = 1 for b in Bss: tmp *= b return 1 if tmp % 2 == 0 else 0 b_mi = Bss.copy() b_mi.append(A_s[index] - 1) b = Bss.copy() b.append(A_s[index]) b_pl = Bss.copy() ...
s312410264
p03568
u163320134
1556034837
Python
Python (3.4.3)
py
Runtime Error
17
2940
119
n=int(input()) arr=list(map(int,input().split())) tmp=1 for i in range(i): if arr[i]%2==0: tmp*=2 print(3**n-tmp)
s308067090
p03568
u280512618
1553207795
Python
Python (3.4.3)
py
Runtime Error
17
3064
119
from functools import reduce n=int(input()) print(3**n-reduce(lambda x, y: x * y, 2-int(s)%2 for s in input().split()))
s596341635
p03568
u811528179
1551638129
Python
Python (3.4.3)
py
Runtime Error
18
2940
861
#include <iostream> #include <vector> #include <numeric> #include <algorithm> #include <cstring> #include <map> #include <set> #include <cmath> #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define INF 1145141919 typedef long long int ll; using n...
s569884198
p03568
u693776163
1538683722
Python
PyPy3 (2.4.0)
py
Runtime Error
161
38256
275
N = int(input()) list =[] for i in range(N): list.append(int(input())) even = [] odd = [] for i in range(len(list)): if list[i] % 2 == 0: even.append(list[i]) else: odd.append(list[i]) result = 3**N -(2**len(even))*(1**len(odd)) print(result)
s751762393
p03568
u146382803
1537153151
Python
Python (3.4.3)
py
Runtime Error
17
2940
150
n = int(input()) a = list(map(int,input().split())) count = 0 for i in range(0, len(a), 1) if a[i] % 2 == 0: count += 1 print(count ** 2)
s534914405
p03568
u351426847
1509238708
Python
Python (2.7.6)
py
Runtime Error
10
2572
265
# -*- coding: utf-8 -*- if __name__ == '__main__': N = raw_input() A = map(int, raw_input().split()) c_total = 1 c_odd = 1 for a in A: c_total *= 3 if a % 2 == 0 and a != 100: c_odd *= 2 print c_total - c_odd
s742372102
p03568
u701131323
1508871366
Python
Python (3.4.3)
py
Runtime Error
20
3060
116
N = int(input()) ans = 3 ** N num = 1 for i in range(N): A = int(input()) num *= (2-(A%2)) print(ans-num)
s403329960
p03568
u943004959
1508723908
Python
Python (3.4.3)
py
Runtime Error
17
3064
458
import itertools def solve(): N = int(input()) A = list(map(int, input().split(" "))) matrix = [[] for _ in range(N)] for i in range(N): matrix[i].append(A[i] - 1) matrix[i].append(A[i]) matrix[i].append(A[i] + 1) cnt = 0 for element in list(itertools.product(*matrix))...
s993573183
p03568
u153147777
1508721123
Python
Python (3.4.3)
py
Runtime Error
18
3056
119
N = int(input()) a = map(int, input().split()) tmp = 3 ** N g = len([c for c in a if a % 2 == 0]) print(tmp - (2 ** g))
s639648253
p03568
u925364229
1508720938
Python
Python (3.4.3)
py
Runtime Error
17
3060
191
#! usr/bin/env python3 #B: N = int(input()) A = list(map(int,input().split(" "))) count = 1 for i in A: if A % 2 == 0: count *= 2 else: pass ans = (3 ** len(A)) - count print(ans)
s099496442
p03569
u792720861
1601426446
Python
Python (3.8.2)
py
Runtime Error
73
12920
313
import sys S = input() A = [] for i,s in enumerate(S): if s != 'x': A.append(i) for i in range(len(A)//2): if S[A[i]] != S[A[-i-1]]: print(-1) sys.exit() ans = abs((len(S)-1-A[-1])-A[0]) for i in range(len(A)//2): cnt = abs(A[i+1]-A[i] - (A[-1-i]-A[-2-i])) ans += cnt print(ans)
s081049861
p03569
u247830763
1601350022
Python
Python (3.8.2)
py
Runtime Error
90
11976
1744
s = list(input()) t = [i for i in s if i != "x"] n = len(t) if "".join(t) != "".join(t[::-1]): print(-1) else: dic = {} cnt = 0 if n % 2 == 0: for j in range(len(s)): if s[j] != "x": cnt += 1 if cnt == n//2: a = s[:j+1] ...
s896729244
p03569
u263824932
1600647860
Python
PyPy3 (7.3.0)
py
Runtime Error
82
79676
467
from collections import deque S=input() deque_S=deque(S) flag=0 ans=0 while True: if deque_S[0] == deque_S[-1]: deque_S.pop() deque_S.popleft() else: if deque_S[0] == 'x': ans+=1 deque_S.pop() elif deque_S[-1] == 'x': ans+=1 deque_S...
s672400073
p03569
u535171899
1599698828
Python
Python (3.8.2)
py
Runtime Error
56
9316
579
def main(): #input data import sys input = lambda:sys.stdin.readline().strip() S = input() N = len(S) #solve left = 0 right = N-1 ans = 0 while True: if right==left: break if S[left]==S[right]: left+=1 right-=1 cont...
s972677299
p03569
u697690147
1599635587
Python
Python (3.8.2)
py
Runtime Error
53
9180
316
s = input() l = 0 r = len(s)-1 cnt = 0 while l < r: lx = 0 while s[l] == "x": lx += 1 l += 1 rx = 0 while s[r] == "x": rx += 1 r -= 1 if s[l] == s[r]: cnt += abs(rx-lx) l += 1 r -= 1 else: cnt = -1 break print(cnt)
s992837398
p03569
u368796742
1599165324
Python
Python (3.8.2)
py
Runtime Error
71
9620
1375
s = list(input()) n = len(s) x = s.count("x") a = n-x if a%2: count = 0 for i in range(n): if s[i] != "x": count += 1 if count == a-a//2: ind = i break count = 0 l = ind-1 r = ind+1 c1 = a//2 while c1 > 0: lc = 0 while l >= ...
s409966979
p03569
u368796742
1599165159
Python
Python (3.8.2)
py
Runtime Error
70
10056
1321
s = list(input()) n = len(s) x = s.count("x") a = n-x if a%2: count = 0 for i in range(n): if s[i] != "x": count += 1 if count == a-a//2: ind = i break count = 0 l = ind-1 r = ind+1 c1 = a//2 while c1 > 0: lc = 0 while l >= ...
s206857167
p03569
u289288647
1598793889
Python
Python (3.8.2)
py
Runtime Error
65
9224
300
s = input() num = len(s) l, r = 0, num-1 ans = 0 while l != r: if s[l] == s[r]: l += 1 r -= 1 else: ans += 1 if s[l] == 'x': l += 1 elif s[r] == 'x': r -= 1 else: print(-1) break print(ans)
s467998269
p03569
u289288647
1598793685
Python
Python (3.8.2)
py
Runtime Error
35
9156
276
s = input() num = len(s) l, r = 0, num-1 for i in range(num//2): if s[l] == s[r]: l += 1 r -= 1 else: if s[l] == 'x' or s[r] == 'x': ans += 1 l += 1 else: print(-1) break print(ans)
s957579117
p03569
u391589398
1598494058
Python
PyPy3 (7.3.0)
py
Runtime Error
84
74832
403
S = input() snx = S.replace('x', '') ls = len(S) if ls == 1: print(0) exit(0) l = 0 r = ls-1 ans = 0 while l < r: lxc = 0 while S[l] == 'x': l += 1 lxc += 1 rxc = 0 while S[r] == 'x': r -= 1 rxc += 1 ans += abs(lxc-rxc) if S[l] == S[r]: l ...
s944872135
p03569
u730769327
1597892754
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74668
278
s=input() t=s.replace('x','') n=len(t) if not(n==1 or t[:n//2]==t[(n+1)//2:][::-1]): print(-1) exit() n=len(s) r=n-1 l=0 ans=0 while r>l: nr,nl=r,l while s[r]=='x':r-=1 while s[l]=='x':l+=1 ans+=abs(nr-r-nl+l) while s[r]==s[l] and l<r: r-=1 l+=1 print(ans)
s252087975
p03569
u202634017
1597634636
Python
Python (3.8.2)
py
Runtime Error
64
9864
317
s = list(input()) l, r = 0, len(s) - 1 ans = 0 while l != r: if s[l] == s[r]: l += 1 r -= 1 else: if s[l] == "x": l += 1 ans += 1 elif s[r] == "x": r -= 1 ans += 1 else: ans = -1 break print(ans)
s897138058
p03569
u074294821
1597422169
Python
PyPy3 (7.3.0)
py
Runtime Error
509
112876
510
def isPal(s): if s == s[::-1]: return True return False s = list(input()) pal = '' for ch in s: if ch != 'x': pal+=ch if not isPal(pal): print(-1) else: beg = s.index(pal[0]) end = len(s)-1 - s[::-1].index(pal[-1]) half = 0 if len(pal) == 1 else len(pal)//2 + 1 cnt = 0 ...
s100981087
p03569
u366886346
1596605983
Python
Python (3.8.2)
py
Runtime Error
80
11140
513
s=list(input()) s2=[] for i in range(len(s)): if s[-i-1]!="x": num=i+1 break s3=["O"]*num for i in range(len(s)): if s[i]!="x": s2.append(s[i]) if i!=len(s)-1: if s[i+1]!="x": s3.append("O") else: s3.append("x") num=0 for i in range(len(s2)...
s736960921
p03569
u266014018
1596210876
Python
Python (3.8.2)
py
Runtime Error
41
9216
586
def main(): import sys def input(): return sys.stdin.readline().rstrip() s = input() n = len(s) cur_l = 0 cur_r = n-1 ans = 0 cnt = 0 while cur_l < cur_r: while s[cur_l] == 'x': cnt += 1 cur_l += 1 while s[cur_r] != s[cur_l]: if s...
s732988161
p03569
u007550226
1596057951
Python
Python (3.8.2)
py
Runtime Error
102
9752
1577
def xcounter(s,nx): l=len(s) cl=[0]*(nx) i=tc=0 while tc<nx: if s[i]!='x': if i==l-1:cl[tc]=0 else: i+=1 c=0 while i<l: if s[i]=='x': i+=1 c+=1 ...
s146981466
p03569
u707498674
1595651364
Python
Python (3.8.2)
py
Runtime Error
53
14660
1133
def main(): s = input() N = len(s) nox = [] idxs = [] ans = 0 for i, c in enumerate(s): if c != "x": nox.append(c) idxs.append(i) if nox != nox[::-1]: print(-1) exit() if len(nox)%2 == 0: left = len(nox)//2 - 1 r...
s345279738
p03569
u028973125
1595638082
Python
Python (3.8.2)
py
Runtime Error
184
9196
512
import sys s = sys.stdin.readline().strip() ans = 0 l = 0 r = len(s) - 1 while l != r: print("left", l, "right", r) if s[l] == "x" and s[r] == "x": l += 1 r -= 1 # rにxを足したとみなし、lを進める elif s[l] == "x": l += 1 ans += 1 # lにxを足したとみなし、rを進める elif s[r] == "x": ...
s375957366
p03569
u941438707
1595631562
Python
Python (3.8.2)
py
Runtime Error
62
9168
341
s=input() i=0 j=len(s)-1 ans=0 while i<j: while s[i]==s[j]=="x": i+=1 j-=1 if i>j:break while s[i]=="x": i+=1 ans+=1 if i>j:break while s[j]=="x": j-=1 ans+=1 if i>j:break if s[i]!=s[j]: ans=-1 break i+=1 j-=1 if...
s931025645
p03569
u768896740
1595631173
Python
Python (3.8.2)
py
Runtime Error
135
10576
678
s = input() if s == s[::-1]: print(0) exit() t = [] for i in range(len(s)): if s[i] != 'x': t.append(s[i]) if t != t[::-1]: print(-1) exit() central_char = t[len(t)//2] s = list(s) s.insert(0, '*') s.append('*') central_position = 0 for i in range(len(s)): if s[i] == central_char...
s593120513
p03569
u941438707
1595630750
Python
Python (3.8.2)
py
Runtime Error
66
9252
404
s=input() i=0 j=len(s)-1 ans=0 while i<j: while s[i]==s[j]=="x": i+=1 j-=1 if i>=len(s) or j<0:break while s[i]=="x": i+=1 ans+=1 if i>=len(s):break if i>j:break while s[j]=="x": j-=1 ans+=1 if j<=-1:break if s[i]!=s[j]: ...
s922652111
p03569
u941438707
1595630683
Python
Python (3.8.2)
py
Runtime Error
59
9188
391
s=input() i=0 j=len(s)-1 ans=0 while i<j: while s[i]==s[j]=="x": i+=1 j-=1 if i>j:break while s[i]=="x": i+=1 ans+=1 if i>=len(s):break if i>j:break while s[j]=="x": j-=1 ans+=1 if j<=-1:break if s[i]!=s[j]: ans=-1 ...
s205447616
p03569
u941438707
1595630598
Python
Python (3.8.2)
py
Runtime Error
57
9196
370
s=input() i=0 j=len(s)-1 ans=0 while i<j: while s[i]==s[j]=="x": i+=1 j-=1 while s[i]=="x": i+=1 ans+=1 if i==len(s):break if i>j:break while s[j]=="x": j-=1 ans+=1 if j==-1:break if s[i]!=s[j]: ans=-1 break if i>j:b...
s502838990
p03569
u941438707
1595630219
Python
Python (3.8.2)
py
Runtime Error
62
9224
316
s=input() i=0 j=len(s)-1 ans=0 while i<j: while s[i]=="x": i+=1 ans+=1 if i>len(s):break if i==j:break while s[j]=="x": j-=1 ans+=1 if j<0:break if s[i]!=s[j]: ans=-1 break if i==j:break i+=1 j-=1 if i>j:break print(ans)
s743258140
p03569
u941438707
1595630147
Python
Python (3.8.2)
py
Runtime Error
58
9176
317
s=input() i=0 j=len(s)-1 ans=0 while i!=j: while s[i]=="x": i+=1 ans+=1 if i>len(s):break if i==j:break while s[j]=="x": j-=1 ans+=1 if j<0:break if s[i]!=s[j]: ans=-1 break if i==j:break i+=1 j-=1 if i>j:break print(ans)
s380276582
p03569
u941438707
1595630036
Python
Python (3.8.2)
py
Runtime Error
48
9008
270
s=input() i=0 j=len(s)-1 ans=0 while i!=j: while s[i]=="x": i+=1 ans+=1 if i==j:break while s[j]=="x": j-=1 ans+=1 if s[i]!=s[j]: ans=-1 break if i==j:break i+=1 j-=1 if i>j:break print(ans)
s530047333
p03569
u941438707
1595629928
Python
Python (3.8.2)
py
Runtime Error
63
9176
272
s=input() i=0 j=len(s)-1 ans=0 while i!=j: while s[i]=="x": i+=1 ans+=1 if i==j: break while s[j]=="x": j-=1 ans+=1 if s[i]!=s[j]: ans=-1 break if i==j: break i+=1 j-=1 print(ans)
s633200211
p03569
u028973125
1595613959
Python
Python (3.8.2)
py
Runtime Error
99
19528
1200
import sys from collections import deque s = sys.stdin.readline().strip() # (元の文字列のindex, 文字)の配列 no_x = [] for i in range(len(s)): if s[i] == "x": continue no_x.append((i, s[i])) len_no_x = len(no_x) half = len_no_x // 2 for i in range(half): # x以外の文字が回文になっていないので不可能 if no_x[i][1] != no_x[len_...
s526141306
p03569
u768896740
1595545569
Python
Python (3.8.2)
py
Runtime Error
125
10524
680
s = input() if s == s[::-1]: print(0) exit() t = [] for i in range(len(s)): if s[i] != 'x': t.append(s[i]) if t != t[::-1]: print(-1) exit() central_char = t[len(t)//2] s = list(s) s.insert(0, '*') s.append('*') central_position = 0 for i in range(len(s)): if s[i] == central_char...
s623250751
p03569
u489959379
1595260342
Python
Python (3.8.2)
py
Runtime Error
52
9632
564
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): s = input() n = len(s) ss = "".join(s.replace("x", "")) if ss != ss[::-1]: print(-1) exit() res = 0 left = 0 right = n - 1 while left != right: if s[left] == s[righ...
s443692693
p03569
u644907318
1595210884
Python
PyPy3 (7.3.0)
py
Runtime Error
507
140756
595
s = list(input().strip()) N = len(s) a = "" for i in range(N): if s[i]!="x": a += s[i] if a==a[::-1]: flag = 1 else: flag = 0 if flag==1: n = len(a) C = [0 for _ in range(2*n+1)] for i in range(1,2*n+1,2): C[i] = a[i//2] cur = 0 ind = 0 for i in range(N): if s...
s968357686
p03569
u575431498
1593671349
Python
Python (3.8.2)
py
Runtime Error
62
9856
449
s = input() core = [] for c in s: if c != 'x': core.append(c) l = 0 r = -1 if core == [] else len(core) - 1 while l <= r: if core[l] != core[r]: print(-1) exit() l += 1 r -= 1 ans = 0 l = 0 r = len(s) - 1 while l <= r: lx = 0 rx = 0 while s[l] == 'x': l += ...
s310012733
p03569
u575431498
1593671275
Python
Python (3.8.2)
py
Runtime Error
65
9752
448
s = input() core = [] for c in s: if c != 'x': core.append(c) l = 0 r = 0 if core == [] else len(core) - 1 while l <= r: if core[l] != core[r]: print(-1) exit() l += 1 r -= 1 ans = 0 l = 0 r = len(s) - 1 while l <= r: lx = 0 rx = 0 while s[l] == 'x': l += 1...
s040102960
p03569
u575431498
1593671148
Python
Python (3.8.2)
py
Runtime Error
64
9880
427
s = input() core = [] for c in s: if c != 'x': core.append(c) l = 0 r = len(core) - 1 while l <= r: if core[l] != core[r]: print(-1) exit() l += 1 r -= 1 ans = 0 l = 0 r = len(s) - 1 while l <= r: lx = 0 rx = 0 while s[l] == 'x': l += 1 lx += 1 ...
s264564874
p03569
u480300350
1593566154
Python
Python (3.8.2)
py
Runtime Error
72
11140
6233
#!/usr/bin/env python3 import sys from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union # import time # import math, cmath # import numpy as np # import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_pre...
s401331491
p03569
u480300350
1593565712
Python
Python (3.8.2)
py
Runtime Error
69
11368
6235
#!/usr/bin/env python3 import sys from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union # import time # import math, cmath # import numpy as np # import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_pre...
s631709847
p03569
u480300350
1593565394
Python
Python (3.8.2)
py
Runtime Error
70
11260
6240
#!/usr/bin/env python3 import sys from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union # import time # import math, cmath # import numpy as np # import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_pre...
s741900916
p03569
u888092736
1592535278
Python
Python (3.8.2)
py
Runtime Error
68
9256
567
def is_valid(): x_removed_S = S.replace("x", "") M = len(x_removed_S) for i in range(M // 2): if x_removed_S[i] != x_removed_S[M - i - 1]: return False return True S = input() N = len(S) if is_valid(): ans = 0 left, right = 0, N - 1 while left != right: if S[lef...
s904128341
p03569
u288430479
1592260912
Python
Python (3.4.3)
py
Runtime Error
71
4212
339
from collections import deque s = deque(input()) cou = 0 while len(s)!=1: a = s[0] b = s[-1] if a=='x' and b!='x': cou += 1 s.popleft() elif a!="x" and b=='x': cou += 1 s.pop() elif a=="x" and b=='x': s.popleft() s.pop() elif a==b: s.popleft() s.pop() else: print(-1) ...
s229140357
p03569
u025501820
1592017783
Python
Python (3.4.3)
py
Runtime Error
64
9852
1021
import sys S = sys.stdin.readline().rstrip() N = len(S) not_x = [] x_cnt_idx = [0] * N not_x_cnt_idx = [0] * N for i, s in enumerate(S): if s != "x": not_x.append(s) not_x_cnt_idx[i] = not_x_cnt_idx[i - 1] + 1 if i > 0 else 1 else: x_cnt_idx[i] = x_cnt_idx[i - 1] + 1 if i > 0 else 1 n...
s222670519
p03569
u860002137
1591323293
Python
Python (3.4.3)
py
Runtime Error
71
4212
401
from collections import deque s = deque(map(str, input().rstrip())) cnt = 0 while s: if s[0] != s[-1]: if s[0] != "x" and s[-1] != "x": print(-1) sys.exit() elif s[0] == "x": tmp = s.popleft() else: tmp = s.pop() cnt += 1 elif len...
s197112658
p03569
u830054172
1591196742
Python
Python (3.4.3)
py
Runtime Error
72
3316
414
s = input() ans = 0 l, r = 0, len(s)-1 if len(s) != 1: while l != r: # print("l", l, "r", r) if s[l] == s[r]: l += 1 r -= 1 else: if s[l] == "x": l += 1 ans += 1 elif s[r] == "x": r -= 1 ...
s954589785
p03569
u208713671
1590562291
Python
PyPy3 (2.4.0)
py
Runtime Error
202
49648
413
S = list(input()) N = len(S) cnt = 0 l = 0 r = N-1 while l<=r: if S[l]=="x" and S[r]!="x": l += 1 cnt += 1 if S[l]!="x" and S[r]=="x": r += -1 cnt += 1 if S[l]=="x" and S[r]=="x": l += 1 r += -1 if S[l]!="x" and S[r]!="x": if S[l]==S[r]: ...
s969457339
p03569
u043048943
1590412039
Python
PyPy3 (2.4.0)
py
Runtime Error
171
38384
1303
def main(): from sys import setrecursionlimit, stdin from os import environ from collections import defaultdict, deque, Counter from math import ceil, floor, gcd from itertools import accumulate, combinations, combinations_with_replacement setrecursionlimit(10**6) dbg = (lambda *something: p...
s397007627
p03569
u747602774
1589689912
Python
Python (3.4.3)
py
Runtime Error
77
8684
524
S = input() N = len(S) ans = [] check = [] for i in range(N): if S[i] != 'x': ans.append(S[i]) check.append(i) if ans != ans[::-1]: print(-1) exit() if len(ans)%2: cl,cr = check[len(ans)//2],check[len(ans)//2] else: cl,cr = check[len(ans)//2-1],check[len(ans)//2] cnt = 0 while 0 <= c...
s782694483
p03569
u897328029
1589594887
Python
Python (3.4.3)
py
Runtime Error
84
3316
527
#!/usr/bin/env python3 S = input() N = len(S) count = 0 is_ok = True right_index = 0 left_index = N - 1 while right_index != left_index: if right_index == left_index: break if S[right_index] == S[left_index]: right_index += 1 left_index -= 1 continue if S[right_index] ==...
s419520934
p03569
u216752093
1589336809
Python
Python (3.4.3)
py
Runtime Error
98
4776
540
s=list(input()) ch=[] for i in range(len(s)): if s[i]!='x': ch.append(s[i]) error=0 for i in range(len(ch)//2): if ch[i]!=ch[len(ch)-i-1]: error=1 break if error==1: print('-1') else: ans=0 li=0 ri=0 for i in range(len(ch)//2+1): x=0 while s...
s797814953
p03569
u216752093
1589335735
Python
Python (3.4.3)
py
Runtime Error
97
4776
430
s=list(input()) ch=[] for i in range(len(s)): if s[i]!='x': ch.append(s[i]) for i in range(len(ch)//2): if ch[i]!=ch[len(ch)-i-1]: print('-1') exit() ans=0 li=0 ri=0 for i in range(len(ch)//2+1): x=0 while s[li]!=ch[i]: x += 1 li += 1 li += 1 y=0 whi...
s886043277
p03569
u198062737
1589333197
Python
PyPy3 (2.4.0)
py
Runtime Error
196
40304
413
def solve(s): l, r = 0, len(s) - 1 ans = 0 while l != r: if s[l] != s[r] and s[l] != 'x' and s[r] != 'x': return -1 if s[l] == s[r]: l += 1 r -= 1 elif s[l] == 'x': ans += 1 l += 1 elif s[r] == 'x': ans ...
s655143059
p03569
u952467214
1588726044
Python
Python (3.4.3)
py
Runtime Error
79
3316
383
s = input() #sys.stdin.readlineは最後が改行 n=len(s) ch = 0 ans = 0 left=0 right=n-1 while left!=right: if s[left] == s[right]: left+=1 right-=1 else: if s[left] == 'x': ans+=1 left+=1 elif s[right] =='x': ans+=1 right-=1 else: ...
s106573656
p03569
u408620326
1588617596
Python
Python (3.4.3)
py
Runtime Error
57
3316
772
def main(): import sys input = sys.stdin.readline s = input().strip() N = len(s) l = -1 r = N while l < r: l += 1 r -= 1 while s[l] == 'x': l += 1 while s[r] == 'x': r -= 1 if s[l] != s[r]: print(-1) exit...
s203455708
p03569
u408620326
1588616985
Python
Python (3.4.3)
py
Runtime Error
51
3316
859
def main(): import sys input = sys.stdin.readline s = input().strip() N = len(s) l = -1 r = N while l < r: l += 1 r -= 1 while s[l] == 'x': l += 1 while s[r] == 'x': r -= 1 if s[l] != s[r]: print(-1) exit...
s319042652
p03569
u995004106
1588552836
Python
PyPy3 (2.4.0)
py
Runtime Error
226
50316
826
from math import ceil s=list(input()) n=len(s) l=[] m=[] buf=[] for i in range(n): if s[i]!="x": l.append(s[i]) m=l[::-1] #print(l,m) left=[] right=[] ans=0 if m==l: flag=1 for i in range(ceil(len(l)/2)): buf.append(s[i]) piv=0 cnt=0 for i in range(n): if piv==len(buf): ...
s909009862
p03569
u886747123
1588172782
Python
Python (3.4.3)
py
Runtime Error
367
3500
766
s = input() s_no_x = "" for i in range(len(s)): if s[i] != "x": s_no_x += s[i] if s_no_x != s_no_x[::-1]: print(-1) exit() if len(s_no_x) % 2 == 0: non_x_count = 0 for i in range(len(s)): if s[i] != "x": non_x_count += 1 if non_x_count == len(s_no_x)//2: ...
s067085909
p03569
u867848444
1588111537
Python
Python (3.4.3)
py
Runtime Error
79
3316
481
#WA s = input() ns = '' cnt = 0 cnt1 = 0 for i in range(len(s)): if s[i] != 'x': ns += s[i] else:cnt += 1 if ns != ns[::-1]: print(-1) exit() mid = len(ns) // 2 mid_str = ns[mid] mid_ind = s.index(mid_str) #print(mid_ind) count = 0 for i in range(len(s)): if s[i] != 'x':continue temp_...
s387666944
p03569
u896741788
1587849059
Python
Python (3.4.3)
py
Runtime Error
85
3316
223
s=input() d=s.replace("x","") rd=d[::-1] if d!=rd:print(-1) else: ans=0 x,y=0,len(s)-1 while abs(x-y)>0: if s[x]==s[y]:x+=1;y-=1 elif s[x]=="x":ans+=1;x+=1 else:ans+=1;y-=1 print(ans)
s904792308
p03569
u843135954
1587779432
Python
Python (3.4.3)
py
Runtime Error
55
3316
439
import sys stdin = sys.stdin sys.setrecursionlimit(10**6) ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) nn = lambda: list(stdin.readline().split()) ns = lambda: stdin.readline().rstrip() s = ns() ans = 0 r = 0 l = len(s)-1 while r < l: if s[r] == s[l]: r += 1 l -= 1 elif s[r]...
s739029124
p03569
u585482323
1587218166
Python
PyPy3 (2.4.0)
py
Runtime Error
201
58272
1415
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def I(): return int(sys.stdin.buffer.readline()) def LS():return...
s024845600
p03569
u345966487
1587032236
Python
Python (3.4.3)
py
Runtime Error
49
3316
358
s = input() N = len(s) def solve2(): l = 0 r = N - 1 cost = 0 while l < r: if s[l] == s[r]: l += 1 r += 1 elif s[l] == 'x': cost += 1 l += 1 elif s[r] == 'x': cost += 1 r -= 1 else: retur...
s841422723
p03569
u345966487
1587031745
Python
Python (3.4.3)
py
Runtime Error
80
4092
1320
s = input() N = len(s) s_trim = ''.join([c for c in s if c != 'x']) N_trim = len(s_trim) def check_anagram(): for i in range(N_trim): j = N_trim - 1 - i if s_trim[i] != s_trim[j]: return False return True def solve(): if not check_anagram(): return -1 # Center of a...
s159255122
p03569
u345966487
1587031560
Python
Python (3.4.3)
py
Runtime Error
102
4092
1381
s = input() N = len(s) s_trim = ''.join([c for c in s if c != 'x']) N_trim = len(s_trim) def check_anagram(): for i in range(N_trim): j = N_trim - 1 - i if s_trim[i] != s_trim[j]: return False return True def solve(): if not check_anagram(): return -1 # Center of a...
s781986260
p03569
u345966487
1587031471
Python
Python (3.4.3)
py
Runtime Error
100
4092
1378
s = input() N = len(s) s_trim = ''.join([c for c in s if c != 'x']) N_trim = len(s_trim) def check_anagram(): for i in range(N_trim): j = N_trim - 1 - i if s_trim[i] != s_trim[j]: return False return True def solve(): if not check_anagram(): return -1 # Center of a...
s938489053
p03569
u345966487
1587031429
Python
Python (3.4.3)
py
Runtime Error
105
4120
1368
s = input() N = len(s) s_trim = ''.join([c for c in s if c != 'x']) N_trim = len(s_trim) def check_anagram(): for i in range(N_trim): j = N_trim - 1 - i if s_trim[i] != s_trim[j]: return False return True def solve(): if not check_anagram(): return -1 # Center of a...
s602230026
p03569
u345966487
1587031355
Python
Python (3.4.3)
py
Runtime Error
105
4092
1372
s = input() N = len(s) s_trim = ''.join([c for c in s if c != 'x']) N_trim = len(s_trim) def check_anagram(): for i in range(N_trim): j = N_trim - 1 - i if s_trim[i] != s_trim[j]: return False return True def solve(): if not check_anagram(): return -1 # Center of a...
s587934849
p03569
u345966487
1587031300
Python
Python (3.4.3)
py
Runtime Error
104
4092
1373
s = input() N = len(s) s_trim = ''.join([c for c in s if c != 'x']) N_trim = len(s_trim) def check_anagram(): for i in range(N_trim): j = N_trim - 1 - i if s_trim[i] != s_trim[j]: return False return True def solve(): if not check_anagram(): return -1 # Center of a...
s437714636
p03569
u345966487
1587031024
Python
PyPy3 (2.4.0)
py
Runtime Error
223
49008
1310
s = input() N = len(s) s_trim = ''.join([c for c in s if c != 'x']) N_trim = len(s_trim) def check_anagram(): for i in range(N_trim): j = N_trim - 1 - i if s_trim[i] != s_trim[j]: return False return True def solve(): if not check_anagram(): return -1 # Center of a...
s809103300
p03569
u345966487
1587030421
Python
Python (3.4.3)
py
Runtime Error
103
4332
1416
from collections import Counter s = input() N = len(s) sc = Counter(s) del sc['x'] def trim_x(): s_trim = ''.join([c for c in s if c != 'x']) for i in range(len(s_trim)): j = len(s_trim) - 1 - i if i >= j: break if s_trim[i] != s_trim[j]: return None return s...
s335099361
p03569
u345966487
1587029739
Python
Python (3.4.3)
py
Runtime Error
102
4332
1449
from collections import Counter s = input() N = len(s) sc = Counter(s) del sc['x'] def trim_x(): s_trim = [c for c in s if c != 'x'] for i in range(len(s_trim)): j = len(s_trim) - 1 - i if i >= j: break if s_trim[i] != s_trim[j]: return None return s_trim de...
s508906335
p03569
u647999897
1586999913
Python
PyPy3 (2.4.0)
py
Runtime Error
174
39536
517
def solve(): S = input() N = len(S) left = 0 right = N-1 ans = 0 while left != right: if S[left] == S[right]: left += 1 right -= 1 else: if S[left] == 'x': left += 1 ans += 1 elif S[right] == 'x': ...
s245245711
p03569
u744920373
1586725660
Python
Python (3.4.3)
py
Runtime Error
69
7540
1758
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return map(int, sys.stdin.readline().split()) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): return [[ini]*i...
s646442412
p03569
u711238850
1586497963
Python
Python (3.4.3)
py
Runtime Error
62
4212
521
from collections import deque def main(): s = deque(input()) ans = 0 while s!=[]: if s[0]==s[-1]: s.popleft() if len(s)>0: s.pop() else: break continue if s[0]!='x' and s[-1]!='x': ans = -1 ...
s098159992
p03569
u434872492
1586485520
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
135560
860
s=input() S="" for i in range(len(s)): if s[i]=="x": continue S=S+s[i] rev="" n=len(S)//2 for i in range(n): rev=rev+S[len(S)-1-i] #print(S) #print(rev) flag=True for i in range(n): if S[i]==rev[i]: pass else: flag=False if flag: pass else: print(-1) exit() ky=S[...
s337576256
p03569
u968846084
1586412119
Python
Python (3.4.3)
py
Runtime Error
114
7080
413
s=list(input()) s1=[] for i in range(len(s)): if s[i]!="x": s1.append(s[i]) s2=s1[::-1] if s1!=s2: print(-1) exit() A1=[0]*10**5 A2=[0]*10**5 i=0 j=0 while i<=len(s1)//2: if s[j]=="x": A1[i]+=1 j=j+1 else: i=i+1 j=j+1 i=0 j=0 while i<=len(s1)//2: if s[-1-j]=="x": A2[i]+=1 j=j+1 ...
s868201732
p03569
u790710233
1585958518
Python
Python (3.4.3)
py
Runtime Error
2104
4972
1548
s = input() s2 = s.replace('x', '') if s2 != s2[::-1]: print(-1) else: center = s2[len(s2)//2] cnt = s.count(center)//2 + 1 for i, c in enumerate(s): if c == center: cnt -= 1 if cnt == 0: center_idx = i break front = list(s)[:center_idx] rear ...
s819250815
p03569
u790710233
1585957682
Python
Python (3.4.3)
py
Runtime Error
2104
4852
1066
s = input() s2 = s.replace('x', '') if s2 != s2[::-1]: print(-1) else: center = s2[len(s2)//2] cnt = s.count(center)//2 + 1 for i, c in enumerate(s): if c == center: cnt -= 1 if cnt == 0: center_idx = i break front = list(s)[:center_idx] rear ...
s656519039
p03569
u287500079
1585941385
Python
PyPy3 (2.4.0)
py
Runtime Error
289
69740
1597
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10 from itertools import permutations, combinations, product, accumulate from operator import itemgetter, mul from copy import deepcopy from string impor...