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
s508492278
p03525
u654470292
1570250153
Python
PyPy3 (2.4.0)
py
Runtime Error
196
41328
787
import sys import collections def input(): return sys.stdin.readline()[:-1] inf=float("inf") n=int(input()) d=list(map(int,input().split())) c=collections.Counter(d) if c.most_common()[0][1]>2: print(0) quit() if 0 in c: if c[0]==1: print(0) quit() li=list(map(int,c.keys())) li.append...
s318634906
p03525
u654470292
1570249861
Python
PyPy3 (2.4.0)
py
Runtime Error
193
40304
757
import sys import collections def input(): return sys.stdin.readline()[:-1] inf=float("inf") n=int(input()) d=list(map(int,input().split())) c=collections.Counter(d) if c.most_common()[0][1]>2: print(0) quit() if 0 in c: if c[0]==1: print(0) quit() li=list(map(int,c.keys())) ans=0 fo...
s666240248
p03525
u654470292
1570249774
Python
PyPy3 (2.4.0)
py
Runtime Error
192
40432
841
import sys import collections def input(): return sys.stdin.readline()[:-1] inf=float("inf") n=int(input()) d=list(map(int,input().split())) d.append(0) d.append(12) c=collections.Counter(d) if c.most_common()[0][1]>2: print(0) quit() if 0 in c: if c[0]==2: print(0) quit() if 12 in c: ...
s474891776
p03525
u654470292
1570249621
Python
PyPy3 (2.4.0)
py
Runtime Error
188
40688
828
import sys import collections def input(): return sys.stdin.readline()[:-1] inf=float("inf") n=int(input()) d=list(map(int,input().split())) d.append(0) c=collections.Counter(d) if c.most_common()[0][1]>2: print(0) quit() if 0 in c: if c[0]==2: print(0) quit() if 12 in c: if c[12]==...
s367340160
p03525
u654470292
1570249359
Python
PyPy3 (2.4.0)
py
Runtime Error
187
40432
811
import sys import collections def input(): return sys.stdin.readline()[:-1] inf=float("inf") n=int(input()) d=list(map(int,input().split())) d.append(0) c=collections.Counter(d) if c.most_common()[0][1]>2: print(0) quit() if 0 in c: if c[0]==2: print(0) quit() if 12 in c: if c[12]==...
s887044874
p03525
u814986259
1569026708
Python
Python (3.4.3)
py
Runtime Error
18
3064
476
N = int(input()) D = list(map(int, input().split())) diff = [0]*13 D.sort() for i in range(N): diff[D[i]] += 1 if diff[0] > 0: print(0) exit(0) else: diff2 = [diff[12 - i] for i in range(1, N-1)] for i in range(13): if diff[i] > 2: print(0) exit(0) ans = [0] ans = [D[i] fo...
s221618187
p03525
u814986259
1569026456
Python
Python (3.4.3)
py
Runtime Error
17
3064
467
N = int(input()) D = list(map(int, input().split())) diff = [0]*13 D.sort() for i in range(N): diff[D[i]] += 1 if diff[0] > 0: print(0) exit(0) else: diff2 = [diff[12 - i] for i in range(1, N-1)] for i in range(13): if diff[i] > 2: print(0) exit(0) ans = [0] for i in range(N): if...
s312944139
p03525
u814986259
1569026375
Python
Python (3.4.3)
py
Runtime Error
17
2940
463
N = int(input()) D = list(map(int, input().split())) diff = [0]*13 D.sort() for i in range(N): diff[D[i]] += 1 if diff[0] > 0: print(0) exit(0) else: diff2 = [diff[12 - i] for i in range(1, N-1)] for i in range(13): if diff[i] > 2: print(0) exit(0) ans = [0] for i in range(N): if i %...
s298537617
p03525
u814986259
1569026328
Python
Python (3.4.3)
py
Runtime Error
18
3064
449
N = int(input()) D = list(map(int, input().split())) diff = [0]*13 D.sort() for i in range(N): diff[D[i]] += 1 if diff[i] > 2: print(0) exit(0) if diff[0] > 0: print(0) exit(0) else: diff2 = [diff[12 - i] for i in range(1, N-1)] ans = [0] for i in range(N): if i % 2 == 0: ...
s638963395
p03525
u814986259
1569026214
Python
Python (3.4.3)
py
Runtime Error
17
3064
451
N = int(input()) D = list(map(int, input().split())) diff = [0]*13 # D.sort() for i in range(N): diff[D[i]] += 1 if diff[i] > 2: print(0) exit(0) if diff[0] > 0: print(0) exit(0) else: diff2 = [diff[12 - i] for i in range(1, N-1)] ans = [0] for i in range(N): if i % 2 == 0: ...
s538770286
p03525
u814986259
1569026128
Python
Python (3.4.3)
py
Runtime Error
18
3064
450
N = int(input()) D = list(map(int, input().split())) diff = [0]*13 # D.sort() for i in range(N): diff[D[i]] += 1 if diff[i] > 2: print(0) exit(0) if diff[0] > 0: print(0) exit(0) else: diff2 = [diff[12 - i] for i in range(1, N-1)] ans = [] for i in range(N): if i % 2 == 0: ...
s944563778
p03525
u814986259
1569026054
Python
Python (3.4.3)
py
Runtime Error
17
3060
244
N = int(input()) D = list(map(int, input().split())) D.sort() ans = [] for i in range(N): if i % 2 == 0: ans.append(D[i]) else: ans.append(24 - D[i]) ans = [abs(ans[i+1] - ans[i]) for i in range(N-1)] print(min(ans))
s579755491
p03525
u619819312
1566366287
Python
Python (3.4.3)
py
Runtime Error
21
3188
928
s=[0]*25 s[11]=1 d=[0]*13 d[0]+=1 n=int(input()) a=list(map(int,input().split())) d=[a.count(i)for i in range(12)] if max(d[0],d[12])<2 and max(d[1:12])<3: if d[12]==1: s[0]=1 s[-1]=1 t=[] for i in range(1,12): if d[i]==2: s[12-i]=1 s[12+i]=1 elif d[i]...
s109190981
p03525
u619819312
1566365582
Python
Python (3.4.3)
py
Runtime Error
18
3064
920
s=[0]*25 s[11]=1 d=[0]*13 n=int(input()) a=list(map(int,input().split())) d=[a.count(i)for i in range(12)] if max(d[0],d[12])<2 and max(d[1:12])<3: if d[12]==1: s[0]=1 s[-1]=1 t=[] for i in range(1,12): if d[i]==2: s[12-i]=1 s[12+i]=1 elif d[i]==1: ...
s576761533
p03525
u619819312
1566365463
Python
Python (3.4.3)
py
Runtime Error
18
3064
920
s=[0]*25 s[11]=1 d=[0]*13 n=int(input()) a=list(map(int,input().split())) d=[a.count(i)for i in range(12)] if max(d[0],d[12])<2 and max(d[1:12])<3: if d[12]==1: s[0]=1 s[-1]=1 t=[] for i in range(1,12): if d[i]==2: s[12-i]=1 s[12+i]=1 elif d[i]==1: ...
s023367431
p03525
u702582248
1561209727
Python
Python (3.4.3)
py
Runtime Error
17
2940
2742
#include <algorithm> #include <iostream> #include <iomanip> #include <vector> #include <map> #include <set> #include <queue> #include <numeric> #include <bitset> using namespace std; using ll = long long; using ld = long double; const ll mod = 1000000007; #define REP(i, n) for (ll i = 0; i < (n); ++i) #define REP_FR...
s816833417
p03525
u620480037
1558725284
Python
PyPy3 (2.4.0)
py
Runtime Error
226
42992
997
import copy N=int(input()) t=[0 for i in range(13)] T=[0 for i in range(25)] T[0]=1 T[24]=1 D=list(map(int,input().split())) for i in range(N): t[D[i]]+=1 #print(t) if t[0]>=1 or t[12]>=2 or max(t)>=3: print(0) else: for i in range(len(t)): if t[i]==2: T[i]=1 T[24-i]=...
s733597178
p03525
u620480037
1558724654
Python
PyPy3 (2.4.0)
py
Runtime Error
240
45040
997
import copy N=int(input()) t=[0 for i in range(13)] T=[0 for i in range(25)] T[0]=1 T[24]=1 D=list(map(int,input().split())) for i in range(N): t[D[i]]+=1 #print(t) if t[0]>=1 or t[12]>=2 or max(t)>=3: print(0) else: for i in range(len(t)): if t[i]==2: T[i]=1 T[24-i]=...
s362952761
p03525
u257374434
1511634154
Python
Python (3.4.3)
py
Runtime Error
17
3064
198
N= int(input()) D = list(map(int,input().split())) if any((D+[0]).count(i) >2 for i in range(12)): print(0) exit(0) raise def check(i): return False def get_close(l,d=0): return
s931121282
p03526
u935558307
1595129325
Python
PyPy3 (7.3.0)
py
Runtime Error
783
395508
578
N = int(input()) """ dp[i][j] -> i番目の人間までみる。j人が積むときの最小値。 """ HP = [list(map(int,input().split())) for _ in range(N)] HP.sort(key=lambda x:x[0]+x[1]) dp = [[float("INF")]*(N+1) for _ in range(N)] for i in range(N): dp[i][0] = 0 dp[0][1] = HP[1][1] for i in range(1,N): for j in range(1,N+1): if dp[i-1][j...
s193882487
p03526
u935558307
1592208098
Python
PyPy3 (2.4.0)
py
Runtime Error
270
44120
464
N = int(input()) HP = [list(map(int,input().split())) for _ in range(N)] HP.sort(key=lambda x: x[0]+x[1]) ceil = max(HP,key=lambda x: x[0])[0] #dp[i][j] -> i人目まで見る。j人積むときの、座布団の枚数の最小値 dp = [ceil+1]*(N+1) ans = 0 for i in range(N+1): dp[i][0] = 0 for i in range(N): h,p = HP[i] for j in range(N,0,-1): ...
s400208147
p03526
u935558307
1588814946
Python
PyPy3 (2.4.0)
py
Runtime Error
275
43992
488
N = int(input()) men = [] for _ in range(N): H,P = map(int,input().split()) men.append((H,P,H+P)) men.sort(key=lambda x: x[2]) inf = max(H)+1 dp = [[inf]*(N+1) for _ in range(N+1)] dp[0][0] = 0 for i in range(1,N+1): h,p,a = men[i-1] for j in range(1,N+1): if dp[i-1][j-1] <= h: dp[i...
s289161319
p03526
u532966492
1577332758
Python
Python (3.4.3)
py
Runtime Error
17
2940
506
def main(): import sys input=sys.stdin.readline n = int(input()) hp = sorted([tuple(map(int, input().split())) for _ in [0]*n], key=lambda x: sum(x)) dp = [10**10]*(n+1) dp[0] = 0 for c, (h, p) in enumerate(hp): for k in range(c, -1, -1): if dp[k] <= h: ...
s175988693
p03526
u218843509
1557987240
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38384
469
n = int(input()) men = [list(map(int, input().split())) for _ in range(n)] men.sort(key=lambda x: x[0]+x[1], x[0]) dp = [[0, 0] for _ in range(n+1)] for i in range(1, n+1): for j in range(i): if dp[j][0] <= men[i-1][0]: if dp[j][1]+1 == dp[i][1]: dp[i][0] = min(dp[i][0], dp[j][0] + men[i-1][1]) elif dp[j][...
s616230691
p03526
u482886586
1549759618
Python
Python (3.4.3)
py
Runtime Error
18
3192
1464
from functools import cmp_to_key class Boxes: def __init__(self,str,weight): self.str=str self.weight=weight def __repr__(self): return '({} , {})'.format(self.str,self.weight) def box_cmp(box_a,box_b): if(box_a.str+box_a.weight > box_b.str+box_b.weight): return -1 ...
s100933505
p03526
u482886586
1549759484
Python
Python (3.4.3)
py
Runtime Error
2104
5808
1465
from functools import cmp_to_key class Boxes: def __init__(self,str,weight): self.str=str self.weight=weight def __repr__(self): return '({} , {})'.format(self.str,self.weight) def box_cmp(box_a,box_b): if(box_a.str+box_a.weight > box_b.str+box_b.weight): return -1 ...
s832683819
p03526
u257374434
1511639735
Python
Python (3.4.3)
py
Runtime Error
17
3064
785
N = int(input()) HP= [list(map(int,input().split()))+[_index] for _index in range(N)] HP.sort() HP2 = list(HP) HP2.sort(key=lambda x:(x[1],x[0])) #if not HP[-1][0]+HP[-1][1] == max(h+p for h,p in HP): # raise def check(_res): """ >>> check([(9, 1), (0, 1)]) False :param _res: :return: """ ...
s951038180
p03526
u257374434
1511637336
Python
Python (3.4.3)
py
Runtime Error
2104
4340
781
N = int(input()) HP= [list(map(int,input().split())) for _ in range(N)] HP.sort() if not HP[-1][0]+HP[-1][1] == max(h+p for h,p in HP): raise def seach(n): max_kouho= [] max_val =-1 for i in range(N): if i in used: continue h,p= HP[i] tmp_val = min(n-p,h) ...
s893876960
p03527
u488401358
1592596277
Python
PyPy3 (7.3.0)
py
Runtime Error
209
100936
2657
def solveequation(edge,ans,n,m): #edge=[[to,dire,id]...] x=[0]*m used=[False]*n def dfs(v): used[v]=True r=ans[v] for to,dire,id in edge[v]: if used[to]: continue y=dfs(to) if dire==-1: x[id]=y else:...
s585879402
p03527
u488401358
1592595747
Python
PyPy3 (7.3.0)
py
Runtime Error
1950
1056808
2224
def solveequation(edge,ans,n,m): #edge=[[to,dire,id]...] x=[0]*m used=[False]*n def dfs(v): used[v]=True r=ans[v] for to,dire,id in edge[v]: if used[to]: continue y=dfs(to) if dire==-1: x[id]=y else:...
s432822954
p03527
u488401358
1592595081
Python
PyPy3 (7.3.0)
py
Runtime Error
1934
1056580
2215
def solveequation(edge,ans,n,m): #edge=[[to,dire,id]...] x=[0]*m used=[False]*n def dfs(v): used[v]=True r=ans[v] for to,dire,id in edge[v]: if used[to]: continue y=dfs(to) if dire==-1: x[id]=y else:...
s289005868
p03527
u488401358
1592594931
Python
PyPy3 (7.3.0)
py
Runtime Error
229
108484
2249
def solveequation(edge,ans,n,m): #edge=[[to,dire,id]...] x=[0]*m used=[False]*n def dfs(v): used[v]=True r=ans[v] for to,dire,id in edge[v]: if used[to]: continue y=dfs(to) if dire==-1: x[id]=y else:...
s500897198
p03528
u488401358
1597124809
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74540
1425
K=38 K=int(input()) N=K**2-K+1 print(N,K) _res=[[-1 for j in range(K-1)] for i in range((K-1)**2)] rest=[[-1 for j in range(K-1)] for i in range(K-1)] id=K start=0 while N>id: for j in range(K-1): _res[(K-1)*j+(start+j*((id-1)//(K-1)))%(K-1)][(id-1)//(K-1)-1]=id id+=1 start=(start+1)%(K-1) rest=[...
s225032618
p03533
u940743763
1588164242
Python
Python (3.4.3)
py
Runtime Error
17
2940
244
s = input().strip() t = 'AKIHABARA' ti = 0 result = True for i in range(len(s)): if s[i] == t[ti]: ti += 1 elif s[i] == 'A': continue else: result = False if result: print('YES') else: print('NO')
s982335498
p03533
u303039933
1583984315
Python
PyPy3 (2.4.0)
py
Runtime Error
180
38640
2281
# -*- coding: utf-8 -*- import sys import math import os import itertools import string import heapq import _collections from collections import Counter from collections import defaultdict from functools import lru_cache import bisect import re import queue class Scanner(): @staticmethod def int(): re...
s394016011
p03533
u702018889
1579381056
Python
Python (3.4.3)
py
Runtime Error
17
3064
403
s=str(input());a=["A","K","I","H","A","B","A","R"] if s=="AKIHABARA": print("YES") elif len(s)<5: print("NO") else: s=list(s) for i in range(len(a)): if s[i]!=a[i]: s.insert(i,"A") #print(s,a,i) if s==a or s==["A","K","I","H","A","B","A","R","A"]: print("YE...
s504851729
p03533
u644907318
1576325759
Python
Python (3.4.3)
py
Runtime Error
17
3064
312
D = ["A","B","H","I","K","R"] C = {a:0 for a in D} C = {"X":0} S = input().strip() for i in range(len(S)): if S[i] in D: C[S[i]] += 1 else: C["X"] += 1 if C["A"]<=4 and C["B"]==1 and C["H"]==1 and C["I"]==1 and C["K"]==1 and C["R"]==1 and C["X"]==0: print("YES") else: print("NO")
s258815584
p03533
u473291366
1568773696
Python
Python (3.4.3)
py
Runtime Error
17
3064
482
def main(): S = input() len_s = len(S) check = "AKIHABARA" idx = 0 len_check = len(check) i = 0 while i < len_s: s = S[i] if check[idx] == s: idx += 1 elif idx+1 < len_check and s == check[idx+1] and "A" == check[idx]: idx += 2 else: ...
s091536504
p03533
u584174687
1568558818
Python
PyPy3 (2.4.0)
py
Runtime Error
185
38636
674
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10 ** 5 + 10) # input = sys.stdin.readline from math import factorial import heapq, bisect import math import itertools import queue from collections import deque def main(): s = list(input()) t = list('AKIHABARA') ind = 0 ...
s373592383
p03533
u677523557
1566869569
Python
Python (3.4.3)
py
Runtime Error
17
3064
397
S = input() K = ['A', 'K', 'I', 'H', 'B', 'R'] ans = 'YES' p = 0 cont = False for s in S: if not s in K: ans = 'NO' elif s == 'A': if (p == 0 or p == 3 or p == 4 or p == 5) and not cont: cont = True else: ans = 'NO' elif s == K[p+1]: p += 1 c...
s461180891
p03533
u794173881
1566786601
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38384
272
goal = 'AKIHABARA' s = input() if s[-1] != "A": s += "A" i = 0 j = 0 while True: if j == len(goal): break if s[i] == goal[j]: i += 1 j += 1 elif s[i] != goal[j]: j += 1 if i == len(s): print("YES") else: print("NO")
s404228539
p03533
u163320134
1558754988
Python
Python (3.4.3)
py
Runtime Error
17
3060
220
s=input() ans=['KIHBR'] for i in range(1,16): flag=format(i,'b') tmp='A'*int(flag[0])+'KIH'+'A'*int(flag[1])+'B'+'A'*int(flag[2])+'R'+'A'*int(flag[3]) ans.append(tmp) if s in ans: print('YES') else: print('NO')
s987566160
p03533
u077337864
1555729093
Python
Python (3.4.3)
py
Runtime Error
18
3064
457
s = input().strip() i = 0 if s[i] == 'A': i += 1 if s[i] == 'K': i += 1 if s[i] == 'I': i += 1 if s[i] == 'H': i += 1 if s[i] == 'A': i += 1 if s[i] == 'B': i += 1 if s[i] == 'A': i += 1 if s[i] == 'R': i += 1 if i >= len(s):...
s490742840
p03533
u065446124
1554686689
Python
Python (3.4.3)
py
Runtime Error
22
3060
226
s=input() if(len(s)>9): print("NO") quit() i=0 for c in "AKIHABAR": if(s[i]==c): i+=1 else: if(c=="A"): continue else: print("NO") quit() print("YES")
s925420511
p03533
u426108351
1554686328
Python
Python (3.4.3)
py
Runtime Error
19
3188
524
S = input() Acount = 0 count = 0 AKIBA = ["K", "I", "H", "B", "R"] AKIBAcount = [1, 0, 0, 1, 1] flag = 1 for i in range(len(S)): if count == 5: if S[i] == "A": Acount += 1 if Acount >= 2: flag = 0 if S[i] == "A": Acount += 1 else: if S[i] == AKIBA[coun...
s122821664
p03533
u782685137
1554686029
Python
Python (3.4.3)
py
Runtime Error
17
3060
165
S=input() T='AKIHABARA' i=0;j=0 while 1: if S[i]==T[j]:i+=1;j+=1 elif 'A'==T[j]:j+=1 else:break if i>=len(S):break print('YES'if i==len(S) else 'NO')
s513378481
p03533
u620868411
1549751203
Python
Python (3.4.3)
py
Runtime Error
18
3060
259
# -*- coding: utf-8 -*- s = list(input()) res = "AKIHABARA" si = 0 ri = 0 while si<len(s): if s[si]==res[ri]: si += 1 ri += 1 elif res[ri]=="A" and s[si]!="A": ri += 1 else: print("NO") exit() print("YES")
s937816453
p03533
u375616706
1548977085
Python
Python (3.4.3)
py
Runtime Error
18
2940
231
s = input() ans="YES" if len(s)>9: ans="NO" else: a="KIHBR" kihbr="" for c in s: if c=="A": contine else: kihbr+=c if kihbr!=a: ans="NO" if not "KIH" in s: ans="NO" if "AA" in s: ans="NO" print(ans)
s538861782
p03533
u375616706
1548976696
Python
Python (3.4.3)
py
Runtime Error
18
3060
264
def factiring2(N,P): if N==1: ans=P else: ans=1 for i in range(2,int(P**0.5)+1): cnt=0 while P%i==0: P//=i cnt+=1 if cnt>=N: ans*=i**(cnt//N) return ans N, P = map(int, input().split()) ans=factiring2(N,P) print(ans)
s133487744
p03533
u375616706
1548976106
Python
Python (3.4.3)
py
Runtime Error
18
2940
273
s = input() l=['K','I','H','B','R'] i=0 ans="YES" seq=False for c in s: if i<len(l) and c=="A": if not seq: seq=True continue else: ans="NO" break else: seq=False if i<len(l) and c==l[i]: i+=1 else: ans="NO" break print(ans)
s906155765
p03533
u375616706
1548975893
Python
Python (3.4.3)
py
Runtime Error
18
2940
155
s = input() l=['K','I','H','B','R'] i=0 ans="YES" for c in s: if c=="A": continue else: if c==l[i]: i+=1 else: ans="NO" break print(ans)
s892174074
p03533
u329399746
1548732024
Python
Python (3.4.3)
py
Runtime Error
18
3060
304
st = [i for i in "AKIHABARA"] input_st = [i for i in input()] if input_st[-1] != "A": input_st.append("A") for ind,str_ in enumerate(st): if str_ != input_st[ind]: input_st.insert(ind,"A") else: pass if "".join(st) == "".join(input_st): print("YES") else: print("NO")
s235414750
p03533
u329399746
1548731922
Python
Python (3.4.3)
py
Runtime Error
18
2940
286
st = [i for i in "AKIHABARA"] input_st = [i for i in input()] if input_st[-1] != "A": input_st.append("A") for ind,str_ in enumerate(st): if str_ != input_st[ind]: input_st.insert(ind,"A") if "".join(st) == "".join(input_st): print("YES") else: print("NO")
s575039573
p03533
u226108478
1536253640
Python
Python (3.4.3)
py
Runtime Error
17
3060
378
# -*- coding: utf-8 -*- def main(): s = input() removed_a = s.replace('A', '') if 4 < len(s) < 10 and removed_a != 'KIHBR': print('NO') else: if s.index('K') <= 1 and (s.index('B') - s.index('H')) <= 1 and (len(s) - 1 - s.index('R')) <= 1: print('YES') else: ...
s752449897
p03533
u226108478
1536253305
Python
Python (3.4.3)
py
Runtime Error
19
3316
378
# -*- coding: utf-8 -*- def main(): s = input() removed_a = s.replace('A', '') if 5 < len(s) < 10 and removed_a != 'KIHBR': print('NO') else: if s.index('K') <= 1 and (s.index('B') - s.index('H')) <= 1 and (len(s) - 1 - s.index('R')) <= 1: print('YES') else: ...
s707021855
p03533
u729133443
1526356166
Python
Python (3.4.3)
py
Runtime Error
22
3188
65
import re;print(['NO','YES'][re.match('A?KIHA?BA?RA?$',input())])
s984969917
p03533
u261886891
1516763471
Python
Python (3.4.3)
py
Runtime Error
19
3064
369
import sys S = input() T = "AKIHABARA" posS = 0 posT = 0 while True: if posS == len(S) and posT >= len(T)-1: print("YES") sys.exit() if posT >= len(T): print("NO") sys.exit() if S[posS] == T[posT]: posS += 1 posT += 1 elif T[posT] == 'A': posT += 1...
s125589373
p03533
u261886891
1516762980
Python
Python (3.4.3)
py
Runtime Error
18
3064
365
import sys S = input() T = "AKIHABARA" pos = 0 for x in S: if pos >= len(T): print("NO") sys.exit() if x == T[pos]: pos += 1 elif T[pos] == 'A': pos += 1 if x == T[pos]: pos += 1 else: print("NO") sys.exit() else: ...
s212447694
p03533
u340781749
1511682236
Python
Python (3.4.3)
py
Runtime Error
17
2940
73
2import re print('Yes' if re.match('A?KIHA?BA?RA?', input()) else 'No')
s804706053
p03533
u174028570
1511660339
Python
Python (3.4.3)
py
Runtime Error
20
3316
124
import re s=input() regex=re.compile(r'(A)*KIB(A)*') if re.search(s): print('YES',end='') else: print('NO',end='')
s446292528
p03533
u174028570
1511659957
Python
Python (2.7.6)
py
Runtime Error
10
2568
128
import re s=input() regex=re.compile(r'(A)*KIB(A)*') if re.search(s): print('YES',end='') else: print('NO',end='')
s992113895
p03533
u271445511
1511639400
Python
Python (3.4.3)
py
Runtime Error
17
3064
942
# coding: utf-8 import sys try: inputline = list(input()) #1文字ずつ文字のリストに akihabara = list("AKIHABARA") lineLength = len(akihabara) - len(inputline) # 正解より文字数が多い、あるいは文字数が5文字以下のとき if lineLength < 0 or lineLength >= 5: sys.exit("NO") # 正解と文字数が同じとき elif lineLength == 0: if i...
s936580775
p03533
u271445511
1511637930
Python
Python (3.4.3)
py
Runtime Error
17
3064
995
# coding: utf-8 import sys try: inputline = list(input()) #1文字ずつ文字のリストに akihabara = list("AKIHABARA") lineLength = len(akihabara) - len(inputline) # 正解より文字数が多い、あるいは文字数が5文字以下のとき if lineLength < 0 or lineLength >= 5: print("NO") sys.exit() # 正解と文字数が同じとき elif lineLength ==...
s189299581
p03533
u638057737
1511637637
Python
Python (3.4.3)
py
Runtime Error
17
3064
488
S = input() if len(S) >= 9: print("NO") else: if S.count("A") > 4: print("NO") elif "KIH" not in S: print("NO") elif S.index("B") > S.index("R") or S.index("B") < S.index("K") or S.index("R") < S.index("K"): print("NO") elif S[:S.index("K")].count("A") > 1 or S[S.index("H"):...
s937184014
p03533
u471797506
1511637152
Python
PyPy2 (5.6.0)
py
Runtime Error
35
28012
395
inf = 1e18 N = int(raw_input()) HP = sorted(sorted([map(int, raw_input().split()) for i in xrange(N)]), key = lambda x:x[1]) dp =[inf] * 5005 for i in xrange(N): H, P = HP[i] for j in xrange(N + 1, -1, -1): if dp[j] < inf and dp[j] <= H: dp[j + 1] = min(dp[j + 1], dp[j] + P) dp[1] = mi...
s635593150
p03533
u271445511
1511636416
Python
Python (3.4.3)
py
Runtime Error
17
3064
827
# coding: utf-8 import sys inputline = list(input()) #1文字ずつ文字のリストに akihabara = list("AKIHABARA") lineLength = len(akihabara) - len(inputline) # 正解より文字数が多い、あるいは文字数が5文字以下のとき if lineLength < 0 or lineLength >= 5: print("NO") sys.exit() # 正解と文字数が同じとき elif lineLength == 0: if inputline == akihabara: pri...
s963077335
p03533
u271445511
1511635989
Python
Python (3.4.3)
py
Runtime Error
17
3064
766
# coding: utf-8 import sys inputline = list(input()) #1文字ずつ文字のリストに akihabara = list("AKIHABARA") lineLength = len(akihabara) - len(inputline) # 正解より文字数が多いとき if lineLength < 0: print("NO") sys.exit() # 正解と文字数が同じとき elif lineLength == 0: if inputline == akihabara: print("YES") sys.exit() e...
s585774534
p03533
u756988562
1511633751
Python
Python (3.4.3)
py
Runtime Error
17
3064
1020
import sys S = list(input()) #judge =1 if S[0] != "A": S.insert(0,"A") #if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] !="A": if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H": if len (S) == 4: S.insert(4,"A") elif S[4] != "A": S.insert(4,"A") else: ...
s803136861
p03533
u621935300
1511632992
Python
Python (2.7.6)
py
Runtime Error
10
2568
257
import sys S=list(raw_input()) if len(S)>10: print "NO" sys.exit() if S.index("K")+1!=S.index("I") or S.index("I")+1!=S.index("H"): print "NO" sys.exit() for i in S: if i=="A": S.remove("A") if ''.join(S)=="KIHBR": print "YES" else: print "NO"
s005129310
p03533
u756988562
1511632699
Python
Python (3.4.3)
py
Runtime Error
17
3064
888
S = list(input()) if S[0] != "A": S.insert(0,"A") #if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] !="A": if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H": if len (S) == 4: S.insert(4,"A") elif S[4] != "A": S.insert(4,"A") if S[0] =="A" and S[1] == "K...
s801665520
p03533
u756988562
1511632067
Python
Python (3.4.3)
py
Runtime Error
18
3188
637
S = list(input()) if S[0] != "A": S.insert(0,"A") if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] !="A": S.insert(4,"A") if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B" and S[6] !="A": S.insert(6,"A") if S[0] =="A" and S[1] == "K" and S[2] ...
s379311122
p03533
u756988562
1511631876
Python
Python (3.4.3)
py
Runtime Error
17
3064
592
S = list(input()) if S[0] != "A": S.insert(0,"A") if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H": S.insert(4,"A") if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4] =="A" and S[5] =="B": S.insert(6,"A") if S[0] =="A" and S[1] == "K" and S[2] == "I" and S[3] == "H" and S[4...
s377366772
p03533
u471797506
1511631280
Python
Python (2.7.6)
py
Runtime Error
11
2572
329
S = raw_input() if S.index("HA") == -1 and S.index("H") > 0: S = S.replace("H", "HA") if S.index("BA") == -1 and S.index("B") > 0: S = S.replace("B", "BA") if S.index("RA") == -1 and S.index("R") > 0: S = S.replace("R", "HA") if S[0] != "A": S = "A" + S if S == "AKIHABARA": print "YES" else: pri...
s905181924
p03534
u609814378
1594848074
Python
Python (3.8.2)
py
Runtime Error
29
9128
107
s = input() c = Counter(s) v = list(c.values()) if max(v) - min(v) > 1: print("NO") else: print("YES")
s658966294
p03534
u213580455
1590957501
Python
Python (3.4.3)
py
Runtime Error
18
3188
459
def answer(s): YES = 'YES' NO = 'NO' dic = collections.Counter(s) vals = sorted([v for k,v in dic.items()], reverse=True) if len(vals) == 1: return YES elif len(vals) == 2: if vals[0] == 1 and vals[1] == 1: return YES else: return NO _max = vals[0] _sum = sum(vals[1:...
s833888008
p03534
u213580455
1590799971
Python
PyPy3 (2.4.0)
py
Runtime Error
171
38448
442
import collections def answer(s): YES = 'YES' NO = 'NO' dic = collections.Counter(s) vals = sorted([v for k,v in dic.items()]) _max = vals[0] print(_max if _max < 2: return YES if len(keys) == 2: return NO if (_max-1)*2 > sum(vals[1:]): return YES if (_ma...
s771936914
p03534
u827202523
1584787676
Python
Python (3.4.3)
py
Runtime Error
17
2940
147
rom collections import Counter s = input().strip() c = Counter(s) v = list(c.values()) if max(v) - min(v) > 1: print("NO") else: print("YES")
s065249144
p03534
u113971909
1575317700
Python
Python (3.4.3)
py
Runtime Error
18
3188
457
S = input() if len(S)<=2: print("YES") else: ca = S.count("a") cb = S.count("b") cc = S.count("c") n = len(S)//3 ca2 = ca - n cb2 = cb - n cc2 = cc - n flg = [ca2,cb2,cc2] if flg.count(0)==3: print("YES") print(flg2,n,flg) elif flg.count(1)==1 and flg.count(0)==2: print("YES") elif f...
s438158658
p03534
u280512618
1554263237
Python
Python (3.4.3)
py
Runtime Error
27
3444
126
from collections import Counter c=sorted(Counter(input()).values()) print('YES' if c[0] == c[2] or c[0] + 1 == c[2] else 'NO')
s324817700
p03534
u729707098
1538076014
Python
Python (3.4.3)
py
Runtime Error
26
3572
199
from collections import Counter s = input() c,x = Counter(s).most_common(),len(s) if any(c[i][1]-x//3-1 for i in range(x%3)) or any(c[i][1]-x//3 for i in range(x%3,3)): print("NO") else: print("YES")
s561196744
p03534
u075012704
1532989975
Python
Python (3.4.3)
py
Runtime Error
17
3188
198
S = input() C = {"a": 0, "b": 0, "c": 0} for s in S: C["s"] += 1 if abs(C["a"] - C["b"]) <= 1 and abs(C["a"] - C["b"]) <= 1 and abs(C["a"] - C["b"]) <= 1: print("YES") else: print("NO")
s956795678
p03534
u858748695
1515614880
Python
Python (3.4.3)
py
Runtime Error
19
3240
582
#!/usr/bin/env python3 A, B = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) dp = [[0] * (B + 1) for _ in range(A + 1)] for i in range(A)[::-1]: dp[i][B] = dp[i + 1][B] + a[i] if (i + B) % 2 == 0 else dp[i + 1][B] for j in range(B)[::-1]: dp[A][j] = dp[A][j + ...
s605870926
p03534
u174028570
1511660317
Python
Python (3.4.3)
py
Runtime Error
17
3188
218
s=input() count=[0,0,0] for i in range(len(s)): count[(int)(s[i]-'a')]+=1 if abs(count[0]-count[1])<2 and abs(count[0]-count[2])<2 and abs(count[1]-count[2])<2: print('YES',end='') else: print('NO',end='')
s292543672
p03534
u756988562
1511644710
Python
Python (3.4.3)
py
Runtime Error
25
3444
239
import sys import collections S = input() count_dict = collections.Counter(S) Num_A = count_dict["a"] Num_B = count_dict["b"] Num_C = count_dict["c"] judge = sorted([a, b, c]) if judge[2]-judge[0]>1: print('NO') else: print('YES')
s802420243
p03534
u621935300
1511641848
Python
Python (2.7.6)
py
Runtime Error
30
3588
537
import sys S=list(raw_input()) x={} for i in S: if not i in x: x[i]=1 else: x[i]+=1 print x val=max([(v,k) for k,v in x.items()])[1] cnt=max(x.values()) if len(x.keys())<3: for i in x.keys(): if x[i]!=1: print "NO" sys.exit() if x["a"]==x["b"]==x["c"]: print "YES" sys.exit() if cnt%2!=0: cnt-=1 ...
s823522343
p03534
u756988562
1511637511
Python
Python (3.4.3)
py
Runtime Error
116
15552
1009
import collections import sys S = input() count_dict = collections.Counter(S) Num_A = count_dict["a"] Num_B = count_dict["b"] Num_C = count_dict["c"] s_list = {} if Num_A !=0: s_list[0] ="a" Num_A -=1 elif Num_B != 0: s_list[0] ="b" Num_B -= 1 elif Num_C != 0: s_list[0] ="c" Num_C -= 1 if Num_...
s677778531
p03535
u325227960
1583963748
Python
PyPy3 (2.4.0)
py
Runtime Error
339
48476
737
import sys input = sys.stdin.readline n = int(input()) D = list(map(int,input().split())) C = [0] * 13 C[0] = 1 for i in range(n): C[D[i]] += 1 if C[0] >= 2 or C[12] >=2: print(0) sys.exit() for i in range(n): if C[i] >= 3: print(0) sys.exit() D = [] for i in range(13): for j in ...
s138090050
p03535
u480806810
1549595630
Python
Python (3.4.3)
py
Runtime Error
17
2940
567
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int n; cin >> n; vector<int> c(25); c[0] = 1; for(int i = 0; i < n; i++){ int x; cin >> x; c[x]++; } c[24] = c[0]; int p = 0; for(int i = 1; i <= 11; i++){ if(c[i] >= 1){ c[24 - i] = (c[i] + 1 - p) / 2; c[i...
s576736598
p03535
u340781749
1511687745
Python
Python (3.4.3)
py
Runtime Error
25
3316
822
from collections import Counter from itertools import product, combinations def solve(n, ds): if n >= 24: return 0 freq = Counter(ds) if 0 in freq or freq[12] >= 2 or max(freq.values()) >= 3: return 0 cmp = set() alt = [] for d, l in freq.items(): if l == 2 or d == 12: ...
s767015395
p03535
u174028570
1511661994
Python
Python (3.4.3)
py
Runtime Error
18
3064
614
#include<stdio.h> #include<stdlib.h> int main() { int i, j; int n; int d[50]; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &d[i]); int check; // if check>0 => back is larger int nearest12[2] = { d[0],d[1] }; if (d[0] > d[1]) check = -1; else check = 1; for (i = 2; i < n; i++) { if (check==...
s255739347
p03535
u280667879
1511646440
Python
Python (2.7.6)
py
Runtime Error
2128
538500
227
n=input() a=map(int,raw_input().split()) r=0 for i in range(1<<n): b=[a[j]*((i>>j&1)*2-1)%24 for j in range(n)]+[0] s=24 for j in range(n): for k in range(j+1,n+1):s=min(s,(b[j]-b[k])%24,(b[k]-b[j])%24) r=max(r,s) print r
s487348578
p03535
u215207367
1511641777
Python
Python (2.7.6)
py
Runtime Error
18
2696
1434
# -*- coding:utf-8 -*- import sys DBG_FLAG = 0 def p_dbg(str): if(DBG_FLAG == 1): sys.stdout.flush() print str # 高橋君の都市とa,bの時差が # (1) 12を超えないとき(例えば、2時間、4時間)⇒加算。 # (1) 12を超えるとき (例えば、6時間、8時間)⇒減算して絶対値 def cal_diff(diff_a, diff_b): diff_a_24 = 24 - diff_a diff_b_24 = 24 - diff_b p_dbg("di...
s002216407
p03535
u586577600
1511640289
Python
Python (3.4.3)
py
Runtime Error
17
3064
494
s = input() n = {'a': 0, 'b': 0, 'c': 0} for c in s: n[c] += 1 import sys if len(s) == 1: print('YES') sys.exit(0) min = int(len(s)/3) val = list(n.values()) val.sort() if len(s)%3 == 0: if val == [min, min, min]: print('YES') else: print('NO') elif len(s)%3 == 1: if val == [mi...
s599779429
p03535
u925364229
1511639801
Python
Python (3.4.3)
py
Runtime Error
18
3064
422
N = int(input()) D = list(map(int,input().split(" "))) ans = D[:] D.sort() for i in range(N): if i % 2 == 0: D_1.append(24-D[i]) D_2.appned(D[i]) else: D_2.append(24-D[i]) D_1.appned(D[i]) for i in range(N): for j in range(i+1,N): df1 = abs(D_1[j] - D_1[i]) df2 = abs(D_2[j] - D_2[i]) df1 = min...
s597926226
p03543
u106804623
1601232255
Python
Python (3.8.2)
py
Runtime Error
25
8984
495
import bisect,collections,copy,heapq,itertools,math,string import sys def I(): # 1 line 1 int return int(sys.stdin.readline().rstrip()) def LI(): # 1 line n ints return list(map(int,sys.stdin.readline().rstrip().split())) def S(): # 1 line 1 string return sys.stdin.readline().rstrip() def LS(): ...
s809102144
p03543
u106804623
1601232102
Python
Python (3.8.2)
py
Runtime Error
27
8988
498
import bisect,collections,copy,heapq,itertools,math,string import sys def I(): # 1 line 1 int return int(sys.stdin.readline().rstrip()) def LI(): # 1 line n ints return list(map(int,sys.stdin.readline().rstrip().split())) def S(): # 1 line 1 string return sys.stdin.readline().rstrip() def LS(): ...
s244480655
p03543
u925353288
1601063835
Python
Python (3.8.2)
py
Runtime Error
24
9052
147
N = int(input()) if N[0] == N[1] and N[1] == N[2] : print('Yes') elif N[1] == N[2] and N[2] == N[3]: print('Yes') else: print('No')
s754740028
p03543
u153686508
1600059438
Python
Python (3.8.2)
py
Runtime Error
28
8780
85
S=input() if S[1]==S[2]==S[3] or S[2]==S[3]==S[4]: print("Yes") else: print("No")
s332195396
p03543
u011872685
1599947048
Python
Python (3.8.2)
py
Runtime Error
20
8856
125
#79 n=list(input()) if (n[0]n[1]n[2] or n[0]n[2]n[3] or n[0]n[1]n[3] or n[1]n[2]n[3]): print('Yes') else: print('No')
s636728492
p03543
u732061897
1599792396
Python
Python (3.8.2)
py
Runtime Error
23
8928
366
N = input() s1 = N[1:len(N)] s2 = N[0:len(N) - 1] isOk = True for i in range(1, len(N-1)): if s1[i] != s1[i - 1]: break isOk = False else: continue if isOk: print('Yes') isOk = True for i in range(1, len(N-1)): if s2[i] != s2[i - 1]: break else: continue if...