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
s533750610
p03523
u993622994
1568142243
Python
Python (3.4.3)
py
Runtime Error
18
3064
395
S = input() len_s = len(S) L = 'AKIHABARA' if S == L: print('YES') exit() if len_s > 9: print('NO') exit() S = [s for s in S] for i in range(9): if S[i] == L[i]: pass elif S[i] == L[i+1]: S.insert(i, 'A') else: print('NO') exit() if i == 7: S.ap...
s701501288
p03523
u644778646
1567874372
Python
Python (3.4.3)
py
Runtime Error
18
3064
1566
def main(): s = input() l = ["K", "I", "H", "B", "R"] for i in range(len(l)): if l[i] not in s: print("NO") if s.index("KIH") == -1: print("NO") exit() c = 0 ac = 0 for i in range(len(s)): if c == 0: if s[i] == "K": c ...
s453431453
p03523
u644778646
1567874347
Python
Python (3.4.3)
py
Runtime Error
27
3952
10043
from datetime import date from math import factorial import functools from heapq import* from collections import deque import collections import math from collections import defaultdict, Counter import sys sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 inf = float("inf") def make_divisors(n): divisors = [] ...
s505771815
p03523
u191874006
1566798127
Python
PyPy3 (2.4.0)
py
Runtime Error
165
38256
1534
#!/usr/bin/env python3 #CODE FESTIVAL 2017 Final A import sys import math import bisect sys.setrecursionlimit(1000000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collections import deque from operator impo...
s287143918
p03523
u077291787
1565435523
Python
Python (3.4.3)
py
Runtime Error
17
2940
198
# cf17-finalA - AKIBA def main(): S = input().rstrip() flg = S.replace("A", "") == "KIHBR" and "AA" not in S and "KA print("YES" if flg else "NO") if __name__ == "__main__": main()
s096999378
p03523
u282228874
1559090320
Python
Python (3.4.3)
py
Runtime Error
17
2940
329
s = input() if s == "KIHBR" or s == "AKIHBR" or s == "KIHABR" or s == "KIHBAR" or s == "KIHBRA" or s == "AKIHABR" or s == "AKIHBAR"or s == "AKIHBRA"or s == "KIHABAR"or s == "KIHABRA"or s == "KIHBARA"or s == "AKIHABAR"or s == "AKIHABRA"or s == "AKIHBARA"or s == "KIHABARA"or s == "AKIHABARA": print("YWS") else: p...
s464161557
p03523
u969190727
1558151679
Python
Python (3.4.3)
py
Runtime Error
17
2940
100
s=input() ss=s.replace("A","") print("YES" if ss="KIHBR" and "AA" not in s and "KIH" in s else "NO")
s769018811
p03523
u969190727
1558151572
Python
Python (3.4.3)
py
Runtime Error
18
2940
104
s=input() ss=s.replace.("A","") print("YES" if ss="KIHBR" and "AA" not in s and "KIH" in s else "NO")
s264924225
p03523
u263933075
1556560792
Python
Python (3.4.3)
py
Runtime Error
19
3188
90
import re p = 'A?KIHA?BA?RA?$' s = raw_input() print ['NO', 'YES'][re.match(p, s) != None]
s952401600
p03523
u426964396
1542655790
Python
Python (3.4.3)
py
Runtime Error
20
3188
90
import re p = 'A?KIHA?BA?RA?$' s = raw_input() print ['NO', 'YES'][re.match(p, s) != None]
s254954181
p03523
u476418095
1542655746
Python
Python (3.4.3)
py
Runtime Error
22
3188
82
import re p='A?KIHA?BA?RA?$' s=raw_input() print['NO', 'YES'][re.match(p,s)!=None]
s998863587
p03523
u201234972
1542381197
Python
Python (3.4.3)
py
Runtime Error
18
3064
366
S = input() T = "AKIHABARA" if S[-1] != "A": S += "A" l = len(S) t = 0 ans = "YES" K = "" c = 0 for i in range(9): if T[i] == S[t]: K += T[i] t += 1 continue elif T[i] == "A": K += "A" c += 1 continue else: ans = "NO" break if T == K and c...
s121437665
p03523
u099918199
1539230506
Python
Python (3.4.3)
py
Runtime Error
17
3064
499
s = str(s) list_ans.append("KIHBR") list_ans.append("AKIHBR") list_ans.append("KIHABR") list_ans.append("KIHBAR") list_ans.append("KIHBRA") list_ans.append("AKIHABR") list_ans.append("AKIHBAR") list_ans.append("AKIHBRA") list_ans.append("KIHABAR") list_ans.append("KIHABRA") list_ans.append("KIHBARA") list_ans.append("A...
s024507996
p03523
u816631826
1518381459
Python
Python (2.7.6)
py
Runtime Error
11
2568
73
import re print('YES' if re.search('^A?KIHA?BA?RA?$', input()) else 'NO')
s969937931
p03523
u369650048
1511636816
Python
Python (2.7.6)
py
Runtime Error
10
2568
1176
#include<cstdio> #include<cstring> #include<vector> #include<queue> #include<algorithm> #include<cmath> #include<climits> #include<string> #include<set> #include<map> #include<iostream> using namespace std; #define rep(i,n) for(int i=0;i<((int)(n));i++) #define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++) #define...
s703125758
p03523
u226155577
1511631514
Python
PyPy3 (2.4.0)
py
Runtime Error
162
38256
393
s = input() t = "AKIHABARA" idx = 0 ok = 1 for i in range(len(s)): if idx == len(t): ok = 0 break if s[i] == t[idx]: idx += 1 elif s[i] != 'A' and t[idx] == 'A': idx += 1 if s[i] == t[idx]: idx += 1 else: ok = 0 else: ok = 0...
s386450800
p03523
u257374434
1511631447
Python
Python (3.4.3)
py
Runtime Error
17
3060
279
S = input() if S[-1]!="A" or S[-1]=="R": print("NO") exit(0) i = 0 for s in "AKIHABARA": if S[i]==s: i+=1 continue elif s=="A": continue else: print("NO") exit() if i>=len(S)-1: print("YES") else: print("NO")
s775519181
p03523
u226155577
1511631382
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38640
347
s = input() t = "AKIHABARA" idx = 0 ok = 1 for i in range(len(s)): if s[i] == t[idx]: idx += 1 elif s[i] != 'A' and t[idx] == 'A': idx += 1 if s[i] == t[idx]: idx += 1 else: ok = 0 elif idx == len(t): ok = 0 break else: ok =...
s196853510
p03523
u536081558
1511631263
Python
Python (2.7.6)
py
Runtime Error
10
2572
207
s = 'AKIHABARA' t = raw_input() n = len(t) i = 0 j = 0 while i < n: if t[i] == s[j]: i += 1 j += 1 elif s[j] == 'A': j += 1 else: print 'NO' exit() if i == n: print 'YES' else: print 'NO'
s170511109
p03524
u626337957
1601391169
Python
PyPy3 (7.3.0)
py
Runtime Error
101
68792
164
S = int(input()) s_dict = {'a': 0, 'b': 0, 'c': 0} for s in S: s_dict[s] += 1 if max(s_dict.values())-min(s_dict.values()) > 1: print('NO') else: print('YES')
s565448549
p03524
u411858517
1599663904
Python
Python (3.8.2)
py
Runtime Error
101
9288
1469
s = input() dic = {} for i in range(len(s)): if s[i] in dic: dic[s[i]] += 1 else: dic[s[i]] = 1 if len(dic) == 1: if len(s) == 1: print('YES') else: print('No') elif len(dic) == 2: print('NO') else: first = 'a' second = 'b' for k, v in dic.items(): if v > dic[first]: secon...
s600775754
p03524
u583507988
1599577064
Python
Python (3.8.2)
py
Runtime Error
27
9048
502
n=len(s) set=set(s) m=len(set) a=s.count('a') b=s.count('b') c=s.count('c') if m==1: if n==1: print('YES') else: print('NO') elif m==2: if c==0: if a==b: print('YES') else: print('NO') elif b==0: if a==c: print('YES') else: print('NO') else: if b==c: p...
s256793466
p03524
u583507988
1599576780
Python
Python (3.8.2)
py
Runtime Error
23
8960
431
s=input() n=len(s) set=set(s) m=len(set) a=s.count('a') b=s.count('b') c=s.count('c') if m==1: if n==1: print('YES') else: print('NO') elif m==2: if (a==b or b==a+1 or a=b+1) or (c==b or b==c+1 or c=b+1) or (a==c or c==a+1 or a=c+1): print('YES') else: print('NO') else: d=n//m res=0 if a<=...
s323749139
p03524
u962330718
1596596694
Python
Python (3.8.2)
py
Runtime Error
29
9100
160
S=input() let=['a','b','c'] k=S.count('a') l=S.count('b') m=S.count('c') if abs(k-l)<=1 and abs(l-m)<=1 and abs(m-k)<=1: print('YES') else: pritn('NO')
s534116390
p03524
u370721525
1595436625
Python
Python (3.8.2)
py
Runtime Error
40
10048
449
from collections import Counter S = [i for i in str(input())] c = Counter(S) m = c.most_common() n = len(S) // 3 if len(S) % 3 == 0: if (m[0][1]==n) and (m[1][1]==n) and (m[2][1]==n): print('YES') else: print('NO') elif len(S) % 3 == 1: if (m[0][1]==n+1) and (m[1][1]==n) and (m[2][1]==n): print('YES'...
s516721064
p03524
u917013605
1594739095
Python
PyPy3 (7.3.0)
py
Runtime Error
96
74640
282
from collections import Counter S = input() counter = Counter(S) if len(counter) == 1: k = counter.keys()[0] if counter[k] > 1: print('NO') else: print('YES') elif len(counter) == 2: print('NO') else: # 通らない気がする print('YES')
s669749833
p03524
u366886346
1594563339
Python
Python (3.8.2)
py
Runtime Error
24
9004
205
s=list(input()) a=s.count("a") b=s.count("b") c=s.count("c") if min(a,b,c)!=0 and max(a,b,c)-min(a,b,c)<=1: print("YES") elif a+b+c=max(a,b,c) and max(a,b,c)==1: print("YES") else: print("NO")
s121643215
p03524
u442877951
1592636317
Python
Python (3.8.2)
py
Runtime Error
33
9544
263
from collections import Counter S = str(input()) CS = Counter(S) V = list(CS.values()) ans = 'YES' if V.count(0) == 2: ans = 'NO' elif V.count(0) <= 1: if V[0] >= 2*V[1]: ans = 'NO' else: if V[0] >= 2*V[1] and V[0] >= 6*V[2]: ans = 'NO' print(ans)
s557744091
p03524
u923270446
1592442259
Python
Python (3.4.3)
py
Runtime Error
17
2940
115
s=input() a,b,c=s.count("a"),s.count("b"),s.count("c") print("NO"ifabs(a-b)>1 or abs(a-c)>1 or abs(b-c)>1else"YES")
s301648647
p03524
u131881594
1592359643
Python
Python (3.4.3)
py
Runtime Error
26
3444
295
from collections import Counter s=Counter(input()) b,s=max(s.values()),min(s.values()) kind = len(s.keys()) if kind==3: if b-s<=1: print("YES") else: print("NO") elif kind==2: if b==2 and s==1: print("YES") else: print("NO") else: if b==1: print("YES") else: print("NO")
s960382022
p03524
u131881594
1592359615
Python
Python (3.4.3)
py
Runtime Error
26
3444
299
from collections import Counter s=Counter(input()) b,s=max(s.values()),min(s.values()) kind = len(s.keys()) if length==3: if b-s<=1: print("YES") else: print("NO") elif length==2: if b==2 and s==1: print("YES") else: print("NO") else: if b==1: print("YES") else: print("NO")
s519228296
p03524
u088552457
1591881335
Python
PyPy3 (2.4.0)
py
Runtime Error
285
67948
1408
import fractions import sys from functools import reduce import math input = sys.stdin.readline def main(): s = input_list() a_num = s.count('a') b_num = s.count('b') c_num = s.count('c') if abs(a_num - b_num) <= 1 and abs(b_num - c_num) <= 1 and abs(a_num - c_num) <= 1: print('YES') e...
s819047738
p03524
u493130708
1591819549
Python
PyPy3 (2.4.0)
py
Runtime Error
176
39408
3554
# -*- coding: utf-8 -*- ############# # Libraries # ############# import sys input = sys.stdin.readline import math #from math import gcd import bisect from collections import defaultdict from collections import deque from collections import Counter from functools import lru_cache ############# # Constants # #####...
s677302401
p03524
u185424824
1591383428
Python
Python (2.7.6)
py
Runtime Error
11
2820
152
S = input() a = S.count("a") b = S.count("b") c = S.count("c") if abs(a-b) <= 1 and abs(a-c) <= 1 and abs(b-c) <= 1: print("YES") else: print("NO")
s357391578
p03524
u888092736
1591013127
Python
Python (3.4.3)
py
Runtime Error
17
3188
375
s = input() K = int(input()) s_dic = {c: [] for c in "abcdefghijklmnopqrstuvwxyz"} for i, c in enumerate(s): s_dic[c].append(i) substrings = set() for lc in "abcdefghijklmnopqrstuvwxyz": for i in s_dic[lc]: for j in range(i + 1, len(s) + 1): substrings.add(s[i:j]) if len(substrings) >= K...
s238663521
p03524
u757117214
1588601025
Python
Python (3.4.3)
py
Runtime Error
18
2940
187
from collections import Counter c = Counter([*input()]) if len(c) <= 2: print("NO") else: dif = c.most_common()[0][1] - c.most_common()[2][1] print("YES" if dif<=1 else "NO")
s827295328
p03524
u524870111
1588595998
Python
Python (3.4.3)
py
Runtime Error
26
3564
423
#create date: 2020-05-04 08:36 import sys stdin = sys.stdin from collections import Counter def ns(): return stdin.readline().rstrip() def ni(): return int(ns()) def na(): return list(map(int, stdin.readline().split())) def main(): s = ns() n = len(s) //3 l = Counter(s).values() if l.count(n) + l.cou...
s758275022
p03524
u609061751
1588592903
Python
PyPy3 (2.4.0)
py
Runtime Error
167
39280
633
import sys input = sys.stdin.readline s = input().rstrip() from collections import Counter c = Counter(s) if n == 1: print("YES") sys.exit() if len(c.keys()) == 1: print("NO") sys.exit() values = list(c.values()) values.sort() if len(c.keys()) == 2: if values[0] == 1 and values[1] == 1: ...
s124879125
p03524
u309141201
1588448802
Python
Python (3.4.3)
py
Runtime Error
26
3444
312
import collections s = input() cnt = collections.Counter(s) cnt = cnt.most_common() # print(cnt) if len(s) == 1: print('YES') exit() if len(cnt) == 2: if len(s) == 2: print('YES') else: print('NO') exit() if cnt[1][1] > cnt[-1][1] + 1: print('NO') else: print('YES')
s567146678
p03524
u036492525
1587788279
Python
Python (3.4.3)
py
Runtime Error
17
2940
335
s=input() t = set(s) if len(s) ==1: print("YES") exit(0) elif len(s) == 1 && len(t) ==2: print("YES") exit(0) if len(t) != 3: print("NO") else: a = s.count("a") b = s.count("b") c = s.count("c") M = max(a,b,c) m = min(a,b,c) if M - m >1 : print("NO") else: ...
s767456976
p03524
u896741788
1587783241
Python
Python (3.4.3)
py
Runtime Error
27
4212
256
from collections import Counter as co s=input() n=len(s) l=sorted(co(list(s)).values()) if len(l)<=2: print("YES") if n==len(l) else print("NO") else: m=l[0] for i,v in l: if v-m<=1:continue print("NO");exit() print("YES")
s678657654
p03524
u293198424
1585950511
Python
PyPy3 (2.4.0)
py
Runtime Error
175
39408
478
from collections import Counter s = input() n = len(s) count = dict(Counter(s)) flag = False if n ==1: flag = True elif n <= 3: if max(count.values())!=2: flag = True elif n==4: if max(count.values())<=2: flag = True else: if count["a"]==count["b"] or count["b"]==count["c"] or count["c"...
s176521249
p03524
u293198424
1585950371
Python
PyPy3 (2.4.0)
py
Runtime Error
178
39664
481
from collections import Counter s = input() n = len(s) count = dict(Counter(s)) flag = False if n ==1: flag = True elif n <= 3: if max(count.values())!=2: flag = True elif n==4: if max(count.values())<=2: flag = True else: if count["a"]==count["b"] or count["b"]==count["c"] or count["c"...
s994186499
p03524
u312025627
1584156567
Python
PyPy3 (2.4.0)
py
Runtime Error
187
39280
425
def main(): S = input() N = len(S) from collections import Counter c = Counter(S) # print(c.most_common()) if N == 3 and c.most_common()[0][1] >= (N+1)//2: print("NO") elif c.most_common()[0][1] > (N+1)//2 or \ (c.most_common()[0][1] >= (N+1)//2 and c.most_common()[1][1] ...
s071861448
p03524
u724844363
1583263429
Python
Python (3.4.3)
py
Runtime Error
27
3956
410
s = list(str(input())) if len(s) == 1: print("YES") exit() # 1文字と2文字と3文字で場合分けしてみる jud = len(set(s)) jud_s = list(set(s)) count_0 = s.count(jud_s[0]) count_1 = s.count(jud_s[1]) count_2 = s.count(jud_s[2]) max_c = max(count_0, count_1, count_2) if abs(max_c -count_0) < 2 and abs(max_c - count_1) <2 and abs(max...
s639545705
p03524
u724844363
1583263324
Python
Python (3.4.3)
py
Runtime Error
19
3956
315
s = list(str(input())) if len(s) == 1: print("YES") exit() count_0 = s.count(jud_s[0]) count_1 = s.count(jud_s[1]) count_2 = s.count(jud_s[2]) max_c = max(count_0, count_1, count_2) if abs(max_c -count_0) < 2 and abs(max_c - count_1) <2 and abs(max_c -count_2) < 2: print("YES") else: print("NO")
s971972318
p03524
u762420987
1581113576
Python
PyPy3 (2.4.0)
py
Runtime Error
174
39408
287
S = input() from collections import Counter C = Counter(S) if len(C.keys()) == 1: if C.values()[0] >= 2: print("No") else: print("Yes") elif len(C.keys()) == 2: if sum(C.values()) < 3: print("Yes") else: print("No") else: print("Yes")
s853563374
p03524
u314050667
1578763512
Python
Python (3.4.3)
py
Runtime Error
34
4340
441
import collections as c import sys s = input() l = len(s) if l == 1: print("YES") else: S = c.Counter(list(map(str,s))) if len(S.key()) == 1: print("NO") sys.exit() elif len(S.keys()) == 2: if l == 2: print("YES") else: print("NO") sys.exit() cnt = set(list(S.values())) if len(cnt) == 3: prin...
s640764709
p03524
u314050667
1578763219
Python
Python (3.4.3)
py
Runtime Error
33
4340
389
import collections as c import sys s = input() l = len(s) if l == 1: print("NO") else: S = c.Counter(list(map(str,s))) if len(S.keys()) <= 2: if l == 2: print("YES") else: print("NO") sys.eixt() cnt = set(list(S.values())) if len(cnt) == 3: print("NO") elif len(cnt) == 2: a,b = cnt if abs(a-...
s058102223
p03524
u777283665
1575503179
Python
Python (3.4.3)
py
Runtime Error
45
3188
249
s = input() d = dict() for a in s: d[a] = d.get(a, 0) + 1 if len(d) == 2 and sum(d.values()) > 2: print("NO") exit() t = sorted([i - (min(d.values())) for i in d.values()]) if t[-1] - t[-2] > 1: print("NO") else: print("YES")
s451655954
p03524
u116233709
1573944212
Python
Python (3.4.3)
py
Runtime Error
17
3188
240
s=str(input()) ans=0 for i in range(1,len(s)-2): if s[i]==s[i+1]: ans+=1 break elif s[i]==s[i+2]: ans+=1 break else: ans+=0 if s[-2]==s[-1]: ans+=1 if ans==0: print("YES") else: print("NO")
s236171806
p03524
u941753895
1569903617
Python
Python (3.4.3)
py
Runtime Error
62
8020
1035
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): ...
s685536312
p03524
u941753895
1569903480
Python
Python (3.4.3)
py
Runtime Error
61
8016
1022
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): ...
s798499051
p03524
u118642796
1568924291
Python
PyPy3 (2.4.0)
py
Runtime Error
199
49392
142
S = list(input()) dic = {"a":0,"b":0,"c":0} for s in S: dic[s] += 1 if max(dic.value)<=min(dic.value)+1: print("YES") else: print("NO")
s066857244
p03524
u814986259
1567600887
Python
Python (3.4.3)
py
Runtime Error
37
3444
254
import collections S=input() dic=collections.defaultdict(int) for i in range(len(S)): dic[S[i]]+=1 smax=[0,d] for i in dic: if dic[i] > smax[0]: smax=[dic[i],i] if sum(dic.values()) - smax[0]>= smax[0] - 1: print("YES") else: print("NO")
s574742576
p03524
u619819312
1566705161
Python
Python (3.4.3)
py
Runtime Error
18
3188
101
s=input() a,b=s.count("a"),s.count("b"),s.count("c") print("NO" if max(a,b,c)-min(a,b,c)>1 else"YES")
s633956859
p03524
u619819312
1566705121
Python
PyPy3 (2.4.0)
py
Runtime Error
171
39024
101
s=input() a,b=s.count("a"),s.count("b"),s.count("c") print("NO" if max(a,b,c)-min(a,b,c)>1 else"YES")
s272393755
p03524
u480138356
1563987061
Python
Python (3.4.3)
py
Runtime Error
17
3064
397
import sys input = sys.stdin.redline def main(): s = input().strip() t = "abc" count = [0, 0, 0] for i in range(len(s)): for j in range(3): if s[i] == t[j]: count[j] += 1 m = min(count) jud = count[0] - m jud = max(jud, count[1] - m) jud = max(jud, count[2] - m) if jud <= 1: ...
s176753937
p03524
u052499405
1560318329
Python
Python (3.4.3)
py
Runtime Error
26
3444
162
from collections import Counter s = input().rstrip() cnt = Counter(s) a = list(cnt.values()) a.sort() if (a[2] - a[0]) > 1: print("NO") else: print("YES")
s444293895
p03524
u879870653
1558096980
Python
Python (3.4.3)
py
Runtime Error
20
3188
204
S=input() D={} for s in D : if s not in D : D[s] = 1 else : D[s] += 1 V = D.values() ma = max(V) mi = min(V) if ma - mi <= 1 : ans = "YES" else : ans = "NO" print(ans)
s791097574
p03524
u798129018
1558067633
Python
PyPy3 (2.4.0)
py
Runtime Error
170
39024
142
s = input() c = Counter(s) cnt = 0 a = list() for v in c.values(): a.append(v) if max(a)-min(a)>=2: print("NO") else: print("Yes")
s128305006
p03524
u698479721
1538769764
Python
Python (3.4.3)
py
Runtime Error
40
3188
195
s = input() a=0 b=0 c=0 for charas in s: if charas=='a': a += 1 elif charas == 'b': b += 1 else: c += 1 if max(a,b,c)-min(a,b,c)<= 1: print('YES') else: primt('NO')
s435822404
p03525
u816587940
1601440879
Python
PyPy3 (7.3.0)
py
Runtime Error
92
68464
814
def ans_is_zero(): print(0) exit(0) def solve(): n=int(input()) if n > 23: ans_is_zero() d=list(map(int,input().split())) for num in d: if num == 0: ans_is_zero() ans=0 N = 1 << n for i in range(N):#left or right t=1 for j in range(n): if (i>>...
s368014403
p03525
u169138653
1601432828
Python
PyPy3 (7.3.0)
py
Runtime Error
2207
68720
433
n=int(input()) d=[0]+list(map(int,input().split())) if n>=25: print(0) else: ans=0 for i in range(2**(n+1)): time=[] for j in range(n+1): if (i>>j)&1: time.append(d[j]) else: time.append((24-d[j])%24) time.sort() mini=10...
s184430267
p03525
u367701763
1599857905
Python
PyPy3 (7.3.0)
py
Runtime Error
99
68592
409
from itertools import product from collections import Counter N=int(input()) D=list(map(int, input().split())) print(list(sorted(D))) res=0 c=Counter(D).values() if c[0]>0 or max(c)>2:print(0);exit() if N>13:print(1);exit() for b in product(*((d,24-d) for d in D)): d0, m= 0,1<<30 for d in sorted(b): m=m...
s516534234
p03525
u397384480
1599293420
Python
PyPy3 (7.3.0)
py
Runtime Error
113
79780
986
import bisect import collections import copy import functools import heapq import math import sys from collections import deque from collections import defaultdict from fractions import Fraction input = sys.stdin.readline sys.setrecursionlimit(10**9) INF = float("inf") MOD = 10**9+7 N = int(input()) A = list(map(int,i...
s023617941
p03525
u222668979
1597873073
Python
PyPy3 (7.3.0)
py
Runtime Error
86
68640
327
n = int(input()) d = sorted(list(map(int, input().split())) + [0]) bit, cnt = [0] * 24, 1 for num in d: bit[(num - 12) * cnt + 12] += 1 cnt *= -1 if any(i > 1 for i in bit): print(0) exit() ans = [i for i, li in enumerate(bit * 2) if li == 1] s = min(ans[i] - ans[i - 1] for i in range(1, len(ans))) pr...
s594074067
p03525
u493520238
1597707240
Python
PyPy3 (7.3.0)
py
Runtime Error
93
74612
2051
from itertools import product import random def solve(n,dl): # n = int(input()) # dl = list(map(int, input().split())) if 0 in dl: return 0 doubles = [] dl1 = [] dl2 = [] for i in range(1,13): i_cnt = dl.count(i) if i_cnt > 2: return 0 elif i_cn...
s148101193
p03525
u493520238
1597705735
Python
Python (3.8.2)
py
Runtime Error
120
27232
725
from itertools import product import numpy as np n = int(input()) dl = list(map(int, input().split())) if 0 in dl: print(0) exit() doubles = [] dl1 = [] dl2 = [] for i in range(1,13): i_cnt = dl.count(i) if i_cnt > 2: print(0) exit() elif i_cnt == 2: dl2.append(24-i) ...
s855863102
p03525
u493520238
1597705673
Python
PyPy3 (7.3.0)
py
Runtime Error
95
74348
725
from itertools import product import numpy as np n = int(input()) dl = list(map(int, input().split())) if 0 in dl: print(0) exit() doubles = [] dl1 = [] dl2 = [] for i in range(1,13): i_cnt = dl.count(i) if i_cnt > 2: print(0) exit() elif i_cnt == 2: dl2.append(24-i) ...
s171570568
p03525
u941753895
1597061617
Python
PyPy3 (7.3.0)
py
Runtime Error
136
72748
995
# https://atcoder.jp/contests/tenka1-2014-qualb/tasks/tenka1_2014_qualB_b import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy sys.setrecursionlimit(10**7) inf=10**20 mod=10**9+7 dd=[(-1,0),(0,1),(1,0),(0,-1)] ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)] def LI(): return [int(x) for ...
s296960507
p03525
u028973125
1595706687
Python
Python (3.8.2)
py
Runtime Error
56
9276
1199
import sys N = int(sys.stdin.readline()) D = list(map(int, sys.stdin.readline().split())) times = [0] * 24 for d in D: times[d] += 1 if max(times) > 2 or times[0] == 2 or times[12] == 2: print(0) else: ans = 0 # 1 - 11時間の時差の場合、Diと24 - Diの両方を試す for i in range(2**11): positions = [] ...
s884278108
p03525
u028973125
1595706115
Python
Python (3.8.2)
py
Runtime Error
54
9256
1085
import sys N = int(sys.stdin.readline()) D = list(map(int, sys.stdin.readline().split())) times = [0] * 24 for d in D: times[d] += 1 if max(times) > 2 or times[0] == 2 or times[12] == 2: print(0) else: ans = 0 # 1 - 11時間の時差の場合、Diと24 - Diの両方を試す for i in range(2**11): positions = [] ...
s700708794
p03525
u244203620
1592431988
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38748
699
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<stdint.h> #include<tgmath.h> #include<stdbool.h> #include<sys/queue.h> #include<time.h> #define ll long long #define min(a, b) ((a) > (b) ? (b) : (a)) #define max(a, b) ((a) > (b) ? (a) : (b)) int cmp(const int *a, const int *b){return *a - *b;} int n, d...
s801381125
p03525
u545368057
1591966783
Python
Python (3.4.3)
py
Runtime Error
18
3064
865
n = int(input()) ds = list(map(int, input().split())) from collections import defaultdict d = defaultdict(int) d[0] = 1 for d_ in ds: d[d_] += 1 if d_ == 12 and d[d_] == 2: print(0) exit() elif d_ == 0 and d[d_] == 2: print(0) exit() elif d[d_] == 3: print(0) ...
s377798407
p03525
u545368057
1591966769
Python
Python (3.4.3)
py
Runtime Error
21
3316
866
n = int(input()) ds = list(map(int, input().split())) from collections import defaultdict d = defaultdict(int) d[0] = 1 for d_ in ds: d[d_] += 1 if d_ == 12 and d[d_] == 2: print(0) exit() elif d_ == 0 and d[d_] == 2: print(0) exit() elif d[d_] == 3: print(0) ...
s511587693
p03525
u698176039
1589681784
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38384
889
N = int(input()) D = list(map(int,input().split())) T = [0]*13 T[0] = 1 for d in D: T[d] += 1 Times = [0]*24 ones =[] for i,t in enumerate(T): if t>=3 or t==2 and (i==0 or i==12): print(0) exit() elif t==2: Times[i] = 1 Times[24-i] = 1 elif t==1: ones.append(i)...
s732317893
p03525
u884692162
1587231666
Python
Python (3.4.3)
py
Runtime Error
22
3188
1189
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() D = lr() l = {i: 0 for i in range(13)} for d in D: l[d] += 1 possible_lists = [[]] for k, v in l.items(): if v > 2: possible_lists = [0] break elif v > 1: ...
s752872494
p03525
u690536347
1586153518
Python
Python (3.4.3)
py
Runtime Error
33
3316
835
from itertools import product, combinations from collections import Counter def solve(): N = int(input()) *D, = map(int, input().split()) l, m = [], [] for i, j in Counter(D).items(): if j>=3 or (i==12 and j>=2) or i==0: print(0) return elif j==2: l...
s317812647
p03525
u690536347
1586153468
Python
Python (3.4.3)
py
Runtime Error
33
3316
816
from itertools import product, combinations from collections import Counter def solve(): N = int(input()) *D, = map(int, input().split()) l, m = [], [] for i, j in Counter(D).items(): if j>=3 or (i==12 and j>=2) or i==0: print(0) elif j==2: l += [i] eli...
s677466861
p03525
u690536347
1586147961
Python
Python (3.4.3)
py
Runtime Error
28
3316
936
from itertools import product from collections import Counter def solve(): N = int(input()) *D, = map(int, input().split()) if N==1: print(D[0]) return else: l, m = [], [] for i, j in Counter(D).items(): if j>=3 or ((i==0 or i==12) and j>=2): ...
s239956927
p03525
u476604182
1585082663
Python
Python (3.4.3)
py
Runtime Error
18
3192
1330
N, *D = map(int, open('0').read().split()) D.append(0) used = [0]*(N+1) cnt = N while True: ls = [] for i in range(N+1): for j in range(N+1): if i==j: continue a,b = min(D[i],D[j]),max(D[i],D[j]) d = b-a ls.append((min(d,24-d),i,j)) ls.sort(key=lambda x:x[0]) d,a,b = ls[0] ...
s306589728
p03525
u312025627
1584644160
Python
PyPy3 (2.4.0)
py
Runtime Error
198
41584
1022
def main(): _ = int(input()) D = [int(i) for i in input().split()] ans = 0 cnt = [0]*24 from collections import Counter c = Counter(D) cnt[0] = 1 s = [0]*13 for k, v in c.items(): if v >= 3: ans = 0 return print(ans) elif v >= 2: cn...
s135675568
p03525
u969190727
1580344442
Python
Python (3.4.3)
py
Runtime Error
2104
3064
350
n=int(input()) D=[int(i) for i in input().split()] if n>=24: print(0) else: ans=0 for i in range(2**(n-1)): C=[0,D[0],24] for j in range(n-1): if i&(1<<j): C.append(24-D[j+1]) else: C.append(D[j+1]) C.sort() cur=24 for j in range(n): cur=min(cur,C[j+1]-C[j]) ...
s310259026
p03525
u297007413
1580227800
Python
Python (3.4.3)
py
Runtime Error
17
2940
3579
#include <iostream> #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep_r(i, n) for (int i = n - 1; i >= 0; i--) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) #define REP(i, n) for (int i = 0, ...
s409278190
p03525
u905582793
1579057176
Python
Python (3.4.3)
py
Runtime Error
17
3064
415
n=int(input()) d=list(map(int,input().split())) d.sort() time=[0]*24 time[0]=1 if n==0: print(0) exit() for i in range(n): if i%2: time[d[i]]+=1 else: time[24-d[i]]+=1 if max(time)>1: print(0) exit() flg=0 ans=0 cnt=0 for i in range(25): i=i%24 if time[i]==0 and not flg: flg=1 cnt=1 el...
s626628606
p03525
u520276780
1578015044
Python
PyPy3 (2.4.0)
py
Runtime Error
184
38512
1143
#n>=25なら鳩ノ巣で0 #2人以上居るdは一意 #あとはしらみつぶし n = int(input()) if n>=25: print(0) exit() d = list(map(int, input().split( ))) if 0 in d:## print(0) exit() d.append(0) dic = {} for di in d: if di in dic: dic[di] += 1 else: dic[di]= 1 solo = [] times = [] for di in dic: if dic[di]==1...
s242670518
p03525
u520276780
1578014972
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38640
1147
#n>=25なら鳩ノ巣で0 #2人以上居るdは一意 #あとはしらみつぶし n = int(input()) if n>=25: print(0) exit() d = list(map(int, input().split( ))) if 0 in d:## print(0) exit() d.append(0) dic = {} for di in d: if di in dic: dic[di] += 1 else: dic[di]= 1 solo = [] times = [] for di in dic: if dic[di]==1...
s982673742
p03525
u520276780
1578014611
Python
PyPy3 (2.4.0)
py
Runtime Error
187
40688
1063
#n>=25なら鳩ノ巣で0 #2人以上居るdは一意 #あとはしらみつぶし n = int(input()) if n>=25: print(0) exit() d = list(map(int, input().split( ))) if 0 in d:## print(0) exit() d.append(0) dic = {} for di in d: if di in dic: dic[di] += 1 else: dic[di]= 1 solo = [] times = [] for di in dic: if dic[di]==1...
s594248579
p03525
u520276780
1577153372
Python
PyPy3 (2.4.0)
py
Runtime Error
190
40688
1090
#n>=25なら鳩ノ巣で0 #2人以上居るdは一意 #あとはしらみつぶし #周期性考慮せよ n = int(input()) if n>=25: print(0) exit() d = list(map(int, input().split( ))) if 0 in d:## print(0) exit() d.append(0) dic = {} for di in d: if di in dic: dic[di] += 1 else: dic[di]= 1 solo = [] times = [] for di in dic: if di...
s129726519
p03525
u520276780
1577153026
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38384
1014
#n>=25なら鳩ノ巣で0 #2人以上居るdは一意 #あとはしらみつぶし n = int(input()) if n>=25: print(0) exit() d = list(map(int, input().split( ))) if 0 in d:## print(0) exit() d.append(0) dic = {} for di in d: if di in dic: dic[di] += 1 else: dic[di]= 1 solo = [] times = [] for di in dic: if dic[di]==1...
s041709913
p03525
u520276780
1577152905
Python
PyPy3 (2.4.0)
py
Runtime Error
178
38384
1017
#n>=25なら鳩ノ巣で0 #2人以上居るdは一意 #あとはしらみつぶし n = int(input()) if n>=25: print(0) exit() d = list(map(int, input().split( ))) if 0 in d:## print(0) exit() d.append(0) dic = {} for di in d: if di in dic: dic[di] += 1 else: dic[di]= 1 solo = [] times = [] for di in dic: if dic[di]==1...
s849295377
p03525
u440566786
1576574774
Python
PyPy3 (2.4.0)
py
Runtime Error
176
42224
451
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda:sys.stdin.readline().rstrip() def resolve(): n=int(input()) D=[int(input()) for _ in range(n)] V=100000 dp=[0]*(V+1) for d in D: dp[d]+=1 for j in range(3): for i in range(V): dp[...
s391213924
p03525
u638795007
1576293460
Python
PyPy3 (2.4.0)
py
Runtime Error
182
38512
1701
def examC(): N = I(); D = LI() ans = -1 d = defaultdict(int); d[0] +=1 choice = [0]*13; choice[0] +=1 for i in D: choice[i] +=1 if choice[i]>2: ans = 0 break if choice[0]>=2 or choice[12]>=2: ans = 0 # print(choice) curT = [0]; cur = [] ...
s915036711
p03525
u223646582
1575846142
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38384
521
import numpy as np import collections N = int(input()) D = [int(i) for i in input().split()]+[0, 24] C = collections.Counter(D) if C.most_common()[0][1] >= 3: print(0) exit() ans = 0 for i in range(2 ** N): D0 = D for j in range(N): # このループが一番のポイント if ((i >> j) & 1): # 順に右にシフトさせ最下位bitのチェックを...
s748283369
p03525
u141610915
1572411377
Python
PyPy3 (2.4.0)
py
Runtime Error
206
42076
652
import sys import heapq input = sys.stdin.readline N = int(input()) d = list(map(int, input().split())) rres = 0 if N == 1: print(d[1]) exit(0) for t in range(13): res = True q = sorted(d) heapq.heapify(q) l = [0, 24] i = 0 c = 0 while len(q) and c < 2 * N ** 2: p = heapq.heappop(q) if abs(p -...
s037951550
p03525
u141610915
1572409707
Python
PyPy3 (2.4.0)
py
Runtime Error
175
39408
673
import sys input = sys.stdin.readline N = int(input()) d = [0] + list(map(int, input().split())) rres = 0 if N == 1: print(d[1]) exit(0) for t in range(13): res = True l = sorted(d) nl = sorted(d) for _ in range(N + 1): l.sort() for i in range(N): if abs(l[i] - l[i + 1]) < t: nl.append...
s940904232
p03525
u223904637
1572111695
Python
Python (3.4.3)
py
Runtime Error
2126
358240
535
n=int(input()) d=list(map(int,input().split())) if n>=24: print(0) exit() op=[[0],[1]] for i in range(n-1): tmp=[] for j in op: tmp.append(j+[0]) tmp.append(j+[1]) op=tmp ans=0 for i in op: t=[0] for j in range(n): if i[j]==0: t.append(d[i]) else: ...
s316166558
p03525
u923279197
1571775483
Python
Python (3.4.3)
py
Runtime Error
21
3316
801
from collections import Counter n = int(input()) d = list(map(int,input().split())) + [0] data = Counter(d).most_common() if data[0][1] >= 3: print(0) exit() ans = 0 #print(data) for bit in range(2**11): this_time = [] for x,c in data: if c == 2: if x == 0 or x == 12: ...
s596946734
p03525
u600402037
1571377932
Python
Python (3.4.3)
py
Runtime Error
17
3064
717
import numpy as np N = int(input()) D = list(map(int, input().split())) if N > 23: print(0) exit() for i in range(13): if D.count(i) >= 3: print(0) exit() for i in range(13) elif D.count(i) == 2 and D.count(i+1) >= 1: print(1) exit() # 深さ優先探索で全通りを探索できるのでは curは0からスタート de...