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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s583341389 | p03611 | u623687794 | 1562037141 | Python | Python (3.4.3) | py | Runtime Error | 139 | 13964 | 185 | n=int(input())
l=list(map(int,input().split()))
l.sort()
a=[0]*(l[-1]-l[0]+3)
for i in range(n):
l[i]-=l[0]
for i in range(n):
a[l[i]]+=1
a[l[i]+1]+=1
a[l[i]+2]+=1
print(max(a)) |
s018978076 | p03611 | u695429668 | 1562037092 | Python | PyPy3 (2.4.0) | py | Runtime Error | 204 | 52652 | 228 | N = int(input())
A = list(map(int, input().split()))
buff = [0 for i in range(10)]
for i in range(N):
buff[A[i]] += 1
ans = 0
# print(buff)
for i in range(N-2):
ans = max(ans,buff[i]+buff[i+1]+buff[i+2])
print(ans) |
s687321958 | p03611 | u641460756 | 1561924207 | Python | Python (3.4.3) | py | Runtime Error | 80 | 13964 | 156 | n=int(input())
a=list(map(int,input().split()))
anslist=[0]*100000
for i in a:
anslist[i-1]+=1
anslist[i]+=1
anslist[i+1]+=1
print(max(anslist)) |
s227043777 | p03611 | u224156735 | 1561778480 | Python | Python (3.4.3) | py | Runtime Error | 77 | 14856 | 149 | n = int(input())
cnt= [0]*100000
a = list(map(int, input().split()))
for v in a:
cnt[v-1] += 1
cnt[v] += 1
cnt[v+1] += 1
print(max(cnt)) |
s298775300 | p03611 | u224156735 | 1561778292 | Python | Python (3.4.3) | py | Runtime Error | 68 | 14092 | 148 | n = int(input())
cnt= [0]*10001
a = list(map(int, input().split()))
for v in a:
cnt[v-1] += 1
cnt[v] += 1
cnt[v+1] += 1
print(max(cnt)) |
s212001717 | p03611 | u539517139 | 1561319625 | Python | Python (3.4.3) | py | Runtime Error | 50 | 13964 | 124 | n=int(input())
a=list(map(int,input().split()))
d=[0]*(max(a)+2)
for i in a:
d[i]+=1
d[i+1]+=1
d[i+2]+=1
print(max(d)) |
s185082290 | p03611 | u247554097 | 1561313527 | Python | PyPy3 (2.4.0) | py | Runtime Error | 245 | 59884 | 503 | # ハッシュで数えてキーでソートして+-1を全探索
n = int(input())
arr = list(map(int, input().split()))
hash = dict()
for a in arr:
if a in hash:
hash[a] += 1
else:
hash[a] = 1
lis = list(sorted(hash.items(), key=lambda x: x[0]))
ans = 0
for i in range(1, n - 2):
temp = lis[i][1]
if lis[i - 1][0] + 1 == lis[... |
s584685880 | p03611 | u497596438 | 1560904031 | Python | PyPy3 (2.4.0) | py | Runtime Error | 214 | 52780 | 130 | N=int(input())
A=list(map(int,input().split()))
B=[0]*(1+10**5)
for a in A:
B[a+1]+=1
B[a]+=1
B[a+2]+=1
print(max(B))
|
s551029066 | p03611 | u102461423 | 1560722399 | Python | Python (3.4.3) | py | Runtime Error | 172 | 21796 | 183 | import numpy as np
N = int(input())
A = np.array(input().split(), dtype = np.int32)
counter = np.bincount(A)
answer = (counter[2:] + counter[1:-1] + counter[:-2]).max()
print(answer) |
s705523051 | p03611 | u220345792 | 1560569762 | Python | Python (3.4.3) | py | Runtime Error | 49 | 13964 | 154 | N = int(input())
A = list(map(int, input().split()))
ans = [0]*(max(A)+1)
for i in A:
ans[i-1] += 1
ans[i] += 1
ans[i+1] += 1
print(max(ans))
|
s876187226 | p03611 | u800780376 | 1559924945 | Python | Python (3.4.3) | py | Runtime Error | 83 | 10124 | 191 | N = int(input())
tmp = input().split(" ")
als = [0]*(10**5)
for n in tmp:
nowNum = int(n)
als[nowNum - 1] += 1
als[nowNum] += 1
als[nowNum + 1] += 1
print(max(als))
|
s329204202 | p03611 | u665038048 | 1559769565 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 335 | from collections import Counter
N = int(input())
a = list(map(int, input().split()))
i_list = []
#return tuple list: Counter().most_common() for i in a:
i_list.append(i-1)
i_list.append(i)
i_list.append(i+1)
print(Counter(i_list).most_... |
s476140942 | p03611 | u665038048 | 1559769532 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 349 | from collections import Counter
N = int(input())
a = list(map(int, input().split()))
i_list = []
#return tuple list: Counter().most_common() for i in a:
i_list.append(i-1)
i_list.append(i)
i_list.append(i+1)
print(i_list)
print(Counter... |
s801019754 | p03611 | u665038048 | 1559768908 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14008 | 230 | N = int(input())
a = list(map(int, input().split()))
i_list = []
for x in range(max(a)):
cnt = 0
for i in range(N):
if abs(x - a[i]) == 1 or x == a[i]:
cnt += 1
i_list.append(cnt)
print(max(i_list)) |
s400720649 | p03611 | u114648678 | 1559646274 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 196 | n=int(input())
a=list(map(int,input().split()))
m=max(a)
cnt=[0]*(m+1)
for i in range(m+1):
cnt[i]=a.count(i)
ans=[0]*(m-1)
for j in range(m-1):
ans[j]=cnt[j]+cnt[j+1]+cnt[j+2]
print(max(ans)) |
s547565288 | p03611 | u114648678 | 1559645683 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 147 | n=int(input())
a=list(map(int,input().split()))
m=max(a)
cou=[0]*m
for i in range(m):
cou[i]=a.count(i-1)+a.count(i)+a.count(i+1)
print(max(cou)) |
s116163900 | p03611 | u761529120 | 1559524862 | Python | Python (3.4.3) | py | Runtime Error | 106 | 13964 | 265 | # 空の配列を用意して各要素の-1,0,+1を試して
# 値のインデックスに+1して最大値をとる
N = int(input())
a = list(map(int, input().split()))
cnt = [0] * 100000
for i in a:
for j in [-1,0,1]:
cnt[i+j] += 1
print(max(cnt)) |
s434755941 | p03611 | u797550216 | 1559254451 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14008 | 671 | n = int(input())
seq = list(map(int,input().split()))
unique = []
seq = sorted(seq)
c = 0
k = seq[0]
for i in seq:
if not i in unique:
unique.append(i)
unique_n = [0]*len(unique)
for i in seq:
if i == k:
unique_n[c] += 1
else:
c += 1
unique_n[c] += 1
if n == 1... |
s218508010 | p03611 | u057109575 | 1559088312 | Python | Python (3.4.3) | py | Runtime Error | 107 | 15536 | 181 | from collections import Counter
N, *a = map(int, open(0).read().split())
c = [y for _, y in sorted(Counter(a).most_common())]
print(max(sum(c[i:i + 3]) for i in range(len(c) - 2))) |
s973195430 | p03611 | u732870425 | 1558507917 | Python | Python (3.4.3) | py | Runtime Error | 104 | 14008 | 201 | N = int(input())
A = list(map(int, input().split()))
L = [0 for _ in range(10 ** 5 + 1)]
for a in A:
L[a] += 1
ans = 0
for i in range(1,100001):
ans = max(ans,L[i-1]+L[i]+L[i+1])
print(ans) |
s961871184 | p03611 | u382431597 | 1558405401 | Python | Python (3.4.3) | py | Runtime Error | 128 | 17796 | 297 | import statistics
n = int(input())
a = list(map(int, input().split()))
a.sort()
imode = statistics.mode(a)
num_ofmode = a.count(imode)
print(max(a.count(imode-2) + a.count(imode-1) + num_ofmode, a.count(imode-1) + num_ofmode + a.count(imode+1), num_ofmode + a.count(imode+1) + a.count(imode+2))) |
s486975731 | p03611 | u488178971 | 1556515571 | Python | Python (3.4.3) | py | Runtime Error | 74 | 13964 | 151 | #ABC 072 C
N=int(input())
A=[int(j) for j in input().split()]
cnt=[0]*(10**5)
for a in A:
cnt[a]+=1
cnt[a+1]+=1
cnt[a+2]+=1
print(max(cnt)) |
s351521422 | p03611 | u740284863 | 1556473245 | Python | Python (3.4.3) | py | Runtime Error | 166 | 33088 | 179 | import statistics
n = int(input())
A = list(map(int,input().split()))
B = [A[i]-1 for i in range(n)] + A + [A[i]+1 for i in range(n)]
ans = statistics.mode(B)
print(B.count(ans)) |
s047357991 | p03611 | u795630164 | 1556254190 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 258 | N = int(input())
a = [int(i) for i in input().split())
c = [0] * (10**5 + 1)
for i in a:
c[i] += 1
if i != 0 and i != 10 ** 5:
c[i-1] += 1
c[i+1] += 1
elif i == 0:
c[i+1] += 1
else:
c[i-1] += 1
print(max(c)) |
s599079670 | p03611 | u559126797 | 1555703784 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 268 | n=int(input())
a=list(map(int,input().split()))
cntans=cntnow=0
for i in range(min(a),max(a)):
for j in range(n):
if abs(a[j]-i)<=1:
cntnow+=1
if cntnow==n:
print(cntnow)
sys.exit()
cntans=max(cntans,cntnow)
cntnow=0
print(cntans) |
s108381501 | p03611 | u210827208 | 1553396780 | Python | Python (3.4.3) | py | Runtime Error | 144 | 16480 | 389 | import collections
n=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
X=sorted(a.items(), key=lambda x:x[0])
K=[]
V=[]
RES=[]
for i in range(len(X)):
K.append(X[i][0])
V.append(X[i][1])
for j in range(1,len(X)-1):
res=V[j]
if K[j]-1==K[j-1]:
res+=V[j-1]
if K[j... |
s417386172 | p03611 | u887207211 | 1552580619 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14004 | 163 | N = int(input())
A = list(map(int,input().split()))
result = [0]*(1000000001)
for a in A:
result[a] += 1
result[a-1] += 1
result[a+1] += 1
print(max(result)) |
s677777092 | p03611 | u807772568 | 1552423429 | Python | Python (3.4.3) | py | Runtime Error | 44 | 13964 | 246 | n = int(input())
a = list(map(int,input().split()))
b = [[0]*(10**5+1)]
for i in range(n):
if a[i] == 0:
b[a[i]] += 1
b[a[i]+1] += 1
else:
b[a[i]-1] += 1
b[a[i]] += 1
b[a[i]+1] += 1
print(max(b)) |
s268973147 | p03611 | u496744988 | 1551394401 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14092 | 199 | n=int(input())
a=list(map(int,input().split()))
a.sort()
ans = [1] * len(set(a))
index=0
for i in range(n):
ans[index] = a.count(a[i]-1)+a.count(a[i])+a.count(a[i]+1)
index+=1
print(max(ans)) |
s013795264 | p03611 | u099566485 | 1550862115 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 169 | #072-C
n=I()
a=IL()
cnt=[0 for i in range(pow(10,5))]
for i in range(n):
cnt[a[i]]+=1
m=0
for i in range(2,pow(10,5)):
m=max(cnt[i]+cnt[i-1]+cnt[i-2],m)
print(m) |
s787561699 | p03611 | u367130284 | 1550635810 | Python | Python (3.4.3) | py | Runtime Error | 69 | 22344 | 157 | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=[i-1 for i in a]+a+[i+1 for i in a]
b=Counter(a).most_max(1)
print(b[0][1]) |
s585760954 | p03611 | u939702463 | 1550114967 | Python | Python (3.4.3) | py | Runtime Error | 68 | 13964 | 232 | n = int(input())
a = list(map(int, input().split()))
count = {}
for ai in a:
count[ai] = count.get(ai, 0) + 1
ans = 0
for key in count.keys():
ans = max(ans, count.get(key - 1) + count.get(key) + count.get(key + 1))
print(ans) |
s155584699 | p03611 | u371763408 | 1550072767 | Python | Python (3.4.3) | py | Runtime Error | 97 | 15312 | 427 | from collections import Counter
n=int(input())
A=Counter(list(map(int,input().split()))).most_common()
if A[0][0]==0:
if A[0][1]==A[1][1]:
max_num=A[1][0]
else:
max_num=A[0][0]
kouho=[max_num-1,max_num,max_num+1]
cnts={max_num-1:0,max_num:0,max_num+1:0}
for i in A:
if i[0]-1 in cnts:
cnts[i[0]-1]+=i[1]
... |
s284355549 | p03611 | u763741681 | 1550000873 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14008 | 165 | #愚直にやる方法
#C問題
N=int(input())
a=list(map(int,input().split()))
Xmax=max(a)
print(max([a.count(X-1)+a.count(X)+a.count(X+1) for X in range(1,Xmax)])) |
s926099356 | p03611 | u763741681 | 1550000282 | Python | Python (3.4.3) | py | Runtime Error | 147 | 14092 | 678 | #C問題
N=int(input())
a=list(map(int,input().split()))
a.sort()
a_sabun=[a[i+1]-a[i] for i in range(0,N-1)]
b=1
B=[]
C=[]
for i in range(0,N-1):
if a_sabun[i]==0:
b=b+1
else:
B.append(b)
C.append(a_sabun[i])
b=1
B.append(b)
#print(B)
#print(C)
D=[]
e=len(C)
for i in range(0,e-1):
... |
s800947476 | p03611 | u763741681 | 1550000220 | Python | Python (3.4.3) | py | Runtime Error | 113 | 13960 | 679 | #C問題
N=int(input())
a=list(map(int,input().split()))
a.sort()
a_sabun=[a[i+1]-a[i] for i in range(0,N-1)]
b=1
B=[]
C=[]
for i in range(0,N-1):
if a_sabun[i]==0:
b=b+1
else:
B.append(b)
C.append(a_sabun[i])
b=1
B.append(b)
#print(B)
#print(C)
D=[]
#e=len(C)
for i in range(0,e-1):
... |
s066260080 | p03611 | u763741681 | 1549999893 | Python | Python (3.4.3) | py | Runtime Error | 145 | 13964 | 678 | #C問題
N=int(input())
a=list(map(int,input().split()))
a.sort()
a_sabun=[a[i+1]-a[i] for i in range(0,N-1)]
b=1
B=[]
C=[]
for i in range(0,N-1):
if a_sabun[i]==0:
b=b+1
else:
B.append(b)
C.append(a_sabun[i])
b=1
B.append(b)
#print(B)
#print(C)
D=[]
e=len(C)
for i in range(0,e-2):
... |
s056897745 | p03611 | u763741681 | 1549999348 | Python | Python (3.4.3) | py | Runtime Error | 148 | 13964 | 629 | #C問題
N=int(input())
a=list(map(int,input().split()))
a.sort()
a_sabun=[a[i+1]-a[i] for i in range(0,N-1)]
b=1
B=[]
C=[]
for i in range(0,N-1):
if a_sabun[i]==0:
b=b+1
else:
B.append(b)
C.append(a_sabun[i])
b=1
B.append(b)
D=[]
e=len(C)
for i in range(0,e-1):
if C[i]>2:
... |
s089817313 | p03611 | u763741681 | 1549998696 | Python | Python (3.4.3) | py | Runtime Error | 145 | 14088 | 663 | #C問題
N=int(input())
a=list(map(int,input().split()))
a.sort()
a_sabun=[a[i+1]-a[i] for i in range(0,N-1)]
b=1
B=[]
C=[]
for i in range(0,N-1):
if a_sabun[i]==0:
b=b+1
else:
B.append(b)
C.append(a_sabun[i])
b=1
B.append(b)
D=[]
e=len(C)
for i in range(0,e-1):
if C[i]>2:
... |
s180244193 | p03611 | u763741681 | 1549997424 | Python | Python (3.4.3) | py | Runtime Error | 118 | 13964 | 272 | N=int(input())
a=list(map(int,input().split()))
a.sort()
a_sabun=[a[i+1]-a[i] for i in range(0,N-1)]
b=0
B=[]
for i in range(0,N-1):
if a_sabun[i]==0:
b=b+1
else:
B.append(b)
b=0
print(max([B[i]+B[i+1]+B[i+2] for i in range(0,len(B)-2)])+3) |
s335135992 | p03611 | u533885955 | 1549739280 | Python | Python (3.4.3) | py | Runtime Error | 88 | 16088 | 894 | import collections
N = int(input())
alist = list(map(int,input().split()))
acount = collections.Counter(alist)
a = acount.most_common()
a.sort()
alen = len(a)
MAX = 0
if alen == 1:
print(a[0][1])
elif alen == 2:
if abs(a[0][1]-a[1][1])<=2:
print(a[0][1]+a[1][1])
else:
print(max(a[0][1],a[1][... |
s158957953 | p03611 | u533885955 | 1549739241 | Python | Python (3.4.3) | py | Runtime Error | 86 | 16088 | 894 | import collections
N = int(input())
alist = list(map(int,input().split()))
acount = collections.Counter(alist)
a = acount.most_common()
a.sort()
alen = len(a)
MAX = 0
if alen == 1:
print(a[0][1])
elif alen == 2:
if abs(a[0][1]-a[1][1])<=2:
print(a[0][1]+a[1][1])
else:
print(max(a[0][1],a[1][... |
s064771596 | p03611 | u533885955 | 1549739144 | Python | Python (3.4.3) | py | Runtime Error | 89 | 16088 | 894 | import collections
N = int(input())
alist = list(map(int,input().split()))
acount = collections.Counter(alist)
a = acount.most_common()
a.sort()
alen = len(a)
MAX = 0
if alen == 1:
print(a[0][1])
elif alen == 2:
if abs(a[0][1]-a[1][1])<=2:
print(a[0][1]+a[1][1])
else:
print(max(a[0][1],a[1][... |
s864728295 | p03611 | u533885955 | 1549736605 | Python | Python (3.4.3) | py | Runtime Error | 145 | 16096 | 643 | import collections
N = int(input())
alist = list(map(int,input().split()))
acount = collections.Counter(alist)
a = acount.most_common()
a.sort()
MAX = 0
if N == 1:
print(1)
elif N == 2:
if abs(alist[0]-alist[1])<=2:
print(2)
else:
print(1)
else:
for i in range(N-2):
if abs(a[i][0... |
s147877458 | p03611 | u785578220 | 1548200543 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 23368 | 801 | import collections
import math
import re
import numpy
def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input(... |
s487783091 | p03611 | u785578220 | 1548199229 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 23376 | 778 | import collections
import math
import re
import numpy
def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input(... |
s476050418 | p03611 | u785578220 | 1548199190 | Python | Python (3.4.3) | py | Runtime Error | 352 | 23376 | 771 | import collections
import math
import re
import numpy
def ai():return input()#s
def a():return int(input())#a,n or k
def ma():return map(int, input().split())#a,b,c,d or n,k
def ms():return map(str, input().split())#,a,b,c,d
def lma():return list(map(int, input().split()))#x or y
def lms():return list(map(str, input(... |
s593734763 | p03611 | u213854484 | 1545858382 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 217 | N = int(input())
A = list(map(int, input().split()))
minA = min(A)
maxA = max(A)
list = [0]*max(A)
for i in range(minA+1,maxA):
L = A
L = [j for j in A if i-1 <= j <= i+1]
list[i]= len(L)
print(max(list))
|
s527931967 | p03611 | u017810624 | 1544834564 | Python | Python (3.4.3) | py | Runtime Error | 107 | 13964 | 198 | n=int(input())
a=list(map(int,input().split()))
l=[]
for i in range(max(a)+2):
l.append(0)
for j in range(n):
l[a[j]]+=1
m=[]
for i in range(max(a)):
m.append(l[i-1]+l[i]+l[i+1])
print(max(m)) |
s452603269 | p03611 | u017810624 | 1544832358 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14008 | 232 | n=int(input())
a=list(map(int,input().split()))
b=list(set(a))
l=[];m=[]
for i in range(len(b)):
l.append(a.count(b[i]))
if len(l)>2:
for j in range(len(l)-3):
m.append(l[j]+l[j+1]+l[j+2])
else:m.append(sum(l))
print(max(m)) |
s462943106 | p03611 | u993642190 | 1544823749 | Python | Python (3.4.3) | py | Runtime Error | 95 | 15972 | 455 | import collections as cl
N = int(input())
a_li = [i for i in input().split()]
c = cl.Counter(a_li)
keys = list(c.keys())
max_sum = 0
if (len(c) == 1) :
print(1)
elif (len(c) == 2) :
if (abs(a_li[0] - a_li[1]) <= 1 ) :
print(2)
else :
print(1)
else :
for k in range(len(c) -2 ) :
... |
s803521452 | p03611 | u993642190 | 1544823653 | Python | Python (3.4.3) | py | Runtime Error | 166 | 22500 | 496 | import collections as cl
N = int(input())
a_li = [i for i in input().split()]
c = cl.Counter(a_li)
print(c)
# for k in list(c.keys())[:-2] :
keys = list(c.keys())
max_sum = 0
if (len(c) == 1) :
print(1)
elif (len(c) == 2) :
if (abs(a_li[0] - a_li[1]) <= 1 ) :
print(2)
else :
print(1)
else :
... |
s569602759 | p03611 | u652150585 | 1541874982 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 374 | iimport collections
n=int(input())
l=list(map(int,input().split()))
s=collections.Counter(l)
s=list(s.items())
s=sorted(s,key=lambda x:x[0])
#print(s)
f=[0]*len(s)
for i in range(len(s)):
f[i]=s[i][1]
if i>=1:
if s[i-1][0]==s[i][0]-1:
f[i]+=s[i-1][1]
if i<=len(s)-2:
if s[i+1][0]... |
s908907859 | p03611 | u824237520 | 1541605209 | Python | Python (3.4.3) | py | Runtime Error | 152 | 15712 | 633 | n = int(input())
a = list(map(int, input().split()))
if n == 1:
print(1)
exit()
elif n == 2:
if abs(a[0] - a[1]) <= 2:
print(2)
else:
print(1)
exit()
d = {}
for x in a:
if x in d:
d[x] += 1
else:
d[x] = 1
d = sorted(d.items())
m = len(d)
ans = d[0][1]
if d... |
s807662861 | p03611 | u983918956 | 1541553822 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 269 | N = int(input())
A = list(map(int,input().split()))
count_list = []
if len(list(set(A))) == 1:
print(1)
else:
for i in range(min(A) + 1,max(A)):
count = A.count(i-1) + A.count(i) + A.count(i+1)
count_list.append(count)
print(max(count_list)) |
s236002071 | p03611 | u983918956 | 1541553748 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 271 | N = int(input())
A = list(map(int,input().split()))
count_list = []
if len(list(set(A))) == 1:
print("1")
else:
for i in range(min(A) + 1,max(A)):
count = A.count(i-1) + A.count(i) + A.count(i+1)
count_list.append(count)
print(max(count_list)) |
s320826863 | p03611 | u659100741 | 1540497774 | Python | Python (3.4.3) | py | Runtime Error | 42 | 13964 | 306 | N = int(input())
a = list(map(int, input().split()))
cnt = []
for i in range(N):
x = a[i]
count = 0
for j in range(N):
if count + len(a[j:]) < max(cnt):
break
if x == a[j] or x == a[j]+1 or x == a[j]-1:
count += 1
cnt.append(count)
print(max(cnt))
|
s422092230 | p03611 | u940102677 | 1539973610 | Python | Python (3.4.3) | py | Runtime Error | 43 | 14220 | 161 | import collections
n = int(input())
a = list(map(int,input().split()))
l = []
for x in a:
l +=[a-1,a,a+1]
c = collections.Counter(l)
print(c.most_common()[1])
|
s101545511 | p03611 | u853900545 | 1539651859 | Python | Python (3.4.3) | py | Runtime Error | 86 | 11480 | 302 | cnt=[0]*100002;input()
for x in map(int,input().split()):cnt[x]+=1;cnt[x+1]+=1;cnt[x+2]+=1
print(max(cnt))
#I understood
n = int(input())
a = list(map(int,input().split()))
d = [0]*(max(a)+3)
for i in range(0,max(a)+1):
c = a.count(i)
d[i+1] += c
d[i] += c
d[i+2] += c
print(max(d)) |
s511572239 | p03611 | u711295009 | 1538444630 | Python | Python (3.4.3) | py | Runtime Error | 167 | 13964 | 776 | n = int(input())
listA = list(map(int, input().split()))
listA.sort()
maxCount=0
index=0
if len(listA) == 1:
print(1)
else:
while index < len(listA):
flag=0
if index==0:
base = listA[index]
count=1
else:
if listA[index] == base+1 and flag==0:
... |
s374973283 | p03611 | u177040005 | 1537831003 | Python | Python (3.4.3) | py | Runtime Error | 265 | 23464 | 287 | import numpy as np
N = int(input())
A_ = list(map(int, input().split()))
A_ = sorted(A_)
A = np.array(A_)
dic = {}
for a in A:
dic[a] = 0
for a in A:
dic[a] += 1
ans = 0
for X in range(A[1],A[-1]):
tmp = dic[X-1] + dic[X] + dic[X+1]
ans = max(tmp,ans)
print(ans)
|
s814618639 | p03611 | u073775598 | 1536636240 | Python | Python (3.4.3) | py | Runtime Error | 87 | 14092 | 237 | #ABC072C
N=int(input())
A=list(map(int,input().split()))
max_A=max(A)
TGS=[0]*(max_A+1)
ans=0
for i in range(N):
TGS[A[i]]+=1
for i in range(max_A):
if ans<TGS[i]+TGS[i+1]+TGS[i+2]:
ans=TGS[i]+TGS[i+1]+TGS[i+2]
print(ans) |
s704057506 | p03611 | u525423408 | 1536298472 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14092 | 534 | n=int(input())
a=list(map(int,input().split()))
al=set(a)
al=list(al)
l=len(al)
a00=al[0]
a01=al[1]
a02=al[2]
a1=a.count(a00)#一個前の合計
if l==1:
print(a1)
exit()
a2=a.count(a01)#現在の合計
if l==2:
if abs(a00-a01)<=2:
print(a1+a2)
exit()
else:
print(max(a1,a2))
exit()
a3=a.count(... |
s657473884 | p03611 | u525423408 | 1536296217 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14092 | 511 | n=int(input())
a=list(map(int,input().split()))
if n==1:
print(1)
exit()
elif n==2:
if abs(a[0]-a[1])<=2:
print(2)
exit()
else:
print(1)
exit()
al=set(a)
al=list(al)
a1=a.count(al[0])#一個前の合計
a2=a.count(al[1])#現在の合計
a3=a.count(al[2])#一つ先の合計
count=0
result=0#最大値
al.append("... |
s031777792 | p03611 | u653642801 | 1536115781 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38896 | 364 | def main():
n = int(input())
a = list(map(int,input().split()))
ans_lst = [0 for i in range(max(a)+4)]
for i in a:
ans_lst[i] += 1
ans_lst[i+1] += 1
ans_lst[i-1] += 1
print(max(ans_lst))
i... |
s654383745 | p03611 | u474270503 | 1535847966 | Python | Python (3.4.3) | py | Runtime Error | 71 | 14008 | 345 | N=int(input())
p=list(map(int,input().split()))
q=['x' for _ in range(N)]
ans=0
for i in range(N):
if p[i]!=i+1:
q[i]='o'
for i in range(N-1):
if q[i]=='x':
if i<n-1:
p[i], p[i+1]=p[i+1], p[i]
else:
p[i], p[i-a1]=p[i-1], p[i]
q[i]='o'
q[i+1]='o'
... |
s296722332 | p03611 | u982762220 | 1531971406 | Python | Python (3.4.3) | py | Runtime Error | 54 | 13964 | 217 | N = int(input())
A = list(map(int, input().split()))
cnts = [0 for i in range(N + 1)]
for a in A:
cnts[a] += 1
res = 0
for idx in range(1, A - 1):
tmp = sum(A[idx-1:idx+1])
if tmp > res:
res = tmp
print(res) |
s669277537 | p03611 | u409064224 | 1531782022 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 417 | n = int(input())
a = [int(i) for i in input().split()]
a.sort()
l = list(set(a))
l_co = list()
if n == 1:
print(1)
elif n == 2:
if abs(a[0]-a[1]) <= 1:
print(2)
else:
print(1)
else:
for i in range(len(l)):
l_co.append(a.count(l[i]))
#print(l_co)
res_l = list()
for ... |
s170414242 | p03611 | u492532572 | 1531157748 | Python | Python (3.4.3) | py | Runtime Error | 48 | 13964 | 359 | N = int(input())
alist = list(map(int, input().split()))
aset = set(alist)
max_num = 0
X = 0
for x in xset:
num = len([xx for xx in alist if x == xx])
if max_num < num:
max_num = num
X = x
max_num = 0
for x in [X - 1, X, X + 1]:
num = len([xx for xx in alist if x - 1 <= xx <= x + 1])
max... |
s466883997 | p03611 | u492532572 | 1531083362 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 247 | N = int(input())
alist = list(map(int, input().split()))
min_x, max_x = min(alist), max(alist)
max_num = 0
for x in range(min_x, max_x + 1):
num = len([xx for xx in alist if x -1 <= xx <== x + 1])
max_num = max(max_num, num)
print(max_num) |
s869183593 | p03611 | u004025573 | 1530548314 | Python | Python (3.4.3) | py | Runtime Error | 60 | 14092 | 288 | N=int(input())
a = list(map(int, input().split()))
ans=[0]*max(a)
for i in range(N):
ans[a[i]-1]+=1
ll = [ans[0], ans[0]+ans[1], ans[N-2]+ans[N-1], ans[N-1]]
ans_a=max(ll)
for i in range(N-2):
aa = ans[i]+ans[i+1]+ans[i+2]
if aa>ans_a:
ans_a=aa
print(ans_a) |
s330109604 | p03611 | u883792993 | 1529705002 | Python | Python (3.4.3) | py | Runtime Error | 45 | 14008 | 200 | N=int(input())
A=list(map(int,input().split()))
number_of_items=0
for X in range(min(A)-1, max(A)+1):
number_of_items.append(A.count(X)+A.count(X-1)+A.count(X+1))
print(max(number_of_items)) |
s792854937 | p03611 | u698479721 | 1528918771 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13836 | 227 | N = int(input())
a = [int(i) for i in input().split()]
i = 0
b = []
while i <= 100000:
n = a.count(i)
b.append(n)
i += 1
l = len(b)
j = 1
c = []
while j < l:
nn = b[j-1]+b[j]+b[j+1]
c.append(nn)
j += 1
print(max(c)) |
s230298110 | p03611 | u281303342 | 1525135466 | Python | Python (3.4.3) | py | Runtime Error | 75 | 15312 | 183 | from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split())))
Ans = 0
B = A.most_common()
for n,c in B:
Ans = max(Ans,B[n]+B[n-1]+B[n+1])
print(Ans) |
s858169799 | p03611 | u944209426 | 1525025349 | Python | Python (3.4.3) | py | Runtime Error | 143 | 14564 | 236 | import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
m = max(1, min(a))
M = max(a)
ans=[]
for x in range(m,M):
ans.append(c[x-1]+c[x]+c[x+1])
if m == M:
ans.append(n)
print(max(ans)) |
s781335740 | p03611 | u944209426 | 1525025198 | Python | Python (3.4.3) | py | Runtime Error | 146 | 14556 | 209 | import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
ans=[]
m = max(1, min(a))
M = max(a)+1
for x in range(m,M):
ans.append(c[x-1]+c[x]+c[x+1])
print(max(ans)) |
s905636878 | p03611 | u503901534 | 1524841448 | Python | Python (3.4.3) | py | Runtime Error | 42 | 14092 | 526 | n = int(input())
a = list(map(int,input().split()))
dics = {}
for i in range(len(n)):
if a[i] in dics:
dics[a[i]] = dics[a[i]] + 1
else:
dics.update({a[i]:1})
#dics min max
dicsmin = min(list(dics.keys()))
dicsmax = max(list(dics.keys()))
counter = []
for i in range(dicsmin,dicsmax + 1):
... |
s133617466 | p03611 | u050428930 | 1523390566 | Python | Python (3.4.3) | py | Runtime Error | 78 | 13964 | 245 | N=int(input())
d={}
for i in list(map(int,input().split())):
d[i]=d.get(i,0)+1
d=list(d.values())
if len(d)<3:
ans=sum(d)
else:
for j in range(len(d)-2):
s=d[j]+d[j+1]+d[j+2]
if s>ans:
ans=s
print(ans) |
s153384810 | p03611 | u050428930 | 1523390462 | Python | Python (3.4.3) | py | Runtime Error | 72 | 14004 | 245 | N=int(input())
d={}
for i in list(map(int,input().split())):
d[i]=d.get(i,0)+1
d=list(d.values())
if len(d)<3:
ans=sum(d)
else:
for j in range(len(d)-2):
s=d[j]+d[j+1]+d[j+2]
if s>ans:
ans=s
print(ans) |
s646317113 | p03611 | u050428930 | 1523386490 | Python | Python (3.4.3) | py | Runtime Error | 67 | 14180 | 242 | N=int(input())
d={}
for i in list(map(int,input().split())):
d[i]=d.get(i,0)+1
d=list(d.values())
if len(d)>=3:
for j in range(len(d)-2):
s=d[j]+d[j+1]+d[j+2]
if s>ans:
ans=s
else:
ans=max(d)
print(ans) |
s947015822 | p03611 | u497046426 | 1520558690 | Python | Python (3.4.3) | py | Runtime Error | 112 | 13964 | 384 | N = int(input())
A = list(map(int, input().split()))
maximum = max(A)
count = [0]*(maximum + 1)
for i in range(N):
if A[i] == 0:
count[0] += 1
count[1] += 1
elif A[i] == maximum:
count[A[i]] += 1
count[A[i] - 1] += 1
else:
count[A[i] + 1] += 1
... |
s697359035 | p03611 | u497046426 | 1520558604 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 365 | N = int(input())
A = list(map(int, input().split()))
count = [0]*(max(A) + 1)
for i in range(N):
if A[i] == 0:
count[0] += 1
count[1] += 1
elif A[i] == max(A):
count[A[i]] += 1
count[A[i] - 1] += 1
else:
count[A[i] + 1] += 1
count[A[i]] += 1
... |
s856662777 | p03611 | u497046426 | 1520554237 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 373 | N = int(input())
A = list(map(int, input().split()))
count = [0 for i in range(max(A) + 1)]
for i in range(N):
if A[i] == 0:
count[A[i]] += 1
count[A[i] + 1] += 1
elif A[i] == max(A):
count[A[i]] += 1
count[A[i] - 1] += 1
else:
count[A[i] + 1] += 1
count[A[i]... |
s508836311 | p03611 | u789417951 | 1513828247 | Python | Python (3.4.3) | py | Runtime Error | 174 | 14564 | 388 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = 0
for i in range(max(A)+1):
ans = max(C[i] + C[i-1] + C[i+1], ans)
print(ans)
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = 0
for i in rang... |
s161148363 | p03611 | u495415554 | 1511128868 | Python | Python (3.4.3) | py | Runtime Error | 177 | 14564 | 198 | import collections
N = int(input())
a = list(map(int, input().split()))
a.sort()
v = list(collections.Counter(a).values())
sum = [v[i] + v[i+1] + v[i+2] for i in range(len(v)-2)]
print(max(sum))
|
s389036798 | p03611 | u926678805 | 1507689803 | Python | Python (3.4.3) | py | Runtime Error | 57 | 11348 | 175 | dic={}
for i in range(10001):
dic[i]=0
input()
for n in map(int,input().split()):
dic[n]+=1
m=0
for i in range(1,9999):
m=max(m,dic[i]+dic[i+1]+dic[i+2])
print(m)
|
s781853726 | p03611 | u364618491 | 1507667585 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 315 | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
int n;
vector<int> v(100002,0);
cin>>n;
for(;n--;){
int p;
cin>>p;
v[p]++;
v[p+1]++;
v[p+2]++;
}
cout<<v[max_element(v.begin(),v.end())-v.begin()];
}
|
s662555771 | p03611 | u816428863 | 1507005825 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 229 | N = int(input())
A = list(map(int,input().split()))
ans = [0]*max(A)
if N ==1:
ans[0] = 1
else:
for X in range(max(A)):
for i in range(N):
if abs(X-A[i])<=1:
ans[X]+=1
print(max(ans)) |
s931954126 | p03611 | u966695411 | 1506639748 | Python | Python (3.4.3) | py | Runtime Error | 27 | 10712 | 146 | input()
d = {}
for i in map(int, input().split()):
if i in d:
d[i] = 1
else:
d[i] += 1
print(sorted(d.values())[-1])
|
s229535462 | p03611 | u813450984 | 1506303547 | Python | Python (3.4.3) | py | Runtime Error | 71 | 14004 | 199 | N = int(input())
A = list(map(int, input().split()))
count = 0
target = A[1]
for i in range(N - 1):
if target == A[i] or target - 1 == A[i] or target + 1 == A[i]:
count += 1
print(count) |
s579828079 | p03611 | u479485961 | 1505250602 | Python | Python (3.4.3) | py | Runtime Error | 77 | 14004 | 226 | # -*- encoding: utf-8 -*-
n = int(input().rstrip())
array = list(map(int, input().rstrip().split(' ')))
count = [0] * 100000
for a in array:
count[a - 1] += 1
count[a ] += 1
count[a + 1] += 1
print(max(count)) |
s692687258 | p03611 | u479485961 | 1505250363 | Python | Python (3.4.3) | py | Runtime Error | 112 | 14092 | 237 | # -*- encoding: utf-8 -*-
n = int(input().rstrip())
array = sorted(list(map(int, input().rstrip().split(' '))))
count = [0] * (10 ** 5)
for a in array:
count[a - 1] += 1
count[a ] += 1
count[a + 1] += 1
print(max(count)) |
s881724259 | p03611 | u231552419 | 1505139825 | Python | Python (3.4.3) | py | Runtime Error | 67 | 14092 | 162 | N = int(input())
nums = [0] * 10000
data = list(map(int, input().split()))
for A in data:
nums[A-1] += 1
nums[A] += 1
nums[A+1] += 1
print(max(nums))
|
s407965518 | p03611 | u621935300 | 1504995562 | Python | Python (2.7.6) | py | Runtime Error | 2105 | 23248 | 498 | import sys
N=input()
a=map(int, raw_input().split())
#print a
#print max(a)
dict={}
for i in range(len(a)):
if a[i] in dict:
dict[ a[i] ]+=1
else:
dict[ a[i] ]=1
#print dict
for j in range(max(a)):
if not j in dict:
dict[j]=0
#print dict
max_sum=0
for key,value in dict.items():
if key==0:
sum=dic... |
s190016751 | p03611 | u835709901 | 1504994980 | Python | Python (3.4.3) | py | Runtime Error | 40 | 13964 | 152 | N = int(input())
a = list(map(int, input().split()))
res = [0] * 100000
for i in a:
list[i] += 1
print(max(map(sum,zip(list, list[1:], list[2:])))) |
s208217966 | p03611 | u628262476 | 1504905154 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 118 | c=[0]*114514;input();for i in map(int,input().split()):; c[i]+=1;print(max([sum(c[i:i+3]) for i in range(100000)])) |
s262373272 | p03611 | u112465297 | 1504759629 | Python | Python (3.4.3) | py | Runtime Error | 67 | 13964 | 144 | N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10009
for t in a:
cnt[t] += 1
cnt[t-1] += 1
cnt[t+1] += 1
print(max(cnt)) |
s108728235 | p03611 | u112465297 | 1504759499 | Python | Python (3.4.3) | py | Runtime Error | 67 | 13964 | 145 | N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10000
for t in a:
cnt[t] += 1
cnt[t-1] += 1
cnt[t+1] += 1
print(max(cnt))
|
s974068385 | p03611 | u112465297 | 1504759417 | Python | Python (3.4.3) | py | Runtime Error | 67 | 13964 | 144 | N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10000
for t in a:
cnt[t] += 1
cnt[t-1] += 1
cnt[t+1] += 1
print(max(cnt)) |
s198956184 | p03611 | u112465297 | 1504759338 | Python | Python (3.4.3) | py | Runtime Error | 74 | 13964 | 153 | N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10000
print(a)
for t in a:
cnt[t] += 1
cnt[t-1] += 1
cnt[t+1] += 1
print(max(cnt)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.