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
s309548665
p03569
u642874916
1585519798
Python
PyPy3 (2.4.0)
py
Runtime Error
177
42796
1376
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time def I(): return int(input()) def S(): return input() def MI(): return map(in...
s043332824
p03569
u379959788
1585491159
Python
Python (3.4.3)
py
Runtime Error
137
16604
2341
# C S = input() N = len(S) # 回分判定 ss = "" for s in S: if s == 'x': pass else: ss += s if ss != ss[::-1]: print(-1) exit() # 真ん中を決める # x の位置と個数を求める n = len(ss) if n % 2 == 0: cnt = 0 for i in range(n//2+1): for j in range(cnt, N): if S[j] == "x": ...
s737988721
p03569
u547608423
1584852294
Python
Python (3.4.3)
py
Runtime Error
89
4084
367
s=input() li=list(s) i=0 j=len(s)-1 answer=0 while i!=j: if li[i]==li[j]: i+=1 j-=1 else: if li[i]!="x" and li[j]!="x": answer=-1 break elif li[i]=="x" and li[j]!="x": answer+=1 i+=1 elif li[i]!="x" and li[j]=="x": ...
s595081810
p03569
u096616343
1584474632
Python
Python (3.4.3)
py
Runtime Error
58
5620
390
s = input() S = [] xid = [0] * (10 ** 5) xcnt = 0 for c in s: if c != "x": S.append(c) xcnt += 1 else: xid[xcnt] += 1 xid = xid[:xcnt + 1] ans = 0 if S[0:xcnt // 2] == S[-1:-(xcnt // 2) - 1:-1]: for i in range(-(-xcnt // 2)): ad = xid[i] - xid[xcnt - i] if ad < 0: ...
s595243791
p03569
u506910932
1584470770
Python
Python (3.4.3)
py
Runtime Error
99
3316
398
s = input() sr = s[-1::-1] left = 0 right = 0 ans = 0 while (1): if left + right == len(s) - 1: break if s[left] != sr[right]: if s[left] == 'x': left += 1 elif sr[right] == 'x': right += 1 else: print(-1) exit() ans += 1 ...
s412544602
p03569
u466331465
1583985571
Python
Python (3.4.3)
py
Runtime Error
70
17764
294
s = input() s1 = [] le = [] lex = [] cnt= 0 for i in list(s): if i!="x": le.append(cnt) s1.append(i) else: lex.append(cnt) cnt+=1 if s1!=s1[::-1]: print(-1) exit() midlle=le[len(le)//2] ans =[] for i in lex: ans.append(abs(i-midlle)) ans = list(set(ans)) print(len(ans))
s746244813
p03569
u466331465
1583985279
Python
Python (3.4.3)
py
Runtime Error
51
8812
170
s = input() s1 = [] le = [] cnt= 0 for i in list(s): if i!="x": le.append(cnt) s1.append(i) cnt+=1 if s1!=s1[::-1]: print(-1) exit() print(le[len(le)//2])
s359085217
p03569
u865741247
1583689162
Python
Python (3.4.3)
py
Runtime Error
88
10244
1073
S = input() S = list(S) S_no_x = [] def is_kaibun(kaibun): for i in range(len(kaibun)//2): if kaibun[i] != kaibun[-i-1]: return False return True inds = [] for i,c in enumerate(S): if c != "x": S_no_x.append(c) inds.append(i) if not is_kaibun(S_no_x): print(-1) else: ...
s709165180
p03569
u732412551
1582588894
Python
Python (3.4.3)
py
Runtime Error
61
3316
316
S=input() T=S.replace("x","") if all(s==t for s,t in zip(T,T[::-1])): ans=0 i=0 j=len(S)-1 while i<j: pi=i pj=j while S[i]=="x": i+=1 while S[j]=="x": j-=1 ans+=abs(i-pi-j+pj) i+=1 j-=1 print(ans) else: print(-1)
s406400086
p03569
u690781906
1582207379
Python
Python (3.4.3)
py
Runtime Error
102
3316
531
s = input() count = 0 if len(set(s)) == 1: print(0) exit() left = 0 right = len(s) - 1 ans = 0 while True: if (s[left] == 'x' and s[right] == 'x') or s[left] == s[right]: left += 1 right -= 1 elif s[left] == 'x' and s[right] != 'x': ans += 1 left += 1 elif s[left] !=...
s477184932
p03569
u690781906
1582207153
Python
Python (3.4.3)
py
Runtime Error
93
3316
544
s = input() rev_s = s[::-1] count = 0 if len(set(s)) == 1: print(0) exit() left = 0 right = len(s) - 1 ans = 0 while True: if (s[left] == 'x' and s[right] == 'x') or s[left] == s[right]: left += 1 right -= 1 if s[left] == 'x' and s[right] != 'x': ans += 1 left += 1 e...
s999896873
p03569
u941753895
1582095555
Python
Python (3.4.3)
py
Runtime Error
73
5332
714
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline(...
s656383074
p03569
u905582793
1581742965
Python
PyPy3 (2.4.0)
py
Runtime Error
186
40560
415
s = input() n = len(s) t = s.replace("x","") if not t: print(0) exit() l = len(t) if t != t[::-1]: print(-1) exit() plc = [-1] for i in range(n): if s[i] != x: plc.append(i) plc.append(n) l = len(plc) if l%2 == 0: fm = plc[:l//2] lt = plc[l//2:] else: fm = plc[l//2+1] lt = plc[l//2:] lt = lt[::-1]...
s230432610
p03569
u771365068
1581113139
Python
Python (3.4.3)
py
Runtime Error
91
4212
1571
S = input() remove_x = S.replace('x','') s_len = len(S) remove_x_len = len(remove_x) if remove_x != remove_x[::-1]: print(-1) else: if remove_x_len % 2 == 0: left = remove_x_len // 2 center = -1 right = left + 1 else: left = remove_x_len // 2 center = left + 1 ...
s343449701
p03569
u771365068
1581110290
Python
Python (3.4.3)
py
Runtime Error
60
3316
1331
S = input() remove_x = S.replace('x','') count = 0 index = 0 left = 0 right = 0 ans = 0 s_len = len(S) if remove_x != remove_x[::-1]: print(-1) else: if len(remove_x) % 2 == 0: center = len(remove_x) // 2 for i, s in enumerate(S): if s != 'x': count += 1 ...
s194386832
p03569
u814781830
1580855695
Python
Python (3.4.3)
py
Runtime Error
36
4852
868
S = input() N = len(S) L = list(S) # 回文の判定 def judge(s): n = len(s) half = n//2 for i in range(half): if s[i] != s[n-1-i]: return False return True removeX = S.replace("x", "") n_removex = len(removeX) if N % 2 == 0: center = removeX[n_removex//2-1:n_removex//2+1] else: cen...
s086079604
p03569
u814781830
1580838967
Python
Python (3.4.3)
py
Runtime Error
36
4852
865
S = input() N = len(S) L = list(S) # 回文の判定 def judge(s): n = len(s) half = n//2 for i in range(half): if s[i] != s[n-1-i]: return False return True removeX = S.replace("x", "") n_removex = len(removeX) if N % 2 == 0: center = removeX[n_removex//2-1:n_removex//2+1] else: cen...
s988831464
p03569
u372144784
1580500400
Python
Python (3.4.3)
py
Runtime Error
87
3444
614
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines s = readline().rstrip().decode('utf-8') t = "" for i in s: if not i == "x": t += i if t[::] != t[::-1]: print(-1) else: ans = 0 left,right = 0,len(s)-1 while True: i...
s538384154
p03569
u010090035
1580348833
Python
Python (3.4.3)
py
Runtime Error
74
3316
405
import sys s=input() ans=0 i=0 j=len(s)-1 xi=0 yj=0 while(i<j): while(i<len(s) and s[i]=='x'): i+=1 xi+=1 # print(i,xi) while(j>=0 and s[j]=='x'): j-=1 yj+=1 # print(j,yj) # print(i,xi,j,yj) if(s[i]!=s[j]): print(-1) sys.exit() else: ...
s247775283
p03569
u010090035
1580348762
Python
Python (3.4.3)
py
Runtime Error
55
3316
383
import sys s=input() ans=0 i=0 j=len(s)-1 xi=0 yj=0 while(i<j): while(s[i]=='x'): i+=1 xi+=1 # print(i,xi) while(s[j]=='x'): j-=1 yj+=1 # print(j,yj) # print(i,xi,j,yj) if(s[i]!=s[j]): print(-1) sys.exit() else: ans+=abs(xi-yj) ...
s617778040
p03569
u010090035
1580348711
Python
Python (3.4.3)
py
Runtime Error
174
4224
382
import sys s=input() ans=0 i=0 j=len(s)-1 xi=0 yj=0 while(i<j): while(s[i]=='x'): i+=1 xi+=1 # print(i,xi) while(s[j]=='x'): j-=1 yj+=1 # print(j,yj) print(i,xi,j,yj) if(s[i]!=s[j]): print(-1) sys.exit() else: ans+=abs(xi-yj) ...
s766282127
p03569
u010090035
1580348618
Python
Python (3.4.3)
py
Runtime Error
200
5164
380
import sys s=input() ans=0 i=0 j=len(s)-1 xi=0 yj=0 while(i<j): while(s[i]=='x'): i+=1 xi+=1 print(i,xi) while(s[j]=='x'): j-=1 yj+=1 print(j,yj) print(i,xi,j,yj) if(s[i]!=s[j]): print(-1) sys.exit() else: ans+=abs(xi-yj) ...
s380233677
p03569
u961683878
1580193694
Python
Python (3.4.3)
py
Runtime Error
71
3316
445
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) s = read().decode("utf-8").rstrip() l = 0 r = len(s) - 1 cnt = 0 while l != r: if s[l] == s[r]: l += 1 r -= 1 elif s[l] == 'x': l += 1 ...
s871566441
p03569
u010090035
1580078730
Python
Python (3.4.3)
py
Runtime Error
72
5616
456
import sys s=input() s_nox=[] x=[] xcount=0 for si in list(s): if(si!='x'): x.append(xcount) xcount=0 s_nox.append(si) else: xcount+=1 else: x.append(xcount) for i in range((len(s_nox)//2)+1): j=-1*i -1 if(s_nox[i] != s_nox[j]): print(-1) sys.exit()...
s119788464
p03569
u317713173
1579663064
Python
Python (3.4.3)
py
Runtime Error
54
4596
1498
import collections s = input() c = collections.Counter(s) flag = True odd_count = 0 for char, times in c.items(): if char == "x": continue if times % 2 == 0: continue odd_count += 1 odd_char = char if odd_count >= 2: flag = False break if flag: x_count = 0 ...
s525004913
p03569
u317713173
1579663027
Python
PyPy3 (2.4.0)
py
Runtime Error
197
47856
1498
import collections s = input() c = collections.Counter(s) flag = True odd_count = 0 for char, times in c.items(): if char == "x": continue if times % 2 == 0: continue odd_count += 1 odd_char = char if odd_count >= 2: flag = False break if flag: x_count = 0 ...
s764101027
p03569
u941753895
1579237250
Python
Python (3.4.3)
py
Runtime Error
73
6740
1486
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): ...
s237301466
p03569
u445624660
1577549422
Python
Python (3.4.3)
py
Runtime Error
79
4596
1137
# x無視したやつが回文なってればいいんじゃね? # 真ん中にしたい(x以外の)文字が決まれば、もとのsにインデックスを適応して、左右のxの数の差をとればいい # と思ったけど差をとっただけだと駄目だな xaaxxxbxxcxxxxbxaxxaxx はこの考えだと3だけど実際は7だし # もうしかたねぇから無理やりsplitした(アホか?) import re s = input() if len(set(s)) == 1: # 1文字でのみ構成されている場合 print(0) exit() t = "" for sv in s: if sv != "x": t += sv if...
s865291875
p03569
u445624660
1577546525
Python
Python (3.4.3)
py
Runtime Error
63
3316
617
# x無視したやつが回文なってればいいんじゃね? # 真ん中にしたい(x以外の)文字が決まれば、もとのsにインデックスを適応して、左右のxの数の差をとればいい s = input() t = "" for sv in s: if sv != "x": t += sv if t != t[::-1]: print(-1) exit() mid = t[len(t) // 2] mid_c = t.count(mid) // 2 leftx, rightx = 0, 0 count = 0 for sv in s: if sv == "x" and count < mid_c: ...
s310419519
p03569
u196579381
1576796987
Python
PyPy3 (2.4.0)
py
Runtime Error
207
40944
320
s = input() l = 0 r = len(s)-1 ans = 0 while l < r: while s[l] == 'x'or s[r] == 'x': if s[l] != s[r]: ans += 1 if s[l] == 'x': l += 1 if s[r] == 'x': r -= 1 if s[l] != s[r]: break l += 1 r -= 1 else: print(ans) exit() print(-1)
s465608880
p03569
u410118019
1576556422
Python
PyPy3 (2.4.0)
py
Runtime Error
196
41712
250
s = input() l = 0 r = len(s)-1 c = 0 while l < r: c_l = 0 c_r = 0 while s[l] == "x": c_l += 1 l += 1 while s[r] == "x": c_r += 1 r -= 1 if s[l] != s[r]: print(-1) exit() c += abs(c_l-c_r) l += 1 r -= 1 print(c)
s146530893
p03569
u761989513
1576498786
Python
Python (3.4.3)
py
Runtime Error
78
3316
304
s = input() i = 0 j = len(s) - 1 ans = 0 while i != j: if s[i] != s[j]: if s[i] != "x" and s[j] != "x": print(-1) exit() elif s[i] != "x": j -= 1 else: i += 1 ans += 1 else: i += 1 j -= 1 print(ans)
s410861306
p03569
u644907318
1576417470
Python
Python (3.4.3)
py
Runtime Error
116
8012
590
import math s = input().strip() A = [] B = [0 for _ in range(len(s)+1)] y = "" for i in range(len(s)): if s[i]!="x": y += s[i] A.append(i) B[i+1] = B[i] else: B[i+1] = B[i]+1 flag=0 cnt = 0 for i in range(len(y)//2): if y[i]!=y[-(i+1)]: flag=1 cnt = -1 ...
s894285367
p03569
u945181840
1575815941
Python
Python (3.4.3)
py
Runtime Error
72
3316
282
s = input() l = 0 r = len(s) - 1 answer = 0 while l != r: if s[l] == s[r]: l += 1 r -= 1 elif s[l] == 'x': l += 1 answer += 1 elif s[r] == 'x': r -= 1 answer += 1 else: print(-1) exit() print(answer)
s319994329
p03569
u945181840
1575815695
Python
Python (3.4.3)
py
Runtime Error
2104
4212
500
from collections import deque s = deque(input()) answer = 0 if len(s) == 1: print(0) exit() l = '' r = '' while l == '' or r == '': if s: if l == '': l = s.popleft() if r == '': r = s.pop() if l == r: l = '' r = '' elif l == 'x': a...
s395037085
p03569
u556799364
1575134550
Python
PyPy3 (2.4.0)
py
Runtime Error
204
51380
667
# -*- coding: utf-8 -*- S = input() # can_solve = True m = [s for s in S if s != 'x'] len_m = len(m) for i in range(len_m): if m[i] != m[len_m - i - 1]: can_solve = False break # if can_solve: nums = [0 for _ in range(len_m+1)] i, n = 0, 0 for s in S: if s == 'x': n...
s651270261
p03569
u254871849
1574445623
Python
Python (3.4.3)
py
Runtime Error
227
5108
1116
# 2019-11-21 01:26:03(JST) import sys import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l # import itertools # from functools import reduce # import operator as op # import re # import heapq # ...
s582929384
p03569
u254871849
1574445587
Python
Python (3.4.3)
py
Runtime Error
227
5108
1074
# 2019-11-21 01:26:03(JST) import sys import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l # import itertools # from functools import reduce # import operator as op # import re # import heapq # ...
s239441206
p03569
u254871849
1574444993
Python
Python (3.4.3)
py
Runtime Error
235
6500
1135
# 2019-11-21 01:26:03(JST) import sys import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l # import itertools # from functools import reduce # import operator as op # import re # import heapq # ...
s534187754
p03569
u254871849
1574438069
Python
Python (3.4.3)
py
Runtime Error
218
4340
1063
# 2019-11-21 01:26:03(JST) import sys import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l # import itertools # from functools import reduce # import operator as op # import re # import heapq # ...
s223024883
p03569
u254871849
1574319136
Python
Python (3.4.3)
py
Runtime Error
222
4340
1063
# 2019-11-21 01:26:03(JST) import sys import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l # import itertools # from functools import reduce # import operator as op # import re # import heapq # ...
s662923075
p03569
u600402037
1573776494
Python
Python (3.4.3)
py
Runtime Error
123
101016
421
S = input() answer = 0 def F(s): global answer if len(s) <= 1: return if s[0] == 'x': if s[-1] == 'x': F(s[1:-1]) else: answer += 1 F(s[1:]) else: if s[-1] == 'x': answer += 1 F(s[:-1]) elif s[0] == s[-...
s796765834
p03569
u828766688
1573630622
Python
PyPy3 (2.4.0)
py
Runtime Error
189
54640
491
import sys s = input() rem = [] remrev = [] for i in s: if i != "x": rem.append(i) remrev.append(i) remrev.reverse() for i in range(len(rem)): if rem[i] != remrev[i]: print (-1) sys.exit() nx = 0 xnum = [] for i in s: if i == "x": nx += 1 else: xn...
s285620806
p03569
u075012704
1573320078
Python
Python (3.4.3)
py
Runtime Error
72
4084
290
S = list(input()) i, j = 0, len(S) - 1 ans = 0 while i != j: if S[i] == S[j]: i += 1 j -= 1 elif S[i] == 'x': i += 1 ans += 1 elif S[j] == 'x': j -= 1 ans += 1 else: print('-1') break else: print(ans)
s796060127
p03569
u037430802
1572670646
Python
Python (3.4.3)
py
Runtime Error
75
3316
355
S = input() l = 0 r = len(S)-1 cnt = 0 while l != r: if S[l] == S[r]: l += 1 r -= 1 else: if S[l] == "x": #末尾にxを追加し削除 l += 1 cnt += 1 elif S[r] == "x": r -= 1 cnt += 1 else: print(-1) ex...
s832839748
p03569
u899975427
1572316323
Python
Python (3.4.3)
py
Runtime Error
79
3316
239
s = input() lens = len(s) l = 0 r = lens - 1 cnt = 0 while l != r: if s[l] == s[r]: l += 1 r -= 1 elif s[l] == 'x': cnt += 1 l += 1 elif s[r] == 'x': cnt += 1 r -= 1 else: print(-1) exit() print(cnt)
s620419056
p03569
u645250356
1571989457
Python
PyPy3 (2.4.0)
py
Runtime Error
201
49644
1064
from collections import Counter,defaultdict,deque from heapq import heapify,heappop,heappush import sys,bisect,math,itertools,string,queue sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sy...
s629683408
p03569
u517447467
1571968389
Python
Python (3.4.3)
py
Runtime Error
35
3316
308
S = input() org = str(S) count = S.count("x") S = S.replace("x", "") left = S[:len(S)//2+1] right = S[len(S)//2:][::-1] if left == right: i = 0 count_left = 0 while (i - count_left) < (len(S)//2+1): if S[i] == "x": count_left += 1 i += 1 print(abs(count - count_left)) else: print(-1)
s980985191
p03569
u517447467
1571968302
Python
Python (3.4.3)
py
Runtime Error
35
3316
309
S = input() org = str(S) count = S.count("x") S = S.replace("x", "") left = S[:len(S)//2+1] right = S[:len(S)//2+1][::-1] if left == right: i = 0 count_left = 0 while (i - count_left) < (len(S)//2+1): if S[i] == "x": count_left += 1 i += 1 print(abs(count - count_left)) else: print(0)
s628593172
p03569
u780962115
1571767093
Python
Python (3.4.3)
py
Runtime Error
104
4212
686
#inserting X s=input() length=len(s) string="" for i in range(length): if s[i]!="x": string=string+s[i] else: continue flag=True length2=len(string) if length2>=2: for i in range(length//2): if string[i]!=string[-(i+1)]: flag=False break if flag: s="x"+s+...
s916065565
p03569
u215315599
1570908387
Python
Python (3.4.3)
py
Runtime Error
107
4788
336
S = list(input()) invS = [] for s in reversed(S): invS.append(s) cnt = 0 loop = 0 i,j = 0,0 while i+j != len(S)-1: if S[i] == invS[j]: i += 1 j += 1 elif S[i] == "x": cnt += 1 i += 1 elif invS[j] == "x": cnt += 1 j += 1 else: cnt = -1 b...
s850556273
p03569
u215315599
1570904517
Python
Python (3.4.3)
py
Runtime Error
119
4792
384
S = list(input()) invS = [] for s in reversed(S): invS.append(s) cnt = 0 loop = 0 i,j = 0,0 while i <= len(S)//2+1 and j <= len(S)//2+1: if S[i] == invS[j]: i += 1 j += 1 elif S[i] == "x": cnt += 1 i += 1 elif invS[j] == "x": cnt += 1 j += 1 loop += 1 ...
s705153004
p03569
u504562455
1569786864
Python
Python (3.4.3)
py
Runtime Error
75
4852
661
import sys s = input() # まず達成可能かどうかを判定する s_without_x = [si for si in s if si != 'x'] if len(s_without_x) % 2 == 0: if s_without_x[:len(s_without_x)//2] != s_without_x[len(s_without_x)-1:len(s_without_x)//2-1:-1]: print(-1) sys.exit(0) else: if s_without_x[:len(s_without_x)//2] != s_without_x[len...
s183026974
p03569
u223646582
1568473204
Python
PyPy3 (2.4.0)
py
Runtime Error
181
41584
425
s = input() # x を除いたときに回文になっていなければ達成不可能 if s.replace('x', '') != s.replace('x', '')[::-1]: print(-1) exit() ans = 0 l = 0 r = len(s)-1 while l != r: if s[l] == s[r]: l += 1 r -= 1 elif s[l] == 'x': ans += 1 l += 1 elif s[r] == 'x': ans += 1 r -= 1 ...
s401519008
p03569
u091051505
1567470098
Python
Python (3.4.3)
py
Runtime Error
2104
3316
625
s = input() left = 0 right = len(s) - 1 x_left = 0 x_right = 0 if len(s) >= 2: while (left <= right): if s[left] == s[right]: left += 1 right -= 1 elif s[left] == "x": x_left += 1 left += 1 elif s[right] == "x": x_right += 1 ...
s138291348
p03569
u091051505
1567469930
Python
Python (3.4.3)
py
Runtime Error
2104
3316
540
s = input() left = 0 right = len(s) - 1 x_left = 0 x_right = 0 if len(s) >= 2: while (left <= right): if s[left] == s[right]: left += 1 right -= 1 elif s[left] == "x": x_left += 1 left += 1 elif s[right] == "x": x_right += 1 ...
s911241452
p03569
u091051505
1567469754
Python
Python (3.4.3)
py
Runtime Error
2104
3316
550
s = input() left = 0 right = len(s) - 1 x_left = 0 x_right = 0 if len(s) > 2: while (left <= right): if s[left] == s[right]: left += 1 right -= 1 elif s[left] == "x": x_left += 1 left += 1 elif s[right] == "x": x_right += 1 ...
s470245442
p03569
u437638594
1567192996
Python
Python (3.4.3)
py
Runtime Error
31
3316
374
s = input() num_x = s.count('x') s_remove_x = s.replace('x', '', num_x) if len(s) % 2 == 1: if s[(len(s) + 1) // 2] == 'x': ans = num_x - 1 else: ans = num_x # s から x を除いたものが回文になっているか判定 half_len = len(s_remove_x) // 2 for i in range(half_len): if s_remove_x[i] != s_remove_x[len(s_remove_x)-1-i]: ans = -...
s521692457
p03569
u231685196
1567022654
Python
Python (3.4.3)
py
Runtime Error
239
14668
1072
import numpy as np s = input() temp = s temp = temp.replace("x","") is_rev = True mirro = [] for i in range(len(temp)//2): if temp[i] == temp[-i-1]: mirro.append(temp[i]) continue else: is_rev = False if len(temp) %2 == 1: mirro.append(temp[len(temp)//2]) if is_rev: ind = 0 ...
s556984646
p03569
u077291787
1566890527
Python
Python (3.4.3)
py
Runtime Error
53
3316
455
# code-festival-2017-qualcC - Inserting 'x' def main(): S = input().rstrip() ans, l, r = 0, 0, len(S) - 1 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": ...
s711721180
p03569
u631277801
1564142811
Python
Python (3.4.3)
py
Runtime Error
58
4148
1488
import sys stdin = sys.stdin sys.setrecursionlimit(10 ** 7) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x) - 1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip...
s790575762
p03569
u785989355
1560897387
Python
Python (3.4.3)
py
Runtime Error
74
5560
444
S = input() T = [] x_list = [] temp = 0 for i in range(len(S)): if S[i]!="x": T.append(S[i]) x_list.append(temp) temp=0 else: temp+=1 x_list.append(temp) U = T[::-1] flag=False for i in range(len(T)): if T[i]!=U[i]: flag=True break if flag: print(-1)...
s136007932
p03569
u983918956
1558162436
Python
Python (3.4.3)
py
Runtime Error
79
4340
967
from collections import deque s = input() ns = "" for s_i in s: if s_i != "x": ns += s_i if ns != ns[::-1]: print(-1) exit() if len(ns) % 2 == 1: cnt = -1 for i,s_i in enumerate(s): if s_i != "x": cnt += 1 if cnt == len(ns)//2: note = i ...
s024255675
p03569
u983918956
1558162386
Python
Python (3.4.3)
py
Runtime Error
1954
137292
989
from collections import deque s = input() ns = "" for s_i in s: if s_i != "x": ns += s_i if ns != ns[::-1]: print(-1) exit() if len(ns) % 2 == 1: cnt = -1 for i,s_i in enumerate(s): if s_i != "x": cnt += 1 if cnt == len(ns)//2: note = i ...
s417880831
p03569
u619819312
1554050491
Python
Python (3.4.3)
py
Runtime Error
18
3316
261
s=input() i=0 j=len(s)-1 c=0 while i>=j: if s[i]!=s[j]: c+=1 if s[i]=="x": i+=1 elif s[j]=="x": j-=1 else: print(-1) break else: i+=1 j-=1 else: print(c)
s217904036
p03569
u619819312
1554050419
Python
Python (3.4.3)
py
Runtime Error
73
3316
261
s=input() i=0 j=len(s)-1 c=0 while i!=j: if s[i]!=s[j]: c+=1 if s[i]=="x": i+=1 elif s[j]=="x": j-=1 else: print(-1) break else: i+=1 j-=1 else: print(c)
s298590900
p03569
u543954314
1553357003
Python
Python (3.4.3)
py
Runtime Error
1894
137176
329
from collections import deque s = deque(input()) print(s) le = len(s) cnt = 0 while le: if s[0] == s[-1]: s.pop() s.popleft() le -= 2 elif s[0] == "x": s.popleft() cnt += 1 le -= 1 elif s[-1] == "x": s.pop() cnt += 1 le -= 1 else: print(-1) break print(s) else: pr...
s742765835
p03569
u543954314
1553356911
Python
Python (3.4.3)
py
Runtime Error
64
4212
310
from collections import deque s = deque(input()) le = len(s)-1 cnt = 0 while le: if s[0] == s[-1]: s.pop() s.popleft() le -= 2 elif s[0] == "x": s.popleft() cnt += 1 le -= 1 elif s[-1] == "x": s.pop() cnt += 1 le -= 1 else: print(-1) break else: print(cnt)
s371021013
p03569
u543954314
1553356635
Python
Python (3.4.3)
py
Runtime Error
68
4212
266
from collections import deque s = deque(input()) cnt = 0 while s: if s[0] == s[-1] == "x": s.pop() s.popleft() elif s[0] == "x": s.popleft() cnt += 1 elif s[-1] == "x": s.pop() cnt += 1 else: print(-1) break else: print(cnt)
s079658776
p03569
u391331433
1553306710
Python
PyPy2 (5.6.0)
py
Runtime Error
50
32156
928
import sys from collections import deque import copy import math def get_read_func(fileobject): if fileobject == None : return raw_input else: return fileobject.readline def main(): if len(sys.argv) > 1: f = open(sys.argv[1]) else: f = None read_func = get_read_fu...
s153792597
p03569
u572144347
1552562236
Python
PyPy3 (2.4.0)
py
Runtime Error
220
48092
312
s=input() baks=s[:] s="".join(list(filter(lambda x:x!="x",s))) revs="".join(list(reversed(s))) i=0 j=len(s-1) ans=0 while i<=j: if s[i]==s[j]: i+=1 j-=1 elif s[i]=="x": ans+=1 i+=1 elif s[j]=="x": ans+=1 j-=1 else: break if i <=j : print(-1) exit(0) else: print(ans)
s050757742
p03569
u218843509
1546500806
Python
Python (3.4.3)
py
Runtime Error
94
9452
477
s = list(input()) without_x = [] notx_index = [] for i in range(len(s)): if s[i] != "x": without_x.append(s[i]) notx_index.append(i) if without_x != without_x[::-1]: print(-1) else: n = len(notx_index) #center_ind = (n-1) // 2 x_num = [notx_index[0]] for i in range(n-1): x_num.append(notx_index[i+1] - notx_...
s470316327
p03569
u608088992
1544194927
Python
Python (3.4.3)
py
Runtime Error
91
7892
778
S = list(input()) X, A = [], [] NX = "" for i in range(len(S)): if S[i] == "x": X.append(i) else: NX += S[i] A.append(i) for i in range(len(NX)//2): if NX[i] != NX[-1-i]: print(-1) break else: if NX == "": print(0) else: l, r = 0, len(S)-1 midl ...
s304081567
p03569
u608088992
1544135239
Python
Python (3.4.3)
py
Runtime Error
77
21780
392
S = list(input()) X = [] NX = "" for i in range(len(S)): if S[i] == "x": X.append(i) else: NX += S[i] NXr = "" for i in reversed(range(len(NX))): NXr += NX[i] if NXr != NX: print(-1) else: mid = S.index(NX[(len(NX) - 1)//2]) Xleft, Xright = set(), set() for x in X: if x < mid: Xleft |...
s333513234
p03569
u723721005
1542308859
Python
Python (2.7.6)
py
Runtime Error
11
2568
389
#include <bits/stdc++.h> #define LL long long using namespace std; string st; int ans; bool flag = true; int main() { cin >> st; int L=0,R = st.size() - 1; while ( L <= R ) { if ( st[L] == st[R] ) {L++,R--;continue;} if ( st[L] == 'x' ) {L++,ans++;continue;} if ( st[R] == 'x' ) {R--,ans++;continue;} flag = ...
s233272195
p03569
u667024514
1541643363
Python
Python (3.4.3)
py
Runtime Error
305
4776
515
import math s = list(str(input())) lis = "" li = "" num = 0 cou = [0 for i in range(26)] for i in range(len(s)): if s[i] != "x": lis += s[i] li = s[i] + li else: num += 1 if lis != li: print(-1) exit() point = lis[len(lis)//2] ss = ["1"] tt = ["1"] nu = 0 while s[nu] != point: ss.append(s[nu]) n...
s127356286
p03569
u667024514
1541643339
Python
Python (3.4.3)
py
Runtime Error
306
6200
521
import math s = list(str(input())) lis = "" li = "" num = 0 cou = [0 for i in range(26)] for i in range(len(s)): if s[i] != "x": lis += s[i] li = s[i] + li else: num += 1 if lis != li: print(-1) exit() point = lis[len(lis)//2] ss = ["1"] tt = ["1"] nu = 0 while s[nu] != point: ss.append(s[nu]) n...
s797359518
p03569
u667024514
1541643084
Python
Python (3.4.3)
py
Runtime Error
306
4776
462
import math s = list(str(input())) lis = "" li = "" num = 0 cou = [0 for i in range(26)] for i in range(len(s)): if s[i] != "x": lis += s[i] li = s[i] + li else: num += 1 if lis != li: print(-1) exit() point = lis[len(lis)//2] ss = [] tt = [] nu = 0 while s[nu] != point: ss.append(s[nu]) nu += 1...
s550051999
p03569
u667024514
1541643002
Python
Python (3.4.3)
py
Runtime Error
306
4772
456
import math s = list(str(input())) lis = "" li = "" num = 0 cou = [0 for i in range(26)] for i in range(len(s)): if s[i] != "x": lis += s[i] li = s[i] + li else: num += 1 if lis != li: print(-1) exit() point = lis[len(lis)//2] ss = [] tt = [] nu = 0 while s[nu] != point: ss.append(s[nu]) nu += 1...
s089783196
p03569
u177398299
1536781962
Python
Python (3.4.3)
py
Runtime Error
23
4212
288
import re s = input() pa = s.replace('x', '') if pa != pa[::-1]: print(-1) else: ans = 0 sp = s.split(pa[len(pa) // 2]) for r, l in zip(re.split(r'[a-wyz]', sp[0]), re.split(r'[a-wyz]', sp[-1])[::-1]): ans += abs(len(r) - len(l)) print(ans)
s214325833
p03569
u140862547
1534305155
Python
Python (3.4.3)
py
Runtime Error
63
3316
491
s = input() go = [] back = [] start = 0 end = len(s)-1 res = 0 while start<=end: gox = 0 backx = 0 while s[start] == 'x' and start<=end: start+=1 gox += 1 while s[end] == 'x'and start<=end: end -= 1 backx +=1 if start == end and s[start] == 'x': break if s...
s255479748
p03569
u278479217
1528516054
Python
PyPy3 (2.4.0)
py
Runtime Error
194
49932
652
#!/usr/bin/env python3 import sys s = input() swox = "".join(list(filter("x".__ne__, list(s)))) # print(s, swox) def is_palind(a): for i in range(len(a)//2): if a[i] != a[-i-1]: return False return True if not is_palind(swox): print(-1) sys.exit(0) # l = 0 r = -1 count = 0 # prin...
s398586891
p03569
u729707098
1526095381
Python
Python (3.4.3)
py
Runtime Error
70
3316
195
s = input() l,r,ans = 0,len(s)-1,0 while l!=r: if s[l]==s[r]: l,r = l+1,r-1 elif s[l]=="x": l,ans = l+1,ans+1 elif s[r]=="x": r,ans = r-1,ans+1 else: break if l==r: print(ans) else: print(-1)
s078257782
p03569
u796424048
1509131557
Python
Python (3.4.3)
py
Runtime Error
90
4084
719
s = list(input()) count = 0 l = 0 r = len(s)-1 #リストsの先頭と末尾を比較 #先頭と末尾がx以外で異なるなら,-1を返す。 #先頭と末尾が同じなら先頭と末尾を移動させる。 #どちらか片方がxなら片方にxを追加し先頭と末尾を移動させたとするので最初にxだったほうだけ移動させる #xabxa while l != r: if s[l] != s[r]: if s[l] != "x" and s[r] != "x": count = -1 break elif s[l] == "x" and s[r]...
s300908537
p03569
u136090046
1508789995
Python
Python (3.4.3)
py
Runtime Error
2104
4084
569
def calc(value): res = 0 while True: if len(value) == 1: break elif value[0] != value[-1] and value[0] != "x" and value[-1] != "x": res = -1 break elif value[0] == value[-1]: value.pop(0) value.pop() else: va...
s554052500
p03569
u136090046
1508789850
Python
Python (3.4.3)
py
Runtime Error
2104
4084
520
def calc(value): res = 0 while True: if len(value) == 1: break elif value[0] != value[-1] and value[0] != "x" and value[-1] != "x": res = -1 break elif value[0] == value[-1]: value.pop(0) value.pop() else: va...
s986216481
p03569
u813238682
1508729241
Python
Python (3.4.3)
py
Runtime Error
17
3316
365
s = input() len_s = len(s) l_index = 0 r_index = s - 1 counter = 0 while l_index < r_index: if s[l_index] == s[r_index]: l_index += 1 r_index -= 1 elif s[l_index] == "x": counter += 1 l_index += 1 elif s[r_index] == "x": counter += 1 r_index -=1 else: ...
s630637948
p03569
u676264453
1508728824
Python
Python (3.4.3)
py
Runtime Error
74
3316
360
import sys S = str(input()) i = 0 j = len(S) - 1 c = 0 while(True): if i == j: break if (S[i] == S[j]): i += 1 j -= 1 else: if (S[i] == 'x'): i += 1 c += 1 elif (S[j] == 'x'): j -= 1 c += 1 else: prin...
s616904972
p03569
u502314533
1508728593
Python
Python (3.4.3)
py
Runtime Error
74
3316
235
use = input() total = 0 p = 0 p1 = len(use) - 1 while p != p1: if use[p] == use[p1]: p += 1 p1 -= 1 elif use[p] == "x": p += 1 total += 1 elif use[p1] == "x": p1 -= 1 total += 1 else: total = -1 break print(total)
s479732764
p03569
u724707209
1508728209
Python
Python (3.4.3)
py
Runtime Error
2104
5620
1161
if __name__ == "__main__": words=input() words_list=list(words) check_words = list(words.replace('x', '')) if len(check_words)%2==0: split_point=int(len(check_words)/2) if split_point!=1: split_point=split_point-1 for (x,y) in zip(check_words[:split_point], ...
s305758921
p03569
u688522869
1508727571
Python
Python (3.4.3)
py
Runtime Error
106
7284
1395
import sys def kaibun(S): mid = len(S)//2 if len(S) % 2 == 0: left = S[:mid] right = S[mid:][::-1] else: left = S[:mid] right = S[mid+1:][::-1] if left==right: return 1 else: return 0 S = input() s = "" position = [] for i in range(len(S)): if S[...
s943367047
p03569
u214380782
1508727357
Python
Python (3.4.3)
py
Runtime Error
2104
5672
863
s = input() sList = [] for i in range(len(s)): sList.append(s[i]) while True: if 'x' in sList: sList.remove('x') else: break if len(sList)%2==0: number = len(sList)//2 else: number = (len(sList)+1)//2 end = 0 for i in range(number): if sList[i]!=sList[-(i+1)]: ...
s918398179
p03569
u619384481
1508727230
Python
Python (2.7.6)
py
Runtime Error
104
14320
1319
a=list(raw_input()) b=[] e=0 for i in a: if i!="x": b.append(i) else: e+=1 if len(b)%2==0: c=len(b)/2 amd=1 else: c=len(b)/2+1 amd=0 d=len(b) ch=0 for i in range(c): if b[i]!=b[d-1-i]: ch=1 if ch==1: print -1 else: if e==0: print 0 else: ...
s382312748
p03569
u233747425
1508726585
Python
Python (3.4.3)
py
Runtime Error
2104
5056
2346
s = input() x = -1 if len(s) == 1: x = 0 else: s2 = s.replace('x', '') if len(s2) % 2 == 0: flg = True else: flg = False nf = len(s2) // 2 if flg: s2_pre = s2[:nf+1] s2_post = s2[nf+1:] else: s2_pre = s2[:nf] s2_post = s2[nf+1:] if s2...
s738517785
p03569
u055459962
1508725932
Python
Python (3.4.3)
py
Runtime Error
127
102372
699
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """code-fes-2017-qual-c-c""" import sys OP_NUM = 0 def solve(s): """Solve.""" global OP_NUM if len(s) == 0: return "" if len(s) == 1: return "" if s[0] == 'x': if s[-1] == 'x': return solve(s[1:-1]) OP_...
s925097860
p03569
u238510421
1508725859
Python
Python (3.4.3)
py
Runtime Error
166
16236
2303
import numpy as np s = input() s_list = list(s) s_array = np.array(s_list) s_without_x_ar = s_array[s_array != "x"] if (s_without_x_ar != s_without_x_ar[::-1]).any(): print(-1) else: kw_count = len(s_without_x_ar) if kw_count % 2 == 0: half_s_wox_left = s_without_x_ar[:int(kw_count/2)] last...
s666000009
p03569
u635974378
1508725631
Python
Python (3.4.3)
py
Runtime Error
1993
137200
1160
from collections import deque def insert_c(s, idx, c): return s[:idx] + c + s[idx:] def calc(s): if s == s[::-1]: return 0 if s.replace('x', '') != s.replace('x', '')[::-1]: return -1 # import ipdb;ipdb.set_trace() revs = deque(s[::-1]) s = deque(s) cnt = 0 o_gap, r_g...
s339245950
p03569
u796424048
1508725326
Python
Python (3.4.3)
py
Runtime Error
85
12140
1440
from collections import Counter S = input() s = list(S) counter = Counter(s) odd = 0 flag = True for k,v in counter.items(): #偶奇性の判定 if k != 'x': if v%2 == 1: odd += 1 mid = k if odd >= 2:#奇数個ある小文字が複数ある場合できない flag = False #"x"を除いた時の回文判定 if flag: s_sub = S.repl...
s967425934
p03569
u293976191
1508725283
Python
Python (2.7.6)
py
Runtime Error
2110
107748
1389
# coding: utf-8 S = raw_input() def split(string): mid = len(string) / 2 if len(string) % 2: left = string[:mid] center = string[mid] right = (string[mid + 1:])[::-1] else: left = string[:mid] center = '' right = (string[mid:])[::-1] return left, center,...
s701944033
p03569
u635974378
1508725225
Python
Python (3.4.3)
py
Runtime Error
97
5100
1160
from collections import deque def insert_c(s, idx, c): return s[:idx] + c + s[idx:] def calc(s): if s == s[::-1]: return 0 if s.replace('x', '') != s.replace('x', '')[::-1]: return -1 # import ipdb;ipdb.set_trace() revs = deque(s[::-1]) s = deque(s) cnt = 0 o_gap, r_g...