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
s129059665
p04031
u567434159
1562898934
Python
Python (3.4.3)
py
Runtime Error
17
2940
172
input() a = [*map(int, input().split())] ans = 10 ** 18 for val in range(-200, 200): curr = 0 for it in a: curr += (it - val) ** 2 ans = min(ans, curr) print(ans)
s543141973
p04031
u537976628
1562038492
Python
Python (3.4.3)
py
Runtime Error
17
3060
267
N = int(input()) A = list(map(int, input().split())) ttl1, ttl2, ttl3 = 0, 0, 0 avarage1 = -(-sum(A) // N) avarage2 = sum(A) // N for i in A: ttl1 += (i - avarage1) ** 2 ttl2 += (i - avarage2) ** 2 ttl3 += (i - avarage3) ** 2 print(min(ttl1, ttl2, ttl3))
s627814653
p04031
u196697332
1561826788
Python
Python (3.4.3)
py
Runtime Error
17
3064
287
import math N = int(input()) a = [int(_) for _ in input().split()] floor = math.floor(sum(a) / len(a)) ceil = math.ceil(sum(a) / len(a)) ceil_sum = sum([(item - ceil) ** 2 for item in a]) floor_sum = sum([(item - floor) ** 2 for item in a]) print(min(ceil_sum, floor_sum, median_sum))
s640390327
p04031
u196697332
1561826702
Python
Python (3.4.3)
py
Runtime Error
18
3064
275
N = int(input()) a = [int(_) for _ in input().split()] floor = math.floor(sum(a) / len(a)) ceil = math.ceil(sum(a) / len(a)) ceil_sum = sum([(item - ceil) ** 2 for item in a]) floor_sum = sum([(item - floor) ** 2 for item in a]) print(min(ceil_sum, floor_sum, median_sum))
s580528949
p04031
u222138979
1555968538
Python
Python (3.4.3)
py
Runtime Error
18
3064
335
S = input() found = False pprev, prev = S[0],S[1] t = {pprev, prev} for i in range(2,len(S)): t.add(S[i]) if len(t) == 2: print(i - 1, i + 1) found = True else: t.remove(pprev) pprev = prev prev = S[i] t = {pprev, prev} if found: break if not found: print(-1, -1)
s516414348
p04031
u227082700
1553370097
Python
Python (3.4.3)
py
Runtime Error
17
2940
161
a,b=int(input()),list(map(int,input().split()));b.sort();c=(b[0]+b[-1])//2;if (b[0]+b[-1])%2==1 and c+1 in b:c+=1 d=[(b[i]-c)**2 for i in range(a)];print(sum(d))
s407733706
p04031
u227082700
1553370069
Python
Python (3.4.3)
py
Runtime Error
17
2940
161
a,b=int(input()),list(map(int,input().split()));b.sort();c=(b[0]+b[-1])//2;if (b[0]+b[-1])%2==1 and c+1 in b:c+=1;d=[(b[i]-c)**2 for i in range(a)];print(sum(d))
s373453907
p04031
u282228874
1552877383
Python
Python (3.4.3)
py
Runtime Error
25
3064
169
n = int(input()) A = list(map(int,input().split())) ans = [] for i in range(-100,101): c = 0 for a in A: c += (i-a)**2 ans.append(c) print(min(min))
s962918696
p04031
u282228874
1552877285
Python
Python (3.4.3)
py
Runtime Error
25
2940
167
n = int(input()) A = list(map(int,input().split())) ans = [] for i in range(-100,101): c = 0 for a in A: c += (i-a)**2 ans.append(c) print(min(c))
s685463348
p04031
u807772568
1552748828
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38256
197
n = int(input()) a = list(map(int,input().split())) b = mean(a)//1 co = 10**9 su = 0 for k in range(3): for i in a: su += abs(i-b+(k-1)) ** 2 co = min(co,su) su = 0 print(co)
s812291284
p04031
u020604402
1551980301
Python
PyPy3 (2.4.0)
py
Runtime Error
182
38640
194
N = int(input()) L = list(map(int,inptu().split())) ave = sum(L) / len(L) if ave * 10 % 10 >= 5: ave = int(ave) + 1 else: ave = int(ave) ans = 0 for x in L: ans += (x - ave) **2 print(ans)
s970740633
p04031
u201234972
1545183647
Python
Python (3.4.3)
py
Runtime Error
19
2940
209
N = int( input()) A = list( map( int, input().split())) ans = 10**6 for a in range(-100, 101): a = A[i] cost = 0 for j in range(N): cost += (A[j]-a)**2 ans = min( ans, cost) print(ans)
s527124685
p04031
u294000907
1540875130
Python
Python (3.4.3)
py
Runtime Error
17
2940
189
#!/usr/bin/env python3 # -*- coding: utf-8 -*- n = int(input()) a = list(map(int, input().split())) c = 0 t = int(sum(a)//n) for i in range(0,N): if a[i]!=t: c=abs(t-a[i]) print(c)
s935399330
p04031
u756569003
1534462195
Python
Python (3.4.3)
py
Runtime Error
17
2940
210
= map(int, input().split()) a = list(map(int, input().split())) ans = 9999 for i in range(-100, 101): sumof = 0 for j in a: sumof += (i - j)*(i - j) ans = min(ans, sumof) print(ans)
s506508235
p04031
u693048766
1534029946
Python
Python (3.4.3)
py
Runtime Error
104
9180
379
range_ = range(-100, 100+1) n = int(input()) sb = { index:None for index in range_ } xs = [int(x) for x in input().split()] def delfun(arg): xs, delta = arg deltas = sum( [ (x-delta)**2 for x in xs] ) return deltas from concurrent.futures import ProcessPoolExecutor as PPE res = PPE(max_workers=12).map(delfun, [(xs, delta) for delta in range_]) print(min(list(res)))
s677254688
p04031
u669770658
1531158998
Python
Python (3.4.3)
py
Runtime Error
17
3060
273
N = int(input()) a = [int(i) for i in input().split()] li_ans = [] ans = 0 for j in range(min(a), max(a)): for k in a: ans += abs(k - j) ** 2 else: li_ans.appned(ans) ans = 0 if len(li_ans) == 0: print(0) else: print(min(li_ans))
s449709176
p04031
u669770658
1531158907
Python
Python (3.4.3)
py
Runtime Error
17
3060
287
N = int(input()) a = [int(i) for i in input().split()] li_ans = [] ans = 0 for num in (min(a), max(a)): for j in range(len(a)): ans += abs(a[j] - num) ** 2 else: li_ans.appned(ans) ans = 0 if len(li_ans) == 0: print(0) else: print(min(li_ans))
s310804919
p04031
u669770658
1531158846
Python
Python (3.4.3)
py
Runtime Error
17
3060
243
N = int(input()) a = [int(i) for i in input().split()] li_ans = [] ans = 0 for num in (min(a), max(a)): for j in range(len(a)): ans += abs(a[j] - num) ** 2 else: li_ans.appned(ans) ans = 0 print(min(li_ans))
s870983868
p04031
u669770658
1530297019
Python
Python (3.4.3)
py
Runtime Error
25
3060
259
N = int(input()) a = [int(i) for i in input().split()] ans = [] sum = 0 for j in range(min(a), max(a)): for num in a: sum += (num - j) ** 2 else: ans.append(sum) sum = 0 if ans == None: ans.appned(0) print(min(ans))
s045019635
p04031
u669770658
1530296842
Python
Python (3.4.3)
py
Runtime Error
24
3060
222
N = int(input()) a = [int(i) for i in input().split()] ans = [] sum = 0 for j in range(min(a), max(a)): for num in a: sum += (num - j) ** 2 else: ans.append(sum) sum = 0 print(min(ans))
s586555045
p04031
u088543709
1518677463
Python
Python (2.7.6)
py
Runtime Error
12
2692
960
process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); /* process.on('SIGINT', function(){ input_stdin_array = input_stdin.split("\n"); main(); process.exit(); }); */ process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); function readLine() { return input_stdin_array[input_currentline++]; } /////////////// ignore above this line //////////////////// function main() { var s = readLine(); var N = parseInt(s); s = readLine().split(" "); for (var i=0; i < N; i++){ s[i]=parseInt(s[i]); } var ans = 200*200*200+1; for (var goal = -100; goal <= 100; goal++){ var cost=0; for (var i=0; i < N; i++){ cost += (s[i]-goal)*(s[i]-goal); } if (ans > cost){ ans = cost; } } console.log(ans.toString()); }
s251448761
p04031
u143492911
1518130766
Python
Python (3.4.3)
py
Runtime Error
20
3188
139
n=int(input()) a=[int(input()) for i in range(n)] s=sum(a) ans=round(s/n) count=0 for i in range(n): count+=(a[i]-ans)**2 print(count)
s910865233
p04031
u584355711
1487311090
Python
Python (3.4.3)
py
Runtime Error
17
3056
356
# -*- coding: utf-8 -*- INF=10**10 def main(): n=int(input()) array=[int(input()) for i in range(n)] answer=INF for a in range(-100,101): temp=0 for b in array: temp+=(a-b)**2 if temp<answer: answer=temp print(answer) if __name__=="__main__": main()
s486692449
p04031
u584355711
1487310741
Python
Python (3.4.3)
py
Runtime Error
17
3056
356
# -*- coding: utf-8 -*- INF=10**20 def main(): n=int(input()) array=[int(input()) for i in range(n)] answer=INF for a in range(-100,101): temp=0 for b in array: temp+=(a-b)**2 if temp<answer: answer=temp print(answer) if __name__=="__main__": main()
s409621101
p04031
u732844340
1472471820
Python
Python (3.4.3)
py
Runtime Error
69
3700
385
from functools import reduce n = int(input()) a = list(map(int,input().split())) end = max(a) ansAry = [] b = min(a) while(True): suma = [] for i in range(0,len(a)): if b == a[i]: pass else: suma.append((a[i] - b)*(a[i] - b)) ansAry.append(reduce(lambda x,y:x+y,suma)) b += 1 if b == end: break print(min(ansAry))
s728362628
p04031
u307757209
1471140159
Python
Python (2.7.6)
py
Runtime Error
30
2696
804
# -*- coding: utf-8 -*- """ Created on Sat Aug 13 20:59:33 2016 @author: kt """ max=-1000 min=1000 cost=[0]*100 N=input() i=0 l = map(int, raw_input().split()) for var in l: if var>max: max=var if var<min: min=var """if max-min==1: if cost[0]>cost[1]: print cost[1] else: print cost[1] else : print cost[0]""" if max==min: print 0 if max-min==1: if l.index(max)>l.index(min): print l.count(min) else: print l.count(max) print max else : for var in range(min,max+1): for var2 in l: cost[i]+=(var-var2)*(var-var2) i+=1 if i>2: if cost[i-2]<cost[i-1] and cost[i-2]<cost[i-3]: print cost[i-2]
s724924741
p04031
u184598095
1471138820
Python
PyPy3 (2.4.0)
py
Runtime Error
366
43376
185
import numpy as np import math N = int(input()) a = np.array(list(map(int, input().split()))) c = round(a.mean()) res = int(0) for i in a: res += (c - i) ** 2 print(int(res))
s720670278
p04031
u886790158
1471137605
Python
Python (3.4.3)
py
Runtime Error
45
3064
793
# include <algorithm> # include <cassert> # include <cctype> # include <cstdio> # include <cstdlib> # include <cstring> # include <cmath> # include <iostream> # include <map> # include <queue> # include <set> # include <sstream> # include <stack> # include <string> # include <vector> # include <iomanip> # define rep(i, n) for (int i = 0; i < (int)(n); i++) # define irep(i, n) for (int i = int(n) - 1; i >= 0; i--) # define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++) using namespace std; typedef long long ll; int main() { int N; cin >> N; vector<int> A(N); rep (i, N) cin >> A[i]; double mean = 0.0; rep (i, N) mean += A[i]; mean /= A.size(); mean = roundf(mean); ll ans = 0; rep (i, N) { ans += pow(A[i] - mean, 2); } cout << ans << endl; }
s055059542
p04032
u612975321
1600389843
Python
Python (3.8.2)
py
Runtime Error
491
9740
554
def check(l, r): th = 1 + (r - l + 1) // 2 for i in range(26): if cnt[i] >= th: return True return False s = input() n = len(s) si = [0] * n for i in range(n): si[i] = ord(s[i]) - 97 l, r = 0, 2 cnt = [0]*26 for i in range(3): cnt[si[i]] += 1 while l < n-2 and r < n: # print(l, r, cnt) if check(l, r): print(l+1, r+1) exit() elif max(cnt) == (r-l) // 2: r += 1 if r < n: cnt[si[r]] += 1 else: cnt[si[l]] -= 1 l += 1 print(-1, -1)
s655554627
p04032
u612975321
1600389767
Python
Python (3.8.2)
py
Runtime Error
462
9732
550
def check(l, r): th = 1 + (r - l + 1) // 2 for i in range(26): if cnt[i] >= th: return True return False s = input() n = len(s) si = [0] * n for i in range(n): si[i] = ord(s[i]) - 97 l, r = 0, 2 cnt = [0]*26 for i in range(3): cnt[si[i]] += 1 while l < n-2 and r < n: # print(l, r, cnt) if check(l, r): print(l, r) exit() elif max(cnt) == (r-l) // 2: r += 1 if r < n: cnt[si[r]] += 1 else: cnt[si[l]] -= 1 l += 1 print(-1, -1)
s957253605
p04032
u456337115
1595094099
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74676
205
str = input() flg=0 for n in range(0,len(str)-2): if(str[n]==str[n+1]): print(n+1,n+2) flg =1 break elif (str[n]==str[n+2]): print(n+1,n+3) flg=1 break if flg =0: print(-1,-1)
s919745928
p04032
u271064067
1594930536
Python
Python (3.8.2)
py
Runtime Error
66
9120
275
s = str(input()) a, b = 0, 0 for i in range(len(s)-1): if s[i] == s[i+1]: a, b = i+1, i+2 break elif i != len(s)-1: if s[i] == s[i+2]: a, b = i+1, i+3 break if a == 0: print(-1, -1) else: print(a, b)
s866884632
p04032
u271064067
1594930481
Python
Python (3.8.2)
py
Runtime Error
27
8944
275
s = str(input()) a, b = 0, 0 for i in range(len(s)-1): if s[i] == s[i+1]: a, b = i+1, i+2 break if i != len(s)-1: elif s[i] == s[i+2]: a, b = i+1, i+3 break if a == 0: print(-1, -1) else: print(a, b)
s343332847
p04032
u271064067
1594930221
Python
Python (3.8.2)
py
Runtime Error
45
9152
176
s = str(input()) a, b = 0, 0 for i in range(len(s)): if s[i] == s[i+1]: a, b = i+1, i+2 break if a == 0: print(-1, -1) else: print(a, b)
s074586023
p04032
u786020649
1594251577
Python
Python (3.8.2)
py
Runtime Error
49
10020
378
import sys import string alphabets=list(string.ascii_lowercase) s=input() l=len(s) hm = lambda a,string: sum([x==a for x in string]) for x in range(l-1): if s[x]==s[x+1]: print('{} {}'.format(x+1, x+2)) sys.exit() for n in range(l-3): for a in alphabets: if hm(a,s[n:n+3])> m//2: print('{} {}'.format(n+1,n+3)) sys.exit() print('-1 -1')
s526113527
p04032
u786020649
1594251504
Python
Python (3.8.2)
py
Runtime Error
46
9860
371
import sys import string alphabets=list(string.ascii_lowercase) s=input() l=len(s) hm = lambda a,string: sum([x==a for x in string]) for x in range(l-1): if s[x]==s[x+1]: print('{} {}'.format(x+1, x+2)) sys.exit() for n in range(l-m): for a in alphabets: if hm(a,s[n:n+3])> m//2: print('{} {}'.format(n+1,n+m)) sys.exit() print('-1 -1')
s523101630
p04032
u786020649
1594250233
Python
Python (3.8.2)
py
Runtime Error
48
10640
479
import sys import string alphabets=list(string.ascii_lowercase) s=input() l=len(s) hm = lambda a,string: sum([x==a for x in string]) for x in range(l-1): if s[x]==s[x+1]: print('{} {}'.format(x+1, x+2)) sys.exit() def func(r,s,n,m): if r==26: return print('-1 -1') else: if hm(alphabets[r],s[n:n+m])>m//2: print('{} {}'.format(r+1,n+m)) sys.exit() return func(n+1,s,n,m) for m in range(3,l,2): for n in range(l-m): func(0,s,n,m)
s202334703
p04032
u786020649
1594250170
Python
Python (3.8.2)
py
Runtime Error
50
10652
479
import sys import string alphabets=list(string.ascii_lowercase) s=input() l=len(s) hm = lambda a,string: sum([x==a for x in string]) for x in range(l-1): if s[x]==s[x+1]: print('{} {}'.format(x+1, x+2)) sys.exit() def func(r,s,n,m): if r==26: return print('-1 -1') else: if hm(alphabets[r],s[n:n+m])>m//2: print('{} {}'.format(n+1,n+m)) sys.exit() return func(n+1,s,n,m) for m in range(3,l,2): for n in range(l-m): func(0,s,n,m)
s613912198
p04032
u026155812
1593564006
Python
Python (3.8.2)
py
Runtime Error
45
9144
281
import sys s = input() for i, (x, y) in enumerate(zip(s, s[1:])): if x == y: print(i+1, i+2) sys.exit() if len(s) == 2: print(-1, -1) for i, (x, y, z) in enumerate(zip(s, s[1:], s[2])): if x == z: print(i+1, i+3) sys.exit() print(-1, -1)
s454894882
p04032
u697615293
1593096653
Python
Python (3.8.2)
py
Runtime Error
28
8972
190
a = list(input()) b = [] for i in a: if a.count(i) >= len(a)/2: b = [j for j ,x in enumerate(a) if x == i] else: pass if not b: print(-1 1) else: print(b[0],b[1])
s680716071
p04032
u106797249
1592757795
Python
Python (3.8.2)
py
Runtime Error
26
8964
286
def resolve(): S = list(input()) if len(S) == 2: print(-1, -1) for i in range(len(S)-3): if S[i] == S[i+1] or S[i+1] == S[i+2] or S[i+2] == S[i]): print(i+1, i+3) return print(-1, -1) if __name__ == '__main__': resolve()
s379064339
p04032
u325149030
1592538937
Python
Python (3.8.2)
py
Runtime Error
25
9056
302
s = input() N = len(s) if N == 2: if s[0] == s[1]: print('1 2') quit() else: print('-1,-1') quit() for i in range(N-2): if s[i] == s[i+1] or s[i] == s[i+2]: print(i+1, i+3) quit() if s[-1] == s[-2]: print(N-1, N quit() print('-1 -1')
s743671759
p04032
u883866798
1590619048
Python
Python (3.4.3)
py
Runtime Error
17
3188
347
S = input() search_dic = {i:0 for i in range(ord('a'),ord('z'))} for ss in S: search_dic[ord(ss)] += 1 max_v = max([(y,x) for x,y in search_dic.items()]) max_v = [chr(max_v[1]),max_v[0]] major = round(len(S) / 2) if max_v[1] >= major: r = S[::-1] print(S.index(max_v[0]) + 1,len(r) - r.index(max_v[0]) + 1) else: print(-1,-1)
s259427520
p04032
u588794534
1589942994
Python
PyPy3 (2.4.0)
py
Runtime Error
183
39280
345
s=input() #長さ2 #xx #長さ3 #xxy←長さ2に内包,yxx,xyx #長さ5:xyxzx ←長さ3に内包 if len(s)==2: if s[i]+s[i+1]: print(1,2) exit() for i in range(len(s)-2): if s[i]==s[i+1]: print(i+1,i+1+1) exit() elif s[i]==s[i+2]: print(i+1,i+2+1) exit() print(-1,-1)
s185438805
p04032
u835534360
1589488619
Python
Python (3.4.3)
py
Runtime Error
17
2940
425
from collections import Counter a = [0] * 26 s = input() c, n = Counter(s).most_common()[0] end = False for i in range(3, n+1): for j in range(len(s)-i): c, m = Counter(s[j:j+i]).most_common()[0] if m * 2 > i: # print(f'{m} , {j} , {j+i} : {s[j:j+i]}') print(f'{j+1} , {j+i+1}') end = True break if end: break if not end: print('-1 -1 -1')
s302202876
p04032
u161857411
1589332279
Python
Python (3.4.3)
py
Runtime Error
52
3188
286
s = input() start_index = -1 end_index = -1 for i in range(len(s)): if(s[i] == s[i+1] and s[i+1] == s[i+2]): start_index = i+1 end_index = i+4 break if(s[i] == s[i+1]): start_index = i+1 end_index = i+3 break print(str(start_index)+' ' + str(end_index))
s831641911
p04032
u308918401
1588285531
Python
Python (3.4.3)
py
Runtime Error
18
3060
332
a=input() t=-1 flag="False" for i in range(n-1): if a[i]==a[i+1]: flag="True1" t=i break if i!=n-2: if a[i]==a[i+2]: flag="True2" t=i break if flag=="False": print("{} {}".format(-1,-1)) elif flag=="True1": print("{} {}".format(t+1,t+2)) else flag=="True2": print("{} {}".format(t+1,t+2))
s556246976
p04032
u308918401
1588285461
Python
Python (3.4.3)
py
Runtime Error
17
3060
322
a=input() t=-1 flag="False" for i in range(n-1): if a[i]==a[i+1]: flag="True1" t=i break if i!=n-2 and a[i]==a[i+2]: flag="True2" t=i break if flag=="False": print("{} {}".format(-1,-1)) elif flag=="True1": print("{} {}".format(t+1,t+2)) else flag=="True2": print("{} {}".format(t+1,t+2))
s441839747
p04032
u870518235
1587522392
Python
Python (3.4.3)
py
Runtime Error
17
3064
309
s = str(inpout()) for i in range(len(s)): if s[i] == s[i+1]: res1 = str(i) res2 = str(i+1) print(res1 + " " + res2) break elif s[i] == s[i+2]: res1 = i res2 = i+2 print(res1 + " " + res2) break else: continue print("-1 -1")
s831265567
p04032
u519923151
1587504296
Python
Python (3.4.3)
py
Runtime Error
18
3060
286
if len(slist) ==2: if len(set(slist)) ==1: print(1,2) exit() else: print("-1 -1") exit() else: for i in range(1,len(slist)-1): if len(set(slist[i-1:i+2])) !=3: print(i,3) exit() print("-1 -1")
s005984701
p04032
u086172144
1585969653
Python
Python (3.4.3)
py
Runtime Error
54
3956
292
s=list(input()) for i in range(len(s)-2): if s[i]==s[i+1]: print("{} {}".format(i+1,i+2)) break elif s[i]==s[i+2]: print("{} {}".format(i+1,i+3)) break else: if s[i+1]==s[i+2]: print("{} {}".format(i+2,i+3)) else: print("-1 -1")
s214881073
p04032
u489959379
1584060071
Python
Python (3.4.3)
py
Runtime Error
59
3188
194
s = str(input()) if len(s) == len(set(s)): print(-1, -1) else: for i in range(1, len(s)): if s[i - 1] != s[i] and s[i] == s[i + 1]: print(i, i + 2) break
s487478102
p04032
u738341948
1583237847
Python
Python (3.4.3)
py
Runtime Error
89
3188
435
s =str(input()) if len(s) == 2: if s[0]==s[1]: sIndex = 1 eIndex = 2 else: sIndex = -1 eIndex = -1 elif len(s)>2: sIndex=-1 eIndex=-1 for i in range(len(s)): par_str = s[i:i+3] if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2): sIndex = i + 1 eIndex = i + 3 break ans = str(sIndex)+' '+str(eIndex) print(ans)
s682324524
p04032
u478266845
1583053128
Python
Python (3.4.3)
py
Runtime Error
17
2940
498
s = str(input()) if len(s) == 2: if s[0] ==s[1]: start_ind =1 end_ind = 2 else: start_ind = -1 end_ind = -1 elif len(s)>2: start_ind = -1 end_ind = -1 for i in range(len(s)-2): par_str = s[i:i+3] if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2): start_ind = i + 1 end_ind = i + 3 break ans = str(start_ind) + ' ' + str(end_ind) print(ans)
s389845287
p04032
u478266845
1583052722
Python
Python (3.4.3)
py
Runtime Error
88
3188
436
s = str(input()) if len(s) == 2: if s[0] ==s[1]: start_ind =1 end_ind = 2 else: start_ind = -1 end_ind = -1 elif len(s)>2: for i in range(len(s)-2): par_str = s[i:i+3] if (par_str.count(par_str[0])>=2) | (par_str.count(par_str[1])>=2): start_ind = i + 1 end_ind = i + 3 break ans = str(start_ind) + ' ' + str(end_ind) print(ans)
s813296413
p04032
u620157187
1582541682
Python
Python (3.4.3)
py
Runtime Error
20
3060
264
import pandas as pd x = -1 y = -1 S = list(input()) for i in range(1, len(S)-1): for j in range(i+2, len(S)+1): s = pd.DataFrame(S[i:j]) if s[0].value_counts()[0] > (len(s)//2): x = i y = j break print(x, y)
s562241659
p04032
u068584789
1582497315
Python
Python (3.4.3)
py
Runtime Error
17
2940
192
word = input() wset = set(word) ans = (-1, -1) for w in wset: if word.count(w) > len(word) / 2: p = word.index(w) + 1 ans = (p, int(len(word) / 2 + p) break print(ans[0], ans[1])
s747344515
p04032
u736729525
1581662812
Python
Python (3.4.3)
py
Runtime Error
54
3188
436
def solve(S): N = len(S) if N == 2: if S[0] == S[1]: # oxx return i+1,i+2 for i in range(N-2): if S[i] == S[i+1]: # xxo return i+1,i+2 if S[i+1] == S[i+2]: # oxx return i+2,i+3 if S[i] == S[i+2]: # xox return i+1,i+3 return -1, -1 def solv(s): a, b = solve(s) print(s[a-1:b]) return a, b #solv("oxx") print(*solve(input()))
s162599179
p04032
u736729525
1581662678
Python
Python (3.4.3)
py
Runtime Error
19
2940
361
def solve(S): N = len(S) if N == 2: if S[0] == S[1]: # oxx return 1,2 for i in range(N-2): if S[i] == S[i+1]: # xxo return i+1,i+2 if S[i+1] == S[i+2]: # oxx return i+2,i+3 if S[i] == S[i+2]: # xox return i+1,i+3 return -1, -1 def solv(s)print(*solve(input()))
s585657211
p04032
u736729525
1581662610
Python
Python (3.4.3)
py
Runtime Error
56
3188
436
def solve(S): N = len(S) if N == 2: if S[0] == S[1]: # oxx return i+1,i+2 for i in range(N-2): if S[i] == S[i+1]: # xxo return i+1,i+2 if S[i+1] == S[i+2]: # oxx return i+2,i+3 if S[i] == S[i+2]: # xox return i+1,i+3 return -1, -1 def solv(s): a, b = solve(s) print(s[a-1:b]) return a, b #solv("oxx") print(*solve(input()))
s070693601
p04032
u760794812
1580948582
Python
Python (3.4.3)
py
Runtime Error
75
3188
129
S = input() for i in range(len(S)-1): for j in [i+1,i+2]: if S[i] == S[j]: print(i+1,j+1) exit() print('-1 -1')
s186124511
p04032
u989345508
1580171988
Python
Python (3.4.3)
py
Runtime Error
17
2940
282
import exit from sys s=input() l=len(s) for i in range(l-2): if s[i]==s[i+2]: print(str(i+1)+" "+str(i+3)) exit() if s[i]==s[i+1]: print(str(i+1)+" "+str(i+2)) exit() if s[l-2]==s[l-1]: print(str(l-1)+" "+str(l)) else: print("-1 -1")
s479003609
p04032
u867848444
1579060451
Python
Python (3.4.3)
py
Runtime Error
17
2940
149
s=input() count=0 for i in range(len(s)-2): if s[i]==s[i+1] or s[i]==s[i+2] or s[i+1]=s[i+2]: print(i+1,i+3) exit() print(-1,-1)
s590795515
p04032
u047816928
1578248033
Python
Python (3.4.3)
py
Runtime Error
17
2940
211
s = input() for x in map(chr, range(ord('a'), ord('z')+1)): p = None for i, c in enumerate(s): if c!=x: continue if p: print(p+1, i+1) exit() p = i print(-1, -1)
s299903553
p04032
u892538842
1577147322
Python
Python (3.4.3)
py
Runtime Error
179
3188
463
s = input() def unbalanced(st): for c in st: if st.count(c) > len(st) // 2: return True return False def test_str(st): r = (-1, -1) if len(s) < 3: return r if len(s) == 3: if unbalanced(s): return (1, 3) else: return r for i in range(len(s) - 3): if unbalanced(s[i:i+3]): r = (i+1, i+3) return r print(test_str(s)[0], test_str(s)[1])
s422503925
p04032
u892538842
1577147207
Python
Python (3.4.3)
py
Runtime Error
309
4144
455
s = input() def unbalanced(st): for c in st: if st.count(c) > len(st) // 2: return True return False def test_str(st): r = (-1, -1) if len(s) == 3: if not unbalanced(s): return r else: return (0, 3) for i in range(len(s) - 3): print(s[i:i+3]) if unbalanced(s[i:i+3]): r = (i+1, i+3) return r print(test_str(s)[0], test_str(s)[1])
s654876304
p04032
u995109095
1577146767
Python
PyPy3 (2.4.0)
py
Runtime Error
2106
42940
714
s=input() temp=0 tem=0 tot=0 if len(s)>10**3: for i in range(len(s)): tem=1 temp=1 flag=0 for j in range(i+1,len(s)): if s[j]==s[i]: temp+=1 tem+=1 if temp>(tem//2 ): print(i+1,j+1) flag=1 tot=1 break if flag: break if tot==0: print("-1 -1") else: for i in range(len(s)-2): if s[i]==s[i+1]: print(i+1,i+2) flag=1 break elif s[i]==s[i+2]: print(i+1,i+3) flag=1 break if flag==0: print("-1 -1")
s403943212
p04032
u488884575
1576793820
Python
Python (3.4.3)
py
Runtime Error
126
5260
566
import sys l = [i for i in input()] dup_l = [i for i in set(l) if l.count(i) > 1] # len(l)//2] #print(dup_l) if len(dup_l)==0: print("-1 -1") else: d = dict() for i in dup_l: d[i] = l.count(i) #print(d) dmax = max(d, key=d.get) #print(dmax) index = [] for i, s in enumerate(l, 1): if s==dmax: index.append(i) #print(index) okflag = 0 for i in range(len(index)): if i != len(index): if index[i+1] - index[i] <= 2: print(index[i], index[i+1]) okflag = 1 break if okflag ==0: print("-1 -1")
s755865509
p04032
u779455925
1576696393
Python
Python (3.4.3)
py
Runtime Error
56
3188
238
s=input() for i in range(len(s)-2): if s[i]==s[i+1]: print(i + 1 ,i+1 + 1) exit() if s[i]==s[i+2]: print(i + 1,i+2 + 1) exit() if s[i-2]==s[i -1 ]: print(i-2 +1 ,i-1) exit() print(-1,-1)
s604058316
p04032
u309141201
1576443029
Python
Python (3.4.3)
py
Runtime Error
61
3564
1062
# s = input() # alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', # 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] # alphabet_count = [0] * 26 # print(alphabet_count) # for i in 10 ** 5: # for j in range(26): # alphabet_count[j] = s[].count(alphabet[j]) # print(alphabet_count) import collections import itertools MAX_S = 100 #制約 NO_SOL = (-1, -1) def is_unbalanced(s): ctr = collections.Counter(s) total = sum(ctr.values()) m = max(ctr.values()) return m >= total // 2 + 1 def find_unbalanced_substr(s): l = len(s) for start, end in itertools.combinations(range(l), 2): # print('start, end = ' + str(start), str(end)) if is_unbalanced(s[start:end + 1]): return start, end return NO_SOL def main(): s = input() assert len(s) <= MAX_S ans = find_unbalanced_substr(s) if ans == NO_SOL: print(*ans) else: # print(ans) print(*(x + 1 for x in ans)) if __name__ == '__main__': main()
s160499716
p04032
u905582793
1576420326
Python
Python (3.4.3)
py
Runtime Error
17
3188
126
s=input() for i in range(len(s)-2): if len(set(s[i],s[i+1],s[i+2]))!=3: print(i+1,i+3) break else: print("-1 -1")
s840980913
p04032
u875600867
1576342566
Python
PyPy3 (2.4.0)
py
Runtime Error
171
39152
666
S = input() # 2文字だった時の判定 if len(s) == 2: if s[0] == s[1]: print("1 2") else: print("-1 -1") # 2文字以上の時の判定 else: # 比較 for i in range(len(s) - 2): # 3文字比較すれば、アンバランスかわかる # 3文字全部ばらばらならOK # 1:2に別れたらアンバランス t = s[i:i + 3] # tの中で、1文字目の出現回数が1より上、もしくは、2文字目の出現回数が1より上 # 2文字出た時点でアンバランス if t.count(t[0]) > 1 or t.count(t[1]) > 1: exit() print("-1 -1")
s521695417
p04032
u945181840
1576122231
Python
Python (3.4.3)
py
Runtime Error
70
3188
225
s = input() n = len(s) if n == 2 and s[0] == s[1]: print(1, 2) exit() for i in range(n): if s[i] == s[i + 1] or s[i] == s[i + 2] or s[i + 1] == s[i + 2]: print(i + 1, i + 3) exit() print(-1, -1)
s837099751
p04032
u952491523
1575950418
Python
Python (3.4.3)
py
Runtime Error
18
3064
237
import sys s = a + input() for i in range(3,len(s)): if s[i] != s[i-1] and s[i] != s[i-2]: continue elif s[i] == s[i-1]: print(i-1,i) sys.exit(0) elif s[i] == s[i-2]: print(i-2,i) sys.exit(0) print(-1,-1)
s935963363
p04032
u731368968
1575228855
Python
Python (3.4.3)
py
Runtime Error
17
2940
1080
#include <bits/stdc++.h> using namespace std; #define REP(i, x) for (int i = 0, i##_len = (int)(x); i < i##_len; i++) #define REP1(i, x) for (int i = 1, i##_len = (int)(x); i <= i##_len; i++) #define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--) #define ALL(v) (v).begin(), (v).end() #define debug(x) cerr << #x << ": " << x << '\n' #define pb(x) push_back(x) #define mp(x, y) make_pair(x, y) const int MOD = (int)1e9 + 7; const int INF = (int)1e9 + 9; using ll = long long; using ull = unsigned long long; using i_i = pair<int, int>; using l_l = pair<ll, ll>; using d_d = pair<double, double>; using vint = vector<int>; using vll = vector<ll>; using vbool = vector<bool>; int main() { string s; cin >> s; REP(i, s.size() - 1) { if (s[i] == s[i + 1]) { cout << i + 1 << " " << i + 2; return 0; } } REP(i, s.size() - 2) { if (s[i] == s[i + 2]) { cout << i + 1 << " " << i + 3; return 0; } } cout << "-1 -1"; }
s268344061
p04032
u673361376
1574110013
Python
PyPy3 (2.4.0)
py
Runtime Error
180
39408
289
S = input() prvs = '' si = None for i, s in enumerate(S): if prvs == s: if si is None: si = i print(i,i+1) exit() else: if si is not None: print(si, i) prvs = s for i in range(len(S)-2): if set(S[i:i+3])>=3: print(i+1, i+4) exit() print(-1, -1)
s633679972
p04032
u673361376
1574109971
Python
PyPy3 (2.4.0)
py
Runtime Error
167
39892
286
S = input() prvs = '' si = None for i, s in enumerate(S): if prvs == s: if si is None: si = i print(i,i+1) exit() else: if si is not None: print(si, i) prvs = s for i range(len(S)-2): if set(S[i:i+3])>=3: print(i+1, i+4) exit() print(-1, -1)
s814819770
p04032
u557494880
1573845304
Python
Python (3.4.3)
py
Runtime Error
117
3188
268
s = input() n = len(s) for i in range(n-1): a = s[i:i+2] if i != n-2: b = s[i:i+3] if a[0] == a[1]: print(i+1,i+2) break if b[0] == b[2] or b[1] == b[2]: print(i+1,i+3) break if i == n-2: print(-1,-1)
s375887656
p04032
u557494880
1573845185
Python
Python (3.4.3)
py
Runtime Error
17
2940
274
s = input() n = len(s) for i in range(n-1): a = s[i:i+2] if i != n-2: b = s[i:i+3] if a[0] == a[1]: print(i+1,i+3) break if b[0] == b[2] or b[1] == b[2]: print(i+1,i+3) break if i = n-2: print(-1,-1)
s548150308
p04032
u779728630
1573625576
Python
Python (3.4.3)
py
Runtime Error
18
3188
385
def check(ss): counter = [0 in range(26)] for i in range(len(ss)): counter[ord(ss[i])-ord('a')] += 1 for i in range(26): if counter[i] >= len(ss)/2: return True return False s = input() f = True for i in range(len(s)-1): if f: for j in range(2,len(s)): if check(s[i:j+1]): print(i, j) f = False break if f: print(-1, -1)
s958375329
p04032
u644907318
1572694519
Python
PyPy3 (2.4.0)
py
Runtime Error
168
39280
355
s = input().strip() a = -1 b = -1 if s[0]==s[1]: a = 1 b = 2 elif s[1]==s[2]: a = 2 b = 3 elif s[0]==s[2]: a = 1 b = 3 else: for i in range(3,len(s)): if s[i]==s[i-1]: a = i b = i+1 break elif s[i]==s[i-2]: a = i-1 b = i+1 break print(a,b)
s491145192
p04032
u518223105
1571964983
Python
Python (3.4.3)
py
Runtime Error
73
3956
333
# -*- coding: utf-8 -*- s = list(input()) a = 0 b = 0 for i in range(len(s)): if i + 2 == len(s)+1: break if s[i] == s[i+2] and s[i] != s[i+1]: #XYX print("%d %d" % (i+1, i+3)) exit() elif s[i] == s[i+1] and s[i] != s[i+2]: #XXY print("%d %d" % (i+1, i+3)) exit() print("-1 -1")
s546880776
p04032
u518223105
1571963071
Python
Python (3.4.3)
py
Runtime Error
2104
3956
299
# -*- coding: utf-8 -*- s = list(input()) a = 0 b = 0 count = list(map(lambda x: s.count(x), s)) print(count) for j in range(len(count)): # print(count[j]) if count[j] > 1: a = j + 1 b = s.index(s[j], j + 2) # print("%d %d" % (a, b)) exit() print("-1 -1")
s222538544
p04032
u223904637
1570596183
Python
Python (3.4.3)
py
Runtime Error
19
3956
304
s=list(input()) if len(s)==2: if s[0]==s[1]: print('1 2') else: print('-1 -1') exit() for i in range(len(s)-1): if l[i]==l[i+1]: print(*[i+1,i+2]) exit() for i in range(len(s)-2): if l[i]==l[i+2]: print(*[i+1,i+3]) exit() print('-1 -1')
s979894280
p04032
u097317219
1569445124
Python
PyPy3 (2.4.0)
py
Runtime Error
177
39536
299
from collections import Counter s = input() s_con = Counter(s) mode = s_con.most_common(1) s_com = mode[0][1] s_con_str = mode[0][0] s_rev = s.reverse() if s_com >= (len(s) / 2): print("-1 -1") else: ans_1 = s.find(s_con_str) ans_2 = s_rev.find(s_con_str) print(str(ans_1) + " " +str(ans_2))
s179081912
p04032
u325227960
1569122628
Python
PyPy3 (2.4.0)
py
Runtime Error
169
39664
250
s = input() + "0" def d(): for i in range(len(s)-1): if s[i] == s[i+1]: return str(i+1) + " " + str(i+2) elif i <= len(s)-2 and s[i] == s[i+2]: return str(i+1) + " " + str(i+3) return "-1 -1" print(d())
s232035482
p04032
u469254913
1568176795
Python
Python (3.4.3)
py
Runtime Error
52
3316
384
s = str(input()) flag = True res = -1 for i in range(len(s)-2): if s[i] == s[i+1]: print(i+1,i+3) flag = False break elif s[i] == s[i+2]: print(i+1,i+3) flag = False break if flag: if s[-2] == s[-1]: print(len(s)-2,len(s)) elif s[-3] == s[-1]: print(len(s)-2,len(s)) else: print(res,res)
s573317174
p04032
u595716769
1568067545
Python
Python (3.4.3)
py
Runtime Error
140
3440
2006
import sys def convert(num): out = "" if num == 0: out = "a" elif num == 1: out = "b" elif num == 2: out = "c" elif num == 3: out = "d" elif num == 4: out = "e" elif num == 5: out = "f" elif num == 6: out = "g" elif num == 7: out = "h" elif num == 8: out = "i" elif num == 9: out = "j" elif num == 10: out = "k" elif num == 11: out = "l" elif num == 12: out = "m" elif num == 13: out = "n" elif num == 14: out = "o" elif num == 15: out = "p" elif num == 16: out = "q" elif num == 17: out = "r" elif num == 18: out = "s" elif num == 19: out = "t" elif num == 20: out = "u" elif num == 21: out = "v" elif num == 22: out = "w" elif num == 23: out = "x" elif num == 24: out = "y" else: out = "z" return (out) s = input() L = [] L.append(s.count("a")) L.append(s.count("b")) L.append(s.count("c")) L.append(s.count("d")) L.append(s.count("e")) L.append(s.count("f")) L.append(s.count("g")) L.append(s.count("h")) L.append(s.count("i")) L.append(s.count("j")) L.append(s.count("k")) L.append(s.count("l")) L.append(s.count("m")) L.append(s.count("n")) L.append(s.count("o")) L.append(s.count("p")) L.append(s.count("q")) L.append(s.count("r")) L.append(s.count("s")) L.append(s.count("t")) L.append(s.count("u")) L.append(s.count("v")) L.append(s.count("w")) L.append(s.count("x")) L.append(s.count("y")) L.append(s.count("z")) flag = 0 maxlist = [] for i in range(26): if L[i] == max(L): maxlist.append(i) for j in range(len(maxlist)): for i in range(len(s)): if s[i] == convert(maxlist[j]): if s[i+1] == convert(maxlist[j]): print("{0} {1}".format(i+1, i+2)) flag = 1 break if s[i+2] == convert(maxlist[j]): print("{0} {1}".format(i+1, i+3)) flag = 1 break if flag == 0: print("{0} {1}".format(-1,-1))
s428634130
p04032
u595716769
1568066869
Python
Python (3.4.3)
py
Runtime Error
132
3444
1934
import sys def convert(num): out = "" if num == 0: out = "a" elif num == 1: out = "b" elif num == 2: out = "c" elif num == 3: out = "d" elif num == 4: out = "e" elif num == 5: out = "f" elif num == 6: out = "g" elif num == 7: out = "h" elif num == 8: out = "i" elif num == 9: out = "j" elif num == 10: out = "k" elif num == 11: out = "l" elif num == 12: out = "m" elif num == 13: out = "n" elif num == 14: out = "o" elif num == 15: out = "p" elif num == 16: out = "q" elif num == 17: out = "r" elif num == 18: out = "s" elif num == 19: out = "t" elif num == 20: out = "u" elif num == 21: out = "v" elif num == 22: out = "w" elif num == 23: out = "x" elif num == 24: out = "y" else: out = "z" return (out) s = input() L = [] L.append(s.count("a")) L.append(s.count("b")) L.append(s.count("c")) L.append(s.count("d")) L.append(s.count("e")) L.append(s.count("f")) L.append(s.count("g")) L.append(s.count("h")) L.append(s.count("i")) L.append(s.count("j")) L.append(s.count("k")) L.append(s.count("l")) L.append(s.count("m")) L.append(s.count("n")) L.append(s.count("o")) L.append(s.count("p")) L.append(s.count("q")) L.append(s.count("r")) L.append(s.count("s")) L.append(s.count("t")) L.append(s.count("u")) L.append(s.count("v")) L.append(s.count("w")) L.append(s.count("x")) L.append(s.count("y")) L.append(s.count("z")) flag = 0 for i in range(26): if L[i] == max(L): maxnum = i break for i in range(len(s)): if s[i] == convert(maxnum): if s[i+1] == convert(maxnum): print("{0} {1}".format(i+1, i+2)) flag = 1 break if s[i+2] == convert(maxnum): print("{0} {1}".format(i+1, i+3)) flag = 1 break if flag == 0: print("{0} {1}".format(-1,-1))
s450302674
p04032
u270144704
1568059657
Python
Python (3.4.3)
py
Runtime Error
17
3064
560
s=input() flag=0 if len(s)==2: if s[0]==s[1]: print('1 2') else: print('-1 -1') else: for i in range(len(s)-2): if s[i]==s[i+2] and s[i]!=s[i+1]: print(f'{i+1} {i+3}') flag=1 break elif s[i]==s[i+1] and s[i]!=s[i+2]: print(f'{i+1} {i+3}') flag=1 break elif s[i+1]==s[i+2] and s[i+1]!=s[i]: print(f'{i+1} {i+3}') flag=1 break if flag==0: print('-1 -1')
s281967810
p04032
u270144704
1568059040
Python
Python (3.4.3)
py
Runtime Error
17
2940
560
s=input() flag=0 if len(s)==2: if s[0]==s[1]: print('1 2') else: print('-1 -1') else: for i in range(len(s)-2): if s[i]==s[i+2] and s[i]!=s[i+1]: print(f'{i+1} {i+3}') flag=1 break elif s[i]==s[i+1] and s[i]!=s[i+2]: print(f'{i+1} {i+3}') flag=1 break elif s[i+1]==s[i+2] and s[i+1]!=s[i]: print(f'{i+1} {i+3}') flag=1 break if flag==0: print('-1 -1')
s195369444
p04032
u270144704
1567991082
Python
Python (3.4.3)
py
Runtime Error
42
3188
434
s=input() dic={} key_letters=[] flag=0 for letter in s: if letter not in dic.keys(): dic[letter]=1 else: dic[letter]+=1 for key,value in dic.items(): if value>=len(s)/2: key_letters.append(key) flag=1 if flag==0: print('-1 -1') else: for i in range(len(s)): if s[i] in key_letters and s[i]==s[i+1]: print(str(i+1)+' '+str(len(s))) break
s670114004
p04032
u270144704
1567991019
Python
Python (3.4.3)
py
Runtime Error
43
3188
461
s=input() dic={} key_letters=[] flag=0 for letter in s: if letter not in dic.keys(): dic[letter]=1 else: dic[letter]+=1 for key,value in dic.items(): if value>=len(s)//2: key_letters.append(key) flag=1 if flag==0: print('-1 -1') else: for i in range(len(s)): if s[i] in key_letters and s[i]==s[i+1]: print(str(i+1)+' '+str(len(s))) break
s724687372
p04032
u919025034
1567328428
Python
Python (3.4.3)
py
Runtime Error
69
3188
194
S = input() if len(S)==2 and s[0]==s[1]: print(1,2);exit() for i in range(len(S)-2): if S[i] == S[i+1] or S[i] == S[i+2] or S[i+1] == S[i+2]: print(i+1,i+3);exit() print("-1 -1")
s260058163
p04032
u919025034
1567325816
Python
Python (3.4.3)
py
Runtime Error
25
2940
468
[InternetShortcut] URL=https://atcoder.jp/contests/abc043/custom_test import collections S = list(input()) n = collections.Counter(S).most_common()[0][1] for i in range(2, min(2*n,len(S)+1)): for j in range(0,len(S)-(i-1)): s = S[j:j+i] s_com = collections.Counter(s).most_common() for com in s_com: if com[1] >= i//2+1: print(j,j+i);exit() elif com[1] <i//2+1: break print("-1 -1")
s199204369
p04032
u037430802
1566960774
Python
Python (3.4.3)
py
Runtime Error
18
3188
605
H,W,N = map(int, input().split()) field = {} for i in range(N): a,b = map(int, input().split()) a,b = a-1,b-1 for j in range(a-1, a+2): for k in range(b-1, b+2): if not j in field: field[j] = {} if not k in field[j]: field[j][k] = 0 field[j][k] += 1 ans = [0] * 10 for kh in field.keys(): for kw in field[kh].keys(): if 1 <= kh <= H-2 and 1 <= kw <= W-2: ans[field[kh][kw]] += 1 tmp = (H-2)*(W-2) for i in range(1,10): tmp -= ans[i] ans[0] = tmp for i in range(10): print(ans[i])
s192428885
p04032
u785470389
1565849238
Python
Python (3.4.3)
py
Runtime Error
70
3188
278
s = input() answer_1 = answer_2 = -1 for i in range(len(s) - 1): if s[i] == s[i+1]: answer_1 = i + 1 answer_2 = i + 2 break elif i+1 != len(s) and s[i] == s[i+2]: answer_1 = i + 1 answer_2 = i + 3 break print(str(answer_1) + " " + str(answer_2))
s287023687
p04032
u785470389
1565849032
Python
Python (3.4.3)
py
Runtime Error
68
3188
278
s = input() answer_1 = answer_2 = -1 for i in range(len(s) - 1): if s[i] == s[i+1]: answer_1 = i + 1 answer_2 = i + 2 break elif i+1 != len(s) and s[i] == s[i+2]: answer_1 = i + 1 answer_2 = i + 3 break print(str(answer_1) + " " + str(answer_2))
s620951990
p04032
u785470389
1565848228
Python
Python (3.4.3)
py
Runtime Error
54
3188
256
s = input() answer_1 = answer_2 = -1 for i in range(len(s)): if s[i] == s[i+1]: answer_1 = i + 1 answer_2 = i + 2 break elif s[i] == s[i+2]: answer_1 = i + 1 answer_2 = i + 3 break print(str(answer_1) + " " + str(answer_2))
s921431420
p04032
u820461302
1565819712
Python
Python (3.4.3)
py
Runtime Error
52
4664
557
# -*- coding: utf-8 -*- from collections import Counter # 文字列の入力 S = input() # 文字列から部分文字列を抽出して偏りをチェック counter = Counter(S) # 最頻出の文字とその次の文字の出現回数を比較 if len(S) > 1: if counter.most_common()[0][1] != counter.most_common()[1][1] : # 文字の頻出分布をチェック counter.most_common()) print(S.index(counter.most_common()[0][0])+1,len(S)-sorted(S,reverse=True).index(counter.most_common()[0][0])+1) else: print("-1","-1") else: print("-1","-1")