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
s969279293
p03611
u917558625
1593581573
Python
Python (3.8.2)
py
Runtime Error
110
20712
137
N=int(input()) a=list(map(int,input().split())) dp=[0]*(10**5+1) for i in range(N): for j in range(3): dp[a[i]+j]+=1 print(max(dp))
s202620076
p03611
u961288441
1593364375
Python
Python (3.8.2)
py
Runtime Error
46
20688
139
N = int(input()) a = list(map(int, input().split())) l = [0]*10**5+2 for i in a: l[i] +=1 l[i+1] +=1 l[i+2] +=1 print(max(l))
s718704113
p03611
u961288441
1593364327
Python
Python (3.8.2)
py
Runtime Error
34
17356
150
N = int(input()) a = map(int, input().split()) l = [0]*10**5+2 ans = 0 num = 0 for i in a: l[i] +=1 l[i+1] +=1 l[i+2] +=1 print(max(l))
s933186055
p03611
u961288441
1593364263
Python
Python (3.8.2)
py
Runtime Error
64
17260
147
N = int(input()) a = map(int, input().split()) l = [0]*10**5 ans = 0 num = 0 for i in a: l[i] +=1 l[i+1] +=1 l[i+2] +=1 print(max(l))
s311879154
p03611
u674588203
1593301149
Python
Python (3.8.2)
py
Runtime Error
49
20732
130
N=int(input()) a=list(map(int,input().split())) l=[0]*10**5+2 for v in a: l[v]+=1 l[v+1]+=1 l[v+2]+=1 print(max(l))
s773468070
p03611
u674588203
1593300001
Python
Python (3.8.2)
py
Runtime Error
32
8912
522
N=int(input()) a=list(map(int,input().split())) l=sorted(a) # N=10 # l=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] if N>=10**4: math. else: pass ans=1 for i in range(N): if i>=1 and l[i]==l[i-1]: continue else: t=l[i] for j in range(N-i): c=l[i+j] if abs(c-t)<=2: ...
s476692477
p03611
u674588203
1593299953
Python
Python (3.8.2)
py
Runtime Error
26
8988
508
N=int(input()) a=list(map(int,input().split())) l=sorted(a) # N=10 # l=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] if N>=10**3: math. ans=1 for i in range(N): if i>=1 and l[i]==l[i-1]: continue else: t=l[i] for j in range(N-i): c=l[i+j] if abs(c-t)<=2: ...
s965837596
p03611
u674588203
1593279731
Python
Python (3.8.2)
py
Runtime Error
71
20784
374
N=int(input()) a=list(map(int,input().split())) l=sorted(a) ans=1 targetindex=0 t=l[targetindex] for i in range (N-targetindex): c=l[targetindex+i] _ans=1 if c-t<=2: pass else: _ans=i if _ans>ans: ans=_ans targetindex=targetindex+i t=[t...
s331130803
p03611
u674588203
1593279586
Python
Python (3.8.2)
py
Runtime Error
77
20856
354
N=int(input()) a=list(map(int,input().split())) l=sorted(a) ans=1 targetindex=0 t=l[targetindex] for i in range (N-targetindex): c=l[targetindex+i] _ans=1 if c-t<=2: pass else: _ans=i if _ans>ans: ans=_ans targetindex=targetindex+i t=[targetindex] ...
s810610070
p03611
u168416324
1593275735
Python
PyPy3 (7.3.0)
py
Runtime Error
110
84628
212
n=int(input()) a=list(map(int,input().split())) num=[0]*(max(a)) for i in a: num[i-1]+=1 #print(num) mx=0 for i in range(1,max(a)-1): #print(num[i-1:i+2]) m=sum(num[i-1:i+2]) if m>mx: mx=m print(mx)
s009150920
p03611
u326552320
1593199893
Python
Python (3.8.2)
py
Runtime Error
72
20908
797
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: C # CreatedDate: 2020-06-26 15:12:37 +0900 # LastModified: 2020-06-26 15:31:15 +0900 # import os import sys from collections import Counter # import numpy as np # import pandas as pd def main(): n = int(input()) a = list(map(int, input().split())...
s256555815
p03611
u253011685
1592682591
Python
Python (3.8.2)
py
Runtime Error
115
20848
258
n=int(input()) A=list(map(int,input().split())) count=[0 for _ in range(max(A)+1)] for i in range(n): count[A[i]]+=1 answer=0 for i in range(0,n-3): tmp=int(count[i])+int(count[i+1])+int(count[i+2]) if tmp>answer: answer=tmp print(answer)
s246647198
p03611
u750651325
1592399279
Python
Python (3.4.3)
py
Runtime Error
26
10124
152
N = int(input()) a = [map(int, input().split())] x = [0] * (10**5+2) for i in a: x[i] += 1 x[i+1] += 1 x[i+2] += 1 print(max(a))
s291996479
p03611
u750651325
1592399183
Python
Python (3.4.3)
py
Runtime Error
68
13964
155
N = int(input()) a = list(map(int, input().split())) x = [0] * (10**5+2) for i in a: a[i] += 1 a[i+1] += 1 a[i+2] +=1 print(max(a))
s734710611
p03611
u540290227
1592361524
Python
Python (3.4.3)
py
Runtime Error
62
14008
399
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 = [0]*(max(a)+1) for i in a: al[i] += 1 index = al.index(max(al)) if index == min(a): index += 1 elif...
s966850913
p03611
u540290227
1592360531
Python
Python (3.4.3)
py
Runtime Error
58
13964
364
x = int(input()) a = list(map(int, input().split())) al = [0]*(max(a)+1) for i in a: al[i] += 1 index = al.index(max(al)) if index == 1: index += 1 elif index == max(a)-1: index -= 1 if x == 1: print(x) elif x == 2: if abs(a[0] - a[1]) <= 1: print(2) else: print(1) else: p...
s766313611
p03611
u268318377
1592080324
Python
Python (3.4.3)
py
Runtime Error
165
14564
206
from collections import Counter N = int(input()) A = list(map(int, input().split())) nc = Counter(A) C = [] for i in range(1, max(A)): c = nc[i - 1] + nc[i] + nc[i + 1] C.append(c) print(max(C))
s309563076
p03611
u502126017
1591899540
Python
Python (3.4.3)
py
Runtime Error
207
32644
194
from statistics import mode n=int(input()) a=list(map(int,input().split())) aa=[] for i in range(n): aa.append(a[i]-1) aa.append(a[i]) aa.append(a[i]+1) print(aa.count(mode(aa)))
s266279208
p03611
u810787773
1591820317
Python
Python (3.4.3)
py
Runtime Error
94
14092
2279
def main(): N = int(input()) a = list(map(int, input().split())) num_dict = {} a.sort() a_max = a[N-1] temp = a[0] sum = 1 for i in range(1,N): if temp == a[i]: sum += 1 else: num_dict[temp] = sum sum = 1 temp = a[i] nu...
s687802610
p03611
u810787773
1591820205
Python
Python (3.4.3)
py
Runtime Error
95
14092
2283
def main(): N = int(input()) a = list(map(int, input().split())) num_dict = {} a.sort() a_max = a[N-1] temp = a[0] sum = 1 for i in range(1,N): if temp == a[i]: sum += 1 else: num_dict[temp] = sum sum = 1 temp = a[i] nu...
s132418887
p03611
u143051858
1591753046
Python
Python (3.4.3)
py
Runtime Error
88
13964
238
N = int(input()) a = list(map(int,input().split())) c = [0]*(max(a)+1) max_num = 0 for i in a: c[i] += 1 for x in range(max(a)+1): if max_num < (c[x-1]) + (c[x]) + (c[x+1]): max_num = (c[x-1]) + (c[x]) + (c[x+1]) print(max_num)
s427642999
p03611
u143051858
1591751398
Python
Python (3.4.3)
py
Runtime Error
86
14004
240
N = int(input()) a = list(map(int,input().split())) c = [0]*(max(a)+1) max_num = 0 for i in a: c[i] += 1 for x in range(1,max(a)+1): if max_num < (c[x-1]) + (c[x]) + (c[x+1]): max_num = (c[x-1]) + (c[x]) + (c[x+1]) print(max_num)
s600704330
p03611
u197457087
1591665308
Python
Python (3.4.3)
py
Runtime Error
168
14092
433
N = int(input()) A = list(map(int,input().split())) MAX = max(A) dic = {} for i in range(N): if A[i] not in dic: dic[A[i]] = 1 else: dic[A[i]] += 1 ans = [] for i in range(1,MAX+1): mae = 0;ima=0;tsugi = 0 if i in dic: ima = dic[i] if i != 1: if i-1 in dic: mae = dic[i-1] if i+1 <= MA...
s417019212
p03611
u581022379
1591584355
Python
Python (3.4.3)
py
Runtime Error
165
35152
237
import copy from statistics import mode N = int(input()) seq = [int(i) for i in input().split()] seqP1 = [i + 1 for i in copy.copy(seq)] seqM1 = [i - 1 for i in copy.copy(seq)] mixed = seq + seqM1 + seqP1 print(mixed.count(mode(mixed)))
s413391088
p03611
u366886346
1591414949
Python
Python (3.4.3)
py
Runtime Error
92
13964
216
n=int(input()) a=list(map(int,input().split())) num=[0]*(max(a)+1) for i in range(n): num[a[i]]+=1 ans=0 for i in range(1,len(a)-1): num2=num[i-1]+num[i]+num[i+1] if ans<num2: ans=num2 print(ans)
s225732064
p03611
u363146889
1591371671
Python
PyPy3 (2.4.0)
py
Runtime Error
301
81128
584
# -*- coding: utf-8 -*- ## Library import sys from fractions import gcd import math from math import ceil,floor import collections from collections import Counter ## input # n=int(input()) # A,B,C,D=map(int, input().split()) # string = input() # yoko = list(map(int, input().split())) # tate = [int(input()) for _ in...
s104162497
p03611
u057415180
1591309648
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38256
131
def main(): x, t = map(int, input().split()) if t > x: print(0) else: print(x-t) if __name__ == '__main__': main()
s635404269
p03611
u464205401
1591186792
Python
Python (3.4.3)
py
Runtime Error
111
14092
223
n=int(input()) a=list(map(int,input().split())) a_min=min(a) a_max=max(a) s=list(range(a_min,a_max+1)) t=[0]*(a_max+1) for i in range(n): t[a[i]]+=1 x=0 for j in range(1,n-1): x=max(x,t[j-1]+t[j]+t[j+1]) print(x)
s773255304
p03611
u574464625
1591151741
Python
PyPy3 (2.4.0)
py
Runtime Error
210
52908
168
n=int(input()) a= list(map(int,input().split())) #for i in a: #i=0 b=[0]*(10**5) r=0 #while i<=n: for i in a: b[i]+=1 b[i+1]+=1 b[i+2]+=1 t=max(b) print(t)
s268081832
p03611
u087731474
1591151651
Python
Python (3.4.3)
py
Runtime Error
17
2940
344
n = int(input()) a= list(input().split()) al = list([int(i) for i in a]) aset = set([int(i) for i in a]) cnt=0 for i in aset: #print(i) #print(al.count(i-1),al.count(i),al.count(i+1)) if cnt < al.count(i-1) + al.count(i) + al.count(i+1): cnt = al.count(i-1) + al.count(i) + al.count(i+1) if cnt >= len(al...
s692460681
p03611
u574464625
1591151527
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38256
322
n=int(input()) a= list(map(int,input().split())) #for i in a: #i=0 b=[0]*(max(a)+2) r=0 #while i<=n: for i in a: b[i]+=1 b[i+1]+=1 b[i+2]+=1 print(max(b)-1) A=a.count(a[i]+1) M=a.count(a[i]) C=a.count(a[i]-1) b[i]=A+M+C i=0 def dfs(i,j): max(dfs(i+1,j),dfs(i,j+1)) print(max(b)...
s384772197
p03611
u574464625
1591151511
Python
PyPy3 (2.4.0)
py
Runtime Error
214
52908
169
n=int(input()) a= list(map(int,input().split())) #for i in a: #i=0 b=[0]*(max(a)+2) r=0 #while i<=n: for i in a: b[i]+=1 b[i+1]+=1 b[i+2]+=1 print(max(b-1))
s838082306
p03611
u574464625
1591149614
Python
Python (3.4.3)
py
Runtime Error
2104
13964
199
n=int(input()) a= list(map(int,input().split())) #for i in a: #i=0 b=[0]*n r=0 #while i<=n: for i in a: r=a[i] A=a.count(i+1) M=a.count(i) C=a.count(i-1) b=A+M+C print(max(b))
s402201151
p03611
u629350026
1591068710
Python
Python (3.4.3)
py
Runtime Error
121
13964
200
n=int(input()) a=list(map(int,input().split())) temp=[0]*max(a) for i in range(n): temp[a[i]-1]=temp[a[i]-1]+1 ans=0 for i in range(1,max(a)-1): ans=max(ans,temp[i-1]+temp[i]+temp[i+1]) print(ans)
s576877988
p03611
u519939795
1590794351
Python
Python (3.4.3)
py
Runtime Error
41
14004
134
n=int(input()) a=list(map(int,input().split())) ans=[0]*n**4 for i in a: ans[i]+=1 ans[i+1]+=1 ans[i+2]+=1 print(max(ans))
s560437052
p03611
u201986772
1590594604
Python
PyPy3 (2.4.0)
py
Runtime Error
201
52292
263
n=int(input()) alis=list(map(int,input().split())) xlis=set(alis) for al in alis: alis.add(al-1) alis.add(al+1) counter=[0 for _ in range(n)] for x in xlis: for i in range(n): if x-1<=alis[i]<=x+1: counter[i]+=1 print(max(counter))
s634848885
p03611
u991134049
1590426473
Python
PyPy3 (2.4.0)
py
Runtime Error
220
60716
177
N = int(input()) A = list(map(int, input().split())) count = [0]*(10**6) for i in range(N): count[A[i]] += 1 count[A[i+1]] += 1 count[A[i+2]] += 1 print(max(count))
s255971970
p03611
u294385082
1590346494
Python
Python (3.4.3)
py
Runtime Error
88
14836
537
n = int(input()) a = list(map(int,input().split())) dict = {} ans = 0 for i in range(n): if a[i] not in dict: dict[a[i]] = 1 else: dict[a[i]] += 1 l = sorted(dict.items()) l += [(-1,0),(-2,0)] for j in range(len(l)-2): if l[i][0]+1 == l[i+1][0] and l[i][0]+2 == l[i+2][0]: ans = max(ans,l[j][1]+l[j...
s966496134
p03611
u545644875
1590308089
Python
Python (3.4.3)
py
Runtime Error
76
14008
404
N = int(input()) S = list(map(int, input().split())) S.sort() if S[1] - S[0] >1: min_s = S[1] else: min_s = S[0] if S[N -1] - S[N -2] >1: max_s = S[N -2] else: min_s = S[N -1] ans = 0 for i in range(min_s -1 ,max_s +1): count = 0 ans_list = list(map(lambda x: x-i, S)) count = ans_list.count(0) + ans_...
s333222833
p03611
u203383537
1590209247
Python
Python (3.4.3)
py
Runtime Error
154
14928
319
import collections n = int(input()) a = list(map(int,input().split())) a = sorted(a) b = list(set(a)) c=collections.Counter(a) ans = 1 for i in range(1,n-1): cnt = 0 if abs(b[i]-b[i-1]) <= 1 and abs(b[i]-b[i+1]) <= 1: cnt += c[b[i]] + c[b[i-1]] + c[b[i+1]] ans = max(ans,cnt) print(ans)
s625731306
p03611
u930723367
1590121613
Python
PyPy3 (2.4.0)
py
Runtime Error
227
62956
301
n = int(input()) m = list(map(int,input().split())) zen = m cou = 0 for x in range(n): zen.append(m[x]-1) for x in range(n): zen.append(m[x]+1) a = collections.Counter(zen) for k in range(n): if a[0][1] == m[k] or a[0][1] == m[k] -1 or a[0][1] == m[k] +1: cou += 1 print(cou)
s154283586
p03611
u131411061
1590102087
Python
Python (3.4.3)
py
Runtime Error
81
13964
155
N = int(input()) a = list(map(int,input().split())) c = [0 for _ in range(10**5)] for i in a: c[i-1] += 1 c[i+1] += 1 c[i] += 1 print(max(c))
s113309466
p03611
u247830763
1590038318
Python
Python (3.4.3)
py
Runtime Error
2104
15692
337
n = int(input()) ls = list(map(int,input().split())) a = min(ls) b = max(ls) c = len(ls) s = 0 def sub(p,q): return p-q ans = [] aaa = [0]*(len(ls)) for i in range(a,b+1): new = [i]*(c) ans = map(sub,ls,new) ans = list(map(str,ans)) s = ans.count("-1") + ans.count("1") + ans.count("0") aaa[i] = ...
s785740355
p03611
u247830763
1590038074
Python
Python (3.4.3)
py
Runtime Error
2104
16308
348
n = int(input()) ls = list(map(int,input().split())) a = min(ls) b = max(ls) c = len(ls) s = 0 def sub(p,q): return p-q ans = [] aaa = [0]*(b-a+1) for i in range(a,b+1): new = [i]*(c) ans = map(sub,ls,new) ans = list(map(str,ans)) s = ans.count("-1") + ans.count("1") + ans.count("0") aaa[i-1] = ...
s126580862
p03611
u247830763
1590037981
Python
Python (3.4.3)
py
Runtime Error
2104
15680
335
n = int(input()) ls = list(map(int,input().split())) a = min(ls) b = max(ls) c = len(ls) s = 0 def sub(p,q): return p-q ans = [] aaa = [0]*(b-a+2) for i in range(a,b+1): new = [i]*(c) ans = map(sub,ls,new) ans = list(map(str,ans)) s = ans.count("-1") + ans.count("1") + ans.count("0") aaa[i] = s ...
s697494048
p03611
u048176319
1589842787
Python
Python (3.4.3)
py
Runtime Error
92
13964
186
N = int(input()) la = list(map(int, input().split())) lcnt = [0] * (max(la) + 1) for i in range(N): lcnt[la[i]-2] += 1 lcnt[la[i]-1] += 1 lcnt[la[i]] += 1 print(max(lcnt))
s682735012
p03611
u860002137
1589655505
Python
Python (3.4.3)
py
Runtime Error
17
3060
202
N = int(input()) a = np.array(list(map(int, input().split()))) ans = 0 for i in range(N): tmp = a.copy() tmp = np.abs(tmp - tmp[i]) ans = max(ans, np.where(tmp<=1)[0].shape[0]) print(ans)
s497434565
p03611
u001769145
1589645568
Python
Python (3.4.3)
py
Runtime Error
82
13704
364
# ABC072 # C # Together import itertools n = int(input()) a = [int(i) for i in input().split()] a.sort() gr = itertools.groupby(a) hoge_list = [0]*10001 ans = 0 for key, group in gr: hoge_list[key] = len(list(group)) for i in range(1,10000,1): _tmp = hoge_list[i-1] + hoge_list[i] + hoge_list[i+1] if ans...
s645408923
p03611
u001769145
1589645536
Python
Python (3.4.3)
py
Runtime Error
85
13748
359
# ABC072 # C # Together import itertools n = int(input()) a = [int(i) for i in input().split()] a.sort() gr = itertools.groupby(a) hoge_list = [0]*10001 ans = 0 for key, group in gr: hoge_list[key] = len(list(group)) for i in range(1000): _tmp = hoge_list[i-1] + hoge_list[i] + hoge_list[i+1] if ans < _t...
s151120872
p03611
u790012205
1589645130
Python
Python (3.4.3)
py
Runtime Error
177
13964
518
import sys N = int(input()) a = sorted(list(map(int, input().split()))) X = 0 c = 1 i = 0 while True: if i == N - 1: X = max(X, c) break a_0 = a[i] a_1 = a[i] - 1 a_2 = a[i] + 1 while True: b_0 = a[i + 1] b_1 = a[i + 1] - 1 b_2 = a[i + 1] + 1 b = [b_0...
s018487347
p03611
u227085629
1589497838
Python
Python (3.4.3)
py
Runtime Error
75
14008
135
n = int(input()) l = list(map(int,input().split())) h = [0]*(10**5+1) for i in l: h[i+1] += 1 h[i] += 1 h[i+2] += 1 print(max(h))
s387867335
p03611
u127499732
1589416491
Python
Python (3.4.3)
py
Runtime Error
92
17572
548
def main(): from collections import Counter n, *a = map(int, open(0).read().split()) b = Counter(a) c = [[k, v] for k, v in b.items()] c.sort(key=lambda x: x[1], reverse=True) x = c[0][0] al, ar = c[0][1], c[0][1] if b.get(x - 1) is not None: al += b.get(xl - 1) if b.get(x - ...
s370821198
p03611
u595375942
1589414163
Python
Python (3.4.3)
py
Runtime Error
141
13964
386
N = int(input()) A = list(map(int, input().split())) maxim = max(A) counter = [0]*(maxim+1) dif = [-1, 0, 1] for a in A: for d in dif: if a == 0: counter[0] += 1 counter[1] += 1 break elif a == maxim: counter[maxim-1] += 1 counter[maxim] +=...
s297042204
p03611
u595375942
1589413888
Python
Python (3.4.3)
py
Runtime Error
107
14092
172
N = int(input()) A = list(map(int, input().split())) counter = [0]*(max(A)+1) dif = [-1, 0, 1] for a in A: for d in dif: counter[a+d-1] += 1 print(max(counter))
s403934222
p03611
u503227287
1588909276
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38256
584
from sys import stdin from collections import Counter if __name__ == "__main__": _in = [_.rstrip() for _ in stdin.readlines()] N = int(_in[0]) # type:int a_arr = list(map(int,_in[1].split(' '))) # type:list(int) # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv count = Counter(a_arr) cnt...
s929410323
p03611
u093041722
1588641859
Python
Python (3.4.3)
py
Runtime Error
148
14564
163
from collections import Counter N = int(input()) a = list(map(int, input().split())) c = Counter(a) d = [c[i]+c[i+1]+c[i+2] for i in range(max(a)-1)] print(max(d))
s879074205
p03611
u379142263
1588531307
Python
Python (3.4.3)
py
Runtime Error
183
17336
818
import sys import itertools sys.setrecursionlimit(1000000000) from heapq import heapify,heappop,heappush,heappushpop import math import collections n = int(input()) a = sorted(list(map(int,input().split()))) c = collections.Counter(a) if n == 1: print(1) sys.exit() item = [] for key,Value in c.items(): ite...
s011009677
p03611
u056358163
1588185895
Python
Python (3.4.3)
py
Runtime Error
436
23388
203
import numpy as np N = int(input()) a = list(map(int, input().split())) V = np.zeros((max(a)+4, N)) for i, v in enumerate(a): V[v:v+3, i] = 1 #print(V) print(np.max(np.sum(V, axis=1, dtype=np.int)))
s227963220
p03611
u056358163
1588185632
Python
Python (3.4.3)
py
Runtime Error
437
23384
193
import numpy as np N = int(input()) a = list(map(int, input().split())) V = np.zeros((max(a)+3, N)) for i, v in enumerate(a): V[v:v+3, i] = 1 print(np.max(np.sum(V, axis=1, dtype=np.int)))
s069194531
p03611
u056358163
1588185588
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38384
193
import numpy as np N = int(input()) a = list(map(int, input().split())) V = np.zeros((max(a)+3, N)) for i, v in enumerate(a): V[v:v+3, i] = 1 print(np.max(np.sum(V, axis=1, dtype=np.int)))
s631524537
p03611
u497952650
1588136794
Python
Python (3.4.3)
py
Runtime Error
2104
13964
328
N = int(input()) A = list(map(int,input().split())) num = [0]*(max(A)+1) for i in A: num[i] += 1 ans = 0 for i in range(0,max(A)+1): if i == 0: tmp = num[i] + num[i+1] elif i == max(A): tmp = num[i-1] + num[i] else: tmp = num[i-1] + num[i] + num[i+1] ans = max(ans,tmp) pr...
s081293296
p03611
u489959379
1588038481
Python
Python (3.4.3)
py
Runtime Error
204
30576
526
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(input()) A = sorted(list(map(int, input().split()))) if n == 1: print(1) else: L = [] for i in range(n): L.append(list(range(A[i] - 1, A[i] + 2))) ma =...
s350484963
p03611
u771007149
1587944084
Python
Python (3.4.3)
py
Runtime Error
83
14216
226
#ABC072-C import collections import itertools n = int(input()) a = list(map(int,input().split())) cnt = [0] * (n+2) for i in a: cnt[i] += 1 cnt[i+1] += 1 cnt[i+2] += 1 print(max(cnt))
s685605079
p03611
u771007149
1587943924
Python
Python (3.4.3)
py
Runtime Error
71
14216
227
#ABC072-C import collections import itertools 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+2] += 1 print(max(cnt))
s508674870
p03611
u771007149
1587943884
Python
Python (3.4.3)
py
Runtime Error
80
14344
242
#ABC072-C import collections import itertools n = int(input()) a = list(map(int,input().split())) cnt = [0] * 100000 a.sort() for i in range(a): cnt[i] += 1 cnt[i+1] += 1 cnt[i+2] += 2 print(max(cnt))
s769007698
p03611
u459150945
1587943665
Python
Python (3.4.3)
py
Runtime Error
41
13964
162
N = int(input()) an = list(map(int, input().split())) ans = 0 cnts = Counter(an) for i in set(an): ans = max(ans, cnts[i] + cnts[i+1] + cnts[i-1]) print(ans)
s106261372
p03611
u478266845
1587922838
Python
Python (3.4.3)
py
Runtime Error
188
23392
486
import numpy as np n = int (input()) a = [int(i) for i in input().split()] a_sort = np.sort(a) a_min = a_sort[0]-1 a_max = a_sort[-1]+1 #num_cand = a_max_a_min + +1 dic = {} for i in range(len(a_sort)): added = [a_sort-1, a_sort ,a_sort+1] for j in range(len(added)): if dic.get(added[j]) is None: ...
s050384803
p03611
u858670323
1587898162
Python
Python (3.4.3)
py
Runtime Error
118
20004
260
from collections import defaultdict n = int(input()) a = list(map(int,input().rstrip().split())) dic = defaultdict(int) for x in a: dic[x-1]+=1 dic[x]+=1 dic[x+1]+=1 k=0 m=0 for key,item in dic.item(): if(item>m): m=item k=key print(k)
s122747315
p03611
u235210692
1587847377
Python
Python (3.4.3)
py
Runtime Error
17
3064
688
for i in a: # print(i) if pre<i-2: succession=0 pre=i maxnum=max(maxnum,sum(check)) check=[1,0,0] elif pre==i: check[succession]+=1 elif pre==i-1 and succession==0: succession+=1 check[1]+=1 pre=i elif pre==i-1 and succession==1: ...
s566497857
p03611
u784022244
1587837090
Python
Python (3.4.3)
py
Runtime Error
50
16228
196
N=int(input()) A=list(map(int, input().split())) count=[0]*10**6 for a in A: count[A]+=1 ans=0 for a in range(max(A)+1): now=count[a-1]+count[a]+count[a+1] ans=max(ans, now) print(ans)
s231205035
p03611
u227082700
1587814300
Python
Python (3.4.3)
py
Runtime Error
90
14008
135
n=int(input()) a=list(map(int,input().split())) b=[0]*(n+1) for i in a: if i!=0:b[i-1]+=1 b[i]+=1 if i!=n:b[i+1]+=1 print(max(b))
s891392381
p03611
u867826040
1587667383
Python
Python (3.4.3)
py
Runtime Error
78
13964
131
n=int(input()) a=list(map(int,input().split())) an = [0]*(max(a)+1) for i in a: an[i-1]+=1 an[i-2]+=1 an[i]+=1 print(max(an))
s221936651
p03611
u301624971
1587614142
Python
Python (3.4.3)
py
Runtime Error
17
3064
553
def myAnswer(N:int,A:list) -> int: if(N == 1): return 1 dic ={} for a in A: if(a == 0): for i in range(2): if(i in dic.keys()): dic[i]+=1 else: dic[i]=1 else: for i in range(a-1,a+2): if(i in dic.keys()): ...
s073201590
p03611
u903005414
1587430371
Python
Python (3.4.3)
py
Runtime Error
181
23352
236
import numpy as np N = int(input()) A = np.array(list(map(int, input().split()))) counter = np.bincount(A) # print(counter) cumsum = counter.cumsum() # print(cumsum) i = min(3, N) # print('i', i) print((cumsum[i:] - cumsum[:-i]).max())
s130264271
p03611
u903005414
1587430062
Python
Python (3.4.3)
py
Runtime Error
280
23352
206
import numpy as np N = int(input()) A = np.array(list(map(int, input().split()))) counter = np.bincount(A) # print(counter) cumsum = counter.cumsum() # print(cumsum) print((cumsum[3:] - cumsum[:-3]).max())
s021013931
p03611
u496821919
1587420696
Python
Python (3.4.3)
py
Runtime Error
46
13964
210
N = int(input()) A = list(map(int,input().split())) cnt = 0 for x in range(min(A),max(A)): transient = A.count(X-1) + A.count(X) + A.count(X+1) if transient > cnt: cnt = transient print(cnt)
s317658757
p03611
u000349418
1587249157
Python
Python (3.4.3)
py
Runtime Error
59
14092
179
n=int(input());A = list(map(int,input().split(' '))) x = [0]*10001 for a in A: if a != 0: x[a-1]+=1;x[a]+=1;x[a+1]+=1 else: x[a]+=1;x[a+1]+=1 print(max(x))
s746192017
p03611
u486990800
1587152395
Python
Python (3.4.3)
py
Runtime Error
289
23352
241
import sys import numpy as np input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) k = [0] * (max(a)+1) for p in a: k[p] += 1 ans = 0 for q,r,s in zip(k, k[1:] + k[2:]): ans = max(ans, q+r+s) print(ans)
s035903814
p03611
u486990800
1587150665
Python
Python (3.4.3)
py
Runtime Error
180
23432
290
import sys import numpy as np input = sys.stdin.readline N = int(input()) a = list(map(int, input().split())) a_ = list(set(a)) temp2 = [] for i in a_: temp2.appned(a.count(a_)) temp = [] for i in range(1,len(temp2)): temp = temp2[i-1] + temp2[i] + temp2[i+1] print(max(temp))
s998161519
p03611
u852790844
1586966983
Python
Python (3.4.3)
py
Runtime Error
342
30696
201
import numpy as np from scipy.stats import mode n = int(input()) a = np.array(input().split(), dtype=np.int64) b = np.stack([a-1, a ,a+1]) mode_b, count_b = mode(b, axis=None) print(b) print(*count_b)
s314125480
p03611
u015467545
1586841880
Python
PyPy3 (2.4.0)
py
Runtime Error
2106
52292
207
N=int(input()) a=list(map(int,input().split())) m=max(a) mm=min(a) p=[0]*(m-mm) if 1<=len(a)<=3: print(len(a)) else: for i in range(mm,m-1): p[i]=a.count(i)+a.count(i+1)+a.count(i+2) print(max(p))
s984464001
p03611
u367117210
1586829423
Python
PyPy3 (2.4.0)
py
Runtime Error
166
38256
200
import numpy as np N = int(input()) a = np.array(list(map(int, input().split()))) r = np.zeros(10**5+2) for i in range(N): r[a[i]] += 1 r[a[i]+1] += 1 r[a[i]+2] += 1 print(int(r.max()))
s632505576
p03611
u337751290
1586655876
Python
Python (3.4.3)
py
Runtime Error
91
22064
247
def main(): N = int(input()) a = map(int, input().split()) d = {i: 0 for i in range(100001)} for i in a: d[i-1] += 1 d[i] += 1 d[i+1] += 1 print(max(d.values())) if __name__ == '__main__': main()
s923199619
p03611
u015467545
1586498104
Python
Python (3.4.3)
py
Runtime Error
2104
13964
207
N=int(input()) a=list(map(int,input().split())) m=max(a) mm=min(a) p=[0]*(m-mm) if 1<=len(a)<=3: print(len(a)) else: for i in range(mm,m-1): p[i]=a.count(i)+a.count(i+1)+a.count(i+2) print(max(p))
s890003180
p03611
u015467545
1586497854
Python
Python (3.4.3)
py
Runtime Error
2104
13964
165
N=int(input()) a=list(map(int,input().split())) m=max(a) mm=min(a) p=[0]*(m-mm) for i in range(mm,m-1): p[i]=a.count(i)+a.count(i+1)+a.count(i+2) print(max(p))
s151700121
p03611
u015467545
1586497665
Python
Python (3.4.3)
py
Runtime Error
2104
13964
151
N=int(input()) a=list(map(int,input().split())) m=max(a) p=[0]*(m-1) for i in range(m-1): p[i]=a.count(i)+a.count(i+1)+a.count(i+2) print(max(p))
s205677984
p03611
u788068140
1586194507
Python
Python (3.4.3)
py
Runtime Error
47
13964
623
N = int(input()) ArR = [int(s) for s in input().split(" ")] def calculate(n,arr): dict = {} for ar in arr: a1 = ar - 1 a2 = ar a3 = ar + 1 if dict.get(a1) == None: dict.__setitem__(a1,1) else: dict.__setitem__(a1,dict.get(a1)+1) if dic...
s639547375
p03611
u212831449
1586030705
Python
Python (3.4.3)
py
Runtime Error
90
14092
330
n = input() s = list(map(int,input().split())) MAX = max(s) nums = [0]*(MAX+1) for i in s: if i == 0: nums[0] += 1 nums[1] += 1 elif i == MAX: nums[-1] += 1 if i != 0: nums[-2] += 1 else: nums[i-1] += 1 nums[i] += 1 nums[i+1] += 1 print(...
s548541327
p03611
u212831449
1586030463
Python
Python (3.4.3)
py
Runtime Error
89
13964
308
n = input() s = list(map(int,input().split())) MAX = max(s) nums = [0]*(MAX+1) for i in s: if i == 0: nums[0] += 1 nums[1] += 1 elif i == MAX: nums[-1] += 1 nums[-2] += 1 else: nums[i-1] += 1 nums[i] += 1 nums[i+1] += 1 print(max(nums))
s944777214
p03611
u186838327
1586003098
Python
PyPy3 (2.4.0)
py
Runtime Error
242
52420
298
n = int(input()) A = list(map(int, input().split())) A.sort() #print(A) d = {} for i in range(n): a = A[i] for k in (-1, 0, 1): if a+k not in d: d[a+k] = 1 else: d[a] += 1 max_ = 0 for v in d.values(): if v >= max_: max_ = v print(max_)
s967928445
p03611
u185424824
1586001309
Python
Python (3.4.3)
py
Runtime Error
50
13964
295
N = int(input()) a = list(map(int,input().split())) num = set(a) cnt = [0]*max(num+1) for i in a: cnt[i] += 1 if len(cnt) == 1: print(cnt[0]) elif len(cnt) == 2: print(sum(cnt)) else: for i in range(1, max(a)): ans = max(ans, cnt[i-1]+cnt[i]+cnt[i+1]) print(ans)
s716686693
p03611
u212831449
1585967177
Python
Python (3.4.3)
py
Runtime Error
2104
13964
300
n = input() s = list(map(int,input().split())) nums = [0]*(max(s)+1) for i in s: if i == 0: nums[0] += 1 nums[1] += 1 elif i == max(s): nums[-1] += 1 nums[-2] += 1 else: nums[i-1] += 1 nums[i] += 1 nums[i+1] += 1 print(max(nums))
s381548491
p03611
u212831449
1585965999
Python
Python (3.4.3)
py
Runtime Error
2104
13964
300
n = input() s = list(map(int,input().split())) nums = [0]*(max(s)+1) for i in s: if i == 0: nums[0] += 1 nums[1] += 1 elif i == max(s): nums[-1] += 1 nums[-2] += 1 else: nums[i-1] += 1 nums[i] += 1 nums[i+1] += 1 print(max(nums))
s626395973
p03611
u731436822
1585932622
Python
Python (3.4.3)
py
Runtime Error
40
13964
189
N = int(input()) A = list(map(int,input().split())) max_n = max(A,1) cnt = [0]*max_n for i in range(max_A): for a in A: if abs(ai-i)<=1: cnt[i] += 1 print(max(cnt))
s385503970
p03611
u731436822
1585931479
Python
Python (3.4.3)
py
Runtime Error
2104
14092
188
N = int(input()) A = list(map(int,input().split())) max_n = max(A) cnt = [0]*max_n for i in range(1,max_n): for a in A: if abs(a-i)<=1: cnt[i] += 1 print(max(cnt))
s742124436
p03611
u970809473
1585787827
Python
Python (3.4.3)
py
Runtime Error
132
13964
290
n = int(input()) a = list(map(int, input().split())) b = [0] * pow(10,5) for i in range(n): if a[i] == 0: b[0] += 1 b[1] += 1 elif a[i] == pow(10,5): b[pow(10,5) - 1] += 1 b[pow(10,5)] += 1 else: b[a[i]] += 1 b[a[i] - 1] += 1 b[a[i] + 1] += 1 print(max(b))
s108534166
p03611
u151005508
1585669957
Python
Python (3.4.3)
py
Runtime Error
80
14008
204
N = int(input()) a=list(map(int, input().split())) cnt=[0]*(max(a)+1) for i in range(N): cnt[a[i]]+=1 #print(cnt) tri=[cnt[i]+cnt[i+1]+cnt[i+2] for i in range(len(cnt)-2)] #print(tri) print(max(tri))
s573330394
p03611
u744034042
1585616746
Python
Python (3.4.3)
py
Runtime Error
2104
13964
165
n = int(input()) a = list(map(int, input().split())) cnt = [0]*(max(a)) for i in range(max(a)): cnt[i] = a.count(i-1) + a.count(i) + a.count(i+1) print(max(cnt))
s597495955
p03611
u755180064
1585527919
Python
PyPy3 (2.4.0)
py
Runtime Error
2109
89156
583
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 s_li: v_1 = s_li.count(v - 1) v_0 = s_li.count(v) + s_li.count(v + 1) v_2 = s_li.count(v + 2) t_c = v_1 + v_0 ...
s914765011
p03611
u148551245
1585527345
Python
Python (3.4.3)
py
Runtime Error
17
2940
1741
// 入力マクロ // https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::st...