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
s813793617
p03480
u411537765
1514083127
Python
Python (3.4.3)
py
Runtime Error
34
3316
365
import sys S = input() center = len(S) // 2 b = S[center] if len(S) % 2 == 1: for i in range(1, center + 1): if S[center + i] != b or S[center - i] != b: print(center + i) sys.exit() else: for i in range(center + 1): if S[center - i] != b or S[center + 1 + i] != b: ...
s786864314
p03480
u257974487
1514082713
Python
Python (3.4.3)
py
Runtime Error
17
3188
82
S = input() N = int(input()) ans = S.count("0") if ans > N: ans = N print(ans)
s109114709
p03481
u301302814
1601237002
Python
Python (3.8.2)
py
Runtime Error
27
8964
191
# coding: utf-8 def main(): X, Y = map(int, input().split()) ans = 0 while (X <= Y){ x *= 2 ans += 1 } print(ans) if __name__ == "__main__": main()
s908569564
p03481
u168416324
1591827991
Python
Python (3.4.3)
py
Runtime Error
17
2940
4
3 20
s034110321
p03481
u937238023
1591054843
Python
Python (3.4.3)
py
Runtime Error
18
2940
1146
/* ID: learnin7 TASK: test LANG: C++ */ /* LANG can be C++11 or C++14 for those more recent releases */ #include<bits/stdc++.h> /* Macros from Endagorion */ #define mp make_pair #define mt make_tuple #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #define...
s331665217
p03481
u287132915
1589064590
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38384
75
import math x, y = map(int, input().split()) print(int(math.log2(y/x))+1)
s592342034
p03481
u711238850
1589024296
Python
Python (3.4.3)
py
Runtime Error
17
2940
100
x,y = tuple(map(int,input().split())) for i in range(1,10*4): x<<=1 if x>y: print(i) break
s586149531
p03481
u007886915
1588789987
Python
Python (3.4.3)
py
Runtime Error
186
21044
10231
# -*- coding: utf-8 -*- import sys import fractions import copy import bisect import math import numpy as np import itertools from itertools import combinations_with_replacement #import math#数学的計算はこれでいける。普通に0.5乗しても計算可能 #w=input() from operator import itemgetter from sys import stdin #input = sys.stdin.readline#こっちの方が入...
s695900310
p03481
u007886915
1588788050
Python
Python (3.4.3)
py
Runtime Error
317
30328
10233
# -*- coding: utf-8 -*- import sys import fractions import copy import bisect import math import numpy as np import itertools from itertools import combinations_with_replacement #import math#数学的計算はこれでいける。普通に0.5乗しても計算可能 #w=input() from operator import itemgetter from sys import stdin #input = sys.stdin.readline#こっちの方が入...
s602903726
p03481
u007886915
1588787972
Python
Python (3.4.3)
py
Runtime Error
185
21296
10233
# -*- coding: utf-8 -*- import sys import fractions import copy import bisect import math import numpy as np import itertools from itertools import combinations_with_replacement #import math#数学的計算はこれでいける。普通に0.5乗しても計算可能 #w=input() from operator import itemgetter from sys import stdin #input = sys.stdin.readline#こっちの方が入...
s353520454
p03481
u548163222
1587829814
Python
Python (3.4.3)
py
Runtime Error
18
2940
295
#include <iostream> #include <queue> #include <algorithm> #include <set> #include <vector> #include <string> using namespace std; using ll=long long; const int INF=1e2; using P=pair<int,int>; int main() { ll x,y; cin>>x>>y; int an=0; while(x<=y) { an++; y/=2; } cout<<an<<endl; }
s761673283
p03481
u373047809
1587749760
Python
Python (3.4.3)
py
Runtime Error
17
2940
64
x, y = map(int, input().split()) print(len(str(bin(y//x))[2:]+1)
s122429702
p03481
u105124953
1587246403
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38384
71
import math x,y = map(int,input().split()) print(int(math.log2(y/x))+1)
s687641619
p03481
u693953100
1585827161
Python
Python (3.4.3)
py
Runtime Error
17
2940
164
def solve(): a,y = map(int,input().split()) ans = 1 while(a<=y){ a*=2 ans+=1 } print(ans) if __name__ == "__main__": solve()
s830204634
p03481
u941115862
1585542406
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38384
158
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll x,y; cin>>x>>y; ll z=y/x; ll ans=log2(z)+1; cout<<ans; }
s048116216
p03481
u703214333
1576860611
Python
Python (3.4.3)
py
Runtime Error
17
2940
838
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) #define fs first #define sc second typedef vector<ll> vl; typedef vector<int> vi; typedef vector<string> vs; typedef vector<char> vc; typedef vector<tuple<ll,ll>...
s289425537
p03481
u556589653
1568320266
Python
Python (3.4.3)
py
Runtime Error
17
2940
110
X,Y = map(int,input().split()) S = X for i in range(Y//X): if S%X<=Y: ans += 1 S == S*(i+1) print(ans)
s314166744
p03481
u296150111
1566265688
Python
Python (3.4.3)
py
Runtime Error
17
2940
83
x,y=map(int,input().split()) import math p=math.log(y/x,2)+10**(-18) print(int(p)+1
s944149436
p03481
u343523393
1555110573
Python
Python (3.4.3)
py
Runtime Error
17
2940
28
314159265 358979323846264338
s567173194
p03481
u067983636
1548809792
Python
Python (3.4.3)
py
Runtime Error
2104
2940
111
import math X, Y = map(int, input().split()) r = 0 while X < Y: Y //= X r += 1 print(int(math.log2(r)) + 1)
s427233534
p03481
u205561862
1541625392
Python
Python (3.4.3)
py
Runtime Error
18
2940
107
import math;print(int((lambda l:math.floor(1e-5+math.log2(l[1]/l[0]))+1))(list(map(int,input().split()))))
s651846317
p03481
u205561862
1541625289
Python
Python (3.4.3)
py
Runtime Error
18
2940
106
import math;print(int((lambda l:math.floor(1e-9+math.log2(l[1]/l[0]))+1))(list(map(int,input().split()))))
s437290291
p03481
u089230684
1541617410
Python
Python (3.4.3)
py
Runtime Error
18
2940
73
X,Y = map(int,input()) ans = 0 while X <= Y: ans += 1 X *= 2 print(ans)
s290602226
p03481
u089230684
1541617380
Python
Python (3.4.3)
py
Runtime Error
18
2940
82
X,Y = map(int,input().split()) ans = 0 while X <= Y: ans += 1 X * = 2 print(ans)
s666532351
p03481
u863370423
1541617348
Python
Python (3.4.3)
py
Runtime Error
19
2940
74
X,Y = map(int,input()) ans = 0 while X <= Y: ans += 1 X * = 2 print(ans)
s878311588
p03481
u353919145
1541614980
Python
Python (3.4.3)
py
Runtime Error
18
2940
99
x,y = map(int, input().split()) while 1: x *= 2 if x > y: print(i+1) quit()
s335048003
p03481
u459737327
1516583820
Python
Python (3.4.3)
py
Runtime Error
17
2940
84
X, Y = map(int, input().split()) cnt = 0 while X <= Y cnt += 1 X *= 2 print(cnt)
s166332656
p03481
u300352570
1515598876
Python
Python (3.4.3)
py
Runtime Error
17
2940
153
def getAns(x,y): num=int(y/x) res=1 while num>1: num/=2 res+=1 return res x,y=map(int,input().split()) print getAns(x,y)
s555177337
p03481
u867069435
1515305662
Python
Python (3.4.3)
py
Runtime Error
17
2940
94
from math import frexp a, b = map(int, input().split()) print(frexp(b)[1]-frexp(a)[1]+1)
s425797263
p03481
u867069435
1515305558
Python
Python (3.4.3)
py
Runtime Error
18
2940
82
from math import frexp a, b = map(int, input().split()) print(frexp(b)-frexp(a)+1)
s320276029
p03481
u341087021
1515250888
Python
Python (3.4.3)
py
Runtime Error
22
3064
150
x,y = [int(x) for x in input().split()] count = 1 while True: if x * 2 <= y: x = x * 2 count += 1 else: break print(count)
s591464119
p03481
u303739137
1514919125
Python
Python (3.4.3)
py
Runtime Error
18
3064
318
inp = input().split(" ") x = float(inp[0]) y = inp[1] if len(y) > 7: y1 = float(y[0:7]) y2 = float(y[7:]) logy =7*np.log(10)+np.log(y1) + y2/y1 print(int(1+np.floor((logy - np.log(x) + 0.00000001 ) / np.log(2)))) else: print(int(1+np.floor((np.log(float(y))-np.log(x) + 0.00000001 ) / np.log(2))))
s312725021
p03481
u303739137
1514918168
Python
Python (3.4.3)
py
Runtime Error
301
20084
347
import numpy as np inp = input().split(" ") x = float(inp[0]) y = inp[1] if len(y) > 7: y1 = float(y[0:7]) y2 = float(y[7:]) logy =7*np.log(10)+np.log(y1) + np.log(y2/y1) print(int(1+np.floor((logy - np.log(x) + 0.00000001 ) / np.log(2)))) else: print(int(1+np.floor((np.log(float(y))-np.log(x) + ...
s757070269
p03481
u303739137
1514916698
Python
Python (3.4.3)
py
Runtime Error
17
2940
71
print(int(1+np.floor((np.log(y)-np.log(x) + 0.00000001 ) / np.log(2))))
s356615221
p03481
u303739137
1514872291
Python
Python (3.4.3)
py
Runtime Error
17
2940
98
inp = input().split(" ") x = inp[0] y = inp[1] print(np.floor((np.log(y)-np.log(x)) / np.log(2)))
s467118232
p03481
u267638701
1514843769
Python
Python (3.4.3)
py
Runtime Error
17
2940
135
# -*- coding: utf-8 -*- X, Y = map(int, raw_input().split()) cnt = 0 num = X while num <= Y: cnt += 1 num = num*2 print(cnt)
s997686771
p03481
u267638701
1514843671
Python
Python (3.4.3)
py
Runtime Error
17
2940
147
# -*- coding: utf-8 -*- import math X, Y = map(int, raw_input().split()) cnt = 0 num = X while num <= Y: cnt += 1 num = num*2 print(cnt)
s441261101
p03481
u399810298
1514425464
Python
Python (3.4.3)
py
Runtime Error
339
21552
87
import numpy as np X,Y=[int(i) for i in raw_input().split()] i=np.log2(Y-X) print(i)
s915594425
p03481
u399810298
1514425370
Python
Python (3.4.3)
py
Runtime Error
333
21768
88
import numpy as np X,Y=[int(i) for i in raw_input().split()] i=np.log_2(Y-X) print(i)
s338160775
p03481
u168964483
1514086673
Python
Python (3.4.3)
py
Runtime Error
17
2940
75
X=input() Y=input() cnt=0 for i<Y: if i%X==0: cnt+=1 print(cnt)
s548361780
p03481
u168964483
1514086492
Python
Python (3.4.3)
py
Runtime Error
17
2940
90
X=input() Y=input() cnt=0 for i in range(X-1:Y): if i%X==0: cnt+=1 print(cnt)
s306868117
p03481
u168964483
1514086411
Python
Python (3.4.3)
py
Runtime Error
17
3064
87
X=input() Y=input() cnt=0 for i in range(X:Y): if i%X==0: cnt+=1 print(cnt)
s405021436
p03481
u168964483
1514086251
Python
Python (3.4.3)
py
Runtime Error
17
2940
134
X=input() Y=input() a=[] for i in range(X:Y): if i%X==0: a.append(i) for j in range(len(a)): print(j)
s649822245
p03482
u662794944
1591840029
Python
PyPy3 (2.4.0)
py
Runtime Error
180
39280
1706
mod = 10**9+7 import sys import math from collections import Counter, defaultdict, deque import copy # from itertools import product, permutations, combinations, combinations_with_replacement # from itertools import accumulate # from operator import itemgetter # from bisect import bisect_bound_list,bisect # from heapq...
s900210193
p03482
u662794944
1591839958
Python
PyPy3 (2.4.0)
py
Runtime Error
220
39664
1703
mod = 10**9+7 import sys import math from collections import Counter, defaultdict, deque import copy # from itertools import product, permutations, combinations, combinations_with_replacement # from itertools import accumulate # from operator import itemgetter # from bisect import bisect_bound_list,bisect # from heapq...
s191439198
p03482
u703950586
1585518265
Python
PyPy3 (2.4.0)
py
Runtime Error
316
63084
377
import sys,queue,math,copy,itertools from fractions import gcd sys.setrecursionlimit(10**7) LI = lambda : [int(x) for x in sys.stdin.readline().split()] _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) ans = len(S) for i in range(len(S)-1): if S[i] != S[i+1]: ...
s082879587
p03482
u703950586
1585518181
Python
PyPy3 (2.4.0)
py
Runtime Error
257
61676
404
import sys,queue,math,copy,itertools from fractions import gcd sys.setrecursionlimit(10**7) LI = lambda : [int(x) for x in sys.stdin.readline().split()] _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) ans = 10**5+1 for i in range(len(S)-1): if S[i] != S[i+1]:...
s128330212
p03482
u259053514
1582291227
Python
Python (3.4.3)
py
Runtime Error
17
3064
5137
//include //------------------------------------------ #include <vector> #include <list> #include <map> #include <unordered_map> #include <climits> #include <set> #include <unordered_set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility>...
s999466514
p03482
u520276780
1569474232
Python
Python (3.4.3)
py
Runtime Error
63
3700
352
s = input() prev = s[0] cnt = 0 now_len = 1 len_sec = [] for i in range(1,len(s)): if prev == s[i]: now_len += 1 else: len_sec.append(now_len) now_len = 1 prev = s[i] if len(len_sec)%2==0: mx = len_sec[0]+len_sec[1] for i in range(1,len(len_sec)-1): mx = max(mx, len_sec[i]+len_sec[i+1]) else:...
s891843883
p03482
u220114950
1560205214
Python
Python (3.4.3)
py
Runtime Error
17
2940
261
#include "bits/stdc++.h" using namespace std; int main(){ string s; cin >> s; int ans = INT_MAX; for(int i = 0; i + 1 < s.size(); i++){ if(s[i] != s[i + 1]) ans = min(ans, max(i + 1, (int)s.size() - i - 1)); } cout << ans << '\n'; }
s381867760
p03482
u220114950
1560205189
Python
Python (3.4.3)
py
Runtime Error
18
2940
257
#include "bits/stdc++.h" using namespace std; int main(){ string s; cin >> s; int ans = INT_MAX; for(int i = 0; i < s.size(); i++){ if(s[i] != s[i + 1]) ans = min(ans, max(i + 1, (int)s.size() - i - 1)); } cout << ans << '\n'; }
s535940649
p03482
u375616706
1552605407
Python
Python (3.4.3)
py
Runtime Error
59
5204
317
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) s = input() K = [] for k in range(1, len(s)): if s[k] != s[k-1]: K.append(max(len(s)-k, k)) else: continue ans = 0 if min(K) == 0: if all(v == "1" for v in s): ans = len(s) else: ans = min(K) print(ans)
s784635729
p03482
u375616706
1552605360
Python
PyPy3 (2.4.0)
py
Runtime Error
206
41840
317
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) s = input() K = [] for k in range(1, len(s)): if s[k] != s[k-1]: K.append(max(len(s)-k, k)) else: continue ans = 0 if min(K) == 0: if all(v == "1" for v in s): ans = len(K) else: ans = min(K) print(ans)
s645851701
p03482
u375616706
1551193976
Python
PyPy3 (2.4.0)
py
Runtime Error
207
43120
240
s=input() l=[] p=s[0] seq=1 for c in s[1:]: if c==p: seq+=1 else: l.append(seq) seq=1 p=c ans=float("inf") d1=min([a+b for a,b in zip(l[0::2],l[1::2])]) d2=min([a+b for a, b in zip(l[1::2],l[2::2])]) print(min(d1,d2))
s174860584
p03482
u375616706
1551193936
Python
PyPy3 (2.4.0)
py
Runtime Error
164
38256
239
s=input() l=[] p=s[0] seq=1 for c in s[1:] if c==p: seq+=1 else: l.append(seq) seq=1 p=c ans=float("inf") d1=min([a+b for a,b in zip(l[0::2],l[1::2])]) d2=min([a+b for a, b in zip(l[1::2],l[2::2])]) print(min(d1,d2))
s173190701
p03482
u375616706
1551193795
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38256
242
s=input() l=[] p=s[0] seq=1 for c in s[1:] if c==p: seq+=1 else: l.append(seq) seq=1 prev=c ans=float("inf") d1=min([a+b for a,b in zip(l[0::2],l[1::2])]) d2=min([a+b for a, b in zip(l[1::2],l[2::2])]) print(min(d1,d2))
s117609341
p03482
u863370423
1546816810
Python
Python (3.4.3)
py
Runtime Error
18
2940
115
a = list(input()) s = 1 for i in range(1, len(a)): if(a[i] != a[i + 1]) s = min(max(i, n - i)) print(s)
s679148378
p03482
u785989355
1542339800
Python
Python (3.4.3)
py
Runtime Error
54
3188
320
S = input() l=len(S) if l%2==0: s=S[int(l/2)] for i in range(int(l/2)): if S[int(l/2)-1-i]!=s or S[int(l/2)+i]!=s: break print(int(l/2)+i) else: s=S[int(l/2)] for i in range(int(l/2)): if S[int(l/2)-1-i]!=s or S[int(l/2)+1+i]!=s: break print(int(l/2)+1+i)
s082045792
p03482
u015768390
1542038983
Python
Python (3.4.3)
py
Runtime Error
82
3708
556
S=input()+'2' prev=S[0] cnt=1 li=[] for i in range(1,len(S)): if S[i]!=prev: li.append(cnt) prev=S[i] cnt=1 else: cnt+=1 if len(li)==1: print(li[0]) elif len(li)==2: print(max(li)) elif len(li)%2==1: ans=li[0]+li[1] for i in range(len(li)-1): ans=min(ans,l...
s273071512
p03482
u422104747
1535846809
Python
PyPy3 (2.4.0)
py
Runtime Error
173
40048
185
s=input()[1:-1] c=s[0] res=0 cnt=1 for i in range(1,len(s)): if s[i]==c: cnt+=1 else: c=s[i] res=max(res,cnt) cnt=1 res=max(res,cnt) print(res+1)
s922711015
p03482
u761320129
1526784007
Python
Python (3.4.3)
py
Runtime Error
36
3188
194
S = input() N = len(S) ans = N//2 l = r = N//2 if N%2 == 0: r += 1 while l >= 0: if S[l] == '1' or S[r] == '1': break l -= 1 r += 1 ans += 1 print(max(ans, N//2 + N%2))
s383999656
p03482
u777923818
1515184333
Python
Python (3.4.3)
py
Runtime Error
72
5836
182
# -*- coding: utf-8 -*- S = input() n = len(S) L = list(map(int, list(S))) D = [] res = 0 for k in range(n-1): if L[k] != L[k+1]: D.append(max(k+1, n-k-1)) print(min(D))
s150119708
p03482
u267638701
1514863801
Python
Python (3.4.3)
py
Runtime Error
68
5212
167
# -*- coding: utf-8 -*- S = input() n = len(S) T = [] for i in range(len(S)-1): if S[i] != S[i+1]: t = max(i+1, n-i-1) T.append(t) print(min(T))
s941862048
p03482
u283229916
1514851339
Python
Python (3.4.3)
py
Runtime Error
18
3060
224
s=raw_input() k=len(s)/2+1 lef=(len(s)-1)/2 ch=s[lef] rig=(len(s))/2 while 0<=lef and rig<len(s): if s[lef]==s[rig] and ch==s[lef]: lef-=1 rig+=1 k+=1 else: k-=1 break print(k)
s271956712
p03482
u667024514
1514687233
Python
Python (3.4.3)
py
Runtime Error
85
3188
235
a,b = map(int,input().split()) s = list(input()) a_lis = s[:(a-1)] b_lis = s[b:] if s[a] == "-": if "-" not in a_lis: if "-" not in b_lis: print("Yes") else: print("No") else: print("No") else: print("No")
s905647509
p03482
u722641375
1514433157
Python
Python (3.4.3)
py
Runtime Error
19
3188
226
def main(): s = map(int,input().split()) ans = len(s) for i in range(0,len(s)-1): if s[i] != s[i+1]: ans = min(ans , max(i+1 , len(s)-i-1)) print(ans) if __name__ == '__main__': main()
s703958525
p03482
u596276291
1514240039
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
82572
1316
import sys from collections import defaultdict, Counter from itertools import product, groupby, count, permutations, combinations from math import pi, sqrt, ceil, floor from collections import deque from bisect import bisect, bisect_left, bisect_right from string import ascii_lowercase from functools import lru_cache, ...
s014720238
p03482
u794543767
1514089705
Python
Python (3.4.3)
py
Runtime Error
1363
14668
212
import numpy as np s = input() fis = s[0] n = len(s) k = float('inf') temp = s[0] for i in range(n): if temp!=s[i]: temp = s[i] k = np.min((k, np.max( (i, n-i) ) )) print("{}".format(int(k)))
s137471134
p03482
u794543767
1514089670
Python
Python (3.4.3)
py
Runtime Error
317
21528
200
import numpy as np fis = s[0] n = len(s) k = float('inf') temp = s[0] for i in range(n): if temp!=s[i]: temp = s[i] k = np.min((k, np.max( (i, n-i) ) )) print("{}".format(int(k)))
s385041125
p03482
u510295687
1514088486
Python
Python (3.4.3)
py
Runtime Error
17
2940
834
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<cstring> #include<vector> #include<cmath> #include<queue> #include<stack> using namespace std; #define INT(x) int x; scanf("%d",&x) #define LL(x) ll x; scanf("%lld",&x) #define INPUT(x) cin >> x #define REP1(x,n) for(int x = 0; x < n; x++...
s699462839
p03482
u341087021
1514086769
Python
Python (3.4.3)
py
Runtime Error
18
3188
401
s = input() l = len(s) for i,x in enumerate(s): if i == 0: pass else: if x != s[i-1]: count += 1 else: if count % 2 == 0: a = count -1 if a <= l: l = a else: a = count ...
s543377256
p03482
u315078622
1514086136
Python
Python (3.4.3)
py
Runtime Error
145
8936
880
S = input() idx = 0 cnts = [] while idx < len(S): char = S[idx] cnt = 0 while idx < len(S) and S[idx] == char: idx += 1 cnt += 1 cnts.append(cnt) if len(cnts) <= 2: print(max(cnts)) quit() ans = (len(S) + 1) // 2 for i in range(len(cnts) - 2): ans = max(ans, min(cnts[i] + cnt...
s460394426
p03482
u315078622
1514085830
Python
Python (3.4.3)
py
Runtime Error
146
8932
873
S = input() idx = 0 cnts = [] while idx < len(S): char = S[idx] cnt = 0 while idx < len(S) and S[idx] == char: idx += 1 cnt += 1 cnts.append(cnt) if len(cnts) <= 2: print(max(cnts)) quit() ans = (len(S) + 1) // 2 for i in range(len(cnts) - 2): ans = max(ans, min(cnts[i] + cnt...
s540866115
p03482
u803848678
1514085292
Python
Python (3.4.3)
py
Runtime Error
46
4468
955
# 無限回試行できる時、Kの最小値を最大化する問題 s = input() now = s[0] cnt = 1 use = [] for i in range(1,len(s)): if now == s[i]: cnt += 1 else: use.append(cnt) cnt = 1 now = s[i] use.append(cnt) min_prob = len(s) def ketsugou(l): global min_prob #一番小さいやつをくっつけていく m = l.index(min(l)) i...
s667744719
p03482
u667084803
1514084939
Python
Python (3.4.3)
py
Runtime Error
64
5764
533
import sys s = list(str(input().rstrip())) s = list(map(int,s)) change = 0 cflag=[] for i in range(len(s)-1): if s[i]!=s[i+1]: change+=1 cflag+=[i+1] if change==0: print(len(s)) sys.exit() elif change ==1: ones = s.count(1) zeros = s.count(0) print(max(ones,zeros)) sys.exit() elif change ==2: p...
s836221870
p03482
u667084803
1514083910
Python
Python (3.4.3)
py
Runtime Error
52
4776
276
import sys s = list(str(input().rstrip())) s = list(map(int,s)) change = 0 for i in range(len(s)-1): if s[i]!=s[i+1]: change+=1 if change==0: print(len(s)) sys.exit() elif change ==1: ones = s.count(1) zeros = s.count(0) print(max(ones,zeros)) sys.exit() 0/0
s172615655
p03482
u826570725
1514083723
Python
Python (3.4.3)
py
Runtime Error
44
3572
252
import sys line = sys.stdin.readline().strip() l = [0] st = line[0] for s in line: if not st is s: st = s l.append(0) l[-1] += 1 if len(l) == 2: print(max(l)) else: print(min( l[i] + l[i+1] for i in range(len(l)-1) ))
s484375289
p03482
u826570725
1514083663
Python
Python (3.4.3)
py
Runtime Error
17
2940
206
import sys line = sys.stdin.readline().strip() l = [0] st = line[0] for s in line: if not st is s: st = s l.append(0) l[-1] += 1 if len(l) == 2: print(max(l)) else: print(
s649200214
p03482
u817026203
1514081465
Python
Python (3.4.3)
py
Runtime Error
41
3188
146
s = input().strip() n = len(s) ans = 0 for i, c in enumerate(s): ld, rd = i, n - i - 1 if c == '1': ans = min(ans, max(lr, rd)) print(ans)
s079763884
p03483
u397496203
1568414259
Python
Python (3.4.3)
py
Runtime Error
23
3500
248
def main(): X, Y = [int(i) for i in input().split()] ans = 1 pre = X while True: pre *= 2 if pre <= Y: ans += 1 else: break print(ans) if __name__ == "__main__": main()
s537304016
p03483
u057109575
1563056323
Python
PyPy3 (2.4.0)
py
Runtime Error
2107
58100
988
from collections import defaultdict S = input() class BIT: def __init__(self, n): self.n = n self.bit = [0] * (n + 1) def update(self, i, v): while i <= self.n: self.bit[i] += v i += i & -i def query(self, i): ret = 0 while i > 0...
s075592293
p03483
u057109575
1563054407
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
139140
1022
from collections import Counter, defaultdict S = input() class BIT: def __init__(self, n): self.n = n self.bit = [0] * (n + 1) def update(self, i, v): while i <= self.n: self.bit[i] += v i += i & -i def query(self, i): ret = 0 wh...
s142372070
p03483
u131213364
1550079509
Python
Python (3.4.3)
py
Runtime Error
1172
15324
1336
#!/usr/bin/env python3 class Bit: def __init__(self, n): self.size = n self.tree = [0] * n def sum(self, i): s = 0 i -= 1 while i >= 0: s += self.tree[i] i = (i & (i + 1)) - 1 return s def add(self, i, x): while i < self.size...
s486722742
p03483
u131213364
1550079391
Python
Python (3.4.3)
py
Runtime Error
641
13412
1314
#!/usr/bin/env python3 class Bit: def __init__(self, n): self.size = n self.tree = [0] * n def sum(self, i): s = 0 i -= 1 while i >= 0: s += self.tree[i] i = (i & (i + 1)) - 1 return s def add(self, i, x): while i < self.size...
s973867875
p03483
u884982181
1545678968
Python
PyPy3 (2.4.0)
py
Runtime Error
608
79352
1217
from collections import deque import copy class BIT: def __init__(self, node_size): self._node = node_size+1 self.bit = [0]*self._node def add(self, index, add_val): while index < self._node: self.bit[index] += add_val index += index & -index def sum(self, i...
s420755530
p03483
u123518636
1528588444
Python
Python (2.7.6)
py
Runtime Error
2104
16788
2927
#!/usr/bin/python # -*- coding: utf-8 -*- import sys,collections,itertools,re,math,fractions,decimal,random,array,bisect,heapq,string # decimal.getcontext().prec = 50 # sys.setrecursionlimit(10000) # MOD = 10**9 + 7 def solve(f): s = f.read_str() n = len(s) d = [collections.deque() for _ in xrange(26)] ...
s471053468
p03483
u343675824
1518046267
Python
PyPy3 (2.4.0)
py
Runtime Error
310
49996
1061
from collections import Counter import sys s = input() N = len(s) sc = Counter(s) odds = [1 for x in sc if sc[x] % 2 == 1] if len(odds) > 1: print(-1) sys.exit(0) class BIT: def __init__(self, size): self.bit = [0] * (size+1) def add(self, index, elem): index += 1 while index < ...
s571765145
p03483
u267638701
1515187863
Python
Python (3.4.3)
py
Runtime Error
19
3500
276
# -*- coding: utf-8 -*- N = int(input()) As = list(map(int, input().split())) sum1 = 0 sum2 = sum(As) min_diff = float('inf') for a in As[0:len(As)-1]: sum1 += a sum2 -= a #print(abs(sum1 - sum2)) min_diff = min(min_diff, abs(sum1 - sum2)) print(min_diff)
s537893994
p03483
u478856278
1515079118
Python
Python (3.4.3)
py
Runtime Error
2115
198888
1572
from collections import Counter text = input() count = Counter() def change_count(text): N = len(text) origin = 0 # print(text) if N <= 2: return 0 elif text[0] == text[N-1]: return change_count(text[1:N-1]) else: if count[text[0]] % 2 == 1: origin = N-1 ...
s412846516
p03483
u478856278
1515078466
Python
Python (3.4.3)
py
Runtime Error
2116
198504
1090
from collections import Counter text = input() count = Counter() def change_count(text): N = len(text) origin = 0 if N <= 2: return 0 elif text[0] == text[N-1]: return change_count(text[1:N-1]) else: if count[0] % 2 == 1: origin = N-1 start = 1 w...
s114690435
p03483
u177481830
1515029475
Python
Python (3.4.3)
py
Runtime Error
21
4976
1083
S=input() S_lst=list(S) counter=Counter(S_lst) margin=len(S)%2 for k, v in counter.items(): if v%2==1: margin -= 1 if not(margin == 0): print(-1) exit() num_lst=[] # number notation of S num_ddct=defaultdict(lambda: []) # remember number for palindrome first_dct={} thres_dct={} for k,_ in coun...
s224964620
p03483
u225528554
1514138118
Python
Python (3.4.3)
py
Runtime Error
2108
9704
1522
import string def main(): l = list(input()) N = len(l) count=0 flag = True middle_letter = None i = 0 dic = {i:l.count(i) for i in string.ascii_lowercase} while i <= N>>1: if l[i]!=l[N-i-1]: if dic[l[i]]%2 and N%2: if flag: middle_l...
s382556882
p03483
u783174124
1514086660
Python
Python (3.4.3)
py
Runtime Error
17
2940
2336
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; int main(){ string S; cin >> S; int N = S.size(); vector<vector<int>> cpos(26); for(int i=0;i<N;i++){ cpos[S[i] - 'a'].push_back(i); } int odd_count = 0; for(int i=0;i<26;i++){ ...
s127776577
p03484
u488401358
1593576536
Python
PyPy3 (7.3.0)
py
Runtime Error
1009
163216
2279
import sys,heapq input=sys.stdin.readline N=int(input()) edge=[[] for i in range(N)] for _ in range(N-1): a,b=map(int,input().split()) edge[a-1].append(b-1) edge[b-1].append(a-1) def dfs(v,pv,n): #print(v,pv,len(edge[v])) if v!=0: if len(edge[v])==1: return 1 temp=[] ...
s970688993
p03484
u488401358
1593576486
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74704
2261
import sys,heapq input=sys.stdin.readline sys.setrecursionlimit(2*10**5) N=int(input()) edge=[[] for i in range(N)] for _ in range(N-1): a,b=map(int,input().split()) edge[a-1].append(b-1) edge[b-1].append(a-1) def dfs(v,pv,n): #print(v,pv,len(edge[v])) if v!=0: if len(edge[v])==1: ...
s555881940
p03484
u488401358
1593574271
Python
PyPy3 (7.3.0)
py
Runtime Error
1167
165104
2660
import sys,heapq input=sys.stdin.readline N=int(input()) edge=[[] for i in range(N)] for _ in range(N-1): a,b=map(int,input().split()) edge[a-1].append(b-1) edge[b-1].append(a-1) def dfs(v,pv,n): #print(v,pv,len(edge[v])) if v!=0: if len(edge[v])==1: return 1 temp=[] ...
s958566788
p03484
u299869545
1577166955
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
131020
1481
n = int(input()) edge = [[] for i in range(n+1)] for i in range(n-1): a,b = map(int, input().split()) edge[a].append(b) edge[b].append(a) cnt = [1] *(n+1) a = 0 for i in range(1, n+1): if len(edge[i]) % 2 == 1: a += 1 a //= 2 def init_dfs(x, last = -1): for to in edge[x]: if to =...
s905869430
p03484
u353797797
1573705216
Python
Python (3.4.3)
py
Runtime Error
2209
1695944
2625
from collections import defaultdict import sys from math import log2 sys.setrecursionlimit(10 ** 6) input = sys.stdin.readline int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def main(): def init(i, oi=-1, dpt=0): depth[i] = dpt parent_2k[0][i] = oi for ki in to[i]: ...
s069112162
p03484
u131213364
1550092286
Python
Python (3.4.3)
py
Runtime Error
2105
25484
1519
#!/usr/bin/env python3 import bisect n = 0 edges = None visited = None def dfs(v, b, r = False): global visited if not r: visited = [False] * n visited[v] = True lengths = [] for c in edges[v]: if not visited[c]: k = dfs(c, b, True) if k < 0 or b < k: ...
s908757874
p03484
u131213364
1550091104
Python
Python (3.4.3)
py
Runtime Error
2105
26300
1568
#!/usr/bin/env python3 import bisect n = 0 edges = None visited = None def dfs(v, b, r = False): global visited if not r: visited = [False] * n count = [0] * n visited[v] = True lengths = [] for c in edges[v]: if not visited[c]: k = dfs(c, b, True) ...