node_ids
listlengths 4
1.4k
| edge_index
listlengths 1
2.22k
| text
listlengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
0,
13,
4,
13,
0,
13,
39,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
4,
18,
13,
13,
13,
0,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
39,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13
] |
[
[
37,
2
],
[
34,
6
],
[
43,
9
],
[
13,
12
],
[
38,
12
],
[
44,
16
],
[
41,
16
],
[
12,
17
],
[
35,
20
],
[
12,
22
],
[
40,
24
],
[
12,
25
],
[
35,
31
],
[
34,
35
],
[
37,
38
],
[
12,
40
],
[
40,
41
],
[
43,
44
]
] |
[
"s=input()\nans=[]\npre=\"\"\nfor i in s:\n if pre!=i:\n ans.append(i)\n pre=i\n\nprint(len(ans)-1)",
"s=input()",
"s",
"input()",
"input",
"ans=[]",
"ans",
"[]",
"pre=\"\"",
"pre",
"\"\"",
"for i in s:\n if pre!=i:\n ans.append(i)\n pre=i",
"i",
"s",
"if pre!=i:\n ans.append(i)\n pre=i",
"pre!=i",
"pre",
"i",
"ans.append(i)",
"ans.append",
"ans",
"append",
"i",
"pre=i",
"pre",
"i",
"print(len(ans)-1)",
"print",
"len(ans)-1",
"len(ans)",
"len",
"ans",
"1",
"ans=[]",
"[]",
"ans",
"s=input()",
"input()",
"s",
"pre=i",
"i",
"pre",
"pre=\"\"",
"\"\"",
"pre"
] |
s=input()
ans=[]
pre=""
for i in s:
if pre!=i:
ans.append(i)
pre=i
print(len(ans)-1)
|
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
40,
13,
18,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
50,
2
],
[
53,
6
],
[
51,
9
],
[
56,
11
],
[
47,
14
],
[
51,
16
],
[
20,
19
],
[
54,
22
],
[
48,
25
],
[
42,
25
],
[
51,
27
],
[
19,
28
],
[
44,
30
],
[
41,
33
],
[
51,
35
],
[
19,
36
],
[
45,
39
],
[
57,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
],
[
56,
57
]
] |
[
"s=input()\nn=len(s)\ncnt=0\np=s[0]\nfor i in range(n):\n if p!= s[i]:\n cnt+=1\n p=s[i]\nprint(cnt)",
"s=input()",
"s",
"input()",
"input",
"n=len(s)",
"n",
"len(s)",
"len",
"s",
"cnt=0",
"cnt",
"0",
"p=s[0]",
"p",
"s[0]",
"s",
"0",
"for i in range(n):\n if p!= s[i]:\n cnt+=1\n p=s[i]",
"i",
"range(n)",
"range",
"n",
"if p!= s[i]:\n cnt+=1\n ",
"p!= s[i]",
"p",
"s[i]",
"s",
"i",
"cnt+=1",
"cnt",
"1",
"p=s[i]",
"p",
"s[i]",
"s",
"i",
"print(cnt)",
"print",
"cnt",
"p=s[i]",
"s[i]",
"p",
"cnt+=1",
"1",
"cnt",
"p=s[0]",
"s[0]",
"p",
"s=input()",
"input()",
"s",
"n=len(s)",
"len(s)",
"n",
"cnt=0",
"0",
"cnt"
] |
s=input()
n=len(s)
cnt=0
p=s[0]
for i in range(n):
if p!= s[i]:
cnt+=1
p=s[i]
print(cnt)
|
[
7,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
18,
13,
39,
17,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13
] |
[
[
39,
2
],
[
33,
6
],
[
40,
8
],
[
36,
11
],
[
15,
14
],
[
40,
16
],
[
14,
21
],
[
34,
22
],
[
46,
22
],
[
42,
24
],
[
45,
27
],
[
14,
28
],
[
43,
31
],
[
37,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
],
[
14,
45
],
[
45,
46
]
] |
[
"S = input()\n\ns_ = S[0]\n\nans = 0\nfor s in S[1:]:\n if s != s_:\n ans += 1\n s_ = s\n\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"s_ = S[0]",
"s_",
"S[0]",
"S",
"0",
"ans = 0",
"ans",
"0",
"for s in S[1:]:\n if s != s_:\n ans += 1\n s_ = s",
"s",
"S[1:]",
"S",
"1:",
"1",
"if s != s_:\n ans += 1\n ",
"s != s_",
"s",
"s_",
"ans += 1",
"ans",
"1",
"s_ = s",
"s_",
"s",
"print(ans)",
"print",
"ans",
"s_ = S[0]",
"S[0]",
"s_",
"ans = 0",
"0",
"ans",
"S = input()",
"input()",
"S",
"ans += 1",
"1",
"ans",
"s_ = s",
"s",
"s_"
] |
S = input()
s_ = S[0]
ans = 0
for s in S[1:]:
if s != s_:
ans += 1
s_ = s
print(ans)
|
[
7,
0,
13,
4,
13,
14,
2,
4,
13,
13,
4,
13,
4,
18,
13,
13,
17,
4,
18,
13,
13,
17,
4,
13,
17,
4,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
2,
13,
17,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
61,
2
],
[
62,
9
],
[
62,
14
],
[
62,
19
],
[
52,
28
],
[
58,
31
],
[
35,
34
],
[
62,
34
],
[
34,
38
],
[
53,
39
],
[
56,
39
],
[
64,
41
],
[
55,
44
],
[
34,
45
],
[
65,
49
],
[
59,
49
],
[
52,
53
],
[
34,
55
],
[
55,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
]
] |
[
"S=input()\nif len(S)==max(S.count('W'),S.count('B')):\n print(0)\n exit()\nelse:\n t=''\n cnt=0\n for i in S:\n if i!=t:\n cnt+=1\n t=i\n\n print(cnt-1)",
"S=input()",
"S",
"input()",
"input",
"if len(S)==max(S.count('W'),S.count('B')):\n print(0)\n exit()\nelse:\n t=''\n cnt=0\n for i in S:\n if i!=t:\n cnt+=1\n t=i\n\n print(cnt-1)",
"len(S)==max(S.count('W'),S.count('B'))",
"len(S)",
"len",
"S",
"max(S.count('W'),S.count('B'))",
"max",
"S.count('W')",
"S.count",
"S",
"count",
"'W'",
"S.count('B')",
"S.count",
"S",
"count",
"'B'",
"print(0)",
"print",
"0",
"exit()",
"exit",
"t=''",
"t",
"''",
"cnt=0",
"cnt",
"0",
"for i in S:\n if i!=t:\n cnt+=1\n t=i\n\n ",
"i",
"S",
"if i!=t:\n cnt+=1\n t=i\n\n ",
"i!=t",
"i",
"t",
"cnt+=1",
"cnt",
"1",
"t=i",
"t",
"i",
"print(cnt-1)",
"print",
"cnt-1",
"cnt",
"1",
"t=''",
"''",
"t",
"t=i",
"i",
"t",
"cnt=0",
"0",
"cnt",
"S=input()",
"input()",
"S",
"cnt+=1",
"1",
"cnt"
] |
S=input()
if len(S)==max(S.count('W'),S.count('B')):
print(0)
exit()
else:
t=''
cnt=0
for i in S:
if i!=t:
cnt+=1
t=i
print(cnt-1)
|
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
37,
2
],
[
46,
6
],
[
38,
9
],
[
40,
11
],
[
15,
14
],
[
47,
18
],
[
38,
23
],
[
14,
24
],
[
38,
26
],
[
14,
28
],
[
43,
31
],
[
44,
35
],
[
41,
35
],
[
37,
38
],
[
40,
41
],
[
43,
44
],
[
46,
47
]
] |
[
"S=input()\nN=len(S)\n\ncount=0\nfor i in range(N-1):\n if S[i]!=S[i+1]:\n count+=1\n\nprint(count)",
"S=input()",
"S",
"input()",
"input",
"N=len(S)",
"N",
"len(S)",
"len",
"S",
"count=0",
"count",
"0",
"for i in range(N-1):\n if S[i]!=S[i+1]:\n count+=1",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"if S[i]!=S[i+1]:\n count+=1",
"S[i]!=S[i+1]",
"S[i]",
"S",
"i",
"S[i+1]",
"S",
"i+1",
"i",
"1",
"count+=1",
"count",
"1",
"print(count)",
"print",
"count",
"S=input()",
"input()",
"S",
"count=0",
"0",
"count",
"count+=1",
"1",
"count",
"N=len(S)",
"len(S)",
"N"
] |
S=input()
N=len(S)
count=0
for i in range(N-1):
if S[i]!=S[i+1]:
count+=1
print(count)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
14,
2,
18,
13,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
13,
2,
18,
13,
13,
17,
0,
13,
17,
0,
13,
17,
14,
2,
40,
13,
2,
18,
13,
13,
17,
0,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
78,
2
],
[
84,
8
],
[
79,
11
],
[
87,
13
],
[
79,
18
],
[
75,
22
],
[
72,
25
],
[
29,
28
],
[
85,
32
],
[
76,
35
],
[
88,
35
],
[
82,
35
],
[
70,
35
],
[
79,
38
],
[
28,
39
],
[
69,
42
],
[
66,
45
],
[
76,
50
],
[
88,
50
],
[
82,
50
],
[
70,
50
],
[
79,
53
],
[
28,
54
],
[
81,
57
],
[
90,
60
],
[
91,
64
],
[
67,
64
],
[
73,
64
],
[
66,
67
],
[
69,
70
],
[
72,
73
],
[
75,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
]
] |
[
"s = list(input())\nn = len(s)\nb = False\nif s[0] == \"B\":\n b = True\n\nans = 0\nfor i in range(1, n):\n if b and s[i] == \"W\":\n b = False\n ans += 1\n elif not b and s[i] == \"B\":\n b = True\n ans += 1\nprint(ans)",
"s = list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"n = len(s)",
"n",
"len(s)",
"len",
"s",
"b = False",
"b",
"False",
"if s[0] == \"B\":\n b = True",
"s[0] == \"B\"",
"s[0]",
"s",
"0",
"\"B\"",
"b = True",
"b",
"True",
"ans = 0",
"ans",
"0",
"for i in range(1, n):\n if b and s[i] == \"W\":\n b = False\n ans += 1\n elif not b and s[i] == \"B\":\n b = True\n ans += 1",
"i",
"range(1, n)",
"range",
"1",
"n",
"if b and s[i] == \"W\":\n b = False\n ans += 1\n elif not b and s[i] == \"B\":\n b = True\n ans += 1",
"b and s[i] == \"W\"",
"b",
"s[i] == \"W\"",
"s[i]",
"s",
"i",
"\"W\"",
"b = False",
"b",
"False",
"ans += 1",
"ans",
"1",
"elif not b and s[i] == \"B\":\n b = True\n ans += 1",
"not b and s[i] == \"B\"",
"not b",
"b",
"s[i] == \"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"b = True",
"b",
"True",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"b = False",
"False",
"b",
"ans = 0",
"0",
"ans",
"b = True",
"True",
"b",
"s = list(input())",
"list(input())",
"s",
"b = True",
"True",
"b",
"n = len(s)",
"len(s)",
"n",
"b = False",
"False",
"b",
"ans += 1",
"1",
"ans"
] |
s = list(input())
n = len(s)
b = False
if s[0] == "B":
b = True
ans = 0
for i in range(1, n):
if b and s[i] == "W":
b = False
ans += 1
elif not b and s[i] == "B":
b = True
ans += 1
print(ans)
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
15,
0,
13,
18,
4,
13,
39,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13
] |
[
[
46,
4
],
[
55,
12
],
[
47,
15
],
[
49,
19
],
[
23,
22
],
[
56,
28
],
[
56,
32
],
[
22,
33
],
[
56,
35
],
[
22,
37
],
[
52,
40
],
[
53,
44
],
[
50,
44
],
[
46,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
]
] |
[
"import sys\ninput = sys.stdin.readline\nfrom collections import *\n\nS = input()[:-1]\nans = 0\n\nfor i in range(1, len(S)):\n if S[i]!=S[i-1]:\n ans += 1\n\nprint(ans)",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"from collections import *",
"S = input()[:-1]",
"S",
"input()[:-1]",
"()",
"input",
":-1",
"-1",
"ans = 0",
"ans",
"0",
"for i in range(1, len(S)):\n if S[i]!=S[i-1]:\n ans += 1",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i]!=S[i-1]:\n ans += 1",
"S[i]!=S[i-1]",
"S[i]",
"S",
"i",
"S[i-1]",
"S",
"i-1",
"i",
"1",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"ans = 0",
"0",
"ans",
"ans += 1",
"1",
"ans",
"S = input()[:-1]",
"input()[:-1]",
"S"
] |
import sys
input = sys.stdin.readline
from collections import *
S = input()[:-1]
ans = 0
for i in range(1, len(S)):
if S[i]!=S[i-1]:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
4,
13,
40,
13,
13,
10,
4,
13
] |
[
[
13,
2
],
[
13,
14
]
] |
[
"s = input()\nprint(sum(a != b for a, b in zip(s[1:], s[:-1])))",
"s = input()",
"s",
"input()",
"input",
"print(sum(a != b for a, b in zip(s[1:], s[:-1])))",
"print",
"sum(a != b for a, b in zip(s[1:], s[:-1]))",
"sum",
"a != b",
"a",
"b",
"s = input()",
"input()",
"s"
] |
s = input()
print(sum(a != b for a, b in zip(s[1:], s[:-1])))
|
[
7,
15,
13,
0,
13,
4,
13,
0,
13,
4,
18,
13,
13,
17,
17,
13,
0,
13,
4,
18,
13,
13,
17,
17,
13,
0,
13,
2,
4,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] |
[
[
36,
4
],
[
45,
8
],
[
37,
15
],
[
39,
17
],
[
46,
24
],
[
37,
24
],
[
42,
26
],
[
40,
30
],
[
46,
30
],
[
37,
30
],
[
43,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
]
] |
[
"import re\ns = input()\ns = re.sub('[W]+', 'W', s)\ns = re.sub('[B]+', 'B', s)\nans = len(s) - 1\nprint(ans)",
"import re",
"re",
"s = input()",
"s",
"input()",
"input",
"s = re.sub('[W]+', 'W', s)",
"s",
"re.sub('[W]+', 'W', s)",
"re.sub",
"re",
"sub",
"'[W]+'",
"'W'",
"s",
"s = re.sub('[B]+', 'B', s)",
"s",
"re.sub('[B]+', 'B', s)",
"re.sub",
"re",
"sub",
"'[B]+'",
"'B'",
"s",
"ans = len(s) - 1",
"ans",
"len(s) - 1",
"len(s)",
"len",
"s",
"1",
"print(ans)",
"print",
"ans",
"s = input()",
"input()",
"s",
"s = re.sub('[B]+', 'B', s)",
"re.sub('[B]+', 'B', s)",
"s",
"ans = len(s) - 1",
"len(s) - 1",
"ans",
"s = re.sub('[W]+', 'W', s)",
"re.sub('[W]+', 'W', s)",
"s"
] |
import re
s = input()
s = re.sub('[W]+', 'W', s)
s = re.sub('[B]+', 'B', s)
ans = len(s) - 1
print(ans)
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
0,
13,
4,
18,
13,
13,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
13,
9,
14,
2,
13,
13,
9,
0,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
57,
4
],
[
66,
11
],
[
58,
13
],
[
54,
15
],
[
67,
18
],
[
69,
23
],
[
75,
26
],
[
30,
29
],
[
55,
29
],
[
67,
29
],
[
70,
33
],
[
61,
33
],
[
73,
33
],
[
72,
36
],
[
29,
37
],
[
73,
41
],
[
70,
41
],
[
61,
41
],
[
29,
42
],
[
60,
45
],
[
29,
46
],
[
63,
48
],
[
64,
52
],
[
76,
52
],
[
54,
55
],
[
57,
58
],
[
29,
60
],
[
60,
61
],
[
63,
64
],
[
66,
67
],
[
69,
70
],
[
29,
72
],
[
72,
73
],
[
75,
76
]
] |
[
"import sys\n\ninput = sys.stdin.readline\nS = input()\nS = S.replace('\\n' , '')\ntmp = \"\"\ndivision_count = 0\nfor s in S:\n if tmp == \"\":\n tmp = s\n continue\n if tmp == s:\n continue\n else:\n tmp = s\n division_count += 1\nprint(division_count)",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"S = input()",
"S",
"input()",
"input",
"S = S.replace('\\n' , '')",
"S",
"S.replace('\\n' , '')",
"S.replace",
"S",
"replace",
"'\\n'",
"''",
"tmp = \"\"",
"tmp",
"\"\"",
"division_count = 0",
"division_count",
"0",
"for s in S:\n if tmp == \"\":\n tmp = s\n continue\n if tmp == s:\n continue\n else:\n tmp = s\n division_count += 1",
"s",
"S",
"if tmp == \"\":\n tmp = s\n continue\n ",
"tmp == \"\"",
"tmp",
"\"\"",
"tmp = s",
"tmp",
"s",
"continue",
"if tmp == s:\n continue\n else:\n tmp = s\n division_count += 1",
"tmp == s",
"tmp",
"s",
"continue",
"tmp = s",
"tmp",
"s",
"division_count += 1",
"division_count",
"1",
"print(division_count)",
"print",
"division_count",
"S = S.replace('\\n' , '')",
"S.replace('\\n' , '')",
"S",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"tmp = s",
"s",
"tmp",
"division_count += 1",
"1",
"division_count",
"S = input()",
"input()",
"S",
"tmp = \"\"",
"\"\"",
"tmp",
"tmp = s",
"s",
"tmp",
"division_count = 0",
"0",
"division_count"
] |
import sys
input = sys.stdin.readline
S = input()
S = S.replace('\n' , '')
tmp = ""
division_count = 0
for s in S:
if tmp == "":
tmp = s
continue
if tmp == s:
continue
else:
tmp = s
division_count += 1
print(division_count)
|
[
7,
12,
13,
17,
15,
0,
13,
39,
13,
39,
0,
13,
39,
17,
28,
13,
13,
4,
13,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
2,
18,
13,
17,
13,
29,
39,
13,
13,
13,
23,
13,
0,
13,
4,
13,
4,
13,
13,
13,
4,
13,
2,
4,
13,
13,
17,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13
] |
[
[
7,
6
],
[
9,
8
],
[
12,
11
],
[
52,
19
],
[
6,
22
],
[
27,
26
],
[
8,
34
],
[
26,
36
],
[
11,
39
],
[
11,
43
],
[
26,
45
],
[
52,
52
],
[
78,
54
],
[
76,
56
],
[
78,
59
],
[
78,
60
],
[
70,
66
],
[
78,
70
],
[
78,
73
],
[
78,
79
]
] |
[
"def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n n = len(list(v))\n s_sum.append(n)\n s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx\n\n\nS_composed, _, _ = run_length_encoding(input())\nprint(len(S_composed) - 1)",
"def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n n = len(list(v))\n s_sum.append(n)\n s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx",
"run_length_encoding",
"'''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''",
"from itertools import groupby",
"s_composed, s_sum = [], []",
"s_composed",
"[]",
"s_sum",
"[]",
"s_idx = [0]",
"s_idx",
"[0]",
"0",
"for k, v in groupby(s):\n s_composed.append(k)\n n = len(list(v))\n s_sum.append(n)\n s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n ",
"k",
"v",
"groupby(s)",
"groupby",
"s",
"s_composed.append(k)",
"s_composed.append",
"s_composed",
"append",
"k",
"n = len(list(v))",
"n",
"len(list(v))",
"len",
"list(v)",
"list",
"v",
"s_sum.append(n)",
"s_sum.append",
"s_sum",
"append",
"n",
"s_idx.append(s_idx[-1] + n)",
"s_idx.append",
"s_idx",
"append",
"s_idx[-1] + n",
"s_idx[-1]",
"s_idx",
"-1",
"n",
"return s_composed, s_sum, s_idx",
"return s_composed, s_sum, s_idx",
"s_composed",
"s_sum",
"s_idx",
"s",
"s",
"S_composed, _, _ = run_length_encoding(input())",
"S_composed",
"run_length_encoding(input())",
"run_length_encoding",
"input()",
"input",
"_",
"_",
"print(len(S_composed) - 1)",
"print",
"len(S_composed) - 1",
"len(S_composed)",
"len",
"S_composed",
"1",
"S_composed, _, _ = run_length_encoding(input())",
"run_length_encoding(input())",
"S_composed",
"_, _ = run_length_encoding(input())",
"run_length_encoding(input())",
"_",
"def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n n = len(list(v))\n s_sum.append(n)\n s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx",
"def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n n = len(list(v))\n s_sum.append(n)\n s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx",
"run_length_encoding",
"_ = run_length_encoding(input())",
"run_length_encoding(input())",
"_"
] |
def run_length_encoding(s):
'''連長圧縮を行う
s ... iterable object e.g. list, str
return
----------
s_composed,s_num,s_idx
それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''
from itertools import groupby
s_composed, s_sum = [], []
s_idx = [0]
for k, v in groupby(s):
s_composed.append(k)
n = len(list(v))
s_sum.append(n)
s_idx.append(s_idx[-1] + n)
# assert len(s_sum) == len(s_composed)
return s_composed, s_sum, s_idx
S_composed, _, _ = run_length_encoding(input())
print(len(S_composed) - 1)
|
[
7,
0,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
40,
18,
13,
13,
18,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
43,
2
],
[
58,
9
],
[
44,
12
],
[
49,
14
],
[
55,
17
],
[
21,
20
],
[
59,
24
],
[
44,
28
],
[
20,
29
],
[
44,
31
],
[
50,
32
],
[
47,
32
],
[
52,
34
],
[
46,
37
],
[
20,
38
],
[
53,
41
],
[
56,
41
],
[
43,
44
],
[
20,
46
],
[
46,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
],
[
58,
59
]
] |
[
"S = input().strip()\nN = len(S)\ncur = 0\ncnt = 0\nfor i in range(1,N):\n if S[i]!=S[cur]:\n cnt += 1\n cur = i\nprint(cnt)",
"S = input().strip()",
"S",
"input().strip()",
"().strip",
"()",
"input",
"strip",
"N = len(S)",
"N",
"len(S)",
"len",
"S",
"cur = 0",
"cur",
"0",
"cnt = 0",
"cnt",
"0",
"for i in range(1,N):\n if S[i]!=S[cur]:\n cnt += 1\n cur = i",
"i",
"range(1,N)",
"range",
"1",
"N",
"if S[i]!=S[cur]:\n cnt += 1\n cur = i",
"S[i]!=S[cur]",
"S[i]",
"S",
"i",
"S[cur]",
"S",
"cur",
"cnt += 1",
"cnt",
"1",
"cur = i",
"cur",
"i",
"print(cnt)",
"print",
"cnt",
"S = input().strip()",
"input().strip()",
"S",
"cur = i",
"i",
"cur",
"cur = 0",
"0",
"cur",
"cnt += 1",
"1",
"cnt",
"cnt = 0",
"0",
"cnt",
"N = len(S)",
"len(S)",
"N"
] |
S = input().strip()
N = len(S)
cur = 0
cnt = 0
for i in range(1,N):
if S[i]!=S[cur]:
cnt += 1
cur = i
print(cnt)
|
[
7,
0,
13,
4,
13,
0,
13,
2,
17,
17,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
40,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
40,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] |
[
[
83,
2
],
[
77,
6
],
[
68,
11
],
[
84,
13
],
[
74,
16
],
[
20,
19
],
[
84,
19
],
[
69,
23
],
[
87,
23
],
[
19,
24
],
[
86,
26
],
[
19,
27
],
[
92,
29
],
[
65,
32
],
[
78,
35
],
[
93,
36
],
[
75,
36
],
[
95,
38
],
[
42,
41
],
[
84,
44
],
[
87,
47
],
[
69,
47
],
[
72,
47
],
[
41,
48
],
[
71,
50
],
[
41,
51
],
[
89,
53
],
[
80,
56
],
[
66,
59
],
[
78,
59
],
[
90,
60
],
[
96,
60
],
[
93,
60
],
[
75,
60
],
[
81,
63
],
[
66,
63
],
[
78,
63
],
[
65,
66
],
[
68,
69
],
[
41,
71
],
[
71,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
],
[
19,
86
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
]
] |
[
"s = input()\n\nmin_value = 10 ** 9\n\n# 左端に置く場合\npivot = s[0]\nresult = 0\nfor c in s:\n if pivot != c:\n pivot = c\n result += 1\nmin_value = min(min_value, result)\n\n# 右端に置く場合\nresult = 0\nfor c in reversed(s):\n if pivot != c:\n pivot = c\n result += 1\nmin_value = min(min_value, result)\nprint(min_value)",
"s = input()",
"s",
"input()",
"input",
"min_value = 10 ** 9",
"min_value",
"10 ** 9",
"10",
"9",
"pivot = s[0]",
"pivot",
"s[0]",
"s",
"0",
"result = 0",
"result",
"0",
"for c in s:\n if pivot != c:\n pivot = c\n result += 1",
"c",
"s",
"if pivot != c:\n pivot = c\n result += 1",
"pivot != c",
"pivot",
"c",
"pivot = c",
"pivot",
"c",
"result += 1",
"result",
"1",
"min_value = min(min_value, result)",
"min_value",
"min(min_value, result)",
"min",
"min_value",
"result",
"result = 0",
"result",
"0",
"for c in reversed(s):\n if pivot != c:\n pivot = c\n result += 1",
"c",
"reversed(s)",
"reversed",
"s",
"if pivot != c:\n pivot = c\n result += 1",
"pivot != c",
"pivot",
"c",
"pivot = c",
"pivot",
"c",
"result += 1",
"result",
"1",
"min_value = min(min_value, result)",
"min_value",
"min(min_value, result)",
"min",
"min_value",
"result",
"print(min_value)",
"print",
"min_value",
"min_value = min(min_value, result)",
"min(min_value, result)",
"min_value",
"pivot = s[0]",
"s[0]",
"pivot",
"pivot = c",
"c",
"pivot",
"result = 0",
"0",
"result",
"min_value = 10 ** 9",
"10 ** 9",
"min_value",
"min_value = min(min_value, result)",
"min(min_value, result)",
"min_value",
"s = input()",
"input()",
"s",
"pivot = c",
"c",
"pivot",
"result += 1",
"1",
"result",
"result += 1",
"1",
"result",
"result = 0",
"0",
"result"
] |
s = input()
min_value = 10 ** 9
# 左端に置く場合
pivot = s[0]
result = 0
for c in s:
if pivot != c:
pivot = c
result += 1
min_value = min(min_value, result)
# 右端に置く場合
result = 0
for c in reversed(s):
if pivot != c:
pivot = c
result += 1
min_value = min(min_value, result)
print(min_value)
|
[
7,
15,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
39,
4
],
[
36,
8
],
[
12,
11
],
[
40,
17
],
[
40,
22
],
[
11,
23
],
[
40,
25
],
[
11,
27
],
[
42,
30
],
[
43,
34
],
[
37,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
]
] |
[
"import re\nstring = input()\nans = 0\nfor i in range(len(string)-1):\n if string[i] != string[i+1]:\n ans += 1\nprint(ans)",
"import re",
"re",
"string = input()",
"string",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for i in range(len(string)-1):\n if string[i] != string[i+1]:\n ans += 1",
"i",
"range(len(string)-1)",
"range",
"len(string)-1",
"len(string)",
"len",
"string",
"1",
"if string[i] != string[i+1]:\n ans += 1",
"string[i] != string[i+1]",
"string[i]",
"string",
"i",
"string[i+1]",
"string",
"i+1",
"i",
"1",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans = 0",
"0",
"ans",
"string = input()",
"input()",
"string",
"ans += 1",
"1",
"ans"
] |
import re
string = input()
ans = 0
for i in range(len(string)-1):
if string[i] != string[i+1]:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
13,
14,
2,
13,
13,
9,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13
] |
[
[
36,
2
],
[
39,
8
],
[
33,
11
],
[
37,
13
],
[
17,
16
],
[
37,
16
],
[
16,
20
],
[
34,
21
],
[
46,
21
],
[
42,
24
],
[
45,
27
],
[
16,
28
],
[
43,
31
],
[
40,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
],
[
16,
45
],
[
45,
46
]
] |
[
"S=list(input())\nans=0\nnow=S[0]\nfor s in S:\n if s==now:\n continue\n ans+=1\n now=s\nprint(ans)",
"S=list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"ans=0",
"ans",
"0",
"now=S[0]",
"now",
"S[0]",
"S",
"0",
"for s in S:\n if s==now:\n continue\n ans+=1\n now=s",
"s",
"S",
"if s==now:\n continue\n ",
"s==now",
"s",
"now",
"continue",
"ans+=1",
"ans",
"1",
"now=s",
"now",
"s",
"print(ans)",
"print",
"ans",
"now=S[0]",
"S[0]",
"now",
"S=list(input())",
"list(input())",
"S",
"ans=0",
"0",
"ans",
"ans+=1",
"1",
"ans",
"now=s",
"s",
"now"
] |
S=list(input())
ans=0
now=S[0]
for s in S:
if s==now:
continue
ans+=1
now=s
print(ans)
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
12,
2,
4,
13,
13,
17,
23,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
12,
13,
23,
13,
23,
13,
17,
0,
13,
4,
13,
17,
12,
13,
0,
13,
4,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
0,
13,
39,
28,
13,
4,
13,
17,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
17,
4,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
17,
4,
18,
13,
13,
13,
4,
13,
2,
4,
13,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13
] |
[
[
122,
11
],
[
32,
31
],
[
144,
37
],
[
41,
41
],
[
45,
45
],
[
48,
47
],
[
146,
50
],
[
58,
57
],
[
64,
63
],
[
57,
65
],
[
69,
68
],
[
72,
71
],
[
75,
74
],
[
57,
80
],
[
57,
84
],
[
74,
85
],
[
63,
86
],
[
96,
86
],
[
89,
88
],
[
71,
92
],
[
68,
94
],
[
101,
94
],
[
88,
94
],
[
97,
96
],
[
57,
98
],
[
74,
99
],
[
102,
101
],
[
71,
105
],
[
101,
107
],
[
88,
107
],
[
68,
107
],
[
71,
113
],
[
126,
120
],
[
122,
123
],
[
146,
147
]
] |
[
"import sys\nsys.setrecursionlimit(10 ** 6)\n# input = sys.stdin.readline ####\nint1 = lambda x: int(x) - 1\ndef II(): return int(input())\n\ndef MI(): return map(int, input().split())\ndef MI1(): return map(int1, input().split())\n\ndef LI(): return list(map(int, input().split()))\ndef LI1(): return list(map(int1, input().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\n\ndef printlist(lst, k='\\n'): print(k.join(list(map(str, lst))))\nINF = float('inf')\n\ndef solve():\n S = list(input())\n\n obj = S[0]\n cnt = 1\n L = []\n for i in range(1, len(S)):\n if S[i] == obj:\n cnt += 1\n else:\n L.append(cnt)\n obj = S[i]\n cnt = 1\n L.append(cnt)\n\n # print(L)\n print(len(L) - 1)\n\n\nif __name__ == '__main__':\n solve()",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 6",
"10",
"6",
"int1 = lambda x: int(x) - 1",
"int1",
"lambda x: int(x) - 1",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"x",
"def II(): return int(input())",
"II",
"def MI(): return map(int, input().split())",
"MI",
"def MI1(): return map(int1, input().split())",
"MI1",
"def LI(): return list(map(int, input().split()))",
"LI",
"def LI1(): return list(map(int1, input().split()))",
"LI1",
"LI() for _ in range(rows_number)",
"for _ in range(rows_number)",
"_",
"range(rows_number)",
"range",
"rows_number",
"for _ in range(rows_number)",
"LI()",
"LI",
"def LLI(rows_number): return [LI() for _ in range(rows_number)]",
"LLI",
"rows_number",
"rows_number",
"def printlist(lst, k='\\n'): print(k.join(list(map(str, lst))))",
"printlist",
"lst",
"lst",
"k='\\n'",
"k",
"'\\n'",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"def solve():\n S = list(input())\n\n obj = S[0]\n cnt = 1\n L = []\n for i in range(1, len(S)):\n if S[i] == obj:\n cnt += 1\n else:\n L.append(cnt)\n obj = S[i]\n cnt = 1\n L.append(cnt)\n\n # print(L)\n print(len(L) - 1)",
"solve",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"obj = S[0]",
"obj",
"S[0]",
"S",
"0",
"cnt = 1",
"cnt",
"1",
"L = []",
"L",
"[]",
"for i in range(1, len(S)):\n if S[i] == obj:\n cnt += 1\n else:\n L.append(cnt)\n obj = S[i]\n cnt = 1\n ",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i] == obj:\n cnt += 1\n else:\n L.append(cnt)\n obj = S[i]\n cnt = 1\n ",
"S[i] == obj",
"S[i]",
"S",
"i",
"obj",
"cnt += 1",
"cnt",
"1",
"L.append(cnt)",
"L.append",
"L",
"append",
"cnt",
"obj = S[i]",
"obj",
"S[i]",
"S",
"i",
"cnt = 1",
"cnt",
"1",
"L.append(cnt)",
"L.append",
"L",
"append",
"cnt",
"print(len(L) - 1)",
"print",
"len(L) - 1",
"len(L)",
"len",
"L",
"1",
"if __name__ == '__main__':\n solve()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"solve()",
"solve",
"int1 = lambda x: int(x) - 1",
"lambda x: int(x) - 1",
"int1",
"def solve():\n S = list(input())\n\n obj = S[0]\n cnt = 1\n L = []\n for i in range(1, len(S)):\n if S[i] == obj:\n cnt += 1\n else:\n L.append(cnt)\n obj = S[i]\n cnt = 1\n L.append(cnt)\n\n # print(L)\n print(len(L) - 1)",
"def solve():\n S = list(input())\n\n obj = S[0]\n cnt = 1\n L = []\n for i in range(1, len(S)):\n if S[i] == obj:\n cnt += 1\n else:\n L.append(cnt)\n obj = S[i]\n cnt = 1\n L.append(cnt)\n\n # print(L)\n print(len(L) - 1)",
"solve",
"def MI(): return map(int, input().split())",
"def MI(): return map(int, input().split())",
"MI",
"def II(): return int(input())",
"def II(): return int(input())",
"II",
"def printlist(lst, k='\\n'): print(k.join(list(map(str, lst))))",
"def printlist(lst, k='\\n'): print(k.join(list(map(str, lst))))",
"printlist",
"def LI1(): return list(map(int1, input().split()))",
"def LI1(): return list(map(int1, input().split()))",
"LI1",
"def MI1(): return map(int1, input().split())",
"def MI1(): return map(int1, input().split())",
"MI1",
"def LI(): return list(map(int, input().split()))",
"def LI(): return list(map(int, input().split()))",
"LI",
"INF = float('inf')",
"float('inf')",
"INF",
"def LLI(rows_number): return [LI() for _ in range(rows_number)]",
"def LLI(rows_number): return [LI() for _ in range(rows_number)]",
"LLI"
] |
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline ####
int1 = lambda x: int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')
def solve():
S = list(input())
obj = S[0]
cnt = 1
L = []
for i in range(1, len(S)):
if S[i] == obj:
cnt += 1
else:
L.append(cnt)
obj = S[i]
cnt = 1
L.append(cnt)
# print(L)
print(len(L) - 1)
if __name__ == '__main__':
solve()
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13
] |
[
[
57,
11
],
[
51,
18
],
[
54,
24
],
[
28,
27
],
[
52,
33
],
[
52,
37
],
[
27,
39
],
[
52,
42
],
[
27,
43
],
[
60,
45
],
[
61,
49
],
[
55,
49
],
[
51,
52
],
[
54,
55
],
[
57,
58
],
[
60,
61
]
] |
[
"import sys\n# input = sys.stdin.readline\nsys.setrecursionlimit(10 ** 9)\nMOD = 10 ** 9 + 7\n\nS = list(input())\nans = 0\nfor i in range(1, len(S)):\n if S[i - 1] != S[i]:\n ans += 1\n\nprint (ans)",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for i in range(1, len(S)):\n if S[i - 1] != S[i]:\n ans += 1",
"i",
"range(1, len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[i - 1] != S[i]:\n ans += 1",
"S[i - 1] != S[i]",
"S[i - 1]",
"S",
"i - 1",
"i",
"1",
"S[i]",
"S",
"i",
"ans += 1",
"ans",
"1",
"print (ans)",
"print",
"ans",
"S = list(input())",
"list(input())",
"S",
"ans = 0",
"0",
"ans",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"ans += 1",
"1",
"ans"
] |
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
S = list(input())
ans = 0
for i in range(1, len(S)):
if S[i - 1] != S[i]:
ans += 1
print (ans)
|
[
7,
0,
13,
17,
0,
13,
4,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
14,
2,
13,
17,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13
] |
[
[
40,
2
],
[
49,
5
],
[
43,
9
],
[
50,
11
],
[
15,
14
],
[
50,
20
],
[
50,
24
],
[
14,
25
],
[
44,
26
],
[
47,
26
],
[
52,
28
],
[
46,
31
],
[
50,
33
],
[
14,
34
],
[
53,
37
],
[
41,
37
],
[
40,
41
],
[
43,
44
],
[
46,
47
],
[
49,
50
],
[
52,
53
]
] |
[
"count=0\ns=input()\ntemp = s[0]\nfor i in range(1,len(s)):\n if s[i]!=temp:\n count+=1\n temp=s[i]\n\nif count==0 : print(0)\nelse : print(count)",
"count=0",
"count",
"0",
"s=input()",
"s",
"input()",
"input",
"temp = s[0]",
"temp",
"s[0]",
"s",
"0",
"for i in range(1,len(s)):\n if s[i]!=temp:\n count+=1\n temp=s[i]",
"i",
"range(1,len(s))",
"range",
"1",
"len(s)",
"len",
"s",
"if s[i]!=temp:\n count+=1\n ",
"s[i]!=temp",
"s[i]",
"s",
"i",
"temp",
"count+=1",
"count",
"1",
"temp=s[i]",
"temp",
"s[i]",
"s",
"i",
"if count==0 : print(0)\nelse : print(count)",
"count==0",
"count",
"0",
"count=0",
"0",
"count",
"temp = s[0]",
"s[0]",
"temp",
"temp=s[i]",
"s[i]",
"temp",
"s=input()",
"input()",
"s",
"count+=1",
"1",
"count"
] |
count=0
s=input()
temp = s[0]
for i in range(1,len(s)):
if s[i]!=temp:
count+=1
temp=s[i]
if count==0 : print(0)
else : print(count)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
40,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
36,
2
],
[
39,
6
],
[
10,
9
],
[
37,
15
],
[
37,
19
],
[
9,
21
],
[
37,
24
],
[
9,
25
],
[
33,
27
],
[
34,
31
],
[
40,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
]
] |
[
"S = input()\nans = 0\nfor k in range(1,len(S)):\n if S[k-1] != S[k]:\n ans += 1\nprint(ans)",
"S = input()",
"S",
"input()",
"input",
"ans = 0",
"ans",
"0",
"for k in range(1,len(S)):\n if S[k-1] != S[k]:\n ans += 1",
"k",
"range(1,len(S))",
"range",
"1",
"len(S)",
"len",
"S",
"if S[k-1] != S[k]:\n ans += 1",
"S[k-1] != S[k]",
"S[k-1]",
"S",
"k-1",
"k",
"1",
"S[k]",
"S",
"k",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"S = input()",
"input()",
"S",
"ans = 0",
"0",
"ans"
] |
S = input()
ans = 0
for k in range(1,len(S)):
if S[k-1] != S[k]:
ans += 1
print(ans)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
0,
13,
17,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
4,
13,
18,
13,
18,
13,
17,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] |
[
[
136,
3
],
[
136,
12
],
[
118,
14
],
[
130,
26
],
[
133,
31
],
[
112,
34
],
[
137,
38
],
[
142,
40
],
[
137,
44
],
[
124,
46
],
[
137,
50
],
[
53,
52
],
[
137,
55
],
[
139,
57
],
[
131,
60
],
[
140,
60
],
[
119,
62
],
[
52,
63
],
[
121,
65
],
[
134,
68
],
[
122,
68
],
[
119,
70
],
[
52,
71
],
[
76,
73
],
[
113,
74
],
[
52,
75
],
[
140,
76
],
[
131,
76
],
[
81,
78
],
[
143,
79
],
[
52,
80
],
[
122,
81
],
[
134,
81
],
[
86,
83
],
[
125,
84
],
[
52,
85
],
[
119,
88
],
[
52,
89
],
[
140,
90
],
[
131,
90
],
[
145,
92
],
[
125,
95
],
[
115,
97
],
[
146,
100
],
[
103,
102
],
[
146,
107
],
[
116,
109
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
136,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
]
] |
[
"# D - 高橋君と見えざる手\n# https://atcoder.jp/contests/abc047/tasks/arc063_b\n\nfrom collections import Counter\nN,T=map(int,input().split())\nA=list(map(int,input().split()))\n\nmini=10**9\nmaxi=0\nm = [0]*N\nM = [0]*N\nz = [0]*N\nfor i in range(N):\n mini=min(mini,A[i])\n maxi=max(maxi,A[i])\n m[i]= mini\n M[i]= maxi\n z[i]= A[i]-mini\nk=Counter(z)\nl=sorted(k,reverse=True)\n#print(l)\nprint(k[l[0]])",
"from collections import Counter",
"N,T=map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A=list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mini=10**9",
"mini",
"10**9",
"10",
"9",
"maxi=0",
"maxi",
"0",
"m = [0]*N",
"m",
"[0]*N",
"[0]",
"0",
"N",
"M = [0]*N",
"M",
"[0]*N",
"[0]",
"0",
"N",
"z = [0]*N",
"z",
"[0]*N",
"[0]",
"0",
"N",
"for i in range(N):\n mini=min(mini,A[i])\n maxi=max(maxi,A[i])\n m[i]= mini\n M[i]= maxi\n z[i]= A[i]-mini",
"i",
"range(N)",
"range",
"N",
"mini=min(mini,A[i])",
"mini",
"min(mini,A[i])",
"min",
"mini",
"A[i]",
"A",
"i",
"maxi=max(maxi,A[i])",
"maxi",
"max(maxi,A[i])",
"max",
"maxi",
"A[i]",
"A",
"i",
"m[i]= mini",
"m[i]",
"m",
"i",
"mini",
"M[i]= maxi",
"M[i]",
"M",
"i",
"maxi",
"z[i]= A[i]-mini",
"z[i]",
"z",
"i",
"A[i]-mini",
"A[i]",
"A",
"i",
"mini",
"k=Counter(z)",
"k",
"Counter(z)",
"Counter",
"z",
"l=sorted(k,reverse=True)",
"l",
"sorted(k,reverse=True)",
"sorted",
"k",
"reverse=True",
"reverse",
"True",
"print(k[l[0]])",
"print",
"k[l[0]]",
"k",
"l[0]",
"l",
"0",
"m = [0]*N",
"[0]*N",
"m",
"l=sorted(k,reverse=True)",
"sorted(k,reverse=True)",
"l",
"A=list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"maxi=max(maxi,A[i])",
"max(maxi,A[i])",
"maxi",
"z = [0]*N",
"[0]*N",
"z",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"mini=10**9",
"10**9",
"mini",
"maxi=0",
"0",
"maxi",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"mini=min(mini,A[i])",
"min(mini,A[i])",
"mini",
"M = [0]*N",
"[0]*N",
"M",
"k=Counter(z)",
"Counter(z)",
"k"
] |
# D - 高橋君と見えざる手
# https://atcoder.jp/contests/abc047/tasks/arc063_b
from collections import Counter
N,T=map(int,input().split())
A=list(map(int,input().split()))
mini=10**9
maxi=0
m = [0]*N
M = [0]*N
z = [0]*N
for i in range(N):
mini=min(mini,A[i])
maxi=max(maxi,A[i])
m[i]= mini
M[i]= maxi
z[i]= A[i]-mini
k=Counter(z)
l=sorted(k,reverse=True)
#print(l)
print(k[l[0]])
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
15,
12,
13,
29,
18,
4,
18,
18,
13,
13,
13,
39,
17,
12,
13,
29,
2,
39,
17,
4,
13,
4,
13,
13,
23,
13,
4,
18,
13,
13,
17,
0,
13,
2,
4,
13,
17,
17,
17,
41,
28,
13,
4,
13,
17,
4,
4,
13,
2,
4,
13,
17,
13,
0,
13,
13,
0,
13,
39,
39,
17,
17,
39,
17,
17,
39,
17,
17,
39,
17,
17,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
13,
2,
17,
13,
4,
13,
18,
13,
2,
17,
13,
18,
13,
2,
17,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
14,
2,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13
] |
[
[
38,
36
],
[
38,
38
],
[
188,
45
],
[
55,
54
],
[
54,
65
],
[
227,
67
],
[
203,
70
],
[
197,
85
],
[
210,
92
],
[
197,
94
],
[
212,
96
],
[
210,
105
],
[
224,
108
],
[
192,
113
],
[
117,
116
],
[
192,
119
],
[
126,
121
],
[
225,
122
],
[
116,
125
],
[
225,
129
],
[
116,
132
],
[
213,
134
],
[
116,
137
],
[
200,
139
],
[
206,
142
],
[
146,
145
],
[
192,
148
],
[
201,
151
],
[
219,
151
],
[
225,
154
],
[
145,
155
],
[
213,
157
],
[
145,
158
],
[
218,
160
],
[
225,
163
],
[
145,
164
],
[
213,
166
],
[
145,
167
],
[
215,
169
],
[
201,
173
],
[
219,
173
],
[
225,
176
],
[
145,
177
],
[
213,
179
],
[
145,
180
],
[
221,
182
],
[
222,
186
],
[
216,
186
],
[
207,
186
],
[
188,
189
],
[
197,
192
],
[
197,
198
],
[
200,
201
],
[
203,
204
],
[
206,
207
],
[
212,
213
],
[
215,
216
],
[
218,
219
],
[
221,
222
],
[
224,
225
],
[
227,
228
]
] |
[
"import bisect\nimport copy\nimport heapq\nimport math\nimport sys\nfrom collections import *\nfrom functools import lru_cache\nfrom itertools import accumulate, combinations, permutations, product\ndef input():\n return sys.stdin.readline()[:-1]\ndef ruiseki(lst):\n return [0]+list(accumulate(lst))\nsys.setrecursionlimit(5000000)\nmod=pow(10,9)+7\nal=[chr(ord('a') + i) for i in range(26)]\ndirection=[[1,0],[0,1],[-1,0],[0,-1]]\n\nn,t=map(int,input().split())\na=list(map(int,input().split()))\nlst=[0]*(n+1)\n\nfor i in range(n):\n lst[-2-i]=max(lst[-1-i],a[-1-i])\n# print(lst)\n\nsa=0\ncnt=0\nfor i in range(n):\n if sa<lst[i]-a[i]:\n sa=lst[i]-a[i]\n cnt=1\n elif sa==lst[i]-a[i]:\n cnt+=1\n else:\n pass\nprint(cnt)",
"import bisect",
"bisect",
"import copy",
"copy",
"import heapq",
"heapq",
"import math",
"math",
"import sys",
"sys",
"from collections import *",
"from functools import lru_cache",
"from itertools import accumulate, combinations, permutations, product",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"return sys.stdin.readline()[:-1]",
"sys.stdin.readline()[:-1]",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
":-1",
"-1",
"def ruiseki(lst):\n return [0]+list(accumulate(lst))",
"ruiseki",
"return [0]+list(accumulate(lst))",
"[0]+list(accumulate(lst))",
"[0]",
"0",
"list(accumulate(lst))",
"list",
"accumulate(lst)",
"accumulate",
"lst",
"lst",
"lst",
"sys.setrecursionlimit(5000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"5000000",
"mod=pow(10,9)+7",
"mod",
"pow(10,9)+7",
"pow(10,9)",
"pow",
"10",
"9",
"7",
"chr(ord('a') + i) for i in range(26)",
"for i in range(26)",
"i",
"range(26)",
"range",
"26",
"for i in range(26)",
"chr(ord('a') + i)",
"chr",
"ord('a') + i",
"ord('a')",
"ord",
"'a'",
"i",
"al=[chr(ord('a') + i) for i in range(26)]",
"al",
"[chr(ord('a') + i) for i in range(26)]",
"direction=[[1,0],[0,1],[-1,0],[0,-1]]",
"direction",
"[[1,0],[0,1],[-1,0],[0,-1]]",
"[1,0]",
"1",
"0",
"[0,1]",
"0",
"1",
"[-1,0]",
"-1",
"0",
"[0,-1]",
"0",
"-1",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"lst=[0]*(n+1)",
"lst",
"[0]*(n+1)",
"[0]",
"0",
"n+1",
"n",
"1",
"for i in range(n):\n lst[-2-i]=max(lst[-1-i],a[-1-i])\n# print(lst)",
"i",
"range(n)",
"range",
"n",
"lst[-2-i]=max(lst[-1-i],a[-1-i])",
"lst[-2-i]",
"lst",
"-2-i",
"-2",
"i",
"max(lst[-1-i],a[-1-i])",
"max",
"lst[-1-i]",
"lst",
"-1-i",
"-1",
"i",
"a[-1-i]",
"a",
"-1-i",
"-1",
"i",
"sa=0",
"sa",
"0",
"cnt=0",
"cnt",
"0",
"for i in range(n):\n if sa<lst[i]-a[i]:\n sa=lst[i]-a[i]\n cnt=1\n elif sa==lst[i]-a[i]:\n cnt+=1\n else:\n pass",
"i",
"range(n)",
"range",
"n",
"if sa<lst[i]-a[i]:\n sa=lst[i]-a[i]\n cnt=1\n elif sa==lst[i]-a[i]:\n cnt+=1\n else:\n pass",
"sa<lst[i]-a[i]",
"sa",
"lst[i]-a[i]",
"lst[i]",
"lst",
"i",
"a[i]",
"a",
"i",
"sa=lst[i]-a[i]",
"sa",
"lst[i]-a[i]",
"lst[i]",
"lst",
"i",
"a[i]",
"a",
"i",
"cnt=1",
"cnt",
"1",
"elif sa==lst[i]-a[i]:\n cnt+=1\n ",
"sa==lst[i]-a[i]",
"sa",
"lst[i]-a[i]",
"lst[i]",
"lst",
"i",
"a[i]",
"a",
"i",
"cnt+=1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"mod=pow(10,9)+7",
"pow(10,9)+7",
"mod",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"def ruiseki(lst):\n return [0]+list(accumulate(lst))",
"def ruiseki(lst):\n return [0]+list(accumulate(lst))",
"ruiseki",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"sa=0",
"0",
"sa",
"direction=[[1,0],[0,1],[-1,0],[0,-1]]",
"[[1,0],[0,1],[-1,0],[0,-1]]",
"direction",
"cnt=0",
"0",
"cnt",
"def input():\n return sys.stdin.readline()[:-1]",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"cnt=1",
"1",
"cnt",
"sa=lst[i]-a[i]",
"lst[i]-a[i]",
"sa",
"cnt+=1",
"1",
"cnt",
"lst=[0]*(n+1)",
"[0]*(n+1)",
"lst",
"al=[chr(ord('a') + i) for i in range(26)]",
"[chr(ord('a') + i) for i in range(26)]",
"al"
] |
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]
n,t=map(int,input().split())
a=list(map(int,input().split()))
lst=[0]*(n+1)
for i in range(n):
lst[-2-i]=max(lst[-1-i],a[-1-i])
# print(lst)
sa=0
cnt=0
for i in range(n):
if sa<lst[i]-a[i]:
sa=lst[i]-a[i]
cnt=1
elif sa==lst[i]-a[i]:
cnt+=1
else:
pass
print(cnt)
|
[
7,
12,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
18,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
2,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
7,
6
],
[
14,
13
],
[
6,
20
],
[
14,
22
],
[
25,
24
],
[
6,
33
],
[
37,
36
],
[
40,
39
],
[
24,
41
],
[
45,
44
],
[
24,
44
],
[
44,
48
],
[
39,
49
],
[
51,
49
],
[
52,
51
],
[
44,
52
],
[
55,
54
],
[
44,
56
],
[
39,
57
],
[
51,
57
],
[
36,
60
],
[
54,
62
],
[
36,
67
],
[
36,
71
],
[
80,
77
]
] |
[
"def main():\n import sys \n input = sys.stdin.readline\n n,t = map(int,input().split())\n l = list(map(int,input().split()))\n ans = []\n check = l[0]\n for i in l:\n if i < check:\n check = i\n else:\n dis = i-check\n ans.append(dis)\n print(ans.count(max(ans)))\n\nif __name__ == \"__main__\":\n main()\n\n ",
"def main():\n import sys \n input = sys.stdin.readline\n n,t = map(int,input().split())\n l = list(map(int,input().split()))\n ans = []\n check = l[0]\n for i in l:\n if i < check:\n check = i\n else:\n dis = i-check\n ans.append(dis)\n print(ans.count(max(ans)))",
"main",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"l = list(map(int,input().split()))",
"l",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans = []",
"ans",
"[]",
"check = l[0]",
"check",
"l[0]",
"l",
"0",
"for i in l:\n if i < check:\n check = i\n else:\n dis = i-check\n ans.append(dis)\n ",
"i",
"l",
"if i < check:\n check = i\n else:\n dis = i-check\n ans.append(dis)\n ",
"i < check",
"i",
"check",
"check = i",
"check",
"i",
"dis = i-check",
"dis",
"i-check",
"i",
"check",
"ans.append(dis)",
"ans.append",
"ans",
"append",
"dis",
"print(ans.count(max(ans)))",
"print",
"ans.count(max(ans))",
"ans.count",
"ans",
"count",
"max(ans)",
"max",
"ans",
"if __name__ == \"__main__\":\n main()\n\n ",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n import sys \n input = sys.stdin.readline\n n,t = map(int,input().split())\n l = list(map(int,input().split()))\n ans = []\n check = l[0]\n for i in l:\n if i < check:\n check = i\n else:\n dis = i-check\n ans.append(dis)\n print(ans.count(max(ans)))",
"def main():\n import sys \n input = sys.stdin.readline\n n,t = map(int,input().split())\n l = list(map(int,input().split()))\n ans = []\n check = l[0]\n for i in l:\n if i < check:\n check = i\n else:\n dis = i-check\n ans.append(dis)\n print(ans.count(max(ans)))",
"main"
] |
def main():
import sys
input = sys.stdin.readline
n,t = map(int,input().split())
l = list(map(int,input().split()))
ans = []
check = l[0]
for i in l:
if i < check:
check = i
else:
dis = i-check
ans.append(dis)
print(ans.count(max(ans)))
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
14,
2,
13,
17,
4,
13,
17,
4,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
2,
17,
2,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
4,
13,
18,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13
] |
[
[
108,
2
],
[
108,
11
],
[
111,
13
],
[
97,
26
],
[
102,
34
],
[
114,
41
],
[
99,
48
],
[
52,
51
],
[
97,
54
],
[
115,
57
],
[
121,
57
],
[
112,
60
],
[
51,
61
],
[
103,
62
],
[
106,
62
],
[
117,
64
],
[
115,
68
],
[
121,
68
],
[
112,
71
],
[
51,
72
],
[
103,
73
],
[
106,
73
],
[
120,
75
],
[
112,
78
],
[
51,
79
],
[
103,
80
],
[
106,
80
],
[
123,
82
],
[
105,
85
],
[
112,
89
],
[
51,
90
],
[
103,
91
],
[
106,
91
],
[
124,
94
],
[
118,
94
],
[
100,
94
],
[
108,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
],
[
123,
124
]
] |
[
"N,T=map(int, input().split())\nA=list(map(int, input().split()))\nif N==1:\n print(1)\n exit()\nmn=10**9+1\nV=-1*10**9\ncnt=0\nfor i in range(N):\n if V==A[i]-mn:\n cnt+=1\n elif V<A[i]-mn:\n V=A[i]-mn\n cnt=1\n mn=min(A[i],mn)\nprint(cnt)",
"N,T=map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A=list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"if N==1:\n print(1)\n exit()",
"N==1",
"N",
"1",
"print(1)",
"print",
"1",
"exit()",
"exit",
"mn=10**9+1",
"mn",
"10**9+1",
"10**9",
"10",
"9",
"1",
"V=-1*10**9",
"V",
"-1*10**9",
"-1",
"10**9",
"10",
"9",
"cnt=0",
"cnt",
"0",
"for i in range(N):\n if V==A[i]-mn:\n cnt+=1\n elif V<A[i]-mn:\n V=A[i]-mn\n cnt=1\n mn=min(A[i],mn)",
"i",
"range(N)",
"range",
"N",
"if V==A[i]-mn:\n cnt+=1\n elif V<A[i]-mn:\n V=A[i]-mn\n cnt=1\n ",
"V==A[i]-mn",
"V",
"A[i]-mn",
"A[i]",
"A",
"i",
"mn",
"cnt+=1",
"cnt",
"1",
"elif V<A[i]-mn:\n V=A[i]-mn\n cnt=1\n ",
"V<A[i]-mn",
"V",
"A[i]-mn",
"A[i]",
"A",
"i",
"mn",
"V=A[i]-mn",
"V",
"A[i]-mn",
"A[i]",
"A",
"i",
"mn",
"cnt=1",
"cnt",
"1",
"mn=min(A[i],mn)",
"mn",
"min(A[i],mn)",
"min",
"A[i]",
"A",
"i",
"mn",
"print(cnt)",
"print",
"cnt",
"N,T=map(int, input().split())",
"map(int, input().split())",
"N",
"cnt=0",
"0",
"cnt",
"mn=10**9+1",
"10**9+1",
"mn",
"mn=min(A[i],mn)",
"min(A[i],mn)",
"mn",
"T=map(int, input().split())",
"map(int, input().split())",
"T",
"A=list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"V=-1*10**9",
"-1*10**9",
"V",
"cnt+=1",
"1",
"cnt",
"V=A[i]-mn",
"A[i]-mn",
"V",
"cnt=1",
"1",
"cnt"
] |
N,T=map(int, input().split())
A=list(map(int, input().split()))
if N==1:
print(1)
exit()
mn=10**9+1
V=-1*10**9
cnt=0
for i in range(N):
if V==A[i]-mn:
cnt+=1
elif V<A[i]-mn:
V=A[i]-mn
cnt=1
mn=min(A[i],mn)
print(cnt)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
17,
28,
13,
18,
13,
39,
17,
14,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
13,
0,
13,
18,
13,
39,
17,
0,
13,
4,
13,
13,
28,
13,
13,
4,
13,
13,
13,
0,
18,
13,
2,
13,
13,
17,
4,
13,
18,
18,
4,
13,
4,
18,
13,
13,
0,
13,
17,
17,
17,
10,
39,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
111,
3
],
[
111,
12
],
[
93,
14
],
[
90,
26
],
[
96,
29
],
[
33,
32
],
[
94,
34
],
[
97,
39
],
[
100,
39
],
[
32,
40
],
[
99,
42
],
[
32,
43
],
[
91,
46
],
[
100,
48
],
[
97,
48
],
[
102,
50
],
[
91,
52
],
[
105,
56
],
[
94,
65
],
[
103,
66
],
[
91,
66
],
[
73,
68
],
[
106,
69
],
[
106,
82
],
[
86,
85
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
32,
99
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
111,
109
],
[
111,
112
]
] |
[
"from collections import defaultdict\nn, _ = map(int, input().split())\nA = list(map(int, input().split()))\n\nMAX_S = []\nmax_s = 0\nfor a in A[::-1]:\n if max_s < a:\n max_s = a\n MAX_S.append(max_s)\nMAX_S = MAX_S[::-1]\ncnt = defaultdict(int)\nfor a, s in zip(A, MAX_S):\n cnt[s-a] += 1\n\nprint(sorted(cnt.items(), reverse=True)[0][1])",
"from collections import defaultdict",
"n, _ = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"_",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"MAX_S = []",
"MAX_S",
"[]",
"max_s = 0",
"max_s",
"0",
"for a in A[::-1]:\n if max_s < a:\n max_s = a\n MAX_S.append(max_s)",
"a",
"A[::-1]",
"A",
"::-1",
"-1",
"if max_s < a:\n max_s = a\n ",
"max_s < a",
"max_s",
"a",
"max_s = a",
"max_s",
"a",
"MAX_S.append(max_s)",
"MAX_S.append",
"MAX_S",
"append",
"max_s",
"MAX_S = MAX_S[::-1]",
"MAX_S",
"MAX_S[::-1]",
"MAX_S",
"::-1",
"-1",
"cnt = defaultdict(int)",
"cnt",
"defaultdict(int)",
"defaultdict",
"int",
"for a, s in zip(A, MAX_S):\n cnt[s-a] += 1",
"a",
"s",
"zip(A, MAX_S)",
"zip",
"A",
"MAX_S",
"cnt[s-a] += 1",
"cnt[s-a]",
"cnt",
"s-a",
"s",
"a",
"1",
"print(sorted(cnt.items(), reverse=True)[0][1])",
"print",
"sorted(cnt.items(), reverse=True)[0][1]",
"[0]",
"(cnt.items(), reverse=True)",
"sorted",
"cnt.items()",
"cnt.items",
"cnt",
"items",
"reverse=True",
"reverse",
"True",
"0",
"1",
"MAX_S = []",
"[]",
"MAX_S",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"max_s = 0",
"0",
"max_s",
"max_s = a",
"a",
"max_s",
"MAX_S = MAX_S[::-1]",
"MAX_S[::-1]",
"MAX_S",
"cnt = defaultdict(int)",
"defaultdict(int)",
"cnt",
"_ = map(int, input().split())",
"map(int, input().split())",
"_",
"n, _ = map(int, input().split())",
"map(int, input().split())",
"n"
] |
from collections import defaultdict
n, _ = map(int, input().split())
A = list(map(int, input().split()))
MAX_S = []
max_s = 0
for a in A[::-1]:
if max_s < a:
max_s = a
MAX_S.append(max_s)
MAX_S = MAX_S[::-1]
cnt = defaultdict(int)
for a, s in zip(A, MAX_S):
cnt[s-a] += 1
print(sorted(cnt.items(), reverse=True)[0][1])
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
31,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
13,
28,
13,
4,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
13,
4,
13,
13,
29,
14,
2,
13,
17,
4,
13,
10,
18,
13,
10,
2,
13,
10,
12,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13
] |
[
[
164,
4
],
[
161,
11
],
[
152,
18
],
[
155,
32
],
[
167,
37
],
[
43,
42
],
[
165,
49
],
[
43,
51
],
[
43,
52
],
[
56,
55
],
[
42,
59
],
[
64,
61
],
[
55,
62
],
[
156,
64
],
[
67,
66
],
[
42,
70
],
[
55,
75
],
[
66,
76
],
[
66,
79
],
[
86,
81
],
[
55,
82
],
[
66,
84
],
[
66,
88
],
[
95,
90
],
[
55,
91
],
[
66,
93
],
[
55,
96
],
[
66,
97
],
[
100,
99
],
[
103,
102
],
[
42,
106
],
[
109,
108
],
[
42,
111
],
[
116,
113
],
[
102,
114
],
[
108,
115
],
[
108,
119
],
[
55,
121
],
[
108,
122
],
[
99,
125
],
[
130,
125
],
[
113,
126
],
[
102,
127
],
[
108,
128
],
[
131,
130
],
[
113,
131
],
[
102,
132
],
[
108,
133
],
[
136,
135
],
[
102,
138
],
[
130,
140
],
[
99,
140
],
[
135,
143
],
[
159,
150
],
[
152,
153
],
[
155,
156
],
[
161,
162
],
[
164,
165
],
[
167,
168
]
] |
[
"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n N, T, *A = map(int, read().split())\n\n B = [0] * N\n B[0] = INF\n for i in range(N - 1):\n if B[i] > A[i]:\n B[i + 1] = A[i]\n else:\n B[i + 1] = B[i]\n\n p = 0\n C = [0] * N\n for i in range(N):\n C[i] = A[i] - B[i]\n if p < C[i]:\n p = C[i]\n\n ans = C.count(p)\n\n print(ans)\n return\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"read = sys.stdin.read",
"read",
"sys.stdin.read",
"sys.stdin",
"sys",
"stdin",
"read",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"readlines = sys.stdin.readlines",
"readlines",
"sys.stdin.readlines",
"sys.stdin",
"sys",
"stdin",
"readlines",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"INF = 1 << 60",
"INF",
"1 << 60",
"1",
"60",
"MOD = 1000000007",
"MOD",
"1000000007",
"def main():\n N, T, *A = map(int, read().split())\n\n B = [0] * N\n B[0] = INF\n for i in range(N - 1):\n if B[i] > A[i]:\n B[i + 1] = A[i]\n else:\n B[i + 1] = B[i]\n\n p = 0\n C = [0] * N\n for i in range(N):\n C[i] = A[i] - B[i]\n if p < C[i]:\n p = C[i]\n\n ans = C.count(p)\n\n print(ans)\n return",
"main",
"N, T, *A = map(int, read().split())",
"N",
"map(int, read().split())",
"map",
"int",
"read().split()",
"().split",
"()",
"read",
"split",
"T",
"*A",
"A",
"B = [0] * N",
"B",
"[0] * N",
"[0]",
"0",
"N",
"B[0] = INF",
"B[0]",
"B",
"0",
"INF",
"for i in range(N - 1):\n if B[i] > A[i]:\n B[i + 1] = A[i]\n else:\n B[i + 1] = B[i]\n\n ",
"i",
"range(N - 1)",
"range",
"N - 1",
"N",
"1",
"if B[i] > A[i]:\n B[i + 1] = A[i]\n else:\n B[i + 1] = B[i]\n\n ",
"B[i] > A[i]",
"B[i]",
"B",
"i",
"A[i]",
"A",
"i",
"B[i + 1] = A[i]",
"B[i + 1]",
"B",
"i + 1",
"i",
"1",
"A[i]",
"A",
"i",
"B[i + 1] = B[i]",
"B[i + 1]",
"B",
"i + 1",
"i",
"1",
"B[i]",
"B",
"i",
"p = 0",
"p",
"0",
"C = [0] * N",
"C",
"[0] * N",
"[0]",
"0",
"N",
"for i in range(N):\n C[i] = A[i] - B[i]\n if p < C[i]:\n p = C[i]\n\n ",
"i",
"range(N)",
"range",
"N",
"C[i] = A[i] - B[i]",
"C[i]",
"C",
"i",
"A[i] - B[i]",
"A[i]",
"A",
"i",
"B[i]",
"B",
"i",
"if p < C[i]:\n p = C[i]\n\n ",
"p < C[i]",
"p",
"C[i]",
"C",
"i",
"p = C[i]",
"p",
"C[i]",
"C",
"i",
"ans = C.count(p)",
"ans",
"C.count(p)",
"C.count",
"C",
"count",
"p",
"print(ans)",
"print",
"ans",
"return",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"readlines = sys.stdin.readlines",
"sys.stdin.readlines",
"readlines",
"INF = 1 << 60",
"1 << 60",
"INF",
"def main():\n N, T, *A = map(int, read().split())\n\n B = [0] * N\n B[0] = INF\n for i in range(N - 1):\n if B[i] > A[i]:\n B[i + 1] = A[i]\n else:\n B[i + 1] = B[i]\n\n p = 0\n C = [0] * N\n for i in range(N):\n C[i] = A[i] - B[i]\n if p < C[i]:\n p = C[i]\n\n ans = C.count(p)\n\n print(ans)\n return",
"def main():\n N, T, *A = map(int, read().split())\n\n B = [0] * N\n B[0] = INF\n for i in range(N - 1):\n if B[i] > A[i]:\n B[i + 1] = A[i]\n else:\n B[i + 1] = B[i]\n\n p = 0\n C = [0] * N\n for i in range(N):\n C[i] = A[i] - B[i]\n if p < C[i]:\n p = C[i]\n\n ans = C.count(p)\n\n print(ans)\n return",
"main",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"read = sys.stdin.read",
"sys.stdin.read",
"read",
"MOD = 1000000007",
"1000000007",
"MOD"
] |
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, T, *A = map(int, read().split())
B = [0] * N
B[0] = INF
for i in range(N - 1):
if B[i] > A[i]:
B[i + 1] = A[i]
else:
B[i + 1] = B[i]
p = 0
C = [0] * N
for i in range(N):
C[i] = A[i] - B[i]
if p < C[i]:
p = C[i]
ans = C.count(p)
print(ans)
return
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
2,
13,
17,
28,
13,
13,
4,
13,
18,
13,
39,
17,
17,
0,
18,
13,
40,
13,
18,
13,
2,
40,
13,
17,
14,
2,
18,
13,
40,
13,
13,
0,
18,
13,
40,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
13,
13,
17,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13
] |
[
[
134,
2
],
[
134,
11
],
[
116,
13
],
[
128,
25
],
[
108,
30
],
[
117,
38
],
[
47,
43
],
[
129,
44
],
[
129,
48
],
[
129,
56
],
[
65,
61
],
[
129,
62
],
[
113,
67
],
[
110,
70
],
[
117,
77
],
[
131,
80
],
[
129,
83
],
[
132,
88
],
[
111,
89
],
[
123,
89
],
[
119,
91
],
[
132,
95
],
[
111,
96
],
[
123,
96
],
[
122,
98
],
[
132,
99
],
[
125,
101
],
[
126,
105
],
[
120,
105
],
[
114,
105
],
[
134,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
132,
122
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\n# i番目の町以降の取引金額の最大値\n# 末尾はダミー\nrighter_max = [0] * (N+1)\nfor i, a in enumerate(A[::-1], 2):\n righter_max[-i] = righter_max[-i+1]\n if righter_max[-i] < a:\n righter_max[-i] = a\n\nans = 0\nmax_profit = 0\nfor i, a in enumerate(A, 1):\n profit = righter_max[i] - a\n if profit == max_profit:\n ans += 1\n elif profit > max_profit:\n max_profit = profit\n ans = 1\n\nprint(ans)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"righter_max = [0] * (N+1)",
"righter_max",
"[0] * (N+1)",
"[0]",
"0",
"N+1",
"N",
"1",
"for i, a in enumerate(A[::-1], 2):\n righter_max[-i] = righter_max[-i+1]\n if righter_max[-i] < a:\n righter_max[-i] = a",
"i",
"a",
"enumerate(A[::-1], 2)",
"enumerate",
"A[::-1]",
"A",
"::-1",
"-1",
"2",
"righter_max[-i] = righter_max[-i+1]",
"righter_max[-i]",
"righter_max",
"-i",
"i",
"righter_max[-i+1]",
"righter_max",
"-i+1",
"-i",
"i",
"1",
"if righter_max[-i] < a:\n righter_max[-i] = a",
"righter_max[-i] < a",
"righter_max[-i]",
"righter_max",
"-i",
"i",
"a",
"righter_max[-i] = a",
"righter_max[-i]",
"righter_max",
"-i",
"i",
"a",
"ans = 0",
"ans",
"0",
"max_profit = 0",
"max_profit",
"0",
"for i, a in enumerate(A, 1):\n profit = righter_max[i] - a\n if profit == max_profit:\n ans += 1\n elif profit > max_profit:\n max_profit = profit\n ans = 1",
"i",
"a",
"enumerate(A, 1)",
"enumerate",
"A",
"1",
"profit = righter_max[i] - a",
"profit",
"righter_max[i] - a",
"righter_max[i]",
"righter_max",
"i",
"a",
"if profit == max_profit:\n ans += 1\n elif profit > max_profit:\n max_profit = profit\n ans = 1",
"profit == max_profit",
"profit",
"max_profit",
"ans += 1",
"ans",
"1",
"elif profit > max_profit:\n max_profit = profit\n ans = 1",
"profit > max_profit",
"profit",
"max_profit",
"max_profit = profit",
"max_profit",
"profit",
"ans = 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"max_profit = 0",
"0",
"max_profit",
"ans = 0",
"0",
"ans",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"ans += 1",
"1",
"ans",
"max_profit = profit",
"profit",
"max_profit",
"ans = 1",
"1",
"ans",
"righter_max = [0] * (N+1)",
"[0] * (N+1)",
"righter_max",
"profit = righter_max[i] - a",
"righter_max[i] - a",
"profit",
"T = map(int, input().split())",
"map(int, input().split())",
"T"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
# i番目の町以降の取引金額の最大値
# 末尾はダミー
righter_max = [0] * (N+1)
for i, a in enumerate(A[::-1], 2):
righter_max[-i] = righter_max[-i+1]
if righter_max[-i] < a:
righter_max[-i] = a
ans = 0
max_profit = 0
for i, a in enumerate(A, 1):
profit = righter_max[i] - a
if profit == max_profit:
ans += 1
elif profit > max_profit:
max_profit = profit
ans = 1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13
] |
[
[
80,
2
],
[
80,
11
],
[
104,
13
],
[
95,
25
],
[
86,
28
],
[
98,
35
],
[
39,
38
],
[
105,
38
],
[
38,
42
],
[
87,
43
],
[
102,
43
],
[
101,
45
],
[
38,
46
],
[
38,
49
],
[
87,
50
],
[
102,
50
],
[
83,
52
],
[
38,
54
],
[
87,
55
],
[
102,
55
],
[
84,
58
],
[
99,
59
],
[
90,
59
],
[
92,
61
],
[
84,
65
],
[
99,
66
],
[
90,
66
],
[
107,
68
],
[
89,
71
],
[
84,
72
],
[
108,
75
],
[
93,
75
],
[
96,
75
],
[
80,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
],
[
84,
89
],
[
89,
90
],
[
92,
93
],
[
95,
96
],
[
98,
99
],
[
38,
101
],
[
101,
102
],
[
104,
105
],
[
107,
108
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\nC = 0\nL = 10 ** 9 + 5\nS = 0\nfor a in A:\n if a < L:\n L = a\n elif a > L:\n St = a - L\n if St == S:\n C += 1\n elif St > S:\n C = 1\n S = St\nprint(C)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"C = 0",
"C",
"0",
"L = 10 ** 9 + 5",
"L",
"10 ** 9 + 5",
"10 ** 9",
"10",
"9",
"5",
"S = 0",
"S",
"0",
"for a in A:\n if a < L:\n L = a\n elif a > L:\n St = a - L\n if St == S:\n C += 1\n elif St > S:\n C = 1\n S = St",
"a",
"A",
"if a < L:\n L = a\n elif a > L:\n St = a - L\n if St == S:\n C += 1\n elif St > S:\n C = 1\n S = St",
"a < L",
"a",
"L",
"L = a",
"L",
"a",
"elif a > L:\n St = a - L\n if St == S:\n C += 1\n elif St > S:\n C = 1\n S = St",
"a > L",
"a",
"L",
"St = a - L",
"St",
"a - L",
"a",
"L",
"if St == S:\n C += 1\n elif St > S:\n C = 1\n S = St",
"St == S",
"St",
"S",
"C += 1",
"C",
"1",
"elif St > S:\n C = 1\n S = St",
"St > S",
"St",
"S",
"C = 1",
"C",
"1",
"S = St",
"S",
"St",
"print(C)",
"print",
"C",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"St = a - L",
"a - L",
"St",
"L = 10 ** 9 + 5",
"10 ** 9 + 5",
"L",
"S = St",
"St",
"S",
"C += 1",
"1",
"C",
"C = 0",
"0",
"C",
"S = 0",
"0",
"S",
"L = a",
"a",
"L",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"C = 1",
"1",
"C"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
C = 0
L = 10 ** 9 + 5
S = 0
for a in A:
if a < L:
L = a
elif a > L:
St = a - L
if St == S:
C += 1
elif St > S:
C = 1
S = St
print(C)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
17,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13
] |
[
[
113,
2
],
[
113,
11
],
[
15,
14
],
[
14,
23
],
[
107,
25
],
[
104,
28
],
[
116,
33
],
[
110,
38
],
[
42,
41
],
[
93,
44
],
[
108,
48
],
[
41,
49
],
[
105,
50
],
[
102,
50
],
[
101,
52
],
[
108,
54
],
[
41,
55
],
[
108,
60
],
[
41,
61
],
[
102,
62
],
[
105,
62
],
[
117,
63
],
[
96,
63
],
[
89,
65
],
[
108,
71
],
[
41,
72
],
[
102,
73
],
[
105,
73
],
[
117,
74
],
[
96,
74
],
[
95,
76
],
[
108,
79
],
[
41,
80
],
[
102,
81
],
[
105,
81
],
[
98,
83
],
[
99,
87
],
[
90,
87
],
[
111,
87
],
[
89,
90
],
[
113,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
]
] |
[
"N, T = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nAmin = 10**10\nP = -10**10\nc = 0\nfor i in range(N):\n if A[i] < Amin:\n Amin = A[i]\n\n if A[i]-Amin == P:\n c += 1\n elif A[i]-Amin > P:\n P = A[i]-Amin\n c = 1\nprint(c)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"A = [int(i) for i in input().split()]",
"A",
"[int(i) for i in input().split()]",
"Amin = 10**10",
"Amin",
"10**10",
"10",
"10",
"P = -10**10",
"P",
"-10**10",
"-10",
"10",
"c = 0",
"c",
"0",
"for i in range(N):\n if A[i] < Amin:\n Amin = A[i]\n\n if A[i]-Amin == P:\n c += 1\n elif A[i]-Amin > P:\n P = A[i]-Amin\n c = 1",
"i",
"range(N)",
"range",
"N",
"if A[i] < Amin:\n Amin = A[i]\n\n ",
"A[i] < Amin",
"A[i]",
"A",
"i",
"Amin",
"Amin = A[i]",
"Amin",
"A[i]",
"A",
"i",
"if A[i]-Amin == P:\n c += 1\n elif A[i]-Amin > P:\n P = A[i]-Amin\n c = 1",
"A[i]-Amin == P",
"A[i]-Amin",
"A[i]",
"A",
"i",
"Amin",
"P",
"c += 1",
"c",
"1",
"elif A[i]-Amin > P:\n P = A[i]-Amin\n c = 1",
"A[i]-Amin > P",
"A[i]-Amin",
"A[i]",
"A",
"i",
"Amin",
"P",
"P = A[i]-Amin",
"P",
"A[i]-Amin",
"A[i]",
"A",
"i",
"Amin",
"c = 1",
"c",
"1",
"print(c)",
"print",
"c",
"c += 1",
"1",
"c",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"P = A[i]-Amin",
"A[i]-Amin",
"P",
"c = 1",
"1",
"c",
"Amin = A[i]",
"A[i]",
"Amin",
"Amin = 10**10",
"10**10",
"Amin",
"A = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"A",
"c = 0",
"0",
"c",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"P = -10**10",
"-10**10",
"P"
] |
N, T = map(int, input().split())
A = [int(i) for i in input().split()]
Amin = 10**10
P = -10**10
c = 0
for i in range(N):
if A[i] < Amin:
Amin = A[i]
if A[i]-Amin == P:
c += 1
elif A[i]-Amin > P:
P = A[i]-Amin
c = 1
print(c)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
2,
13,
13,
0,
13,
17,
0,
13,
2,
13,
13,
14,
2,
13,
2,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] |
[
[
100,
2
],
[
100,
11
],
[
85,
13
],
[
79,
25
],
[
82,
30
],
[
88,
35
],
[
39,
38
],
[
86,
38
],
[
83,
42
],
[
95,
42
],
[
38,
44
],
[
80,
45
],
[
98,
45
],
[
91,
47
],
[
94,
50
],
[
38,
52
],
[
80,
53
],
[
98,
53
],
[
95,
56
],
[
83,
56
],
[
38,
58
],
[
80,
59
],
[
98,
59
],
[
76,
61
],
[
97,
64
],
[
80,
67
],
[
98,
67
],
[
38,
68
],
[
77,
71
],
[
92,
71
],
[
89,
71
],
[
100,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
]
] |
[
"N, _ = map(int, input().split())\nA = list(map(int, input().split()))\n\nmi = 10**18\nmx = -10**18\nans = 0\nfor a in A:\n if mx < a - mi:\n ans = 0\n mx = a - mi\n if mx == a - mi:\n ans += 1\n mi = min(mi, a)\n\nprint(ans)",
"N, _ = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"_",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mi = 10**18",
"mi",
"10**18",
"10",
"18",
"mx = -10**18",
"mx",
"-10**18",
"-10",
"18",
"ans = 0",
"ans",
"0",
"for a in A:\n if mx < a - mi:\n ans = 0\n mx = a - mi\n if mx == a - mi:\n ans += 1\n mi = min(mi, a)",
"a",
"A",
"if mx < a - mi:\n ans = 0\n mx = a - mi\n ",
"mx < a - mi",
"mx",
"a - mi",
"a",
"mi",
"ans = 0",
"ans",
"0",
"mx = a - mi",
"mx",
"a - mi",
"a",
"mi",
"if mx == a - mi:\n ans += 1\n ",
"mx == a - mi",
"mx",
"a - mi",
"a",
"mi",
"ans += 1",
"ans",
"1",
"mi = min(mi, a)",
"mi",
"min(mi, a)",
"min",
"mi",
"a",
"print(ans)",
"print",
"ans",
"_ = map(int, input().split())",
"map(int, input().split())",
"_",
"ans += 1",
"1",
"ans",
"mi = 10**18",
"10**18",
"mi",
"mx = -10**18",
"-10**18",
"mx",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"ans = 0",
"0",
"ans",
"ans = 0",
"0",
"ans",
"mx = a - mi",
"a - mi",
"mx",
"mi = min(mi, a)",
"min(mi, a)",
"mi",
"N, _ = map(int, input().split())",
"map(int, input().split())",
"N"
] |
N, _ = map(int, input().split())
A = list(map(int, input().split()))
mi = 10**18
mx = -10**18
ans = 0
for a in A:
if mx < a - mi:
ans = 0
mx = a - mi
if mx == a - mi:
ans += 1
mi = min(mi, a)
print(ans)
|
[
7,
15,
0,
13,
18,
13,
13,
15,
13,
15,
12,
13,
41,
28,
13,
4,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
17,
12,
13,
41,
28,
13,
4,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
23,
13,
17,
12,
13,
41,
28,
13,
4,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
17,
12,
13,
41,
28,
13,
4,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
23,
13,
17,
12,
13,
4,
13,
4,
18,
17,
13,
13,
23,
13,
6,
13,
12,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
17,
23,
13,
17,
12,
13,
29,
4,
18,
17,
13,
18,
13,
13,
18,
13,
13,
23,
13,
12,
13,
29,
2,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
12,
13,
0,
13,
17,
42,
13,
14,
2,
13,
17,
0,
13,
13,
0,
13,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
17,
18,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
2,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
0,
13,
4,
13,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
4,
13,
39,
4,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
13,
18,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
17,
4,
18,
13,
13,
13,
4,
13,
13,
10,
12,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
6,
13,
10,
2,
13,
10,
17,
13
] |
[
[
372,
3
],
[
15,
14
],
[
23,
17
],
[
25,
19
],
[
23,
23
],
[
26,
25
],
[
32,
31
],
[
40,
34
],
[
40,
40
],
[
42,
42
],
[
45,
44
],
[
51,
50
],
[
59,
53
],
[
61,
55
],
[
59,
59
],
[
62,
61
],
[
68,
67
],
[
76,
70
],
[
76,
76
],
[
78,
78
],
[
81,
80
],
[
92,
90
],
[
92,
92
],
[
101,
98
],
[
108,
99
],
[
110,
101
],
[
106,
103
],
[
108,
104
],
[
113,
106
],
[
108,
108
],
[
111,
110
],
[
114,
113
],
[
129,
123
],
[
129,
126
],
[
129,
129
],
[
141,
135
],
[
143,
138
],
[
141,
141
],
[
143,
143
],
[
148,
147
],
[
169,
153
],
[
162,
153
],
[
157,
156
],
[
167,
157
],
[
159,
157
],
[
160,
159
],
[
159,
160
],
[
167,
160
],
[
163,
162
],
[
156,
165
],
[
147,
165
],
[
167,
167
],
[
169,
169
],
[
366,
171
],
[
373,
180
],
[
366,
183
],
[
390,
185
],
[
373,
196
],
[
363,
200
],
[
385,
202
],
[
358,
203
],
[
354,
205
],
[
385,
207
],
[
358,
208
],
[
213,
210
],
[
364,
211
],
[
391,
214
],
[
222,
217
],
[
355,
218
],
[
358,
220
],
[
391,
223
],
[
358,
225
],
[
229,
228
],
[
358,
232
],
[
237,
234
],
[
364,
235
],
[
228,
236
],
[
391,
240
],
[
228,
241
],
[
364,
243
],
[
228,
245
],
[
249,
248
],
[
358,
252
],
[
260,
257
],
[
355,
258
],
[
248,
259
],
[
391,
263
],
[
248,
264
],
[
355,
266
],
[
248,
268
],
[
402,
271
],
[
367,
273
],
[
405,
276
],
[
280,
279
],
[
358,
283
],
[
396,
286
],
[
406,
289
],
[
397,
289
],
[
355,
292
],
[
279,
294
],
[
234,
296
],
[
364,
297
],
[
279,
298
],
[
369,
300
],
[
370,
306
],
[
391,
309
],
[
358,
311
],
[
381,
314
],
[
318,
317
],
[
358,
321
],
[
393,
326
],
[
391,
328
],
[
317,
329
],
[
394,
333
],
[
397,
334
],
[
406,
334
],
[
370,
335
],
[
351,
337
],
[
370,
341
],
[
394,
343
],
[
352,
346
],
[
382,
346
],
[
351,
352
],
[
354,
355
],
[
366,
358
],
[
363,
364
],
[
366,
367
],
[
369,
370
],
[
372,
373
],
[
381,
382
],
[
390,
391
],
[
393,
394
],
[
396,
397
],
[
402,
403
],
[
405,
406
]
] |
[
"from sys import stdin\ninput = stdin.readline\nimport copy as cp\nfrom collections import deque\n\ndef VI(N, init=0):\n return [init for _ in range(N)]\ndef VVI(N, M, init=0):\n return [[init for _ in range(M)] for _ in range(N)]\n\ndef VD(N, init=0.0):\n return [init for _ in range(N)]\ndef VVD(N, M, init=0.0):\n return [[init for _ in range(M)] for _ in range(N)]\n\ndef Decimal(x):\n print(\"{0:.10f}\".format(x))\n\nclass Pair:\n def __init__(self, x=0, y=0):\n self.first = x\n self.second = y\n\n def __repr__(self):\n return '{0} {1}'.format(self.first, self.second)\n\n def __lt__(self, pi):\n return self.first < pi.second\n\ndef POW(x, n):\n ret = 1\n while n:\n if n&1:\n ret *= x\n x *= x\n n >>= 1\n return ret\n\nN, T = map(int, input().rstrip().split())\nA = list(map(int, input().rstrip().split()))\n\nmi = VI(N)\nma = VI(N)\n\nmi[0] = A[0]\nma[N-1] = A[N-1]\n\nfor i in range(1, N):\n mi[i] = min(A[i], mi[i-1])\n\nfor i in range(N-2, -1, -1):\n ma[i] = max(A[i], ma[i+1])\n\nt = T // 2\n\nmax_benefit = 0\nfor i in range(N-1):\n max_benefit = max(max_benefit, ma[i+1]-mi[i])\n\ns = set([])\ns.add(A[N-1])\ncnt = 0\nfor i in range(N-2, -1, -1):\n a = A[i]\n if (a+max_benefit) in s:\n cnt += 1\n s.add(a)\n\nprint(cnt)",
"from sys import stdin",
"input = stdin.readline",
"input",
"stdin.readline",
"stdin",
"readline",
"import copy as cp",
"copy",
"from collections import deque",
"def VI(N, init=0):\n return [init for _ in range(N)]",
"VI",
"init for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"init",
"return [init for _ in range(N)]",
"[init for _ in range(N)]",
"N",
"N",
"init=0",
"init",
"0",
"def VVI(N, M, init=0):\n return [[init for _ in range(M)] for _ in range(N)]",
"VVI",
"[init for _ in range(M)] for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"[init for _ in range(M)]",
"return [[init for _ in range(M)] for _ in range(N)]",
"[[init for _ in range(M)] for _ in range(N)]",
"N",
"N",
"M",
"M",
"init=0",
"init",
"0",
"def VD(N, init=0.0):\n return [init for _ in range(N)]",
"VD",
"init for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"init",
"return [init for _ in range(N)]",
"[init for _ in range(N)]",
"N",
"N",
"init=0.0",
"init",
"0.0",
"def VVD(N, M, init=0.0):\n return [[init for _ in range(M)] for _ in range(N)]",
"VVD",
"[init for _ in range(M)] for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"[init for _ in range(M)]",
"return [[init for _ in range(M)] for _ in range(N)]",
"[[init for _ in range(M)] for _ in range(N)]",
"N",
"N",
"M",
"M",
"init=0.0",
"init",
"0.0",
"def Decimal(x):\n print(\"{0:.10f}\".format(x))",
"Decimal",
"print(\"{0:.10f}\".format(x))",
"print",
"\"{0:.10f}\".format(x)",
"\"{0:.10f}\".format",
"\"{0:.10f}\"",
"format",
"x",
"x",
"x",
"class Pair:\n def __init__(self, x=0, y=0):\n self.first = x\n self.second = y\n\n def __repr__(self):\n return '{0} {1}'.format(self.first, self.second)\n\n def __lt__(self, pi):\n return self.first < pi.second",
"Pair",
"def __init__(self, x=0, y=0):\n self.first = x\n self.second = y\n\n ",
"__init__",
"self.first = x",
"self.first",
"self",
"first",
"x",
"self.second = y",
"self.second",
"self",
"second",
"y",
"self",
"self",
"x=0",
"x",
"0",
"y=0",
"y",
"0",
"def __repr__(self):\n return '{0} {1}'.format(self.first, self.second)\n\n ",
"__repr__",
"return '{0} {1}'.format(self.first, self.second)",
"'{0} {1}'.format(self.first, self.second)",
"'{0} {1}'.format",
"'{0} {1}'",
"format",
"self.first",
"self",
"first",
"self.second",
"self",
"second",
"self",
"self",
"def __lt__(self, pi):\n return self.first < pi.second",
"__lt__",
"return self.first < pi.second",
"self.first < pi.second",
"self.first",
"self",
"first",
"pi.second",
"pi",
"second",
"self",
"self",
"pi",
"pi",
"def POW(x, n):\n ret = 1\n while n:\n if n&1:\n ret *= x\n x *= x\n n >>= 1\n return ret",
"POW",
"ret = 1",
"ret",
"1",
"while n:\n if n&1:\n ret *= x\n x *= x\n n >>= 1\n ",
"n",
"if n&1:\n ret *= x\n ",
"n&1",
"n",
"1",
"ret *= x",
"ret",
"x",
"x *= x",
"x",
"x",
"n >>= 1",
"n",
"1",
"return ret",
"ret",
"x",
"x",
"n",
"n",
"N, T = map(int, input().rstrip().split())",
"N",
"map(int, input().rstrip().split())",
"map",
"int",
"input().rstrip().split()",
"().rstrip().split",
"().rstrip()",
"().rstrip",
"()",
"input",
"rstrip",
"split",
"T",
"A = list(map(int, input().rstrip().split()))",
"A",
"list(map(int, input().rstrip().split()))",
"list",
"map(int, input().rstrip().split())",
"map",
"int",
"input().rstrip().split()",
"().rstrip().split",
"().rstrip()",
"().rstrip",
"()",
"input",
"rstrip",
"split",
"mi = VI(N)",
"mi",
"VI(N)",
"VI",
"N",
"ma = VI(N)",
"ma",
"VI(N)",
"VI",
"N",
"mi[0] = A[0]",
"mi[0]",
"mi",
"0",
"A[0]",
"A",
"0",
"ma[N-1] = A[N-1]",
"ma[N-1]",
"ma",
"N-1",
"N",
"1",
"A[N-1]",
"A",
"N-1",
"N",
"1",
"for i in range(1, N):\n mi[i] = min(A[i], mi[i-1])",
"i",
"range(1, N)",
"range",
"1",
"N",
"mi[i] = min(A[i], mi[i-1])",
"mi[i]",
"mi",
"i",
"min(A[i], mi[i-1])",
"min",
"A[i]",
"A",
"i",
"mi[i-1]",
"mi",
"i-1",
"i",
"1",
"for i in range(N-2, -1, -1):\n ma[i] = max(A[i], ma[i+1])",
"i",
"range(N-2, -1, -1)",
"range",
"N-2",
"N",
"2",
"-1",
"-1",
"ma[i] = max(A[i], ma[i+1])",
"ma[i]",
"ma",
"i",
"max(A[i], ma[i+1])",
"max",
"A[i]",
"A",
"i",
"ma[i+1]",
"ma",
"i+1",
"i",
"1",
"t = T // 2",
"t",
"T // 2",
"T",
"2",
"max_benefit = 0",
"max_benefit",
"0",
"for i in range(N-1):\n max_benefit = max(max_benefit, ma[i+1]-mi[i])",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"max_benefit = max(max_benefit, ma[i+1]-mi[i])",
"max_benefit",
"max(max_benefit, ma[i+1]-mi[i])",
"max",
"max_benefit",
"ma[i+1]-mi[i]",
"ma[i+1]",
"ma",
"i+1",
"i",
"1",
"mi[i]",
"mi",
"i",
"s = set([])",
"s",
"set([])",
"set",
"[]",
"s.add(A[N-1])",
"s.add",
"s",
"add",
"A[N-1]",
"A",
"N-1",
"N",
"1",
"cnt = 0",
"cnt",
"0",
"for i in range(N-2, -1, -1):\n a = A[i]\n if (a+max_benefit) in s:\n cnt += 1\n s.add(a)",
"i",
"range(N-2, -1, -1)",
"range",
"N-2",
"N",
"2",
"-1",
"-1",
"a = A[i]",
"a",
"A[i]",
"A",
"i",
"if (a+max_benefit) in s:\n cnt += 1\n ",
"(a+max_benefit) in s",
"a+max_benefit",
"a",
"max_benefit",
"s",
"cnt += 1",
"cnt",
"1",
"s.add(a)",
"s.add",
"s",
"add",
"a",
"print(cnt)",
"print",
"cnt",
"def VVD(N, M, init=0.0):\n return [[init for _ in range(M)] for _ in range(N)]",
"def VVD(N, M, init=0.0):\n return [[init for _ in range(M)] for _ in range(N)]",
"VVD",
"cnt += 1",
"1",
"cnt",
"ma = VI(N)",
"VI(N)",
"ma",
"N, T = map(int, input().rstrip().split())",
"map(int, input().rstrip().split())",
"N",
"def VVI(N, M, init=0):\n return [[init for _ in range(M)] for _ in range(N)]",
"def VVI(N, M, init=0):\n return [[init for _ in range(M)] for _ in range(N)]",
"VVI",
"mi = VI(N)",
"VI(N)",
"mi",
"T = map(int, input().rstrip().split())",
"map(int, input().rstrip().split())",
"T",
"s = set([])",
"set([])",
"s",
"input = stdin.readline",
"stdin.readline",
"input",
"def POW(x, n):\n ret = 1\n while n:\n if n&1:\n ret *= x\n x *= x\n n >>= 1\n return ret",
"def POW(x, n):\n ret = 1\n while n:\n if n&1:\n ret *= x\n x *= x\n n >>= 1\n return ret",
"POW",
"def VD(N, init=0.0):\n return [init for _ in range(N)]",
"def VD(N, init=0.0):\n return [init for _ in range(N)]",
"VD",
"cnt = 0",
"0",
"cnt",
"def VI(N, init=0):\n return [init for _ in range(N)]",
"def VI(N, init=0):\n return [init for _ in range(N)]",
"VI",
"def Decimal(x):\n print(\"{0:.10f}\".format(x))",
"def Decimal(x):\n print(\"{0:.10f}\".format(x))",
"Decimal",
"A = list(map(int, input().rstrip().split()))",
"list(map(int, input().rstrip().split()))",
"A",
"a = A[i]",
"A[i]",
"a",
"max_benefit = max(max_benefit, ma[i+1]-mi[i])",
"max(max_benefit, ma[i+1]-mi[i])",
"max_benefit",
"class Pair:\n def __init__(self, x=0, y=0):\n self.first = x\n self.second = y\n\n def __repr__(self):\n return '{0} {1}'.format(self.first, self.second)\n\n def __lt__(self, pi):\n return self.first < pi.second",
"class Pair:\n def __init__(self, x=0, y=0):\n self.first = x\n self.second = y\n\n def __repr__(self):\n return '{0} {1}'.format(self.first, self.second)\n\n def __lt__(self, pi):\n return self.first < pi.second",
"Pair",
"t = T // 2",
"T // 2",
"t",
"max_benefit = 0",
"0",
"max_benefit"
] |
from sys import stdin
input = stdin.readline
import copy as cp
from collections import deque
def VI(N, init=0):
return [init for _ in range(N)]
def VVI(N, M, init=0):
return [[init for _ in range(M)] for _ in range(N)]
def VD(N, init=0.0):
return [init for _ in range(N)]
def VVD(N, M, init=0.0):
return [[init for _ in range(M)] for _ in range(N)]
def Decimal(x):
print("{0:.10f}".format(x))
class Pair:
def __init__(self, x=0, y=0):
self.first = x
self.second = y
def __repr__(self):
return '{0} {1}'.format(self.first, self.second)
def __lt__(self, pi):
return self.first < pi.second
def POW(x, n):
ret = 1
while n:
if n&1:
ret *= x
x *= x
n >>= 1
return ret
N, T = map(int, input().rstrip().split())
A = list(map(int, input().rstrip().split()))
mi = VI(N)
ma = VI(N)
mi[0] = A[0]
ma[N-1] = A[N-1]
for i in range(1, N):
mi[i] = min(A[i], mi[i-1])
for i in range(N-2, -1, -1):
ma[i] = max(A[i], ma[i+1])
t = T // 2
max_benefit = 0
for i in range(N-1):
max_benefit = max(max_benefit, ma[i+1]-mi[i])
s = set([])
s.add(A[N-1])
cnt = 0
for i in range(N-2, -1, -1):
a = A[i]
if (a+max_benefit) in s:
cnt += 1
s.add(a)
print(cnt)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
18,
13,
2,
13,
17,
4,
13,
18,
13,
13,
18,
13,
13,
0,
13,
2,
39,
2,
2,
17,
17,
17,
2,
13,
17,
28,
13,
4,
13,
13,
0,
18,
13,
2,
13,
17,
4,
13,
18,
13,
13,
18,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
2,
13,
17,
14,
2,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
14,
2,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] |
[
[
166,
2
],
[
166,
11
],
[
142,
13
],
[
163,
25
],
[
167,
30
],
[
34,
33
],
[
167,
37
],
[
47,
42
],
[
164,
43
],
[
33,
45
],
[
164,
50
],
[
33,
51
],
[
143,
53
],
[
33,
54
],
[
148,
56
],
[
167,
65
],
[
69,
68
],
[
167,
71
],
[
78,
73
],
[
149,
74
],
[
68,
76
],
[
149,
81
],
[
68,
82
],
[
143,
84
],
[
68,
85
],
[
139,
87
],
[
157,
90
],
[
94,
93
],
[
167,
98
],
[
140,
102
],
[
146,
102
],
[
164,
105
],
[
93,
106
],
[
149,
108
],
[
93,
109
],
[
151,
111
],
[
140,
115
],
[
146,
115
],
[
164,
118
],
[
93,
119
],
[
149,
121
],
[
93,
122
],
[
154,
124
],
[
145,
127
],
[
164,
130
],
[
93,
131
],
[
149,
133
],
[
93,
134
],
[
155,
137
],
[
152,
137
],
[
158,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
166,
161
],
[
163,
164
],
[
166,
167
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\nright = [0] * (N+1)\nfor i in range(N-1,-1,-1):\n right[i+1] = max(right[i], A[i])\nleft = [10 ** 9 + 7] * (N+1)\nfor i in range(N):\n left[i+1] = min(left[i], A[i])\n\nprofit = 0\ncnt = 0\nfor i in range(1,N+1):\n if profit == right[i]-left[i]:\n cnt += 1\n elif profit < right[i]-left[i]:\n cnt = 1\n profit = right[i]-left[i]\n\nprint(cnt)\n",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"right = [0] * (N+1)",
"right",
"[0] * (N+1)",
"[0]",
"0",
"N+1",
"N",
"1",
"for i in range(N-1,-1,-1):\n right[i+1] = max(right[i], A[i])",
"i",
"range(N-1,-1,-1)",
"range",
"N-1",
"N",
"1",
"-1",
"-1",
"right[i+1] = max(right[i], A[i])",
"right[i+1]",
"right",
"i+1",
"i",
"1",
"max(right[i], A[i])",
"max",
"right[i]",
"right",
"i",
"A[i]",
"A",
"i",
"left = [10 ** 9 + 7] * (N+1)",
"left",
"[10 ** 9 + 7] * (N+1)",
"[10 ** 9 + 7]",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"N+1",
"N",
"1",
"for i in range(N):\n left[i+1] = min(left[i], A[i])",
"i",
"range(N)",
"range",
"N",
"left[i+1] = min(left[i], A[i])",
"left[i+1]",
"left",
"i+1",
"i",
"1",
"min(left[i], A[i])",
"min",
"left[i]",
"left",
"i",
"A[i]",
"A",
"i",
"profit = 0",
"profit",
"0",
"cnt = 0",
"cnt",
"0",
"for i in range(1,N+1):\n if profit == right[i]-left[i]:\n cnt += 1\n elif profit < right[i]-left[i]:\n cnt = 1\n profit = right[i]-left[i]",
"i",
"range(1,N+1)",
"range",
"1",
"N+1",
"N",
"1",
"if profit == right[i]-left[i]:\n cnt += 1\n elif profit < right[i]-left[i]:\n cnt = 1\n profit = right[i]-left[i]",
"profit == right[i]-left[i]",
"profit",
"right[i]-left[i]",
"right[i]",
"right",
"i",
"left[i]",
"left",
"i",
"cnt += 1",
"cnt",
"1",
"elif profit < right[i]-left[i]:\n cnt = 1\n profit = right[i]-left[i]",
"profit < right[i]-left[i]",
"profit",
"right[i]-left[i]",
"right[i]",
"right",
"i",
"left[i]",
"left",
"i",
"cnt = 1",
"cnt",
"1",
"profit = right[i]-left[i]",
"profit",
"right[i]-left[i]",
"right[i]",
"right",
"i",
"left[i]",
"left",
"i",
"print(cnt)",
"print",
"cnt",
"profit = 0",
"0",
"profit",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"profit = right[i]-left[i]",
"right[i]-left[i]",
"profit",
"left = [10 ** 9 + 7] * (N+1)",
"[10 ** 9 + 7] * (N+1)",
"left",
"cnt += 1",
"1",
"cnt",
"cnt = 1",
"1",
"cnt",
"cnt = 0",
"0",
"cnt",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"right = [0] * (N+1)",
"[0] * (N+1)",
"right",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
right = [0] * (N+1)
for i in range(N-1,-1,-1):
right[i+1] = max(right[i], A[i])
left = [10 ** 9 + 7] * (N+1)
for i in range(N):
left[i+1] = min(left[i], A[i])
profit = 0
cnt = 0
for i in range(1,N+1):
if profit == right[i]-left[i]:
cnt += 1
elif profit < right[i]-left[i]:
cnt = 1
profit = right[i]-left[i]
print(cnt)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
0,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
14,
40,
18,
13,
13,
13,
4,
18,
13,
13,
2,
13,
13,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
40,
18,
13,
13,
13,
4,
18,
13,
13,
2,
13,
13,
0,
13,
18,
13,
13,
4,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
2,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
131,
2
],
[
131,
11
],
[
128,
13
],
[
116,
25
],
[
137,
30
],
[
140,
33
],
[
37,
36
],
[
126,
39
],
[
129,
43
],
[
36,
44
],
[
117,
45
],
[
135,
45
],
[
141,
48
],
[
138,
51
],
[
120,
51
],
[
123,
51
],
[
117,
52
],
[
135,
52
],
[
134,
54
],
[
129,
56
],
[
36,
57
],
[
122,
59
],
[
129,
61
],
[
36,
62
],
[
129,
66
],
[
36,
67
],
[
138,
68
],
[
120,
68
],
[
123,
68
],
[
141,
71
],
[
138,
74
],
[
120,
74
],
[
123,
74
],
[
117,
75
],
[
135,
75
],
[
119,
77
],
[
129,
79
],
[
36,
80
],
[
141,
83
],
[
120,
86
],
[
123,
86
],
[
138,
86
],
[
135,
87
],
[
117,
87
],
[
143,
89
],
[
141,
92
],
[
149,
94
],
[
98,
97
],
[
141,
102
],
[
141,
106
],
[
97,
107
],
[
144,
108
],
[
146,
110
],
[
147,
114
],
[
150,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
],
[
131,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\nmin_A = 10**10\nmax_A = 0\nprofit = []\nfor i in range(N):\n if A[i] <= min_A:\n profit.append(max_A - min_A)\n min_A = A[i]\n max_A = A[i]\n elif A[i] >= max_A:\n profit.append(max_A - min_A)\n max_A = A[i]\nprofit.append(max_A - min_A) \n \nmax_profit = max(profit)\ncount = 0\nfor i in range(len(profit)):\n if profit[i] == max_profit:\n count += 1\n \nprint(count)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"min_A = 10**10",
"min_A",
"10**10",
"10",
"10",
"max_A = 0",
"max_A",
"0",
"profit = []",
"profit",
"[]",
"for i in range(N):\n if A[i] <= min_A:\n profit.append(max_A - min_A)\n min_A = A[i]\n max_A = A[i]\n elif A[i] >= max_A:\n profit.append(max_A - min_A)\n max_A = A[i]",
"i",
"range(N)",
"range",
"N",
"if A[i] <= min_A:\n profit.append(max_A - min_A)\n min_A = A[i]\n max_A = A[i]\n elif A[i] >= max_A:\n profit.append(max_A - min_A)\n max_A = A[i]",
"A[i] <= min_A",
"A[i]",
"A",
"i",
"min_A",
"profit.append(max_A - min_A)",
"profit.append",
"profit",
"append",
"max_A - min_A",
"max_A",
"min_A",
"min_A = A[i]",
"min_A",
"A[i]",
"A",
"i",
"max_A = A[i]",
"max_A",
"A[i]",
"A",
"i",
"elif A[i] >= max_A:\n profit.append(max_A - min_A)\n max_A = A[i]",
"A[i] >= max_A",
"A[i]",
"A",
"i",
"max_A",
"profit.append(max_A - min_A)",
"profit.append",
"profit",
"append",
"max_A - min_A",
"max_A",
"min_A",
"max_A = A[i]",
"max_A",
"A[i]",
"A",
"i",
"profit.append(max_A - min_A)",
"profit.append",
"profit",
"append",
"max_A - min_A",
"max_A",
"min_A",
"max_profit = max(profit)",
"max_profit",
"max(profit)",
"max",
"profit",
"count = 0",
"count",
"0",
"for i in range(len(profit)):\n if profit[i] == max_profit:\n count += 1\n ",
"i",
"range(len(profit))",
"range",
"len(profit)",
"len",
"profit",
"if profit[i] == max_profit:\n count += 1\n ",
"profit[i] == max_profit",
"profit[i]",
"profit",
"i",
"max_profit",
"count += 1",
"count",
"1",
"print(count)",
"print",
"count",
"min_A = 10**10",
"10**10",
"min_A",
"max_A = A[i]",
"A[i]",
"max_A",
"max_A = A[i]",
"A[i]",
"max_A",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"min_A = A[i]",
"A[i]",
"min_A",
"max_A = 0",
"0",
"max_A",
"profit = []",
"[]",
"profit",
"max_profit = max(profit)",
"max(profit)",
"max_profit",
"count += 1",
"1",
"count",
"count = 0",
"0",
"count"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
min_A = 10**10
max_A = 0
profit = []
for i in range(N):
if A[i] <= min_A:
profit.append(max_A - min_A)
min_A = A[i]
max_A = A[i]
elif A[i] >= max_A:
profit.append(max_A - min_A)
max_A = A[i]
profit.append(max_A - min_A)
max_profit = max(profit)
count = 0
for i in range(len(profit)):
if profit[i] == max_profit:
count += 1
print(count)
|
[
7,
15,
13,
15,
12,
13,
29,
4,
18,
4,
18,
18,
13,
13,
13,
13,
4,
18,
13,
13,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
2,
18,
13,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
18,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13
] |
[
[
25,
24
],
[
104,
31
],
[
25,
33
],
[
36,
35
],
[
104,
44
],
[
48,
47
],
[
53,
52
],
[
58,
57
],
[
24,
60
],
[
35,
64
],
[
57,
65
],
[
47,
66
],
[
68,
66
],
[
69,
68
],
[
35,
70
],
[
57,
71
],
[
80,
73
],
[
52,
74
],
[
35,
77
],
[
57,
78
],
[
47,
79
],
[
68,
79
],
[
83,
82
],
[
52,
87
],
[
52,
92
],
[
82,
95
],
[
107,
101
]
] |
[
"import sys\nfrom collections import defaultdict\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\nsys.setrecursionlimit(20000000)\n\n\ndef main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n m = float(\"inf\")\n count = defaultdict(int)\n for i in range(N):\n if A[i] < m:\n m = A[i]\n else:\n count[A[i] - m] += 1\n K = list(count.keys())\n print(count[max(K)])\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"from collections import defaultdict",
"def input():\n return sys.stdin.readline().strip()",
"input",
"return sys.stdin.readline().strip()",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"sys.setrecursionlimit(20000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"20000000",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n m = float(\"inf\")\n count = defaultdict(int)\n for i in range(N):\n if A[i] < m:\n m = A[i]\n else:\n count[A[i] - m] += 1\n K = list(count.keys())\n print(count[max(K)])",
"main",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"m = float(\"inf\")",
"m",
"float(\"inf\")",
"float",
"\"inf\"",
"count = defaultdict(int)",
"count",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N):\n if A[i] < m:\n m = A[i]\n else:\n count[A[i] - m] += 1\n ",
"i",
"range(N)",
"range",
"N",
"if A[i] < m:\n m = A[i]\n else:\n count[A[i] - m] += 1\n ",
"A[i] < m",
"A[i]",
"A",
"i",
"m",
"m = A[i]",
"m",
"A[i]",
"A",
"i",
"count[A[i] - m] += 1",
"count[A[i] - m]",
"count",
"A[i] - m",
"A[i]",
"A",
"i",
"m",
"1",
"K = list(count.keys())",
"K",
"list(count.keys())",
"list",
"count.keys()",
"count.keys",
"count",
"keys",
"print(count[max(K)])",
"print",
"count[max(K)]",
"count",
"max(K)",
"max",
"K",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def input():\n return sys.stdin.readline().strip()",
"def input():\n return sys.stdin.readline().strip()",
"input",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n m = float(\"inf\")\n count = defaultdict(int)\n for i in range(N):\n if A[i] < m:\n m = A[i]\n else:\n count[A[i] - m] += 1\n K = list(count.keys())\n print(count[max(K)])",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n m = float(\"inf\")\n count = defaultdict(int)\n for i in range(N):\n if A[i] < m:\n m = A[i]\n else:\n count[A[i] - m] += 1\n K = list(count.keys())\n print(count[max(K)])",
"main"
] |
import sys
from collections import defaultdict
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(20000000)
def main():
N, T = map(int, input().split())
A = list(map(int, input().split()))
m = float("inf")
count = defaultdict(int)
for i in range(N):
if A[i] < m:
m = A[i]
else:
count[A[i] - m] += 1
K = list(count.keys())
print(count[max(K)])
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
40,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
18,
13,
2,
13,
17,
14,
2,
13,
2,
13,
13,
0,
13,
17,
14,
2,
13,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
13,
13,
10,
18,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13
] |
[
[
108,
2
],
[
108,
11
],
[
15,
14
],
[
14,
23
],
[
90,
25
],
[
111,
28
],
[
96,
31
],
[
105,
34
],
[
91,
36
],
[
40,
39
],
[
103,
43
],
[
91,
48
],
[
39,
49
],
[
106,
50
],
[
115,
50
],
[
114,
52
],
[
91,
54
],
[
39,
55
],
[
93,
57
],
[
91,
59
],
[
39,
61
],
[
97,
65
],
[
100,
65
],
[
94,
67
],
[
115,
68
],
[
106,
68
],
[
120,
70
],
[
97,
74
],
[
100,
74
],
[
94,
76
],
[
115,
77
],
[
106,
77
],
[
99,
79
],
[
94,
81
],
[
115,
82
],
[
106,
82
],
[
117,
84
],
[
118,
88
],
[
121,
88
],
[
112,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
108,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
]
] |
[
"N, T = map(int, input().split())\nA = [int(i) for i in input().split()]\n\nc = 0\nMAX = 0\na1 = A[0]\nfor i in range(N-1):\n if A[i] <= a1:\n a1 = A[i]\n a2 = A[i+1]\n if MAX == a2 - a1:\n c += 1\n elif MAX < a2 - a1:\n MAX = a2 - a1\n c = 1\nprint(c)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"A = [int(i) for i in input().split()]",
"A",
"[int(i) for i in input().split()]",
"c = 0",
"c",
"0",
"MAX = 0",
"MAX",
"0",
"a1 = A[0]",
"a1",
"A[0]",
"A",
"0",
"for i in range(N-1):\n if A[i] <= a1:\n a1 = A[i]\n a2 = A[i+1]\n if MAX == a2 - a1:\n c += 1\n elif MAX < a2 - a1:\n MAX = a2 - a1\n c = 1",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"if A[i] <= a1:\n a1 = A[i]\n ",
"A[i] <= a1",
"A[i]",
"A",
"i",
"a1",
"a1 = A[i]",
"a1",
"A[i]",
"A",
"i",
"a2 = A[i+1]",
"a2",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"if MAX == a2 - a1:\n c += 1\n elif MAX < a2 - a1:\n MAX = a2 - a1\n c = 1",
"MAX == a2 - a1",
"MAX",
"a2 - a1",
"a2",
"a1",
"c += 1",
"c",
"1",
"elif MAX < a2 - a1:\n MAX = a2 - a1\n c = 1",
"MAX < a2 - a1",
"MAX",
"a2 - a1",
"a2",
"a1",
"MAX = a2 - a1",
"MAX",
"a2 - a1",
"a2",
"a1",
"c = 1",
"c",
"1",
"print(c)",
"print",
"c",
"A = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"A",
"a2 = A[i+1]",
"A[i+1]",
"a2",
"MAX = 0",
"0",
"MAX",
"MAX = a2 - a1",
"a2 - a1",
"MAX",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"a1 = A[0]",
"A[0]",
"a1",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"c = 0",
"0",
"c",
"a1 = A[i]",
"A[i]",
"a1",
"c = 1",
"1",
"c",
"c += 1",
"1",
"c"
] |
N, T = map(int, input().split())
A = [int(i) for i in input().split()]
c = 0
MAX = 0
a1 = A[0]
for i in range(N-1):
if A[i] <= a1:
a1 = A[i]
a2 = A[i+1]
if MAX == a2 - a1:
c += 1
elif MAX < a2 - a1:
MAX = a2 - a1
c = 1
print(c)
|
[
7,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
2,
18,
13,
13,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
4,
18,
13,
13,
0,
13,
12,
18,
13,
17,
23,
0,
13,
17,
4,
13,
18,
18,
13,
17,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
6,
5
],
[
6,
14
],
[
17,
16
],
[
29,
28
],
[
34,
33
],
[
16,
35
],
[
39,
38
],
[
5,
42
],
[
51,
44
],
[
28,
45
],
[
16,
48
],
[
38,
49
],
[
33,
50
],
[
53,
50
],
[
54,
53
],
[
33,
56
],
[
53,
56
],
[
16,
58
],
[
38,
59
],
[
62,
61
],
[
28,
66
],
[
61,
70
],
[
28,
70
],
[
74,
73
],
[
81,
80
],
[
61,
86
],
[
28,
86
],
[
97,
94
]
] |
[
"from collections import defaultdict\n\n\ndef main():\n n, t = map(int, input().split())\n a = list(map(int, input().split()))\n profit = defaultdict(int)\n now_min = a[0]\n for i in range(1, n):\n profit[a[i] - now_min] += 1\n now_min = min(now_min, a[i])\n profit = list(profit.items())\n profit.sort(key=lambda x: x[0], reverse=True)\n print(profit[0][1])\n\n\nif __name__ == '__main__':\n main()",
"from collections import defaultdict",
"def main():\n n, t = map(int, input().split())\n a = list(map(int, input().split()))\n profit = defaultdict(int)\n now_min = a[0]\n for i in range(1, n):\n profit[a[i] - now_min] += 1\n now_min = min(now_min, a[i])\n profit = list(profit.items())\n profit.sort(key=lambda x: x[0], reverse=True)\n print(profit[0][1])",
"main",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"profit = defaultdict(int)",
"profit",
"defaultdict(int)",
"defaultdict",
"int",
"now_min = a[0]",
"now_min",
"a[0]",
"a",
"0",
"for i in range(1, n):\n profit[a[i] - now_min] += 1\n now_min = min(now_min, a[i])\n ",
"i",
"range(1, n)",
"range",
"1",
"n",
"profit[a[i] - now_min] += 1",
"profit[a[i] - now_min]",
"profit",
"a[i] - now_min",
"a[i]",
"a",
"i",
"now_min",
"1",
"now_min = min(now_min, a[i])",
"now_min",
"min(now_min, a[i])",
"min",
"now_min",
"a[i]",
"a",
"i",
"profit = list(profit.items())",
"profit",
"list(profit.items())",
"list",
"profit.items()",
"profit.items",
"profit",
"items",
"profit.sort(key=lambda x: x[0], reverse=True)",
"profit.sort",
"profit",
"sort",
"key=lambda x: x[0]",
"key",
"lambda x: x[0]",
"x[0]",
"x",
"0",
"x",
"reverse=True",
"reverse",
"True",
"print(profit[0][1])",
"print",
"profit[0][1]",
"[0]",
"profit",
"0",
"1",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n n, t = map(int, input().split())\n a = list(map(int, input().split()))\n profit = defaultdict(int)\n now_min = a[0]\n for i in range(1, n):\n profit[a[i] - now_min] += 1\n now_min = min(now_min, a[i])\n profit = list(profit.items())\n profit.sort(key=lambda x: x[0], reverse=True)\n print(profit[0][1])",
"def main():\n n, t = map(int, input().split())\n a = list(map(int, input().split()))\n profit = defaultdict(int)\n now_min = a[0]\n for i in range(1, n):\n profit[a[i] - now_min] += 1\n now_min = min(now_min, a[i])\n profit = list(profit.items())\n profit.sort(key=lambda x: x[0], reverse=True)\n print(profit[0][1])",
"main"
] |
from collections import defaultdict
def main():
n, t = map(int, input().split())
a = list(map(int, input().split()))
profit = defaultdict(int)
now_min = a[0]
for i in range(1, n):
profit[a[i] - now_min] += 1
now_min = min(now_min, a[i])
profit = list(profit.items())
profit.sort(key=lambda x: x[0], reverse=True)
print(profit[0][1])
if __name__ == '__main__':
main()
|
[
7,
15,
13,
12,
13,
29,
4,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
17,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
39,
0,
13,
40,
18,
13,
13,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
13,
4,
13,
13,
18,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
29,
13,
14,
2,
13,
17,
4,
13,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
34,
33
],
[
135,
35
],
[
34,
36
],
[
39,
38
],
[
135,
40
],
[
43,
42
],
[
46,
45
],
[
52,
51
],
[
33,
55
],
[
61,
60
],
[
45,
63
],
[
60,
63
],
[
38,
65
],
[
51,
66
],
[
42,
69
],
[
60,
71
],
[
45,
71
],
[
42,
74
],
[
78,
77
],
[
81,
80
],
[
84,
83
],
[
33,
87
],
[
91,
90
],
[
42,
93
],
[
83,
95
],
[
38,
98
],
[
83,
99
],
[
90,
102
],
[
77,
103
],
[
105,
103
],
[
106,
105
],
[
90,
106
],
[
109,
108
],
[
90,
112
],
[
77,
113
],
[
105,
113
],
[
116,
115
],
[
115,
118
],
[
108,
118
],
[
80,
118
],
[
129,
126
]
] |
[
"import math\n\n\ndef read_int():\n return int(input().strip())\n\n\ndef read_ints():\n return list(map(int, input().strip().split(' ')))\n\n\ndef solve():\n N, T = read_ints()\n A = read_ints()\n MAX_OF_REST = []\n MAX = -math.inf\n for i in range(N-1, -1, -1):\n MAX = max(MAX, A[i])\n MAX_OF_REST.append(MAX)\n MAX_OF_REST.reverse()\n max_profit = 0\n max_count = 0\n for i in range(N-1):\n profit = MAX_OF_REST[i+1]-A[i]\n if profit > max_profit:\n max_profit = profit\n max_count = 1\n elif profit == max_profit:\n max_count += 1\n return max_count\n\n\nif __name__ == '__main__':\n print(solve())",
"import math",
"math",
"def read_int():\n return int(input().strip())",
"read_int",
"return int(input().strip())",
"int(input().strip())",
"int",
"input().strip()",
"().strip",
"()",
"input",
"strip",
"def read_ints():\n return list(map(int, input().strip().split(' ')))",
"read_ints",
"return list(map(int, input().strip().split(' ')))",
"list(map(int, input().strip().split(' ')))",
"list",
"map(int, input().strip().split(' '))",
"map",
"int",
"input().strip().split(' ')",
"().strip().split",
"().strip()",
"().strip",
"()",
"input",
"strip",
"split",
"' '",
"def solve():\n N, T = read_ints()\n A = read_ints()\n MAX_OF_REST = []\n MAX = -math.inf\n for i in range(N-1, -1, -1):\n MAX = max(MAX, A[i])\n MAX_OF_REST.append(MAX)\n MAX_OF_REST.reverse()\n max_profit = 0\n max_count = 0\n for i in range(N-1):\n profit = MAX_OF_REST[i+1]-A[i]\n if profit > max_profit:\n max_profit = profit\n max_count = 1\n elif profit == max_profit:\n max_count += 1\n return max_count",
"solve",
"N, T = read_ints()",
"N",
"read_ints()",
"read_ints",
"T",
"A = read_ints()",
"A",
"read_ints()",
"read_ints",
"MAX_OF_REST = []",
"MAX_OF_REST",
"[]",
"MAX = -math.inf",
"MAX",
"-math.inf",
"math.inf",
"math",
"inf",
"for i in range(N-1, -1, -1):\n MAX = max(MAX, A[i])\n MAX_OF_REST.append(MAX)\n ",
"i",
"range(N-1, -1, -1)",
"range",
"N-1",
"N",
"1",
"-1",
"-1",
"MAX = max(MAX, A[i])",
"MAX",
"max(MAX, A[i])",
"max",
"MAX",
"A[i]",
"A",
"i",
"MAX_OF_REST.append(MAX)",
"MAX_OF_REST.append",
"MAX_OF_REST",
"append",
"MAX",
"MAX_OF_REST.reverse()",
"MAX_OF_REST.reverse",
"MAX_OF_REST",
"reverse",
"max_profit = 0",
"max_profit",
"0",
"max_count = 0",
"max_count",
"0",
"for i in range(N-1):\n profit = MAX_OF_REST[i+1]-A[i]\n if profit > max_profit:\n max_profit = profit\n max_count = 1\n elif profit == max_profit:\n max_count += 1\n ",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"profit = MAX_OF_REST[i+1]-A[i]",
"profit",
"MAX_OF_REST[i+1]-A[i]",
"MAX_OF_REST[i+1]",
"MAX_OF_REST",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"if profit > max_profit:\n max_profit = profit\n max_count = 1\n elif profit == max_profit:\n max_count += 1\n ",
"profit > max_profit",
"profit",
"max_profit",
"max_profit = profit",
"max_profit",
"profit",
"max_count = 1",
"max_count",
"1",
"elif profit == max_profit:\n max_count += 1\n ",
"profit == max_profit",
"profit",
"max_profit",
"max_count += 1",
"max_count",
"1",
"return max_count",
"max_count",
"if __name__ == '__main__':\n print(solve())",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"print(solve())",
"print",
"solve()",
"solve",
"def solve():\n N, T = read_ints()\n A = read_ints()\n MAX_OF_REST = []\n MAX = -math.inf\n for i in range(N-1, -1, -1):\n MAX = max(MAX, A[i])\n MAX_OF_REST.append(MAX)\n MAX_OF_REST.reverse()\n max_profit = 0\n max_count = 0\n for i in range(N-1):\n profit = MAX_OF_REST[i+1]-A[i]\n if profit > max_profit:\n max_profit = profit\n max_count = 1\n elif profit == max_profit:\n max_count += 1\n return max_count",
"def solve():\n N, T = read_ints()\n A = read_ints()\n MAX_OF_REST = []\n MAX = -math.inf\n for i in range(N-1, -1, -1):\n MAX = max(MAX, A[i])\n MAX_OF_REST.append(MAX)\n MAX_OF_REST.reverse()\n max_profit = 0\n max_count = 0\n for i in range(N-1):\n profit = MAX_OF_REST[i+1]-A[i]\n if profit > max_profit:\n max_profit = profit\n max_count = 1\n elif profit == max_profit:\n max_count += 1\n return max_count",
"solve",
"def read_int():\n return int(input().strip())",
"def read_int():\n return int(input().strip())",
"read_int",
"def read_ints():\n return list(map(int, input().strip().split(' ')))",
"def read_ints():\n return list(map(int, input().strip().split(' ')))",
"read_ints"
] |
import math
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def solve():
N, T = read_ints()
A = read_ints()
MAX_OF_REST = []
MAX = -math.inf
for i in range(N-1, -1, -1):
MAX = max(MAX, A[i])
MAX_OF_REST.append(MAX)
MAX_OF_REST.reverse()
max_profit = 0
max_count = 0
for i in range(N-1):
profit = MAX_OF_REST[i+1]-A[i]
if profit > max_profit:
max_profit = profit
max_count = 1
elif profit == max_profit:
max_count += 1
return max_count
if __name__ == '__main__':
print(solve())
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] |
[
[
88,
2
],
[
88,
11
],
[
85,
13
],
[
82,
25
],
[
79,
28
],
[
86,
30
],
[
34,
33
],
[
77,
37
],
[
70,
39
],
[
80,
42
],
[
71,
42
],
[
86,
44
],
[
33,
46
],
[
83,
50
],
[
86,
54
],
[
33,
55
],
[
71,
56
],
[
80,
56
],
[
73,
58
],
[
83,
61
],
[
83,
66
],
[
74,
68
],
[
70,
71
],
[
73,
74
],
[
88,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\n\nans = []\nmin_a = a[0]\nfor i in range(1, n):\n min_a = min(min_a, a[i-1])\n ans.append(a[i] - min_a)\nr = max(ans)\nprint(ans.count(r))",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans = []",
"ans",
"[]",
"min_a = a[0]",
"min_a",
"a[0]",
"a",
"0",
"for i in range(1, n):\n min_a = min(min_a, a[i-1])\n ans.append(a[i] - min_a)",
"i",
"range(1, n)",
"range",
"1",
"n",
"min_a = min(min_a, a[i-1])",
"min_a",
"min(min_a, a[i-1])",
"min",
"min_a",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"ans.append(a[i] - min_a)",
"ans.append",
"ans",
"append",
"a[i] - min_a",
"a[i]",
"a",
"i",
"min_a",
"r = max(ans)",
"r",
"max(ans)",
"max",
"ans",
"print(ans.count(r))",
"print",
"ans.count(r)",
"ans.count",
"ans",
"count",
"r",
"min_a = min(min_a, a[i-1])",
"min(min_a, a[i-1])",
"min_a",
"r = max(ans)",
"max(ans)",
"r",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"min_a = a[0]",
"a[0]",
"min_a",
"ans = []",
"[]",
"ans",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"t = map(int, input().split())",
"map(int, input().split())",
"t"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
ans = []
min_a = a[0]
for i in range(1, n):
min_a = min(min_a, a[i-1])
ans.append(a[i] - min_a)
r = max(ans)
print(ans.count(r))
|
[
7,
12,
13,
15,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
17,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
17,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
2,
17,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
18,
13,
2,
13,
13,
39,
13,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
12,
18,
13,
17,
23,
0,
13,
17,
4,
13,
4,
13,
18,
18,
13,
17,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
9,
8
],
[
16,
15
],
[
8,
26
],
[
16,
30
],
[
33,
32
],
[
8,
43
],
[
49,
48
],
[
56,
55
],
[
61,
60
],
[
32,
60
],
[
60,
64
],
[
55,
65
],
[
67,
65
],
[
68,
67
],
[
60,
68
],
[
75,
70
],
[
48,
71
],
[
60,
73
],
[
55,
74
],
[
67,
74
],
[
79,
78
],
[
48,
83
],
[
87,
86
],
[
94,
93
],
[
78,
101
],
[
48,
101
],
[
112,
109
]
] |
[
"def slove():\n import sys\n import collections\n input = sys.stdin.readline\n n, t = list(map(int, input().rstrip('\\n').split()))\n a = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(list)\n m = 10 ** 10\n for v in a:\n if v < m:\n m = v\n else:\n d[v-m] += [m]\n d = sorted(d.items(), key=lambda x: x[0], reverse=True)\n print(len(d[0][1]))\n\n\nif __name__ == '__main__':\n slove()",
"def slove():\n import sys\n import collections\n input = sys.stdin.readline\n n, t = list(map(int, input().rstrip('\\n').split()))\n a = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(list)\n m = 10 ** 10\n for v in a:\n if v < m:\n m = v\n else:\n d[v-m] += [m]\n d = sorted(d.items(), key=lambda x: x[0], reverse=True)\n print(len(d[0][1]))",
"slove",
"import sys",
"sys",
"import collections",
"collections",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"n, t = list(map(int, input().rstrip('\\n').split()))",
"n",
"list(map(int, input().rstrip('\\n').split()))",
"list",
"map(int, input().rstrip('\\n').split())",
"map",
"int",
"input().rstrip('\\n').split()",
"().rstrip('\\n').split",
"().rstrip('\\n')",
"().rstrip",
"()",
"input",
"rstrip",
"'\\n'",
"split",
"t",
"a = list(map(int, input().rstrip('\\n').split()))",
"a",
"list(map(int, input().rstrip('\\n').split()))",
"list",
"map(int, input().rstrip('\\n').split())",
"map",
"int",
"input().rstrip('\\n').split()",
"().rstrip('\\n').split",
"().rstrip('\\n')",
"().rstrip",
"()",
"input",
"rstrip",
"'\\n'",
"split",
"d = collections.defaultdict(list)",
"d",
"collections.defaultdict(list)",
"collections.defaultdict",
"collections",
"defaultdict",
"list",
"m = 10 ** 10",
"m",
"10 ** 10",
"10",
"10",
"for v in a:\n if v < m:\n m = v\n else:\n d[v-m] += [m]\n ",
"v",
"a",
"if v < m:\n m = v\n else:\n d[v-m] += [m]\n ",
"v < m",
"v",
"m",
"m = v",
"m",
"v",
"d[v-m] += [m]",
"d[v-m]",
"d",
"v-m",
"v",
"m",
"[m]",
"m",
"d = sorted(d.items(), key=lambda x: x[0], reverse=True)",
"d",
"sorted(d.items(), key=lambda x: x[0], reverse=True)",
"sorted",
"d.items()",
"d.items",
"d",
"items",
"key=lambda x: x[0]",
"key",
"lambda x: x[0]",
"x[0]",
"x",
"0",
"x",
"reverse=True",
"reverse",
"True",
"print(len(d[0][1]))",
"print",
"len(d[0][1])",
"len",
"d[0][1]",
"[0]",
"d",
"0",
"1",
"if __name__ == '__main__':\n slove()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"slove()",
"slove",
"def slove():\n import sys\n import collections\n input = sys.stdin.readline\n n, t = list(map(int, input().rstrip('\\n').split()))\n a = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(list)\n m = 10 ** 10\n for v in a:\n if v < m:\n m = v\n else:\n d[v-m] += [m]\n d = sorted(d.items(), key=lambda x: x[0], reverse=True)\n print(len(d[0][1]))",
"def slove():\n import sys\n import collections\n input = sys.stdin.readline\n n, t = list(map(int, input().rstrip('\\n').split()))\n a = list(map(int, input().rstrip('\\n').split()))\n d = collections.defaultdict(list)\n m = 10 ** 10\n for v in a:\n if v < m:\n m = v\n else:\n d[v-m] += [m]\n d = sorted(d.items(), key=lambda x: x[0], reverse=True)\n print(len(d[0][1]))",
"slove"
] |
def slove():
import sys
import collections
input = sys.stdin.readline
n, t = list(map(int, input().rstrip('\n').split()))
a = list(map(int, input().rstrip('\n').split()))
d = collections.defaultdict(list)
m = 10 ** 10
for v in a:
if v < m:
m = v
else:
d[v-m] += [m]
d = sorted(d.items(), key=lambda x: x[0], reverse=True)
print(len(d[0][1]))
if __name__ == '__main__':
slove()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13
] |
[
[
82,
2
],
[
82,
11
],
[
76,
13
],
[
88,
25
],
[
100,
32
],
[
94,
35
],
[
39,
38
],
[
77,
38
],
[
91,
41
],
[
89,
44
],
[
92,
44
],
[
38,
45
],
[
38,
49
],
[
92,
50
],
[
89,
50
],
[
101,
51
],
[
98,
51
],
[
97,
53
],
[
38,
55
],
[
92,
56
],
[
89,
56
],
[
79,
58
],
[
38,
63
],
[
92,
64
],
[
89,
64
],
[
101,
65
],
[
98,
65
],
[
85,
67
],
[
86,
71
],
[
80,
71
],
[
95,
71
],
[
82,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\nm = 10**9+1\ns = 0\nc = 0\nfor a in A:\n m = min(m, a)\n if a - m > s:\n s = a - m\n c = 1\n elif a - m == s:\n c += 1\n\nprint(c)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"m = 10**9+1",
"m",
"10**9+1",
"10**9",
"10",
"9",
"1",
"s = 0",
"s",
"0",
"c = 0",
"c",
"0",
"for a in A:\n m = min(m, a)\n if a - m > s:\n s = a - m\n c = 1\n elif a - m == s:\n c += 1",
"a",
"A",
"m = min(m, a)",
"m",
"min(m, a)",
"min",
"m",
"a",
"if a - m > s:\n s = a - m\n c = 1\n elif a - m == s:\n c += 1",
"a - m > s",
"a - m",
"a",
"m",
"s",
"s = a - m",
"s",
"a - m",
"a",
"m",
"c = 1",
"c",
"1",
"elif a - m == s:\n c += 1",
"a - m == s",
"a - m",
"a",
"m",
"s",
"c += 1",
"c",
"1",
"print(c)",
"print",
"c",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"c = 1",
"1",
"c",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"c += 1",
"1",
"c",
"m = 10**9+1",
"10**9+1",
"m",
"m = min(m, a)",
"min(m, a)",
"m",
"c = 0",
"0",
"c",
"s = a - m",
"a - m",
"s",
"s = 0",
"0",
"s"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
m = 10**9+1
s = 0
c = 0
for a in A:
m = min(m, a)
if a - m > s:
s = a - m
c = 1
elif a - m == s:
c += 1
print(c)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
14,
2,
40,
13,
17,
4,
13,
40,
13,
13,
4,
13,
17,
0,
13,
4,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13
] |
[
[
101,
2
],
[
101,
11
],
[
15,
14
],
[
14,
23
],
[
92,
25
],
[
96,
30
],
[
107,
41
],
[
98,
46
],
[
110,
49
],
[
53,
52
],
[
93,
52
],
[
52,
57
],
[
108,
58
],
[
117,
58
],
[
99,
59
],
[
105,
59
],
[
120,
59
],
[
119,
61
],
[
52,
63
],
[
108,
64
],
[
117,
64
],
[
122,
66
],
[
52,
71
],
[
108,
72
],
[
117,
72
],
[
99,
73
],
[
105,
73
],
[
120,
73
],
[
104,
75
],
[
52,
77
],
[
108,
78
],
[
117,
78
],
[
113,
80
],
[
116,
83
],
[
108,
86
],
[
117,
86
],
[
52,
87
],
[
114,
90
],
[
123,
90
],
[
111,
90
],
[
92,
93
],
[
101,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
]
] |
[
"n, t = map(int, input().split())\nl = [int(i)for i in input().split()]\n\nif t <= 1 or all(a >= b for a, b in zip(l, l[1:])):\n print(0)\nelse:\n mini = float(\"inf\")\n maxp = 0\n maxc = 0\n for n in l:\n if n - mini > maxp:\n maxp = n - mini\n maxc = 1\n elif n - mini == maxp:\n maxp = n - mini\n maxc += 1\n mini = min(mini, n)\n print(maxc)",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"int(i)for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"l = [int(i)for i in input().split()]",
"l",
"[int(i)for i in input().split()]",
"if t <= 1 or all(a >= b for a, b in zip(l, l[1:])):\n print(0)\nelse:\n mini = float(\"inf\")\n maxp = 0\n maxc = 0\n for n in l:\n if n - mini > maxp:\n maxp = n - mini\n maxc = 1\n elif n - mini == maxp:\n maxp = n - mini\n maxc += 1\n mini = min(mini, n)\n print(maxc)",
"t <= 1 or all(a >= b for a, b in zip(l, l[1:]))",
"t <= 1",
"t",
"1",
"all(a >= b for a, b in zip(l, l[1:]))",
"all",
"a >= b",
"a",
"b",
"print(0)",
"print",
"0",
"mini = float(\"inf\")",
"mini",
"float(\"inf\")",
"float",
"\"inf\"",
"maxp = 0",
"maxp",
"0",
"maxc = 0",
"maxc",
"0",
"for n in l:\n if n - mini > maxp:\n maxp = n - mini\n maxc = 1\n elif n - mini == maxp:\n maxp = n - mini\n maxc += 1\n mini = min(mini, n)\n ",
"n",
"l",
"if n - mini > maxp:\n maxp = n - mini\n maxc = 1\n elif n - mini == maxp:\n maxp = n - mini\n maxc += 1\n ",
"n - mini > maxp",
"n - mini",
"n",
"mini",
"maxp",
"maxp = n - mini",
"maxp",
"n - mini",
"n",
"mini",
"maxc = 1",
"maxc",
"1",
"elif n - mini == maxp:\n maxp = n - mini\n maxc += 1\n ",
"n - mini == maxp",
"n - mini",
"n",
"mini",
"maxp",
"maxp = n - mini",
"maxp",
"n - mini",
"n",
"mini",
"maxc += 1",
"maxc",
"1",
"mini = min(mini, n)",
"mini",
"min(mini, n)",
"min",
"mini",
"n",
"print(maxc)",
"print",
"maxc",
"l = [int(i)for i in input().split()]",
"[int(i)for i in input().split()]",
"l",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"maxp = 0",
"0",
"maxp",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"maxp = n - mini",
"n - mini",
"maxp",
"mini = float(\"inf\")",
"float(\"inf\")",
"mini",
"maxc = 0",
"0",
"maxc",
"maxc += 1",
"1",
"maxc",
"mini = min(mini, n)",
"min(mini, n)",
"mini",
"maxp = n - mini",
"n - mini",
"maxp",
"maxc = 1",
"1",
"maxc"
] |
n, t = map(int, input().split())
l = [int(i)for i in input().split()]
if t <= 1 or all(a >= b for a, b in zip(l, l[1:])):
print(0)
else:
mini = float("inf")
maxp = 0
maxc = 0
for n in l:
if n - mini > maxp:
maxp = n - mini
maxc = 1
elif n - mini == maxp:
maxp = n - mini
maxc += 1
mini = min(mini, n)
print(maxc)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
9,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] |
[
[
85,
2
],
[
85,
11
],
[
91,
13
],
[
88,
25
],
[
79,
30
],
[
94,
33
],
[
37,
36
],
[
92,
36
],
[
36,
40
],
[
89,
41
],
[
77,
41
],
[
76,
43
],
[
36,
44
],
[
36,
49
],
[
77,
50
],
[
89,
50
],
[
80,
51
],
[
83,
51
],
[
82,
53
],
[
36,
55
],
[
77,
56
],
[
89,
56
],
[
100,
58
],
[
36,
63
],
[
77,
64
],
[
89,
64
],
[
80,
65
],
[
83,
65
],
[
97,
67
],
[
98,
71
],
[
101,
71
],
[
95,
71
],
[
85,
74
],
[
36,
76
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\npre = 10 ** 18\ndiff_max = 0\ndiff_cnt = 0\n\nfor a in A:\n if a < pre:\n pre = a\n continue\n\n if a - pre > diff_max:\n diff_max = a - pre\n diff_cnt = 1\n elif a - pre == diff_max:\n diff_cnt += 1\n\n# 高橋君はdiffmax*(T//2)の利益\n# 取引できるのがdiffcnt箇所、これをつぶす\nprint(diff_cnt)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"pre = 10 ** 18",
"pre",
"10 ** 18",
"10",
"18",
"diff_max = 0",
"diff_max",
"0",
"diff_cnt = 0",
"diff_cnt",
"0",
"for a in A:\n if a < pre:\n pre = a\n continue\n\n if a - pre > diff_max:\n diff_max = a - pre\n diff_cnt = 1\n elif a - pre == diff_max:\n diff_cnt += 1\n\n# 高橋君はdiffmax*(T//2)の利益\n# 取引できるのがdiffcnt箇所、これをつぶす",
"a",
"A",
"if a < pre:\n pre = a\n continue\n\n ",
"a < pre",
"a",
"pre",
"pre = a",
"pre",
"a",
"continue",
"if a - pre > diff_max:\n diff_max = a - pre\n diff_cnt = 1\n elif a - pre == diff_max:\n diff_cnt += 1\n\n# 高橋君はdiffmax*(T//2)の利益\n# 取引できるのがdiffcnt箇所、これをつぶす",
"a - pre > diff_max",
"a - pre",
"a",
"pre",
"diff_max",
"diff_max = a - pre",
"diff_max",
"a - pre",
"a",
"pre",
"diff_cnt = 1",
"diff_cnt",
"1",
"elif a - pre == diff_max:\n diff_cnt += 1\n\n# 高橋君はdiffmax*(T//2)の利益\n# 取引できるのがdiffcnt箇所、これをつぶす",
"a - pre == diff_max",
"a - pre",
"a",
"pre",
"diff_max",
"diff_cnt += 1",
"diff_cnt",
"1",
"print(diff_cnt)",
"print",
"diff_cnt",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"pre = a",
"a",
"pre",
"diff_max = 0",
"0",
"diff_max",
"diff_max = a - pre",
"a - pre",
"diff_max",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"pre = 10 ** 18",
"10 ** 18",
"pre",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"diff_cnt = 0",
"0",
"diff_cnt",
"diff_cnt += 1",
"1",
"diff_cnt",
"diff_cnt = 1",
"1",
"diff_cnt"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
pre = 10 ** 18
diff_max = 0
diff_cnt = 0
for a in A:
if a < pre:
pre = a
continue
if a - pre > diff_max:
diff_max = a - pre
diff_cnt = 1
elif a - pre == diff_max:
diff_cnt += 1
# 高橋君はdiffmax*(T//2)の利益
# 取引できるのがdiffcnt箇所、これをつぶす
print(diff_cnt)
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
2,
17,
17,
0,
13,
39,
28,
13,
13,
14,
2,
13,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
39,
39,
13,
13,
14,
2,
13,
2,
13,
13,
4,
18,
13,
13,
39,
13,
13,
14,
2,
13,
13,
0,
13,
13,
4,
13,
4,
13,
13,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
16,
15
],
[
28,
27
],
[
31,
30
],
[
36,
35
],
[
39,
38
],
[
15,
38
],
[
27,
42
],
[
47,
42
],
[
38,
44
],
[
30,
45
],
[
75,
45
],
[
48,
47
],
[
38,
49
],
[
30,
50
],
[
75,
50
],
[
53,
52
],
[
27,
59
],
[
47,
59
],
[
38,
61
],
[
30,
62
],
[
75,
62
],
[
35,
65
],
[
52,
65
],
[
30,
72
],
[
75,
72
],
[
38,
73
],
[
76,
75
],
[
38,
76
],
[
52,
81
],
[
35,
81
],
[
86,
83
]
] |
[
"def solve():\n N,T = map(int, input().split())\n A = list(map(int, input().split()))\n max_profit = 0\n min_val = 10**9\n max_profit_pair = []\n \n for a in A:\n # print(min_val, max_profit)\n if max_profit < a-min_val:\n max_profit = a-min_val\n max_profit_pair = [(min_val,a)]\n elif max_profit == a-min_val:\n max_profit_pair.append((min_val,a))\n \n if min_val > a:\n min_val = a\n \n # print(max_profit, max_profit_pair)\n print(len(max_profit_pair))\n \nsolve()",
"def solve():\n N,T = map(int, input().split())\n A = list(map(int, input().split()))\n max_profit = 0\n min_val = 10**9\n max_profit_pair = []\n \n for a in A:\n # print(min_val, max_profit)\n if max_profit < a-min_val:\n max_profit = a-min_val\n max_profit_pair = [(min_val,a)]\n elif max_profit == a-min_val:\n max_profit_pair.append((min_val,a))\n \n if min_val > a:\n min_val = a\n \n # print(max_profit, max_profit_pair)\n print(len(max_profit_pair))\n ",
"solve",
"N,T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"max_profit = 0",
"max_profit",
"0",
"min_val = 10**9",
"min_val",
"10**9",
"10",
"9",
"max_profit_pair = []",
"max_profit_pair",
"[]",
"for a in A:\n # print(min_val, max_profit)\n if max_profit < a-min_val:\n max_profit = a-min_val\n max_profit_pair = [(min_val,a)]\n elif max_profit == a-min_val:\n max_profit_pair.append((min_val,a))\n \n if min_val > a:\n min_val = a\n \n # print(max_profit, max_profit_pair)\n ",
"a",
"A",
"if max_profit < a-min_val:\n max_profit = a-min_val\n max_profit_pair = [(min_val,a)]\n elif max_profit == a-min_val:\n max_profit_pair.append((min_val,a))\n \n ",
"max_profit < a-min_val",
"max_profit",
"a-min_val",
"a",
"min_val",
"max_profit = a-min_val",
"max_profit",
"a-min_val",
"a",
"min_val",
"max_profit_pair = [(min_val,a)]",
"max_profit_pair",
"[(min_val,a)]",
"(min_val,a)",
"min_val",
"a",
"elif max_profit == a-min_val:\n max_profit_pair.append((min_val,a))\n \n ",
"max_profit == a-min_val",
"max_profit",
"a-min_val",
"a",
"min_val",
"max_profit_pair.append((min_val,a))",
"max_profit_pair.append",
"max_profit_pair",
"append",
"(min_val,a)",
"min_val",
"a",
"if min_val > a:\n min_val = a\n \n # print(max_profit, max_profit_pair)\n ",
"min_val > a",
"min_val",
"a",
"min_val = a",
"min_val",
"a",
"print(len(max_profit_pair))",
"print",
"len(max_profit_pair)",
"len",
"max_profit_pair",
"solve()",
"solve",
"def solve():\n N,T = map(int, input().split())\n A = list(map(int, input().split()))\n max_profit = 0\n min_val = 10**9\n max_profit_pair = []\n \n for a in A:\n # print(min_val, max_profit)\n if max_profit < a-min_val:\n max_profit = a-min_val\n max_profit_pair = [(min_val,a)]\n elif max_profit == a-min_val:\n max_profit_pair.append((min_val,a))\n \n if min_val > a:\n min_val = a\n \n # print(max_profit, max_profit_pair)\n print(len(max_profit_pair))\n ",
"def solve():\n N,T = map(int, input().split())\n A = list(map(int, input().split()))\n max_profit = 0\n min_val = 10**9\n max_profit_pair = []\n \n for a in A:\n # print(min_val, max_profit)\n if max_profit < a-min_val:\n max_profit = a-min_val\n max_profit_pair = [(min_val,a)]\n elif max_profit == a-min_val:\n max_profit_pair.append((min_val,a))\n \n if min_val > a:\n min_val = a\n \n # print(max_profit, max_profit_pair)\n print(len(max_profit_pair))\n ",
"solve"
] |
def solve():
N,T = map(int, input().split())
A = list(map(int, input().split()))
max_profit = 0
min_val = 10**9
max_profit_pair = []
for a in A:
# print(min_val, max_profit)
if max_profit < a-min_val:
max_profit = a-min_val
max_profit_pair = [(min_val,a)]
elif max_profit == a-min_val:
max_profit_pair.append((min_val,a))
if min_val > a:
min_val = a
# print(max_profit, max_profit_pair)
print(len(max_profit_pair))
solve()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
2,
13,
17,
14,
2,
2,
13,
18,
13,
40,
13,
13,
0,
13,
2,
13,
18,
13,
40,
13,
0,
13,
17,
14,
2,
2,
13,
18,
13,
40,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
18,
13,
40,
13,
4,
13,
13,
10,
2,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
109,
2
],
[
109,
11
],
[
97,
13
],
[
103,
25
],
[
100,
28
],
[
91,
31
],
[
98,
33
],
[
37,
36
],
[
110,
41
],
[
92,
46
],
[
113,
46
],
[
98,
48
],
[
36,
50
],
[
104,
51
],
[
89,
51
],
[
88,
53
],
[
92,
55
],
[
113,
55
],
[
98,
57
],
[
36,
59
],
[
94,
61
],
[
92,
66
],
[
113,
66
],
[
98,
68
],
[
36,
70
],
[
104,
71
],
[
89,
71
],
[
115,
73
],
[
112,
76
],
[
92,
79
],
[
113,
79
],
[
98,
81
],
[
36,
83
],
[
116,
86
],
[
95,
86
],
[
101,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
109,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
]
] |
[
"n,t = map(int,input().split())\na = list(map(int,input().split()))\nmd = 0\nc = 0\nm = a[-1]\nfor i in range(2,n+1):\n if m-a[-i] > md:\n md = m-a[-i]\n c = 1\n elif m-a[-i] == md:\n c += 1\n m = max(m,a[-i])\nprint(c)",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"md = 0",
"md",
"0",
"c = 0",
"c",
"0",
"m = a[-1]",
"m",
"a[-1]",
"a",
"-1",
"for i in range(2,n+1):\n if m-a[-i] > md:\n md = m-a[-i]\n c = 1\n elif m-a[-i] == md:\n c += 1\n m = max(m,a[-i])",
"i",
"range(2,n+1)",
"range",
"2",
"n+1",
"n",
"1",
"if m-a[-i] > md:\n md = m-a[-i]\n c = 1\n elif m-a[-i] == md:\n c += 1\n ",
"m-a[-i] > md",
"m-a[-i]",
"m",
"a[-i]",
"a",
"-i",
"i",
"md",
"md = m-a[-i]",
"md",
"m-a[-i]",
"m",
"a[-i]",
"a",
"-i",
"i",
"c = 1",
"c",
"1",
"elif m-a[-i] == md:\n c += 1\n ",
"m-a[-i] == md",
"m-a[-i]",
"m",
"a[-i]",
"a",
"-i",
"i",
"md",
"c += 1",
"c",
"1",
"m = max(m,a[-i])",
"m",
"max(m,a[-i])",
"max",
"m",
"a[-i]",
"a",
"-i",
"i",
"print(c)",
"print",
"c",
"md = m-a[-i]",
"m-a[-i]",
"md",
"m = a[-1]",
"a[-1]",
"m",
"c = 1",
"1",
"c",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"c = 0",
"0",
"c",
"md = 0",
"0",
"md",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"m = max(m,a[-i])",
"max(m,a[-i])",
"m",
"c += 1",
"1",
"c"
] |
n,t = map(int,input().split())
a = list(map(int,input().split()))
md = 0
c = 0
m = a[-1]
for i in range(2,n+1):
if m-a[-i] > md:
md = m-a[-i]
c = 1
elif m-a[-i] == md:
c += 1
m = max(m,a[-i])
print(c)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
0,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
40,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
18,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
116,
2
],
[
116,
11
],
[
113,
13
],
[
98,
25
],
[
101,
32
],
[
122,
35
],
[
39,
38
],
[
117,
41
],
[
95,
43
],
[
114,
45
],
[
38,
46
],
[
107,
48
],
[
96,
51
],
[
99,
52
],
[
108,
52
],
[
92,
54
],
[
96,
56
],
[
108,
57
],
[
99,
57
],
[
93,
60
],
[
102,
61
],
[
111,
61
],
[
89,
63
],
[
110,
66
],
[
93,
67
],
[
93,
70
],
[
102,
71
],
[
111,
71
],
[
119,
73
],
[
111,
77
],
[
102,
77
],
[
104,
80
],
[
105,
84
],
[
120,
84
],
[
90,
84
],
[
123,
84
],
[
116,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
93,
110
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
]
] |
[
"n,t = map(int,input().split())\nA = list(map(int,input().split()))\nm = 10**9+1 \nM = -1\nans = 1\nfor i in range(n):\n x = A[i]\n m = min(x,m)\n p = x-m\n if p > M:\n ans = 1\n M = p\n elif p == M:\n ans += 1\nif M <= 0:\n ans = 0\nprint(ans)",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"A = list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"m = 10**9+1",
"m",
"10**9+1",
"10**9",
"10",
"9",
"1",
"M = -1",
"M",
"-1",
"ans = 1",
"ans",
"1",
"for i in range(n):\n x = A[i]\n m = min(x,m)\n p = x-m\n if p > M:\n ans = 1\n M = p\n elif p == M:\n ans += 1",
"i",
"range(n)",
"range",
"n",
"x = A[i]",
"x",
"A[i]",
"A",
"i",
"m = min(x,m)",
"m",
"min(x,m)",
"min",
"x",
"m",
"p = x-m",
"p",
"x-m",
"x",
"m",
"if p > M:\n ans = 1\n M = p\n elif p == M:\n ans += 1",
"p > M",
"p",
"M",
"ans = 1",
"ans",
"1",
"M = p",
"M",
"p",
"elif p == M:\n ans += 1",
"p == M",
"p",
"M",
"ans += 1",
"ans",
"1",
"if M <= 0:\n ans = 0",
"M <= 0",
"M",
"0",
"ans = 0",
"ans",
"0",
"print(ans)",
"print",
"ans",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"ans = 1",
"1",
"ans",
"p = x-m",
"x-m",
"p",
"x = A[i]",
"A[i]",
"x",
"m = 10**9+1",
"10**9+1",
"m",
"M = -1",
"-1",
"M",
"ans = 0",
"0",
"ans",
"m = min(x,m)",
"min(x,m)",
"m",
"M = p",
"p",
"M",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"ans += 1",
"1",
"ans",
"ans = 1",
"1",
"ans"
] |
n,t = map(int,input().split())
A = list(map(int,input().split()))
m = 10**9+1
M = -1
ans = 1
for i in range(n):
x = A[i]
m = min(x,m)
p = x-m
if p > M:
ans = 1
M = p
elif p == M:
ans += 1
if M <= 0:
ans = 0
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
13,
2,
17,
13,
4,
18,
13,
13,
2,
13,
18,
13,
2,
17,
13,
0,
13,
17,
4,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
40,
18,
13,
13,
18,
13,
2,
13,
17,
4,
13,
2,
13,
17,
3,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] |
[
[
105,
2
],
[
105,
11
],
[
96,
13
],
[
108,
25
],
[
90,
28
],
[
32,
31
],
[
103,
34
],
[
99,
36
],
[
91,
39
],
[
100,
39
],
[
97,
41
],
[
31,
44
],
[
109,
47
],
[
100,
50
],
[
91,
50
],
[
97,
52
],
[
31,
55
],
[
93,
57
],
[
109,
61
],
[
65,
64
],
[
68,
67
],
[
103,
71
],
[
109,
76
],
[
67,
77
],
[
109,
79
],
[
67,
81
],
[
67,
86
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
105,
103
],
[
105,
106
],
[
108,
109
]
] |
[
"N,T = map(int,input().split())\nA = list(map(int,input().split()))\ndif = []\nmax_A = 0\nfor i in range(N):\n max_A = max(max_A,A[-1-i])\n dif.append(max_A-A[-1-i])\nans = 0\ndif.sort(reverse=True)\nfor i in range(N-1):\n if dif[i]!=dif[i+1]:\n print(i+1)\n break",
"N,T = map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"dif = []",
"dif",
"[]",
"max_A = 0",
"max_A",
"0",
"for i in range(N):\n max_A = max(max_A,A[-1-i])\n dif.append(max_A-A[-1-i])",
"i",
"range(N)",
"range",
"N",
"max_A = max(max_A,A[-1-i])",
"max_A",
"max(max_A,A[-1-i])",
"max",
"max_A",
"A[-1-i]",
"A",
"-1-i",
"-1",
"i",
"dif.append(max_A-A[-1-i])",
"dif.append",
"dif",
"append",
"max_A-A[-1-i]",
"max_A",
"A[-1-i]",
"A",
"-1-i",
"-1",
"i",
"ans = 0",
"ans",
"0",
"dif.sort(reverse=True)",
"dif.sort",
"dif",
"sort",
"reverse=True",
"reverse",
"True",
"for i in range(N-1):\n if dif[i]!=dif[i+1]:\n print(i+1)\n break",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"if dif[i]!=dif[i+1]:\n print(i+1)\n break",
"dif[i]!=dif[i+1]",
"dif[i]",
"dif",
"i",
"dif[i+1]",
"dif",
"i+1",
"i",
"1",
"print(i+1)",
"print",
"i+1",
"i",
"1",
"break",
"max_A = 0",
"0",
"max_A",
"ans = 0",
"0",
"ans",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"max_A = max(max_A,A[-1-i])",
"max(max_A,A[-1-i])",
"max_A",
"N,T = map(int,input().split())",
"map(int,input().split())",
"N",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"dif = []",
"[]",
"dif"
] |
N,T = map(int,input().split())
A = list(map(int,input().split()))
dif = []
max_A = 0
for i in range(N):
max_A = max(max_A,A[-1-i])
dif.append(max_A-A[-1-i])
ans = 0
dif.sort(reverse=True)
for i in range(N-1):
if dif[i]!=dif[i+1]:
print(i+1)
break
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
8,
2,
13,
18,
13,
13,
17,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
4,
13,
13,
10,
18,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
8,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13
] |
[
[
132,
2
],
[
132,
11
],
[
138,
13
],
[
129,
25
],
[
114,
28
],
[
139,
30
],
[
34,
33
],
[
133,
36
],
[
139,
40
],
[
33,
41
],
[
115,
42
],
[
112,
42
],
[
111,
44
],
[
139,
46
],
[
33,
47
],
[
126,
49
],
[
112,
52
],
[
115,
52
],
[
139,
54
],
[
33,
55
],
[
139,
59
],
[
33,
60
],
[
112,
61
],
[
115,
61
],
[
130,
64
],
[
142,
64
],
[
127,
65
],
[
141,
67
],
[
127,
68
],
[
144,
70
],
[
117,
73
],
[
139,
75
],
[
79,
78
],
[
133,
81
],
[
135,
83
],
[
139,
86
],
[
78,
87
],
[
118,
88
],
[
112,
88
],
[
115,
88
],
[
124,
88
],
[
136,
91
],
[
142,
92
],
[
130,
92
],
[
147,
94
],
[
139,
99
],
[
78,
100
],
[
118,
101
],
[
112,
101
],
[
115,
101
],
[
124,
101
],
[
123,
103
],
[
139,
105
],
[
78,
106
],
[
148,
109
],
[
145,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
132,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
],
[
138,
139
],
[
127,
141
],
[
141,
142
],
[
144,
145
],
[
147,
148
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\n\nprofit = -1\nlow = a[0]\nfor i in range(n):\n if a[i] < low:\n low = a[i]\n x = 0 if low > a[i] else a[i] - low\n if profit < x:\n profit = x\n\nans = 0\nlow = a[0]\nfor i in range(n):\n diff = a[i] - low\n if diff == profit:\n ans += 1\n if a[i] < low:\n low = a[i]\n\nprint(ans)",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"profit = -1",
"profit",
"-1",
"low = a[0]",
"low",
"a[0]",
"a",
"0",
"for i in range(n):\n if a[i] < low:\n low = a[i]\n x = 0 if low > a[i] else a[i] - low\n if profit < x:\n profit = x",
"i",
"range(n)",
"range",
"n",
"if a[i] < low:\n low = a[i]\n ",
"a[i] < low",
"a[i]",
"a",
"i",
"low",
"low = a[i]",
"low",
"a[i]",
"a",
"i",
"x = 0 if low > a[i] else a[i] - low",
"x",
"0 if low > a[i] else a[i] - low",
"low > a[i]",
"low",
"a[i]",
"a",
"i",
"0",
"a[i] - low",
"a[i]",
"a",
"i",
"low",
"if profit < x:\n profit = x",
"profit < x",
"profit",
"x",
"profit = x",
"profit",
"x",
"ans = 0",
"ans",
"0",
"low = a[0]",
"low",
"a[0]",
"a",
"0",
"for i in range(n):\n diff = a[i] - low\n if diff == profit:\n ans += 1\n if a[i] < low:\n low = a[i]",
"i",
"range(n)",
"range",
"n",
"diff = a[i] - low",
"diff",
"a[i] - low",
"a[i]",
"a",
"i",
"low",
"if diff == profit:\n ans += 1\n ",
"diff == profit",
"diff",
"profit",
"ans += 1",
"ans",
"1",
"if a[i] < low:\n low = a[i]",
"a[i] < low",
"a[i]",
"a",
"i",
"low",
"low = a[i]",
"low",
"a[i]",
"a",
"i",
"print(ans)",
"print",
"ans",
"low = a[i]",
"a[i]",
"low",
"low = a[0]",
"a[0]",
"low",
"low = a[0]",
"a[0]",
"low",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"low = a[i]",
"a[i]",
"low",
"x = 0 if low > a[i] else a[i] - low",
"0 if low > a[i] else a[i] - low",
"x",
"profit = -1",
"-1",
"profit",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"diff = a[i] - low",
"a[i] - low",
"diff",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"profit = x",
"x",
"profit",
"ans = 0",
"0",
"ans",
"ans += 1",
"1",
"ans"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
profit = -1
low = a[0]
for i in range(n):
if a[i] < low:
low = a[i]
x = 0 if low > a[i] else a[i] - low
if profit < x:
profit = x
ans = 0
low = a[0]
for i in range(n):
diff = a[i] - low
if diff == profit:
ans += 1
if a[i] < low:
low = a[i]
print(ans)
|
[
7,
15,
13,
15,
41,
28,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
41,
28,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
39,
28,
13,
18,
13,
39,
17,
0,
13,
4,
13,
13,
13,
4,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
4,
13,
18,
13,
4,
13,
13,
10,
13,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13
] |
[
[
7,
6
],
[
6,
19
],
[
93,
21
],
[
93,
23
],
[
27,
26
],
[
26,
39
],
[
87,
41
],
[
96,
44
],
[
84,
47
],
[
51,
50
],
[
88,
52
],
[
99,
56
],
[
50,
59
],
[
97,
60
],
[
100,
60
],
[
85,
63
],
[
100,
66
],
[
97,
66
],
[
50,
67
],
[
90,
69
],
[
85,
72
],
[
91,
76
],
[
85,
79
],
[
93,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
]
] |
[
"import sys\nfrom collections import Counter\nn,t = [int(i) for i in sys.stdin.readline().split()]\na_ls = [int(i) for i in sys.stdin.readline().split()]\n_max = 0\nres = []\nfor a in a_ls[::-1]:\n _max = max(a, _max)\n res.append(_max - a)\nct = Counter(res)\nprint(ct[max(res)])",
"import sys",
"sys",
"from collections import Counter",
"int(i) for i in sys.stdin.readline().split()",
"for i in sys.stdin.readline().split()",
"i",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"for i in sys.stdin.readline().split()",
"int(i)",
"int",
"i",
"n,t = [int(i) for i in sys.stdin.readline().split()]",
"n",
"[int(i) for i in sys.stdin.readline().split()]",
"t",
"int(i) for i in sys.stdin.readline().split()",
"for i in sys.stdin.readline().split()",
"i",
"sys.stdin.readline().split()",
"sys.stdin.readline().split",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"split",
"for i in sys.stdin.readline().split()",
"int(i)",
"int",
"i",
"a_ls = [int(i) for i in sys.stdin.readline().split()]",
"a_ls",
"[int(i) for i in sys.stdin.readline().split()]",
"_max = 0",
"_max",
"0",
"res = []",
"res",
"[]",
"for a in a_ls[::-1]:\n _max = max(a, _max)\n res.append(_max - a)",
"a",
"a_ls[::-1]",
"a_ls",
"::-1",
"-1",
"_max = max(a, _max)",
"_max",
"max(a, _max)",
"max",
"a",
"_max",
"res.append(_max - a)",
"res.append",
"res",
"append",
"_max - a",
"_max",
"a",
"ct = Counter(res)",
"ct",
"Counter(res)",
"Counter",
"res",
"print(ct[max(res)])",
"print",
"ct[max(res)]",
"ct",
"max(res)",
"max",
"res",
"n,t = [int(i) for i in sys.stdin.readline().split()]",
"[int(i) for i in sys.stdin.readline().split()]",
"n",
"res = []",
"[]",
"res",
"a_ls = [int(i) for i in sys.stdin.readline().split()]",
"[int(i) for i in sys.stdin.readline().split()]",
"a_ls",
"ct = Counter(res)",
"Counter(res)",
"ct",
"t = [int(i) for i in sys.stdin.readline().split()]",
"[int(i) for i in sys.stdin.readline().split()]",
"t",
"_max = 0",
"0",
"_max",
"_max = max(a, _max)",
"max(a, _max)",
"_max"
] |
import sys
from collections import Counter
n,t = [int(i) for i in sys.stdin.readline().split()]
a_ls = [int(i) for i in sys.stdin.readline().split()]
_max = 0
res = []
for a in a_ls[::-1]:
_max = max(a, _max)
res.append(_max - a)
ct = Counter(res)
print(ct[max(res)])
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
2,
17,
13,
4,
13,
18,
13,
40,
13,
18,
13,
40,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
4,
18,
13,
13,
18,
13,
17,
4,
13,
13,
4,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
113,
4
],
[
20,
19
],
[
27,
26
],
[
120,
28
],
[
27,
29
],
[
32,
31
],
[
126,
33
],
[
36,
35
],
[
26,
39
],
[
44,
41
],
[
35,
42
],
[
31,
45
],
[
49,
48
],
[
26,
52
],
[
59,
54
],
[
35,
55
],
[
48,
58
],
[
35,
62
],
[
48,
64
],
[
31,
66
],
[
48,
68
],
[
71,
70
],
[
26,
74
],
[
77,
76
],
[
26,
79
],
[
84,
81
],
[
70,
82
],
[
76,
83
],
[
35,
86
],
[
76,
87
],
[
31,
89
],
[
76,
90
],
[
70,
93
],
[
97,
96
],
[
100,
99
],
[
70,
102
],
[
70,
105
],
[
99,
109
],
[
117,
111
],
[
113,
114
]
] |
[
"import sys\ninput = sys.stdin.readline\n\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(map(int, input().split()))\n\ndef main():\n mod=10**9+7\n N,T=MI()\n A=LI()\n M=[0]*N#自分以降の最大値\n M[-1]=A[-1]\n for i in range(1,N):\n M[-1-i]=max(M[-i],A[-i])\n \n diff=[0]*N\n for i in range(N):\n diff[i]=M[i]-A[i]\n \n diff.sort(reverse = True)\n ans=diff.count(diff[0])\n print(ans)\n\nmain()",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def I(): return int(input())",
"I",
"def MI(): return map(int, input().split())",
"MI",
"def LI(): return list(map(int, input().split()))",
"LI",
"def main():\n mod=10**9+7\n N,T=MI()\n A=LI()\n M=[0]*N#自分以降の最大値\n M[-1]=A[-1]\n for i in range(1,N):\n M[-1-i]=max(M[-i],A[-i])\n \n diff=[0]*N\n for i in range(N):\n diff[i]=M[i]-A[i]\n \n diff.sort(reverse = True)\n ans=diff.count(diff[0])\n print(ans)",
"main",
"mod=10**9+7",
"mod",
"10**9+7",
"10**9",
"10",
"9",
"7",
"N,T=MI()",
"N",
"MI()",
"MI",
"T",
"A=LI()",
"A",
"LI()",
"LI",
"M=[0]*N",
"M",
"[0]*N",
"[0]",
"0",
"N",
"M[-1]=A[-1]",
"M[-1]",
"M",
"-1",
"A[-1]",
"A",
"-1",
"for i in range(1,N):\n M[-1-i]=max(M[-i],A[-i])\n \n ",
"i",
"range(1,N)",
"range",
"1",
"N",
"M[-1-i]=max(M[-i],A[-i])",
"M[-1-i]",
"M",
"-1-i",
"-1",
"i",
"max(M[-i],A[-i])",
"max",
"M[-i]",
"M",
"-i",
"i",
"A[-i]",
"A",
"-i",
"i",
"diff=[0]*N",
"diff",
"[0]*N",
"[0]",
"0",
"N",
"for i in range(N):\n diff[i]=M[i]-A[i]\n \n ",
"i",
"range(N)",
"range",
"N",
"diff[i]=M[i]-A[i]",
"diff[i]",
"diff",
"i",
"M[i]-A[i]",
"M[i]",
"M",
"i",
"A[i]",
"A",
"i",
"diff.sort(reverse = True)",
"diff.sort",
"diff",
"sort",
"reverse = True",
"reverse",
"True",
"ans=diff.count(diff[0])",
"ans",
"diff.count(diff[0])",
"diff.count",
"diff",
"count",
"diff[0]",
"diff",
"0",
"print(ans)",
"print",
"ans",
"main()",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def main():\n mod=10**9+7\n N,T=MI()\n A=LI()\n M=[0]*N#自分以降の最大値\n M[-1]=A[-1]\n for i in range(1,N):\n M[-1-i]=max(M[-i],A[-i])\n \n diff=[0]*N\n for i in range(N):\n diff[i]=M[i]-A[i]\n \n diff.sort(reverse = True)\n ans=diff.count(diff[0])\n print(ans)",
"def main():\n mod=10**9+7\n N,T=MI()\n A=LI()\n M=[0]*N#自分以降の最大値\n M[-1]=A[-1]\n for i in range(1,N):\n M[-1-i]=max(M[-i],A[-i])\n \n diff=[0]*N\n for i in range(N):\n diff[i]=M[i]-A[i]\n \n diff.sort(reverse = True)\n ans=diff.count(diff[0])\n print(ans)",
"main",
"def MI(): return map(int, input().split())",
"def MI(): return map(int, input().split())",
"MI",
"def I(): return int(input())",
"def I(): return int(input())",
"I",
"def LI(): return list(map(int, input().split()))",
"def LI(): return list(map(int, input().split()))",
"LI"
] |
import sys
input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,T=MI()
A=LI()
M=[0]*N#自分以降の最大値
M[-1]=A[-1]
for i in range(1,N):
M[-1-i]=max(M[-i],A[-i])
diff=[0]*N
for i in range(N):
diff[i]=M[i]-A[i]
diff.sort(reverse = True)
ans=diff.count(diff[0])
print(ans)
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
9,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13
] |
[
[
107,
2
],
[
107,
11
],
[
110,
13
],
[
89,
25
],
[
89,
28
],
[
86,
31
],
[
111,
33
],
[
37,
36
],
[
96,
39
],
[
111,
43
],
[
36,
44
],
[
87,
45
],
[
99,
45
],
[
98,
47
],
[
111,
49
],
[
36,
50
],
[
101,
53
],
[
111,
56
],
[
36,
57
],
[
99,
58
],
[
87,
58
],
[
84,
61
],
[
105,
61
],
[
102,
62
],
[
104,
64
],
[
102,
65
],
[
92,
67
],
[
84,
71
],
[
105,
71
],
[
102,
72
],
[
80,
74
],
[
81,
78
],
[
93,
78
],
[
90,
78
],
[
80,
81
],
[
89,
84
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
107,
96
],
[
98,
99
],
[
101,
102
],
[
102,
104
],
[
104,
105
],
[
107,
108
],
[
110,
111
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\nb=c=0\nm=a[0]\nfor i in range(n):\n if a[i]<m:\n m=a[i]\n continue\n \n d=a[i]-m\n if b<d:\n b=d\n c=1\n elif b==d:\n c+=1\nprint(c)",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b=c=0",
"b",
"0",
"=c=0",
"c",
"0",
"m=a[0]",
"m",
"a[0]",
"a",
"0",
"for i in range(n):\n if a[i]<m:\n m=a[i]\n continue\n \n d=a[i]-m\n if b<d:\n b=d\n c=1\n elif b==d:\n c+=1",
"i",
"range(n)",
"range",
"n",
"if a[i]<m:\n m=a[i]\n continue\n \n ",
"a[i]<m",
"a[i]",
"a",
"i",
"m",
"m=a[i]",
"m",
"a[i]",
"a",
"i",
"continue",
"d=a[i]-m",
"d",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"if b<d:\n b=d\n c=1\n elif b==d:\n c+=1",
"b<d",
"b",
"d",
"b=d",
"b",
"d",
"c=1",
"c",
"1",
"elif b==d:\n c+=1",
"b==d",
"b",
"d",
"c+=1",
"c",
"1",
"print(c)",
"print",
"c",
"c+=1",
"1",
"c",
"b=c=0",
"0",
"b",
"m=a[0]",
"a[0]",
"m",
"c=0",
"0",
"c",
"c=1",
"1",
"c",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"m=a[i]",
"a[i]",
"m",
"d=a[i]-m",
"a[i]-m",
"d",
"b=d",
"d",
"b",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
b=c=0
m=a[0]
for i in range(n):
if a[i]<m:
m=a[i]
continue
d=a[i]-m
if b<d:
b=d
c=1
elif b==d:
c+=1
print(c)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
17,
4,
13,
2,
13,
17,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
4,
13
] |
[
[
135,
2
],
[
135,
11
],
[
111,
13
],
[
105,
25
],
[
126,
30
],
[
123,
33
],
[
117,
36
],
[
40,
39
],
[
136,
42
],
[
112,
46
],
[
39,
47
],
[
106,
48
],
[
121,
48
],
[
120,
50
],
[
112,
52
],
[
39,
53
],
[
99,
55
],
[
112,
60
],
[
39,
61
],
[
100,
62
],
[
127,
62
],
[
130,
62
],
[
129,
64
],
[
112,
66
],
[
39,
67
],
[
130,
71
],
[
100,
71
],
[
127,
71
],
[
121,
72
],
[
106,
72
],
[
124,
73
],
[
133,
73
],
[
132,
75
],
[
130,
77
],
[
100,
77
],
[
127,
77
],
[
121,
78
],
[
106,
78
],
[
114,
80
],
[
130,
85
],
[
100,
85
],
[
127,
85
],
[
121,
86
],
[
106,
86
],
[
124,
87
],
[
133,
87
],
[
108,
89
],
[
118,
91
],
[
109,
91
],
[
115,
91
],
[
109,
96
],
[
115,
96
],
[
118,
96
],
[
99,
100
],
[
135,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
]
] |
[
"n,t=map(int,input().split())\nA=list(map(int,input().split()))\na=10**10\nb=0\nc=0\nans=0\nfor i in range(n):\n if A[i]<a:\n a=A[i]\n b=0\n if A[i]>b:\n b=A[i]\n if b-a>c:\n c=b-a\n ans=0\n elif b-a==c:\n ans=ans+1\nprint(ans+1)",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"A=list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a=10**10",
"a",
"10**10",
"10",
"10",
"b=0",
"b",
"0",
"c=0",
"c",
"0",
"ans=0",
"ans",
"0",
"for i in range(n):\n if A[i]<a:\n a=A[i]\n b=0\n if A[i]>b:\n b=A[i]\n if b-a>c:\n c=b-a\n ans=0\n elif b-a==c:\n ans=ans+1",
"i",
"range(n)",
"range",
"n",
"if A[i]<a:\n a=A[i]\n b=0\n ",
"A[i]<a",
"A[i]",
"A",
"i",
"a",
"a=A[i]",
"a",
"A[i]",
"A",
"i",
"b=0",
"b",
"0",
"if A[i]>b:\n b=A[i]\n if b-a>c:\n c=b-a\n ans=0\n elif b-a==c:\n ans=ans+1",
"A[i]>b",
"A[i]",
"A",
"i",
"b",
"b=A[i]",
"b",
"A[i]",
"A",
"i",
"if b-a>c:\n c=b-a\n ans=0\n elif b-a==c:\n ans=ans+1",
"b-a>c",
"b-a",
"b",
"a",
"c",
"c=b-a",
"c",
"b-a",
"b",
"a",
"ans=0",
"ans",
"0",
"elif b-a==c:\n ans=ans+1",
"b-a==c",
"b-a",
"b",
"a",
"c",
"ans=ans+1",
"ans",
"ans+1",
"ans",
"1",
"print(ans+1)",
"print",
"ans+1",
"ans",
"1",
"b=0",
"0",
"b",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"a=10**10",
"10**10",
"a",
"ans=ans+1",
"ans+1",
"ans",
"A=list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"ans=0",
"0",
"ans",
"ans=0",
"0",
"ans",
"a=A[i]",
"A[i]",
"a",
"c=0",
"0",
"c",
"b=0",
"0",
"b",
"b=A[i]",
"A[i]",
"b",
"c=b-a",
"b-a",
"c",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n"
] |
n,t=map(int,input().split())
A=list(map(int,input().split()))
a=10**10
b=0
c=0
ans=0
for i in range(n):
if A[i]<a:
a=A[i]
b=0
if A[i]>b:
b=A[i]
if b-a>c:
c=b-a
ans=0
elif b-a==c:
ans=ans+1
print(ans+1)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
4,
13,
13,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
75,
2
],
[
75,
11
],
[
60,
13
],
[
69,
23
],
[
66,
26
],
[
61,
29
],
[
32,
31
],
[
61,
31
],
[
31,
35
],
[
67,
36
],
[
79,
36
],
[
78,
38
],
[
31,
39
],
[
70,
42
],
[
31,
45
],
[
67,
46
],
[
79,
46
],
[
72,
48
],
[
70,
51
],
[
70,
56
],
[
73,
58
],
[
60,
61
],
[
75,
64
],
[
66,
67
],
[
69,
70
],
[
72,
73
],
[
75,
76
],
[
31,
78
],
[
78,
79
]
] |
[
"N, T = map(int, input().split())\nprices = map(int, input().split())\n\n\nprofit_memo = []\nmin_price = next(prices)\n\nfor price in prices:\n if price < min_price:\n min_price = price\n else:\n profit_memo.append(price - min_price)\n\nmax_profit = max(profit_memo)\nprint(profit_memo.count(max_profit))",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"prices = map(int, input().split())",
"prices",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"profit_memo = []",
"profit_memo",
"[]",
"min_price = next(prices)",
"min_price",
"next(prices)",
"next",
"prices",
"for price in prices:\n if price < min_price:\n min_price = price\n else:\n profit_memo.append(price - min_price)",
"price",
"prices",
"if price < min_price:\n min_price = price\n else:\n profit_memo.append(price - min_price)",
"price < min_price",
"price",
"min_price",
"min_price = price",
"min_price",
"price",
"profit_memo.append(price - min_price)",
"profit_memo.append",
"profit_memo",
"append",
"price - min_price",
"price",
"min_price",
"max_profit = max(profit_memo)",
"max_profit",
"max(profit_memo)",
"max",
"profit_memo",
"print(profit_memo.count(max_profit))",
"print",
"profit_memo.count(max_profit)",
"profit_memo.count",
"profit_memo",
"count",
"max_profit",
"prices = map(int, input().split())",
"map(int, input().split())",
"prices",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"min_price = next(prices)",
"next(prices)",
"min_price",
"profit_memo = []",
"[]",
"profit_memo",
"max_profit = max(profit_memo)",
"max(profit_memo)",
"max_profit",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"min_price = price",
"price",
"min_price"
] |
N, T = map(int, input().split())
prices = map(int, input().split())
profit_memo = []
min_price = next(prices)
for price in prices:
if price < min_price:
min_price = price
else:
profit_memo.append(price - min_price)
max_profit = max(profit_memo)
print(profit_memo.count(max_profit))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
13,
18,
13,
17,
28,
13,
13,
4,
13,
18,
13,
39,
17,
17,
0,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] |
[
[
89,
2
],
[
89,
11
],
[
95,
13
],
[
92,
25
],
[
84,
29
],
[
86,
31
],
[
96,
33
],
[
96,
41
],
[
49,
46
],
[
93,
47
],
[
87,
51
],
[
78,
51
],
[
77,
53
],
[
87,
56
],
[
78,
56
],
[
74,
59
],
[
93,
62
],
[
80,
64
],
[
93,
67
],
[
75,
69
],
[
81,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
89,
84
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\n\nprofit = [0] * n\nbuy_mn = a[0]\nfor i, e in enumerate(a[1:], 1):\n profit[i] = e - buy_mn\n buy_mn = min(buy_mn, e)\n\nprofit_mx = max(profit)\nans = profit.count(profit_mx)\nprint(ans)",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"profit = [0] * n",
"profit",
"[0] * n",
"[0]",
"0",
"n",
"buy_mn = a[0]",
"buy_mn",
"a[0]",
"a",
"0",
"for i, e in enumerate(a[1:], 1):\n profit[i] = e - buy_mn\n buy_mn = min(buy_mn, e)",
"i",
"e",
"enumerate(a[1:], 1)",
"enumerate",
"a[1:]",
"a",
"1:",
"1",
"1",
"profit[i] = e - buy_mn",
"profit[i]",
"profit",
"i",
"e - buy_mn",
"e",
"buy_mn",
"buy_mn = min(buy_mn, e)",
"buy_mn",
"min(buy_mn, e)",
"min",
"buy_mn",
"e",
"profit_mx = max(profit)",
"profit_mx",
"max(profit)",
"max",
"profit",
"ans = profit.count(profit_mx)",
"ans",
"profit.count(profit_mx)",
"profit.count",
"profit",
"count",
"profit_mx",
"print(ans)",
"print",
"ans",
"profit_mx = max(profit)",
"max(profit)",
"profit_mx",
"buy_mn = min(buy_mn, e)",
"min(buy_mn, e)",
"buy_mn",
"ans = profit.count(profit_mx)",
"profit.count(profit_mx)",
"ans",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"buy_mn = a[0]",
"a[0]",
"buy_mn",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"profit = [0] * n",
"[0] * n",
"profit",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
profit = [0] * n
buy_mn = a[0]
for i, e in enumerate(a[1:], 1):
profit[i] = e - buy_mn
buy_mn = min(buy_mn, e)
profit_mx = max(profit)
ans = profit.count(profit_mx)
print(ans)
|
[
7,
12,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
17,
0,
13,
2,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
7,
6
],
[
14,
13
],
[
14,
22
],
[
25,
24
],
[
6,
33
],
[
37,
36
],
[
42,
41
],
[
45,
44
],
[
48,
47
],
[
24,
47
],
[
47,
52
],
[
36,
53
],
[
77,
53
],
[
44,
54
],
[
59,
54
],
[
57,
56
],
[
60,
59
],
[
47,
61
],
[
36,
62
],
[
77,
62
],
[
47,
66
],
[
36,
67
],
[
77,
67
],
[
44,
68
],
[
59,
68
],
[
71,
70
],
[
47,
74
],
[
36,
75
],
[
77,
75
],
[
78,
77
],
[
47,
78
],
[
70,
81
],
[
56,
81
],
[
41,
81
],
[
90,
87
]
] |
[
"def main():\n import sys\n readline = sys.stdin.readline\n # readlines = sys.stdin.readlines\n N, T = map(int, input().split())\n A = list(map(int, readline().split()))\n\n L = float('inf')\n cnt = 0\n profit = 0\n for a in A:\n if a - L > profit:\n cnt = 1\n profit = a - L\n elif a - L == profit:\n cnt += 1\n \n if a < L:\n L = a\n \n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()",
"def main():\n import sys\n readline = sys.stdin.readline\n # readlines = sys.stdin.readlines\n N, T = map(int, input().split())\n A = list(map(int, readline().split()))\n\n L = float('inf')\n cnt = 0\n profit = 0\n for a in A:\n if a - L > profit:\n cnt = 1\n profit = a - L\n elif a - L == profit:\n cnt += 1\n \n if a < L:\n L = a\n \n print(cnt)",
"main",
"import sys",
"sys",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, readline().split()))",
"A",
"list(map(int, readline().split()))",
"list",
"map(int, readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"L = float('inf')",
"L",
"float('inf')",
"float",
"'inf'",
"cnt = 0",
"cnt",
"0",
"profit = 0",
"profit",
"0",
"for a in A:\n if a - L > profit:\n cnt = 1\n profit = a - L\n elif a - L == profit:\n cnt += 1\n \n if a < L:\n L = a\n \n ",
"a",
"A",
"if a - L > profit:\n cnt = 1\n profit = a - L\n elif a - L == profit:\n cnt += 1\n \n ",
"a - L > profit",
"a - L",
"a",
"L",
"profit",
"cnt = 1",
"cnt",
"1",
"profit = a - L",
"profit",
"a - L",
"a",
"L",
"elif a - L == profit:\n cnt += 1\n \n ",
"a - L == profit",
"a - L",
"a",
"L",
"profit",
"cnt += 1",
"cnt",
"1",
"if a < L:\n L = a\n \n ",
"a < L",
"a",
"L",
"L = a",
"L",
"a",
"print(cnt)",
"print",
"cnt",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n import sys\n readline = sys.stdin.readline\n # readlines = sys.stdin.readlines\n N, T = map(int, input().split())\n A = list(map(int, readline().split()))\n\n L = float('inf')\n cnt = 0\n profit = 0\n for a in A:\n if a - L > profit:\n cnt = 1\n profit = a - L\n elif a - L == profit:\n cnt += 1\n \n if a < L:\n L = a\n \n print(cnt)",
"def main():\n import sys\n readline = sys.stdin.readline\n # readlines = sys.stdin.readlines\n N, T = map(int, input().split())\n A = list(map(int, readline().split()))\n\n L = float('inf')\n cnt = 0\n profit = 0\n for a in A:\n if a - L > profit:\n cnt = 1\n profit = a - L\n elif a - L == profit:\n cnt += 1\n \n if a < L:\n L = a\n \n print(cnt)",
"main"
] |
def main():
import sys
readline = sys.stdin.readline
# readlines = sys.stdin.readlines
N, T = map(int, input().split())
A = list(map(int, readline().split()))
L = float('inf')
cnt = 0
profit = 0
for a in A:
if a - L > profit:
cnt = 1
profit = a - L
elif a - L == profit:
cnt += 1
if a < L:
L = a
print(cnt)
if __name__ == "__main__":
main()
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
13,
2,
18,
13,
13,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
18,
13,
2,
13,
17,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13
] |
[
[
136,
4
],
[
121,
11
],
[
137,
18
],
[
121,
20
],
[
133,
22
],
[
137,
31
],
[
112,
34
],
[
134,
36
],
[
124,
39
],
[
43,
42
],
[
110,
46
],
[
127,
48
],
[
113,
51
],
[
128,
51
],
[
134,
53
],
[
42,
55
],
[
106,
58
],
[
125,
61
],
[
107,
61
],
[
134,
64
],
[
42,
65
],
[
128,
66
],
[
113,
66
],
[
139,
68
],
[
134,
70
],
[
118,
73
],
[
77,
76
],
[
110,
80
],
[
115,
82
],
[
140,
85
],
[
128,
85
],
[
113,
85
],
[
116,
85
],
[
134,
87
],
[
76,
89
],
[
134,
95
],
[
76,
96
],
[
116,
97
],
[
140,
97
],
[
128,
97
],
[
113,
97
],
[
107,
98
],
[
125,
98
],
[
130,
100
],
[
131,
104
],
[
119,
104
],
[
106,
107
],
[
121,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
]
] |
[
"import sys\ninput = sys.stdin.readline\nn,t=map(int,input().split())\na=list(map(int,input().split()))\nm=a[0]\nM=0\nfor i in range(1,n):\n m=min(m,a[i-1])\n M=max(M,a[i]-m)\nm=a[0]\nans=0\nfor i in range(1,n):\n m=min(m,a[i-1])\n if a[i]-m==M:\n ans+=1\nprint(ans)",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"m=a[0]",
"m",
"a[0]",
"a",
"0",
"M=0",
"M",
"0",
"for i in range(1,n):\n m=min(m,a[i-1])\n M=max(M,a[i]-m)",
"i",
"range(1,n)",
"range",
"1",
"n",
"m=min(m,a[i-1])",
"m",
"min(m,a[i-1])",
"min",
"m",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"M=max(M,a[i]-m)",
"M",
"max(M,a[i]-m)",
"max",
"M",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"m=a[0]",
"m",
"a[0]",
"a",
"0",
"ans=0",
"ans",
"0",
"for i in range(1,n):\n m=min(m,a[i-1])\n if a[i]-m==M:\n ans+=1",
"i",
"range(1,n)",
"range",
"1",
"n",
"m=min(m,a[i-1])",
"m",
"min(m,a[i-1])",
"min",
"m",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"if a[i]-m==M:\n ans+=1",
"a[i]-m==M",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"M",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"M=max(M,a[i]-m)",
"max(M,a[i]-m)",
"M",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"m=a[0]",
"a[0]",
"m",
"m=min(m,a[i-1])",
"min(m,a[i-1])",
"m",
"ans=0",
"0",
"ans",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"M=0",
"0",
"M",
"m=min(m,a[i-1])",
"min(m,a[i-1])",
"m",
"ans+=1",
"1",
"ans",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"m=a[0]",
"a[0]",
"m"
] |
import sys
input = sys.stdin.readline
n,t=map(int,input().split())
a=list(map(int,input().split()))
m=a[0]
M=0
for i in range(1,n):
m=min(m,a[i-1])
M=max(M,a[i]-m)
m=a[0]
ans=0
for i in range(1,n):
m=min(m,a[i-1])
if a[i]-m==M:
ans+=1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
0,
13,
39,
0,
13,
18,
13,
17,
28,
13,
13,
14,
2,
13,
13,
4,
18,
13,
13,
2,
13,
13,
4,
18,
13,
13,
17,
0,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13
] |
[
[
81,
2
],
[
81,
12
],
[
75,
14
],
[
87,
27
],
[
69,
30
],
[
76,
32
],
[
36,
35
],
[
76,
35
],
[
70,
39
],
[
85,
39
],
[
35,
40
],
[
88,
43
],
[
35,
46
],
[
70,
47
],
[
85,
47
],
[
88,
50
],
[
84,
54
],
[
35,
55
],
[
72,
57
],
[
88,
60
],
[
88,
65
],
[
73,
67
],
[
69,
70
],
[
72,
73
],
[
75,
76
],
[
81,
79
],
[
81,
82
],
[
35,
84
],
[
84,
85
],
[
87,
88
]
] |
[
"n, t = map(int, input().split(\" \"))\nlist_a = list(map(int, input().split(\" \")))\nlist_profit = []\nmin_price = list_a[0]\nfor a in list_a:\n if min_price < a:\n list_profit.append(a - min_price)\n else:\n list_profit.append(0)\n min_price = a\nmax_profit = max(list_profit)\nprint(list_profit.count(max_profit))",
"n, t = map(int, input().split(\" \"))",
"n",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"t",
"list_a = list(map(int, input().split(\" \")))",
"list_a",
"list(map(int, input().split(\" \")))",
"list",
"map(int, input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"list_profit = []",
"list_profit",
"[]",
"min_price = list_a[0]",
"min_price",
"list_a[0]",
"list_a",
"0",
"for a in list_a:\n if min_price < a:\n list_profit.append(a - min_price)\n else:\n list_profit.append(0)\n min_price = a",
"a",
"list_a",
"if min_price < a:\n list_profit.append(a - min_price)\n else:\n list_profit.append(0)\n min_price = a",
"min_price < a",
"min_price",
"a",
"list_profit.append(a - min_price)",
"list_profit.append",
"list_profit",
"append",
"a - min_price",
"a",
"min_price",
"list_profit.append(0)",
"list_profit.append",
"list_profit",
"append",
"0",
"min_price = a",
"min_price",
"a",
"max_profit = max(list_profit)",
"max_profit",
"max(list_profit)",
"max",
"list_profit",
"print(list_profit.count(max_profit))",
"print",
"list_profit.count(max_profit)",
"list_profit.count",
"list_profit",
"count",
"max_profit",
"min_price = list_a[0]",
"list_a[0]",
"min_price",
"max_profit = max(list_profit)",
"max(list_profit)",
"max_profit",
"list_a = list(map(int, input().split(\" \")))",
"list(map(int, input().split(\" \")))",
"list_a",
"n, t = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"n",
"t = map(int, input().split(\" \"))",
"map(int, input().split(\" \"))",
"t",
"min_price = a",
"a",
"min_price",
"list_profit = []",
"[]",
"list_profit"
] |
n, t = map(int, input().split(" "))
list_a = list(map(int, input().split(" ")))
list_profit = []
min_price = list_a[0]
for a in list_a:
if min_price < a:
list_profit.append(a - min_price)
else:
list_profit.append(0)
min_price = a
max_profit = max(list_profit)
print(list_profit.count(max_profit))
|
[
7,
15,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
9,
0,
13,
2,
18,
13,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
13,
13,
4,
13,
18,
13,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
18,
13,
10,
18,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13
] |
[
[
5,
4
],
[
4,
13
],
[
107,
15
],
[
107,
17
],
[
21,
20
],
[
20,
29
],
[
92,
31
],
[
113,
34
],
[
101,
39
],
[
93,
41
],
[
89,
44
],
[
48,
47
],
[
108,
51
],
[
93,
55
],
[
47,
56
],
[
102,
57
],
[
105,
57
],
[
104,
59
],
[
93,
61
],
[
47,
62
],
[
110,
65
],
[
93,
68
],
[
47,
69
],
[
105,
70
],
[
102,
70
],
[
111,
73
],
[
90,
74
],
[
96,
74
],
[
79,
76
],
[
114,
77
],
[
111,
78
],
[
95,
81
],
[
111,
82
],
[
114,
86
],
[
96,
87
],
[
90,
87
],
[
89,
90
],
[
92,
93
],
[
111,
95
],
[
95,
96
],
[
107,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
]
] |
[
"from collections import defaultdict\nn, t = [int(x) for x in input().split()]\na_list = [int(x) for x in input().split()]\nd = defaultdict(int)\na_min = a_list[0]\np_max = 0\nfor i in range(1, n):\n if a_list[i] < a_min:\n a_min = a_list[i]\n continue\n p = a_list[i] - a_min\n if p >= p_max:\n d[p] += 1\n p_max = p\nprint(d[p_max])",
"from collections import defaultdict",
"int(x) for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)",
"int",
"x",
"n, t = [int(x) for x in input().split()]",
"n",
"[int(x) for x in input().split()]",
"t",
"int(x) for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)",
"int",
"x",
"a_list = [int(x) for x in input().split()]",
"a_list",
"[int(x) for x in input().split()]",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"a_min = a_list[0]",
"a_min",
"a_list[0]",
"a_list",
"0",
"p_max = 0",
"p_max",
"0",
"for i in range(1, n):\n if a_list[i] < a_min:\n a_min = a_list[i]\n continue\n p = a_list[i] - a_min\n if p >= p_max:\n d[p] += 1\n p_max = p",
"i",
"range(1, n)",
"range",
"1",
"n",
"if a_list[i] < a_min:\n a_min = a_list[i]\n continue\n ",
"a_list[i] < a_min",
"a_list[i]",
"a_list",
"i",
"a_min",
"a_min = a_list[i]",
"a_min",
"a_list[i]",
"a_list",
"i",
"continue",
"p = a_list[i] - a_min",
"p",
"a_list[i] - a_min",
"a_list[i]",
"a_list",
"i",
"a_min",
"if p >= p_max:\n d[p] += 1\n p_max = p",
"p >= p_max",
"p",
"p_max",
"d[p] += 1",
"d[p]",
"d",
"p",
"1",
"p_max = p",
"p_max",
"p",
"print(d[p_max])",
"print",
"d[p_max]",
"d",
"p_max",
"p_max = 0",
"0",
"p_max",
"a_list = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"a_list",
"p_max = p",
"p",
"p_max",
"t = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"t",
"a_min = a_list[0]",
"a_list[0]",
"a_min",
"a_min = a_list[i]",
"a_list[i]",
"a_min",
"n, t = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"n",
"p = a_list[i] - a_min",
"a_list[i] - a_min",
"p",
"d = defaultdict(int)",
"defaultdict(int)",
"d"
] |
from collections import defaultdict
n, t = [int(x) for x in input().split()]
a_list = [int(x) for x in input().split()]
d = defaultdict(int)
a_min = a_list[0]
p_max = 0
for i in range(1, n):
if a_list[i] < a_min:
a_min = a_list[i]
continue
p = a_list[i] - a_min
if p >= p_max:
d[p] += 1
p_max = p
print(d[p_max])
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
0,
13,
2,
39,
17,
13,
0,
18,
13,
2,
13,
17,
18,
13,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
2,
13,
13,
17,
4,
13,
18,
13,
2,
2,
13,
13,
17,
18,
13,
2,
2,
13,
17,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
13,
4,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13
] |
[
[
171,
2
],
[
171,
11
],
[
177,
13
],
[
168,
25
],
[
180,
30
],
[
163,
34
],
[
39,
36
],
[
181,
37
],
[
178,
40
],
[
165,
43
],
[
163,
47
],
[
54,
49
],
[
166,
50
],
[
163,
52
],
[
178,
55
],
[
163,
57
],
[
61,
60
],
[
163,
64
],
[
72,
67
],
[
181,
68
],
[
60,
70
],
[
181,
75
],
[
60,
76
],
[
178,
78
],
[
60,
80
],
[
90,
83
],
[
166,
84
],
[
163,
87
],
[
60,
88
],
[
166,
93
],
[
163,
96
],
[
60,
97
],
[
178,
100
],
[
163,
103
],
[
60,
105
],
[
109,
108
],
[
163,
112
],
[
166,
117
],
[
108,
119
],
[
181,
122
],
[
108,
123
],
[
174,
125
],
[
159,
128
],
[
175,
131
],
[
183,
133
],
[
178,
140
],
[
181,
146
],
[
160,
148
],
[
156,
150
],
[
157,
154
],
[
184,
154
],
[
156,
157
],
[
159,
160
],
[
171,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
]
] |
[
"n,t = map(int,input().split())\nA = list(map(int,input().split()))\ninf = float('inf')\nm = [0]*n\nm[0] = A[0]\nM = [0]*n\nM[n-1] = A[n-1]\nfor i in range(n-1):\n m[i+1] = min(m[i],A[i+1])\n M[n-i-2] = max(M[n-i-1],A[n-2-i])\n\ndelta = [M[i+1] - m[i] for i in range(n-1)]\ncan = max(delta)\nans = 0\nfor i,a in enumerate(A):\n if a == m[i] + can:\n ans += 1\nprint(ans)",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"A = list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"inf = float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"m = [0]*n",
"m",
"[0]*n",
"[0]",
"0",
"n",
"m[0] = A[0]",
"m[0]",
"m",
"0",
"A[0]",
"A",
"0",
"M = [0]*n",
"M",
"[0]*n",
"[0]",
"0",
"n",
"M[n-1] = A[n-1]",
"M[n-1]",
"M",
"n-1",
"n",
"1",
"A[n-1]",
"A",
"n-1",
"n",
"1",
"for i in range(n-1):\n m[i+1] = min(m[i],A[i+1])\n M[n-i-2] = max(M[n-i-1],A[n-2-i])",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"m[i+1] = min(m[i],A[i+1])",
"m[i+1]",
"m",
"i+1",
"i",
"1",
"min(m[i],A[i+1])",
"min",
"m[i]",
"m",
"i",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"M[n-i-2] = max(M[n-i-1],A[n-2-i])",
"M[n-i-2]",
"M",
"n-i-2",
"n-i",
"n",
"i",
"2",
"max(M[n-i-1],A[n-2-i])",
"max",
"M[n-i-1]",
"M",
"n-i-1",
"n-i",
"n",
"i",
"1",
"A[n-2-i]",
"A",
"n-2-i",
"n-2",
"n",
"2",
"i",
"M[i+1] - m[i] for i in range(n-1)",
"for i in range(n-1)",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"for i in range(n-1)",
"M[i+1] - m[i]",
"M[i+1]",
"M",
"i+1",
"i",
"1",
"m[i]",
"m",
"i",
"delta = [M[i+1] - m[i] for i in range(n-1)]",
"delta",
"[M[i+1] - m[i] for i in range(n-1)]",
"can = max(delta)",
"can",
"max(delta)",
"max",
"delta",
"ans = 0",
"ans",
"0",
"for i,a in enumerate(A):\n if a == m[i] + can:\n ans += 1",
"i",
"a",
"enumerate(A)",
"enumerate",
"A",
"if a == m[i] + can:\n ans += 1",
"a == m[i] + can",
"a",
"m[i] + can",
"m[i]",
"m",
"i",
"can",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"can = max(delta)",
"max(delta)",
"can",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"M = [0]*n",
"[0]*n",
"M",
"inf = float('inf')",
"float('inf')",
"inf",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"delta = [M[i+1] - m[i] for i in range(n-1)]",
"[M[i+1] - m[i] for i in range(n-1)]",
"delta",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"m = [0]*n",
"[0]*n",
"m",
"ans = 0",
"0",
"ans"
] |
n,t = map(int,input().split())
A = list(map(int,input().split()))
inf = float('inf')
m = [0]*n
m[0] = A[0]
M = [0]*n
M[n-1] = A[n-1]
for i in range(n-1):
m[i+1] = min(m[i],A[i+1])
M[n-i-2] = max(M[n-i-1],A[n-2-i])
delta = [M[i+1] - m[i] for i in range(n-1)]
can = max(delta)
ans = 0
for i,a in enumerate(A):
if a == m[i] + can:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
17,
13,
0,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
14,
2,
13,
17,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
18,
13,
13,
0,
13,
17,
4,
13,
18,
18,
13,
17,
17,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
137,
2
],
[
137,
11
],
[
134,
13
],
[
128,
25
],
[
138,
29
],
[
34,
31
],
[
129,
32
],
[
135,
35
],
[
39,
38
],
[
138,
42
],
[
47,
44
],
[
129,
45
],
[
38,
46
],
[
129,
50
],
[
38,
52
],
[
135,
55
],
[
38,
56
],
[
131,
58
],
[
63,
62
],
[
138,
66
],
[
119,
68
],
[
135,
71
],
[
62,
72
],
[
129,
74
],
[
62,
76
],
[
120,
80
],
[
120,
84
],
[
132,
85
],
[
90,
87
],
[
132,
88
],
[
120,
89
],
[
95,
92
],
[
132,
93
],
[
120,
94
],
[
122,
97
],
[
132,
102
],
[
123,
106
],
[
132,
106
],
[
110,
109
],
[
123,
115
],
[
132,
115
],
[
119,
120
],
[
122,
123
],
[
137,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\nx=[0]*n\nx[0]=a[0]\nfor i in range(1,n):\n x[i]=min(x[i-1],a[i])\nd=dict()\nfor i in range(1,n):\n y=a[i]-x[i-1]\n if y>0:\n if y in d:\n d[y]+=1\n else:\n d[y]=1\nd=list(d.items())\nd.sort(reverse=True)\nprint(d[0][1])",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x=[0]*n",
"x",
"[0]*n",
"[0]",
"0",
"n",
"x[0]=a[0]",
"x[0]",
"x",
"0",
"a[0]",
"a",
"0",
"for i in range(1,n):\n x[i]=min(x[i-1],a[i])",
"i",
"range(1,n)",
"range",
"1",
"n",
"x[i]=min(x[i-1],a[i])",
"x[i]",
"x",
"i",
"min(x[i-1],a[i])",
"min",
"x[i-1]",
"x",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"d=dict()",
"d",
"dict()",
"dict",
"for i in range(1,n):\n y=a[i]-x[i-1]\n if y>0:\n if y in d:\n d[y]+=1\n else:\n d[y]=1",
"i",
"range(1,n)",
"range",
"1",
"n",
"y=a[i]-x[i-1]",
"y",
"a[i]-x[i-1]",
"a[i]",
"a",
"i",
"x[i-1]",
"x",
"i-1",
"i",
"1",
"if y>0:\n if y in d:\n d[y]+=1\n else:\n d[y]=1",
"y>0",
"y",
"0",
"if y in d:\n d[y]+=1\n else:\n d[y]=1",
"y in d",
"y",
"d",
"d[y]+=1",
"d[y]",
"d",
"y",
"1",
"d[y]=1",
"d[y]",
"d",
"y",
"1",
"d=list(d.items())",
"d",
"list(d.items())",
"list",
"d.items()",
"d.items",
"d",
"items",
"d.sort(reverse=True)",
"d.sort",
"d",
"sort",
"reverse=True",
"reverse",
"True",
"print(d[0][1])",
"print",
"d[0][1]",
"[0]",
"d",
"0",
"1",
"y=a[i]-x[i-1]",
"a[i]-x[i-1]",
"y",
"d=list(d.items())",
"list(d.items())",
"d",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"x=[0]*n",
"[0]*n",
"x",
"d=dict()",
"dict()",
"d",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
x=[0]*n
x[0]=a[0]
for i in range(1,n):
x[i]=min(x[i-1],a[i])
d=dict()
for i in range(1,n):
y=a[i]-x[i-1]
if y>0:
if y in d:
d[y]+=1
else:
d[y]=1
d=list(d.items())
d.sort(reverse=True)
print(d[0][1])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
4,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
13,
13,
4,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
17,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
17,
14,
2,
13,
17,
0,
18,
13,
39,
13,
2,
13,
13,
4,
13,
13,
13,
0,
13,
17,
28,
13,
4,
18,
13,
13,
0,
13,
13,
4,
13,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] |
[
[
198,
3
],
[
198,
12
],
[
171,
14
],
[
195,
26
],
[
201,
31
],
[
35,
34
],
[
178,
37
],
[
172,
41
],
[
34,
42
],
[
196,
43
],
[
208,
43
],
[
207,
45
],
[
172,
47
],
[
34,
48
],
[
186,
50
],
[
202,
53
],
[
187,
53
],
[
172,
56
],
[
34,
57
],
[
196,
58
],
[
208,
58
],
[
204,
60
],
[
189,
65
],
[
165,
70
],
[
192,
73
],
[
77,
76
],
[
178,
79
],
[
172,
83
],
[
76,
84
],
[
190,
85
],
[
208,
85
],
[
196,
85
],
[
169,
85
],
[
193,
88
],
[
211,
88
],
[
214,
88
],
[
98,
91
],
[
205,
92
],
[
190,
96
],
[
208,
96
],
[
196,
96
],
[
169,
96
],
[
187,
97
],
[
202,
97
],
[
193,
100
],
[
211,
100
],
[
214,
100
],
[
166,
101
],
[
217,
101
],
[
175,
101
],
[
168,
103
],
[
172,
105
],
[
76,
106
],
[
174,
108
],
[
213,
111
],
[
172,
116
],
[
76,
117
],
[
190,
118
],
[
208,
118
],
[
196,
118
],
[
169,
118
],
[
216,
120
],
[
172,
126
],
[
76,
127
],
[
190,
128
],
[
208,
128
],
[
196,
128
],
[
169,
128
],
[
187,
129
],
[
202,
129
],
[
210,
131
],
[
211,
135
],
[
214,
135
],
[
193,
135
],
[
145,
138
],
[
205,
139
],
[
169,
143
],
[
190,
143
],
[
208,
143
],
[
196,
143
],
[
187,
144
],
[
202,
144
],
[
211,
147
],
[
214,
147
],
[
193,
147
],
[
217,
148
],
[
175,
148
],
[
166,
148
],
[
183,
150
],
[
154,
153
],
[
205,
156
],
[
180,
159
],
[
153,
160
],
[
181,
163
],
[
184,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
198,
178
],
[
153,
180
],
[
180,
181
],
[
183,
184
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
],
[
210,
211
],
[
213,
214
],
[
216,
217
]
] |
[
"from collections import defaultdict\nN,T = map(int,input().split())\na_ls = list(map(int,input().split()))\n# 初期のa_lsにおける高橋くんのりんご一個あたりの最大利益を求める\nMin = float('inf')\nmax_profit = 0\nfor i in range(N):\n if a_ls[i] < Min:\n Min = a_ls[i]\n else:\n max_profit = max(max_profit,a_ls[i]-Min)\n\n#print(max_profit)\n\npair_dict = defaultdict(int)\nMin = float('inf')\nnum_Min = 0\nnum_Max = 0\nfor i in range(N):\n #print(Min)\n #print(a_ls[i])\n #print('---')\n if a_ls[i] < Min:\n if num_Max > 0:\n pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)\n Min = a_ls[i]\n num_Min = 1\n num_Max = 0\n elif a_ls[i] == Min:\n num_Min += 1\n elif a_ls[i] - Min == max_profit:\n num_Max += 1\n\nif num_Max > 0:\n pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)\n\nans = 0\n#print(pair_dict)\nfor v in pair_dict.values():\n ans += v\nprint(ans)",
"from collections import defaultdict",
"N,T = map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"a_ls = list(map(int,input().split()))",
"a_ls",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"Min = float('inf')",
"Min",
"float('inf')",
"float",
"'inf'",
"max_profit = 0",
"max_profit",
"0",
"for i in range(N):\n if a_ls[i] < Min:\n Min = a_ls[i]\n else:\n max_profit = max(max_profit,a_ls[i]-Min)\n\n#print(max_profit)",
"i",
"range(N)",
"range",
"N",
"if a_ls[i] < Min:\n Min = a_ls[i]\n else:\n max_profit = max(max_profit,a_ls[i]-Min)\n\n#print(max_profit)",
"a_ls[i] < Min",
"a_ls[i]",
"a_ls",
"i",
"Min",
"Min = a_ls[i]",
"Min",
"a_ls[i]",
"a_ls",
"i",
"max_profit = max(max_profit,a_ls[i]-Min)",
"max_profit",
"max(max_profit,a_ls[i]-Min)",
"max",
"max_profit",
"a_ls[i]-Min",
"a_ls[i]",
"a_ls",
"i",
"Min",
"pair_dict = defaultdict(int)",
"pair_dict",
"defaultdict(int)",
"defaultdict",
"int",
"Min = float('inf')",
"Min",
"float('inf')",
"float",
"'inf'",
"num_Min = 0",
"num_Min",
"0",
"num_Max = 0",
"num_Max",
"0",
"for i in range(N):\n #print(Min)\n #print(a_ls[i])\n #print('---')\n if a_ls[i] < Min:\n if num_Max > 0:\n pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)\n Min = a_ls[i]\n num_Min = 1\n num_Max = 0\n elif a_ls[i] == Min:\n num_Min += 1\n elif a_ls[i] - Min == max_profit:\n num_Max += 1",
"i",
"range(N)",
"range",
"N",
"if a_ls[i] < Min:\n if num_Max > 0:\n pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)\n Min = a_ls[i]\n num_Min = 1\n num_Max = 0\n elif a_ls[i] == Min:\n num_Min += 1\n elif a_ls[i] - Min == max_profit:\n num_Max += 1",
"a_ls[i] < Min",
"a_ls[i]",
"a_ls",
"i",
"Min",
"if num_Max > 0:\n pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)\n ",
"num_Max > 0",
"num_Max",
"0",
"pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)",
"pair_dict[(Min,Min+max_profit)]",
"pair_dict",
"(Min,Min+max_profit)",
"Min",
"Min+max_profit",
"Min",
"max_profit",
"min(num_Max,num_Min)",
"min",
"num_Max",
"num_Min",
"Min = a_ls[i]",
"Min",
"a_ls[i]",
"a_ls",
"i",
"num_Min = 1",
"num_Min",
"1",
"num_Max = 0",
"num_Max",
"0",
"elif a_ls[i] == Min:\n num_Min += 1\n ",
"a_ls[i] == Min",
"a_ls[i]",
"a_ls",
"i",
"Min",
"num_Min += 1",
"num_Min",
"1",
"elif a_ls[i] - Min == max_profit:\n num_Max += 1",
"a_ls[i] - Min == max_profit",
"a_ls[i] - Min",
"a_ls[i]",
"a_ls",
"i",
"Min",
"max_profit",
"num_Max += 1",
"num_Max",
"1",
"if num_Max > 0:\n pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)",
"num_Max > 0",
"num_Max",
"0",
"pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)",
"pair_dict[(Min,Min+max_profit)]",
"pair_dict",
"(Min,Min+max_profit)",
"Min",
"Min+max_profit",
"Min",
"max_profit",
"min(num_Max,num_Min)",
"min",
"num_Max",
"num_Min",
"ans = 0",
"ans",
"0",
"for v in pair_dict.values():\n ans += v",
"v",
"pair_dict.values()",
"pair_dict.values",
"pair_dict",
"values",
"ans += v",
"ans",
"v",
"print(ans)",
"print",
"ans",
"num_Min = 0",
"0",
"num_Min",
"Min = a_ls[i]",
"a_ls[i]",
"Min",
"a_ls = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a_ls",
"num_Min = 1",
"1",
"num_Min",
"N,T = map(int,input().split())",
"map(int,input().split())",
"N",
"ans += v",
"v",
"ans",
"ans = 0",
"0",
"ans",
"max_profit = max(max_profit,a_ls[i]-Min)",
"max(max_profit,a_ls[i]-Min)",
"max_profit",
"Min = float('inf')",
"float('inf')",
"Min",
"num_Max = 0",
"0",
"num_Max",
"Min = float('inf')",
"float('inf')",
"Min",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"max_profit = 0",
"0",
"max_profit",
"pair_dict = defaultdict(int)",
"defaultdict(int)",
"pair_dict",
"Min = a_ls[i]",
"a_ls[i]",
"Min",
"num_Max += 1",
"1",
"num_Max",
"num_Max = 0",
"0",
"num_Max",
"num_Min += 1",
"1",
"num_Min"
] |
from collections import defaultdict
N,T = map(int,input().split())
a_ls = list(map(int,input().split()))
# 初期のa_lsにおける高橋くんのりんご一個あたりの最大利益を求める
Min = float('inf')
max_profit = 0
for i in range(N):
if a_ls[i] < Min:
Min = a_ls[i]
else:
max_profit = max(max_profit,a_ls[i]-Min)
#print(max_profit)
pair_dict = defaultdict(int)
Min = float('inf')
num_Min = 0
num_Max = 0
for i in range(N):
#print(Min)
#print(a_ls[i])
#print('---')
if a_ls[i] < Min:
if num_Max > 0:
pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)
Min = a_ls[i]
num_Min = 1
num_Max = 0
elif a_ls[i] == Min:
num_Min += 1
elif a_ls[i] - Min == max_profit:
num_Max += 1
if num_Max > 0:
pair_dict[(Min,Min+max_profit)] = min(num_Max,num_Min)
ans = 0
#print(pair_dict)
for v in pair_dict.values():
ans += v
print(ans)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
18,
4,
13,
13,
39,
17,
0,
13,
2,
13,
18,
13,
13,
14,
2,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
18,
13,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
99,
3
],
[
99,
12
],
[
16,
15
],
[
15,
24
],
[
90,
26
],
[
96,
29
],
[
84,
34
],
[
84,
37
],
[
41,
40
],
[
100,
44
],
[
81,
48
],
[
85,
50
],
[
103,
50
],
[
91,
52
],
[
40,
53
],
[
82,
56
],
[
93,
59
],
[
79,
62
],
[
94,
62
],
[
82,
63
],
[
102,
65
],
[
85,
68
],
[
103,
68
],
[
91,
70
],
[
40,
71
],
[
97,
75
],
[
94,
76
],
[
79,
76
],
[
84,
79
],
[
81,
82
],
[
84,
85
],
[
99,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
]
] |
[
"from collections import defaultdict\nn,t = map(int,input().split())\na = [int(i) for i in input().split()]\ndct = defaultdict(int)\nmv = mk = 0\nfor i in range(n)[::-1]:\n k = mv-a[i]\n if k > 0: dct[k] += 1\n mk = max(mk,k)\n mv = max(mv,a[i])\nprint(dct[mk])",
"from collections import defaultdict",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"a = [int(i) for i in input().split()]",
"a",
"[int(i) for i in input().split()]",
"dct = defaultdict(int)",
"dct",
"defaultdict(int)",
"defaultdict",
"int",
"mv = mk = 0",
"mv",
"0",
"= mk = 0",
"mk",
"0",
"for i in range(n)[::-1]:\n k = mv-a[i]\n if k > 0: dct[k] += 1\n mk = max(mk,k)\n mv = max(mv,a[i])",
"i",
"range(n)[::-1]",
"(n)",
"range",
"n",
"::-1",
"-1",
"k = mv-a[i]",
"k",
"mv-a[i]",
"mv",
"a[i]",
"a",
"i",
"if k > 0: dct[k] += 1\n ",
"k > 0",
"k",
"0",
"mk = max(mk,k)",
"mk",
"max(mk,k)",
"max",
"mk",
"k",
"mv = max(mv,a[i])",
"mv",
"max(mv,a[i])",
"max",
"mv",
"a[i]",
"a",
"i",
"print(dct[mk])",
"print",
"dct[mk]",
"dct",
"mk",
"mk = 0",
"0",
"mk",
"k = mv-a[i]",
"mv-a[i]",
"k",
"mv = mk = 0",
"0",
"mv",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"a = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a",
"mk = max(mk,k)",
"max(mk,k)",
"mk",
"dct = defaultdict(int)",
"defaultdict(int)",
"dct",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"mv = max(mv,a[i])",
"max(mv,a[i])",
"mv"
] |
from collections import defaultdict
n,t = map(int,input().split())
a = [int(i) for i in input().split()]
dct = defaultdict(int)
mv = mk = 0
for i in range(n)[::-1]:
k = mv-a[i]
if k > 0: dct[k] += 1
mk = max(mk,k)
mv = max(mv,a[i])
print(dct[mk])
|
[
7,
15,
15,
15,
13,
15,
13,
15,
13,
15,
15,
13,
15,
15,
15,
13,
15,
15,
15,
15,
15,
4,
18,
13,
13,
17,
0,
13,
2,
17,
17,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
12,
13,
23,
13,
41,
28,
13,
4,
13,
13,
4,
13,
12,
13,
23,
13,
0,
13,
17,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
244,
27
],
[
42,
41
],
[
248,
47
],
[
51,
51
],
[
55,
54
],
[
263,
60
],
[
64,
64
],
[
68,
67
],
[
218,
73
],
[
77,
77
],
[
81,
80
],
[
230,
86
],
[
90,
90
],
[
94,
93
],
[
218,
101
],
[
105,
105
],
[
109,
108
],
[
117,
117
],
[
205,
119
],
[
232,
122
],
[
263,
124
],
[
232,
125
],
[
253,
127
],
[
263,
129
],
[
202,
131
],
[
254,
133
],
[
256,
136
],
[
140,
139
],
[
233,
143
],
[
226,
145
],
[
257,
148
],
[
227,
148
],
[
254,
151
],
[
139,
152
],
[
203,
153
],
[
242,
153
],
[
241,
155
],
[
203,
158
],
[
242,
158
],
[
254,
160
],
[
139,
161
],
[
214,
163
],
[
235,
166
],
[
254,
168
],
[
172,
171
],
[
233,
175
],
[
254,
180
],
[
171,
181
],
[
236,
182
],
[
242,
182
],
[
203,
182
],
[
221,
182
],
[
227,
183
],
[
257,
183
],
[
250,
185
],
[
220,
188
],
[
236,
191
],
[
242,
191
],
[
203,
191
],
[
221,
191
],
[
254,
193
],
[
171,
194
],
[
251,
197
],
[
215,
197
],
[
232,
200
],
[
202,
203
],
[
205,
206
],
[
214,
215
],
[
220,
221
],
[
226,
227
],
[
232,
233
],
[
235,
236
],
[
241,
242
],
[
244,
245
],
[
250,
251
],
[
253,
254
],
[
256,
257
]
] |
[
"from collections import defaultdict, deque, Counter\nfrom heapq import heappush, heappop, heapify\nimport math\nimport bisect\nimport random\nfrom itertools import permutations, accumulate, combinations, product\nimport sys\nfrom pprint import pprint\nfrom copy import deepcopy\nimport string\nfrom bisect import bisect_left, bisect_right\nfrom math import factorial, ceil, floor\nfrom operator import mul\nfrom functools import reduce\nfrom pprint import pprint\n\n\nsys.setrecursionlimit(2147483647)\nINF = 10 ** 13\ndef LI(): return list(map(int, sys.stdin.buffer.readline().split()))\ndef I(): return int(sys.stdin.buffer.readline())\ndef LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()\ndef S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef LSR(n): return [LS() for i in range(n)]\ndef SRL(n): return [list(S()) for i in range(n)]\ndef MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]\nmod = 1000000007\n\n\nn, t = LI()\nA = LI()\nmin_ret = A[0]\nmax_diff = 1\nfor i in range(1, n):\n max_diff = max(max_diff, A[i] - min_ret)\n min_ret = min(min_ret, A[i])\n\n\n\nans = 0\nmin_ret = A[0]\nfor j in range(1, n):\n if A[j] - min_ret == max_diff:\n ans += 1\n min_ret = min(min_ret, A[j])\n\n\nprint(ans)\n\n",
"from collections import defaultdict, deque, Counter",
"from heapq import heappush, heappop, heapify",
"import math",
"math",
"import bisect",
"bisect",
"import random",
"random",
"from itertools import permutations, accumulate, combinations, product",
"import sys",
"sys",
"from pprint import pprint",
"from copy import deepcopy",
"import string",
"string",
"from bisect import bisect_left, bisect_right",
"from math import factorial, ceil, floor",
"from operator import mul",
"from functools import reduce",
"from pprint import pprint",
"sys.setrecursionlimit(2147483647)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"2147483647",
"INF = 10 ** 13",
"INF",
"10 ** 13",
"10",
"13",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"LI",
"def I(): return int(sys.stdin.buffer.readline())",
"I",
"def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()",
"LS",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"S",
"I() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"I()",
"I",
"def IR(n): return [I() for i in range(n)]",
"IR",
"n",
"n",
"LI() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"LI()",
"LI",
"def LIR(n): return [LI() for i in range(n)]",
"LIR",
"n",
"n",
"S() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"S()",
"S",
"def SR(n): return [S() for i in range(n)]",
"SR",
"n",
"n",
"LS() for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"LS()",
"LS",
"def LSR(n): return [LS() for i in range(n)]",
"LSR",
"n",
"n",
"list(S()) for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"list(S())",
"list",
"S()",
"S",
"def SRL(n): return [list(S()) for i in range(n)]",
"SRL",
"n",
"n",
"[int(j) for j in list(S())] for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"[int(j) for j in list(S())]",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"MSRL",
"n",
"n",
"mod = 1000000007",
"mod",
"1000000007",
"n, t = LI()",
"n",
"LI()",
"LI",
"t",
"A = LI()",
"A",
"LI()",
"LI",
"min_ret = A[0]",
"min_ret",
"A[0]",
"A",
"0",
"max_diff = 1",
"max_diff",
"1",
"for i in range(1, n):\n max_diff = max(max_diff, A[i] - min_ret)\n min_ret = min(min_ret, A[i])",
"i",
"range(1, n)",
"range",
"1",
"n",
"max_diff = max(max_diff, A[i] - min_ret)",
"max_diff",
"max(max_diff, A[i] - min_ret)",
"max",
"max_diff",
"A[i] - min_ret",
"A[i]",
"A",
"i",
"min_ret",
"min_ret = min(min_ret, A[i])",
"min_ret",
"min(min_ret, A[i])",
"min",
"min_ret",
"A[i]",
"A",
"i",
"ans = 0",
"ans",
"0",
"min_ret = A[0]",
"min_ret",
"A[0]",
"A",
"0",
"for j in range(1, n):\n if A[j] - min_ret == max_diff:\n ans += 1\n min_ret = min(min_ret, A[j])",
"j",
"range(1, n)",
"range",
"1",
"n",
"if A[j] - min_ret == max_diff:\n ans += 1\n ",
"A[j] - min_ret == max_diff",
"A[j] - min_ret",
"A[j]",
"A",
"j",
"min_ret",
"max_diff",
"ans += 1",
"ans",
"1",
"min_ret = min(min_ret, A[j])",
"min_ret",
"min(min_ret, A[j])",
"min",
"min_ret",
"A[j]",
"A",
"j",
"print(ans)",
"print",
"ans",
"t = LI()",
"LI()",
"t",
"min_ret = A[0]",
"A[0]",
"min_ret",
"mod = 1000000007",
"1000000007",
"mod",
"def LSR(n): return [LS() for i in range(n)]",
"def LSR(n): return [LS() for i in range(n)]",
"LSR",
"def SRL(n): return [list(S()) for i in range(n)]",
"def SRL(n): return [list(S()) for i in range(n)]",
"SRL",
"ans = 0",
"0",
"ans",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')",
"S",
"min_ret = min(min_ret, A[j])",
"min(min_ret, A[j])",
"min_ret",
"def IR(n): return [I() for i in range(n)]",
"def IR(n): return [I() for i in range(n)]",
"IR",
"max_diff = max(max_diff, A[i] - min_ret)",
"max(max_diff, A[i] - min_ret)",
"max_diff",
"def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()",
"def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()",
"LS",
"n, t = LI()",
"LI()",
"n",
"min_ret = A[0]",
"A[0]",
"min_ret",
"def SR(n): return [S() for i in range(n)]",
"def SR(n): return [S() for i in range(n)]",
"SR",
"min_ret = min(min_ret, A[i])",
"min(min_ret, A[i])",
"min_ret",
"INF = 10 ** 13",
"10 ** 13",
"INF",
"def I(): return int(sys.stdin.buffer.readline())",
"def I(): return int(sys.stdin.buffer.readline())",
"I",
"ans += 1",
"1",
"ans",
"A = LI()",
"LI()",
"A",
"max_diff = 1",
"1",
"max_diff",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]",
"MSRL",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"def LI(): return list(map(int, sys.stdin.buffer.readline().split()))",
"LI",
"def LIR(n): return [LI() for i in range(n)]",
"def LIR(n): return [LI() for i in range(n)]",
"LIR"
] |
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
from pprint import pprint
from copy import deepcopy
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
from pprint import pprint
sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007
n, t = LI()
A = LI()
min_ret = A[0]
max_diff = 1
for i in range(1, n):
max_diff = max(max_diff, A[i] - min_ret)
min_ret = min(min_ret, A[i])
ans = 0
min_ret = A[0]
for j in range(1, n):
if A[j] - min_ret == max_diff:
ans += 1
min_ret = min(min_ret, A[j])
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
2,
17,
17,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
0,
13,
4,
13,
18,
13,
13,
13,
0,
13,
4,
13,
2,
18,
13,
2,
13,
17,
13,
13,
0,
18,
13,
18,
13,
13,
13,
0,
18,
13,
18,
13,
2,
13,
17,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
2,
2,
18,
13,
13,
13,
13,
2,
18,
13,
2,
18,
13,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13
] |
[
[
134,
2
],
[
134,
11
],
[
15,
14
],
[
14,
23
],
[
143,
25
],
[
140,
28
],
[
137,
32
],
[
119,
35
],
[
39,
38
],
[
135,
42
],
[
128,
45
],
[
144,
49
],
[
38,
50
],
[
141,
51
],
[
129,
51
],
[
131,
53
],
[
144,
58
],
[
38,
60
],
[
129,
62
],
[
141,
62
],
[
138,
63
],
[
132,
63
],
[
70,
65
],
[
120,
66
],
[
144,
68
],
[
38,
69
],
[
38,
70
],
[
79,
72
],
[
120,
73
],
[
144,
75
],
[
135,
77
],
[
135,
80
],
[
122,
83
],
[
87,
86
],
[
135,
90
],
[
144,
96
],
[
86,
97
],
[
132,
98
],
[
138,
98
],
[
120,
99
],
[
120,
102
],
[
144,
105
],
[
86,
106
],
[
132,
107
],
[
138,
107
],
[
86,
108
],
[
125,
110
],
[
126,
114
],
[
123,
114
],
[
134,
117
],
[
119,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
]
] |
[
"n,t=map(int,input().split())\na=[int(i) for i in input().split()]\nmn,mx=10**10,-1\nd={}\nfor i in range(n-1):\n mn=min(a[i],mn)\n mx=max(a[i+1]-mn,mx)\n d[a[i]]=i\nd[a[n-1]]=n-1\nans=0\nfor i in range(1,n):\n if a[i]-mx in d and d[a[i]-mx]<i:\n ans+=1\nprint(ans)",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"int(i) for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"a=[int(i) for i in input().split()]",
"a",
"[int(i) for i in input().split()]",
"mn,mx=10**10,-1",
"mn",
"10**10",
"10",
"10",
"mx",
"-1",
"d={}",
"d",
"{}",
"for i in range(n-1):\n mn=min(a[i],mn)\n mx=max(a[i+1]-mn,mx)\n d[a[i]]=i",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"mn=min(a[i],mn)",
"mn",
"min(a[i],mn)",
"min",
"a[i]",
"a",
"i",
"mn",
"mx=max(a[i+1]-mn,mx)",
"mx",
"max(a[i+1]-mn,mx)",
"max",
"a[i+1]-mn",
"a[i+1]",
"a",
"i+1",
"i",
"1",
"mn",
"mx",
"d[a[i]]=i",
"d[a[i]]",
"d",
"a[i]",
"a",
"i",
"i",
"d[a[n-1]]=n-1",
"d[a[n-1]]",
"d",
"a[n-1]",
"a",
"n-1",
"n",
"1",
"n-1",
"n",
"1",
"ans=0",
"ans",
"0",
"for i in range(1,n):\n if a[i]-mx in d and d[a[i]-mx]<i:\n ans+=1",
"i",
"range(1,n)",
"range",
"1",
"n",
"if a[i]-mx in d and d[a[i]-mx]<i:\n ans+=1",
"a[i]-mx in d and d[a[i]-mx]<i",
"a[i]-mx in d",
"a[i]-mx",
"a[i]",
"a",
"i",
"mx",
"d",
"d[a[i]-mx]<i",
"d[a[i]-mx]",
"d",
"a[i]-mx",
"a[i]",
"a",
"i",
"mx",
"i",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"d={}",
"{}",
"d",
"ans=0",
"0",
"ans",
"ans+=1",
"1",
"ans",
"mn=min(a[i],mn)",
"min(a[i],mn)",
"mn",
"mx=max(a[i+1]-mn,mx)",
"max(a[i+1]-mn,mx)",
"mx",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"mx=10**10,-1",
"-1",
"mx",
"mn,mx=10**10,-1",
"10**10",
"mn",
"a=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a"
] |
n,t=map(int,input().split())
a=[int(i) for i in input().split()]
mn,mx=10**10,-1
d={}
for i in range(n-1):
mn=min(a[i],mn)
mx=max(a[i+1]-mn,mx)
d[a[i]]=i
d[a[n-1]]=n-1
ans=0
for i in range(1,n):
if a[i]-mx in d and d[a[i]-mx]<i:
ans+=1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
14,
4,
18,
13,
13,
2,
13,
13,
4,
13,
18,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13
] |
[
[
67,
2
],
[
67,
11
],
[
58,
13
],
[
61,
25
],
[
64,
30
],
[
34,
33
],
[
59,
33
],
[
33,
37
],
[
62,
38
],
[
65,
42
],
[
33,
45
],
[
62,
46
],
[
65,
50
],
[
65,
53
],
[
67,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
],
[
67,
68
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\nm=10**18\nd={}\nfor i in a:\n if i<m:m=i\n if d.get(i-m):d[i-m]+=1\n else:d[i-m]=1\nprint(d[max(d)])",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"m=10**18",
"m",
"10**18",
"10",
"18",
"d={}",
"d",
"{}",
"for i in a:\n if i<m:m=i\n if d.get(i-m):d[i-m]+=1\n else:d[i-m]=1",
"i",
"a",
"if i<m:m=i\n ",
"i<m",
"i",
"m",
"if d.get(i-m):d[i-m]+=1\n else:d[i-m]=1",
"d.get(i-m)",
"d.get",
"d",
"get",
"i-m",
"i",
"m",
"print(d[max(d)])",
"print",
"d[max(d)]",
"d",
"max(d)",
"max",
"d",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"m=10**18",
"10**18",
"m",
"d={}",
"{}",
"d",
"t=map(int,input().split())",
"map(int,input().split())",
"t"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
m=10**18
d={}
for i in a:
if i<m:m=i
if d.get(i-m):d[i-m]+=1
else:d[i-m]=1
print(d[max(d)])
|
[
7,
15,
13,
13,
13,
15,
15,
15,
15,
15,
15,
15,
12,
13,
14,
13,
4,
13,
31,
13,
23,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
23,
13,
23,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
13,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
0,
13,
39,
17,
17,
17,
17,
17,
17,
17,
17,
0,
13,
17,
0,
13,
4,
13,
13,
0,
13,
4,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
13,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
18,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
12,
13,
10,
2,
13,
10,
13,
13,
10,
12,
13,
10,
13,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13
] |
[
[
40,
40
],
[
42,
42
],
[
198,
51
],
[
222,
56
],
[
246,
63
],
[
213,
74
],
[
216,
85
],
[
201,
88
],
[
220,
90
],
[
201,
91
],
[
210,
93
],
[
205,
95
],
[
99,
98
],
[
202,
101
],
[
231,
105
],
[
111,
108
],
[
232,
109
],
[
211,
112
],
[
116,
115
],
[
202,
119
],
[
232,
123
],
[
115,
125
],
[
211,
128
],
[
115,
129
],
[
134,
131
],
[
232,
132
],
[
115,
133
],
[
211,
135
],
[
115,
136
],
[
141,
138
],
[
232,
139
],
[
115,
140
],
[
232,
142
],
[
115,
144
],
[
238,
147
],
[
232,
148
],
[
152,
151
],
[
202,
154
],
[
225,
158
],
[
162,
161
],
[
202,
164
],
[
169,
166
],
[
226,
167
],
[
161,
168
],
[
211,
171
],
[
161,
172
],
[
138,
173
],
[
131,
173
],
[
232,
174
],
[
161,
175
],
[
238,
177
],
[
226,
178
],
[
226,
183
],
[
226,
187
],
[
201,
193
],
[
198,
199
],
[
201,
202
],
[
210,
211
],
[
213,
214
],
[
216,
217
],
[
222,
223
],
[
225,
226
],
[
231,
232
],
[
246,
247
]
] |
[
"import sys, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10\nfrom itertools import permutations, combinations, product, accumulate, combinations_with_replacement\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\ndef debug(*args):\n if debugmode:\n print(*args)\ndef input(): return sys.stdin.readline().strip()\ndef STR(): return input()\ndef INT(): return int(input())\ndef FLOAT(): return float(input())\ndef MAP(): return map(int, input().split())\ndef S_MAP(): return map(str, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef S_LIST(): return list(map(str, input().split()))\ndef lcm(a, b): return a * b // gcd(a, b)\nsys.setrecursionlimit(10 ** 9)\ninf = sys.maxsize\nmod = 10 ** 9 + 7\ndx = [0, 1, 0, -1, 1, -1, -1, 1]\ndy = [1, 0, -1, 0, 1, -1, 1, -1]\ndebugmode = False\n\nn, t = MAP()\na = LIST()\nb = [0 for _ in range(n)]\nb[0] = a[0]\nfor i in range(1, n):\n if b[i - 1] > a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i - 1]\ndebug(b)\nc = [0 for _ in range(n)]\nfor i in range(n):\n c[i] = a[i] - b[i]\ndebug(c)\nprint(c.count(max(c)))",
"import sys, re, os",
"sys",
"re",
"os",
"from collections import deque, defaultdict, Counter",
"from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10",
"from itertools import permutations, combinations, product, accumulate, combinations_with_replacement",
"from operator import itemgetter, mul",
"from copy import deepcopy",
"from string import ascii_lowercase, ascii_uppercase, digits",
"from fractions import gcd",
"def debug(*args):\n if debugmode:\n print(*args)",
"debug",
"if debugmode:\n print(*args)",
"debugmode",
"print(*args)",
"print",
"*args",
"args",
"*args",
"def input(): return sys.stdin.readline().strip()",
"input",
"def STR(): return input()",
"STR",
"def INT(): return int(input())",
"INT",
"def FLOAT(): return float(input())",
"FLOAT",
"def MAP(): return map(int, input().split())",
"MAP",
"def S_MAP(): return map(str, input().split())",
"S_MAP",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"def S_LIST(): return list(map(str, input().split()))",
"S_LIST",
"def lcm(a, b): return a * b // gcd(a, b)",
"lcm",
"a",
"a",
"b",
"b",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"inf = sys.maxsize",
"inf",
"sys.maxsize",
"sys",
"maxsize",
"mod = 10 ** 9 + 7",
"mod",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"dx = [0, 1, 0, -1, 1, -1, -1, 1]",
"dx",
"[0, 1, 0, -1, 1, -1, -1, 1]",
"0",
"1",
"0",
"-1",
"1",
"-1",
"-1",
"1",
"dy = [1, 0, -1, 0, 1, -1, 1, -1]",
"dy",
"[1, 0, -1, 0, 1, -1, 1, -1]",
"1",
"0",
"-1",
"0",
"1",
"-1",
"1",
"-1",
"debugmode = False",
"debugmode",
"False",
"n, t = MAP()",
"n",
"MAP()",
"MAP",
"t",
"a = LIST()",
"a",
"LIST()",
"LIST",
"0 for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"0",
"b = [0 for _ in range(n)]",
"b",
"[0 for _ in range(n)]",
"b[0] = a[0]",
"b[0]",
"b",
"0",
"a[0]",
"a",
"0",
"for i in range(1, n):\n if b[i - 1] > a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i - 1]",
"i",
"range(1, n)",
"range",
"1",
"n",
"if b[i - 1] > a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i - 1]",
"b[i - 1] > a[i]",
"b[i - 1]",
"b",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"b[i] = a[i]",
"b[i]",
"b",
"i",
"a[i]",
"a",
"i",
"b[i] = b[i - 1]",
"b[i]",
"b",
"i",
"b[i - 1]",
"b",
"i - 1",
"i",
"1",
"debug(b)",
"debug",
"b",
"0 for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"0",
"c = [0 for _ in range(n)]",
"c",
"[0 for _ in range(n)]",
"for i in range(n):\n c[i] = a[i] - b[i]",
"i",
"range(n)",
"range",
"n",
"c[i] = a[i] - b[i]",
"c[i]",
"c",
"i",
"a[i] - b[i]",
"a[i]",
"a",
"i",
"b[i]",
"b",
"i",
"debug(c)",
"debug",
"c",
"print(c.count(max(c)))",
"print",
"c.count(max(c))",
"c.count",
"c",
"count",
"max(c)",
"max",
"c",
"def S_MAP(): return map(str, input().split())",
"def S_MAP(): return map(str, input().split())",
"S_MAP",
"t = MAP()",
"MAP()",
"t",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"inf = sys.maxsize",
"sys.maxsize",
"inf",
"n, t = MAP()",
"MAP()",
"n",
"def LIST(): return list(map(int, input().split()))",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"def lcm(a, b): return a * b // gcd(a, b)",
"def lcm(a, b): return a * b // gcd(a, b)",
"lcm",
"a = LIST()",
"LIST()",
"a",
"dy = [1, 0, -1, 0, 1, -1, 1, -1]",
"[1, 0, -1, 0, 1, -1, 1, -1]",
"dy",
"debugmode = False",
"False",
"debugmode",
"def MAP(): return map(int, input().split())",
"def MAP(): return map(int, input().split())",
"MAP",
"mod = 10 ** 9 + 7",
"10 ** 9 + 7",
"mod",
"c = [0 for _ in range(n)]",
"[0 for _ in range(n)]",
"c",
"def STR(): return input()",
"def STR(): return input()",
"STR",
"b = [0 for _ in range(n)]",
"[0 for _ in range(n)]",
"b",
"def FLOAT(): return float(input())",
"def FLOAT(): return float(input())",
"FLOAT",
"def debug(*args):\n if debugmode:\n print(*args)",
"def debug(*args):\n if debugmode:\n print(*args)",
"debug",
"def S_LIST(): return list(map(str, input().split()))",
"def S_LIST(): return list(map(str, input().split()))",
"S_LIST",
"def INT(): return int(input())",
"def INT(): return int(input())",
"INT",
"dx = [0, 1, 0, -1, 1, -1, -1, 1]",
"[0, 1, 0, -1, 1, -1, -1, 1]",
"dx"
] |
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
if debugmode:
print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = False
n, t = MAP()
a = LIST()
b = [0 for _ in range(n)]
b[0] = a[0]
for i in range(1, n):
if b[i - 1] > a[i]:
b[i] = a[i]
else:
b[i] = b[i - 1]
debug(b)
c = [0 for _ in range(n)]
for i in range(n):
c[i] = a[i] - b[i]
debug(c)
print(c.count(max(c)))
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
13,
4,
13,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
13,
10,
2,
13,
10,
18,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13
] |
[
[
141,
4
],
[
132,
11
],
[
138,
27
],
[
129,
32
],
[
42,
41
],
[
133,
48
],
[
42,
50
],
[
53,
52
],
[
133,
61
],
[
65,
64
],
[
68,
67
],
[
71,
70
],
[
52,
72
],
[
76,
75
],
[
41,
79
],
[
52,
83
],
[
75,
84
],
[
70,
85
],
[
87,
85
],
[
88,
87
],
[
52,
89
],
[
75,
90
],
[
52,
95
],
[
75,
96
],
[
87,
97
],
[
70,
97
],
[
67,
98
],
[
100,
98
],
[
101,
100
],
[
52,
103
],
[
75,
104
],
[
87,
105
],
[
70,
105
],
[
64,
108
],
[
52,
112
],
[
75,
113
],
[
87,
114
],
[
70,
114
],
[
64,
119
],
[
100,
121
],
[
67,
121
],
[
136,
127
],
[
129,
130
],
[
132,
133
],
[
138,
139
],
[
141,
142
]
] |
[
"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\n\ndef main():\n N, T = map(int, readline().split())\n A = list(map(int, readline().split()))\n\n L = []\n Max = 0\n Min = A[0]\n\n for i in range(1, N):\n if A[i] < Min:\n Min = A[i]\n if A[i] - Min > Max:\n Max = A[i] - Min\n L.append(A[i] - Min)\n print(L.count(Max))\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"read = sys.stdin.read",
"read",
"sys.stdin.read",
"sys.stdin",
"sys",
"stdin",
"read",
"readline = sys.stdin.buffer.readline",
"readline",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"sys.setrecursionlimit(10 ** 8)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 8",
"10",
"8",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"def main():\n N, T = map(int, readline().split())\n A = list(map(int, readline().split()))\n\n L = []\n Max = 0\n Min = A[0]\n\n for i in range(1, N):\n if A[i] < Min:\n Min = A[i]\n if A[i] - Min > Max:\n Max = A[i] - Min\n L.append(A[i] - Min)\n print(L.count(Max))",
"main",
"N, T = map(int, readline().split())",
"N",
"map(int, readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"T",
"A = list(map(int, readline().split()))",
"A",
"list(map(int, readline().split()))",
"list",
"map(int, readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"L = []",
"L",
"[]",
"Max = 0",
"Max",
"0",
"Min = A[0]",
"Min",
"A[0]",
"A",
"0",
"for i in range(1, N):\n if A[i] < Min:\n Min = A[i]\n if A[i] - Min > Max:\n Max = A[i] - Min\n L.append(A[i] - Min)\n ",
"i",
"range(1, N)",
"range",
"1",
"N",
"if A[i] < Min:\n Min = A[i]\n ",
"A[i] < Min",
"A[i]",
"A",
"i",
"Min",
"Min = A[i]",
"Min",
"A[i]",
"A",
"i",
"if A[i] - Min > Max:\n Max = A[i] - Min\n ",
"A[i] - Min > Max",
"A[i] - Min",
"A[i]",
"A",
"i",
"Min",
"Max",
"Max = A[i] - Min",
"Max",
"A[i] - Min",
"A[i]",
"A",
"i",
"Min",
"L.append(A[i] - Min)",
"L.append",
"L",
"append",
"A[i] - Min",
"A[i]",
"A",
"i",
"Min",
"print(L.count(Max))",
"print",
"L.count(Max)",
"L.count",
"L",
"count",
"Max",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"readline = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"readline",
"def main():\n N, T = map(int, readline().split())\n A = list(map(int, readline().split()))\n\n L = []\n Max = 0\n Min = A[0]\n\n for i in range(1, N):\n if A[i] < Min:\n Min = A[i]\n if A[i] - Min > Max:\n Max = A[i] - Min\n L.append(A[i] - Min)\n print(L.count(Max))",
"def main():\n N, T = map(int, readline().split())\n A = list(map(int, readline().split()))\n\n L = []\n Max = 0\n Min = A[0]\n\n for i in range(1, N):\n if A[i] < Min:\n Min = A[i]\n if A[i] - Min > Max:\n Max = A[i] - Min\n L.append(A[i] - Min)\n print(L.count(Max))",
"main",
"INF = float('inf')",
"float('inf')",
"INF",
"read = sys.stdin.read",
"sys.stdin.read",
"read"
] |
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N, T = map(int, readline().split())
A = list(map(int, readline().split()))
L = []
Max = 0
Min = A[0]
for i in range(1, N):
if A[i] < Min:
Min = A[i]
if A[i] - Min > Max:
Max = A[i] - Min
L.append(A[i] - Min)
print(L.count(Max))
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
14,
2,
13,
17,
9,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
4,
18,
13,
13,
0,
13,
17,
4,
13,
18,
18,
13,
17,
17,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
122,
2
],
[
122,
11
],
[
131,
13
],
[
125,
25
],
[
123,
29
],
[
34,
31
],
[
126,
32
],
[
132,
35
],
[
39,
38
],
[
123,
42
],
[
47,
44
],
[
126,
45
],
[
38,
46
],
[
126,
50
],
[
38,
52
],
[
132,
55
],
[
38,
56
],
[
137,
58
],
[
62,
61
],
[
123,
65
],
[
128,
67
],
[
132,
70
],
[
61,
71
],
[
126,
73
],
[
61,
75
],
[
129,
79
],
[
129,
84
],
[
138,
85
],
[
90,
87
],
[
138,
88
],
[
129,
89
],
[
95,
92
],
[
138,
93
],
[
129,
94
],
[
134,
97
],
[
138,
102
],
[
135,
106
],
[
110,
109
],
[
135,
115
],
[
122,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
]
] |
[
"N,T=map(int,input().split())\nA=tuple(map(int,input().split()))\nx=[0]*N\nx[0]=A[0]\nfor i in range(1,N):\n x[i]=min(x[i-1],A[i])\nB={}\nfor i in range(1,N):\n tmp=A[i]-x[i-1]\n if tmp<0:\n continue\n if tmp not in B:\n B[tmp]=1\n else:\n B[tmp]+=1\nd=list(B.items())\nd.sort(reverse=True)\nprint(d[0][1])",
"N,T=map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A=tuple(map(int,input().split()))",
"A",
"tuple(map(int,input().split()))",
"tuple",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x=[0]*N",
"x",
"[0]*N",
"[0]",
"0",
"N",
"x[0]=A[0]",
"x[0]",
"x",
"0",
"A[0]",
"A",
"0",
"for i in range(1,N):\n x[i]=min(x[i-1],A[i])",
"i",
"range(1,N)",
"range",
"1",
"N",
"x[i]=min(x[i-1],A[i])",
"x[i]",
"x",
"i",
"min(x[i-1],A[i])",
"min",
"x[i-1]",
"x",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"B={}",
"B",
"{}",
"for i in range(1,N):\n tmp=A[i]-x[i-1]\n if tmp<0:\n continue\n if tmp not in B:\n B[tmp]=1\n else:\n B[tmp]+=1",
"i",
"range(1,N)",
"range",
"1",
"N",
"tmp=A[i]-x[i-1]",
"tmp",
"A[i]-x[i-1]",
"A[i]",
"A",
"i",
"x[i-1]",
"x",
"i-1",
"i",
"1",
"if tmp<0:\n continue\n ",
"tmp<0",
"tmp",
"0",
"continue",
"if tmp not in B:\n B[tmp]=1\n else:\n B[tmp]+=1",
"tmp not in B",
"tmp",
"B",
"B[tmp]=1",
"B[tmp]",
"B",
"tmp",
"1",
"B[tmp]+=1",
"B[tmp]",
"B",
"tmp",
"1",
"d=list(B.items())",
"d",
"list(B.items())",
"list",
"B.items()",
"B.items",
"B",
"items",
"d.sort(reverse=True)",
"d.sort",
"d",
"sort",
"reverse=True",
"reverse",
"True",
"print(d[0][1])",
"print",
"d[0][1]",
"[0]",
"d",
"0",
"1",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"x=[0]*N",
"[0]*N",
"x",
"tmp=A[i]-x[i-1]",
"A[i]-x[i-1]",
"tmp",
"A=tuple(map(int,input().split()))",
"tuple(map(int,input().split()))",
"A",
"d=list(B.items())",
"list(B.items())",
"d",
"B={}",
"{}",
"B"
] |
N,T=map(int,input().split())
A=tuple(map(int,input().split()))
x=[0]*N
x[0]=A[0]
for i in range(1,N):
x[i]=min(x[i-1],A[i])
B={}
for i in range(1,N):
tmp=A[i]-x[i-1]
if tmp<0:
continue
if tmp not in B:
B[tmp]=1
else:
B[tmp]+=1
d=list(B.items())
d.sort(reverse=True)
print(d[0][1])
|
[
7,
15,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
17,
0,
13,
4,
13,
12,
17,
0,
13,
18,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
40,
40,
18,
13,
13,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
2,
13,
13,
17,
14,
40,
40,
13,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
2,
13,
13,
17,
14,
40,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
4,
13,
13,
4,
13,
18,
13,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
155,
3
],
[
155,
15
],
[
152,
17
],
[
158,
30
],
[
140,
36
],
[
153,
38
],
[
149,
41
],
[
153,
43
],
[
47,
46
],
[
138,
49
],
[
153,
54
],
[
46,
55
],
[
141,
56
],
[
147,
56
],
[
144,
56
],
[
132,
56
],
[
150,
57
],
[
126,
57
],
[
131,
59
],
[
153,
61
],
[
46,
62
],
[
69,
64
],
[
159,
65
],
[
132,
67
],
[
141,
67
],
[
147,
67
],
[
144,
67
],
[
150,
68
],
[
126,
68
],
[
141,
73
],
[
147,
73
],
[
144,
73
],
[
132,
73
],
[
153,
75
],
[
46,
76
],
[
150,
77
],
[
126,
77
],
[
143,
79
],
[
153,
81
],
[
46,
82
],
[
89,
84
],
[
159,
85
],
[
144,
87
],
[
141,
87
],
[
147,
87
],
[
132,
87
],
[
150,
88
],
[
126,
88
],
[
150,
92
],
[
126,
92
],
[
153,
94
],
[
46,
95
],
[
125,
97
],
[
153,
99
],
[
46,
100
],
[
146,
102
],
[
153,
104
],
[
46,
105
],
[
128,
107
],
[
159,
112
],
[
134,
115
],
[
129,
118
],
[
159,
122
],
[
135,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
155,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
]
] |
[
"from collections import defaultdict\nN,T=list(map(int,input().split(\" \")))\nA=list(map(int,input().split(\" \")))\nsub=defaultdict(lambda:0)\nmax1=A[0]\nmin1=A[0]\nfor i in range(N):\n if A[i]>=max1>=min1:\n max1=A[i]\n sub[max1-min1]+=1\n elif max1>=A[i]>=min1:\n max1=A[i]\n sub[max1-min1]+=1\n elif min1>=A[i]:\n min1=A[i]\n max1=A[i]\na=list(sub.keys())\nb=max(a)\nprint(sub[b])",
"from collections import defaultdict",
"N,T=list(map(int,input().split(\" \")))",
"N",
"list(map(int,input().split(\" \")))",
"list",
"map(int,input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"T",
"A=list(map(int,input().split(\" \")))",
"A",
"list(map(int,input().split(\" \")))",
"list",
"map(int,input().split(\" \"))",
"map",
"int",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"sub=defaultdict(lambda:0)",
"sub",
"defaultdict(lambda:0)",
"defaultdict",
"lambda:0",
"0",
"max1=A[0]",
"max1",
"A[0]",
"A",
"0",
"min1=A[0]",
"min1",
"A[0]",
"A",
"0",
"for i in range(N):\n if A[i]>=max1>=min1:\n max1=A[i]\n sub[max1-min1]+=1\n elif max1>=A[i]>=min1:\n max1=A[i]\n sub[max1-min1]+=1\n elif min1>=A[i]:\n min1=A[i]\n max1=A[i]",
"i",
"range(N)",
"range",
"N",
"if A[i]>=max1>=min1:\n max1=A[i]\n sub[max1-min1]+=1\n elif max1>=A[i]>=min1:\n max1=A[i]\n sub[max1-min1]+=1\n elif min1>=A[i]:\n min1=A[i]\n max1=A[i]",
"A[i]>=max1>=min1",
"A[i]>=max1",
"A[i]",
"A",
"i",
"max1",
"min1",
"max1=A[i]",
"max1",
"A[i]",
"A",
"i",
"sub[max1-min1]+=1",
"sub[max1-min1]",
"sub",
"max1-min1",
"max1",
"min1",
"1",
"elif max1>=A[i]>=min1:\n max1=A[i]\n sub[max1-min1]+=1\n ",
"max1>=A[i]>=min1",
"max1>=A[i]",
"max1",
"A[i]",
"A",
"i",
"min1",
"max1=A[i]",
"max1",
"A[i]",
"A",
"i",
"sub[max1-min1]+=1",
"sub[max1-min1]",
"sub",
"max1-min1",
"max1",
"min1",
"1",
"elif min1>=A[i]:\n min1=A[i]\n max1=A[i]",
"min1>=A[i]",
"min1",
"A[i]",
"A",
"i",
"min1=A[i]",
"min1",
"A[i]",
"A",
"i",
"max1=A[i]",
"max1",
"A[i]",
"A",
"i",
"a=list(sub.keys())",
"a",
"list(sub.keys())",
"list",
"sub.keys()",
"sub.keys",
"sub",
"keys",
"b=max(a)",
"b",
"max(a)",
"max",
"a",
"print(sub[b])",
"print",
"sub[b]",
"sub",
"b",
"min1=A[i]",
"A[i]",
"min1",
"a=list(sub.keys())",
"list(sub.keys())",
"a",
"max1=A[i]",
"A[i]",
"max1",
"b=max(a)",
"max(a)",
"b",
"N,T=list(map(int,input().split(\" \")))",
"list(map(int,input().split(\" \")))",
"N",
"max1=A[0]",
"A[0]",
"max1",
"max1=A[i]",
"A[i]",
"max1",
"max1=A[i]",
"A[i]",
"max1",
"min1=A[0]",
"A[0]",
"min1",
"A=list(map(int,input().split(\" \")))",
"list(map(int,input().split(\" \")))",
"A",
"T=list(map(int,input().split(\" \")))",
"list(map(int,input().split(\" \")))",
"T",
"sub=defaultdict(lambda:0)",
"defaultdict(lambda:0)",
"sub"
] |
from collections import defaultdict
N,T=list(map(int,input().split(" ")))
A=list(map(int,input().split(" ")))
sub=defaultdict(lambda:0)
max1=A[0]
min1=A[0]
for i in range(N):
if A[i]>=max1>=min1:
max1=A[i]
sub[max1-min1]+=1
elif max1>=A[i]>=min1:
max1=A[i]
sub[max1-min1]+=1
elif min1>=A[i]:
min1=A[i]
max1=A[i]
a=list(sub.keys())
b=max(a)
print(sub[b])
|
[
7,
15,
13,
0,
13,
18,
13,
13,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
18,
13,
13,
13,
0,
13,
12,
4,
18,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
9,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
17,
0,
13,
13,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13,
10,
18,
13,
10,
13,
13,
10,
18,
13,
10,
2,
13,
10,
4,
13
] |
[
[
136,
4
],
[
124,
9
],
[
130,
16
],
[
137,
27
],
[
127,
31
],
[
137,
37
],
[
121,
41
],
[
131,
43
],
[
121,
44
],
[
148,
46
],
[
131,
48
],
[
118,
50
],
[
106,
53
],
[
142,
56
],
[
149,
58
],
[
62,
61
],
[
116,
65
],
[
149,
69
],
[
61,
70
],
[
143,
71
],
[
113,
71
],
[
112,
73
],
[
149,
75
],
[
61,
76
],
[
145,
79
],
[
149,
82
],
[
61,
83
],
[
113,
84
],
[
143,
84
],
[
146,
87
],
[
107,
88
],
[
140,
88
],
[
109,
90
],
[
139,
93
],
[
146,
94
],
[
146,
97
],
[
107,
98
],
[
140,
98
],
[
133,
100
],
[
134,
104
],
[
110,
104
],
[
119,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
121,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
146,
139
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
]
] |
[
"import sys\n\nstdin = sys.stdin\n\nri = lambda: int(rs())\nrl = lambda: list(map(int, stdin.readline().split()))\nrs = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nN, T = rl()\nA = rl()\nanswer = 1\nprofit = 0\nmin = A[0]\nfor i in range(1, N):\n if A[i] < min:\n min = A[i]\n continue\n x = A[i] - min\n if x > profit:\n answer = 1\n profit = x\n elif x == profit:\n answer += 1\n\nprint(answer)\n# 40",
"import sys",
"sys",
"stdin = sys.stdin",
"stdin",
"sys.stdin",
"sys",
"stdin",
"ri = lambda: int(rs())",
"ri",
"lambda: int(rs())",
"int(rs())",
"int",
"rs()",
"rs",
"rl = lambda: list(map(int, stdin.readline().split()))",
"rl",
"lambda: list(map(int, stdin.readline().split()))",
"list(map(int, stdin.readline().split()))",
"list",
"map(int, stdin.readline().split())",
"map",
"int",
"stdin.readline().split()",
"stdin.readline().split",
"stdin.readline()",
"stdin.readline",
"stdin",
"readline",
"split",
"rs = lambda: stdin.readline().rstrip()",
"rs",
"lambda: stdin.readline().rstrip()",
"stdin.readline().rstrip()",
"stdin.readline().rstrip",
"stdin.readline()",
"stdin.readline",
"stdin",
"readline",
"rstrip",
"N, T = rl()",
"N",
"rl()",
"rl",
"T",
"A = rl()",
"A",
"rl()",
"rl",
"answer = 1",
"answer",
"1",
"profit = 0",
"profit",
"0",
"min = A[0]",
"min",
"A[0]",
"A",
"0",
"for i in range(1, N):\n if A[i] < min:\n min = A[i]\n continue\n x = A[i] - min\n if x > profit:\n answer = 1\n profit = x\n elif x == profit:\n answer += 1",
"i",
"range(1, N)",
"range",
"1",
"N",
"if A[i] < min:\n min = A[i]\n continue\n ",
"A[i] < min",
"A[i]",
"A",
"i",
"min",
"min = A[i]",
"min",
"A[i]",
"A",
"i",
"continue",
"x = A[i] - min",
"x",
"A[i] - min",
"A[i]",
"A",
"i",
"min",
"if x > profit:\n answer = 1\n profit = x\n elif x == profit:\n answer += 1",
"x > profit",
"x",
"profit",
"answer = 1",
"answer",
"1",
"profit = x",
"profit",
"x",
"elif x == profit:\n answer += 1",
"x == profit",
"x",
"profit",
"answer += 1",
"answer",
"1",
"print(answer)",
"print",
"answer",
"profit = 0",
"0",
"profit",
"answer = 1",
"1",
"answer",
"min = A[i]",
"A[i]",
"min",
"N, T = rl()",
"rl()",
"N",
"answer = 1",
"1",
"answer",
"T = rl()",
"rl()",
"T",
"ri = lambda: int(rs())",
"lambda: int(rs())",
"ri",
"rs = lambda: stdin.readline().rstrip()",
"lambda: stdin.readline().rstrip()",
"rs",
"rl = lambda: list(map(int, stdin.readline().split()))",
"lambda: list(map(int, stdin.readline().split()))",
"rl",
"answer += 1",
"1",
"answer",
"stdin = sys.stdin",
"sys.stdin",
"stdin",
"profit = x",
"x",
"profit",
"min = A[0]",
"A[0]",
"min",
"x = A[i] - min",
"A[i] - min",
"x",
"A = rl()",
"rl()",
"A"
] |
import sys
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip() # ignore trailing spaces
N, T = rl()
A = rl()
answer = 1
profit = 0
min = A[0]
for i in range(1, N):
if A[i] < min:
min = A[i]
continue
x = A[i] - min
if x > profit:
answer = 1
profit = x
elif x == profit:
answer += 1
print(answer)
# 40
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
18,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
18,
13
] |
[
[
76,
2
],
[
76,
11
],
[
15,
14
],
[
14,
23
],
[
79,
25
],
[
82,
28
],
[
80,
30
],
[
70,
33
],
[
37,
36
],
[
68,
39
],
[
71,
42
],
[
80,
46
],
[
36,
47
],
[
83,
48
],
[
74,
48
],
[
73,
50
],
[
83,
53
],
[
74,
53
],
[
80,
55
],
[
36,
56
],
[
71,
61
],
[
71,
65
],
[
76,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
]
] |
[
"n, t = map(int, input().split())\na = [int(x) for x in input().split()]\n\nlowest = a[0]\nd = []\n\nfor i in range(n):\n d.append(a[i]-lowest)\n lowest = min(lowest, a[i])\n\nprint(d.count(max(d)))",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"int(x) for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)",
"int",
"x",
"a = [int(x) for x in input().split()]",
"a",
"[int(x) for x in input().split()]",
"lowest = a[0]",
"lowest",
"a[0]",
"a",
"0",
"d = []",
"d",
"[]",
"for i in range(n):\n d.append(a[i]-lowest)\n lowest = min(lowest, a[i])",
"i",
"range(n)",
"range",
"n",
"d.append(a[i]-lowest)",
"d.append",
"d",
"append",
"a[i]-lowest",
"a[i]",
"a",
"i",
"lowest",
"lowest = min(lowest, a[i])",
"lowest",
"min(lowest, a[i])",
"min",
"lowest",
"a[i]",
"a",
"i",
"print(d.count(max(d)))",
"print",
"d.count(max(d))",
"d.count",
"d",
"count",
"max(d)",
"max",
"d",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"d = []",
"[]",
"d",
"lowest = min(lowest, a[i])",
"min(lowest, a[i])",
"lowest",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"a = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"a",
"lowest = a[0]",
"a[0]",
"lowest"
] |
n, t = map(int, input().split())
a = [int(x) for x in input().split()]
lowest = a[0]
d = []
for i in range(n):
d.append(a[i]-lowest)
lowest = min(lowest, a[i])
print(d.count(max(d)))
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
41,
28,
13,
4,
13,
13,
4,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
4,
13,
18,
18,
4,
13,
4,
18,
13,
13,
0,
13,
17,
17,
17,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
108,
3
],
[
108,
12
],
[
96,
14
],
[
102,
26
],
[
109,
30
],
[
35,
32
],
[
103,
33
],
[
97,
36
],
[
40,
39
],
[
109,
43
],
[
48,
45
],
[
103,
46
],
[
39,
47
],
[
103,
51
],
[
39,
53
],
[
97,
56
],
[
39,
57
],
[
61,
60
],
[
109,
63
],
[
97,
67
],
[
60,
68
],
[
45,
69
],
[
103,
70
],
[
60,
71
],
[
111,
73
],
[
105,
76
],
[
112,
79
],
[
106,
88
],
[
92,
91
],
[
96,
97
],
[
108,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
]
] |
[
"from collections import Counter\n\nn,t = map(int,input().split())\na = list(map(int,input().split()))\na_min = [0] * n\na_min[0] = a[0]\nfor i in range(1,n):\n a_min[i] = min(a_min[i-1],a[i])\n\nprofit = [a[i] - a_min[i] for i in range(n)]\n\ncomb = Counter(profit)\nprint(sorted(comb.items(),reverse = True)[0][1])",
"from collections import Counter",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a_min = [0] * n",
"a_min",
"[0] * n",
"[0]",
"0",
"n",
"a_min[0] = a[0]",
"a_min[0]",
"a_min",
"0",
"a[0]",
"a",
"0",
"for i in range(1,n):\n a_min[i] = min(a_min[i-1],a[i])",
"i",
"range(1,n)",
"range",
"1",
"n",
"a_min[i] = min(a_min[i-1],a[i])",
"a_min[i]",
"a_min",
"i",
"min(a_min[i-1],a[i])",
"min",
"a_min[i-1]",
"a_min",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"a[i] - a_min[i] for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"a[i] - a_min[i]",
"a[i]",
"a",
"i",
"a_min[i]",
"a_min",
"i",
"profit = [a[i] - a_min[i] for i in range(n)]",
"profit",
"[a[i] - a_min[i] for i in range(n)]",
"comb = Counter(profit)",
"comb",
"Counter(profit)",
"Counter",
"profit",
"print(sorted(comb.items(),reverse = True)[0][1])",
"print",
"sorted(comb.items(),reverse = True)[0][1]",
"[0]",
"(comb.items(),reverse = True)",
"sorted",
"comb.items()",
"comb.items",
"comb",
"items",
"reverse = True",
"reverse",
"True",
"0",
"1",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"a_min = [0] * n",
"[0] * n",
"a_min",
"comb = Counter(profit)",
"Counter(profit)",
"comb",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"profit = [a[i] - a_min[i] for i in range(n)]",
"[a[i] - a_min[i] for i in range(n)]",
"profit"
] |
from collections import Counter
n,t = map(int,input().split())
a = list(map(int,input().split()))
a_min = [0] * n
a_min[0] = a[0]
for i in range(1,n):
a_min[i] = min(a_min[i-1],a[i])
profit = [a[i] - a_min[i] for i in range(n)]
comb = Counter(profit)
print(sorted(comb.items(),reverse = True)[0][1])
|
[
7,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
14,
2,
2,
18,
13,
13,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
14,
2,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13
] |
[
[
4,
3
],
[
3,
12
],
[
131,
14
],
[
131,
16
],
[
20,
19
],
[
19,
28
],
[
113,
30
],
[
107,
33
],
[
126,
35
],
[
110,
38
],
[
119,
41
],
[
116,
44
],
[
48,
47
],
[
114,
53
],
[
114,
57
],
[
111,
58
],
[
129,
58
],
[
114,
60
],
[
47,
61
],
[
128,
63
],
[
47,
64
],
[
114,
69
],
[
47,
70
],
[
114,
72
],
[
111,
73
],
[
129,
73
],
[
117,
74
],
[
123,
74
],
[
122,
76
],
[
114,
79
],
[
47,
80
],
[
114,
82
],
[
111,
83
],
[
129,
83
],
[
104,
85
],
[
117,
89
],
[
123,
89
],
[
114,
92
],
[
47,
93
],
[
114,
95
],
[
111,
96
],
[
129,
96
],
[
134,
98
],
[
135,
102
],
[
105,
102
],
[
120,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
],
[
131,
126
],
[
47,
128
],
[
128,
129
],
[
131,
132
],
[
134,
135
]
] |
[
"#入力\nN,T=[int(x) for x in input().split()]\nA=[int(x) for x in input().split()]\n\nmax=N-1\nlow=0\nmaxnum=0\ndif = -1\n\nfor i in range(1,len(A)):\n if(A[low]>A[i]):\n low=i\n else:\n if(A[i] - A[low] > dif):\n dif=A[i] - A[low]\n maxnum=1\n elif(dif==A[i] - A[low]):\n maxnum+=1\n\nprint(maxnum)",
"int(x) for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)",
"int",
"x",
"N,T=[int(x) for x in input().split()]",
"N",
"[int(x) for x in input().split()]",
"T",
"int(x) for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x)",
"int",
"x",
"A=[int(x) for x in input().split()]",
"A",
"[int(x) for x in input().split()]",
"max=N-1",
"max",
"N-1",
"N",
"1",
"low=0",
"low",
"0",
"maxnum=0",
"maxnum",
"0",
"dif = -1",
"dif",
"-1",
"for i in range(1,len(A)):\n if(A[low]>A[i]):\n low=i\n else:\n if(A[i] - A[low] > dif):\n dif=A[i] - A[low]\n maxnum=1\n elif(dif==A[i] - A[low]):\n maxnum+=1",
"i",
"range(1,len(A))",
"range",
"1",
"len(A)",
"len",
"A",
"if(A[low]>A[i]):\n low=i\n else:\n if(A[i] - A[low] > dif):\n dif=A[i] - A[low]\n maxnum=1\n elif(dif==A[i] - A[low]):\n maxnum+=1",
"A[low]>A[i]",
"A[low]",
"A",
"low",
"A[i]",
"A",
"i",
"low=i",
"low",
"i",
"if(A[i] - A[low] > dif):\n dif=A[i] - A[low]\n maxnum=1\n elif(dif==A[i] - A[low]):\n maxnum+=1",
"A[i] - A[low] > dif",
"A[i] - A[low]",
"A[i]",
"A",
"i",
"A[low]",
"A",
"low",
"dif",
"dif=A[i] - A[low]",
"dif",
"A[i] - A[low]",
"A[i]",
"A",
"i",
"A[low]",
"A",
"low",
"maxnum=1",
"maxnum",
"1",
"elif(dif==A[i] - A[low]):\n maxnum+=1",
"dif==A[i] - A[low]",
"dif",
"A[i] - A[low]",
"A[i]",
"A",
"i",
"A[low]",
"A",
"low",
"maxnum+=1",
"maxnum",
"1",
"print(maxnum)",
"print",
"maxnum",
"maxnum=1",
"1",
"maxnum",
"max=N-1",
"N-1",
"max",
"low=0",
"0",
"low",
"A=[int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"A",
"dif = -1",
"-1",
"dif",
"maxnum=0",
"0",
"maxnum",
"dif=A[i] - A[low]",
"A[i] - A[low]",
"dif",
"N,T=[int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"N",
"low=i",
"i",
"low",
"T=[int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"T",
"maxnum+=1",
"1",
"maxnum"
] |
#入力
N,T=[int(x) for x in input().split()]
A=[int(x) for x in input().split()]
max=N-1
low=0
maxnum=0
dif = -1
for i in range(1,len(A)):
if(A[low]>A[i]):
low=i
else:
if(A[i] - A[low] > dif):
dif=A[i] - A[low]
maxnum=1
elif(dif==A[i] - A[low]):
maxnum+=1
print(maxnum)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
39,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
2,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13
] |
[
[
77,
2
],
[
77,
11
],
[
92,
13
],
[
93,
26
],
[
80,
30
],
[
89,
33
],
[
95,
36
],
[
40,
39
],
[
93,
39
],
[
81,
43
],
[
84,
43
],
[
39,
44
],
[
83,
46
],
[
39,
47
],
[
96,
50
],
[
90,
52
],
[
87,
52
],
[
99,
52
],
[
98,
54
],
[
86,
57
],
[
90,
60
],
[
87,
60
],
[
99,
60
],
[
39,
62
],
[
81,
63
],
[
84,
63
],
[
96,
68
],
[
96,
72
],
[
77,
75
],
[
77,
78
],
[
80,
81
],
[
39,
83
],
[
83,
84
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
],
[
98,
99
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\n\n\n#最小値が更新された時にそれまでの利益の最大値を候補としてリストに追加\na.append(0)\nmini = 10e10\nmaxval = 0\nmaxvals = []\nfor x in a:\n if mini > x:\n mini = x\n maxvals.append(maxval)\n maxval = 0\n else:\n maxval = max(maxval, x - mini)\n\nprint(maxvals.count(max(maxvals)))\n#3 2\n#100 50 200",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a.append(0)",
"a.append",
"a",
"append",
"0",
"mini = 10e10",
"mini",
"10e10",
"maxval = 0",
"maxval",
"0",
"maxvals = []",
"maxvals",
"[]",
"for x in a:\n if mini > x:\n mini = x\n maxvals.append(maxval)\n maxval = 0\n else:\n maxval = max(maxval, x - mini)",
"x",
"a",
"if mini > x:\n mini = x\n maxvals.append(maxval)\n maxval = 0\n else:\n maxval = max(maxval, x - mini)",
"mini > x",
"mini",
"x",
"mini = x",
"mini",
"x",
"maxvals.append(maxval)",
"maxvals.append",
"maxvals",
"append",
"maxval",
"maxval = 0",
"maxval",
"0",
"maxval = max(maxval, x - mini)",
"maxval",
"max(maxval, x - mini)",
"max",
"maxval",
"x - mini",
"x",
"mini",
"print(maxvals.count(max(maxvals)))",
"print",
"maxvals.count(max(maxvals))",
"maxvals.count",
"maxvals",
"count",
"max(maxvals)",
"max",
"maxvals",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"mini = 10e10",
"10e10",
"mini",
"mini = x",
"x",
"mini",
"maxval = max(maxval, x - mini)",
"max(maxval, x - mini)",
"maxval",
"maxval = 0",
"0",
"maxval",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"maxvals = []",
"[]",
"maxvals",
"maxval = 0",
"0",
"maxval"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
#最小値が更新された時にそれまでの利益の最大値を候補としてリストに追加
a.append(0)
mini = 10e10
maxval = 0
maxvals = []
for x in a:
if mini > x:
mini = x
maxvals.append(maxval)
maxval = 0
else:
maxval = max(maxval, x - mini)
print(maxvals.count(max(maxvals)))
#3 2
#100 50 200
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
13,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
2,
13,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
13,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
124,
2
],
[
124,
11
],
[
148,
13
],
[
139,
25
],
[
106,
28
],
[
118,
31
],
[
109,
34
],
[
38,
37
],
[
149,
37
],
[
37,
41
],
[
119,
42
],
[
143,
42
],
[
142,
44
],
[
37,
45
],
[
127,
47
],
[
140,
51
],
[
134,
51
],
[
113,
51
],
[
128,
53
],
[
110,
53
],
[
131,
53
],
[
143,
54
],
[
119,
54
],
[
112,
56
],
[
128,
58
],
[
110,
58
],
[
131,
58
],
[
143,
59
],
[
119,
59
],
[
115,
61
],
[
140,
65
],
[
134,
65
],
[
113,
65
],
[
128,
67
],
[
110,
67
],
[
131,
67
],
[
143,
68
],
[
119,
68
],
[
145,
70
],
[
37,
74
],
[
128,
75
],
[
110,
75
],
[
131,
75
],
[
130,
77
],
[
37,
78
],
[
113,
81
],
[
140,
81
],
[
134,
81
],
[
131,
83
],
[
128,
83
],
[
110,
83
],
[
143,
84
],
[
119,
84
],
[
133,
86
],
[
131,
88
],
[
128,
88
],
[
110,
88
],
[
143,
89
],
[
119,
89
],
[
151,
91
],
[
113,
95
],
[
140,
95
],
[
134,
95
],
[
131,
97
],
[
128,
97
],
[
110,
97
],
[
143,
98
],
[
119,
98
],
[
136,
100
],
[
137,
104
],
[
152,
104
],
[
146,
104
],
[
116,
104
],
[
107,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
124,
122
],
[
124,
125
],
[
127,
128
],
[
37,
130
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
37,
142
],
[
142,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\nmax_d = 0\nmax_count = 0\n\ncurrent_min = 999999999\ncurrent_max = 0\n\nfor a in A:\n if a < current_min:\n current_min = a\n current_max = 0\n if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1\n\n if a > current_max:\n current_max = a\n if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1\n\nprint(max_count)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"max_d = 0",
"max_d",
"0",
"max_count = 0",
"max_count",
"0",
"current_min = 999999999",
"current_min",
"999999999",
"current_max = 0",
"current_max",
"0",
"for a in A:\n if a < current_min:\n current_min = a\n current_max = 0\n if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1\n\n if a > current_max:\n current_max = a\n if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1",
"a",
"A",
"if a < current_min:\n current_min = a\n current_max = 0\n if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1\n\n ",
"a < current_min",
"a",
"current_min",
"current_min = a",
"current_min",
"a",
"current_max = 0",
"current_max",
"0",
"if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1\n\n ",
"max_d < (current_max - current_min)",
"max_d",
"current_max - current_min",
"current_max",
"current_min",
"max_d = current_max - current_min",
"max_d",
"current_max - current_min",
"current_max",
"current_min",
"max_count = 1",
"max_count",
"1",
"elif max_d == (current_max - current_min):\n max_count += 1\n\n ",
"max_d == (current_max - current_min)",
"max_d",
"current_max - current_min",
"current_max",
"current_min",
"max_count += 1",
"max_count",
"1",
"if a > current_max:\n current_max = a\n if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1",
"a > current_max",
"a",
"current_max",
"current_max = a",
"current_max",
"a",
"if max_d < (current_max - current_min):\n max_d = current_max - current_min\n max_count = 1\n elif max_d == (current_max - current_min):\n max_count += 1",
"max_d < (current_max - current_min)",
"max_d",
"current_max - current_min",
"current_max",
"current_min",
"max_d = current_max - current_min",
"max_d",
"current_max - current_min",
"current_max",
"current_min",
"max_count = 1",
"max_count",
"1",
"elif max_d == (current_max - current_min):\n max_count += 1",
"max_d == (current_max - current_min)",
"max_d",
"current_max - current_min",
"current_max",
"current_min",
"max_count += 1",
"max_count",
"1",
"print(max_count)",
"print",
"max_count",
"max_count = 0",
"0",
"max_count",
"current_max = 0",
"0",
"current_max",
"max_d = current_max - current_min",
"current_max - current_min",
"max_d",
"max_count = 1",
"1",
"max_count",
"current_min = 999999999",
"999999999",
"current_min",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"current_max = 0",
"0",
"current_max",
"current_max = a",
"a",
"current_max",
"max_d = current_max - current_min",
"current_max - current_min",
"max_d",
"max_count += 1",
"1",
"max_count",
"max_d = 0",
"0",
"max_d",
"current_min = a",
"a",
"current_min",
"max_count += 1",
"1",
"max_count",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"max_count = 1",
"1",
"max_count"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
max_d = 0
max_count = 0
current_min = 999999999
current_max = 0
for a in A:
if a < current_min:
current_min = a
current_max = 0
if max_d < (current_max - current_min):
max_d = current_max - current_min
max_count = 1
elif max_d == (current_max - current_min):
max_count += 1
if a > current_max:
current_max = a
if max_d < (current_max - current_min):
max_d = current_max - current_min
max_count = 1
elif max_d == (current_max - current_min):
max_count += 1
print(max_count)
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
2,
17,
17,
0,
13,
39,
0,
13,
39,
28,
13,
13,
4,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
13,
4,
18,
13,
13,
2,
13,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
41,
28,
13,
13,
4,
13,
13,
13,
2,
13,
13,
4,
13,
4,
13,
4,
13,
10,
4,
13,
10,
39,
13,
10,
13,
13,
10,
2,
13,
10,
39,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
118,
2
],
[
118,
13
],
[
91,
15
],
[
106,
27
],
[
100,
30
],
[
103,
35
],
[
94,
38
],
[
92,
45
],
[
101,
49
],
[
98,
49
],
[
97,
51
],
[
109,
54
],
[
104,
58
],
[
98,
62
],
[
101,
62
],
[
95,
65
],
[
110,
67
],
[
107,
67
],
[
115,
69
],
[
104,
72
],
[
104,
79
],
[
95,
80
],
[
116,
83
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
118,
113
],
[
115,
116
],
[
118,
119
]
] |
[
"N, T = list(map(int, input().split()))\nA = list(map(int, input().split()))\n\nim = 0\nm = 10**20\nB = []\nC = []\nfor i,a in enumerate(A):\n if a<m:\n m=a\n im=i\n B.append(a-m)\n C.append(im)\n\nmaxB = max(B)\nprint(len({c for b,c in zip(B,C) if b==maxB}))",
"N, T = list(map(int, input().split()))",
"N",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"im = 0",
"im",
"0",
"m = 10**20",
"m",
"10**20",
"10",
"20",
"B = []",
"B",
"[]",
"C = []",
"C",
"[]",
"for i,a in enumerate(A):\n if a<m:\n m=a\n im=i\n B.append(a-m)\n C.append(im)",
"i",
"a",
"enumerate(A)",
"enumerate",
"A",
"if a<m:\n m=a\n im=i\n ",
"a<m",
"a",
"m",
"m=a",
"m",
"a",
"im=i",
"im",
"i",
"B.append(a-m)",
"B.append",
"B",
"append",
"a-m",
"a",
"m",
"C.append(im)",
"C.append",
"C",
"append",
"im",
"maxB = max(B)",
"maxB",
"max(B)",
"max",
"B",
"c for b,c in zip(B,C) if b==maxB",
"for b,c in zip(B,C) if b==maxB",
"b",
"c",
"zip(B,C)",
"zip",
"B",
"C",
"b==maxB",
"b",
"maxB",
"if b==maxB",
"c",
"print(len({c for b,c in zip(B,C) if b==maxB}))",
"print",
"len({c for b,c in zip(B,C) if b==maxB})",
"len",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"C = []",
"[]",
"C",
"m=a",
"a",
"m",
"m = 10**20",
"10**20",
"m",
"B = []",
"[]",
"B",
"im = 0",
"0",
"im",
"im=i",
"i",
"im",
"T = list(map(int, input().split()))",
"list(map(int, input().split()))",
"T",
"maxB = max(B)",
"max(B)",
"maxB",
"N, T = list(map(int, input().split()))",
"list(map(int, input().split()))",
"N"
] |
N, T = list(map(int, input().split()))
A = list(map(int, input().split()))
im = 0
m = 10**20
B = []
C = []
for i,a in enumerate(A):
if a<m:
m=a
im=i
B.append(a-m)
C.append(im)
maxB = max(B)
print(len({c for b,c in zip(B,C) if b==maxB}))
|
[
7,
15,
13,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
31,
13,
12,
13,
0,
13,
39,
0,
13,
18,
13,
17,
28,
13,
18,
13,
39,
17,
4,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
13,
4,
18,
13,
13,
0,
13,
2,
2,
13,
4,
13,
13,
18,
13,
17,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13
] |
[
[
82,
5
],
[
82,
18
],
[
82,
19
],
[
25,
24
],
[
28,
27
],
[
33,
32
],
[
24,
39
],
[
32,
42
],
[
27,
43
],
[
45,
43
],
[
46,
45
],
[
27,
48
],
[
45,
48
],
[
32,
49
],
[
24,
52
],
[
56,
55
],
[
83,
58
],
[
24,
61
],
[
24,
63
],
[
55,
68
],
[
77,
74
],
[
82,
80
],
[
82,
83
]
] |
[
"import sys\nfrom bisect import bisect_left as bi_l\n\nn, t, *a = map(int, sys.stdin.read().split())\n\ndef main():\n cand = []\n mi = a[0]\n for x in a[1:]:\n cand.append(x - mi)\n mi = min(mi, x)\n cand.sort() \n ans = n - bi_l(cand, cand[-1]) - 1\n print(ans)\n \nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"from bisect import bisect_left as bi_l",
"n, t, *a = map(int, sys.stdin.read().split())",
"n",
"map(int, sys.stdin.read().split())",
"map",
"int",
"sys.stdin.read().split()",
"sys.stdin.read().split",
"sys.stdin.read()",
"sys.stdin.read",
"sys.stdin",
"sys",
"stdin",
"read",
"split",
"t",
"*a",
"a",
"def main():\n cand = []\n mi = a[0]\n for x in a[1:]:\n cand.append(x - mi)\n mi = min(mi, x)\n cand.sort() \n ans = n - bi_l(cand, cand[-1]) - 1\n print(ans)\n ",
"main",
"cand = []",
"cand",
"[]",
"mi = a[0]",
"mi",
"a[0]",
"a",
"0",
"for x in a[1:]:\n cand.append(x - mi)\n mi = min(mi, x)\n ",
"x",
"a[1:]",
"a",
"1:",
"1",
"cand.append(x - mi)",
"cand.append",
"cand",
"append",
"x - mi",
"x",
"mi",
"mi = min(mi, x)",
"mi",
"min(mi, x)",
"min",
"mi",
"x",
"cand.sort()",
"cand.sort",
"cand",
"sort",
"ans = n - bi_l(cand, cand[-1]) - 1",
"ans",
"n - bi_l(cand, cand[-1]) - 1",
"n - bi_l(cand, cand[-1])",
"n",
"bi_l(cand, cand[-1])",
"bi_l",
"cand",
"cand[-1]",
"cand",
"-1",
"1",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n cand = []\n mi = a[0]\n for x in a[1:]:\n cand.append(x - mi)\n mi = min(mi, x)\n cand.sort() \n ans = n - bi_l(cand, cand[-1]) - 1\n print(ans)\n ",
"def main():\n cand = []\n mi = a[0]\n for x in a[1:]:\n cand.append(x - mi)\n mi = min(mi, x)\n cand.sort() \n ans = n - bi_l(cand, cand[-1]) - 1\n print(ans)\n ",
"main",
"t, *a = map(int, sys.stdin.read().split())",
"map(int, sys.stdin.read().split())",
"t",
"n, t, *a = map(int, sys.stdin.read().split())",
"map(int, sys.stdin.read().split())",
"n"
] |
import sys
from bisect import bisect_left as bi_l
n, t, *a = map(int, sys.stdin.read().split())
def main():
cand = []
mi = a[0]
for x in a[1:]:
cand.append(x - mi)
mi = min(mi, x)
cand.sort()
ans = n - bi_l(cand, cand[-1]) - 1
print(ans)
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
40,
2,
18,
13,
13,
13,
13,
0,
18,
13,
2,
18,
13,
13,
13,
17,
0,
18,
13,
2,
18,
13,
13,
13,
17,
0,
13,
4,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
18,
18,
13,
17,
17,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13
] |
[
[
114,
2
],
[
114,
11
],
[
102,
13
],
[
108,
25
],
[
111,
28
],
[
103,
30
],
[
34,
33
],
[
115,
36
],
[
103,
40
],
[
33,
41
],
[
112,
42
],
[
97,
42
],
[
96,
44
],
[
103,
46
],
[
33,
47
],
[
103,
52
],
[
33,
53
],
[
97,
54
],
[
112,
54
],
[
109,
55
],
[
64,
57
],
[
109,
58
],
[
103,
61
],
[
33,
62
],
[
97,
63
],
[
112,
63
],
[
73,
66
],
[
109,
67
],
[
103,
70
],
[
33,
71
],
[
97,
72
],
[
112,
72
],
[
105,
75
],
[
109,
80
],
[
84,
83
],
[
117,
86
],
[
106,
89
],
[
118,
94
],
[
96,
97
],
[
114,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
]
] |
[
"N,T = map(int,input().split())\nList = list(map(int,input().split()))\ndic = {}\nmin = List[0]\nfor i in range(N):\n if List[i]<min:\n min = List[i]\n if List[i]-min not in dic:\n dic[List[i]-min] = 1\n else:\n dic[List[i]-min] += 1\ndic2 = sorted(dic.items(), reverse=True)\nAnswer = dic2[0][1]\nprint(Answer)",
"N,T = map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"List = list(map(int,input().split()))",
"List",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"dic = {}",
"dic",
"{}",
"min = List[0]",
"min",
"List[0]",
"List",
"0",
"for i in range(N):\n if List[i]<min:\n min = List[i]\n if List[i]-min not in dic:\n dic[List[i]-min] = 1\n else:\n dic[List[i]-min] += 1",
"i",
"range(N)",
"range",
"N",
"if List[i]<min:\n min = List[i]\n ",
"List[i]<min",
"List[i]",
"List",
"i",
"min",
"min = List[i]",
"min",
"List[i]",
"List",
"i",
"if List[i]-min not in dic:\n dic[List[i]-min] = 1\n else:\n dic[List[i]-min] += 1",
"List[i]-min not in dic",
"List[i]-min",
"List[i]",
"List",
"i",
"min",
"dic",
"dic[List[i]-min] = 1",
"dic[List[i]-min]",
"dic",
"List[i]-min",
"List[i]",
"List",
"i",
"min",
"1",
"dic[List[i]-min] += 1",
"dic[List[i]-min]",
"dic",
"List[i]-min",
"List[i]",
"List",
"i",
"min",
"1",
"dic2 = sorted(dic.items(), reverse=True)",
"dic2",
"sorted(dic.items(), reverse=True)",
"sorted",
"dic.items()",
"dic.items",
"dic",
"items",
"reverse=True",
"reverse",
"True",
"Answer = dic2[0][1]",
"Answer",
"dic2[0][1]",
"[0]",
"dic2",
"0",
"1",
"print(Answer)",
"print",
"Answer",
"min = List[i]",
"List[i]",
"min",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"List = list(map(int,input().split()))",
"list(map(int,input().split()))",
"List",
"dic2 = sorted(dic.items(), reverse=True)",
"sorted(dic.items(), reverse=True)",
"dic2",
"dic = {}",
"{}",
"dic",
"min = List[0]",
"List[0]",
"min",
"N,T = map(int,input().split())",
"map(int,input().split())",
"N",
"Answer = dic2[0][1]",
"dic2[0][1]",
"Answer"
] |
N,T = map(int,input().split())
List = list(map(int,input().split()))
dic = {}
min = List[0]
for i in range(N):
if List[i]<min:
min = List[i]
if List[i]-min not in dic:
dic[List[i]-min] = 1
else:
dic[List[i]-min] += 1
dic2 = sorted(dic.items(), reverse=True)
Answer = dic2[0][1]
print(Answer)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
13,
17,
28,
13,
18,
4,
13,
13,
39,
17,
14,
2,
13,
2,
13,
17,
0,
18,
13,
13,
39,
18,
13,
13,
17,
9,
0,
13,
18,
13,
2,
13,
17,
13,
14,
2,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
18,
13,
13,
39,
13,
2,
13,
17,
0,
18,
13,
13,
39,
18,
13,
13,
17,
0,
13,
4,
13,
13,
2,
18,
18,
13,
13,
17,
18,
13,
13,
0,
13,
4,
13,
28,
13,
39,
13,
13,
4,
13,
13,
13,
14,
2,
2,
13,
13,
13,
14,
2,
39,
13,
13,
13,
0,
13,
18,
13,
39,
13,
13,
13,
0,
18,
13,
39,
13,
13,
39,
2,
13,
17,
4,
13,
13,
13,
0,
18,
13,
39,
13,
13,
39,
17,
13,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
0,
13,
13,
13,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13
] |
[
[
219,
2
],
[
219,
11
],
[
231,
13
],
[
198,
25
],
[
220,
29
],
[
222,
31
],
[
35,
34
],
[
220,
38
],
[
34,
43
],
[
220,
45
],
[
51,
48
],
[
199,
49
],
[
34,
50
],
[
232,
53
],
[
34,
54
],
[
225,
58
],
[
199,
60
],
[
34,
62
],
[
225,
64
],
[
217,
67
],
[
232,
69
],
[
34,
70
],
[
75,
72
],
[
199,
73
],
[
34,
74
],
[
199,
76
],
[
34,
78
],
[
217,
82
],
[
232,
84
],
[
34,
85
],
[
90,
87
],
[
199,
88
],
[
34,
89
],
[
226,
93
],
[
99,
96
],
[
199,
97
],
[
34,
98
],
[
232,
101
],
[
34,
102
],
[
234,
105
],
[
223,
108
],
[
235,
108
],
[
96,
111
],
[
87,
111
],
[
72,
111
],
[
48,
111
],
[
199,
112
],
[
34,
113
],
[
232,
116
],
[
34,
117
],
[
201,
119
],
[
232,
129
],
[
199,
130
],
[
235,
136
],
[
223,
136
],
[
202,
142
],
[
237,
144
],
[
202,
146
],
[
237,
150
],
[
157,
152
],
[
202,
153
],
[
238,
159
],
[
229,
163
],
[
171,
166
],
[
202,
167
],
[
213,
175
],
[
202,
182
],
[
240,
185
],
[
240,
187
],
[
207,
189
],
[
241,
192
],
[
238,
192
],
[
205,
193
],
[
229,
193
],
[
208,
196
],
[
214,
196
],
[
198,
199
],
[
201,
202
],
[
240,
205
],
[
207,
208
],
[
219,
211
],
[
213,
214
],
[
225,
217
],
[
219,
220
],
[
222,
223
],
[
225,
226
],
[
237,
229
],
[
231,
232
],
[
234,
235
],
[
237,
238
],
[
240,
241
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\nMax = [0] * N\nrevenue = 0\nfor i in range(N)[::-1]:\n if i == N-1:\n Max[i] = (A[i], 1)\n continue\n ma, cnt = Max[i+1]\n if ma > A[i]:\n Max[i] = Max[i+1]\n elif ma == A[i]:\n Max[i] = (ma, cnt + 1)\n else:\n Max[i] = (A[i], 1)\n revenue = max(revenue, Max[i][0] - A[i])\n\nD = dict()\n\nfor a, (m, c) in zip(A, Max):\n if m - a == revenue:\n if (m, a) in D:\n x, y = D[(m, a)]\n D[(m, a)] = (x + 1, max(y, c))\n else:\n D[(m, a)] = (1, c)\n\nans = 0\nfor key, value in D.items():\n x, y = value\n ans += min(x, y)\nprint(ans)",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"Max = [0] * N",
"Max",
"[0] * N",
"[0]",
"0",
"N",
"revenue = 0",
"revenue",
"0",
"for i in range(N)[::-1]:\n if i == N-1:\n Max[i] = (A[i], 1)\n continue\n ma, cnt = Max[i+1]\n if ma > A[i]:\n Max[i] = Max[i+1]\n elif ma == A[i]:\n Max[i] = (ma, cnt + 1)\n else:\n Max[i] = (A[i], 1)\n revenue = max(revenue, Max[i][0] - A[i])",
"i",
"range(N)[::-1]",
"(N)",
"range",
"N",
"::-1",
"-1",
"if i == N-1:\n Max[i] = (A[i], 1)\n continue\n ",
"i == N-1",
"i",
"N-1",
"N",
"1",
"Max[i] = (A[i], 1)",
"Max[i]",
"Max",
"i",
"(A[i], 1)",
"A[i]",
"A",
"i",
"1",
"continue",
"ma, cnt = Max[i+1]",
"ma",
"Max[i+1]",
"Max",
"i+1",
"i",
"1",
"cnt",
"if ma > A[i]:\n Max[i] = Max[i+1]\n elif ma == A[i]:\n Max[i] = (ma, cnt + 1)\n else:\n Max[i] = (A[i], 1)\n ",
"ma > A[i]",
"ma",
"A[i]",
"A",
"i",
"Max[i] = Max[i+1]",
"Max[i]",
"Max",
"i",
"Max[i+1]",
"Max",
"i+1",
"i",
"1",
"elif ma == A[i]:\n Max[i] = (ma, cnt + 1)\n ",
"ma == A[i]",
"ma",
"A[i]",
"A",
"i",
"Max[i] = (ma, cnt + 1)",
"Max[i]",
"Max",
"i",
"(ma, cnt + 1)",
"ma",
"cnt + 1",
"cnt",
"1",
"Max[i] = (A[i], 1)",
"Max[i]",
"Max",
"i",
"(A[i], 1)",
"A[i]",
"A",
"i",
"1",
"revenue = max(revenue, Max[i][0] - A[i])",
"revenue",
"max(revenue, Max[i][0] - A[i])",
"max",
"revenue",
"Max[i][0] - A[i]",
"Max[i][0]",
"[i]",
"Max",
"i",
"0",
"A[i]",
"A",
"i",
"D = dict()",
"D",
"dict()",
"dict",
"for a, (m, c) in zip(A, Max):\n if m - a == revenue:\n if (m, a) in D:\n x, y = D[(m, a)]\n D[(m, a)] = (x + 1, max(y, c))\n else:\n D[(m, a)] = (1, c)",
"a",
"(m, c)",
"m",
"c",
"zip(A, Max)",
"zip",
"A",
"Max",
"if m - a == revenue:\n if (m, a) in D:\n x, y = D[(m, a)]\n D[(m, a)] = (x + 1, max(y, c))\n else:\n D[(m, a)] = (1, c)",
"m - a == revenue",
"m - a",
"m",
"a",
"revenue",
"if (m, a) in D:\n x, y = D[(m, a)]\n D[(m, a)] = (x + 1, max(y, c))\n else:\n D[(m, a)] = (1, c)",
"(m, a) in D",
"(m, a)",
"m",
"a",
"D",
"x, y = D[(m, a)]",
"x",
"D[(m, a)]",
"D",
"(m, a)",
"m",
"a",
"y",
"D[(m, a)] = (x + 1, max(y, c))",
"D[(m, a)]",
"D",
"(m, a)",
"m",
"a",
"(x + 1, max(y, c))",
"x + 1",
"x",
"1",
"max(y, c)",
"max",
"y",
"c",
"D[(m, a)] = (1, c)",
"D[(m, a)]",
"D",
"(m, a)",
"m",
"a",
"(1, c)",
"1",
"c",
"ans = 0",
"ans",
"0",
"for key, value in D.items():\n x, y = value\n ans += min(x, y)",
"key",
"value",
"D.items()",
"D.items",
"D",
"items",
"x, y = value",
"x",
"value",
"y",
"ans += min(x, y)",
"ans",
"min(x, y)",
"min",
"x",
"y",
"print(ans)",
"print",
"ans",
"Max = [0] * N",
"[0] * N",
"Max",
"D = dict()",
"dict()",
"D",
"y = value",
"value",
"y",
"ans += min(x, y)",
"min(x, y)",
"ans",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"ans = 0",
"0",
"ans",
"ma, cnt = Max[i+1]",
"Max[i+1]",
"ma",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"revenue = 0",
"0",
"revenue",
"cnt = Max[i+1]",
"Max[i+1]",
"cnt",
"y = D[(m, a)]",
"D[(m, a)]",
"y",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"revenue = max(revenue, Max[i][0] - A[i])",
"max(revenue, Max[i][0] - A[i])",
"revenue",
"x, y = D[(m, a)]",
"D[(m, a)]",
"x",
"x, y = value",
"value",
"x"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
Max = [0] * N
revenue = 0
for i in range(N)[::-1]:
if i == N-1:
Max[i] = (A[i], 1)
continue
ma, cnt = Max[i+1]
if ma > A[i]:
Max[i] = Max[i+1]
elif ma == A[i]:
Max[i] = (ma, cnt + 1)
else:
Max[i] = (A[i], 1)
revenue = max(revenue, Max[i][0] - A[i])
D = dict()
for a, (m, c) in zip(A, Max):
if m - a == revenue:
if (m, a) in D:
x, y = D[(m, a)]
D[(m, a)] = (x + 1, max(y, c))
else:
D[(m, a)] = (1, c)
ans = 0
for key, value in D.items():
x, y = value
ans += min(x, y)
print(ans)
|
[
7,
15,
13,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
4,
18,
13,
13,
17,
15,
15,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
40,
13,
17,
4,
13,
18,
13,
2,
40,
13,
17,
18,
13,
40,
13,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
14,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
2,
13,
10,
12,
13,
10,
2,
13
] |
[
[
186,
4
],
[
180,
9
],
[
26,
25
],
[
26,
34
],
[
37,
36
],
[
49,
48
],
[
25,
52
],
[
55,
54
],
[
25,
58
],
[
63,
60
],
[
48,
61
],
[
36,
64
],
[
70,
67
],
[
54,
68
],
[
36,
71
],
[
75,
74
],
[
25,
78
],
[
83,
80
],
[
48,
81
],
[
74,
82
],
[
36,
86
],
[
74,
87
],
[
48,
89
],
[
74,
91
],
[
100,
94
],
[
54,
95
],
[
74,
98
],
[
36,
103
],
[
74,
106
],
[
54,
109
],
[
74,
111
],
[
114,
113
],
[
117,
116
],
[
25,
120
],
[
123,
122
],
[
113,
125
],
[
122,
125
],
[
54,
128
],
[
116,
129
],
[
48,
131
],
[
116,
133
],
[
137,
136
],
[
140,
139
],
[
143,
142
],
[
25,
146
],
[
122,
149
],
[
113,
149
],
[
54,
152
],
[
142,
153
],
[
48,
155
],
[
142,
157
],
[
163,
162
],
[
166,
165
],
[
169,
168
],
[
162,
172
],
[
136,
172
],
[
184,
178
],
[
180,
181
],
[
186,
187
]
] |
[
"import sys\nINF = 10**10\nMOD = 10**9 + 7\nsys.setrecursionlimit(100000000)\nfrom functools import lru_cache\nfrom itertools import permutations\n\ndef main():\n n,t = map(int,input().split())\n a = list(map(int,input().split()))\n\n cummin = [0] * n\n cummax = [0] * n\n cummin[0] = a[0]\n cummax[-1] = a[-1]\n for i in range(1,n):\n cummin[i] = min(a[i],cummin[i - 1])\n cummax[- i - 1] = max(a[- i - 1],cummax[-i])\n \n ben = 0 \n for i in range(1,n):\n ben = max(ben,cummax[i] - cummin[i - 1])\n \n cnt = 0\n flag = True\n for i in range(1,n):\n if ben == cummax[i] - cummin[i - 1]:\n if flag:\n cnt += 1\n flag = False\n \n else:\n flag = True\n \n print(cnt)\n\nif __name__=='__main__':\n main() ",
"import sys",
"sys",
"INF = 10**10",
"INF",
"10**10",
"10",
"10",
"MOD = 10**9 + 7",
"MOD",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"sys.setrecursionlimit(100000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"100000000",
"from functools import lru_cache",
"from itertools import permutations",
"def main():\n n,t = map(int,input().split())\n a = list(map(int,input().split()))\n\n cummin = [0] * n\n cummax = [0] * n\n cummin[0] = a[0]\n cummax[-1] = a[-1]\n for i in range(1,n):\n cummin[i] = min(a[i],cummin[i - 1])\n cummax[- i - 1] = max(a[- i - 1],cummax[-i])\n \n ben = 0 \n for i in range(1,n):\n ben = max(ben,cummax[i] - cummin[i - 1])\n \n cnt = 0\n flag = True\n for i in range(1,n):\n if ben == cummax[i] - cummin[i - 1]:\n if flag:\n cnt += 1\n flag = False\n \n else:\n flag = True\n \n print(cnt)",
"main",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"cummin = [0] * n",
"cummin",
"[0] * n",
"[0]",
"0",
"n",
"cummax = [0] * n",
"cummax",
"[0] * n",
"[0]",
"0",
"n",
"cummin[0] = a[0]",
"cummin[0]",
"cummin",
"0",
"a[0]",
"a",
"0",
"cummax[-1] = a[-1]",
"cummax[-1]",
"cummax",
"-1",
"a[-1]",
"a",
"-1",
"for i in range(1,n):\n cummin[i] = min(a[i],cummin[i - 1])\n cummax[- i - 1] = max(a[- i - 1],cummax[-i])\n \n ",
"i",
"range(1,n)",
"range",
"1",
"n",
"cummin[i] = min(a[i],cummin[i - 1])",
"cummin[i]",
"cummin",
"i",
"min(a[i],cummin[i - 1])",
"min",
"a[i]",
"a",
"i",
"cummin[i - 1]",
"cummin",
"i - 1",
"i",
"1",
"cummax[- i - 1] = max(a[- i - 1],cummax[-i])",
"cummax[- i - 1]",
"cummax",
"- i - 1",
"- i",
"i",
"1",
"max(a[- i - 1],cummax[-i])",
"max",
"a[- i - 1]",
"a",
"- i - 1",
"- i",
"i",
"1",
"cummax[-i]",
"cummax",
"-i",
"i",
"ben = 0",
"ben",
"0",
"for i in range(1,n):\n ben = max(ben,cummax[i] - cummin[i - 1])\n \n ",
"i",
"range(1,n)",
"range",
"1",
"n",
"ben = max(ben,cummax[i] - cummin[i - 1])",
"ben",
"max(ben,cummax[i] - cummin[i - 1])",
"max",
"ben",
"cummax[i] - cummin[i - 1]",
"cummax[i]",
"cummax",
"i",
"cummin[i - 1]",
"cummin",
"i - 1",
"i",
"1",
"cnt = 0",
"cnt",
"0",
"flag = True",
"flag",
"True",
"for i in range(1,n):\n if ben == cummax[i] - cummin[i - 1]:\n if flag:\n cnt += 1\n flag = False\n \n else:\n flag = True\n \n ",
"i",
"range(1,n)",
"range",
"1",
"n",
"if ben == cummax[i] - cummin[i - 1]:\n if flag:\n cnt += 1\n flag = False\n \n else:\n flag = True\n \n ",
"ben == cummax[i] - cummin[i - 1]",
"ben",
"cummax[i] - cummin[i - 1]",
"cummax[i]",
"cummax",
"i",
"cummin[i - 1]",
"cummin",
"i - 1",
"i",
"1",
"if flag:\n cnt += 1\n flag = False\n \n ",
"flag",
"cnt += 1",
"cnt",
"1",
"flag = False",
"flag",
"False",
"flag = True",
"flag",
"True",
"print(cnt)",
"print",
"cnt",
"if __name__=='__main__':\n main() ",
"__name__=='__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"MOD = 10**9 + 7",
"10**9 + 7",
"MOD",
"def main():\n n,t = map(int,input().split())\n a = list(map(int,input().split()))\n\n cummin = [0] * n\n cummax = [0] * n\n cummin[0] = a[0]\n cummax[-1] = a[-1]\n for i in range(1,n):\n cummin[i] = min(a[i],cummin[i - 1])\n cummax[- i - 1] = max(a[- i - 1],cummax[-i])\n \n ben = 0 \n for i in range(1,n):\n ben = max(ben,cummax[i] - cummin[i - 1])\n \n cnt = 0\n flag = True\n for i in range(1,n):\n if ben == cummax[i] - cummin[i - 1]:\n if flag:\n cnt += 1\n flag = False\n \n else:\n flag = True\n \n print(cnt)",
"def main():\n n,t = map(int,input().split())\n a = list(map(int,input().split()))\n\n cummin = [0] * n\n cummax = [0] * n\n cummin[0] = a[0]\n cummax[-1] = a[-1]\n for i in range(1,n):\n cummin[i] = min(a[i],cummin[i - 1])\n cummax[- i - 1] = max(a[- i - 1],cummax[-i])\n \n ben = 0 \n for i in range(1,n):\n ben = max(ben,cummax[i] - cummin[i - 1])\n \n cnt = 0\n flag = True\n for i in range(1,n):\n if ben == cummax[i] - cummin[i - 1]:\n if flag:\n cnt += 1\n flag = False\n \n else:\n flag = True\n \n print(cnt)",
"main",
"INF = 10**10",
"10**10",
"INF"
] |
import sys
INF = 10**10
MOD = 10**9 + 7
sys.setrecursionlimit(100000000)
from functools import lru_cache
from itertools import permutations
def main():
n,t = map(int,input().split())
a = list(map(int,input().split()))
cummin = [0] * n
cummax = [0] * n
cummin[0] = a[0]
cummax[-1] = a[-1]
for i in range(1,n):
cummin[i] = min(a[i],cummin[i - 1])
cummax[- i - 1] = max(a[- i - 1],cummax[-i])
ben = 0
for i in range(1,n):
ben = max(ben,cummax[i] - cummin[i - 1])
cnt = 0
flag = True
for i in range(1,n):
if ben == cummax[i] - cummin[i - 1]:
if flag:
cnt += 1
flag = False
else:
flag = True
print(cnt)
if __name__=='__main__':
main()
|
[
7,
15,
15,
6,
13,
12,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
2,
39,
18,
13,
13,
2,
17,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
13,
12,
13,
28,
13,
4,
13,
18,
13,
13,
0,
18,
18,
13,
13,
2,
2,
13,
18,
13,
13,
17,
18,
13,
13,
28,
13,
18,
4,
13,
2,
18,
13,
13,
17,
39,
17,
0,
18,
18,
13,
13,
13,
4,
18,
13,
13,
18,
18,
13,
13,
2,
2,
17,
13,
17,
18,
18,
13,
13,
2,
2,
17,
13,
17,
23,
13,
23,
13,
12,
13,
0,
13,
2,
18,
13,
13,
17,
0,
18,
18,
13,
13,
13,
13,
42,
40,
13,
17,
0,
13,
2,
2,
13,
17,
17,
0,
18,
18,
13,
13,
13,
4,
18,
13,
13,
18,
18,
13,
13,
2,
2,
17,
13,
17,
18,
18,
13,
13,
2,
2,
17,
13,
17,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
42,
2,
13,
13,
14,
2,
13,
17,
0,
13,
4,
18,
13,
13,
13,
18,
18,
13,
13,
2,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
17,
0,
13,
4,
18,
13,
13,
13,
18,
18,
13,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
29,
13,
23,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
31,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
17,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
2,
13,
17,
0,
18,
13,
2,
4,
18,
13,
13,
2,
13,
17,
13,
18,
13,
13,
17,
4,
13,
18,
13,
4,
13,
4,
18,
13,
13,
10,
6,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
11,
8
],
[
35,
9
],
[
39,
10
],
[
39,
11
],
[
16,
13
],
[
35,
14
],
[
37,
16
],
[
21,
18
],
[
35,
19
],
[
35,
24
],
[
39,
25
],
[
37,
28
],
[
33,
30
],
[
35,
31
],
[
41,
32
],
[
41,
33
],
[
35,
35
],
[
37,
37
],
[
39,
39
],
[
42,
41
],
[
47,
46
],
[
108,
50
],
[
64,
53
],
[
108,
55
],
[
46,
59
],
[
108,
61
],
[
110,
65
],
[
46,
66
],
[
69,
68
],
[
108,
74
],
[
85,
80
],
[
108,
82
],
[
68,
84
],
[
108,
87
],
[
108,
91
],
[
68,
96
],
[
108,
100
],
[
68,
105
],
[
108,
108
],
[
110,
110
],
[
115,
114
],
[
167,
117
],
[
126,
121
],
[
167,
123
],
[
114,
125
],
[
169,
125
],
[
171,
126
],
[
114,
129
],
[
169,
129
],
[
132,
129
],
[
133,
132
],
[
114,
135
],
[
169,
135
],
[
132,
135
],
[
144,
139
],
[
167,
141
],
[
132,
143
],
[
114,
143
],
[
169,
143
],
[
167,
146
],
[
167,
150
],
[
132,
155
],
[
114,
155
],
[
169,
155
],
[
167,
159
],
[
132,
164
],
[
114,
164
],
[
169,
164
],
[
167,
167
],
[
169,
169
],
[
171,
171
],
[
176,
175
],
[
244,
177
],
[
181,
180
],
[
244,
182
],
[
186,
185
],
[
244,
187
],
[
180,
191
],
[
246,
191
],
[
236,
191
],
[
212,
191
],
[
185,
192
],
[
248,
192
],
[
239,
192
],
[
219,
192
],
[
180,
195
],
[
246,
195
],
[
236,
195
],
[
212,
195
],
[
199,
198
],
[
244,
201
],
[
175,
203
],
[
222,
203
],
[
198,
203
],
[
244,
206
],
[
180,
209
],
[
246,
209
],
[
236,
209
],
[
212,
209
],
[
213,
212
],
[
185,
216
],
[
248,
216
],
[
239,
216
],
[
219,
216
],
[
220,
219
],
[
223,
222
],
[
244,
225
],
[
198,
227
],
[
175,
227
],
[
222,
227
],
[
244,
230
],
[
219,
233
],
[
185,
233
],
[
248,
233
],
[
239,
233
],
[
237,
236
],
[
240,
239
],
[
222,
242
],
[
198,
242
],
[
175,
242
],
[
244,
244
],
[
246,
246
],
[
248,
248
],
[
334,
250
],
[
334,
259
],
[
263,
261
],
[
331,
272
],
[
329,
275
],
[
332,
280
],
[
44,
281
],
[
325,
284
],
[
290,
289
],
[
329,
293
],
[
310,
296
],
[
326,
297
],
[
332,
301
],
[
173,
302
],
[
289,
304
],
[
329,
306
],
[
289,
309
],
[
326,
314
],
[
326,
319
],
[
325,
326
],
[
334,
329
],
[
331,
332
],
[
334,
335
]
] |
[
"from operator import add\nfrom collections import defaultdict\n\nclass SegTree():\n def __init__(self, N, e, operator_func=add):\n self.e = e # 単位元\n self.size = N\n self.node = [self.e] * (2*N)\n self.operator_func = operator_func # 処理(add or xor max minなど)\n\n def set_list(self, l):\n for i in range(self.size):\n self.node[i+self.size-1] = l[i]\n for i in range(self.size-1)[::-1]:\n self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])\n \n def update(self, k, x):\n k += self.size-1\n self.node[k] = x\n while k >= 0:\n k = (k - 1) // 2\n self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])\n\n def get(self, l, r):\n # [l, r) についてqueryを求める\n x = self.e\n l += self.size\n r += self.size\n\n while l<r:\n if l&1:\n x = self.operator_func(x, self.node[l-1])\n l += 1\n if r&1:\n r -= 1\n x = self.operator_func(x, self.node[r-1])\n l >>= 1\n r >>= 1\n return x\n\nN, T = map(int, input().split())\n*A, = map(int, input().split())\ntree = SegTree(N, 0, max)\ntree.set_list(A)\nd = defaultdict(int)\nfor i in range(N-1):\n d[(tree.get(i+1, N)-A[i])] += 1\nprint(d[max(d.keys())])",
"from operator import add",
"from collections import defaultdict",
"class SegTree():\n def __init__(self, N, e, operator_func=add):\n self.e = e # 単位元\n self.size = N\n self.node = [self.e] * (2*N)\n self.operator_func = operator_func # 処理(add or xor max minなど)\n\n def set_list(self, l):\n for i in range(self.size):\n self.node[i+self.size-1] = l[i]\n for i in range(self.size-1)[::-1]:\n self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])\n \n def update(self, k, x):\n k += self.size-1\n self.node[k] = x\n while k >= 0:\n k = (k - 1) // 2\n self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])\n\n def get(self, l, r):\n # [l, r) についてqueryを求める\n x = self.e\n l += self.size\n r += self.size\n\n while l<r:\n if l&1:\n x = self.operator_func(x, self.node[l-1])\n l += 1\n if r&1:\n r -= 1\n x = self.operator_func(x, self.node[r-1])\n l >>= 1\n r >>= 1\n return x",
"SegTree",
"def __init__(self, N, e, operator_func=add):\n self.e = e # 単位元\n self.size = N\n self.node = [self.e] * (2*N)\n self.operator_func = operator_func # 処理(add or xor max minなど)\n\n ",
"__init__",
"self.e = e",
"self.e",
"self",
"e",
"e",
"self.size = N",
"self.size",
"self",
"size",
"N",
"self.node = [self.e] * (2*N)",
"self.node",
"self",
"node",
"[self.e] * (2*N)",
"[self.e]",
"self.e",
"self",
"e",
"2*N",
"2",
"N",
"self.operator_func = operator_func",
"self.operator_func",
"self",
"operator_func",
"operator_func",
"self",
"self",
"N",
"N",
"e",
"e",
"operator_func=add",
"operator_func",
"add",
"def set_list(self, l):\n for i in range(self.size):\n self.node[i+self.size-1] = l[i]\n for i in range(self.size-1)[::-1]:\n self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])\n \n ",
"set_list",
"for i in range(self.size):\n self.node[i+self.size-1] = l[i]\n ",
"i",
"range(self.size)",
"range",
"self.size",
"self",
"size",
"self.node[i+self.size-1] = l[i]",
"self.node[i+self.size-1]",
"self.node",
"self",
"node",
"i+self.size-1",
"i+self.size",
"i",
"self.size",
"self",
"size",
"1",
"l[i]",
"l",
"i",
"for i in range(self.size-1)[::-1]:\n self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])\n \n ",
"i",
"range(self.size-1)[::-1]",
"(self.size-1)",
"range",
"self.size-1",
"self.size",
"self",
"size",
"1",
"::-1",
"-1",
"self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])",
"self.node[i]",
"self.node",
"self",
"node",
"i",
"self.operator_func(self.node[2*i+1], self.node[2*i+2])",
"self.operator_func",
"self",
"operator_func",
"self.node[2*i+1]",
"self.node",
"self",
"node",
"2*i+1",
"2*i",
"2",
"i",
"1",
"self.node[2*i+2]",
"self.node",
"self",
"node",
"2*i+2",
"2*i",
"2",
"i",
"2",
"self",
"self",
"l",
"l",
"def update(self, k, x):\n k += self.size-1\n self.node[k] = x\n while k >= 0:\n k = (k - 1) // 2\n self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])\n\n ",
"update",
"k += self.size-1",
"k",
"self.size-1",
"self.size",
"self",
"size",
"1",
"self.node[k] = x",
"self.node[k]",
"self.node",
"self",
"node",
"k",
"x",
"while k >= 0:\n k = (k - 1) // 2\n self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])\n\n ",
"k >= 0",
"k",
"0",
"k = (k - 1) // 2",
"k",
"(k - 1) // 2",
"k - 1",
"k",
"1",
"2",
"self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])",
"self.node[k]",
"self.node",
"self",
"node",
"k",
"self.operator_func(self.node[2*k+1], self.node[2*k+2])",
"self.operator_func",
"self",
"operator_func",
"self.node[2*k+1]",
"self.node",
"self",
"node",
"2*k+1",
"2*k",
"2",
"k",
"1",
"self.node[2*k+2]",
"self.node",
"self",
"node",
"2*k+2",
"2*k",
"2",
"k",
"2",
"self",
"self",
"k",
"k",
"x",
"x",
"def get(self, l, r):\n # [l, r) についてqueryを求める\n x = self.e\n l += self.size\n r += self.size\n\n while l<r:\n if l&1:\n x = self.operator_func(x, self.node[l-1])\n l += 1\n if r&1:\n r -= 1\n x = self.operator_func(x, self.node[r-1])\n l >>= 1\n r >>= 1\n return x",
"get",
"x = self.e",
"x",
"self.e",
"self",
"e",
"l += self.size",
"l",
"self.size",
"self",
"size",
"r += self.size",
"r",
"self.size",
"self",
"size",
"while l<r:\n if l&1:\n x = self.operator_func(x, self.node[l-1])\n l += 1\n if r&1:\n r -= 1\n x = self.operator_func(x, self.node[r-1])\n l >>= 1\n r >>= 1\n ",
"l<r",
"l",
"r",
"if l&1:\n x = self.operator_func(x, self.node[l-1])\n l += 1\n ",
"l&1",
"l",
"1",
"x = self.operator_func(x, self.node[l-1])",
"x",
"self.operator_func(x, self.node[l-1])",
"self.operator_func",
"self",
"operator_func",
"x",
"self.node[l-1]",
"self.node",
"self",
"node",
"l-1",
"l",
"1",
"l += 1",
"l",
"1",
"if r&1:\n r -= 1\n x = self.operator_func(x, self.node[r-1])\n ",
"r&1",
"r",
"1",
"r -= 1",
"r",
"1",
"x = self.operator_func(x, self.node[r-1])",
"x",
"self.operator_func(x, self.node[r-1])",
"self.operator_func",
"self",
"operator_func",
"x",
"self.node[r-1]",
"self.node",
"self",
"node",
"r-1",
"r",
"1",
"l >>= 1",
"l",
"1",
"r >>= 1",
"r",
"1",
"return x",
"x",
"self",
"self",
"l",
"l",
"r",
"r",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"*A, = map(int, input().split())",
"*A",
"A",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"tree = SegTree(N, 0, max)",
"tree",
"SegTree(N, 0, max)",
"SegTree",
"N",
"0",
"max",
"tree.set_list(A)",
"tree.set_list",
"tree",
"set_list",
"A",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(N-1):\n d[(tree.get(i+1, N)-A[i])] += 1",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"d[(tree.get(i+1, N)-A[i])] += 1",
"d[(tree.get(i+1, N)-A[i])]",
"d",
"tree.get(i+1, N)-A[i]",
"tree.get(i+1, N)",
"tree.get",
"tree",
"get",
"i+1",
"i",
"1",
"N",
"A[i]",
"A",
"i",
"1",
"print(d[max(d.keys())])",
"print",
"d[max(d.keys())]",
"d",
"max(d.keys())",
"max",
"d.keys()",
"d.keys",
"d",
"keys",
"class SegTree():\n def __init__(self, N, e, operator_func=add):\n self.e = e # 単位元\n self.size = N\n self.node = [self.e] * (2*N)\n self.operator_func = operator_func # 処理(add or xor max minなど)\n\n def set_list(self, l):\n for i in range(self.size):\n self.node[i+self.size-1] = l[i]\n for i in range(self.size-1)[::-1]:\n self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])\n \n def update(self, k, x):\n k += self.size-1\n self.node[k] = x\n while k >= 0:\n k = (k - 1) // 2\n self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])\n\n def get(self, l, r):\n # [l, r) についてqueryを求める\n x = self.e\n l += self.size\n r += self.size\n\n while l<r:\n if l&1:\n x = self.operator_func(x, self.node[l-1])\n l += 1\n if r&1:\n r -= 1\n x = self.operator_func(x, self.node[r-1])\n l >>= 1\n r >>= 1\n return x",
"class SegTree():\n def __init__(self, N, e, operator_func=add):\n self.e = e # 単位元\n self.size = N\n self.node = [self.e] * (2*N)\n self.operator_func = operator_func # 処理(add or xor max minなど)\n\n def set_list(self, l):\n for i in range(self.size):\n self.node[i+self.size-1] = l[i]\n for i in range(self.size-1)[::-1]:\n self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])\n \n def update(self, k, x):\n k += self.size-1\n self.node[k] = x\n while k >= 0:\n k = (k - 1) // 2\n self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])\n\n def get(self, l, r):\n # [l, r) についてqueryを求める\n x = self.e\n l += self.size\n r += self.size\n\n while l<r:\n if l&1:\n x = self.operator_func(x, self.node[l-1])\n l += 1\n if r&1:\n r -= 1\n x = self.operator_func(x, self.node[r-1])\n l >>= 1\n r >>= 1\n return x",
"SegTree",
"d = defaultdict(int)",
"defaultdict(int)",
"d",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"tree = SegTree(N, 0, max)",
"SegTree(N, 0, max)",
"tree",
"T = map(int, input().split())",
"map(int, input().split())",
"T"
] |
from operator import add
from collections import defaultdict
class SegTree():
def __init__(self, N, e, operator_func=add):
self.e = e # 単位元
self.size = N
self.node = [self.e] * (2*N)
self.operator_func = operator_func # 処理(add or xor max minなど)
def set_list(self, l):
for i in range(self.size):
self.node[i+self.size-1] = l[i]
for i in range(self.size-1)[::-1]:
self.node[i] = self.operator_func(self.node[2*i+1], self.node[2*i+2])
def update(self, k, x):
k += self.size-1
self.node[k] = x
while k >= 0:
k = (k - 1) // 2
self.node[k] = self.operator_func(self.node[2*k+1], self.node[2*k+2])
def get(self, l, r):
# [l, r) についてqueryを求める
x = self.e
l += self.size
r += self.size
while l<r:
if l&1:
x = self.operator_func(x, self.node[l-1])
l += 1
if r&1:
r -= 1
x = self.operator_func(x, self.node[r-1])
l >>= 1
r >>= 1
return x
N, T = map(int, input().split())
*A, = map(int, input().split())
tree = SegTree(N, 0, max)
tree.set_list(A)
d = defaultdict(int)
for i in range(N-1):
d[(tree.get(i+1, N)-A[i])] += 1
print(d[max(d.keys())])
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
39,
28,
13,
18,
13,
39,
17,
14,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
8,
2,
13,
13,
2,
13,
13,
17,
0,
13,
4,
13,
13,
4,
13,
18,
13,
4,
13,
4,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13
] |
[
[
81,
3
],
[
81,
12
],
[
84,
14
],
[
90,
26
],
[
78,
29
],
[
33,
32
],
[
85,
34
],
[
91,
39
],
[
88,
39
],
[
32,
40
],
[
87,
42
],
[
32,
43
],
[
79,
46
],
[
32,
50
],
[
88,
51
],
[
91,
51
],
[
88,
53
],
[
91,
53
],
[
32,
54
],
[
72,
57
],
[
79,
60
],
[
73,
64
],
[
73,
69
],
[
72,
73
],
[
81,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
32,
87
],
[
87,
88
],
[
90,
91
]
] |
[
"from collections import Counter\nn,t = map(int, input().split())\na = list(map(int, input().split()))\n\nmx = 0\nb = []\nfor i in a[::-1]:\n if mx < i:\n mx = i\n b.append(mx-i if i < mx else 0)\nc = Counter(b)\n\nprint(c[max(c.keys())])",
"from collections import Counter",
"n,t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mx = 0",
"mx",
"0",
"b = []",
"b",
"[]",
"for i in a[::-1]:\n if mx < i:\n mx = i\n b.append(mx-i if i < mx else 0)",
"i",
"a[::-1]",
"a",
"::-1",
"-1",
"if mx < i:\n mx = i\n ",
"mx < i",
"mx",
"i",
"mx = i",
"mx",
"i",
"b.append(mx-i if i < mx else 0)",
"b.append",
"b",
"append",
"mx-i if i < mx else 0",
"i < mx",
"i",
"mx",
"mx-i",
"mx",
"i",
"0",
"c = Counter(b)",
"c",
"Counter(b)",
"Counter",
"b",
"print(c[max(c.keys())])",
"print",
"c[max(c.keys())]",
"c",
"max(c.keys())",
"max",
"c.keys()",
"c.keys",
"c",
"keys",
"c = Counter(b)",
"Counter(b)",
"c",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"b = []",
"[]",
"b",
"n,t = map(int, input().split())",
"map(int, input().split())",
"n",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"mx = i",
"i",
"mx",
"mx = 0",
"0",
"mx"
] |
from collections import Counter
n,t = map(int, input().split())
a = list(map(int, input().split()))
mx = 0
b = []
for i in a[::-1]:
if mx < i:
mx = i
b.append(mx-i if i < mx else 0)
c = Counter(b)
print(c[max(c.keys())])
|
[
7,
15,
13,
15,
13,
15,
4,
18,
13,
13,
2,
17,
17,
12,
13,
29,
18,
4,
18,
18,
13,
13,
13,
39,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
12,
13,
12,
13,
14,
40,
13,
17,
41,
28,
13,
4,
13,
13,
4,
39,
29,
13,
14,
2,
13,
17,
41,
28,
13,
4,
13,
13,
4,
4,
13,
29,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
0,
13,
13,
29,
4,
13,
13,
4,
13,
31,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
18,
4,
13,
13,
39,
17,
0,
13,
4,
13,
13,
18,
13,
13,
14,
2,
2,
13,
18,
13,
13,
13,
0,
13,
2,
13,
18,
13,
13,
0,
13,
17,
14,
2,
2,
13,
18,
13,
13,
13,
0,
13,
17,
9,
4,
13,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
2,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
189,
26
],
[
88,
40
],
[
45,
44
],
[
90,
47
],
[
90,
54
],
[
59,
58
],
[
88,
61
],
[
163,
64
],
[
70,
69
],
[
88,
72
],
[
172,
75
],
[
78,
77
],
[
77,
86
],
[
88,
88
],
[
90,
90
],
[
174,
92
],
[
172,
94
],
[
174,
95
],
[
177,
97
],
[
172,
99
],
[
192,
101
],
[
198,
104
],
[
168,
107
],
[
111,
110
],
[
175,
114
],
[
201,
118
],
[
169,
121
],
[
202,
121
],
[
178,
123
],
[
110,
124
],
[
202,
128
],
[
169,
128
],
[
178,
130
],
[
110,
131
],
[
193,
132
],
[
187,
132
],
[
186,
134
],
[
202,
136
],
[
169,
136
],
[
178,
138
],
[
110,
139
],
[
195,
141
],
[
202,
146
],
[
169,
146
],
[
178,
148
],
[
110,
149
],
[
193,
150
],
[
187,
150
],
[
180,
152
],
[
181,
157
],
[
196,
157
],
[
199,
157
],
[
174,
160
],
[
168,
169
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
186,
187
],
[
189,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
]
] |
[
"import sys\nimport math\nfrom collections import defaultdict\n\nsys.setrecursionlimit(10**7)\ndef input():\n return sys.stdin.readline()[:-1]\n\nmod = 10**9 + 7\n\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\ndef LIR(row,col):\n if row <= 0:\n return [[] for _ in range(col)]\n elif col == 1:\n return [I() for _ in range(row)]\n else:\n read_all = [LI() for _ in range(row)]\n return map(list, zip(*read_all))\n\n#################\n\nN,T = LI()\nA = LI()\n\ndiff = -1\nnum = 0\nhigh = 0\nfor i in range(N)[::-1]:\n high = max(high,A[i])\n if high-A[i] > diff:\n diff = high-A[i]\n num = 1\n elif high-A[i] == diff:\n num += 1\n else:\n continue\n\nprint(num)",
"import sys",
"sys",
"import math",
"math",
"from collections import defaultdict",
"sys.setrecursionlimit(10**7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**7",
"10",
"7",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"return sys.stdin.readline()[:-1]",
"sys.stdin.readline()[:-1]",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
":-1",
"-1",
"mod = 10**9 + 7",
"mod",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"def I(): return int(input())",
"I",
"def LI(): return list(map(int, input().split()))",
"LI",
"def LIR(row,col):\n if row <= 0:\n return [[] for _ in range(col)]\n elif col == 1:\n return [I() for _ in range(row)]\n else:\n read_all = [LI() for _ in range(row)]\n return map(list, zip(*read_all))\n\n#################",
"LIR",
"if row <= 0:\n return [[] for _ in range(col)]\n elif col == 1:\n return [I() for _ in range(row)]\n else:\n read_all = [LI() for _ in range(row)]\n return map(list, zip(*read_all))\n\n#################",
"row <= 0",
"row",
"0",
"[] for _ in range(col)",
"for _ in range(col)",
"_",
"range(col)",
"range",
"col",
"for _ in range(col)",
"[]",
"return [[] for _ in range(col)]",
"[[] for _ in range(col)]",
"elif col == 1:\n return [I() for _ in range(row)]\n ",
"col == 1",
"col",
"1",
"I() for _ in range(row)",
"for _ in range(row)",
"_",
"range(row)",
"range",
"row",
"for _ in range(row)",
"I()",
"I",
"return [I() for _ in range(row)]",
"[I() for _ in range(row)]",
"LI() for _ in range(row)",
"for _ in range(row)",
"_",
"range(row)",
"range",
"row",
"for _ in range(row)",
"LI()",
"LI",
"read_all = [LI() for _ in range(row)]",
"read_all",
"[LI() for _ in range(row)]",
"return map(list, zip(*read_all))",
"map(list, zip(*read_all))",
"map",
"list",
"zip(*read_all)",
"zip",
"*read_all",
"read_all",
"row",
"row",
"col",
"col",
"N,T = LI()",
"N",
"LI()",
"LI",
"T",
"A = LI()",
"A",
"LI()",
"LI",
"diff = -1",
"diff",
"-1",
"num = 0",
"num",
"0",
"high = 0",
"high",
"0",
"for i in range(N)[::-1]:\n high = max(high,A[i])\n if high-A[i] > diff:\n diff = high-A[i]\n num = 1\n elif high-A[i] == diff:\n num += 1\n else:\n continue",
"i",
"range(N)[::-1]",
"(N)",
"range",
"N",
"::-1",
"-1",
"high = max(high,A[i])",
"high",
"max(high,A[i])",
"max",
"high",
"A[i]",
"A",
"i",
"if high-A[i] > diff:\n diff = high-A[i]\n num = 1\n elif high-A[i] == diff:\n num += 1\n else:\n continue",
"high-A[i] > diff",
"high-A[i]",
"high",
"A[i]",
"A",
"i",
"diff",
"diff = high-A[i]",
"diff",
"high-A[i]",
"high",
"A[i]",
"A",
"i",
"num = 1",
"num",
"1",
"elif high-A[i] == diff:\n num += 1\n ",
"high-A[i] == diff",
"high-A[i]",
"high",
"A[i]",
"A",
"i",
"diff",
"num += 1",
"num",
"1",
"continue",
"print(num)",
"print",
"num",
"T = LI()",
"LI()",
"T",
"def I(): return int(input())",
"def I(): return int(input())",
"I",
"def LIR(row,col):\n if row <= 0:\n return [[] for _ in range(col)]\n elif col == 1:\n return [I() for _ in range(row)]\n else:\n read_all = [LI() for _ in range(row)]\n return map(list, zip(*read_all))\n\n#################",
"def LIR(row,col):\n if row <= 0:\n return [[] for _ in range(col)]\n elif col == 1:\n return [I() for _ in range(row)]\n else:\n read_all = [LI() for _ in range(row)]\n return map(list, zip(*read_all))\n\n#################",
"LIR",
"high = 0",
"0",
"high",
"def LI(): return list(map(int, input().split()))",
"def LI(): return list(map(int, input().split()))",
"LI",
"N,T = LI()",
"LI()",
"N",
"A = LI()",
"LI()",
"A",
"num += 1",
"1",
"num",
"def input():\n return sys.stdin.readline()[:-1]",
"def input():\n return sys.stdin.readline()[:-1]",
"input",
"diff = high-A[i]",
"high-A[i]",
"diff",
"mod = 10**9 + 7",
"10**9 + 7",
"mod",
"diff = -1",
"-1",
"diff",
"num = 1",
"1",
"num",
"num = 0",
"0",
"num",
"high = max(high,A[i])",
"max(high,A[i])",
"high"
] |
import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
if row <= 0:
return [[] for _ in range(col)]
elif col == 1:
return [I() for _ in range(row)]
else:
read_all = [LI() for _ in range(row)]
return map(list, zip(*read_all))
#################
N,T = LI()
A = LI()
diff = -1
num = 0
high = 0
for i in range(N)[::-1]:
high = max(high,A[i])
if high-A[i] > diff:
diff = high-A[i]
num = 1
elif high-A[i] == diff:
num += 1
else:
continue
print(num)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
39,
17,
13,
0,
13,
13,
28,
13,
4,
13,
17,
2,
13,
17,
0,
13,
18,
13,
40,
13,
14,
2,
18,
18,
13,
2,
13,
17,
17,
13,
0,
18,
18,
13,
13,
17,
13,
0,
18,
18,
13,
13,
17,
2,
2,
13,
17,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
17,
17,
0,
13,
13,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
2,
13,
17,
4,
13,
18,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
2,
13,
17,
14,
2,
18,
18,
13,
13,
17,
18,
13,
2,
13,
13,
0,
13,
4,
13,
13,
2,
18,
18,
13,
13,
17,
18,
13,
2,
13,
13,
0,
13,
39,
28,
13,
4,
13,
17,
2,
13,
17,
0,
13,
18,
13,
2,
13,
17,
14,
2,
2,
13,
13,
18,
18,
13,
2,
13,
13,
17,
4,
18,
13,
13,
39,
13,
18,
18,
13,
2,
13,
13,
17,
6,
13,
12,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
2,
39,
17,
2,
13,
17,
23,
13,
23,
13,
12,
13,
14,
2,
18,
18,
13,
13,
13,
13,
29,
13,
0,
18,
18,
13,
13,
13,
4,
18,
13,
13,
18,
18,
13,
13,
13,
29,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
18,
13,
13,
13,
14,
2,
18,
18,
13,
13,
13,
18,
18,
13,
13,
13,
0,
18,
18,
13,
13,
13,
13,
0,
18,
18,
13,
13,
13,
13,
14,
2,
18,
18,
13,
13,
13,
18,
18,
13,
13,
13,
0,
18,
18,
13,
13,
13,
17,
23,
13,
23,
13,
23,
13,
12,
13,
29,
2,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
0,
13,
4,
13,
13,
28,
13,
13,
0,
13,
18,
13,
17,
13,
18,
13,
17,
4,
18,
13,
13,
13,
13,
28,
13,
4,
13,
2,
13,
17,
4,
18,
13,
13,
13,
41,
28,
13,
4,
13,
2,
13,
17,
4,
13,
39,
0,
13,
13,
28,
13,
4,
13,
2,
13,
17,
4,
18,
18,
13,
18,
18,
13,
13,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
0,
13,
4,
13,
18,
13,
13,
0,
13,
2,
2,
13,
2,
13,
17,
17,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
6,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13
] |
[
[
496,
2
],
[
496,
11
],
[
466,
13
],
[
27,
26
],
[
497,
30
],
[
505,
37
],
[
41,
40
],
[
497,
45
],
[
481,
48
],
[
467,
50
],
[
40,
52
],
[
506,
57
],
[
40,
59
],
[
482,
62
],
[
69,
64
],
[
82,
65
],
[
506,
66
],
[
40,
67
],
[
482,
69
],
[
76,
71
],
[
82,
72
],
[
506,
73
],
[
40,
74
],
[
497,
78
],
[
40,
80
],
[
85,
82
],
[
506,
83
],
[
40,
84
],
[
506,
86
],
[
40,
88
],
[
93,
92
],
[
497,
96
],
[
511,
103
],
[
107,
106
],
[
497,
109
],
[
463,
111
],
[
467,
113
],
[
106,
114
],
[
121,
116
],
[
512,
117
],
[
106,
119
],
[
512,
124
],
[
106,
125
],
[
464,
126
],
[
475,
128
],
[
132,
131
],
[
497,
136
],
[
82,
141
],
[
506,
142
],
[
131,
143
],
[
512,
146
],
[
497,
148
],
[
131,
149
],
[
469,
151
],
[
476,
154
],
[
470,
154
],
[
82,
157
],
[
506,
158
],
[
131,
159
],
[
512,
162
],
[
497,
164
],
[
131,
165
],
[
508,
167
],
[
171,
170
],
[
497,
175
],
[
478,
178
],
[
467,
180
],
[
170,
182
],
[
479,
187
],
[
470,
188
],
[
476,
188
],
[
506,
191
],
[
497,
193
],
[
170,
194
],
[
509,
198
],
[
506,
204
],
[
497,
206
],
[
170,
207
],
[
216,
215
],
[
241,
219
],
[
215,
222
],
[
227,
224
],
[
239,
225
],
[
232,
229
],
[
239,
230
],
[
241,
236
],
[
239,
239
],
[
241,
241
],
[
276,
248
],
[
278,
250
],
[
278,
251
],
[
278,
253
],
[
260,
255
],
[
276,
257
],
[
278,
259
],
[
276,
262
],
[
276,
266
],
[
278,
268
],
[
255,
270
],
[
276,
272
],
[
278,
274
],
[
276,
276
],
[
278,
278
],
[
283,
282
],
[
341,
285
],
[
243,
286
],
[
343,
287
],
[
290,
289
],
[
341,
292
],
[
243,
293
],
[
345,
294
],
[
341,
299
],
[
282,
301
],
[
343,
301
],
[
341,
304
],
[
289,
306
],
[
345,
306
],
[
313,
308
],
[
341,
310
],
[
282,
312
],
[
343,
312
],
[
289,
313
],
[
345,
313
],
[
320,
315
],
[
341,
317
],
[
289,
319
],
[
345,
319
],
[
282,
320
],
[
343,
320
],
[
341,
325
],
[
282,
327
],
[
343,
327
],
[
341,
330
],
[
289,
332
],
[
345,
332
],
[
339,
334
],
[
341,
336
],
[
282,
338
],
[
343,
338
],
[
341,
341
],
[
343,
343
],
[
345,
345
],
[
361,
352
],
[
243,
353
],
[
363,
354
],
[
361,
357
],
[
243,
358
],
[
365,
359
],
[
361,
361
],
[
363,
363
],
[
365,
365
],
[
484,
367
],
[
497,
370
],
[
373,
372
],
[
509,
372
],
[
472,
375
],
[
372,
377
],
[
499,
379
],
[
372,
381
],
[
485,
385
],
[
280,
386
],
[
473,
387
],
[
467,
387
],
[
500,
388
],
[
391,
390
],
[
497,
394
],
[
485,
398
],
[
243,
399
],
[
390,
400
],
[
404,
403
],
[
497,
407
],
[
403,
410
],
[
514,
413
],
[
417,
416
],
[
497,
420
],
[
515,
425
],
[
485,
428
],
[
416,
430
],
[
416,
432
],
[
517,
434
],
[
438,
437
],
[
497,
441
],
[
502,
444
],
[
515,
448
],
[
437,
449
],
[
490,
451
],
[
503,
454
],
[
503,
456
],
[
491,
461
],
[
518,
461
],
[
463,
464
],
[
466,
467
],
[
469,
470
],
[
472,
473
],
[
475,
476
],
[
478,
479
],
[
481,
482
],
[
484,
485
],
[
496,
488
],
[
490,
491
],
[
496,
497
],
[
499,
500
],
[
502,
503
],
[
505,
506
],
[
508,
509
],
[
511,
512
],
[
514,
515
],
[
517,
518
]
] |
[
"# 高橋くんと見えざる手\nn, t = map(int, input().split())\na = list(map(int, input().split()))\n\nmax_value = [[0, n] for i in range(n + 1)]\n\n# max_value[i]=後ろからi番目までの値で最も大きい値\nfor i in range(1, n + 1):\n num = a[-i]\n if max_value[i - 1][0] < num:\n max_value[i][0] = num\n max_value[i][1] = n + 1 - i\n else:\n max_value[i] = max_value[i - 1]\n\n\nmin_value = [10**10 for i in range(n + 1)]\n# min_value[i]=初めからi番目までの値で最も小さい値\nfor _ in range(n):\n x = a[_]\n min_value[_ + 1] = min(min_value[_], x)\n\nmax_dif = 0\nfor i in range(1, n + 1):\n if max_value[i][0] > min_value[n - i]:\n max_dif = max(max_dif, max_value[i][0] - min_value[n - i])\n\n\ndisk = []\nfor i in range(1, n + 1):\n base = a[i - 1]\n if base + max_dif == max_value[n - i][0]:\n disk.append((i, max_value[n - i][1]))\n\n######\n\n\nclass UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n # 検索\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # 併合\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # 同じ集合に属するか判定\n def same_check(self, x, y):\n return self.find(x) == self.find(y)\n\n\nuni = UnionFind(n)\nfor some in disk:\n a, b = some[0], some[1]\n uni.union(a, b)\nfor i in range(n + 1):\n uni.find(i)\n\n# UnionFind\n\ngroup = {i: [] for i in range(n + 1)}\n\nfor i in range(n + 1):\n group[uni.par[i]].append(i)\nans = 0\nfor i in range(n + 1):\n L = len(group[i])\n ans += L * (L - 1) // 2\nprint(ans)",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"[0, n] for i in range(n + 1)",
"for i in range(n + 1)",
"i",
"range(n + 1)",
"range",
"n + 1",
"n",
"1",
"for i in range(n + 1)",
"[0, n]",
"0",
"n",
"max_value = [[0, n] for i in range(n + 1)]",
"max_value",
"[[0, n] for i in range(n + 1)]",
"for i in range(1, n + 1):\n num = a[-i]\n if max_value[i - 1][0] < num:\n max_value[i][0] = num\n max_value[i][1] = n + 1 - i\n else:\n max_value[i] = max_value[i - 1]",
"i",
"range(1, n + 1)",
"range",
"1",
"n + 1",
"n",
"1",
"num = a[-i]",
"num",
"a[-i]",
"a",
"-i",
"i",
"if max_value[i - 1][0] < num:\n max_value[i][0] = num\n max_value[i][1] = n + 1 - i\n else:\n max_value[i] = max_value[i - 1]",
"max_value[i - 1][0] < num",
"max_value[i - 1][0]",
"[i - 1]",
"max_value",
"i - 1",
"i",
"1",
"0",
"num",
"max_value[i][0] = num",
"max_value[i][0]",
"[i]",
"max_value",
"i",
"0",
"num",
"max_value[i][1] = n + 1 - i",
"max_value[i][1]",
"[i]",
"max_value",
"i",
"1",
"n + 1 - i",
"n + 1",
"n",
"1",
"i",
"max_value[i] = max_value[i - 1]",
"max_value[i]",
"max_value",
"i",
"max_value[i - 1]",
"max_value",
"i - 1",
"i",
"1",
"10**10 for i in range(n + 1)",
"for i in range(n + 1)",
"i",
"range(n + 1)",
"range",
"n + 1",
"n",
"1",
"for i in range(n + 1)",
"10**10",
"10",
"10",
"min_value = [10**10 for i in range(n + 1)]",
"min_value",
"[10**10 for i in range(n + 1)]",
"for _ in range(n):\n x = a[_]\n min_value[_ + 1] = min(min_value[_], x)",
"_",
"range(n)",
"range",
"n",
"x = a[_]",
"x",
"a[_]",
"a",
"_",
"min_value[_ + 1] = min(min_value[_], x)",
"min_value[_ + 1]",
"min_value",
"_ + 1",
"_",
"1",
"min(min_value[_], x)",
"min",
"min_value[_]",
"min_value",
"_",
"x",
"max_dif = 0",
"max_dif",
"0",
"for i in range(1, n + 1):\n if max_value[i][0] > min_value[n - i]:\n max_dif = max(max_dif, max_value[i][0] - min_value[n - i])",
"i",
"range(1, n + 1)",
"range",
"1",
"n + 1",
"n",
"1",
"if max_value[i][0] > min_value[n - i]:\n max_dif = max(max_dif, max_value[i][0] - min_value[n - i])",
"max_value[i][0] > min_value[n - i]",
"max_value[i][0]",
"[i]",
"max_value",
"i",
"0",
"min_value[n - i]",
"min_value",
"n - i",
"n",
"i",
"max_dif = max(max_dif, max_value[i][0] - min_value[n - i])",
"max_dif",
"max(max_dif, max_value[i][0] - min_value[n - i])",
"max",
"max_dif",
"max_value[i][0] - min_value[n - i]",
"max_value[i][0]",
"[i]",
"max_value",
"i",
"0",
"min_value[n - i]",
"min_value",
"n - i",
"n",
"i",
"disk = []",
"disk",
"[]",
"for i in range(1, n + 1):\n base = a[i - 1]\n if base + max_dif == max_value[n - i][0]:\n disk.append((i, max_value[n - i][1]))\n\n######",
"i",
"range(1, n + 1)",
"range",
"1",
"n + 1",
"n",
"1",
"base = a[i - 1]",
"base",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"if base + max_dif == max_value[n - i][0]:\n disk.append((i, max_value[n - i][1]))\n\n######",
"base + max_dif == max_value[n - i][0]",
"base + max_dif",
"base",
"max_dif",
"max_value[n - i][0]",
"[n - i]",
"max_value",
"n - i",
"n",
"i",
"0",
"disk.append((i, max_value[n - i][1]))",
"disk.append",
"disk",
"append",
"(i, max_value[n - i][1])",
"i",
"max_value[n - i][1]",
"[n - i]",
"max_value",
"n - i",
"n",
"i",
"1",
"class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n # 検索\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # 併合\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # 同じ集合に属するか判定\n def same_check(self, x, y):\n return self.find(x) == self.find(y)",
"UnionFind",
"def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n # 検索\n ",
"__init__",
"i for i in range(n + 1)",
"for i in range(n + 1)",
"i",
"range(n + 1)",
"range",
"n + 1",
"n",
"1",
"for i in range(n + 1)",
"i",
"self.par = [i for i in range(n + 1)]",
"self.par",
"self",
"par",
"[i for i in range(n + 1)]",
"self.rank = [0] * (n + 1)",
"self.rank",
"self",
"rank",
"[0] * (n + 1)",
"[0]",
"0",
"n + 1",
"n",
"1",
"self",
"self",
"n",
"n",
"def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # 併合\n ",
"find",
"if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # 併合\n ",
"self.par[x] == x",
"self.par[x]",
"self.par",
"self",
"par",
"x",
"x",
"return x",
"x",
"self.par[x] = self.find(self.par[x])",
"self.par[x]",
"self.par",
"self",
"par",
"x",
"self.find(self.par[x])",
"self.find",
"self",
"find",
"self.par[x]",
"self.par",
"self",
"par",
"x",
"return self.par[x]",
"self.par[x]",
"self.par",
"self",
"par",
"x",
"self",
"self",
"x",
"x",
"def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # 同じ集合に属するか判定\n ",
"union",
"x = self.find(x)",
"x",
"self.find(x)",
"self.find",
"self",
"find",
"x",
"y = self.find(y)",
"y",
"self.find(y)",
"self.find",
"self",
"find",
"y",
"if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # 同じ集合に属するか判定\n ",
"self.rank[x] < self.rank[y]",
"self.rank[x]",
"self.rank",
"self",
"rank",
"x",
"self.rank[y]",
"self.rank",
"self",
"rank",
"y",
"self.par[x] = y",
"self.par[x]",
"self.par",
"self",
"par",
"x",
"y",
"self.par[y] = x",
"self.par[y]",
"self.par",
"self",
"par",
"y",
"x",
"if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # 同じ集合に属するか判定\n ",
"self.rank[x] == self.rank[y]",
"self.rank[x]",
"self.rank",
"self",
"rank",
"x",
"self.rank[y]",
"self.rank",
"self",
"rank",
"y",
"self.rank[x] += 1",
"self.rank[x]",
"self.rank",
"self",
"rank",
"x",
"1",
"self",
"self",
"x",
"x",
"y",
"y",
"def same_check(self, x, y):\n return self.find(x) == self.find(y)",
"same_check",
"return self.find(x) == self.find(y)",
"self.find(x) == self.find(y)",
"self.find(x)",
"self.find",
"self",
"find",
"x",
"self.find(y)",
"self.find",
"self",
"find",
"y",
"self",
"self",
"x",
"x",
"y",
"y",
"uni = UnionFind(n)",
"uni",
"UnionFind(n)",
"UnionFind",
"n",
"for some in disk:\n a, b = some[0], some[1]\n uni.union(a, b)",
"some",
"disk",
"a, b = some[0], some[1]",
"a",
"some[0]",
"some",
"0",
"b",
"some[1]",
"some",
"1",
"uni.union(a, b)",
"uni.union",
"uni",
"union",
"a",
"b",
"for i in range(n + 1):\n uni.find(i)\n\n# UnionFind",
"i",
"range(n + 1)",
"range",
"n + 1",
"n",
"1",
"uni.find(i)",
"uni.find",
"uni",
"find",
"i",
"i: [] for i in range(n + 1)",
"for i in range(n + 1)",
"i",
"range(n + 1)",
"range",
"n + 1",
"n",
"1",
"for i in range(n + 1)",
"i",
"[]",
"group = {i: [] for i in range(n + 1)}",
"group",
"{i: [] for i in range(n + 1)}",
"for i in range(n + 1):\n group[uni.par[i]].append(i)",
"i",
"range(n + 1)",
"range",
"n + 1",
"n",
"1",
"group[uni.par[i]].append(i)",
"[uni.par[i]].append",
"[uni.par[i]]",
"group",
"uni.par[i]",
"uni.par",
"uni",
"par",
"i",
"append",
"i",
"ans = 0",
"ans",
"0",
"for i in range(n + 1):\n L = len(group[i])\n ans += L * (L - 1) // 2",
"i",
"range(n + 1)",
"range",
"n + 1",
"n",
"1",
"L = len(group[i])",
"L",
"len(group[i])",
"len",
"group[i]",
"group",
"i",
"ans += L * (L - 1) // 2",
"ans",
"L * (L - 1) // 2",
"L * (L - 1)",
"L",
"L - 1",
"L",
"1",
"2",
"print(ans)",
"print",
"ans",
"x = a[_]",
"a[_]",
"x",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"max_dif = max(max_dif, max_value[i][0] - min_value[n - i])",
"max(max_dif, max_value[i][0] - min_value[n - i])",
"max_dif",
"a, b = some[0], some[1]",
"some[0]",
"a",
"max_dif = 0",
"0",
"max_dif",
"base = a[i - 1]",
"a[i - 1]",
"base",
"num = a[-i]",
"a[-i]",
"num",
"uni = UnionFind(n)",
"UnionFind(n)",
"uni",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"ans += L * (L - 1) // 2",
"L * (L - 1) // 2",
"ans",
"class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n # 検索\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # 併合\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # 同じ集合に属するか判定\n def same_check(self, x, y):\n return self.find(x) == self.find(y)",
"class UnionFind:\n def __init__(self, n):\n self.par = [i for i in range(n + 1)]\n self.rank = [0] * (n + 1)\n\n # 検索\n def find(self, x):\n if self.par[x] == x:\n return x\n else:\n self.par[x] = self.find(self.par[x])\n return self.par[x]\n\n # 併合\n def union(self, x, y):\n x = self.find(x)\n y = self.find(y)\n if self.rank[x] < self.rank[y]:\n self.par[x] = y\n else:\n self.par[y] = x\n if self.rank[x] == self.rank[y]:\n self.rank[x] += 1\n\n # 同じ集合に属するか判定\n def same_check(self, x, y):\n return self.find(x) == self.find(y)",
"UnionFind",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"b = some[0], some[1]",
"some[1]",
"b",
"L = len(group[i])",
"len(group[i])",
"L",
"max_value = [[0, n] for i in range(n + 1)]",
"[[0, n] for i in range(n + 1)]",
"max_value",
"disk = []",
"[]",
"disk",
"min_value = [10**10 for i in range(n + 1)]",
"[10**10 for i in range(n + 1)]",
"min_value",
"group = {i: [] for i in range(n + 1)}",
"{i: [] for i in range(n + 1)}",
"group",
"ans = 0",
"0",
"ans"
] |
# 高橋くんと見えざる手
n, t = map(int, input().split())
a = list(map(int, input().split()))
max_value = [[0, n] for i in range(n + 1)]
# max_value[i]=後ろからi番目までの値で最も大きい値
for i in range(1, n + 1):
num = a[-i]
if max_value[i - 1][0] < num:
max_value[i][0] = num
max_value[i][1] = n + 1 - i
else:
max_value[i] = max_value[i - 1]
min_value = [10**10 for i in range(n + 1)]
# min_value[i]=初めからi番目までの値で最も小さい値
for _ in range(n):
x = a[_]
min_value[_ + 1] = min(min_value[_], x)
max_dif = 0
for i in range(1, n + 1):
if max_value[i][0] > min_value[n - i]:
max_dif = max(max_dif, max_value[i][0] - min_value[n - i])
disk = []
for i in range(1, n + 1):
base = a[i - 1]
if base + max_dif == max_value[n - i][0]:
disk.append((i, max_value[n - i][1]))
######
class UnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
# 検索
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
# 併合
def union(self, x, y):
x = self.find(x)
y = self.find(y)
if self.rank[x] < self.rank[y]:
self.par[x] = y
else:
self.par[y] = x
if self.rank[x] == self.rank[y]:
self.rank[x] += 1
# 同じ集合に属するか判定
def same_check(self, x, y):
return self.find(x) == self.find(y)
uni = UnionFind(n)
for some in disk:
a, b = some[0], some[1]
uni.union(a, b)
for i in range(n + 1):
uni.find(i)
# UnionFind
group = {i: [] for i in range(n + 1)}
for i in range(n + 1):
group[uni.par[i]].append(i)
ans = 0
for i in range(n + 1):
L = len(group[i])
ans += L * (L - 1) // 2
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
18,
13,
17,
0,
13,
39,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
13,
4,
18,
13,
13,
4,
13,
4,
18,
13,
13,
18,
13,
17,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
39,
13
] |
[
[
83,
2
],
[
83,
11
],
[
71,
13
],
[
80,
25
],
[
72,
27
],
[
86,
30
],
[
34,
33
],
[
78,
36
],
[
72,
40
],
[
33,
41
],
[
81,
42
],
[
75,
42
],
[
74,
44
],
[
72,
46
],
[
33,
47
],
[
87,
50
],
[
72,
54
],
[
33,
55
],
[
75,
56
],
[
81,
56
],
[
87,
59
],
[
87,
65
],
[
87,
68
],
[
71,
72
],
[
74,
75
],
[
83,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
]
] |
[
"n,t=map(int,input().split())\ns=list(map(int,input().split()))\nmi=s[0]\nma=[]\nfor i in range(n):\n if s[i]<mi:\n mi=s[i]\n ma.append(s[i]-mi)\nma.sort()\nprint(ma.count(ma[-1]))",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"s=list(map(int,input().split()))",
"s",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mi=s[0]",
"mi",
"s[0]",
"s",
"0",
"ma=[]",
"ma",
"[]",
"for i in range(n):\n if s[i]<mi:\n mi=s[i]\n ma.append(s[i]-mi)",
"i",
"range(n)",
"range",
"n",
"if s[i]<mi:\n mi=s[i]\n ",
"s[i]<mi",
"s[i]",
"s",
"i",
"mi",
"mi=s[i]",
"mi",
"s[i]",
"s",
"i",
"ma.append(s[i]-mi)",
"ma.append",
"ma",
"append",
"s[i]-mi",
"s[i]",
"s",
"i",
"mi",
"ma.sort()",
"ma.sort",
"ma",
"sort",
"print(ma.count(ma[-1]))",
"print",
"ma.count(ma[-1])",
"ma.count",
"ma",
"count",
"ma[-1]",
"ma",
"-1",
"s=list(map(int,input().split()))",
"list(map(int,input().split()))",
"s",
"mi=s[i]",
"s[i]",
"mi",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"mi=s[0]",
"s[0]",
"mi",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"ma=[]",
"[]",
"ma"
] |
n,t=map(int,input().split())
s=list(map(int,input().split()))
mi=s[0]
ma=[]
for i in range(n):
if s[i]<mi:
mi=s[i]
ma.append(s[i]-mi)
ma.sort()
print(ma.count(ma[-1]))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
12,
4,
13,
13,
23,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13
] |
[
[
86,
2
],
[
86,
11
],
[
74,
13
],
[
77,
29
],
[
83,
32
],
[
75,
34
],
[
38,
37
],
[
75,
43
],
[
78,
46
],
[
75,
50
],
[
37,
51
],
[
84,
52
],
[
90,
52
],
[
75,
56
],
[
37,
57
],
[
84,
58
],
[
90,
58
],
[
89,
60
],
[
75,
62
],
[
37,
63
],
[
78,
68
],
[
78,
72
],
[
74,
75
],
[
77,
78
],
[
86,
81
],
[
83,
84
],
[
86,
87
],
[
89,
90
]
] |
[
"n, t = map(int, input().split())\na = list(map(lambda x: int(x), input().split()))\n#a = list(map(lambda x: int(x), in1.split()))\nb = []\nstrlow = a[0]\n\nfor idx1 in range(1, len(a)):\n b.append(a[idx1] - strlow)\n if a[idx1] < strlow:\n strlow = a[idx1]\n\nprint(b.count(max(b)))",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(lambda x: int(x), input().split()))",
"a",
"list(map(lambda x: int(x), input().split()))",
"list",
"map(lambda x: int(x), input().split())",
"map",
"lambda x: int(x)",
"int(x)",
"int",
"x",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"b = []",
"b",
"[]",
"strlow = a[0]",
"strlow",
"a[0]",
"a",
"0",
"for idx1 in range(1, len(a)):\n b.append(a[idx1] - strlow)\n if a[idx1] < strlow:\n strlow = a[idx1]",
"idx1",
"range(1, len(a))",
"range",
"1",
"len(a)",
"len",
"a",
"b.append(a[idx1] - strlow)",
"b.append",
"b",
"append",
"a[idx1] - strlow",
"a[idx1]",
"a",
"idx1",
"strlow",
"if a[idx1] < strlow:\n strlow = a[idx1]",
"a[idx1] < strlow",
"a[idx1]",
"a",
"idx1",
"strlow",
"strlow = a[idx1]",
"strlow",
"a[idx1]",
"a",
"idx1",
"print(b.count(max(b)))",
"print",
"b.count(max(b))",
"b.count",
"b",
"count",
"max(b)",
"max",
"b",
"a = list(map(lambda x: int(x), input().split()))",
"list(map(lambda x: int(x), input().split()))",
"a",
"b = []",
"[]",
"b",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"strlow = a[0]",
"a[0]",
"strlow",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"strlow = a[idx1]",
"a[idx1]",
"strlow"
] |
n, t = map(int, input().split())
a = list(map(lambda x: int(x), input().split()))
#a = list(map(lambda x: int(x), in1.split()))
b = []
strlow = a[0]
for idx1 in range(1, len(a)):
b.append(a[idx1] - strlow)
if a[idx1] < strlow:
strlow = a[idx1]
print(b.count(max(b)))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
2,
13,
17,
18,
13,
2,
13,
17,
28,
13,
4,
13,
4,
13,
17,
13,
0,
18,
13,
2,
13,
17,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
0,
13,
4,
13,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
13,
17,
14,
2,
2,
18,
13,
13,
13,
13,
14,
2,
18,
13,
2,
18,
13,
13,
13,
17,
0,
18,
13,
2,
18,
13,
13,
13,
17,
0,
13,
17,
14,
40,
18,
13,
13,
13,
0,
18,
13,
18,
13,
13,
17,
0,
18,
13,
18,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] |
[
[
183,
2
],
[
183,
11
],
[
162,
13
],
[
168,
25
],
[
178,
29
],
[
36,
31
],
[
169,
32
],
[
178,
34
],
[
163,
37
],
[
178,
39
],
[
43,
42
],
[
178,
48
],
[
55,
50
],
[
169,
51
],
[
42,
53
],
[
169,
58
],
[
42,
59
],
[
163,
61
],
[
42,
63
],
[
171,
66
],
[
70,
69
],
[
178,
73
],
[
186,
76
],
[
172,
79
],
[
187,
79
],
[
169,
82
],
[
69,
84
],
[
163,
87
],
[
69,
88
],
[
165,
90
],
[
174,
93
],
[
97,
96
],
[
178,
99
],
[
163,
104
],
[
96,
105
],
[
187,
106
],
[
172,
106
],
[
163,
112
],
[
96,
113
],
[
187,
114
],
[
172,
114
],
[
175,
115
],
[
175,
119
],
[
163,
122
],
[
96,
123
],
[
187,
124
],
[
172,
124
],
[
134,
127
],
[
175,
128
],
[
163,
131
],
[
96,
132
],
[
187,
133
],
[
172,
133
],
[
180,
136
],
[
163,
141
],
[
96,
142
],
[
175,
143
],
[
150,
145
],
[
175,
146
],
[
163,
148
],
[
96,
149
],
[
157,
152
],
[
175,
153
],
[
163,
155
],
[
96,
156
],
[
181,
160
],
[
166,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
183,
178
],
[
180,
181
],
[
183,
184
],
[
186,
187
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\naccum=[0]*n\naccum[n-1]=a[n-1]\nfor i in reversed(range(1,n)):\n accum[i-1]=max(accum[i],a[i-1])\nmaxi=0\nfor i in range(n-1):\n maxi=max(maxi,accum[i+1]-a[i])\nans=0\nd={}\nfor i in range(n):\n if a[i]-maxi>0:\n if a[i]-maxi in d:\n if d[a[i]-maxi]>0:\n d[a[i]-maxi]-=1\n ans+=1\n if a[i] not in d:\n d[a[i]]=1\n else:\n d[a[i]]+=1\nprint(ans)",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"accum=[0]*n",
"accum",
"[0]*n",
"[0]",
"0",
"n",
"accum[n-1]=a[n-1]",
"accum[n-1]",
"accum",
"n-1",
"n",
"1",
"a[n-1]",
"a",
"n-1",
"n",
"1",
"for i in reversed(range(1,n)):\n accum[i-1]=max(accum[i],a[i-1])",
"i",
"reversed(range(1,n))",
"reversed",
"range(1,n)",
"range",
"1",
"n",
"accum[i-1]=max(accum[i],a[i-1])",
"accum[i-1]",
"accum",
"i-1",
"i",
"1",
"max(accum[i],a[i-1])",
"max",
"accum[i]",
"accum",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"maxi=0",
"maxi",
"0",
"for i in range(n-1):\n maxi=max(maxi,accum[i+1]-a[i])",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"maxi=max(maxi,accum[i+1]-a[i])",
"maxi",
"max(maxi,accum[i+1]-a[i])",
"max",
"maxi",
"accum[i+1]-a[i]",
"accum[i+1]",
"accum",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"ans=0",
"ans",
"0",
"d={}",
"d",
"{}",
"for i in range(n):\n if a[i]-maxi>0:\n if a[i]-maxi in d:\n if d[a[i]-maxi]>0:\n d[a[i]-maxi]-=1\n ans+=1\n if a[i] not in d:\n d[a[i]]=1\n else:\n d[a[i]]+=1",
"i",
"range(n)",
"range",
"n",
"if a[i]-maxi>0:\n if a[i]-maxi in d:\n if d[a[i]-maxi]>0:\n d[a[i]-maxi]-=1\n ans+=1\n ",
"a[i]-maxi>0",
"a[i]-maxi",
"a[i]",
"a",
"i",
"maxi",
"0",
"if a[i]-maxi in d:\n if d[a[i]-maxi]>0:\n d[a[i]-maxi]-=1\n ans+=1\n ",
"a[i]-maxi in d",
"a[i]-maxi",
"a[i]",
"a",
"i",
"maxi",
"d",
"if d[a[i]-maxi]>0:\n d[a[i]-maxi]-=1\n ans+=1\n ",
"d[a[i]-maxi]>0",
"d[a[i]-maxi]",
"d",
"a[i]-maxi",
"a[i]",
"a",
"i",
"maxi",
"0",
"d[a[i]-maxi]-=1",
"d[a[i]-maxi]",
"d",
"a[i]-maxi",
"a[i]",
"a",
"i",
"maxi",
"1",
"ans+=1",
"ans",
"1",
"if a[i] not in d:\n d[a[i]]=1\n else:\n d[a[i]]+=1",
"a[i] not in d",
"a[i]",
"a",
"i",
"d",
"d[a[i]]=1",
"d[a[i]]",
"d",
"a[i]",
"a",
"i",
"1",
"d[a[i]]+=1",
"d[a[i]]",
"d",
"a[i]",
"a",
"i",
"1",
"print(ans)",
"print",
"ans",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"ans=0",
"0",
"ans",
"accum=[0]*n",
"[0]*n",
"accum",
"maxi=0",
"0",
"maxi",
"d={}",
"{}",
"d",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"ans+=1",
"1",
"ans",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"maxi=max(maxi,accum[i+1]-a[i])",
"max(maxi,accum[i+1]-a[i])",
"maxi"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
accum=[0]*n
accum[n-1]=a[n-1]
for i in reversed(range(1,n)):
accum[i-1]=max(accum[i],a[i-1])
maxi=0
for i in range(n-1):
maxi=max(maxi,accum[i+1]-a[i])
ans=0
d={}
for i in range(n):
if a[i]-maxi>0:
if a[i]-maxi in d:
if d[a[i]-maxi]>0:
d[a[i]-maxi]-=1
ans+=1
if a[i] not in d:
d[a[i]]=1
else:
d[a[i]]+=1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
18,
13,
39,
17,
0,
13,
39,
28,
13,
13,
4,
13,
13,
14,
2,
13,
17,
0,
13,
39,
18,
13,
13,
0,
13,
39,
4,
13,
18,
13,
13,
18,
13,
17,
41,
28,
13,
13,
4,
13,
18,
13,
39,
17,
13,
4,
4,
13,
17,
2,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
17,
13,
10,
13,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] |
[
[
130,
2
],
[
130,
11
],
[
103,
13
],
[
106,
25
],
[
104,
27
],
[
127,
31
],
[
107,
38
],
[
109,
44
],
[
107,
47
],
[
118,
50
],
[
107,
55
],
[
128,
58
],
[
119,
58
],
[
110,
58
],
[
119,
67
],
[
110,
67
],
[
128,
67
],
[
104,
70
],
[
115,
79
],
[
133,
82
],
[
116,
85
],
[
121,
87
],
[
91,
90
],
[
116,
90
],
[
90,
94
],
[
134,
95
],
[
112,
97
],
[
113,
101
],
[
122,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
130,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
]
] |
[
"n,t = map(int,input().split())\nA = list(map(int,input().split()))\nA_rev = A[::-1]\ntmp_max = []\nfor i, a in enumerate(A_rev):\n if i==0:\n tmp_max = [A_rev[i]]\n else:\n tmp_max += [max(A_rev[i], tmp_max[-1])]\nbuy = [max(0, x-y) for x,y in zip(tmp_max[::-1], A)]\nx = max(buy)\ncnt = 0\nfor b in buy:\n if b==x:\n cnt += 1\nprint(cnt)",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"A = list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"A_rev = A[::-1]",
"A_rev",
"A[::-1]",
"A",
"::-1",
"-1",
"tmp_max = []",
"tmp_max",
"[]",
"for i, a in enumerate(A_rev):\n if i==0:\n tmp_max = [A_rev[i]]\n else:\n tmp_max += [max(A_rev[i], tmp_max[-1])]",
"i",
"a",
"enumerate(A_rev)",
"enumerate",
"A_rev",
"if i==0:\n tmp_max = [A_rev[i]]\n else:\n tmp_max += [max(A_rev[i], tmp_max[-1])]",
"i==0",
"i",
"0",
"tmp_max = [A_rev[i]]",
"tmp_max",
"[A_rev[i]]",
"A_rev[i]",
"A_rev",
"i",
"tmp_max += [max(A_rev[i], tmp_max[-1])]",
"tmp_max",
"[max(A_rev[i], tmp_max[-1])]",
"max(A_rev[i], tmp_max[-1])",
"max",
"A_rev[i]",
"A_rev",
"i",
"tmp_max[-1]",
"tmp_max",
"-1",
"max(0, x-y) for x,y in zip(tmp_max[::-1], A)",
"for x,y in zip(tmp_max[::-1], A)",
"x",
"y",
"zip(tmp_max[::-1], A)",
"zip",
"tmp_max[::-1]",
"tmp_max",
"::-1",
"-1",
"A",
"for x,y in zip(tmp_max[::-1], A)",
"max(0, x-y)",
"max",
"0",
"x-y",
"x",
"y",
"buy = [max(0, x-y) for x,y in zip(tmp_max[::-1], A)]",
"buy",
"[max(0, x-y) for x,y in zip(tmp_max[::-1], A)]",
"x = max(buy)",
"x",
"max(buy)",
"max",
"buy",
"cnt = 0",
"cnt",
"0",
"for b in buy:\n if b==x:\n cnt += 1",
"b",
"buy",
"if b==x:\n cnt += 1",
"b==x",
"b",
"x",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"A_rev = A[::-1]",
"A[::-1]",
"A_rev",
"tmp_max = [A_rev[i]]",
"[A_rev[i]]",
"tmp_max",
"cnt += 1",
"1",
"cnt",
"buy = [max(0, x-y) for x,y in zip(tmp_max[::-1], A)]",
"[max(0, x-y) for x,y in zip(tmp_max[::-1], A)]",
"buy",
"tmp_max += [max(A_rev[i], tmp_max[-1])]",
"[max(A_rev[i], tmp_max[-1])]",
"tmp_max",
"cnt = 0",
"0",
"cnt",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"tmp_max = []",
"[]",
"tmp_max",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"x = max(buy)",
"max(buy)",
"x"
] |
n,t = map(int,input().split())
A = list(map(int,input().split()))
A_rev = A[::-1]
tmp_max = []
for i, a in enumerate(A_rev):
if i==0:
tmp_max = [A_rev[i]]
else:
tmp_max += [max(A_rev[i], tmp_max[-1])]
buy = [max(0, x-y) for x,y in zip(tmp_max[::-1], A)]
x = max(buy)
cnt = 0
for b in buy:
if b==x:
cnt += 1
print(cnt)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
13,
14,
2,
2,
18,
13,
2,
4,
13,
13,
17,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13
] |
[
[
125,
2
],
[
125,
11
],
[
122,
13
],
[
131,
25
],
[
110,
28
],
[
119,
31
],
[
35,
34
],
[
123,
40
],
[
123,
45
],
[
34,
46
],
[
111,
47
],
[
129,
47
],
[
128,
49
],
[
123,
51
],
[
34,
52
],
[
111,
56
],
[
129,
56
],
[
123,
58
],
[
34,
59
],
[
132,
61
],
[
138,
61
],
[
123,
64
],
[
34,
65
],
[
111,
66
],
[
129,
66
],
[
113,
68
],
[
132,
72
],
[
138,
72
],
[
123,
75
],
[
34,
76
],
[
111,
77
],
[
129,
77
],
[
134,
79
],
[
137,
82
],
[
123,
85
],
[
34,
86
],
[
111,
87
],
[
129,
87
],
[
123,
92
],
[
123,
96
],
[
129,
98
],
[
111,
98
],
[
138,
99
],
[
132,
99
],
[
107,
101
],
[
108,
105
],
[
135,
105
],
[
114,
105
],
[
120,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
125,
117
],
[
119,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\nmax=0\nmin=1000000000000000000000000000000000000\nans=1\nfor i in range(len(a)-1):\n if a[i]<min:\n min=a[i]\n elif min==a[i] or max==a[i]-min:\n ans+=1\n elif max<a[i]-min:\n ans=1\n max=a[i]-min\nif a[len(a)-1]-min==max:\n ans+=1\nprint(ans)",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"max=0",
"max",
"0",
"min=1000000000000000000000000000000000000",
"min",
"1000000000000000000000000000000000000",
"ans=1",
"ans",
"1",
"for i in range(len(a)-1):\n if a[i]<min:\n min=a[i]\n elif min==a[i] or max==a[i]-min:\n ans+=1\n elif max<a[i]-min:\n ans=1\n max=a[i]-min",
"i",
"range(len(a)-1)",
"range",
"len(a)-1",
"len(a)",
"len",
"a",
"1",
"if a[i]<min:\n min=a[i]\n elif min==a[i] or max==a[i]-min:\n ans+=1\n elif max<a[i]-min:\n ans=1\n max=a[i]-min",
"a[i]<min",
"a[i]",
"a",
"i",
"min",
"min=a[i]",
"min",
"a[i]",
"a",
"i",
"elif min==a[i] or max==a[i]-min:\n ans+=1\n ",
"min==a[i] or max==a[i]-min",
"min==a[i]",
"min",
"a[i]",
"a",
"i",
"max==a[i]-min",
"max",
"a[i]-min",
"a[i]",
"a",
"i",
"min",
"ans+=1",
"ans",
"1",
"elif max<a[i]-min:\n ans=1\n max=a[i]-min",
"max<a[i]-min",
"max",
"a[i]-min",
"a[i]",
"a",
"i",
"min",
"ans=1",
"ans",
"1",
"max=a[i]-min",
"max",
"a[i]-min",
"a[i]",
"a",
"i",
"min",
"if a[len(a)-1]-min==max:\n ans+=1",
"a[len(a)-1]-min==max",
"a[len(a)-1]-min",
"a[len(a)-1]",
"a",
"len(a)-1",
"len(a)",
"len",
"a",
"1",
"min",
"max",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans+=1",
"1",
"ans",
"min=1000000000000000000000000000000000000",
"1000000000000000000000000000000000000",
"min",
"ans+=1",
"1",
"ans",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"ans=1",
"1",
"ans",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"min=a[i]",
"a[i]",
"min",
"max=0",
"0",
"max",
"ans=1",
"1",
"ans",
"max=a[i]-min",
"a[i]-min",
"max"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
max=0
min=1000000000000000000000000000000000000
ans=1
for i in range(len(a)-1):
if a[i]<min:
min=a[i]
elif min==a[i] or max==a[i]-min:
ans+=1
elif max<a[i]-min:
ans=1
max=a[i]-min
if a[len(a)-1]-min==max:
ans+=1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
18,
13,
17,
0,
13,
39,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13
] |
[
[
85,
2
],
[
85,
11
],
[
88,
13
],
[
82,
25
],
[
89,
27
],
[
76,
30
],
[
34,
33
],
[
74,
37
],
[
79,
39
],
[
83,
42
],
[
80,
42
],
[
89,
44
],
[
33,
46
],
[
77,
50
],
[
89,
54
],
[
33,
55
],
[
80,
56
],
[
83,
56
],
[
70,
58
],
[
77,
61
],
[
77,
66
],
[
71,
68
],
[
70,
71
],
[
85,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\nm = A[0]\nB = []\nfor i in range(1, N):\n m = min(m, A[i-1])\n B.append(A[i]-m)\n\nM = max(B)\nprint(B.count(M))",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"m = A[0]",
"m",
"A[0]",
"A",
"0",
"B = []",
"B",
"[]",
"for i in range(1, N):\n m = min(m, A[i-1])\n B.append(A[i]-m)",
"i",
"range(1, N)",
"range",
"1",
"N",
"m = min(m, A[i-1])",
"m",
"min(m, A[i-1])",
"min",
"m",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"B.append(A[i]-m)",
"B.append",
"B",
"append",
"A[i]-m",
"A[i]",
"A",
"i",
"m",
"M = max(B)",
"M",
"max(B)",
"max",
"B",
"print(B.count(M))",
"print",
"B.count(M)",
"B.count",
"B",
"count",
"M",
"M = max(B)",
"max(B)",
"M",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"B = []",
"[]",
"B",
"m = min(m, A[i-1])",
"min(m, A[i-1])",
"m",
"m = A[0]",
"A[0]",
"m",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
m = A[0]
B = []
for i in range(1, N):
m = min(m, A[i-1])
B.append(A[i]-m)
M = max(B)
print(B.count(M))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
0,
13,
4,
13,
0,
13,
17,
0,
13,
2,
17,
17,
28,
13,
13,
4,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
39,
13,
14,
2,
13,
13,
4,
18,
13,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
14,
2,
2,
13,
13,
13,
4,
18,
13,
13,
13,
28,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
13,
4,
13,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] |
[
[
142,
2
],
[
142,
11
],
[
145,
13
],
[
133,
25
],
[
124,
29
],
[
127,
33
],
[
115,
36
],
[
146,
45
],
[
116,
49
],
[
149,
49
],
[
148,
51
],
[
136,
54
],
[
116,
60
],
[
149,
60
],
[
137,
63
],
[
149,
70
],
[
116,
70
],
[
128,
71
],
[
140,
71
],
[
139,
73
],
[
149,
76
],
[
116,
76
],
[
130,
78
],
[
118,
81
],
[
137,
84
],
[
149,
89
],
[
116,
89
],
[
128,
90
],
[
140,
90
],
[
125,
93
],
[
131,
93
],
[
98,
97
],
[
137,
97
],
[
134,
101
],
[
119,
101
],
[
97,
103
],
[
131,
110
],
[
125,
110
],
[
119,
113
],
[
134,
113
],
[
115,
116
],
[
118,
119
],
[
142,
122
],
[
124,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\nmins = set()\nmaxs = set()\nma = 0\nmi = 10**9\nfor ind, i in enumerate(a):\n if i<mi:\n mi = i\n min_ind = [ind]\n elif i==mi:\n min_ind.append(ind)\n if i-mi>ma:\n ma = i-mi\n maxs = {ind}\n mins = set(min_ind)\n elif i-mi==ma:\n maxs.add(ind)\n for j in min_ind:\n mins.add(j)\nprint(min(len(maxs), len(mins)))",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mins = set()",
"mins",
"set()",
"set",
"maxs = set()",
"maxs",
"set()",
"set",
"ma = 0",
"ma",
"0",
"mi = 10**9",
"mi",
"10**9",
"10",
"9",
"for ind, i in enumerate(a):\n if i<mi:\n mi = i\n min_ind = [ind]\n elif i==mi:\n min_ind.append(ind)\n if i-mi>ma:\n ma = i-mi\n maxs = {ind}\n mins = set(min_ind)\n elif i-mi==ma:\n maxs.add(ind)\n for j in min_ind:\n mins.add(j)",
"ind",
"i",
"enumerate(a)",
"enumerate",
"a",
"if i<mi:\n mi = i\n min_ind = [ind]\n elif i==mi:\n min_ind.append(ind)\n ",
"i<mi",
"i",
"mi",
"mi = i",
"mi",
"i",
"min_ind = [ind]",
"min_ind",
"[ind]",
"ind",
"elif i==mi:\n min_ind.append(ind)\n ",
"i==mi",
"i",
"mi",
"min_ind.append(ind)",
"min_ind.append",
"min_ind",
"append",
"ind",
"if i-mi>ma:\n ma = i-mi\n maxs = {ind}\n mins = set(min_ind)\n elif i-mi==ma:\n maxs.add(ind)\n for j in min_ind:\n mins.add(j)",
"i-mi>ma",
"i-mi",
"i",
"mi",
"ma",
"ma = i-mi",
"ma",
"i-mi",
"i",
"mi",
"maxs = {ind}",
"maxs",
"{ind}",
"mins = set(min_ind)",
"mins",
"set(min_ind)",
"set",
"min_ind",
"elif i-mi==ma:\n maxs.add(ind)\n for j in min_ind:\n mins.add(j)",
"i-mi==ma",
"i-mi",
"i",
"mi",
"ma",
"maxs.add(ind)",
"maxs.add",
"maxs",
"add",
"ind",
"for j in min_ind:\n mins.add(j)",
"j",
"min_ind",
"mins.add(j)",
"mins.add",
"mins",
"add",
"j",
"print(min(len(maxs), len(mins)))",
"print",
"min(len(maxs), len(mins))",
"min",
"len(maxs)",
"len",
"maxs",
"len(mins)",
"len",
"mins",
"mi = 10**9",
"10**9",
"mi",
"mins = set(min_ind)",
"set(min_ind)",
"mins",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"maxs = set()",
"set()",
"maxs",
"ma = 0",
"0",
"ma",
"maxs = {ind}",
"{ind}",
"maxs",
"mins = set()",
"set()",
"mins",
"min_ind = [ind]",
"[ind]",
"min_ind",
"ma = i-mi",
"i-mi",
"ma",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"mi = i",
"i",
"mi"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
mins = set()
maxs = set()
ma = 0
mi = 10**9
for ind, i in enumerate(a):
if i<mi:
mi = i
min_ind = [ind]
elif i==mi:
min_ind.append(ind)
if i-mi>ma:
ma = i-mi
maxs = {ind}
mins = set(min_ind)
elif i-mi==ma:
maxs.add(ind)
for j in min_ind:
mins.add(j)
print(min(len(maxs), len(mins)))
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
106,
2
],
[
106,
11
],
[
88,
13
],
[
103,
25
],
[
89,
27
],
[
107,
29
],
[
115,
32
],
[
109,
35
],
[
39,
38
],
[
107,
42
],
[
89,
49
],
[
38,
50
],
[
104,
51
],
[
98,
51
],
[
97,
53
],
[
89,
55
],
[
38,
56
],
[
91,
58
],
[
98,
60
],
[
104,
60
],
[
89,
62
],
[
38,
63
],
[
92,
66
],
[
116,
67
],
[
113,
67
],
[
112,
69
],
[
92,
70
],
[
100,
72
],
[
92,
76
],
[
116,
77
],
[
113,
77
],
[
94,
79
],
[
95,
83
],
[
101,
83
],
[
110,
83
],
[
106,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
92,
112
],
[
112,
113
],
[
115,
116
]
] |
[
"n,t = map(int,input().split())\na= list(map(int,input().split()))\n\nmaxa = a[n-1]\nsa = 0\nres = 1\nfor i in range(n-1,-1,-1):\n if a[i] > maxa:\n maxa = a[i]\n tsa = maxa - a[i]\n if tsa > sa:\n sa = tsa\n res =1\n elif tsa == sa:\n res += 1\n\nprint(res)",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a= list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"maxa = a[n-1]",
"maxa",
"a[n-1]",
"a",
"n-1",
"n",
"1",
"sa = 0",
"sa",
"0",
"res = 1",
"res",
"1",
"for i in range(n-1,-1,-1):\n if a[i] > maxa:\n maxa = a[i]\n tsa = maxa - a[i]\n if tsa > sa:\n sa = tsa\n res =1\n elif tsa == sa:\n res += 1",
"i",
"range(n-1,-1,-1)",
"range",
"n-1",
"n",
"1",
"-1",
"-1",
"if a[i] > maxa:\n maxa = a[i]\n ",
"a[i] > maxa",
"a[i]",
"a",
"i",
"maxa",
"maxa = a[i]",
"maxa",
"a[i]",
"a",
"i",
"tsa = maxa - a[i]",
"tsa",
"maxa - a[i]",
"maxa",
"a[i]",
"a",
"i",
"if tsa > sa:\n sa = tsa\n res =1\n elif tsa == sa:\n res += 1",
"tsa > sa",
"tsa",
"sa",
"sa = tsa",
"sa",
"tsa",
"res =1",
"res",
"1",
"elif tsa == sa:\n res += 1",
"tsa == sa",
"tsa",
"sa",
"res += 1",
"res",
"1",
"print(res)",
"print",
"res",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"a= list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"tsa = maxa - a[i]",
"maxa - a[i]",
"tsa",
"res += 1",
"1",
"res",
"maxa = a[i]",
"a[i]",
"maxa",
"res =1",
"1",
"res",
"maxa = a[n-1]",
"a[n-1]",
"maxa",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"res = 1",
"1",
"res",
"sa = tsa",
"tsa",
"sa",
"sa = 0",
"0",
"sa"
] |
n,t = map(int,input().split())
a= list(map(int,input().split()))
maxa = a[n-1]
sa = 0
res = 1
for i in range(n-1,-1,-1):
if a[i] > maxa:
maxa = a[i]
tsa = maxa - a[i]
if tsa > sa:
sa = tsa
res =1
elif tsa == sa:
res += 1
print(res)
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
4,
18,
13,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
143,
2
],
[
143,
13
],
[
125,
15
],
[
131,
27
],
[
138,
31
],
[
35,
34
],
[
138,
37
],
[
128,
41
],
[
126,
45
],
[
51,
48
],
[
129,
49
],
[
126,
52
],
[
56,
55
],
[
138,
59
],
[
64,
61
],
[
129,
62
],
[
55,
63
],
[
129,
67
],
[
55,
69
],
[
126,
72
],
[
55,
73
],
[
129,
76
],
[
126,
80
],
[
84,
83
],
[
138,
87
],
[
92,
89
],
[
132,
90
],
[
83,
91
],
[
61,
93
],
[
129,
94
],
[
83,
95
],
[
126,
97
],
[
83,
98
],
[
140,
100
],
[
132,
103
],
[
134,
105
],
[
109,
108
],
[
138,
111
],
[
141,
114
],
[
89,
115
],
[
132,
116
],
[
108,
117
],
[
146,
119
],
[
147,
123
],
[
135,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
143,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
]
] |
[
"n, t = list(map(int, input().split()))\na = list(map(int, input().split()))\ndif_list = [0] * n\nmax_list = [0 for i in range(n)]\na.reverse()\nmax_list[0] = a[0]\nfor i in range(1,n):\n max_list[i] = max(max_list[i-1], a[i])\nmax_list.reverse()\na.reverse()\nfor i in range(0,n):\n dif_list[i] = max_list[i] - a[i]\n\nk = max(dif_list)\ncount = 0\nfor i in range(n):\n if k == dif_list[i]:\n count += 1\nprint(count)",
"n, t = list(map(int, input().split()))",
"n",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"dif_list = [0] * n",
"dif_list",
"[0] * n",
"[0]",
"0",
"n",
"0 for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"0",
"max_list = [0 for i in range(n)]",
"max_list",
"[0 for i in range(n)]",
"a.reverse()",
"a.reverse",
"a",
"reverse",
"max_list[0] = a[0]",
"max_list[0]",
"max_list",
"0",
"a[0]",
"a",
"0",
"for i in range(1,n):\n max_list[i] = max(max_list[i-1], a[i])",
"i",
"range(1,n)",
"range",
"1",
"n",
"max_list[i] = max(max_list[i-1], a[i])",
"max_list[i]",
"max_list",
"i",
"max(max_list[i-1], a[i])",
"max",
"max_list[i-1]",
"max_list",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"max_list.reverse()",
"max_list.reverse",
"max_list",
"reverse",
"a.reverse()",
"a.reverse",
"a",
"reverse",
"for i in range(0,n):\n dif_list[i] = max_list[i] - a[i]",
"i",
"range(0,n)",
"range",
"0",
"n",
"dif_list[i] = max_list[i] - a[i]",
"dif_list[i]",
"dif_list",
"i",
"max_list[i] - a[i]",
"max_list[i]",
"max_list",
"i",
"a[i]",
"a",
"i",
"k = max(dif_list)",
"k",
"max(dif_list)",
"max",
"dif_list",
"count = 0",
"count",
"0",
"for i in range(n):\n if k == dif_list[i]:\n count += 1",
"i",
"range(n)",
"range",
"n",
"if k == dif_list[i]:\n count += 1",
"k == dif_list[i]",
"k",
"dif_list[i]",
"dif_list",
"i",
"count += 1",
"count",
"1",
"print(count)",
"print",
"count",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"max_list = [0 for i in range(n)]",
"[0 for i in range(n)]",
"max_list",
"dif_list = [0] * n",
"[0] * n",
"dif_list",
"count = 0",
"0",
"count",
"n, t = list(map(int, input().split()))",
"list(map(int, input().split()))",
"n",
"k = max(dif_list)",
"max(dif_list)",
"k",
"t = list(map(int, input().split()))",
"list(map(int, input().split()))",
"t",
"count += 1",
"1",
"count"
] |
n, t = list(map(int, input().split()))
a = list(map(int, input().split()))
dif_list = [0] * n
max_list = [0 for i in range(n)]
a.reverse()
max_list[0] = a[0]
for i in range(1,n):
max_list[i] = max(max_list[i-1], a[i])
max_list.reverse()
a.reverse()
for i in range(0,n):
dif_list[i] = max_list[i] - a[i]
k = max(dif_list)
count = 0
for i in range(n):
if k == dif_list[i]:
count += 1
print(count)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
0,
13,
17,
28,
13,
18,
13,
39,
17,
0,
13,
4,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
13,
18,
13,
39,
17,
18,
13,
39,
17,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
0,
13,
13,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
39,
13,
10,
17,
13,
10,
17,
13
] |
[
[
111,
2
],
[
111,
11
],
[
96,
13
],
[
123,
25
],
[
129,
28
],
[
32,
31
],
[
97,
33
],
[
114,
37
],
[
31,
40
],
[
130,
41
],
[
115,
41
],
[
124,
44
],
[
115,
46
],
[
130,
46
],
[
124,
49
],
[
117,
52
],
[
99,
55
],
[
97,
63
],
[
124,
67
],
[
102,
71
],
[
103,
77
],
[
118,
78
],
[
121,
78
],
[
126,
80
],
[
120,
83
],
[
103,
84
],
[
103,
87
],
[
118,
88
],
[
121,
88
],
[
108,
90
],
[
109,
94
],
[
127,
94
],
[
100,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
111,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
103,
120
],
[
120,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
]
] |
[
"n,t = map(int, input().split())\na = list(map(int, input().split()))\nMAX = []\nnow = 0\nfor i in a[::-1]:\n now = max(i,now)\n MAX.append(now)\nMAX.reverse()\nmax_margin = 0\nans = 0\nfor i,j in zip(a[:-1],MAX[1:]):\n margin = j-i\n if margin > max_margin:\n ans = 1\n max_margin = margin\n elif margin == max_margin:\n ans += 1\nprint(ans)",
"n,t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"MAX = []",
"MAX",
"[]",
"now = 0",
"now",
"0",
"for i in a[::-1]:\n now = max(i,now)\n MAX.append(now)",
"i",
"a[::-1]",
"a",
"::-1",
"-1",
"now = max(i,now)",
"now",
"max(i,now)",
"max",
"i",
"now",
"MAX.append(now)",
"MAX.append",
"MAX",
"append",
"now",
"MAX.reverse()",
"MAX.reverse",
"MAX",
"reverse",
"max_margin = 0",
"max_margin",
"0",
"ans = 0",
"ans",
"0",
"for i,j in zip(a[:-1],MAX[1:]):\n margin = j-i\n if margin > max_margin:\n ans = 1\n max_margin = margin\n elif margin == max_margin:\n ans += 1",
"i",
"j",
"zip(a[:-1],MAX[1:])",
"zip",
"a[:-1]",
"a",
":-1",
"-1",
"MAX[1:]",
"MAX",
"1:",
"1",
"margin = j-i",
"margin",
"j-i",
"j",
"i",
"if margin > max_margin:\n ans = 1\n max_margin = margin\n elif margin == max_margin:\n ans += 1",
"margin > max_margin",
"margin",
"max_margin",
"ans = 1",
"ans",
"1",
"max_margin = margin",
"max_margin",
"margin",
"elif margin == max_margin:\n ans += 1",
"margin == max_margin",
"margin",
"max_margin",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"ans = 0",
"0",
"ans",
"margin = j-i",
"j-i",
"margin",
"n,t = map(int, input().split())",
"map(int, input().split())",
"n",
"ans += 1",
"1",
"ans",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"now = max(i,now)",
"max(i,now)",
"now",
"max_margin = 0",
"0",
"max_margin",
"max_margin = margin",
"margin",
"max_margin",
"MAX = []",
"[]",
"MAX",
"ans = 1",
"1",
"ans",
"now = 0",
"0",
"now"
] |
n,t = map(int, input().split())
a = list(map(int, input().split()))
MAX = []
now = 0
for i in a[::-1]:
now = max(i,now)
MAX.append(now)
MAX.reverse()
max_margin = 0
ans = 0
for i,j in zip(a[:-1],MAX[1:]):
margin = j-i
if margin > max_margin:
ans = 1
max_margin = margin
elif margin == max_margin:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
18,
13,
17,
0,
13,
39,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
40,
18,
13,
13,
18,
13,
17,
4,
18,
13,
13,
18,
13,
13,
4,
18,
13,
13,
18,
13,
17,
14,
40,
18,
13,
2,
40,
13,
17,
18,
13,
17,
4,
18,
13,
13,
18,
13,
2,
40,
13,
17,
4,
18,
13,
13,
18,
13,
17,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
18,
13,
2,
40,
13,
17,
18,
13,
13,
0,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
17,
0,
13,
4,
13,
13,
28,
13,
4,
13,
2,
13,
17,
14,
2,
2,
18,
13,
13,
13,
40,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13
] |
[
[
180,
2
],
[
180,
11
],
[
165,
13
],
[
168,
25
],
[
166,
28
],
[
183,
31
],
[
166,
34
],
[
38,
37
],
[
163,
41
],
[
166,
45
],
[
37,
46
],
[
169,
48
],
[
169,
52
],
[
166,
55
],
[
37,
56
],
[
169,
59
],
[
169,
62
],
[
166,
67
],
[
37,
70
],
[
184,
73
],
[
184,
77
],
[
166,
80
],
[
37,
83
],
[
184,
87
],
[
184,
90
],
[
95,
94
],
[
163,
98
],
[
184,
103
],
[
94,
106
],
[
169,
109
],
[
94,
110
],
[
174,
112
],
[
175,
116
],
[
159,
122
],
[
171,
125
],
[
175,
128
],
[
131,
130
],
[
163,
134
],
[
175,
140
],
[
130,
141
],
[
172,
142
],
[
175,
145
],
[
130,
146
],
[
175,
148
],
[
130,
150
],
[
177,
153
],
[
178,
157
],
[
160,
157
],
[
159,
160
],
[
180,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
],
[
177,
178
],
[
180,
181
],
[
183,
184
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\nlmin=[a[0]]\nrmax=[a[-1]]\nfor i in range(1,n):\n if a[i]<=lmin[-1]:\n lmin.append(a[i])\n else:\n lmin.append(lmin[-1])\n if a[-i-1]>=rmax[-1]:\n rmax.append(a[-i-1])\n else:\n rmax.append(rmax[-1])\nmxls=[rmax[-i-2]-lmin[i] for i in range(n-1)]\nmxls.append(-10**18)\nans=0\nmx=max(mxls)\nfor i in range(n-1):\n if mxls[i]==mx and mxls[i]!=mxls[i+1]:\n ans+=1\nprint(ans)",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"lmin=[a[0]]",
"lmin",
"[a[0]]",
"a[0]",
"a",
"0",
"rmax=[a[-1]]",
"rmax",
"[a[-1]]",
"a[-1]",
"a",
"-1",
"for i in range(1,n):\n if a[i]<=lmin[-1]:\n lmin.append(a[i])\n else:\n lmin.append(lmin[-1])\n if a[-i-1]>=rmax[-1]:\n rmax.append(a[-i-1])\n else:\n rmax.append(rmax[-1])",
"i",
"range(1,n)",
"range",
"1",
"n",
"if a[i]<=lmin[-1]:\n lmin.append(a[i])\n else:\n lmin.append(lmin[-1])\n ",
"a[i]<=lmin[-1]",
"a[i]",
"a",
"i",
"lmin[-1]",
"lmin",
"-1",
"lmin.append(a[i])",
"lmin.append",
"lmin",
"append",
"a[i]",
"a",
"i",
"lmin.append(lmin[-1])",
"lmin.append",
"lmin",
"append",
"lmin[-1]",
"lmin",
"-1",
"if a[-i-1]>=rmax[-1]:\n rmax.append(a[-i-1])\n else:\n rmax.append(rmax[-1])",
"a[-i-1]>=rmax[-1]",
"a[-i-1]",
"a",
"-i-1",
"-i",
"i",
"1",
"rmax[-1]",
"rmax",
"-1",
"rmax.append(a[-i-1])",
"rmax.append",
"rmax",
"append",
"a[-i-1]",
"a",
"-i-1",
"-i",
"i",
"1",
"rmax.append(rmax[-1])",
"rmax.append",
"rmax",
"append",
"rmax[-1]",
"rmax",
"-1",
"rmax[-i-2]-lmin[i] for i in range(n-1)",
"for i in range(n-1)",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"for i in range(n-1)",
"rmax[-i-2]-lmin[i]",
"rmax[-i-2]",
"rmax",
"-i-2",
"-i",
"i",
"2",
"lmin[i]",
"lmin",
"i",
"mxls=[rmax[-i-2]-lmin[i] for i in range(n-1)]",
"mxls",
"[rmax[-i-2]-lmin[i] for i in range(n-1)]",
"mxls.append(-10**18)",
"mxls.append",
"mxls",
"append",
"-10**18",
"-10",
"18",
"ans=0",
"ans",
"0",
"mx=max(mxls)",
"mx",
"max(mxls)",
"max",
"mxls",
"for i in range(n-1):\n if mxls[i]==mx and mxls[i]!=mxls[i+1]:\n ans+=1",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"if mxls[i]==mx and mxls[i]!=mxls[i+1]:\n ans+=1",
"mxls[i]==mx and mxls[i]!=mxls[i+1]",
"mxls[i]==mx",
"mxls[i]",
"mxls",
"i",
"mx",
"mxls[i]!=mxls[i+1]",
"mxls[i]",
"mxls",
"i",
"mxls[i+1]",
"mxls",
"i+1",
"i",
"1",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans=0",
"0",
"ans",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"lmin=[a[0]]",
"[a[0]]",
"lmin",
"mx=max(mxls)",
"max(mxls)",
"mx",
"mxls=[rmax[-i-2]-lmin[i] for i in range(n-1)]",
"[rmax[-i-2]-lmin[i] for i in range(n-1)]",
"mxls",
"ans+=1",
"1",
"ans",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"rmax=[a[-1]]",
"[a[-1]]",
"rmax"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
lmin=[a[0]]
rmax=[a[-1]]
for i in range(1,n):
if a[i]<=lmin[-1]:
lmin.append(a[i])
else:
lmin.append(lmin[-1])
if a[-i-1]>=rmax[-1]:
rmax.append(a[-i-1])
else:
rmax.append(rmax[-1])
mxls=[rmax[-i-2]-lmin[i] for i in range(n-1)]
mxls.append(-10**18)
ans=0
mx=max(mxls)
for i in range(n-1):
if mxls[i]==mx and mxls[i]!=mxls[i+1]:
ans+=1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
17,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
13,
13,
17,
41,
28,
13,
4,
13,
2,
4,
13,
13,
17,
4,
17,
0,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
17,
17,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
18,
13,
13,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
18,
13,
13,
14,
2,
2,
18,
13,
13,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] |
[
[
148,
2
],
[
148,
15
],
[
145,
17
],
[
35,
34
],
[
146,
40
],
[
139,
45
],
[
151,
48
],
[
157,
51
],
[
55,
54
],
[
146,
60
],
[
140,
67
],
[
54,
69
],
[
146,
72
],
[
54,
73
],
[
78,
75
],
[
140,
76
],
[
54,
77
],
[
146,
79
],
[
54,
80
],
[
85,
82
],
[
140,
83
],
[
54,
84
],
[
140,
86
],
[
54,
88
],
[
92,
91
],
[
146,
96
],
[
82,
100
],
[
75,
100
],
[
140,
101
],
[
91,
102
],
[
146,
104
],
[
91,
105
],
[
158,
106
],
[
143,
106
],
[
154,
108
],
[
142,
111
],
[
82,
113
],
[
75,
113
],
[
140,
114
],
[
91,
115
],
[
146,
117
],
[
91,
118
],
[
82,
122
],
[
75,
122
],
[
140,
123
],
[
91,
124
],
[
146,
126
],
[
91,
127
],
[
158,
128
],
[
143,
128
],
[
160,
130
],
[
161,
134
],
[
155,
134
],
[
152,
134
],
[
148,
137
],
[
139,
140
],
[
142,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
]
] |
[
"N,T = map(int,input().rstrip().split(\" \"))\nA = list(map(int,input().rstrip().split(\" \")))\nmax_ra = [0 for i in range(len(A)+1)]\nans = 0\nk = 0\nfor i in range(len(A)-1,-1,-1):\n if max_ra[i+1] < A[i]:\n max_ra[i] = A[i]\n else:\n max_ra[i] = max_ra[i+1]\nfor i in range(len(A)):\n if max_ra[i] - A[i] > k:\n ans = 1\n k = max_ra[i] - A[i]\n elif max_ra[i] - A[i] == k:\n ans += 1\nprint(ans)",
"N,T = map(int,input().rstrip().split(\" \"))",
"N",
"map(int,input().rstrip().split(\" \"))",
"map",
"int",
"input().rstrip().split(\" \")",
"().rstrip().split",
"().rstrip()",
"().rstrip",
"()",
"input",
"rstrip",
"split",
"\" \"",
"T",
"A = list(map(int,input().rstrip().split(\" \")))",
"A",
"list(map(int,input().rstrip().split(\" \")))",
"list",
"map(int,input().rstrip().split(\" \"))",
"map",
"int",
"input().rstrip().split(\" \")",
"().rstrip().split",
"().rstrip()",
"().rstrip",
"()",
"input",
"rstrip",
"split",
"\" \"",
"0 for i in range(len(A)+1)",
"for i in range(len(A)+1)",
"i",
"range(len(A)+1)",
"range",
"len(A)+1",
"len(A)",
"len",
"A",
"1",
"for i in range(len(A)+1)",
"0",
"max_ra = [0 for i in range(len(A)+1)]",
"max_ra",
"[0 for i in range(len(A)+1)]",
"ans = 0",
"ans",
"0",
"k = 0",
"k",
"0",
"for i in range(len(A)-1,-1,-1):\n if max_ra[i+1] < A[i]:\n max_ra[i] = A[i]\n else:\n max_ra[i] = max_ra[i+1]",
"i",
"range(len(A)-1,-1,-1)",
"range",
"len(A)-1",
"len(A)",
"len",
"A",
"1",
"-1",
"-1",
"if max_ra[i+1] < A[i]:\n max_ra[i] = A[i]\n else:\n max_ra[i] = max_ra[i+1]",
"max_ra[i+1] < A[i]",
"max_ra[i+1]",
"max_ra",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"max_ra[i] = A[i]",
"max_ra[i]",
"max_ra",
"i",
"A[i]",
"A",
"i",
"max_ra[i] = max_ra[i+1]",
"max_ra[i]",
"max_ra",
"i",
"max_ra[i+1]",
"max_ra",
"i+1",
"i",
"1",
"for i in range(len(A)):\n if max_ra[i] - A[i] > k:\n ans = 1\n k = max_ra[i] - A[i]\n elif max_ra[i] - A[i] == k:\n ans += 1",
"i",
"range(len(A))",
"range",
"len(A)",
"len",
"A",
"if max_ra[i] - A[i] > k:\n ans = 1\n k = max_ra[i] - A[i]\n elif max_ra[i] - A[i] == k:\n ans += 1",
"max_ra[i] - A[i] > k",
"max_ra[i] - A[i]",
"max_ra[i]",
"max_ra",
"i",
"A[i]",
"A",
"i",
"k",
"ans = 1",
"ans",
"1",
"k = max_ra[i] - A[i]",
"k",
"max_ra[i] - A[i]",
"max_ra[i]",
"max_ra",
"i",
"A[i]",
"A",
"i",
"elif max_ra[i] - A[i] == k:\n ans += 1",
"max_ra[i] - A[i] == k",
"max_ra[i] - A[i]",
"max_ra[i]",
"max_ra",
"i",
"A[i]",
"A",
"i",
"k",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"T = map(int,input().rstrip().split(\" \"))",
"map(int,input().rstrip().split(\" \"))",
"T",
"max_ra = [0 for i in range(len(A)+1)]",
"[0 for i in range(len(A)+1)]",
"max_ra",
"k = max_ra[i] - A[i]",
"max_ra[i] - A[i]",
"k",
"A = list(map(int,input().rstrip().split(\" \")))",
"list(map(int,input().rstrip().split(\" \")))",
"A",
"N,T = map(int,input().rstrip().split(\" \"))",
"map(int,input().rstrip().split(\" \"))",
"N",
"ans = 0",
"0",
"ans",
"ans = 1",
"1",
"ans",
"k = 0",
"0",
"k",
"ans += 1",
"1",
"ans"
] |
N,T = map(int,input().rstrip().split(" "))
A = list(map(int,input().rstrip().split(" ")))
max_ra = [0 for i in range(len(A)+1)]
ans = 0
k = 0
for i in range(len(A)-1,-1,-1):
if max_ra[i+1] < A[i]:
max_ra[i] = A[i]
else:
max_ra[i] = max_ra[i+1]
for i in range(len(A)):
if max_ra[i] - A[i] > k:
ans = 1
k = max_ra[i] - A[i]
elif max_ra[i] - A[i] == k:
ans += 1
print(ans)
|
[
7,
15,
13,
4,
18,
13,
13,
2,
2,
17,
17,
17,
12,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
18,
13,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
4,
13,
10,
12,
13,
10,
12,
13
] |
[
[
18,
17
],
[
110,
24
],
[
18,
26
],
[
29,
28
],
[
110,
37
],
[
41,
40
],
[
17,
44
],
[
49,
46
],
[
40,
47
],
[
28,
50
],
[
54,
53
],
[
17,
57
],
[
28,
61
],
[
53,
62
],
[
40,
64
],
[
53,
66
],
[
72,
69
],
[
40,
70
],
[
53,
71
],
[
28,
73
],
[
53,
74
],
[
77,
76
],
[
17,
80
],
[
83,
82
],
[
17,
85
],
[
90,
87
],
[
76,
88
],
[
82,
89
],
[
28,
92
],
[
82,
93
],
[
69,
94
],
[
40,
95
],
[
82,
96
],
[
76,
101
],
[
76,
105
],
[
113,
107
]
] |
[
"import sys\nsys.setrecursionlimit(10 ** 5 + 10)\ndef input(): return sys.stdin.readline().strip()\n\ndef resolve():\n \n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n mlist=[0]*n\n mlist[0]=A[0]\n for i in range(1,n):\n if A[i]<mlist[i-1]:\n mlist[i]=A[i]\n else: mlist[i]=mlist[i-1]\n val=[0]*n\n for i in range(n):\n val[i]=A[i]-mlist[i]\n\n print(val.count(max(val)))\n\n \nresolve()",
"import sys",
"sys",
"sys.setrecursionlimit(10 ** 5 + 10)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 5 + 10",
"10 ** 5",
"10",
"5",
"10",
"def input(): return sys.stdin.readline().strip()",
"input",
"def resolve():\n \n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n mlist=[0]*n\n mlist[0]=A[0]\n for i in range(1,n):\n if A[i]<mlist[i-1]:\n mlist[i]=A[i]\n else: mlist[i]=mlist[i-1]\n val=[0]*n\n for i in range(n):\n val[i]=A[i]-mlist[i]\n\n print(val.count(max(val)))\n\n ",
"resolve",
"n,t=map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"A=list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mlist=[0]*n",
"mlist",
"[0]*n",
"[0]",
"0",
"n",
"mlist[0]=A[0]",
"mlist[0]",
"mlist",
"0",
"A[0]",
"A",
"0",
"for i in range(1,n):\n if A[i]<mlist[i-1]:\n mlist[i]=A[i]\n else: mlist[i]=mlist[i-1]\n ",
"i",
"range(1,n)",
"range",
"1",
"n",
"if A[i]<mlist[i-1]:\n mlist[i]=A[i]\n else: mlist[i]=mlist[i-1]\n ",
"A[i]<mlist[i-1]",
"A[i]",
"A",
"i",
"mlist[i-1]",
"mlist",
"i-1",
"i",
"1",
"mlist[i]=A[i]",
"mlist[i]",
"mlist",
"i",
"A[i]",
"A",
"i",
"val=[0]*n",
"val",
"[0]*n",
"[0]",
"0",
"n",
"for i in range(n):\n val[i]=A[i]-mlist[i]\n\n ",
"i",
"range(n)",
"range",
"n",
"val[i]=A[i]-mlist[i]",
"val[i]",
"val",
"i",
"A[i]-mlist[i]",
"A[i]",
"A",
"i",
"mlist[i]",
"mlist",
"i",
"print(val.count(max(val)))",
"print",
"val.count(max(val))",
"val.count",
"val",
"count",
"max(val)",
"max",
"val",
"resolve()",
"resolve",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"def resolve():\n \n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n mlist=[0]*n\n mlist[0]=A[0]\n for i in range(1,n):\n if A[i]<mlist[i-1]:\n mlist[i]=A[i]\n else: mlist[i]=mlist[i-1]\n val=[0]*n\n for i in range(n):\n val[i]=A[i]-mlist[i]\n\n print(val.count(max(val)))\n\n ",
"def resolve():\n \n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n mlist=[0]*n\n mlist[0]=A[0]\n for i in range(1,n):\n if A[i]<mlist[i-1]:\n mlist[i]=A[i]\n else: mlist[i]=mlist[i-1]\n val=[0]*n\n for i in range(n):\n val[i]=A[i]-mlist[i]\n\n print(val.count(max(val)))\n\n ",
"resolve"
] |
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
n,t=map(int,input().split())
A=list(map(int,input().split()))
mlist=[0]*n
mlist[0]=A[0]
for i in range(1,n):
if A[i]<mlist[i-1]:
mlist[i]=A[i]
else: mlist[i]=mlist[i-1]
val=[0]*n
for i in range(n):
val[i]=A[i]-mlist[i]
print(val.count(max(val)))
resolve()
|
[
7,
15,
13,
15,
12,
13,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
2,
39,
17,
2,
13,
17,
39,
18,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
13,
13,
13,
14,
2,
13,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
17,
14,
2,
13,
2,
13,
13,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13
] |
[
[
10,
9
],
[
117,
16
],
[
10,
18
],
[
21,
20
],
[
117,
29
],
[
33,
32
],
[
9,
38
],
[
20,
42
],
[
46,
45
],
[
9,
49
],
[
57,
54
],
[
32,
55
],
[
45,
56
],
[
32,
60
],
[
45,
62
],
[
20,
65
],
[
45,
66
],
[
69,
68
],
[
72,
71
],
[
20,
78
],
[
32,
79
],
[
71,
82
],
[
87,
82
],
[
88,
87
],
[
93,
92
],
[
71,
96
],
[
87,
96
],
[
102,
101
],
[
101,
105
],
[
92,
105
],
[
68,
105
],
[
114,
111
]
] |
[
"import sys\nfrom collections import defaultdict\ndef input(): return sys.stdin.readline().strip()\n\ndef main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n M = [0] * (N - 1) + [A[-1]]\n for i in range(N - 2, -1, -1):\n M[i] = max(M[i + 1], A[i])\n cnt = 0\n maxA = 0\n for a, m in zip(A, M):\n if maxA < m - a:\n maxA = m - a\n cnt = 1\n elif maxA == m - a:\n cnt += 1\n print(cnt)\n\n\n\n\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"from collections import defaultdict",
"def input(): return sys.stdin.readline().strip()",
"input",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n M = [0] * (N - 1) + [A[-1]]\n for i in range(N - 2, -1, -1):\n M[i] = max(M[i + 1], A[i])\n cnt = 0\n maxA = 0\n for a, m in zip(A, M):\n if maxA < m - a:\n maxA = m - a\n cnt = 1\n elif maxA == m - a:\n cnt += 1\n print(cnt)",
"main",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"M = [0] * (N - 1) + [A[-1]]",
"M",
"[0] * (N - 1) + [A[-1]]",
"[0] * (N - 1)",
"[0]",
"0",
"N - 1",
"N",
"1",
"[A[-1]]",
"A[-1]",
"A",
"-1",
"for i in range(N - 2, -1, -1):\n M[i] = max(M[i + 1], A[i])\n ",
"i",
"range(N - 2, -1, -1)",
"range",
"N - 2",
"N",
"2",
"-1",
"-1",
"M[i] = max(M[i + 1], A[i])",
"M[i]",
"M",
"i",
"max(M[i + 1], A[i])",
"max",
"M[i + 1]",
"M",
"i + 1",
"i",
"1",
"A[i]",
"A",
"i",
"cnt = 0",
"cnt",
"0",
"maxA = 0",
"maxA",
"0",
"for a, m in zip(A, M):\n if maxA < m - a:\n maxA = m - a\n cnt = 1\n elif maxA == m - a:\n cnt += 1\n ",
"a",
"m",
"zip(A, M)",
"zip",
"A",
"M",
"if maxA < m - a:\n maxA = m - a\n cnt = 1\n elif maxA == m - a:\n cnt += 1\n ",
"maxA < m - a",
"maxA",
"m - a",
"m",
"a",
"maxA = m - a",
"maxA",
"m - a",
"m",
"a",
"cnt = 1",
"cnt",
"1",
"elif maxA == m - a:\n cnt += 1\n ",
"maxA == m - a",
"maxA",
"m - a",
"m",
"a",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n M = [0] * (N - 1) + [A[-1]]\n for i in range(N - 2, -1, -1):\n M[i] = max(M[i + 1], A[i])\n cnt = 0\n maxA = 0\n for a, m in zip(A, M):\n if maxA < m - a:\n maxA = m - a\n cnt = 1\n elif maxA == m - a:\n cnt += 1\n print(cnt)",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n M = [0] * (N - 1) + [A[-1]]\n for i in range(N - 2, -1, -1):\n M[i] = max(M[i + 1], A[i])\n cnt = 0\n maxA = 0\n for a, m in zip(A, M):\n if maxA < m - a:\n maxA = m - a\n cnt = 1\n elif maxA == m - a:\n cnt += 1\n print(cnt)",
"main",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input"
] |
import sys
from collections import defaultdict
def input(): return sys.stdin.readline().strip()
def main():
N, T = map(int, input().split())
A = list(map(int, input().split()))
M = [0] * (N - 1) + [A[-1]]
for i in range(N - 2, -1, -1):
M[i] = max(M[i + 1], A[i])
cnt = 0
maxA = 0
for a, m in zip(A, M):
if maxA < m - a:
maxA = m - a
cnt = 1
elif maxA == m - a:
cnt += 1
print(cnt)
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
13,
17,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13
] |
[
[
92,
2
],
[
92,
11
],
[
83,
13
],
[
107,
25
],
[
95,
28
],
[
89,
35
],
[
39,
38
],
[
93,
41
],
[
108,
44
],
[
105,
44
],
[
84,
47
],
[
38,
48
],
[
96,
49
],
[
102,
49
],
[
104,
51
],
[
84,
54
],
[
38,
55
],
[
96,
56
],
[
102,
56
],
[
110,
58
],
[
108,
62
],
[
105,
62
],
[
84,
65
],
[
38,
66
],
[
96,
67
],
[
102,
67
],
[
98,
69
],
[
101,
72
],
[
96,
75
],
[
102,
75
],
[
84,
77
],
[
38,
78
],
[
99,
81
],
[
111,
81
],
[
90,
81
],
[
83,
84
],
[
92,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
]
] |
[
"n,t = map(int,input().split())\na = list(map(int,input().split()))\np = 0\nm = 10**9+7\nans = 0\nfor i in range(n):\n if p < a[i]-m:\n p = a[i]-m\n ans = 1\n elif p == a[i]-m:\n ans += 1\n m = min(m,a[i])\nprint(ans)",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"p = 0",
"p",
"0",
"m = 10**9+7",
"m",
"10**9+7",
"10**9",
"10",
"9",
"7",
"ans = 0",
"ans",
"0",
"for i in range(n):\n if p < a[i]-m:\n p = a[i]-m\n ans = 1\n elif p == a[i]-m:\n ans += 1\n m = min(m,a[i])",
"i",
"range(n)",
"range",
"n",
"if p < a[i]-m:\n p = a[i]-m\n ans = 1\n elif p == a[i]-m:\n ans += 1\n ",
"p < a[i]-m",
"p",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"p = a[i]-m",
"p",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"ans = 1",
"ans",
"1",
"elif p == a[i]-m:\n ans += 1\n ",
"p == a[i]-m",
"p",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"ans += 1",
"ans",
"1",
"m = min(m,a[i])",
"m",
"min(m,a[i])",
"min",
"m",
"a[i]",
"a",
"i",
"print(ans)",
"print",
"ans",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"ans = 0",
"0",
"ans",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"m = 10**9+7",
"10**9+7",
"m",
"ans += 1",
"1",
"ans",
"m = min(m,a[i])",
"min(m,a[i])",
"m",
"p = a[i]-m",
"a[i]-m",
"p",
"p = 0",
"0",
"p",
"ans = 1",
"1",
"ans"
] |
n,t = map(int,input().split())
a = list(map(int,input().split()))
p = 0
m = 10**9+7
ans = 0
for i in range(n):
if p < a[i]-m:
p = a[i]-m
ans = 1
elif p == a[i]-m:
ans += 1
m = min(m,a[i])
print(ans)
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
13,
0,
13,
17,
0,
13,
2,
13,
13,
29,
13,
4,
13,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
16,
15
],
[
28,
27
],
[
33,
32
],
[
36,
35
],
[
39,
38
],
[
15,
38
],
[
38,
42
],
[
27,
43
],
[
45,
43
],
[
46,
45
],
[
38,
46
],
[
38,
50
],
[
27,
51
],
[
45,
51
],
[
32,
52
],
[
66,
52
],
[
55,
54
],
[
38,
59
],
[
27,
60
],
[
45,
60
],
[
32,
61
],
[
66,
61
],
[
64,
63
],
[
67,
66
],
[
38,
68
],
[
27,
69
],
[
45,
69
],
[
63,
71
],
[
54,
71
],
[
35,
71
],
[
78,
75
]
] |
[
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n\n mi = 10**10\n diff = 0\n r = 0\n for a in A:\n if a < mi:\n mi = a\n elif a - mi == diff:\n r += 1\n elif a - mi > diff:\n r = 1\n diff = a - mi\n return r\n\nprint(main())",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n\n mi = 10**10\n diff = 0\n r = 0\n for a in A:\n if a < mi:\n mi = a\n elif a - mi == diff:\n r += 1\n elif a - mi > diff:\n r = 1\n diff = a - mi\n return r",
"main",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mi = 10**10",
"mi",
"10**10",
"10",
"10",
"diff = 0",
"diff",
"0",
"r = 0",
"r",
"0",
"for a in A:\n if a < mi:\n mi = a\n elif a - mi == diff:\n r += 1\n elif a - mi > diff:\n r = 1\n diff = a - mi\n ",
"a",
"A",
"if a < mi:\n mi = a\n elif a - mi == diff:\n r += 1\n elif a - mi > diff:\n r = 1\n diff = a - mi\n ",
"a < mi",
"a",
"mi",
"mi = a",
"mi",
"a",
"elif a - mi == diff:\n r += 1\n ",
"a - mi == diff",
"a - mi",
"a",
"mi",
"diff",
"r += 1",
"r",
"1",
"elif a - mi > diff:\n r = 1\n diff = a - mi\n ",
"a - mi > diff",
"a - mi",
"a",
"mi",
"diff",
"r = 1",
"r",
"1",
"diff = a - mi",
"diff",
"a - mi",
"a",
"mi",
"return r",
"r",
"print(main())",
"print",
"main()",
"main",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n\n mi = 10**10\n diff = 0\n r = 0\n for a in A:\n if a < mi:\n mi = a\n elif a - mi == diff:\n r += 1\n elif a - mi > diff:\n r = 1\n diff = a - mi\n return r",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n\n mi = 10**10\n diff = 0\n r = 0\n for a in A:\n if a < mi:\n mi = a\n elif a - mi == diff:\n r += 1\n elif a - mi > diff:\n r = 1\n diff = a - mi\n return r",
"main"
] |
def main():
N, T = map(int, input().split())
A = list(map(int, input().split()))
mi = 10**10
diff = 0
r = 0
for a in A:
if a < mi:
mi = a
elif a - mi == diff:
r += 1
elif a - mi > diff:
r = 1
diff = a - mi
return r
print(main())
|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
16,
15
],
[
28,
27
],
[
33,
32
],
[
36,
35
],
[
39,
38
],
[
4,
41
],
[
44,
43
],
[
27,
46
],
[
43,
46
],
[
15,
48
],
[
38,
49
],
[
52,
51
],
[
15,
54
],
[
38,
55
],
[
43,
56
],
[
27,
56
],
[
35,
59
],
[
72,
59
],
[
51,
60
],
[
63,
62
],
[
35,
66
],
[
72,
66
],
[
51,
67
],
[
70,
69
],
[
73,
72
],
[
51,
73
],
[
69,
76
],
[
62,
76
],
[
32,
76
],
[
85,
82
]
] |
[
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n min_A = float('inf')\n cnt = 0\n profit = 0\n for i in range(N):\n min_A = min(min_A,A[i])\n diff_A = A[i] - min_A\n if profit == diff_A:\n cnt += 1\n elif profit < diff_A:\n cnt = 1\n profit = diff_A\n print(cnt)\n\n\n\nif __name__ == \"__main__\":\n main()",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n min_A = float('inf')\n cnt = 0\n profit = 0\n for i in range(N):\n min_A = min(min_A,A[i])\n diff_A = A[i] - min_A\n if profit == diff_A:\n cnt += 1\n elif profit < diff_A:\n cnt = 1\n profit = diff_A\n print(cnt)",
"main",
"N, T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A = list(map(int, input().split()))",
"A",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"min_A = float('inf')",
"min_A",
"float('inf')",
"float",
"'inf'",
"cnt = 0",
"cnt",
"0",
"profit = 0",
"profit",
"0",
"for i in range(N):\n min_A = min(min_A,A[i])\n diff_A = A[i] - min_A\n if profit == diff_A:\n cnt += 1\n elif profit < diff_A:\n cnt = 1\n profit = diff_A\n ",
"i",
"range(N)",
"range",
"N",
"min_A = min(min_A,A[i])",
"min_A",
"min(min_A,A[i])",
"min",
"min_A",
"A[i]",
"A",
"i",
"diff_A = A[i] - min_A",
"diff_A",
"A[i] - min_A",
"A[i]",
"A",
"i",
"min_A",
"if profit == diff_A:\n cnt += 1\n elif profit < diff_A:\n cnt = 1\n profit = diff_A\n ",
"profit == diff_A",
"profit",
"diff_A",
"cnt += 1",
"cnt",
"1",
"elif profit < diff_A:\n cnt = 1\n profit = diff_A\n ",
"profit < diff_A",
"profit",
"diff_A",
"cnt = 1",
"cnt",
"1",
"profit = diff_A",
"profit",
"diff_A",
"print(cnt)",
"print",
"cnt",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n min_A = float('inf')\n cnt = 0\n profit = 0\n for i in range(N):\n min_A = min(min_A,A[i])\n diff_A = A[i] - min_A\n if profit == diff_A:\n cnt += 1\n elif profit < diff_A:\n cnt = 1\n profit = diff_A\n print(cnt)",
"def main():\n N, T = map(int, input().split())\n A = list(map(int, input().split()))\n min_A = float('inf')\n cnt = 0\n profit = 0\n for i in range(N):\n min_A = min(min_A,A[i])\n diff_A = A[i] - min_A\n if profit == diff_A:\n cnt += 1\n elif profit < diff_A:\n cnt = 1\n profit = diff_A\n print(cnt)",
"main"
] |
def main():
N, T = map(int, input().split())
A = list(map(int, input().split()))
min_A = float('inf')
cnt = 0
profit = 0
for i in range(N):
min_A = min(min_A,A[i])
diff_A = A[i] - min_A
if profit == diff_A:
cnt += 1
elif profit < diff_A:
cnt = 1
profit = diff_A
print(cnt)
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
39,
17,
2,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
18,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] |
[
[
115,
2
],
[
115,
13
],
[
112,
15
],
[
109,
27
],
[
101,
32
],
[
36,
35
],
[
101,
39
],
[
47,
44
],
[
110,
45
],
[
35,
46
],
[
110,
50
],
[
35,
52
],
[
113,
55
],
[
35,
56
],
[
106,
58
],
[
62,
61
],
[
101,
64
],
[
118,
66
],
[
107,
69
],
[
119,
69
],
[
44,
71
],
[
110,
72
],
[
61,
73
],
[
113,
75
],
[
61,
76
],
[
103,
78
],
[
82,
81
],
[
101,
84
],
[
121,
86
],
[
44,
89
],
[
110,
90
],
[
81,
91
],
[
113,
93
],
[
81,
94
],
[
119,
95
],
[
107,
95
],
[
122,
98
],
[
104,
98
],
[
115,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
]
] |
[
"n,t = list(map(int,input().split()))\na = list(map(int,input().split()))\nmax_array = [0]*(n+1)\nfor i in range(n-1,-1,-1):\n max_array[i] = max(max_array[i+1],a[i])\nmax_diff = 0\nfor i in range(n):\n max_diff = max(max_diff,max_array[i] - a[i])\ncount = 0\nfor i in range(n):\n count += (max_array[i] - a[i]) == max_diff\nprint(count)",
"n,t = list(map(int,input().split()))",
"n",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"a = list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"max_array = [0]*(n+1)",
"max_array",
"[0]*(n+1)",
"[0]",
"0",
"n+1",
"n",
"1",
"for i in range(n-1,-1,-1):\n max_array[i] = max(max_array[i+1],a[i])",
"i",
"range(n-1,-1,-1)",
"range",
"n-1",
"n",
"1",
"-1",
"-1",
"max_array[i] = max(max_array[i+1],a[i])",
"max_array[i]",
"max_array",
"i",
"max(max_array[i+1],a[i])",
"max",
"max_array[i+1]",
"max_array",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"max_diff = 0",
"max_diff",
"0",
"for i in range(n):\n max_diff = max(max_diff,max_array[i] - a[i])",
"i",
"range(n)",
"range",
"n",
"max_diff = max(max_diff,max_array[i] - a[i])",
"max_diff",
"max(max_diff,max_array[i] - a[i])",
"max",
"max_diff",
"max_array[i] - a[i]",
"max_array[i]",
"max_array",
"i",
"a[i]",
"a",
"i",
"count = 0",
"count",
"0",
"for i in range(n):\n count += (max_array[i] - a[i]) == max_diff",
"i",
"range(n)",
"range",
"n",
"count += (max_array[i] - a[i]) == max_diff",
"count",
"(max_array[i] - a[i]) == max_diff",
"max_array[i] - a[i]",
"max_array[i]",
"max_array",
"i",
"a[i]",
"a",
"i",
"max_diff",
"print(count)",
"print",
"count",
"n,t = list(map(int,input().split()))",
"list(map(int,input().split()))",
"n",
"count = 0",
"0",
"count",
"max_diff = 0",
"0",
"max_diff",
"max_array = [0]*(n+1)",
"[0]*(n+1)",
"max_array",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"t = list(map(int,input().split()))",
"list(map(int,input().split()))",
"t",
"max_diff = max(max_diff,max_array[i] - a[i])",
"max(max_diff,max_array[i] - a[i])",
"max_diff",
"count += (max_array[i] - a[i]) == max_diff",
"(max_array[i] - a[i]) == max_diff",
"count"
] |
n,t = list(map(int,input().split()))
a = list(map(int,input().split()))
max_array = [0]*(n+1)
for i in range(n-1,-1,-1):
max_array[i] = max(max_array[i+1],a[i])
max_diff = 0
for i in range(n):
max_diff = max(max_diff,max_array[i] - a[i])
count = 0
for i in range(n):
count += (max_array[i] - a[i]) == max_diff
print(count)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.