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
s247576589
p03687
u761989513
1539376434
Python
Python (3.4.3)
py
Runtime Error
25
3444
663
import collections s = input() c = collections.Counter(s).most_common() m = c[0][1] maxi = 0 if m == 1: print(len(s) // 2) else: for k in c: if k[1] == m and k[0] != s[0]: index = [i for i, x in enumerate(s) if x == k[0]] sa = [index[i + 1] - index[i] for i in range(m - 1)] ...
s068132874
p03687
u536113865
1535597265
Python
Python (3.4.3)
py
Runtime Error
22
3316
436
from collections import Counter s = input() n = 0 ans = 10**10 while n<len(s) and Counter(s).most_common()[n][1]==Counter(s).most_common()[0][1]: k = Counter(s).most_common()[n][0] l = [i if i == k else 0 for i in s] a = 0 while l.count(k)!=len(l): for i in range(len(l)-1): if l[i]==...
s233716927
p03687
u631277801
1535023804
Python
Python (3.4.3)
py
Runtime Error
46
3316
684
from collections import Counter s = input() cnt = Counter(s) if len(cnt.keys()) == 1: print(0) else: al_set = set(s) c = list(s) dic = {} for alpha in al_set: c_prev = [ci for ci in c] count = 0 while any([ci != alpha for ci in c_prev]): c_new = [] ...
s702728086
p03687
u582577761
1501775367
Python
Python (3.4.3)
py
Runtime Error
18
3064
585
n,a,b,ax,bx=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0],0,0 na,nb=a,b for i in range(n): a[n]^=a[i] b[n]^=b[i] a,b=sorted(a),sorted(b) if sum([a[i]!=b[i] for i in range(n+1)]): print("-1") exit() mp=dict() ax,bx=0,0 f=[i for i in range(n+1)] def find(x): if f[x]==x: return ...
s720982567
p03687
u676264453
1501199142
Python
Python (3.4.3)
py
Runtime Error
18
2940
225
S = str(input()) c = 0 ma = 0 for i in S: c = 0 for k,j in enumerate(S): if ( k != 0 and k != len(S) and j != i and S[k-1] != a and S[k+1] != a): c += 1 ma = min(ma, c) print(ma)
s700341936
p03687
u676264453
1501199075
Python
Python (3.4.3)
py
Runtime Error
17
2940
213
S = str(input()) c = 0 ma = 0 for i in S: c = 0 for k,j in enumerate(S): if ( k != 0 and k != N-1 and j != i and S[k-1] != a and S[k+1] != a): c += 1 ma = min(ma, c) print(ma)
s520588623
p03687
u817328209
1498808176
Python
Python (3.4.3)
py
Runtime Error
18
3060
130
S = input() chars = set(S) ans = len(S) for c in chas : m = max(len(_) for _ in S.split(c)) ans = min(ans, m) print(ans)
s238955231
p03687
u817328209
1498807854
Python
Python (3.4.3)
py
Runtime Error
17
2940
173
S = input() for c in string.lowercase : if c not in S : continue X = S.split(c) ans = 0 for str in X : ans = max(ans, len(str)) print(ans)
s333673249
p03687
u177481830
1498014066
Python
Python (3.4.3)
py
Runtime Error
17
2940
172
s=input() #s="whbrjpjyhsrywlqjxdbrbaomnw" minCost=len(s) for char in char_set: m=max([len(_) for _ in s.split(char)]) if m<minCost: minCost=m print(minCost)
s171891469
p03687
u865604924
1498000335
Python
Python (3.4.3)
py
Runtime Error
17
3060
256
# _*_ coding:utf-8 _*_ import sys input = sys.stdin.readline().replace('\n','') ans = 1000 for c in input: s = input.split(f'{c}') ma = 0 for i in range(len(s)): if ma < len(s[i]): ma = len(s[i]) if ans > ma: ans = ma print(ans,end='')
s306618444
p03687
u865604924
1497999932
Python
Python (3.4.3)
py
Runtime Error
18
2940
232
# _*_ coding:utf-8 _*_ import sys input = sys.stdin.readline() ans = 1000 for c in input: s = input.split(f'{c}') ma = 0 for i in range(len(s)): if ma < len(s[i]): ma = len(s[i]) if ans > ma: ans = ma print(ans)
s373369620
p03687
u865604924
1497999509
Python
Python (3.4.3)
py
Runtime Error
18
2940
237
# _*_ coding:utf-8 _*_ import sys input = sys.stdin.readline() ans = 1000 for c in input: s = input.split(f'{c}') max = 0 for i in range(len(s)): if max < len(s[i]): max = len(s[i]) if ans > max: ans = max print(ans)
s785255850
p03687
u455591217
1497839537
Python
Python (3.4.3)
py
Runtime Error
17
3188
853
import sys def judgeUpper(ansList, var): for a in ansList: if int(a) > var: # print(a + ':' + str(var) + str(True)) return True return False def judgeEqual(ansList, var, N): count = ansList.count(str(var)) # print(str(count) + ':' + str(N-1) + str(count < N - 1)) re...
s740765948
p03687
u213431796
1497838645
Python
Python (3.4.3)
py
Runtime Error
21
3188
446
s = input() counter = {} new_s = s for i in range(len(s) - 1): if not s[i] in counter.keys(): counter[s[i]] = 1 else: counter[s[i]] += 1 m = max([(v,k) for k,v in counter.items()])[1] count = 0 while True: if new_s.count(m) == len(new_s): break new_s = "" for i in range(len(s) - 1): if s[i] == m: ...
s508456482
p03687
u794543767
1497838316
Python
Python (3.4.3)
py
Runtime Error
24
3064
399
a = input() for target in set(s): s = a j = 0 min = 10000 while(1): if len(set(s)) == 1: break new_s = "" for i in range(len(s)-1): if s[i] == target or s[i+1] == target: new_s +=target else: new_s += ...
s267950894
p03687
u520409849
1497837390
Python
Python (3.4.3)
py
Runtime Error
17
3064
842
# -*- coding:utf-8 -*- def main(): s = input() d = {} poyo = '' cnt = 0 c = '' for i in s: d[i] = 0 for i in s: d[i] += 1 for i in s: cnt = max(cnt, d[i]) for i in s: if d[i] == cnt: poyo += i if cnt == 1: c = s[int(len(...
s682274516
p03687
u794543767
1497837318
Python
Python (3.4.3)
py
Runtime Error
20
3316
352
from collections import Counter s = raw_input() counter = Counter(s) target = counter.most_common()[0][0] j = 0 while(1): if len(set(s)) == 1: break new_s = "" for i in range(len(s)-1): if s[i] == target or s[i+1] == target: new_s +=target else: new_s += s[i] ...
s851224787
p03687
u820351940
1497835792
Python
Python (3.4.3)
py
Runtime Error
37
3064
420
s = input() def resolve(target): depth = 0 now = s while len(set(now)) > 1: result = list(now[:-1]) for i, x in enumerate(now[:-1]): result[i] = now[i + 1] if now[i + 1] == target else now[i] now = "".join(result) depth += 1 return "".join(result), depth pr...
s197902768
p03688
u197457087
1594350568
Python
PyPy3 (7.3.0)
py
Runtime Error
2283
2963176
1312
import sys sys.setrecursionlimit(500000) def dfs(A): #if sum(A) > M: # return if len(A) == N-1: temp = M-sum(A) if A[-1] <= temp: A.append(temp) B.append(list(A)) #listとしないとAppendできない。 A.pop() return if len(A) >= 1: #数列がある場合には最後の数字を取得し、そこから追加のFor loopを回す。 t = A[-1] else: ...
s620727474
p03688
u197457087
1594350530
Python
PyPy3 (7.3.0)
py
Runtime Error
2215
234332
1269
def dfs(A): #if sum(A) > M: # return if len(A) == N-1: temp = M-sum(A) if A[-1] <= temp: A.append(temp) B.append(list(A)) #listとしないとAppendできない。 A.pop() return if len(A) >= 1: #数列がある場合には最後の数字を取得し、そこから追加のFor loopを回す。 t = A[-1] else: t = 1 for i in range(t,M): A.appen...
s323673312
p03688
u227082700
1594344263
Python
Python (3.8.2)
py
Runtime Error
59
20892
303
yes="Yes" no="No" n=int(input()) a=list(map(int,input().split())) if max(a)-min(a)>1:exit(print(no)) if a==[a[0]]*n: if a[0]==n-1:print(yes) elif 2*a[0]<=n:print(yes) else:print(no) else: mi=a.count(min(a)) ma=n-mi if mi<max(a):print(yes) elif 2*(max(a)-mi)<=y:print(yes) else:print(no)
s602807401
p03688
u102461423
1592679924
Python
Python (3.8.2)
py
Runtime Error
54
18464
485
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) A = sorted(map(int, readline().split())) def main(A): N = len(A) if A[0] == A[-1]: raise x = A[0] return x == N - 1 or 2 * x <= N if A[0] + 1 != ...
s290393392
p03688
u392319141
1589230544
Python
Python (3.4.3)
py
Runtime Error
53
22636
348
from collections import Counter N = int(input()) A = Counter(map(int, input().split())) if len(A.keys()) >= 3: print('No') exit() if len(A.keys()) == 1: p = list(A.keys())[0] print('Yes' if 2 * p <= N or p == N - 1 else 'No') exit() p1, p2 = sorted(A.keys()) 1 / 0 print('Yes' if [p1, p2] == [1, ...
s998395184
p03688
u392319141
1589230080
Python
Python (3.4.3)
py
Runtime Error
53
22636
376
from collections import Counter N = int(input()) A = Counter(map(int, input().split())) if len(A.keys()) >= 3: print('No') exit() if len(A.keys()) == 1: print('Yes' if list(A.keys())[0] == N - 1 or list(A.keys())[0] == 2 else 'No') exit() p1, p2 = A.keys() 1 / 0 print('Yes' if abs(p1 - p2) == 1 and ...
s361673311
p03688
u896741788
1588990155
Python
Python (3.4.3)
py
Runtime Error
52
14564
256
n=int(input()) a=list(map(int,input().split())) if len(set(a))==1: if n>=2*a[0] or n-1==a[0]:print("Yes") else:print("No") elif len(set(a))==3:print("No") else: s,S=sorted(list(set(a))) if n+a.count(s)>=2*S:print("Yes") else:print("No")
s806629523
p03688
u477320129
1587925479
Python
Python (2.7.6)
py
Runtime Error
10
2568
1209
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False # 全員aloneか、全員pairもしくはcrowd if ma == mi: ...
s821153519
p03688
u477320129
1587925226
Python
Python (2.7.6)
py
Runtime Error
11
2568
1193
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False # 全員aloneか、全員crowd if ma == mi: return ...
s308212214
p03688
u477320129
1587924856
Python
Python (2.7.6)
py
Runtime Error
11
2568
1188
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False if ma == mi: return ma == N - 1 or 2 * ma ...
s260696255
p03688
u477320129
1587923973
Python
Python (2.7.6)
py
Runtime Error
10
2568
991
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False if ma == mi: return ma == N - 1 or 2 * ma ...
s765578720
p03688
u813174766
1587678768
Python
Python (3.4.3)
py
Runtime Error
18
3060
328
n=int(input()) a=list(map(int,input().split())) M=max(a) m=min(a) if M>m+1: print("No") elif M==m+1: cntm=a.count(m) cntM=n-cntm if cntm>m: print("No") elif cntm+cntM//2<M: print("No") else: print("Yes") elif M==m: if m<=n//2: print("Yes") else if m==n-1: print("Yes") else: pri...
s417067582
p03688
u477320129
1587533901
Python
Python (2.7.6)
py
Runtime Error
10
2568
990
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False if ma == mi: return ma == N - 1 or 2 * ma ...
s876560198
p03688
u477320129
1587533349
Python
Python (2.7.6)
py
Runtime Error
10
2568
938
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False if ma == mi: return ma == N - 1 or 2 * ma ...
s188715370
p03688
u477320129
1587533054
Python
Python (2.7.6)
py
Runtime Error
10
2580
942
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False if ma == mi: return ma == N - 1 or 2 * ma ...
s005837196
p03688
u477320129
1587532473
Python
Python (2.7.6)
py
Runtime Error
10
2568
940
#!/usr/bin/env python3 import sys YES = "Yes" # type: str NO = "No" # type: str def solve(N: int, a: "List[int]"): from collections import Counter ma, mi = max(a), min(a) if ma >= N or mi < 1: raise if ma - mi > 1: return False if ma == mi: return N % 2 == 0 or ma != N -...
s930365930
p03688
u149752754
1583338675
Python
Python (3.4.3)
py
Runtime Error
2104
14324
707
n = int(input()) A = list(map(int,input().split())) B = [] C = [] for num in A: if num in B: C[B.index(num)] += 1 else: B.append(num) C.append(1) if len(B) > 2: print('No') elif len(B) == 1: if N == B[0] +1: print('Yes') elif N//B[0] >= 2: print('Yes') e...
s833370811
p03688
u149752754
1583338363
Python
Python (3.4.3)
py
Runtime Error
2104
14300
707
n = int(input()) A = list(map(int,input().split())) B = [] C = [] for num in A: if num in B: C[B.index(num)] += 1 else: B.append(num) C.append(1) if len(B) > 2: print('No') elif len(B) == 1: if N == B[0] +1: print('Yes') elif N//B[0] >= 2: print('Yes') e...
s933969381
p03688
u149752754
1583337988
Python
Python (3.4.3)
py
Runtime Error
2104
13964
662
n = int(input()) A = list(map(int,input().split())) B = [] C = [] for num in A: if num in B: C[B.index(num)] += 1 else: B.append(num) C.append(1) if len(B) > 2: print('No') elif len(B) == 1: if N/B[0] >= 2: print('Yes') else: print('No') elif B[0] == (B[1]+...
s973215122
p03688
u149752754
1583337657
Python
Python (3.4.3)
py
Runtime Error
2104
14008
580
n = int(input()) A = list(map(int,input().split())) B = [] C = [] for num in A: if num in B: C[B.index(num)] += 1 else: B.append(num) C.append(1) if len(B) > 2: print('No') elif len(B) == 1: if N/B[0] >= 2: print('Yes') else: print('No') elif B[0] == (B[1]+...
s445999317
p03688
u504836877
1582937469
Python
Python (3.4.3)
py
Runtime Error
56
13964
328
N = int(input()) A = [int(a) for a in input().split()] A.sort() flag = True for a in A: if a > A[0]+1: flag = False if flag: cnt = A.count(A[0]) if cnt == N and (A[0] == N-1 or A[0]*2 <= N): ans = "Yes" elif cnt == A[0] and cnt < N-1: ans = "Yes" else: ans = "No" pr...
s915831825
p03688
u374099594
1581482498
Python
Python (2.7.6)
py
Runtime Error
67
11316
283
N = input() a = map(int, raw_input().split()) if max(a)-min(a)>=2: print "No" elif max(a)-min(a)==0: if N>=2*a[0] or N==a[0]+1: print "Yes" else: print "No" else: if a.count(max(a))>=2 and a.count(min(a))==min(a): print "Yes" else: exit(-1) print "No"
s064549149
p03688
u374099594
1581482454
Python
Python (2.7.6)
py
Runtime Error
67
11316
292
N = input() a = map(int, raw_input().split()) if max(a)-min(a)>=2: exit(-1) print "No" elif max(a)-min(a)==0: exit(-1) if N>=2*a[0] or N==a[0]+1: print "Yes" else: print "No" else: if a.count(max(a))>=2 and a.count(min(a))==min(a): print "Yes" else: print "No"
s214962720
p03688
u236193715
1580009417
Python
PyPy3 (2.4.0)
py
Runtime Error
207
61420
448
N=int(input()) A=list(map(int,input().split())) D={} for a in A: if(a in D): D[a]+=1 else: D[a]=1 if(len(D)>2): print("No") exit() if(len(D)==2): B=max(D) if(B-D[B-1]>0 and D[B]>=2*(B-D[B-1])): print("Yes") else: print("No") else: B=max(D) # 常に同じ色の人がいる if(N>=2*B): print(...
s996376141
p03688
u236193715
1580009339
Python
Python (3.4.3)
py
Runtime Error
63
18272
448
N=int(input()) A=list(map(int,input().split())) D={} for a in A: if(a in D): D[a]+=1 else: D[a]=1 if(len(D)>2): print("No") exit() if(len(D)==2): B=max(D) if(B-D[B-1]>0 and D[B]>=2*(B-D[B-1])): print("Yes") else: print("No") else: B=max(D) # 常に同じ色の人がいる if(N>=2*B): print(...
s675215058
p03688
u148423304
1569676387
Python
Python (3.4.3)
py
Runtime Error
17
2940
571
n = int(input()) a = list(map(int, input().split())) import collections l1 = collections.Counter(a).most_common() l1.sort() if len(l1) > 2 or l1[1][0] - l1[0][0] > 1: print("No") elif len(l1) == 1:#発言が1種類の場合 if l1[0][0] * 2 <= n or l1[0][0] == n - 1: print("Yes") else: print("No") else: ...
s271197245
p03688
u268516119
1569600164
Python
Python (3.4.3)
py
Runtime Error
53
13964
610
import sys def printans(t): print(t) sys.exit() N=int(input()) A=[int(i) for i in input().split()] if all([a==A[0] for a in A]):#全部同じ shurui=A[0] if shurui==N-1 or shurui*2<=N: printans("Yes") else:printans("No") else:#少ないやつは自分だけの色、そいつら以外で上と同じ処理 maxshurui = max(A) if all([a in (max...
s416641707
p03688
u268516119
1569600102
Python
PyPy3 (2.4.0)
py
Runtime Error
227
55916
610
import sys def printans(t): print(t) sys.exit() N=int(input()) A=[int(i) for i in input().split()] if all([a==A[0] for a in A]):#全部同じ shurui=A[0] if shurui==N-1 or shurui*2<=N: printans("Yes") else:printans("No") else:#少ないやつは自分だけの色、そいつら以外で上と同じ処理 maxshurui = max(A) if all([a in (max...
s138333339
p03688
u268516119
1569600028
Python
PyPy3 (2.4.0)
py
Runtime Error
227
56132
599
def printans(t): print(t) sys.exit() N=int(input()) A=[int(i) for i in input().split()] if all([a==A[0] for a in A]):#全部同じ shurui=A[0] if shurui==N-1 or shurui*2<=N: printans("Yes") else:printans("No") else:#少ないやつは自分だけの色、そいつら以外で上と同じ処理 maxshurui = max(A) if all([a in (maxshurui,maxs...
s886237020
p03688
u414425367
1567018639
Python
PyPy3 (2.4.0)
py
Runtime Error
215
52292
304
N=int(input()) A=list(map(int,input().split())) min_,max_=min(A),max(A) ans=None if max_-min_ > 1: ans=False elif max_-min_ == 1: A=max_ y=len([a for a in A if a==max_]) x=N-y nc=A-x ans=(A-x)>0 and y >=2*(A-x) else: ans=N>=2*min_ or min_+1==N print("Yes" if ans else "No")
s544313425
p03688
u284854859
1550733681
Python
Python (3.4.3)
py
Runtime Error
20
4788
362
n = int(input()) a = list(map(int,int(input()))) a_max = max(a) a_min = min(a) if a_max > a_min+1: print('No') exit() k = a_max if a_max == a_min: if k == n-1 or 2*k <= n: print('Yes') else: print('No') else: uni = a.count(k-1) if k >= uni + 1 and k <= uni + (n-uni)//2: ...
s088973280
p03688
u422104747
1533612290
Python
Python (3.4.3)
py
Runtime Error
50
13964
361
n=int(input()) s=input().split() l=[int(s[i]) for i in range(n)] l.sort() if l[0]==l[-1]: if 1<=l[0]<=n//2: print("Yes") else: print("No") elif l[-1]-l[0]>1: l[10000000]-=1 print("No") else: l[10000000]-=1 a=l.count(l[0]) b=l.count(l[-1]) if a+1<=l[-1]<=a+b//2: pr...
s944550840
p03688
u388927326
1528531045
Python
Python (3.4.3)
py
Runtime Error
22
3444
746
#!/usr/bin/env python3 import sys, math, copy import numba # import fractions, itertools import numpy as np # import scipy HUGE = 2147483647 HUGEL = 9223372036854775807 ABC = "abcdefghijklmnopqrstuvwxyz" @numba.jit("b1(i8, i8[:])", nopython=True) def main(n, ai): ma = np.max(ai) k = 0 for a in ai: ...
s241660702
p03688
u149260203
1527602389
Python
Python (3.4.3)
py
Runtime Error
52
14564
333
N = int(input()) a = [int(i) for i in input().split()] amax = max(a) aelse = list(set(a)) aelse.remove(amax) if len(aelse) == 0: if max == N | max == N-1: print('No') else: print('Yes') exit() if len(aelse) != 1: print('No') exit() if aelse[0] != amax - 1: print('No') exit()...
s925889680
p03688
u149260203
1527601726
Python
Python (3.4.3)
py
Runtime Error
51
14120
211
N = int(input()) a = [int(i) for i in input().split()] amax = max(a) aelse = list(set(a)) - [amax] if len(aelse) != 0: print('No') exit() if aelse[0] != amax - 1: print('No') exit() print('Yes')
s076321795
p03688
u976162616
1499957463
Python
Python (3.4.3)
py
Runtime Error
62
14660
1163
import sys if __name__ == "__main__": N = int(input()) evidences = list(map(int, input().split())) evidences = list(sorted(evidences)) unique_evidence = set(evidences) if (evidences[-1] - evidences[0] > 1): print ("No") sys.exit() if (len(unique_evidence) == 1): group = e...
s572608727
p03688
u637175065
1497898124
Python
Python (3.4.3)
py
Runtime Error
94
20476
1062
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x...
s515943225
p03688
u637175065
1497897671
Python
Python (3.4.3)
py
Runtime Error
93
20476
1066
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x...
s762794143
p03688
u637175065
1497897621
Python
Python (3.4.3)
py
Runtime Error
93
20476
1062
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x...
s043804411
p03688
u777923818
1497839812
Python
Python (3.4.3)
py
Runtime Error
66
14852
517
# -*- coding: utf-8 -*- from queue import Queue N = int(input()) a = sorted([int(n) for n in input().split()], reverse=True) alone = a.count(max(a) - 1) if alone: a = [a_ - alone for a_ in a][alone:] if len(a) == 2 and a[0] == 1: print("Yes") elif 2*a[0] <= len(a) and a[0] <= len(a)//a[0]: ...
s674375530
p03688
u667084803
1497837353
Python
Python (3.4.3)
py
Runtime Error
69
13964
299
import sys N=int(input()) a=[int(i) for i in input().split()] a.sort() if a[N-1]-a[0]>1: print("No") sys.exit() if a[0]==N-1: print("Yes") sys.exit() if a[N-1]==1: print("Yes") sys.exit() if a[0]==a[N-1]: if 2*a[0]<=N: print("Yes") else: print("No") sys.exit() print(a[N])
s579875988
p03688
u985443069
1497837197
Python
Python (3.4.3)
py
Runtime Error
21
3316
918
import sys from collections import Counter sys.stdin = open('b1.in') def read_int_list(): return list(map(int, input().split())) def read_int(): return int(input()) def read_str_list(): return input().split() def read_str(): return input() yes, no = 'Yes', 'No' def solve(n, a): s = set(...
s729967136
p03688
u667084803
1497837163
Python
Python (3.4.3)
py
Runtime Error
52
13964
170
import sys N=int(input()) a=[int(i) for i in input().split()] a.sort() if a[N-1]-a[0]>1: print("No") sys.exit() if a[0]==N-1: print("Yes") sys.exit() print(a[N])
s864797464
p03688
u667084803
1497837028
Python
Python (3.4.3)
py
Runtime Error
45
13964
257
import sys N=int(input()) a=[int(i) for i in input().split()] a.sort() if a[N-1]-a[0]>1: print("NO") sys.exit() if a[N-1]>N-1: print("NO") sys.exit() if a[0]==N-1: print("YES") sys.exit() if a[0]==a[N-1]: print("YES") sys.exit() print(a[N])
s333870974
p03688
u854685751
1497836528
Python
Python (3.4.3)
py
Runtime Error
318
21520
310
import numpy as np H,W,h,w = map(int,input().split()) # H,W,h,w = (3,4,2,3) hrep = H//h +1 wrep = W//w +1 elem = np.ones((h,w),dtype=np.int) elem[-1,-1] = -h*w mat = np.tile(elem, (hrep,wrep)) mat = mat[:H,:W] if mat.sum() > 0: print("Yes") for i in mat: print(" ".join(map(str,i))) else: print("No")
s092262289
p03688
u854685751
1497836355
Python
Python (3.4.3)
py
Runtime Error
336
21392
307
import numpy as np H,W,h,w = map(int,input().split()) # H,W,h,w = (3,4,2,3) hrep = H//h +1 wrep = W//w +1 elem = np.ones((h,w),dtype=int) elem[-1,-1] = -h*w mat = np.tile(elem, (hrep,wrep)) mat = mat[:H,:W] if mat.sum() > 0: print("Yes") for i in mat: print(" ".join(map(str,i))) else: print("No")
s860817810
p03688
u945080461
1497835983
Python
Python (2.7.6)
py
Runtime Error
10
2568
344
nwin@linux-lqq3:~/atcoder/g16> cat b.py n = int(raw_input()) a = map(int, raw_input().split()) b = max(a) c = min(a) if b - c > 1: print "No" elif b == c: print "Yes" if b == n - 1 or 2 * b <= n else "No" else: t = sum(c == x for x in a) if t >= b: print "No" else: print "Yes" if (b ...
s677844927
p03688
u946386741
1497835882
Python
Python (3.4.3)
py
Runtime Error
49
14208
428
N = int(input()) a = list(map(int, input().split())) result = False if len(set(a)) > 1: set_min = list(set(a)[0]) set_max = list(set(a)[1]) if len(set(a)) > 2: result = False elif (set_max - set_min) != 1: result = False else: result = (a.count(set_min) == 1) else: res...
s180896886
p03688
u299869545
1497834841
Python
Python (2.7.6)
py
Runtime Error
12
2568
624
#include<iostream> #include<algorithm> using namespace std; void ng(){ cout << "No" << endl; exit(0); } void ok(){ cout << "Yes" << endl; exit(0); } int a[108000], n; int main(){ cin >> n; int mn = n + 1; int mx = 0; int mxcnt = 0; int mncnt = 0; for(int i = 0;i < n;i++){ cin >> a[i]; mn ...
s390987410
p03689
u644972721
1600753192
Python
Python (3.8.2)
py
Runtime Error
124
9276
416
h, w, h0, w0 = map(int, input().split()) x, y = h // h0, w // w0 a1cnt = h0 * w0 - 1 a1sum, a2sum = h * w - x * y, x * y a1 = ((pow(10, 9) - 1) // a1cnt) a2 = -(a1 * a1cnt + 1) asum = a1 * a1sum + a2 * a2sum print("Yes" if asum > 0 else "No") if asum > 0: for i in range(1, h + 1): a = [0] * w for j ...
s642361045
p03689
u813174766
1594663395
Python
Python (3.8.2)
py
Runtime Error
222
15152
369
H,W,h,w=map(int,input().split()) p=(10**9-1)//(h*w-1) m=p*(h*w-1)+1 vec=[[p for i in range(W+1)] for j in range(H+1)] sm=0 for i in range(1,H+1): for j in range(1,W+1): if i%h==0 and j%w==0: vec[i][j]=-m sm+=vec[i][j] if sm<=0: print("No") else: print("Yes") for i in range(1,H+1): for j in ran...
s605915740
p03689
u144913062
1593797961
Python
PyPy3 (7.3.0)
py
Runtime Error
98
77080
341
H, W, h, w = map(int, input().split()) if H % h == 0 and W % h == 0: print('No') exit() rem = H * W - (H - H % h) * (W - W % w) x = (H // h * W // w) // rem + 1 a = [[x] * W for _ in range(H)] for i in range(h-1, H, h): for j in range(w-1, W, w): a[i][j] = -(h * w - 1) * x - 1 print('Yes') for row i...
s582707067
p03689
u794173881
1591146821
Python
PyPy3 (2.4.0)
py
Runtime Error
191
41840
340
h, w, hp, wp = map(int, input().split()) a = [[1] * w for i in range(h)] sum_ = 0 for i in range(h): for j in range(w): if (i + 1) % hp == 0 and (j + 1) % wp == 0: a[i][j] = -(hp * wp) sum_ += a[i][j] if sum_ > 0: print(re) print("Yes") for res in a: print(*res) els...
s553792524
p03689
u141610915
1588951716
Python
PyPy3 (2.4.0)
py
Runtime Error
292
48476
411
import sys input = sys.stdin.readline H, W, h, w = map(int, input().split()) unit = 10 ** 9 - 1 c = H * W for i in range(h - 1, H, h): for j in range(w - 1, W, w): c -= 1 res = [[unit // c] * W for _ in range(H)] for i in range(h - 1, H, h): for j in range(w - 1, W, w): res[i][j] = -(unit // c * (h * w - 1) + 1) if...
s694278529
p03689
u732412551
1584650328
Python
Python (3.4.3)
py
Runtime Error
191
6256
1009
def solve(H,W,h,w): A=[[0]*W for _ in range(H)] for i in range(H+1-h): for j in range(W+1-w): A[-1-i][-1-j]=-1 A[-1][-1]=1 if H==h: A[-1][-w-1]+=1 else: A[-h-1][-1]+=1 if W==w: A[-h-1][-1]+=1 else: A[-1][-w-1]+=1 for i in range(H)[::-1]...
s435820547
p03689
u732412551
1584647261
Python
Python (3.4.3)
py
Runtime Error
276
6256
492
H,W,h,w=map(int, input().split()) if h*2<H+1 or w*2<W+1: print("No") else: print("Yes") A=[[0]*W for _ in range(H)] for i in range(h): for j in range(w): A[-1-i][-1-j]=-1 A[-1][-1]=1 A[-1][-1-w]=1 A[-1-h][-1]=1 for i in range(H)[::-1]: for j in range(W-1)[::-1...
s078530398
p03689
u310678820
1583597553
Python
PyPy3 (2.4.0)
py
Runtime Error
177
38512
4499
//header #ifdef LOCAL #include "cxx-prettyprint-master/prettyprint.hpp" #define print(x) cout << x << endl #else #define print(...) 42 #endif #pragma GCC optimize("Ofast") #include <bits/stdc++.h> //types using namespace std; using ll = long long; typedef pair < ll , ll >Pl; type...
s789259735
p03689
u511965386
1581828755
Python
PyPy3 (2.4.0)
py
Runtime Error
288
49372
333
H, W, h, w = map(int, input().split()) a = (10 ** 9 - 1) // (h * w - 1) ret = [[a] * W for _ in range(H)] for y in range(h - 1, H, h) : for x in range(w - 1, W, w) : ret[y][x] = - a * (h * w - 1) - 1 s = 0 for y in range(H) : s += sum(ret[y]) if s > 0 : print('Yes') for r in ret : print(*r) else : ...
s843033173
p03689
u585482323
1575319866
Python
PyPy3 (2.4.0)
py
Runtime Error
281
48348
1318
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()]...
s989904780
p03689
u585482323
1575319756
Python
PyPy3 (2.4.0)
py
Runtime Error
262
48476
1314
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()]...
s483810307
p03689
u585482323
1575318783
Python
PyPy3 (2.4.0)
py
Runtime Error
314
49244
1328
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()]...
s627784745
p03689
u389910364
1572567522
Python
Python (3.4.3)
py
Runtime Error
279
40264
637
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 H, W, A, B = list(map(int, sys.stdin.readline().split())) if H % A == 0 and W % B == 0: print('No') exit() print('Yes') ...
s961522282
p03689
u389910364
1572566949
Python
Python (3.4.3)
py
Runtime Error
281
38340
477
import os import sys import numpy as np if os.getenv("LOCAL"): sys.stdin = open("_in.txt", "r") sys.setrecursionlimit(2147483647) INF = float("inf") IINF = 10 ** 18 MOD = 10 ** 9 + 7 H, W, A, B = list(map(int, sys.stdin.readline().split())) if H % A == 0 and W % B == 0: print('No') exit() print('Yes') ...
s605444424
p03689
u637175065
1497899291
Python
Python (3.4.3)
py
Runtime Error
84
12044
1007
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x...
s850902807
p03689
u257374434
1497840875
Python
Python (3.4.3)
py
Runtime Error
2104
6384
727
H, W, h, w =list(map(int,input().split())) INF = 10**10 mat = [[1 for _ in range(H)] for _ in range(W)] for i in range(h): for j in range(w): mat[i][j] =1 mat[h-1][w-1] = -h*w for i in range(H-h+1): for j in range(W-w+1): _sum = 0 for p in range(h): for q in range(w): ...
s322989519
p03689
u692632484
1497840585
Python
Python (3.4.3)
py
Runtime Error
19
3188
471
temp=input().split() H=int(temp[0]) W=int(temp[1]) h=int(temp[2]) w=int(temp[3]) countT=0 ans=[] if H%h==0 and W%w==0: print("No") else: for i in range(H): tempAns=[] for j in range(W): if (i+1)%h==0 and (j+1)%w==0: countT-=h*w tempAns.append(-1*h*w) else: tempAns.append(1) countT+=1 ans....
s670848334
p03689
u985443069
1497839509
Python
Python (3.4.3)
py
Runtime Error
19
3064
762
import sys sys.stdin = open('c1.in') def read_int_list(): return list(map(int, input().split())) def read_int(): return int(input()) def read_str_list(): return input().split() def read_str(): return input() H, W, h, w = read_int_list() def solve(H, W, h, w): if H % h == 0 and W % w == ...
s783992266
p03689
u340781749
1497836732
Python
Python (3.4.3)
py
Runtime Error
18
3192
977
def solve(H, W, h, w): if H == 1: if W <= 2: print('No') else: kari = (W - 2) // 2 + 1 if kari >= w - 1: print('No') else: print('Yes') print(kari, *([-1] * (W - 2)), kari) return if W == 1: ...
s000251089
p03689
u340781749
1497836461
Python
Python (3.4.3)
py
Runtime Error
18
3064
954
def solve(H, W, h, w): if H == 1: if W <= 2: print('No') else: kari = (W - 2) // 2 + 1 if kari >= w - 1: print('No') else: print('Yes') print(kari, *([-1] * (W - 2)), kari) return if W == 1: ...
s913651414
p03690
u969708690
1597871786
Python
Python (3.8.2)
py
Runtime Error
191
24564
498
N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) s=0 for i in A: s=s^i if sorted(A)==sorted(B): ans=0 for i in range(N+10): if A[i]!=B[i]: ans+=1 print(ans+1) exit() else:#OK ans=0 A+=[s] L=sorted(A) R=sorted(B) for i in range(N): if L[i]!=R[i]: L....
s049989548
p03690
u638795007
1591845122
Python
PyPy3 (2.4.0)
py
Runtime Error
1113
125836
4907
def examA(): N = I() ans = 0 print(ans) return def examB(): ans = 0 print(ans) return def examC(): ans = 0 print(ans) return def examD(): class UnionFind(): def __init__(self, n): self.parent = [-1 for _ in range(n)] # 正==子: 根の頂点番号 / 負==根: 連...
s708112330
p03690
u674885198
1553887839
Python
Python (3.4.3)
py
Runtime Error
17
3064
548
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) x = a[0] for i in range(1,n): x = x^a[i] a.append(x) a_=[] b_=[] for i in range(n): if a[i]!=b[i]: a_.append(a[i]) b_.append(b[i]) a_.sort() b_.sort() flag=True boo = False for i in range(len(a_)): i...
s850478868
p03690
u674885198
1553887659
Python
Python (3.4.3)
py
Runtime Error
19
3064
444
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) x = a[0] for i in range(1,n): x = x^a[i] a.append(x) a_=[] b_=[] for i in range(n): if a[i]!=b[i]: a_.append(a[i]) b_.append(b[i]) a_.sort() b_.sort() boo = False for i in range(len(a_)): if a_[i]!=b...
s499184410
p03690
u582577761
1501779195
Python
PyPy3 (2.4.0)
py
Runtime Error
1318
156580
460
n,a,b=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0] for i in range(n): a[n]^=a[i] b[n]^=b[i] na,nb=sorted(a),sorted(b) if na!=nb: print("-1") exit() f=dict() def find(x): if f[x]==x: return x else: f[x]=find(f[x]) return f[x] ans=0 for i in range(n): if a[i]!=b[i]: f[...
s609611289
p03690
u582577761
1501779002
Python
PyPy3 (2.4.0)
py
Runtime Error
1374
181376
493
n,a,b=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0] for i in range(n): a[n]^=a[i] b[n]^=b[i] na,nb=sorted(a),sorted(b) if sum([na[i]!=nb[i] for i in range(n+1)]): print("-1") exit() f=dict() def find(x): if f[x]==x: return x else: f[x]=find(f[x]) return f[x] ans=0 for i ...
s193187655
p03690
u582577761
1501778554
Python
Python (3.4.3)
py
Runtime Error
458
24600
519
n,a,b,ax,bx=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0],0,0 for i in range(n): a[n]^=a[i] b[n]^=b[i] na,nb=a,b a,b=sorted(a),sorted(b) if sum([a[i]!=b[i] for i in range(n+1)]): print("-1") exit() f=dict() def find(x): if f[x]==x: return x else: f[x]=find(f[x]) return f...
s633079513
p03690
u582577761
1501778379
Python
Python (3.4.3)
py
Runtime Error
470
24600
517
n,a,b,ax,bx=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0],0,0 na,nb=a,b for i in range(n): a[n]^=a[i] b[n]^=b[i] a,b=sorted(a),sorted(b) if sum([a[i]!=b[i] for i in range(n+1)]): print("-1") exit() f=dict() def find(x): if f[x]==x: return x else: f[x]=find(f[x]) return f...
s746251162
p03690
u582577761
1501775061
Python
Python (3.4.3)
py
Runtime Error
2105
30232
580
n,a,b,ax,bx=int(input()),list(map(int,input().split()))+[0],list(map(int,input().split()))+[0],0,0 na,nb=a,b for i in range(n): a[n]^=a[i] b[n]^=b[i] a,b=sorted(a),sorted(b) if sum([a[i]!=b[i] for i in range(n+1)]): print("-1") exit() mp=dict() ax,bx=0,0 f=[i for i in range(n+1)] def find(x): if f[x]==x: return ...
s834976037
p03691
u340781749
1527301796
Python
Python (3.4.3)
py
Runtime Error
28
10080
498
import sys from itertools import combinations n, m = map(int, input().split()) survivors = {v: {v + 1} for v in range(n)} for x, y in reversed(map(int, line.split()) for line in sys.stdin.readlines()): for v, srv in survivors.copy().items(): if x in srv: if y in srv: del surviv...
s722214825
p03691
u340781749
1527300909
Python
Python (3.4.3)
py
Runtime Error
2104
12744
784
def get_survivors(n, pairs): survivors = {v: {v} for v in range(n)} for x, y in reversed(pairs): for v, srv in survivors.copy().items(): if x in srv: if y in srv: del survivors[v] else: srv.add(y) elif y in s...
s614516326
p03691
u340781749
1527300874
Python
Python (3.4.3)
py
Runtime Error
2104
12740
779
def get_survivors(n, pairs): survivors = {v: {v} for v in range(n)} for x, y in reversed(pairs): for v, srv in survivors.copy().items(): if x in srv: if y in srv: del survivors[v] else: srv.add(y) elif y in s...
s470199838
p03693
u294394140
1600875147
Python
Python (3.8.2)
py
Runtime Error
24
9136
103
r, g, b = map(int, input().split()) num = 10*y + z if num % 4 == 0: print("YES") else: print("NO")