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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s360761256 | p03611 | u755180064 | 1585522210 | Python | PyPy3 (2.4.0) | py | Runtime Error | 169 | 38256 | 512 | import read_val
import copy
def main():
t = input()
if t == "1":
print(1)
exit(0)
li = [int(v) for v in input().split(' ')]
s_li = sorted(li)
count = 0
for v in range(s_li[0] - 1, s_li[-1] + 1):
t_c = 0
for vv in s_li:
if v == vv or v - 1 == vv or v ... |
s135065417 | p03611 | u755180064 | 1585520146 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 373 | def main():
t = input()
if t == "1":
print(input())
li = [int(v) for v in input().split(' ')]
s_li = sorted(li)
count = 0
for v in s_li:
list_2 = list(filter(lambda x: x == v - 1 or x == v or x == v + 1, s_li))
if len(list_2) > count:
count = len(list_2)
... |
s180011509 | p03611 | u755180064 | 1585520104 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 404 | import read_val
import copy
def main():
t = input()
if t == "1":
print(input())
li = [int(v) for v in input().split(' ')]
s_li = sorted(li)
count = 0
for v in s_li:
list_2 = list(filter(lambda x: x == v - 1 or x == v or x == v + 1, s_li))
if len(list_2) > count:
... |
s117087787 | p03611 | u637451088 | 1585374511 | Python | Python (3.4.3) | py | Runtime Error | 101 | 13964 | 294 | import sys
n = int(input())
a = list(map(int, input().split()))
bucket = [0 for i in range(max(a) + 1)]
for i in range(n):
bucket[a[i]] += 1
sum_three_num = []
for i in range(1, len(bucket) - 1):
sum_three_num.append(bucket[i-1] + bucket[i] + bucket[i+1])
print(max(sum_three_num)) |
s466911190 | p03611 | u420130252 | 1585347405 | Python | PyPy3 (2.4.0) | py | Runtime Error | 214 | 52652 | 181 | from collections import Counter
n=int,input()
a=list(map(int,input().split()))
for i in range(n):
a.append(a[i]-1)
a.append(a[i]+1)
c=Counter(a).most_common()
print(c[0][1]) |
s060246914 | p03611 | u420130252 | 1585347222 | Python | PyPy3 (2.4.0) | py | Runtime Error | 233 | 52908 | 208 | n=int,input()
a=list(map(int,input().split()))
m=max(a)
n=min(a)
for i in range(n,m+1):
pre=0
for j in range(len(a)):
if i-1<=a[j]<=i+1:
pre+=1
ans=max(ans,pre)
print(ans) |
s817526612 | p03611 | u479638406 | 1585171072 | Python | Python (3.4.3) | py | Runtime Error | 92 | 14004 | 172 | n = int(input())
a = list(map(int,input().split()))
ans = [0] * int(1e5)
for i in range(n):
ans[a[i]-1] += 1
ans[a[i]] += 1
ans[a[i]+1] += 1
print(max(ans))
|
s105700386 | p03611 | u652569315 | 1584400588 | Python | Python (3.4.3) | py | Runtime Error | 65 | 13432 | 235 | def main():
import sys
input = sys.stdin.readline
n=input()
a=tuple(map(int,input().split()))
cnt=[0]*(max(a)+2)
for i in a:
cnt[i]+= 1
print(max(map(sum,zip(cnt,cnt[1:],cnt[2:]))))
if __name__=='__main__':
main() |
s450626713 | p03611 | u253952966 | 1584154893 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 603 | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define len(array) (sizeof(array) / sizeof(array[0]))
#define a... |
s447715947 | p03611 | u075595666 | 1584122696 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 13836 | 382 | n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
ans = []
for i in range(n):
for j in range(n-1):
if j >= i:
if a[j]-a[i] <= 2:
#print(i,j)
count += 1
else:
if count != 0:
ans.append(count)
count = 0
i += 1
else:
cont... |
s105277529 | p03611 | u075595666 | 1584122638 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38256 | 296 | ans = []
for i in range(n):
for j in range(n-1):
if j >= i:
if a[j]-a[i] <= 2:
#print(i,j)
count += 1
else:
if count != 0:
ans.append(count)
count = 0
i += 1
else:
continue
if n == 1:
print(1)
else:
print(max(ans)) |
s880365105 | p03611 | u977193988 | 1584015774 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 103648 | 453 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
if N >= 3:
counter = Counter(A)
m = min(A)
M = max(A)
cnt = []
for i in range(m, M - 1):
ans = counter[i] + counter[i + 1] + counter[i + 2]
if ans:
cnt.append(ans)
print(cnt)
... |
s691166210 | p03611 | u977193988 | 1584015499 | Python | Python (3.4.3) | py | Runtime Error | 142 | 14564 | 396 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
if N >= 3:
counter = Counter(A)
m = min(A)
M = max(A)
cnt = []
for i in range(m, M - 2):
cnt.append(counter[i] + counter[i + 1] + counter[i + 2])
print(max(cnt))
elif N == 2:
if abs(A[0] - A[1]) <... |
s541691616 | p03611 | u263824932 | 1583968481 | Python | Python (3.4.3) | py | Runtime Error | 99 | 15500 | 199 | N=int(input())
A=[0]*10**5
b=input().split()
numbers=[int(a) for a in b]
for a in numbers:
A[a-1]+=1
list=[]
for z in range(10**5-1):
y=A[z]+A[z+1]+A[z+2]
list.append(y)
print(max(list))
|
s874487452 | p03611 | u953794676 | 1583934075 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 17180 | 314 | import sys
n = input()
a = list(map(int, input().split()))
ans_dict = {}
if len(a)==1:
print(a[0])
sys.exit()
for X in range(min(a), max(a)):
ans_dict[str(X)] = 0
for j in a:
if X == j or X == j-1 or X == j+1:
ans_dict[str(X)] = ans_dict[str(X)]+1
print(max(ans_dict.values())) |
s887347352 | p03611 | u953794676 | 1583933444 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 17184 | 257 | n = input()
a = list(map(int, input().split()))
ans_dict = {}
for X in range(min(a), max(a)):
ans_dict[str(X)] = 0
for j in a:
if X == j or X == j-1 or X == j+1:
ans_dict[str(X)] = ans_dict[str(X)]+1
print(max(ans_dict.values())) |
s870639936 | p03611 | u697696097 | 1583902680 | Python | Python (3.4.3) | py | Runtime Error | 87 | 13876 | 245 | import sys
readline=sys.stdin.readline
n=int(readline())
aa=list(map(int,readline().split()))
laa=len(aa)
cnt=[0]*(10**5+3)
for i in range(laa):
if i > 0:
aa[i-1]+=1
aa[i]+=1
aa[i+1]+=1
ans=0
for _ in aa:
ans=max(ans,_)
print(ans) |
s494740973 | p03611 | u325956328 | 1583800170 | Python | Python (3.4.3) | py | Runtime Error | 114 | 13964 | 364 | N = int(input())
a = list(map(int, input().split()))
# いもす法 imos法
imos = [0] * (10 ** 5 + 1)
for i in range(N):
l, r, s = a[i] - 1, a[i] + 1, 1
l += 1
r += 1
# print(l, r)
imos[l] += s
imos[r + 1] -= s
for i in range(N + 1):
imos[i + 1] = imos[i] + imos[i + 1]
# print(imos[: max(a) + 3]... |
s546678760 | p03611 | u217627525 | 1583084687 | Python | Python (3.4.3) | py | Runtime Error | 108 | 13964 | 217 | n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=[-1,0]
i=0
while i<n-1:
res=0
while a[i+res]-a[i]<=2:
res+=1
if res>ans[1]:
ans[1]=res
ans[0]=i
i+=res
print(ans[1]) |
s454098575 | p03611 | u703214333 | 1582675369 | Python | Python (3.4.3) | py | Runtime Error | 156 | 13964 | 206 | n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
cnt=[0]*(10**5)
for i in range(n):
cnt[a[i]]+=1
for i in range(n):
tmp=cnt[a[i]]+cnt[a[i]+1]+cnt[a[i]+2]
ans=max(tmp,ans)
print(ans) |
s288217919 | p03611 | u703214333 | 1582675318 | Python | Python (3.4.3) | py | Runtime Error | 156 | 13964 | 208 | n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
cnt=[0]*(10**5)
for i in range(n):
cnt[a[i]]+=1
for i in range(n-1):
tmp=cnt[a[i]]+cnt[a[i]+1]+cnt[a[i]+2]
ans=max(tmp,ans)
print(ans) |
s220626628 | p03611 | u595289165 | 1582304539 | Python | Python (3.4.3) | py | Runtime Error | 181 | 16096 | 436 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
x = Counter(a)
cnt = sorted(x.items(), key=lambda x: x[0], reverse=True)
ans = 0
for i in range(len(cnt)):
x = cnt[i][1]
print(x)
if i != 0:
if cnt[i][0] == cnt[i-1][0] - 1:
x += cnt[i-1][1]
if i == ... |
s855265539 | p03611 | u426572476 | 1582093412 | Python | Python (3.4.3) | py | Runtime Error | 96 | 16084 | 286 | import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
cnt = [0] * 10 ** 5
for i in a:
cnt[i - 1] += 1
cnt[i] += 1
cnt[i + 1] += 1
print(max(cnt))
|
s636131892 | p03611 | u488934106 | 1581785769 | Python | PyPy3 (2.4.0) | py | Runtime Error | 209 | 52292 | 325 | def together(n , a):
listans = [0]*(10**5)
for i in range(n):
listans[a[i] - 1] += 1
listans[a[i]] += 1
listans[a[i] + 1] += 1
return max(listans)
def main():
n = int(input())
a = list(map(int,input().split()))
print(together(n , a))
if __name__ == '__main__':
m... |
s412865600 | p03611 | u268792407 | 1580810088 | Python | Python (3.4.3) | py | Runtime Error | 71 | 17124 | 177 | n=int(input())
a=list(map(int,input().split()))
b=a.copy()
for i in a:
b.append(i-1)
b.append(i+1)
import collection
c=collection.Counter(b)
d=c.most_common()
print(d[0][1]) |
s689176287 | p03611 | u361381049 | 1580330847 | Python | Python (3.4.3) | py | Runtime Error | 24 | 9944 | 154 | n = int(input())
a = list(map(int(input().split())))
cnt = [0] * int(1e6)
for i in a:
cnt[i-1] += 1
cnt[i] += 1
cnt[i+1] += 1
print(max(cnt))
|
s554960122 | p03611 | u566529875 | 1580064321 | Python | Python (3.4.3) | py | Runtime Error | 99 | 13964 | 194 | n=int(input())
a=list(map(int,input().split()))
pl = [0]*(n+5)
for i in range(n):
num = a[i]
pl[num-1] += 1
pl[num+2] -= 1
for i in range(1,n):
pl[i] += pl[i-1]
print(max(pl)) |
s111924075 | p03611 | u566529875 | 1580064281 | Python | Python (3.4.3) | py | Runtime Error | 97 | 13964 | 196 | n=int(input())
a=list(map(int,input().split()))
pl = [0]*(n+5)
for i in range(n):
num = a[i]
pl[num-1] += 1
pl[num+2] -= 1
for i in range(1,n+4):
pl[i] += pl[i-1]
print(max(pl)) |
s980864619 | p03611 | u273010357 | 1579748450 | Python | Python (3.4.3) | py | Runtime Error | 45 | 14220 | 390 | from collections import defaultdict
n = int(input())
li = list(map(int, input().split()))
li_conut = defaultdict(int)
# 要素ごとの出現数を記録
for a in li:
li_count[a] += 1
max_x_count = 0
for x in range(1, 10**5):
# xにできるやつの個数
x_conut = li_conut[x-1] + li_conut[x] + li_conut[x+1]
max_x_count = max(max_x_coun... |
s463227658 | p03611 | u431981421 | 1578935278 | Python | Python (3.4.3) | py | Runtime Error | 962 | 23368 | 253 | import numpy as np
li = np.array([])
N=int(input())
li = list(map(int, input().split()))
arr = np.array(li)
max = 0
for i in range(100000 + 1):
a = np.count_nonzero(arr == i or arr == (i + 1) or arr == (i - 1))
if max < a:
max = a
print(a) |
s533509660 | p03611 | u597455618 | 1578852420 | Python | Python (3.4.3) | py | Runtime Error | 60 | 13964 | 180 | def main():
n = int(input())
a = list(map(int, input().split()))
ans = [0] * 10**5
for i in a:
ans[i] += 1
ans[i+1] += 1
ans[i+2] += 1
print(max(ans))
main() |
s719106343 | p03611 | u071416928 | 1578349857 | Python | Python (3.4.3) | py | Runtime Error | 40 | 13964 | 207 | n = int(input())
a = list( map( int, input().split() ) )
cnt = [0]*10^5
for j in a:
for num in range(10^5):
if j-1 == num or j == num or j+1 == num:
cnt[num] += 1
print(max(cnt)) |
s424011267 | p03611 | u071416928 | 1578349795 | Python | Python (3.4.3) | py | Runtime Error | 41 | 14008 | 205 | n = int(input())
a = list( map( int, input().split() ) )
cnt = [0]*10^5
for j in a:
for num in range(10^5):
if j-1 == num or j == num or j+1 == num:
cnt[i] += 1
print(max(cnt)) |
s055316675 | p03611 | u626468554 | 1577502852 | Python | Python (3.4.3) | py | Runtime Error | 59 | 13964 | 191 | n = int(input())
a = list(map(int,input().split()))
li = [0 for i in range(n)]
for i in range(n):
li[a[i]] += 1
x = 0
for i in range(1,n-1):
x = max(li[i-1]+li[i]+li[i+1])
print(x) |
s640600734 | p03611 | u768896740 | 1577047011 | Python | Python (3.4.3) | py | Runtime Error | 139 | 14556 | 910 | import collections
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
c = collections.Counter(a)
d = list(c.keys())
e = list(c.values())
if n == 1:
print(1)
exit()
elif n == 2:
if a[0] == a[1] or abs(a[0] - a[1]) == 1:
print(2)
exit()
else:
print(1)
... |
s488247879 | p03611 | u768896740 | 1577046308 | Python | Python (3.4.3) | py | Runtime Error | 136 | 14564 | 718 | import collections
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
c = collections.Counter(a)
d = list(c.keys())
e = list(c.values())
if n == 1:
print(1)
exit()
elif n == 2:
if a[0] == a[1] or abs(a[0] - a[1]) == 1:
print(2)
exit()
else:
print(1)
... |
s754255005 | p03611 | u600402037 | 1576971712 | Python | Python (3.4.3) | py | Runtime Error | 387 | 23428 | 409 | import sys
import numpy as np
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to only numbers
rs = lambda: stdin.readline().rstrip() # ignores trailing space
N = ri()
A = np.array(rl())
answer = 0
c = np.bincount(A)
for i in range(1, len(c)):
result = c... |
s113562950 | p03611 | u653485478 | 1576682521 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 307 | n = int(input())
a = list(map(int, input().split()))
a.sort()
cur = a[0]
ans1 = 1
ans = 1
for i in range(max(a)+1):
if a[i + 1] - a[i] <= 2:
cur = a[i]
ans1 = a.count(cur) + a.count(cur + 1) + a.count(cur + 2)
if ans < ans1:
ans = ans1
ans1 = 0
print(ans) |
s893691010 | p03611 | u934052933 | 1576618184 | Python | PyPy3 (2.4.0) | py | Runtime Error | 206 | 52652 | 296 | N = int(input())
a = list(map(int, input().split()))
a_dict = Counter(a)
keys = a_dict.keys()
max_count = 0
for key in keys:
tmp_count = 0
for i in keys:
if key + 1 == i or key - 1 == i or key == i:
tmp_count += a_dict[i]
if tmp_count > max_count:
max_count = tmp_count
print(max_count) |
s975920272 | p03611 | u934052933 | 1576609353 | Python | Python (3.4.3) | py | Runtime Error | 56 | 14564 | 434 | from collections import Counter
def main():
N = int(input())
a = list(map(int, input().split()))
a_dict = Counter(a)
max_count = 0
for key in a_dict.keys():
tmp_count = 0
for i in a_dict.key():
if abs(key - i) <= 1:
tmp_count += a_dict[i]
if tmp... |
s344078292 | p03611 | u934052933 | 1576602295 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38608 | 784 | from collections import Counter
from typing import List, Set
def main()->None:
# a_iに1を足すか、1引くか、何もしないかの操作を行って、ある整数個数最大化をする
# x を決めるとgreedyに決まる。
# 最後の一つのサンプルがTLEになる。jit の使い方もよくわからん
N: int = int(input())
a: List[int] = list(map(int, input().split()))
set_a: Set[int] = set(a)
max_count: int ... |
s727298408 | p03611 | u852798899 | 1576378461 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 190 | n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(max(a))]
for i in a:
ans[i-1]+=1
if i <max(a):
ans[i]+=1
if i-2 >= 0:
ans[i-2]+=1
print(max(ans)) |
s627087511 | p03611 | u904943473 | 1575812824 | Python | PyPy3 (2.4.0) | py | Runtime Error | 285 | 65384 | 236 | N = int(input())
A = list(map(int, input().split()))
dct = {}
for i in range(-1,10**5):
dct[i] = 0
for i in A:
dct[i-1] += 1
dct[i] += 1
dct[i+1] += 1
sorted_dct = sorted(dct.items(), key=lambda x:-x[1])
print(sorted_dct[0][1]) |
s231709922 | p03611 | u904943473 | 1575812739 | Python | PyPy3 (2.4.0) | py | Runtime Error | 217 | 61548 | 233 | N = int(input())
A = list(map(int, input().split()))
dct = {}
for i in range(10**5):
dct[i] = 0
for i in A:
dct[i-1] += 1
dct[i] += 1
dct[i+1] += 1
sorted_dct = sorted(dct.items(), key=lambda x:-x[1])
print(sorted_dct[0][1]) |
s093336125 | p03611 | u527261492 | 1574299881 | Python | Python (3.4.3) | py | Runtime Error | 72 | 16096 | 849 | import collections
import sys
n=int(input())
a=list(map(int,input().split()))
A=collections.Counter(a)
b=list(A.items())
b.sort()
cnt=0
if len(b)==1:
print(b[0][1])
sys.exit()
if len(b)==2:
if int(b[1][0])-int(b[0][0])==1:
print(b[1][1]+b[0][1])
sys.exit()
else:
print(max(b[1][1],b[0][1]))
sys.e... |
s625073730 | p03611 | u527261492 | 1574299726 | Python | Python (3.4.3) | py | Runtime Error | 70 | 16096 | 792 | import collections
import sys
n=int(input())
a=list(map(int,input().split()))
if n==1:
print(1)
sys.exit()
if n==2:
if abs(a[1]-a[0])<2:
print(2)
sys.exit()
else:
print(1)
sys.exit()
A=collections.Counter(a)
b=list(A.items())
b.sort()
cnt=0
for i in range(len(b)-2):
if int(b[i+2][0])-int(b... |
s292775456 | p03611 | u527261492 | 1574299478 | Python | Python (3.4.3) | py | Runtime Error | 70 | 16096 | 681 | import collections
import sys
n=int(input())
a=list(map(int,input().split()))
if n==1:
print(1)
sys.exit()
if n==2:
if abs(a[1]-a[0])<2:
print(2)
sys.exit()
else:
print(1)
sys.exit()
A=collections.Counter(a)
b=list(A.items())
b.sort()
cnt=0
for i in range(len(b)-2):
if int(b[i+2][0])-int(b... |
s800041950 | p03611 | u527261492 | 1574297698 | Python | Python (3.4.3) | py | Runtime Error | 78 | 14564 | 198 | import collections
n=int(input())
a=list(map(int,input().split()))
A=collections.Counter(a)
b=list(A.values())
b.sort()
lst=[]
for i in range(len(b)-1):
lst.append(b[i]+b[i+1])
print(max(lst))
|
s873102112 | p03611 | u325282913 | 1574051217 | Python | Python (3.4.3) | py | Runtime Error | 85 | 13964 | 324 | N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if max(arr) == 1:
print(len(arr))
exit()
for i in range(N):
arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
tmp = tmp - arr2[i-3] + arr2[i]
if ans < tmp:
ans = tmp
print(... |
s504173157 | p03611 | u325282913 | 1574051091 | Python | Python (3.4.3) | py | Runtime Error | 86 | 14004 | 311 | N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
if len(arr2) == 3:
arr2 = [0]*4
for i in range(N):
arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
tmp = tmp - arr2[i-3] + arr2[i]
if ans < tmp:
ans = tmp
print(ans) |
s611710712 | p03611 | u325282913 | 1574050753 | Python | Python (3.4.3) | py | Runtime Error | 83 | 13964 | 275 | N = int(input())
arr = list(map(int, input().split()))
arr2 = [0]*(max(arr)+1)
for i in range(N):
arr2[arr[i]] += 1
ans = arr2[1] + arr2[2] + arr2[3]
tmp = ans
for i in range(4,len(arr2)):
tmp = tmp - arr2[i-3] + arr2[i]
if ans < tmp:
ans = tmp
print(ans) |
s369292118 | p03611 | u047816928 | 1573712580 | Python | Python (3.4.3) | py | Runtime Error | 118 | 13964 | 126 | N = int(input())
A = list(map(int, input().split()))
M = [0]*(N+10)
for a in A:
for i in range(3): M[a+i]+=1
print(max(M)) |
s429758510 | p03611 | u768896740 | 1573130256 | Python | Python (3.4.3) | py | Runtime Error | 127 | 13964 | 560 | n = int(input())
a = list(map(int, input().split()))
if n == 1:
print(1)
exit()
a.sort()
li = []
count = 1
for i in range(n-1):
if a[i] == a[i+1]:
count += 1
else:
li.append(count)
count = 1
li.sort()
count2 = 0
if len(li) == 1:
print(li[0])
exit()
elif len(li) == 2:
... |
s198695638 | p03611 | u768896740 | 1573103409 | Python | Python (3.4.3) | py | Runtime Error | 128 | 13964 | 365 | n = int(input())
a = list(map(int, input().split()))
if n == 1:
print(1)
exit()
a.sort()
li = []
count = 1
for i in range(n-1):
if a[i] == a[i+1]:
count += 1
else:
li.append(count)
count = 1
li.sort()
count2 = 0
for i in range(len(li)-2):
x = li[i] + li[i+1] + li[i+2]
i... |
s951239666 | p03611 | u148551245 | 1572912894 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 210 | n = int(input())
array = list(map(int,input().split()))
i = 0
three_num = list()
while i + 2 < n:
three_num.append(array.count(i) + array.count(i + 1) + array.count(i + 2))
i += 1
print(max(three_num)) |
s998230360 | p03611 | u185325486 | 1572616312 | Python | Python (3.4.3) | py | Runtime Error | 117 | 13964 | 163 | N = int(input())
A = [int(i) for i in input().split(' ')]
A.sort()
B = [0]*(A[N-1]-A[0]+3)
for a in A:
B[a] += 1
B[a-1] += 1
B[a+1] += 1
print(max(B)) |
s470245578 | p03611 | u002459665 | 1572494472 | Python | Python (3.4.3) | py | Runtime Error | 66 | 14092 | 236 | def main():
N = int(input())
A = list(map(int, input().split()))
c = [0] * (100000 + 1)
for ai in A:
c[ai+1] += 1
c[ai] += 1
c[ai+2] += 1
print(max(c))
if __name__ == "__main__":
main() |
s177405714 | p03611 | u321623101 | 1572464998 | Python | Python (3.4.3) | py | Runtime Error | 110 | 13964 | 174 | N=int(input())
a=list(map(int,input().split()))
m=max(a)
c=[0]*(m+1)
for i in a:
c[i]=c[i]+1
T=c[0]+c[1]+c[2]
for i in range(m):
T=max(T,c[i-1]+c[i]+c[i+1])
print(T) |
s125296469 | p03611 | u614875193 | 1572291282 | Python | Python (3.4.3) | py | Runtime Error | 151 | 13964 | 246 | N=int(input())
A=sorted(list(map(int,input().split())))
C=[0]*(max(A)+1)
for i in A:
C[i]+=1
if len(C)==0:
print(C[0])
else:
T=max(C[0]+C[1],C[-1]+C[-2])
for i in range(1,max(A)):
T=max(T,C[i-1]+C[i]+C[i+1])
print(T) |
s291594462 | p03611 | u614875193 | 1572291170 | Python | Python (3.4.3) | py | Runtime Error | 141 | 13964 | 195 | N=int(input())
A=sorted(list(map(int,input().split())))
C=[0]*(max(A)+1)
for i in A:
C[i]+=1
T=max(C[0]+C[1],C[-1]+C[-2])
for i in range(1,max(A)):
T=max(T,C[i-1]+C[i]+C[i+1])
print(T) |
s398873042 | p03611 | u644907318 | 1571140047 | Python | Python (3.4.3) | py | Runtime Error | 137 | 13964 | 432 | N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
flag = 1
cur0 = 0
cur1 = 0
cur2 = 0
cnt = 0
for i in range(1,N):
if A[i]>A[i-1]:
flag += 1
if flag==1:
cur1 = i
elif flag==2:
cur2 = i
elif flag==3:
cnt = max(cnt,i-cur0)
... |
s464380199 | p03611 | u644907318 | 1571139795 | Python | Python (3.4.3) | py | Runtime Error | 132 | 14008 | 472 | N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
flag = 1
cur0 = 0
cur1 = 0
cur2 = 0
cnt = 0
for i in range(1,N):
if A[i]>A[i-1]:
flag += 1
if flag==1:
cur1 = i
elif flag==2:
cur2 = i
elif flag==3:
cnt = max(cnt,i-cur0)
... |
s370844563 | p03611 | u527261492 | 1570584409 | Python | PyPy3 (2.4.0) | py | Runtime Error | 2107 | 57532 | 228 | n=int(input())
a=list(map(int,input().split()))
a.sort()
CNT=[]
cnt=0
for i in range(n-1):
for j in range(n-i):
if a[i+j]-a[i]<2:
cnt+=1
else:
CNT.append(cnt)
cnt-=cnt
break
print(max(CNT))
|
s602020319 | p03611 | u527261492 | 1570583984 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14004 | 221 | n=int(input())
a=list(map(int,input().split()))
a.sort()
CNT=[]
cnt=0
for i in range(n-1):
cnt=0
for j in range(n-i):
if a[i+j]-a[i]<2:
cnt+=1
else:
CNT.append(cnt)
break
print(max(CNT))
|
s529357345 | p03611 | u527261492 | 1570583822 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 219 | n=int(input())
a=list(map(int,input().split()))
a.sort()
CNT=[]
for i in range(n-1):
cnt=0
for j in range(n-i):
if abs(a[i+j]-a[i])<2:
cnt+=1
else:
CNT.append(cnt)
break
print(max(CNT))
|
s958667645 | p03611 | u379959788 | 1570307261 | Python | Python (3.4.3) | py | Runtime Error | 81 | 14092 | 159 | # TLE
N = int(input())
a = list(map(int, input().split()))
cnt = [0] * 100000
for i in a:
cnt[i] += 1
cnt[i+1] += 1
cnt[i-1] += 1
print(max(cnt)) |
s025318856 | p03611 | u471684875 | 1569868548 | Python | Python (3.4.3) | py | Runtime Error | 109 | 13964 | 225 | n=int(input())
a=list(map(int,input().split()))
l=[0]*(max(a)+1)
for i in range(n):
l[a[i]-1]+=1
#print(l)
ans=0
for i in range(len(l)-2):
ans=max(ans,l[i]+l[i+1]+l[i+2])
ans=max(ans,l[0]+l[1],l[-1]+l[-2])
print(ans) |
s071526655 | p03611 | u027929618 | 1569394837 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 131 | n=int(input())
A=list(map(int,input().split()))
cnt = [0]*100002
for a in A:
cnt[a-1]+=1
cnt[a]+=1
cnt[a+1]+=1
print(max(cnt) |
s960720724 | p03611 | u745223262 | 1569096562 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 213 | n = int(input())
a = list(map(int, input().split()))
ary = [0 for _ in range(10**5)]
for i in range(n):
if a[i] > 1:
ary[a[i]-2] += 1
ary[a[i]-1] += 1
ary[a[i]] += 1
print(max(ary)) |
s371601347 | p03611 | u530844517 | 1569095364 | Python | Python (3.4.3) | py | Runtime Error | 87 | 13964 | 182 | n = int(input())
a = list(map(int, input().split()))
ary = [0 for _ in range(10**5)]
for i in range(n):
ary[a[i]-1] += 1
ary[a[i]] += 1
ary[a[i]+1] += 1
print(max(ary)) |
s578660992 | p03611 | u395202850 | 1569093516 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 14008 | 138 | n = int(input())
a = list(map(int, input().split()))
aMax = 0
print(max(a.count(i-1) + a.count(i) + a.count(i+1) for i in range(1, n-1)))
|
s512589102 | p03611 | u799479335 | 1568953195 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 20300 | 713 | import numpy as np
N = int(input())
a_s = input().split()
for i in range(N):
a_s[i] = int(a_s[i])
a_s = np.array(a_s)
a_unique = np.unique(a_s)
ans = 0
i = 1
for a in a_unique[1:-1]:
val = np.sum(a_s==a)
if (a_unique[i-1]+1==a):
val += np.sum(a_s==a_unique[i-1])
if (a_unique[i+1]-... |
s776632196 | p03611 | u799479335 | 1568950492 | Python | Python (3.4.3) | py | Runtime Error | 2109 | 20200 | 543 | import numpy as np
N = int(input())
a_s = input().split()
for i in range(N):
a_s[i] = int(a_s[i])
a_s = np.array(a_s)
a_unique = np.unique(a_s)
ans = 0
for i,a in enumerate(a_s):
val = np.sum(a_s==a)
if (i>0):
if (a_unique[i-1]+1==a):
val += np.sum(a_s==a_unique[i-1])
... |
s162337225 | p03611 | u799479335 | 1568950198 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 739 | import numpy as np
N = int(input())
a_s = input().split()
for i in range(N):
a_s[i] = int(a_s[i])
a_s = np.array(a_s)
a_unique = np.unique(a_s)
# a_counts = []
# for i,a in enumerate(a_unique):
# a_counts.append(np.sum(a_s==a))
# a_counts = np.array(a_counts)
ans = 0
for i in range(len(a_unique)):
val = n... |
s540716386 | p03611 | u799479335 | 1568950154 | Python | Python (3.4.3) | py | Runtime Error | 205 | 20200 | 714 | import numpy as np
N = int(input())
a_s = input().split()
for i in range(N):
a_s[i] = int(a_s[i])
a_s = np.array(a_s)
a_unique = np.unique(a_s)
# a_counts = []
# for i,a in enumerate(a_unique):
# a_counts.append(np.sum(a_s==a))
# a_counts = np.array(a_counts)
ans = 0
for i in range(len(a_unique)):
val = a... |
s734730395 | p03611 | u799479335 | 1568923630 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 23612 | 614 | import numpy as np
N = int(input())
a_s = input().split()
for i in range(N):
a_s[i] = int(a_s[i])
a_s = np.array(a_s)
a_unique = np.unique(a_s)
a_counts = []
for i,a in enumerate(a_unique):
a_counts.append(np.sum(a_s==a))
a_counts = np.array(a_counts)
ans = 0
for i in range(len(a_unique)):
val = a_counts[... |
s592581691 | p03611 | u799479335 | 1568915703 | Python | Python (3.4.3) | py | Runtime Error | 1198 | 22284 | 508 | import numpy as np
N = int(input())
a_s = input().split()
for i in range(N):
a_s[i] = int(a_s[i])
a_s = np.array(a_s)
a_unique, a_counts = np.unique(a_s, return_counts=True)
ans = 0
for i in range(len(a_unique)):
val = a_counts[i]
if i>0:
if a_unique[i-1]+1==a_unique[i]:
val += a_count... |
s588380102 | p03611 | u518042385 | 1568619531 | Python | Python (3.4.3) | py | Runtime Error | 167 | 14096 | 876 | n=int(input())
l=list(map(int,input().split()))
l.sort()
lcount=[]
count=0
now=l[0]
for i in range(n):
if now==l[i]:
count+=1
else:
lcount.append([count,now])
count=1
now=l[i]
if count!=1:
lcount.append([count,now])
if len(lcount)==1:
print(n)
elif len(lcount)==2:
l1=lcount[0][0]
l2=lcount[1... |
s921538414 | p03611 | u518042385 | 1568619361 | Python | Python (3.4.3) | py | Runtime Error | 165 | 14008 | 666 | n=int(input())
l=list(map(int,input().split()))
l.sort()
lcount=[]
count=0
now=l[0]
for i in range(n):
if now==l[i]:
count+=1
else:
lcount.append([count,now])
count=1
now=l[i]
if count!=1:
lcount.append([count,now])
count=0
for i in range(1,len(lcount)-1):
scount=0
scount+=lcount[i][0]
if lc... |
s757101008 | p03611 | u161318582 | 1568619117 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3060 | 325 | import counter
num = int(input())
s = sorted(list(map(int, input().split())))
if num == 1:
print(1)
else:
max_ans = 0
for i in range(num):
start = s[i]
c = s.collections.Counter(1)
current_ans = c[start]+c[start+1]+c[start+2]
max_ans = max(current_ans,max_ans)
print(max_... |
s360380556 | p03611 | u161318582 | 1568618944 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 325 | import counter
num = int(input())
s = [input() for i in range(num)].sort
if num == 1:
print(1)
else:
max_ans = 0
for i in range(num):
start = int(s[i])
c = s.collections.Counter(1)
current_ans = c[start]+c[start+1]+c[start+2]
max_ans = max(current_ans,max_ans)
print(max_... |
s054473493 | p03611 | u161318582 | 1568618934 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 325 | import counter
num = int(input())
s = [input() for i in range(num)].sort
if num == 1:
print(1)
else:
max_ans = 0
for i in range(num):
start = int(s[i])
c = s.collections.Counter(1)
current_ans = c[start]+c[start+1]+c[start+2]
max_ans = max(current_ans,max_ans)
print(max_... |
s841739791 | p03611 | u893063840 | 1568491671 | Python | Python (3.4.3) | py | Runtime Error | 388 | 14092 | 832 | # -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
a.sort()
l = 0
r = 0
ans = 0
cnt = [0, 0, 0]
while l < n and r < n:
a_l = {a[l] - 1, a[l], a[l] + 1}
a_r = {a[r] - 1, a[r], a[r] + 1}
l_r = a_l & a_r
if l_r:
for ele in l_r:
diff = ele - a[l]
... |
s715459201 | p03611 | u008229752 | 1568484604 | Python | PyPy3 (2.4.0) | py | Runtime Error | 170 | 38640 | 1292 | // 072-c
// +1,0,-1を全てmapに足し、最大値を出す
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(i... |
s244070574 | p03611 | u248670337 | 1568231031 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 85 | C=[0]*100002
for i in map(int,input().split()):
C[i-1],C[i],C[i+1]+=1
print(max(C)) |
s378125724 | p03611 | u733738237 | 1567809981 | Python | PyPy3 (2.4.0) | py | Runtime Error | 168 | 38256 | 209 | from collections import*
import sys
sys.stdin=input
n=int(input())
a=list(map(int,input().split()))
a=Counter(a)
cnt=1
for i in range(min(a),max(a)+1):
cnt_=a[i-1]+a[i]+a[i+1]
if cnt_>cnt:cnt=cnt_
print(cnt) |
s177118822 | p03611 | u266874640 | 1567790374 | Python | Python (3.4.3) | py | Runtime Error | 144 | 14556 | 244 | import collections
N = int(input())
a = list(map(int,input().split()))
b = collections.Counter(a)
dp = [0] * (max(a)+1)
dp[0] = b[0] + b[1]
dp[1] = dp[0] + b[2]
for i in range(2, max(a)+1):
dp[i] = dp[i-1] + b[i+1] - b[i-2]
print(max(dp))
|
s482469575 | p03611 | u648212584 | 1567386332 | Python | Python (3.4.3) | py | Runtime Error | 93 | 16928 | 725 | import collections
import sys
input = sys.stdin.readline
def main():
N = int(input())
a = list(map(int,input().split()))
max_a = max(a)
count = [0 for _ in range(max_a)]
c = collections.Counter(a)
c = list(c.items())
if len(c) == 1:
print(c[0][1])
elif len(c) == 2:
if ... |
s831071938 | p03611 | u648212584 | 1567386249 | Python | Python (3.4.3) | py | Runtime Error | 112 | 16928 | 720 | import collections
import sys
input = sys.stdin.readline
def main():
N = int(input())
a = list(map(int,input().split()))
max_a = max(a)
count = [0 for _ in range(max_a)]
c = collections.Counter(a)
c = list(c.items())
if len(c) == 1:
print(c[0][1])
elif len(c) == 2:
if ... |
s417910894 | p03611 | u239342230 | 1567323010 | Python | PyPy3 (2.4.0) | py | Runtime Error | 211 | 52652 | 133 | N=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
ans=max(ans,sa.count(i-1)+sa.count(i)+sa.count(i+1))
print(ans) |
s784928888 | p03611 | u617515020 | 1567044838 | Python | Python (3.4.3) | py | Runtime Error | 92 | 16092 | 370 | import collections
N = int(input())
a = list(map(int, input().split()))
cand = collections.Counter(a)
cand_list = cand.most_common(len(set(a)))
ans = 0
n = min(len(a),5)
for i in range(n):
num = cand_list[i][0]
count = cand[num]
if num + 1 in a:
count += cand[num + 1]
if num - 1 in a:
count += cand[num ... |
s386550420 | p03611 | u957872856 | 1566948641 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 13964 | 200 | n = int(input())
A = list(map(int,input().split()))
l = []
for i in range(min(A),max(A)):
cnt = 0
for a in A:
if i == a or i == a-1 or i == a+1:
cnt += 1
l.append(cnt)
print(max(l))
|
s296608579 | p03611 | u811000506 | 1566440328 | Python | Python (3.4.3) | py | Runtime Error | 131 | 15312 | 428 | import collections
N = int(input())
a = list(map(int,input().split()))
a = collections.Counter(a)
a = sorted(a.items())
li = [0]*N
tmp = 0
if N==1:
print(1)
exit()
for i in range(len(a)-1):
tmp += a[i][1]
if a[i][0]-1==a[i-1][0]:
tmp += a[i-1][1]
if a[i][0]+1==a[i+1][0]:
tmp += a[i... |
s215208866 | p03611 | u811000506 | 1566440120 | Python | Python (3.4.3) | py | Runtime Error | 133 | 15312 | 425 | import collections
N = int(input())
a = list(map(int,input().split()))
a = collections.Counter(a)
a = sorted(a.items())
li = [0]*N
tmp = 0
if N==1:
print(1)
exit()
for i in range(len(a)-1):
tmp += a[i][1]
if a[i][0]-1==a[i-1][0]:
tmp += a[i-1][1]
if a[i][0]+1==a[i+1][0]:
tmp += a[i... |
s098411469 | p03611 | u399721252 | 1566328795 | Python | PyPy3 (2.4.0) | py | Runtime Error | 254 | 56132 | 210 | n = int(input())
num_list = [ int(v) for v in input().split() ]
ans_list = [ 0 for i in range(n+2) ]
for i in num_list:
ans_list[i] += 1
ans_list[i+1] += 1
ans_list[i+2] += 1
print(max(ans_list)) |
s546767176 | p03611 | u716043626 | 1565986518 | Python | Python (3.4.3) | py | Runtime Error | 184 | 32640 | 205 | import statistics
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(n):
ans.append(a[i])
ans.append(a[i]-1)
ans.append(a[i]+1)
print(ans.count(statistics.mode(ans))) |
s905752608 | p03611 | u745561510 | 1565455933 | Python | Python (3.4.3) | py | Runtime Error | 154 | 15860 | 863 | N = int(input())
a = list(map(int, input().split()))
a_hash = {}
for i in range(N):
if a[i] in a_hash:
a_hash[a[i]] += 1
else:
a_hash[a[i]] = 1
a_sort = sorted(a_hash.items(), key = lambda x: x[0])
a_sort = list(a_sort)
ans_list = [0] * N
if len(a) == 1:
print(1)
exit()
for i in rang... |
s689273515 | p03611 | u745561510 | 1565455891 | Python | PyPy3 (2.4.0) | py | Runtime Error | 250 | 60652 | 863 | N = int(input())
a = list(map(int, input().split()))
a_hash = {}
for i in range(N):
if a[i] in a_hash:
a_hash[a[i]] += 1
else:
a_hash[a[i]] = 1
a_sort = sorted(a_hash.items(), key = lambda x: x[0])
a_sort = list(a_sort)
ans_list = [0] * N
if len(a) == 1:
print(1)
exit()
for i in rang... |
s378262982 | p03611 | u554954744 | 1564910702 | Python | PyPy3 (2.4.0) | py | Runtime Error | 211 | 52292 | 276 | N = int(input())
a = list(map(int, input().split()))
b = [0]*(10**5)
for i in a:
if i == 10**5:
b[i-1] += 1
b[i] += 1
elif i == 0:
b[i] += 1
b[i+1] += 1
else:
b[i-1] += 1
b[i] += 1
b[i+1] += 1
print(max(b)) |
s078003346 | p03611 | u634461820 | 1563253649 | Python | Python (3.4.3) | py | Runtime Error | 68 | 13964 | 150 | N = int(input())
l = list(map(int,input().split()))
data = [0]*(10001)
for i in l:
data[i-1] += 1
data[i] += 1
data[i+1] += 1
print(max(data)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.