node_ids
listlengths 4
1.4k
| edge_index
listlengths 1
2.22k
| text
listlengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
12,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
31,
13,
0,
13,
17,
0,
13,
4,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
0,
13,
8,
2,
2,
13,
13,
13,
17,
2,
13,
4,
13,
2,
2,
13,
13,
13,
0,
13,
4,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
17
],
[
5,
18
],
[
22,
21
],
[
25,
24
],
[
30,
29
],
[
33,
32
],
[
4,
35
],
[
38,
37
],
[
32,
40
],
[
43,
42
],
[
37,
46
],
[
24,
47
],
[
68,
47
],
[
21,
48
],
[
60,
48
],
[
29,
51
],
[
42,
51
],
[
37,
56
],
[
24,
57
],
[
68,
57
],
[
21,
58
],
[
60,
58
],
[
61,
60
],
[
21,
63
],
[
60,
63
],
[
37,
65
],
[
24,
66
],
[
68,
66
],
[
69,
68
],
[
24,
71
],
[
68,
71
],
[
37,
72
],
[
42,
75
],
[
29,
75
],
[
84,
81
]
] |
[
"def main():\n n, t, *a = map(int, open(0).read().split())\n b = 0\n c = float(\"Inf\")\n ans = 1\n for i in range(n):\n x = a[i]\n ans = 1 if x - c > b else ans + int(x - c == b)\n b = max(b, x - c)\n c = min(c, x)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()",
"def main():\n n, t, *a = map(int, open(0).read().split())\n b = 0\n c = float(\"Inf\")\n ans = 1\n for i in range(n):\n x = a[i]\n ans = 1 if x - c > b else ans + int(x - c == b)\n b = max(b, x - c)\n c = min(c, x)\n\n print(ans)",
"main",
"n, t, *a = map(int, open(0).read().split())",
"n",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"t",
"*a",
"a",
"b = 0",
"b",
"0",
"c = float(\"Inf\")",
"c",
"float(\"Inf\")",
"float",
"\"Inf\"",
"ans = 1",
"ans",
"1",
"for i in range(n):\n x = a[i]\n ans = 1 if x - c > b else ans + int(x - c == b)\n b = max(b, x - c)\n c = min(c, x)\n\n ",
"i",
"range(n)",
"range",
"n",
"x = a[i]",
"x",
"a[i]",
"a",
"i",
"ans = 1 if x - c > b else ans + int(x - c == b)",
"ans",
"1 if x - c > b else ans + int(x - c == b)",
"x - c > b",
"x - c",
"x",
"c",
"b",
"1",
"ans + int(x - c == b)",
"ans",
"int(x - c == b)",
"int",
"x - c == b",
"x - c",
"x",
"c",
"b",
"b = max(b, x - c)",
"b",
"max(b, x - c)",
"max",
"b",
"x - c",
"x",
"c",
"c = min(c, x)",
"c",
"min(c, x)",
"min",
"c",
"x",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n n, t, *a = map(int, open(0).read().split())\n b = 0\n c = float(\"Inf\")\n ans = 1\n for i in range(n):\n x = a[i]\n ans = 1 if x - c > b else ans + int(x - c == b)\n b = max(b, x - c)\n c = min(c, x)\n\n print(ans)",
"def main():\n n, t, *a = map(int, open(0).read().split())\n b = 0\n c = float(\"Inf\")\n ans = 1\n for i in range(n):\n x = a[i]\n ans = 1 if x - c > b else ans + int(x - c == b)\n b = max(b, x - c)\n c = min(c, x)\n\n print(ans)",
"main"
] |
def main():
n, t, *a = map(int, open(0).read().split())
b = 0
c = float("Inf")
ans = 1
for i in range(n):
x = a[i]
ans = 1 if x - c > b else ans + int(x - c == b)
b = max(b, x - c)
c = min(c, x)
print(ans)
if __name__ == '__main__':
main()
|
[
7,
15,
13,
13,
13,
15,
15,
15,
15,
15,
15,
15,
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,
4,
13,
13,
0,
13,
4,
13,
0,
13,
17,
0,
13,
17,
0,
13,
39,
18,
13,
17,
28,
13,
4,
13,
17,
2,
13,
17,
14,
2,
2,
18,
13,
2,
13,
17,
18,
13,
13,
18,
13,
2,
13,
17,
9,
4,
18,
13,
13,
18,
13,
13,
4,
18,
13,
13,
18,
13,
17,
41,
28,
13,
4,
13,
2,
4,
13,
13,
17,
4,
17,
0,
13,
13,
0,
13,
13,
28,
13,
4,
13,
2,
4,
13,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
13,
2,
18,
13,
2,
13,
17,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
12,
13,
10,
39,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13,
10,
17,
13
] |
[
[
31,
31
],
[
33,
33
],
[
251,
42
],
[
206,
47
],
[
260,
54
],
[
248,
65
],
[
230,
76
],
[
201,
78
],
[
230,
79
],
[
236,
81
],
[
219,
83
],
[
209,
85
],
[
263,
88
],
[
203,
91
],
[
237,
94
],
[
98,
97
],
[
231,
102
],
[
237,
108
],
[
97,
110
],
[
237,
113
],
[
97,
114
],
[
237,
116
],
[
97,
118
],
[
204,
123
],
[
237,
126
],
[
97,
127
],
[
204,
130
],
[
237,
133
],
[
138,
137
],
[
204,
143
],
[
239,
148
],
[
233,
151
],
[
252,
152
],
[
155,
154
],
[
204,
160
],
[
234,
164
],
[
216,
164
],
[
204,
166
],
[
154,
167
],
[
215,
169
],
[
204,
171
],
[
154,
172
],
[
177,
174
],
[
240,
175
],
[
154,
176
],
[
204,
179
],
[
154,
181
],
[
216,
183
],
[
234,
183
],
[
242,
185
],
[
240,
188
],
[
240,
193
],
[
243,
195
],
[
203,
204
],
[
206,
207
],
[
209,
210
],
[
215,
216
],
[
230,
228
],
[
230,
231
],
[
252,
233
],
[
233,
234
],
[
236,
237
],
[
239,
240
],
[
242,
243
],
[
248,
249
],
[
251,
252
],
[
260,
261
],
[
263,
264
]
] |
[
"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\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom fractions import gcd\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, 0, 1, -1, 1, -1, -1, 1]\ndy = [1, -1, 0, 0, 1, -1, 1, -1]\n\nn, t = MAP()\na = LIST()\nget = 0\nans = 0\nb = [a[0]]\nfor i in range(1, n - 1):\n if a[i - 1] < a[i] < a[i + 1]:\n continue\n b.append(a[i])\nb.append(a[-1])\nd = [0 for i in range(len(b) - 1)]\nmn = inf\nfor i in range(len(b) - 1):\n if mn > b[i]:\n mn = b[i]\n d[i] = b[i + 1] - mn\nmx = max(d)\nprint(d.count(mx))",
"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",
"from operator import itemgetter, mul",
"from copy import deepcopy",
"from string import ascii_lowercase, ascii_uppercase, digits",
"from fractions import gcd",
"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, 0, 1, -1, 1, -1, -1, 1]",
"dx",
"[0, 0, 1, -1, 1, -1, -1, 1]",
"0",
"0",
"1",
"-1",
"1",
"-1",
"-1",
"1",
"dy = [1, -1, 0, 0, 1, -1, 1, -1]",
"dy",
"[1, -1, 0, 0, 1, -1, 1, -1]",
"1",
"-1",
"0",
"0",
"1",
"-1",
"1",
"-1",
"n, t = MAP()",
"n",
"MAP()",
"MAP",
"t",
"a = LIST()",
"a",
"LIST()",
"LIST",
"get = 0",
"get",
"0",
"ans = 0",
"ans",
"0",
"b = [a[0]]",
"b",
"[a[0]]",
"a[0]",
"a",
"0",
"for i in range(1, n - 1):\n if a[i - 1] < a[i] < a[i + 1]:\n continue\n b.append(a[i])",
"i",
"range(1, n - 1)",
"range",
"1",
"n - 1",
"n",
"1",
"if a[i - 1] < a[i] < a[i + 1]:\n continue\n ",
"a[i - 1] < a[i] < a[i + 1]",
"a[i - 1] < a[i]",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"continue",
"b.append(a[i])",
"b.append",
"b",
"append",
"a[i]",
"a",
"i",
"b.append(a[-1])",
"b.append",
"b",
"append",
"a[-1]",
"a",
"-1",
"0 for i in range(len(b) - 1)",
"for i in range(len(b) - 1)",
"i",
"range(len(b) - 1)",
"range",
"len(b) - 1",
"len(b)",
"len",
"b",
"1",
"for i in range(len(b) - 1)",
"0",
"d = [0 for i in range(len(b) - 1)]",
"d",
"[0 for i in range(len(b) - 1)]",
"mn = inf",
"mn",
"inf",
"for i in range(len(b) - 1):\n if mn > b[i]:\n mn = b[i]\n d[i] = b[i + 1] - mn",
"i",
"range(len(b) - 1)",
"range",
"len(b) - 1",
"len(b)",
"len",
"b",
"1",
"if mn > b[i]:\n mn = b[i]\n ",
"mn > b[i]",
"mn",
"b[i]",
"b",
"i",
"mn = b[i]",
"mn",
"b[i]",
"b",
"i",
"d[i] = b[i + 1] - mn",
"d[i]",
"d",
"i",
"b[i + 1] - mn",
"b[i + 1]",
"b",
"i + 1",
"i",
"1",
"mn",
"mx = max(d)",
"mx",
"max(d)",
"max",
"d",
"print(d.count(mx))",
"print",
"d.count(mx)",
"d.count",
"d",
"count",
"mx",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"def MAP(): return map(int, input().split())",
"def MAP(): return map(int, input().split())",
"MAP",
"b = [a[0]]",
"[a[0]]",
"b",
"mod = 10 ** 9 + 7",
"10 ** 9 + 7",
"mod",
"get = 0",
"0",
"get",
"def INT(): return int(input())",
"def INT(): return int(input())",
"INT",
"mn = b[i]",
"b[i]",
"mn",
"def LIST(): return list(map(int, input().split()))",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"def S_LIST(): return list(map(str, input().split()))",
"def S_LIST(): return list(map(str, input().split()))",
"S_LIST",
"def FLOAT(): return float(input())",
"def FLOAT(): return float(input())",
"FLOAT",
"t = MAP()",
"MAP()",
"t",
"n, t = MAP()",
"MAP()",
"n",
"mn = inf",
"inf",
"mn",
"a = LIST()",
"LIST()",
"a",
"d = [0 for i in range(len(b) - 1)]",
"[0 for i in range(len(b) - 1)]",
"d",
"mx = max(d)",
"max(d)",
"mx",
"def STR(): return input()",
"def STR(): return input()",
"STR",
"dy = [1, -1, 0, 0, 1, -1, 1, -1]",
"[1, -1, 0, 0, 1, -1, 1, -1]",
"dy",
"inf = sys.maxsize",
"sys.maxsize",
"inf",
"def S_MAP(): return map(str, input().split())",
"def S_MAP(): return map(str, input().split())",
"S_MAP",
"def lcm(a, b): return a * b // gcd(a, b)",
"def lcm(a, b): return a * b // gcd(a, b)",
"lcm",
"dx = [0, 0, 1, -1, 1, -1, -1, 1]",
"[0, 0, 1, -1, 1, -1, -1, 1]",
"dx",
"ans = 0",
"0",
"ans"
] |
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
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
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, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
n, t = MAP()
a = LIST()
get = 0
ans = 0
b = [a[0]]
for i in range(1, n - 1):
if a[i - 1] < a[i] < a[i + 1]:
continue
b.append(a[i])
b.append(a[-1])
d = [0 for i in range(len(b) - 1)]
mn = inf
for i in range(len(b) - 1):
if mn > b[i]:
mn = b[i]
d[i] = b[i + 1] - mn
mx = max(d)
print(d.count(mx))
|
[
7,
15,
13,
15,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
39,
0,
13,
18,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
13,
4,
18,
13,
13,
2,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
17,
42,
2,
18,
13,
13,
18,
13,
17,
4,
13,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
39,
13,
10,
4,
13,
10,
17,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13
] |
[
[
110,
20
],
[
81,
22
],
[
110,
23
],
[
77,
25
],
[
96,
27
],
[
86,
29
],
[
113,
32
],
[
78,
34
],
[
38,
37
],
[
78,
37
],
[
89,
40
],
[
37,
43
],
[
114,
44
],
[
90,
44
],
[
87,
47
],
[
37,
50
],
[
90,
51
],
[
114,
51
],
[
87,
54
],
[
58,
57
],
[
92,
60
],
[
87,
65
],
[
93,
66
],
[
87,
68
],
[
93,
72
],
[
77,
78
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
110,
102
],
[
110,
111
],
[
113,
114
]
] |
[
"import numpy as np\nimport sys\ndef sinput(): return sys.stdin.readline()\ndef iinput(): return int(sinput())\ndef imap(): return map(int, sinput().split())\ndef fmap(): return map(float, sinput().split())\ndef iarr(): return list(imap())\ndef farr(): return list(fmap())\ndef sarr(): return sinput().split()\n\nn, t = imap()\na = iarr()\nb = []\nminv = a[0]\nfor i in a:\n minv = min(i, minv)\n b.append(i - minv)\nb.sort(reverse=True)\nans = 0\nwhile b[ans]==b[0]: ans+=1\nprint(ans)",
"import numpy as np",
"numpy",
"import sys",
"sys",
"def sinput(): return sys.stdin.readline()",
"sinput",
"def iinput(): return int(sinput())",
"iinput",
"def imap(): return map(int, sinput().split())",
"imap",
"def fmap(): return map(float, sinput().split())",
"fmap",
"def iarr(): return list(imap())",
"iarr",
"def farr(): return list(fmap())",
"farr",
"def sarr(): return sinput().split()",
"sarr",
"n, t = imap()",
"n",
"imap()",
"imap",
"t",
"a = iarr()",
"a",
"iarr()",
"iarr",
"b = []",
"b",
"[]",
"minv = a[0]",
"minv",
"a[0]",
"a",
"0",
"for i in a:\n minv = min(i, minv)\n b.append(i - minv)",
"i",
"a",
"minv = min(i, minv)",
"minv",
"min(i, minv)",
"min",
"i",
"minv",
"b.append(i - minv)",
"b.append",
"b",
"append",
"i - minv",
"i",
"minv",
"b.sort(reverse=True)",
"b.sort",
"b",
"sort",
"reverse=True",
"reverse",
"True",
"ans = 0",
"ans",
"0",
"while b[ans]==b[0]: ans+=1",
"b[ans]==b[0]",
"b[ans]",
"b",
"ans",
"b[0]",
"b",
"0",
"print(ans)",
"print",
"ans",
"def fmap(): return map(float, sinput().split())",
"def fmap(): return map(float, sinput().split())",
"fmap",
"a = iarr()",
"iarr()",
"a",
"def imap(): return map(int, sinput().split())",
"def imap(): return map(int, sinput().split())",
"imap",
"def farr(): return list(fmap())",
"def farr(): return list(fmap())",
"farr",
"b = []",
"[]",
"b",
"minv = min(i, minv)",
"min(i, minv)",
"minv",
"ans = 0",
"0",
"ans",
"def iarr(): return list(imap())",
"def iarr(): return list(imap())",
"iarr",
"def sarr(): return sinput().split()",
"def sarr(): return sinput().split()",
"sarr",
"n, t = imap()",
"imap()",
"n",
"def sinput(): return sys.stdin.readline()",
"def sinput(): return sys.stdin.readline()",
"sinput",
"def iinput(): return int(sinput())",
"def iinput(): return int(sinput())",
"iinput",
"t = imap()",
"imap()",
"t",
"minv = a[0]",
"a[0]",
"minv"
] |
import numpy as np
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(): return list(imap())
def farr(): return list(fmap())
def sarr(): return sinput().split()
n, t = imap()
a = iarr()
b = []
minv = a[0]
for i in a:
minv = min(i, minv)
b.append(i - minv)
b.sort(reverse=True)
ans = 0
while b[ans]==b[0]: 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,
17,
0,
13,
2,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] |
[
[
77,
2
],
[
77,
11
],
[
74,
13
],
[
71,
25
],
[
80,
29
],
[
35,
34
],
[
69,
37
],
[
65,
39
],
[
81,
42
],
[
66,
42
],
[
75,
44
],
[
34,
45
],
[
72,
48
],
[
75,
52
],
[
34,
53
],
[
66,
54
],
[
81,
54
],
[
72,
59
],
[
72,
63
],
[
65,
66
],
[
77,
69
],
[
71,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\nprofit = [0]\nminm = 10 ** 9\nfor i in range(n):\n minm = min(minm, a[i])\n profit.append(a[i] - minm)\nprint(profit.count(max(profit)))",
"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]",
"profit",
"[0]",
"0",
"minm = 10 ** 9",
"minm",
"10 ** 9",
"10",
"9",
"for i in range(n):\n minm = min(minm, a[i])\n profit.append(a[i] - minm)",
"i",
"range(n)",
"range",
"n",
"minm = min(minm, a[i])",
"minm",
"min(minm, a[i])",
"min",
"minm",
"a[i]",
"a",
"i",
"profit.append(a[i] - minm)",
"profit.append",
"profit",
"append",
"a[i] - minm",
"a[i]",
"a",
"i",
"minm",
"print(profit.count(max(profit)))",
"print",
"profit.count(max(profit))",
"profit.count",
"profit",
"count",
"max(profit)",
"max",
"profit",
"minm = min(minm, a[i])",
"min(minm, a[i])",
"minm",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"profit = [0]",
"[0]",
"profit",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"minm = 10 ** 9",
"10 ** 9",
"minm"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
profit = [0]
minm = 10 ** 9
for i in range(n):
minm = min(minm, a[i])
profit.append(a[i] - minm)
print(profit.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,
17,
17,
0,
13,
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,
17,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
13,
4,
13,
4,
13,
13,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
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,
4,
13,
10,
17,
13,
10,
18,
13,
10,
13,
13
] |
[
[
147,
2
],
[
147,
11
],
[
141,
13
],
[
129,
25
],
[
111,
30
],
[
150,
33
],
[
126,
36
],
[
144,
39
],
[
43,
42
],
[
148,
45
],
[
142,
49
],
[
42,
50
],
[
130,
51
],
[
154,
51
],
[
153,
53
],
[
142,
55
],
[
42,
56
],
[
135,
58
],
[
142,
63
],
[
42,
64
],
[
151,
65
],
[
124,
65
],
[
136,
65
],
[
123,
67
],
[
112,
71
],
[
118,
71
],
[
142,
74
],
[
42,
75
],
[
154,
76
],
[
130,
76
],
[
117,
78
],
[
142,
81
],
[
42,
82
],
[
154,
83
],
[
130,
83
],
[
132,
85
],
[
120,
88
],
[
124,
89
],
[
136,
89
],
[
151,
89
],
[
112,
92
],
[
118,
92
],
[
142,
95
],
[
42,
96
],
[
154,
97
],
[
130,
97
],
[
114,
99
],
[
156,
102
],
[
124,
103
],
[
136,
103
],
[
151,
103
],
[
157,
108
],
[
121,
108
],
[
127,
108
],
[
115,
109
],
[
133,
109
],
[
145,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
124,
120
],
[
136,
120
],
[
151,
120
],
[
120,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
],
[
147,
139
],
[
141,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
],
[
124,
156
],
[
136,
156
],
[
151,
156
],
[
156,
157
]
] |
[
"n,t = map(int, input().split( ))\na = list(map(int, input().split( )))\nmn = 10**10\nmx = 0\ncnt_mn = 0#現在の買値の最小値\ncnt_inf = 0#最大りえきの達成で買える町の数\ncnt_sup = 0#現在の最大利益の達成で売れる町の数\nfor i in range(n):\n if a[i]<mn:\n mn = a[i]\n cnt_mn = 1\n elif a[i] == cnt_mn:\n cnt_mn += 1\n if mx < a[i] - mn:\n mx = a[i] - mn\n cnt_sup = 1\n cnt_inf = cnt_mn\n elif mx == a[i]-mn:\n cnt_sup += 1\n cnt_inf += cnt_mn\n\nprint(min(cnt_inf,cnt_sup))",
"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",
"mn = 10**10",
"mn",
"10**10",
"10",
"10",
"mx = 0",
"mx",
"0",
"cnt_mn = 0",
"cnt_mn",
"0",
"cnt_inf = 0",
"cnt_inf",
"0",
"cnt_sup = 0",
"cnt_sup",
"0",
"for i in range(n):\n if a[i]<mn:\n mn = a[i]\n cnt_mn = 1\n elif a[i] == cnt_mn:\n cnt_mn += 1\n if mx < a[i] - mn:\n mx = a[i] - mn\n cnt_sup = 1\n cnt_inf = cnt_mn\n elif mx == a[i]-mn:\n cnt_sup += 1\n cnt_inf += cnt_mn",
"i",
"range(n)",
"range",
"n",
"if a[i]<mn:\n mn = a[i]\n cnt_mn = 1\n elif a[i] == cnt_mn:\n cnt_mn += 1\n ",
"a[i]<mn",
"a[i]",
"a",
"i",
"mn",
"mn = a[i]",
"mn",
"a[i]",
"a",
"i",
"cnt_mn = 1",
"cnt_mn",
"1",
"elif a[i] == cnt_mn:\n cnt_mn += 1\n ",
"a[i] == cnt_mn",
"a[i]",
"a",
"i",
"cnt_mn",
"cnt_mn += 1",
"cnt_mn",
"1",
"if mx < a[i] - mn:\n mx = a[i] - mn\n cnt_sup = 1\n cnt_inf = cnt_mn\n elif mx == a[i]-mn:\n cnt_sup += 1\n cnt_inf += cnt_mn",
"mx < a[i] - mn",
"mx",
"a[i] - mn",
"a[i]",
"a",
"i",
"mn",
"mx = a[i] - mn",
"mx",
"a[i] - mn",
"a[i]",
"a",
"i",
"mn",
"cnt_sup = 1",
"cnt_sup",
"1",
"cnt_inf = cnt_mn",
"cnt_inf",
"cnt_mn",
"elif mx == a[i]-mn:\n cnt_sup += 1\n cnt_inf += cnt_mn",
"mx == a[i]-mn",
"mx",
"a[i]-mn",
"a[i]",
"a",
"i",
"mn",
"cnt_sup += 1",
"cnt_sup",
"1",
"cnt_inf += cnt_mn",
"cnt_inf",
"cnt_mn",
"print(min(cnt_inf,cnt_sup))",
"print",
"min(cnt_inf,cnt_sup)",
"min",
"cnt_inf",
"cnt_sup",
"mx = 0",
"0",
"mx",
"cnt_sup += 1",
"1",
"cnt_sup",
"mx = a[i] - mn",
"a[i] - mn",
"mx",
"cnt_inf = cnt_mn",
"cnt_mn",
"cnt_inf",
"cnt_mn += 1",
"1",
"cnt_mn",
"cnt_inf = 0",
"0",
"cnt_inf",
"mn = 10**10",
"10**10",
"mn",
"cnt_sup = 1",
"1",
"cnt_sup",
"cnt_mn = 1",
"1",
"cnt_mn",
"t = map(int, input().split( ))",
"map(int, input().split( ))",
"t",
"a = list(map(int, input().split( )))",
"list(map(int, input().split( )))",
"a",
"cnt_sup = 0",
"0",
"cnt_sup",
"n,t = map(int, input().split( ))",
"map(int, input().split( ))",
"n",
"cnt_mn = 0",
"0",
"cnt_mn",
"mn = a[i]",
"a[i]",
"mn",
"cnt_inf += cnt_mn",
"cnt_mn",
"cnt_inf"
] |
n,t = map(int, input().split( ))
a = list(map(int, input().split( )))
mn = 10**10
mx = 0
cnt_mn = 0#現在の買値の最小値
cnt_inf = 0#最大りえきの達成で買える町の数
cnt_sup = 0#現在の最大利益の達成で売れる町の数
for i in range(n):
if a[i]<mn:
mn = a[i]
cnt_mn = 1
elif a[i] == cnt_mn:
cnt_mn += 1
if mx < a[i] - mn:
mx = a[i] - mn
cnt_sup = 1
cnt_inf = cnt_mn
elif mx == a[i]-mn:
cnt_sup += 1
cnt_inf += cnt_mn
print(min(cnt_inf,cnt_sup))
|
[
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,
4,
13,
13,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] |
[
[
100,
2
],
[
100,
11
],
[
82,
13
],
[
106,
25
],
[
76,
30
],
[
97,
33
],
[
37,
36
],
[
92,
39
],
[
103,
41
],
[
83,
44
],
[
36,
45
],
[
107,
46
],
[
80,
46
],
[
104,
49
],
[
77,
50
],
[
86,
50
],
[
85,
52
],
[
104,
53
],
[
88,
55
],
[
104,
59
],
[
77,
60
],
[
86,
60
],
[
94,
62
],
[
79,
65
],
[
107,
68
],
[
80,
68
],
[
83,
70
],
[
36,
71
],
[
95,
74
],
[
89,
74
],
[
98,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
104,
85
],
[
85,
86
],
[
88,
89
],
[
100,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n#全て同じではない\n\n#buy = int(T / 2)\n#一番安い町で買って、高い町で売る\nnow = 10 ** 10\nmax_sub = 0\ncount = 1\nfor i in range(N):\n bb = A[i] - now\n if bb > max_sub:\n max_sub = bb\n count = 1\n elif bb == max_sub:\n count += 1\n\n now = min(now, A[i])\n #print(bb, max_sub, now, count)\n \n#print(max_sub, count)\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",
"now = 10 ** 10",
"now",
"10 ** 10",
"10",
"10",
"max_sub = 0",
"max_sub",
"0",
"count = 1",
"count",
"1",
"for i in range(N):\n bb = A[i] - now\n if bb > max_sub:\n max_sub = bb\n count = 1\n elif bb == max_sub:\n count += 1\n\n now = min(now, A[i])\n #print(bb, max_sub, now, count)\n \n#print(max_sub, count)",
"i",
"range(N)",
"range",
"N",
"bb = A[i] - now",
"bb",
"A[i] - now",
"A[i]",
"A",
"i",
"now",
"if bb > max_sub:\n max_sub = bb\n count = 1\n elif bb == max_sub:\n count += 1\n\n ",
"bb > max_sub",
"bb",
"max_sub",
"max_sub = bb",
"max_sub",
"bb",
"count = 1",
"count",
"1",
"elif bb == max_sub:\n count += 1\n\n ",
"bb == max_sub",
"bb",
"max_sub",
"count += 1",
"count",
"1",
"now = min(now, A[i])",
"now",
"min(now, A[i])",
"min",
"now",
"A[i]",
"A",
"i",
"print(count)",
"print",
"count",
"max_sub = 0",
"0",
"max_sub",
"now = min(now, A[i])",
"min(now, A[i])",
"now",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"max_sub = bb",
"bb",
"max_sub",
"count = 1",
"1",
"count",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"count += 1",
"1",
"count",
"count = 1",
"1",
"count",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"bb = A[i] - now",
"A[i] - now",
"bb",
"now = 10 ** 10",
"10 ** 10",
"now"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
#全て同じではない
#buy = int(T / 2)
#一番安い町で買って、高い町で売る
now = 10 ** 10
max_sub = 0
count = 1
for i in range(N):
bb = A[i] - now
if bb > max_sub:
max_sub = bb
count = 1
elif bb == max_sub:
count += 1
now = min(now, A[i])
#print(bb, max_sub, now, count)
#print(max_sub, count)
print(count)
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
12,
4,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
12,
2,
4,
13,
13,
17,
23,
4,
18,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
4,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
17,
14,
2,
13,
4,
18,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
8,
40,
13,
17,
18,
13,
4,
13,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13
] |
[
[
204,
19
],
[
201,
24
],
[
207,
31
],
[
195,
45
],
[
192,
63
],
[
198,
83
],
[
112,
111
],
[
196,
113
],
[
112,
114
],
[
117,
116
],
[
193,
118
],
[
121,
120
],
[
125,
124
],
[
116,
126
],
[
130,
129
],
[
111,
133
],
[
136,
135
],
[
116,
138
],
[
129,
139
],
[
124,
140
],
[
163,
140
],
[
135,
143
],
[
135,
147
],
[
120,
150
],
[
156,
153
],
[
120,
154
],
[
135,
155
],
[
161,
158
],
[
120,
159
],
[
135,
160
],
[
164,
163
],
[
124,
166
],
[
163,
166
],
[
116,
168
],
[
129,
169
],
[
111,
174
],
[
120,
177
],
[
120,
182
],
[
211,
190
],
[
192,
193
],
[
195,
196
],
[
198,
199
],
[
201,
202
],
[
204,
205
],
[
207,
208
]
] |
[
"import sys\nimport math\nimport collections\nimport bisect\nimport itertools\n\n# import numpy as np\n\nsys.setrecursionlimit(10 ** 7)\nINF = 10 ** 20\nMOD = 10 ** 9 + 7\n# MOD = 998244353\n\nni = lambda: int(sys.stdin.readline().rstrip())\nns = lambda: map(int, sys.stdin.readline().rstrip().split())\nna = lambda: list(map(int, sys.stdin.readline().rstrip().split()))\nna1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))\n\n\n# ===CODE===\n\ndef main():\n n, t = ns()\n a = na()\n\n res = dict()\n s_num = a[0]\n for i in range(1, n):\n tmp = a[i] - s_num\n if tmp > 0:\n if tmp in res.keys():\n res[tmp] += 1\n else:\n res[tmp] = 1\n\n s_num = min(s_num, a[i])\n\n print(res[max(res.keys())] if n != 1 else 0)\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"import math",
"math",
"import collections",
"collections",
"import bisect",
"bisect",
"import itertools",
"itertools",
"sys.setrecursionlimit(10 ** 7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 7",
"10",
"7",
"INF = 10 ** 20",
"INF",
"10 ** 20",
"10",
"20",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"ni = lambda: int(sys.stdin.readline().rstrip())",
"ni",
"lambda: int(sys.stdin.readline().rstrip())",
"int(sys.stdin.readline().rstrip())",
"int",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"ns = lambda: map(int, sys.stdin.readline().rstrip().split())",
"ns",
"lambda: map(int, sys.stdin.readline().rstrip().split())",
"map(int, sys.stdin.readline().rstrip().split())",
"map",
"int",
"sys.stdin.readline().rstrip().split()",
"sys.stdin.readline().rstrip().split",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"split",
"na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))",
"na",
"lambda: list(map(int, sys.stdin.readline().rstrip().split()))",
"list(map(int, sys.stdin.readline().rstrip().split()))",
"list",
"map(int, sys.stdin.readline().rstrip().split())",
"map",
"int",
"sys.stdin.readline().rstrip().split()",
"sys.stdin.readline().rstrip().split",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"split",
"na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))",
"na1",
"lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))",
"list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))",
"list",
"map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split())",
"map",
"lambda x: int(x) - 1",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"x",
"sys.stdin.readline().rstrip().split()",
"sys.stdin.readline().rstrip().split",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"split",
"def main():\n n, t = ns()\n a = na()\n\n res = dict()\n s_num = a[0]\n for i in range(1, n):\n tmp = a[i] - s_num\n if tmp > 0:\n if tmp in res.keys():\n res[tmp] += 1\n else:\n res[tmp] = 1\n\n s_num = min(s_num, a[i])\n\n print(res[max(res.keys())] if n != 1 else 0)",
"main",
"n, t = ns()",
"n",
"ns()",
"ns",
"t",
"a = na()",
"a",
"na()",
"na",
"res = dict()",
"res",
"dict()",
"dict",
"s_num = a[0]",
"s_num",
"a[0]",
"a",
"0",
"for i in range(1, n):\n tmp = a[i] - s_num\n if tmp > 0:\n if tmp in res.keys():\n res[tmp] += 1\n else:\n res[tmp] = 1\n\n s_num = min(s_num, a[i])\n\n ",
"i",
"range(1, n)",
"range",
"1",
"n",
"tmp = a[i] - s_num",
"tmp",
"a[i] - s_num",
"a[i]",
"a",
"i",
"s_num",
"if tmp > 0:\n if tmp in res.keys():\n res[tmp] += 1\n else:\n res[tmp] = 1\n\n ",
"tmp > 0",
"tmp",
"0",
"if tmp in res.keys():\n res[tmp] += 1\n else:\n res[tmp] = 1\n\n ",
"tmp in res.keys()",
"tmp",
"res.keys()",
"res.keys",
"res",
"keys",
"res[tmp] += 1",
"res[tmp]",
"res",
"tmp",
"1",
"res[tmp] = 1",
"res[tmp]",
"res",
"tmp",
"1",
"s_num = min(s_num, a[i])",
"s_num",
"min(s_num, a[i])",
"min",
"s_num",
"a[i]",
"a",
"i",
"print(res[max(res.keys())] if n != 1 else 0)",
"print",
"res[max(res.keys())] if n != 1 else 0",
"n != 1",
"n",
"1",
"res[max(res.keys())]",
"res",
"max(res.keys())",
"max",
"res.keys()",
"res.keys",
"res",
"keys",
"0",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))",
"lambda: list(map(int, sys.stdin.readline().rstrip().split()))",
"na",
"ns = lambda: map(int, sys.stdin.readline().rstrip().split())",
"lambda: map(int, sys.stdin.readline().rstrip().split())",
"ns",
"na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))",
"lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))",
"na1",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"INF = 10 ** 20",
"10 ** 20",
"INF",
"ni = lambda: int(sys.stdin.readline().rstrip())",
"lambda: int(sys.stdin.readline().rstrip())",
"ni",
"def main():\n n, t = ns()\n a = na()\n\n res = dict()\n s_num = a[0]\n for i in range(1, n):\n tmp = a[i] - s_num\n if tmp > 0:\n if tmp in res.keys():\n res[tmp] += 1\n else:\n res[tmp] = 1\n\n s_num = min(s_num, a[i])\n\n print(res[max(res.keys())] if n != 1 else 0)",
"def main():\n n, t = ns()\n a = na()\n\n res = dict()\n s_num = a[0]\n for i in range(1, n):\n tmp = a[i] - s_num\n if tmp > 0:\n if tmp in res.keys():\n res[tmp] += 1\n else:\n res[tmp] = 1\n\n s_num = min(s_num, a[i])\n\n print(res[max(res.keys())] if n != 1 else 0)",
"main"
] |
import sys
import math
import collections
import bisect
import itertools
# import numpy as np
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353
ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
# ===CODE===
def main():
n, t = ns()
a = na()
res = dict()
s_num = a[0]
for i in range(1, n):
tmp = a[i] - s_num
if tmp > 0:
if tmp in res.keys():
res[tmp] += 1
else:
res[tmp] = 1
s_num = min(s_num, a[i])
print(res[max(res.keys())] if n != 1 else 0)
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,
15,
13,
15,
13,
0,
13,
39,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
18,
13,
17,
0,
13,
17,
0,
13,
4,
18,
13,
13,
13,
28,
13,
4,
13,
17,
13,
0,
13,
4,
18,
13,
13,
13,
0,
18,
13,
2,
18,
13,
13,
13,
17,
0,
13,
4,
13,
13,
2,
18,
13,
13,
13,
4,
18,
13,
13,
13,
13,
4,
18,
13,
13,
13,
18,
13,
13,
4,
13,
18,
13,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13
] |
[
[
115,
2
],
[
115,
11
],
[
124,
13
],
[
106,
29
],
[
107,
35
],
[
107,
40
],
[
125,
42
],
[
127,
45
],
[
118,
48
],
[
56,
55
],
[
116,
59
],
[
121,
61
],
[
107,
66
],
[
75,
68
],
[
119,
69
],
[
125,
72
],
[
55,
73
],
[
122,
74
],
[
109,
77
],
[
128,
80
],
[
110,
80
],
[
125,
83
],
[
55,
84
],
[
122,
85
],
[
107,
90
],
[
122,
91
],
[
107,
96
],
[
125,
98
],
[
55,
99
],
[
119,
103
],
[
110,
104
],
[
128,
104
],
[
106,
107
],
[
109,
110
],
[
115,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
]
] |
[
"N,T=map(int,input().split())\nA=list(map(int,input().split()))\n\n\nimport heapq\nimport collections\nhq=[]\nheapq.heapify(hq)\nheapq.heappush(hq,A[0])\ntmp=0\ntable=collections.defaultdict(int)\nfor i in range(1,N):\n j=heapq.heappop(hq)\n table[A[i]-j]+=1\n tmp=max(tmp,A[i]-j)\n heapq.heappush(hq,j)\n heapq.heappush(hq,A[i])\nprint(table[tmp])",
"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",
"import heapq",
"heapq",
"import collections",
"collections",
"hq=[]",
"hq",
"[]",
"heapq.heapify(hq)",
"heapq.heapify",
"heapq",
"heapify",
"hq",
"heapq.heappush(hq,A[0])",
"heapq.heappush",
"heapq",
"heappush",
"hq",
"A[0]",
"A",
"0",
"tmp=0",
"tmp",
"0",
"table=collections.defaultdict(int)",
"table",
"collections.defaultdict(int)",
"collections.defaultdict",
"collections",
"defaultdict",
"int",
"for i in range(1,N):\n j=heapq.heappop(hq)\n table[A[i]-j]+=1\n tmp=max(tmp,A[i]-j)\n heapq.heappush(hq,j)\n heapq.heappush(hq,A[i])",
"i",
"range(1,N)",
"range",
"1",
"N",
"j=heapq.heappop(hq)",
"j",
"heapq.heappop(hq)",
"heapq.heappop",
"heapq",
"heappop",
"hq",
"table[A[i]-j]+=1",
"table[A[i]-j]",
"table",
"A[i]-j",
"A[i]",
"A",
"i",
"j",
"1",
"tmp=max(tmp,A[i]-j)",
"tmp",
"max(tmp,A[i]-j)",
"max",
"tmp",
"A[i]-j",
"A[i]",
"A",
"i",
"j",
"heapq.heappush(hq,j)",
"heapq.heappush",
"heapq",
"heappush",
"hq",
"j",
"heapq.heappush(hq,A[i])",
"heapq.heappush",
"heapq",
"heappush",
"hq",
"A[i]",
"A",
"i",
"print(table[tmp])",
"print",
"table[tmp]",
"table",
"tmp",
"hq=[]",
"[]",
"hq",
"tmp=max(tmp,A[i]-j)",
"max(tmp,A[i]-j)",
"tmp",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"table=collections.defaultdict(int)",
"collections.defaultdict(int)",
"table",
"j=heapq.heappop(hq)",
"heapq.heappop(hq)",
"j",
"A=list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"tmp=0",
"0",
"tmp"
] |
N,T=map(int,input().split())
A=list(map(int,input().split()))
import heapq
import collections
hq=[]
heapq.heapify(hq)
heapq.heappush(hq,A[0])
tmp=0
table=collections.defaultdict(int)
for i in range(1,N):
j=heapq.heappop(hq)
table[A[i]-j]+=1
tmp=max(tmp,A[i]-j)
heapq.heappush(hq,j)
heapq.heappush(hq,A[i])
print(table[tmp])
|
[
7,
15,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
39,
18,
13,
17,
28,
13,
18,
13,
39,
17,
4,
18,
13,
13,
4,
13,
18,
13,
17,
13,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
114,
4
],
[
32,
31
],
[
130,
33
],
[
32,
34
],
[
37,
36
],
[
124,
38
],
[
41,
40
],
[
36,
43
],
[
47,
46
],
[
36,
48
],
[
40,
53
],
[
40,
58
],
[
46,
60
],
[
63,
62
],
[
31,
66
],
[
69,
68
],
[
31,
71
],
[
76,
73
],
[
62,
74
],
[
68,
75
],
[
36,
78
],
[
68,
79
],
[
40,
81
],
[
68,
82
],
[
85,
84
],
[
62,
87
],
[
62,
92
],
[
84,
94
],
[
112,
100
],
[
114,
115
]
] |
[
"import sys\ninput = sys.stdin.buffer.readline\n\n#sys.setrecursionlimit(10**9)\n#from functools import lru_cache\n\ndef RD(): return input().rstrip().decode()\ndef II(): return int(input())\ndef FI(): return float(input())\ndef MI(): return map(int,input().split())\ndef MF(): return map(float,input().split())\ndef LI(): return list(map(int,input().split()))\ndef LF(): return list(map(float,input().split()))\ndef TI(): return tuple(map(int,input().split()))\n# rstrip().decode()\n\n\n\ndef main():\n\tn,t=MI()\n\tA=LI()\n\n\tB=[A[0]]\n\tfor i in A[1:]:\n\t\tB.append(min(B[-1],i))\n\t#print(B)\n\n\tC=[0]*n\n\n\tfor i in range(n):\n\t\tC[i]=A[i]-B[i]\n\n\tc=max(C)\n\tprint(C.count(c))\n\n\t\n\t\n\n\n\n\t\n\t\n\t\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n\tmain()",
"import sys",
"sys",
"input = sys.stdin.buffer.readline",
"input",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"def RD(): return input().rstrip().decode()",
"RD",
"def II(): return int(input())",
"II",
"def FI(): return float(input())",
"FI",
"def MI(): return map(int,input().split())",
"MI",
"def MF(): return map(float,input().split())",
"MF",
"def LI(): return list(map(int,input().split()))",
"LI",
"def LF(): return list(map(float,input().split()))",
"LF",
"def TI(): return tuple(map(int,input().split()))\n# rstrip().decode()",
"TI",
"def main():\n\tn,t=MI()\n\tA=LI()\n\n\tB=[A[0]]\n\tfor i in A[1:]:\n\t\tB.append(min(B[-1],i))\n\t#print(B)\n\n\tC=[0]*n\n\n\tfor i in range(n):\n\t\tC[i]=A[i]-B[i]\n\n\tc=max(C)\n\tprint(C.count(c))\n\n\t\n\t\n\n\n\n\t\n\t\n\t",
"main",
"n,t=MI()",
"n",
"MI()",
"MI",
"t",
"A=LI()",
"A",
"LI()",
"LI",
"B=[A[0]]",
"B",
"[A[0]]",
"A[0]",
"A",
"0",
"for i in A[1:]:\n\t\tB.append(min(B[-1],i))\n\t#print(B)\n\n\t",
"i",
"A[1:]",
"A",
"1:",
"1",
"B.append(min(B[-1],i))",
"B.append",
"B",
"append",
"min(B[-1],i)",
"min",
"B[-1]",
"B",
"-1",
"i",
"C=[0]*n",
"C",
"[0]*n",
"[0]",
"0",
"n",
"for i in range(n):\n\t\tC[i]=A[i]-B[i]\n\n\t",
"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",
"c=max(C)",
"c",
"max(C)",
"max",
"C",
"print(C.count(c))",
"print",
"C.count(c)",
"C.count",
"C",
"count",
"c",
"if __name__ == \"__main__\":\n\tmain()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def TI(): return tuple(map(int,input().split()))\n# rstrip().decode()",
"def TI(): return tuple(map(int,input().split()))\n# rstrip().decode()",
"TI",
"def FI(): return float(input())",
"def FI(): return float(input())",
"FI",
"def RD(): return input().rstrip().decode()",
"def RD(): return input().rstrip().decode()",
"RD",
"def main():\n\tn,t=MI()\n\tA=LI()\n\n\tB=[A[0]]\n\tfor i in A[1:]:\n\t\tB.append(min(B[-1],i))\n\t#print(B)\n\n\tC=[0]*n\n\n\tfor i in range(n):\n\t\tC[i]=A[i]-B[i]\n\n\tc=max(C)\n\tprint(C.count(c))\n\n\t\n\t\n\n\n\n\t\n\t\n\t",
"def main():\n\tn,t=MI()\n\tA=LI()\n\n\tB=[A[0]]\n\tfor i in A[1:]:\n\t\tB.append(min(B[-1],i))\n\t#print(B)\n\n\tC=[0]*n\n\n\tfor i in range(n):\n\t\tC[i]=A[i]-B[i]\n\n\tc=max(C)\n\tprint(C.count(c))\n\n\t\n\t\n\n\n\n\t\n\t\n\t",
"main",
"input = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"input",
"def II(): return int(input())",
"def II(): return int(input())",
"II",
"def MF(): return map(float,input().split())",
"def MF(): return map(float,input().split())",
"MF",
"def LI(): return list(map(int,input().split()))",
"def LI(): return list(map(int,input().split()))",
"LI",
"def LF(): return list(map(float,input().split()))",
"def LF(): return list(map(float,input().split()))",
"LF",
"def MI(): return map(int,input().split())",
"def MI(): return map(int,input().split())",
"MI"
] |
import sys
input = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**9)
#from functools import lru_cache
def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return float(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()
def main():
n,t=MI()
A=LI()
B=[A[0]]
for i in A[1:]:
B.append(min(B[-1],i))
#print(B)
C=[0]*n
for i in range(n):
C[i]=A[i]-B[i]
c=max(C)
print(C.count(c))
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,
4,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
4,
18,
13,
13,
4,
18,
13,
13,
28,
13,
13,
14,
2,
18,
13,
17,
13,
24,
18,
13,
17,
3,
28,
13,
4,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
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,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] |
[
[
122,
2
],
[
122,
11
],
[
134,
13
],
[
137,
25
],
[
107,
30
],
[
110,
33
],
[
113,
36
],
[
135,
39
],
[
114,
43
],
[
47,
46
],
[
114,
46
],
[
135,
51
],
[
46,
53
],
[
135,
56
],
[
61,
60
],
[
135,
65
],
[
125,
67
],
[
138,
70
],
[
126,
70
],
[
135,
72
],
[
60,
73
],
[
108,
76
],
[
132,
76
],
[
135,
79
],
[
60,
80
],
[
126,
81
],
[
138,
81
],
[
131,
83
],
[
135,
86
],
[
60,
87
],
[
126,
88
],
[
138,
88
],
[
116,
90
],
[
108,
94
],
[
132,
94
],
[
135,
97
],
[
60,
98
],
[
126,
99
],
[
138,
99
],
[
128,
101
],
[
129,
105
],
[
117,
105
],
[
111,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
122,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
]
] |
[
"\nN,T = map(int,input().split())\n\nA = list(map(int,input().split()))\n\nnmin = float(\"inf\")\nnsub = 0\nans = 0\n\nAcopy = A.copy()\nAcopy.sort()\n\nfor i in Acopy:\n\n if A[-1] == i:\n del A[-1]\n else:\n break\n\n\nfor i in range(len(A)):\n\n nmin = min(nmin , A[i])\n\n if nsub < A[i] - nmin:\n nsub = A[i] - nmin\n ans = 1\n\n elif nsub == A[i] - nmin:\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",
"nmin = float(\"inf\")",
"nmin",
"float(\"inf\")",
"float",
"\"inf\"",
"nsub = 0",
"nsub",
"0",
"ans = 0",
"ans",
"0",
"Acopy = A.copy()",
"Acopy",
"A.copy()",
"A.copy",
"A",
"copy",
"Acopy.sort()",
"Acopy.sort",
"Acopy",
"sort",
"for i in Acopy:\n\n if A[-1] == i:\n del A[-1]\n else:\n break",
"i",
"Acopy",
"if A[-1] == i:\n del A[-1]\n else:\n break",
"A[-1] == i",
"A[-1]",
"A",
"-1",
"i",
"del A[-1]",
"A[-1]",
"A",
"-1",
"break",
"for i in range(len(A)):\n\n nmin = min(nmin , A[i])\n\n if nsub < A[i] - nmin:\n nsub = A[i] - nmin\n ans = 1\n\n elif nsub == A[i] - nmin:\n ans += 1",
"i",
"range(len(A))",
"range",
"len(A)",
"len",
"A",
"nmin = min(nmin , A[i])",
"nmin",
"min(nmin , A[i])",
"min",
"nmin",
"A[i]",
"A",
"i",
"if nsub < A[i] - nmin:\n nsub = A[i] - nmin\n ans = 1\n\n elif nsub == A[i] - nmin:\n ans += 1",
"nsub < A[i] - nmin",
"nsub",
"A[i] - nmin",
"A[i]",
"A",
"i",
"nmin",
"nsub = A[i] - nmin",
"nsub",
"A[i] - nmin",
"A[i]",
"A",
"i",
"nmin",
"ans = 1",
"ans",
"1",
"elif nsub == A[i] - nmin:\n ans += 1",
"nsub == A[i] - nmin",
"nsub",
"A[i] - nmin",
"A[i]",
"A",
"i",
"nmin",
"ans += 1",
"ans",
"1",
"print (ans)",
"print",
"ans",
"nsub = 0",
"0",
"nsub",
"ans = 0",
"0",
"ans",
"Acopy = A.copy()",
"A.copy()",
"Acopy",
"ans = 1",
"1",
"ans",
"N,T = map(int,input().split())",
"map(int,input().split())",
"N",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"nmin = min(nmin , A[i])",
"min(nmin , A[i])",
"nmin",
"ans += 1",
"1",
"ans",
"nsub = A[i] - nmin",
"A[i] - nmin",
"nsub",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"nmin = float(\"inf\")",
"float(\"inf\")",
"nmin"
] |
N,T = map(int,input().split())
A = list(map(int,input().split()))
nmin = float("inf")
nsub = 0
ans = 0
Acopy = A.copy()
Acopy.sort()
for i in Acopy:
if A[-1] == i:
del A[-1]
else:
break
for i in range(len(A)):
nmin = min(nmin , A[i])
if nsub < A[i] - nmin:
nsub = A[i] - nmin
ans = 1
elif nsub == A[i] - nmin:
ans += 1
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,
18,
13,
17,
0,
13,
18,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
13,
14,
2,
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,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13
] |
[
[
99,
2
],
[
99,
11
],
[
15,
14
],
[
14,
23
],
[
111,
25
],
[
117,
28
],
[
112,
30
],
[
102,
33
],
[
112,
35
],
[
120,
38
],
[
105,
41
],
[
45,
44
],
[
112,
44
],
[
118,
48
],
[
88,
48
],
[
44,
49
],
[
87,
51
],
[
44,
52
],
[
108,
54
],
[
44,
55
],
[
118,
58
],
[
88,
58
],
[
44,
59
],
[
44,
63
],
[
118,
64
],
[
88,
64
],
[
121,
65
],
[
97,
65
],
[
96,
67
],
[
44,
69
],
[
118,
70
],
[
88,
70
],
[
90,
72
],
[
44,
77
],
[
118,
78
],
[
88,
78
],
[
121,
79
],
[
97,
79
],
[
114,
81
],
[
115,
85
],
[
91,
85
],
[
106,
85
],
[
44,
87
],
[
87,
88
],
[
90,
91
],
[
99,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
44,
108
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
]
] |
[
"n, t = map(int, input().split())\na = [int(i) for i in input().split()]\nmin_a = a[0]\nmax_a = a[0]\ndiff = 0\nnum = 0\nfor aa in a:\n if min_a > aa:\n min_a = aa\n max_a = aa\n elif min_a < aa:\n if aa - min_a > diff:\n diff = aa - min_a\n num = 1\n elif aa - min_a == diff:\n num += 1\nprint(num)",
"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()]",
"min_a = a[0]",
"min_a",
"a[0]",
"a",
"0",
"max_a = a[0]",
"max_a",
"a[0]",
"a",
"0",
"diff = 0",
"diff",
"0",
"num = 0",
"num",
"0",
"for aa in a:\n if min_a > aa:\n min_a = aa\n max_a = aa\n elif min_a < aa:\n if aa - min_a > diff:\n diff = aa - min_a\n num = 1\n elif aa - min_a == diff:\n num += 1",
"aa",
"a",
"if min_a > aa:\n min_a = aa\n max_a = aa\n elif min_a < aa:\n if aa - min_a > diff:\n diff = aa - min_a\n num = 1\n elif aa - min_a == diff:\n num += 1",
"min_a > aa",
"min_a",
"aa",
"min_a = aa",
"min_a",
"aa",
"max_a = aa",
"max_a",
"aa",
"elif min_a < aa:\n if aa - min_a > diff:\n diff = aa - min_a\n num = 1\n elif aa - min_a == diff:\n num += 1",
"min_a < aa",
"min_a",
"aa",
"if aa - min_a > diff:\n diff = aa - min_a\n num = 1\n elif aa - min_a == diff:\n num += 1",
"aa - min_a > diff",
"aa - min_a",
"aa",
"min_a",
"diff",
"diff = aa - min_a",
"diff",
"aa - min_a",
"aa",
"min_a",
"num = 1",
"num",
"1",
"elif aa - min_a == diff:\n num += 1",
"aa - min_a == diff",
"aa - min_a",
"aa",
"min_a",
"diff",
"num += 1",
"num",
"1",
"print(num)",
"print",
"num",
"min_a = aa",
"aa",
"min_a",
"num = 1",
"1",
"num",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"diff = aa - min_a",
"aa - min_a",
"diff",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"max_a = a[0]",
"a[0]",
"max_a",
"num = 0",
"0",
"num",
"max_a = aa",
"aa",
"max_a",
"a = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a",
"num += 1",
"1",
"num",
"min_a = a[0]",
"a[0]",
"min_a",
"diff = 0",
"0",
"diff"
] |
n, t = map(int, input().split())
a = [int(i) for i in input().split()]
min_a = a[0]
max_a = a[0]
diff = 0
num = 0
for aa in a:
if min_a > aa:
min_a = aa
max_a = aa
elif min_a < aa:
if aa - min_a > diff:
diff = aa - min_a
num = 1
elif aa - min_a == diff:
num += 1
print(num)
|
[
7,
15,
13,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
0,
13,
12,
4,
13,
8,
13,
39,
4,
13,
17,
4,
13,
17,
23,
0,
13,
12,
4,
13,
8,
13,
39,
4,
13,
17,
4,
13,
17,
23,
0,
13,
12,
2,
4,
13,
13,
17,
23,
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,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
12,
39,
17,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
2,
18,
13,
13,
13,
14,
2,
13,
17,
0,
18,
18,
13,
18,
13,
13,
17,
17,
0,
18,
18,
13,
18,
13,
13,
17,
13,
0,
18,
13,
18,
13,
13,
17,
0,
13,
17,
28,
13,
4,
18,
13,
13,
0,
13,
4,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
217,
12
],
[
214,
17
],
[
220,
24
],
[
223,
36
],
[
226,
51
],
[
211,
66
],
[
78,
77
],
[
221,
84
],
[
78,
86
],
[
89,
88
],
[
221,
97
],
[
101,
100
],
[
218,
101
],
[
104,
103
],
[
107,
106
],
[
77,
109
],
[
112,
111
],
[
100,
114
],
[
111,
114
],
[
88,
116
],
[
106,
117
],
[
120,
119
],
[
103,
122
],
[
119,
122
],
[
88,
125
],
[
106,
126
],
[
111,
127
],
[
100,
127
],
[
130,
129
],
[
135,
134
],
[
143,
142
],
[
77,
145
],
[
148,
147
],
[
129,
149
],
[
88,
152
],
[
142,
153
],
[
119,
154
],
[
103,
154
],
[
147,
157
],
[
167,
160
],
[
134,
162
],
[
88,
164
],
[
142,
165
],
[
176,
169
],
[
134,
171
],
[
88,
173
],
[
142,
174
],
[
147,
176
],
[
183,
178
],
[
129,
179
],
[
88,
181
],
[
142,
182
],
[
186,
185
],
[
189,
188
],
[
134,
191
],
[
195,
194
],
[
188,
197
],
[
194,
200
],
[
185,
200
],
[
209,
206
],
[
211,
212
],
[
214,
215
],
[
217,
218
],
[
220,
221
],
[
223,
224
],
[
226,
227
]
] |
[
"# -*- coding: utf-8 -*-\nimport sys\nfrom collections import defaultdict\nsys.setrecursionlimit(10**9)\nINF=10**18\nMOD=10**9+7\ninput=lambda: sys.stdin.readline().rstrip()\nYesNo=lambda b: bool([print('Yes')] if b else print('No'))\nYESNO=lambda b: bool([print('YES')] if b else print('NO'))\nint1=lambda x:int(x)-1\n\ndef main():\n N,T=map(int,input().split())\n A=list(map(int,input().split()))\n m=INF\n diff=0\n for i in range(N):\n m=min(m,A[i])\n diff=max(diff,A[i]-m)\n d=defaultdict(int)\n dd=defaultdict(lambda:[0,0])\n for i in range(N):\n res=d[A[i]-diff]\n if res>0:\n dd[A[i]][0]+=1\n dd[A[i]][1]+=res\n d[A[i]]+=1\n ans=0\n for l in dd.values():\n ans+=min(l)\n print(ans)\n \n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"from collections import defaultdict",
"sys.setrecursionlimit(10**9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**9",
"10",
"9",
"INF=10**18",
"INF",
"10**18",
"10",
"18",
"MOD=10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"input=lambda: sys.stdin.readline().rstrip()",
"input",
"lambda: sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"YesNo=lambda b: bool([print('Yes')] if b else print('No'))",
"YesNo",
"lambda b: bool([print('Yes')] if b else print('No'))",
"bool([print('Yes')] if b else print('No'))",
"bool",
"[print('Yes')] if b else print('No')",
"b",
"[print('Yes')]",
"print('Yes')",
"print",
"'Yes'",
"print('No')",
"print",
"'No'",
"b",
"YESNO=lambda b: bool([print('YES')] if b else print('NO'))",
"YESNO",
"lambda b: bool([print('YES')] if b else print('NO'))",
"bool([print('YES')] if b else print('NO'))",
"bool",
"[print('YES')] if b else print('NO')",
"b",
"[print('YES')]",
"print('YES')",
"print",
"'YES'",
"print('NO')",
"print",
"'NO'",
"b",
"int1=lambda x:int(x)-1",
"int1",
"lambda x:int(x)-1",
"int(x)-1",
"int(x)",
"int",
"x",
"1",
"x",
"def main():\n N,T=map(int,input().split())\n A=list(map(int,input().split()))\n m=INF\n diff=0\n for i in range(N):\n m=min(m,A[i])\n diff=max(diff,A[i]-m)\n d=defaultdict(int)\n dd=defaultdict(lambda:[0,0])\n for i in range(N):\n res=d[A[i]-diff]\n if res>0:\n dd[A[i]][0]+=1\n dd[A[i]][1]+=res\n d[A[i]]+=1\n ans=0\n for l in dd.values():\n ans+=min(l)\n print(ans)\n ",
"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=INF",
"m",
"INF",
"diff=0",
"diff",
"0",
"for i in range(N):\n m=min(m,A[i])\n diff=max(diff,A[i]-m)\n ",
"i",
"range(N)",
"range",
"N",
"m=min(m,A[i])",
"m",
"min(m,A[i])",
"min",
"m",
"A[i]",
"A",
"i",
"diff=max(diff,A[i]-m)",
"diff",
"max(diff,A[i]-m)",
"max",
"diff",
"A[i]-m",
"A[i]",
"A",
"i",
"m",
"d=defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"dd=defaultdict(lambda:[0,0])",
"dd",
"defaultdict(lambda:[0,0])",
"defaultdict",
"lambda:[0,0]",
"[0,0]",
"0",
"0",
"for i in range(N):\n res=d[A[i]-diff]\n if res>0:\n dd[A[i]][0]+=1\n dd[A[i]][1]+=res\n d[A[i]]+=1\n ",
"i",
"range(N)",
"range",
"N",
"res=d[A[i]-diff]",
"res",
"d[A[i]-diff]",
"d",
"A[i]-diff",
"A[i]",
"A",
"i",
"diff",
"if res>0:\n dd[A[i]][0]+=1\n dd[A[i]][1]+=res\n ",
"res>0",
"res",
"0",
"dd[A[i]][0]+=1",
"dd[A[i]][0]",
"[A[i]]",
"dd",
"A[i]",
"A",
"i",
"0",
"1",
"dd[A[i]][1]+=res",
"dd[A[i]][1]",
"[A[i]]",
"dd",
"A[i]",
"A",
"i",
"1",
"res",
"d[A[i]]+=1",
"d[A[i]]",
"d",
"A[i]",
"A",
"i",
"1",
"ans=0",
"ans",
"0",
"for l in dd.values():\n ans+=min(l)\n ",
"l",
"dd.values()",
"dd.values",
"dd",
"values",
"ans+=min(l)",
"ans",
"min(l)",
"min",
"l",
"print(ans)",
"print",
"ans",
"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=INF\n diff=0\n for i in range(N):\n m=min(m,A[i])\n diff=max(diff,A[i]-m)\n d=defaultdict(int)\n dd=defaultdict(lambda:[0,0])\n for i in range(N):\n res=d[A[i]-diff]\n if res>0:\n dd[A[i]][0]+=1\n dd[A[i]][1]+=res\n d[A[i]]+=1\n ans=0\n for l in dd.values():\n ans+=min(l)\n print(ans)\n ",
"def main():\n N,T=map(int,input().split())\n A=list(map(int,input().split()))\n m=INF\n diff=0\n for i in range(N):\n m=min(m,A[i])\n diff=max(diff,A[i]-m)\n d=defaultdict(int)\n dd=defaultdict(lambda:[0,0])\n for i in range(N):\n res=d[A[i]-diff]\n if res>0:\n dd[A[i]][0]+=1\n dd[A[i]][1]+=res\n d[A[i]]+=1\n ans=0\n for l in dd.values():\n ans+=min(l)\n print(ans)\n ",
"main",
"int1=lambda x:int(x)-1",
"lambda x:int(x)-1",
"int1",
"MOD=10**9+7",
"10**9+7",
"MOD",
"INF=10**18",
"10**18",
"INF",
"input=lambda: sys.stdin.readline().rstrip()",
"lambda: sys.stdin.readline().rstrip()",
"input",
"YesNo=lambda b: bool([print('Yes')] if b else print('No'))",
"lambda b: bool([print('Yes')] if b else print('No'))",
"YesNo",
"YESNO=lambda b: bool([print('YES')] if b else print('NO'))",
"lambda b: bool([print('YES')] if b else print('NO'))",
"YESNO"
] |
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
N,T=map(int,input().split())
A=list(map(int,input().split()))
m=INF
diff=0
for i in range(N):
m=min(m,A[i])
diff=max(diff,A[i]-m)
d=defaultdict(int)
dd=defaultdict(lambda:[0,0])
for i in range(N):
res=d[A[i]-diff]
if res>0:
dd[A[i]][0]+=1
dd[A[i]][1]+=res
d[A[i]]+=1
ans=0
for l in dd.values():
ans+=min(l)
print(ans)
if __name__ == '__main__':
main()
|
[
7,
12,
13,
15,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
15,
15,
15,
15,
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,
2,
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,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
14,
2,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
7,
6
],
[
26,
25
],
[
6,
32
],
[
26,
34
],
[
37,
36
],
[
6,
45
],
[
49,
48
],
[
25,
52
],
[
57,
54
],
[
48,
55
],
[
36,
58
],
[
62,
61
],
[
25,
65
],
[
48,
72
],
[
61,
74
],
[
36,
77
],
[
61,
78
],
[
83,
80
],
[
48,
81
],
[
61,
82
],
[
36,
84
],
[
61,
85
],
[
90,
87
],
[
48,
88
],
[
61,
89
],
[
48,
91
],
[
61,
93
],
[
97,
96
],
[
100,
99
],
[
103,
102
],
[
25,
106
],
[
99,
110
],
[
121,
110
],
[
48,
113
],
[
102,
115
],
[
36,
118
],
[
102,
119
],
[
122,
121
],
[
48,
124
],
[
102,
126
],
[
36,
129
],
[
102,
130
],
[
133,
132
],
[
99,
136
],
[
121,
136
],
[
48,
139
],
[
102,
141
],
[
36,
144
],
[
102,
145
],
[
148,
147
],
[
147,
151
],
[
132,
151
],
[
96,
151
],
[
160,
157
]
] |
[
"def main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n #from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby, product\n from bisect import bisect_left,bisect_right\n from heapq import heapify, heappop, heappush\n from math import floor, ceil\n #from operator import itemgetter\n\n #inf = 10**17\n #mod = 10**9 + 7\n\n n,t = map(int, input().split())\n a = list(map(int, input().split()))\n b = [0]*n\n b[-1] = a[-1]\n for i in range(n-2, 0, -1):\n if b[i+1] < a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i+1]\n res = 0\n temp = 0\n for i in range(n-1):\n if temp < b[i+1]-a[i]:\n temp = b[i+1]-a[i]\n res = 1\n elif temp == b[i+1]-a[i]:\n res += 1\n print(res)\n\nif __name__ == '__main__':\n main()",
"def main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n #from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby, product\n from bisect import bisect_left,bisect_right\n from heapq import heapify, heappop, heappush\n from math import floor, ceil\n #from operator import itemgetter\n\n #inf = 10**17\n #mod = 10**9 + 7\n\n n,t = map(int, input().split())\n a = list(map(int, input().split()))\n b = [0]*n\n b[-1] = a[-1]\n for i in range(n-2, 0, -1):\n if b[i+1] < a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i+1]\n res = 0\n temp = 0\n for i in range(n-1):\n if temp < b[i+1]-a[i]:\n temp = b[i+1]-a[i]\n res = 1\n elif temp == b[i+1]-a[i]:\n res += 1\n print(res)",
"main",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"sys.setrecursionlimit(10**7)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**7",
"10",
"7",
"from collections import Counter, deque",
"from itertools import combinations, permutations, accumulate, groupby, product",
"from bisect import bisect_left,bisect_right",
"from heapq import heapify, heappop, heappush",
"from math import floor, ceil",
"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 = [0]*n",
"b",
"[0]*n",
"[0]",
"0",
"n",
"b[-1] = a[-1]",
"b[-1]",
"b",
"-1",
"a[-1]",
"a",
"-1",
"for i in range(n-2, 0, -1):\n if b[i+1] < a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i+1]\n ",
"i",
"range(n-2, 0, -1)",
"range",
"n-2",
"n",
"2",
"0",
"-1",
"if b[i+1] < a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i+1]\n ",
"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",
"res = 0",
"res",
"0",
"temp = 0",
"temp",
"0",
"for i in range(n-1):\n if temp < b[i+1]-a[i]:\n temp = b[i+1]-a[i]\n res = 1\n elif temp == b[i+1]-a[i]:\n res += 1\n ",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"if temp < b[i+1]-a[i]:\n temp = b[i+1]-a[i]\n res = 1\n elif temp == b[i+1]-a[i]:\n res += 1\n ",
"temp < b[i+1]-a[i]",
"temp",
"b[i+1]-a[i]",
"b[i+1]",
"b",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"temp = b[i+1]-a[i]",
"temp",
"b[i+1]-a[i]",
"b[i+1]",
"b",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"res = 1",
"res",
"1",
"elif temp == b[i+1]-a[i]:\n res += 1\n ",
"temp == b[i+1]-a[i]",
"temp",
"b[i+1]-a[i]",
"b[i+1]",
"b",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"res += 1",
"res",
"1",
"print(res)",
"print",
"res",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n #from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby, product\n from bisect import bisect_left,bisect_right\n from heapq import heapify, heappop, heappush\n from math import floor, ceil\n #from operator import itemgetter\n\n #inf = 10**17\n #mod = 10**9 + 7\n\n n,t = map(int, input().split())\n a = list(map(int, input().split()))\n b = [0]*n\n b[-1] = a[-1]\n for i in range(n-2, 0, -1):\n if b[i+1] < a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i+1]\n res = 0\n temp = 0\n for i in range(n-1):\n if temp < b[i+1]-a[i]:\n temp = b[i+1]-a[i]\n res = 1\n elif temp == b[i+1]-a[i]:\n res += 1\n print(res)",
"def main():\n import sys\n input = sys.stdin.readline\n sys.setrecursionlimit(10**7)\n from collections import Counter, deque\n #from collections import defaultdict\n from itertools import combinations, permutations, accumulate, groupby, product\n from bisect import bisect_left,bisect_right\n from heapq import heapify, heappop, heappush\n from math import floor, ceil\n #from operator import itemgetter\n\n #inf = 10**17\n #mod = 10**9 + 7\n\n n,t = map(int, input().split())\n a = list(map(int, input().split()))\n b = [0]*n\n b[-1] = a[-1]\n for i in range(n-2, 0, -1):\n if b[i+1] < a[i]:\n b[i] = a[i]\n else:\n b[i] = b[i+1]\n res = 0\n temp = 0\n for i in range(n-1):\n if temp < b[i+1]-a[i]:\n temp = b[i+1]-a[i]\n res = 1\n elif temp == b[i+1]-a[i]:\n res += 1\n print(res)",
"main"
] |
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
#from operator import itemgetter
#inf = 10**17
#mod = 10**9 + 7
n,t = map(int, input().split())
a = list(map(int, input().split()))
b = [0]*n
b[-1] = a[-1]
for i in range(n-2, 0, -1):
if b[i+1] < a[i]:
b[i] = a[i]
else:
b[i] = b[i+1]
res = 0
temp = 0
for i in range(n-1):
if temp < b[i+1]-a[i]:
temp = b[i+1]-a[i]
res = 1
elif temp == b[i+1]-a[i]:
res += 1
print(res)
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,
18,
13,
17,
13,
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,
2,
17,
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,
4,
13,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
129,
2
],
[
129,
11
],
[
123,
13
],
[
102,
25
],
[
124,
29
],
[
127,
31
],
[
34,
33
],
[
127,
37
],
[
45,
42
],
[
103,
43
],
[
33,
44
],
[
103,
48
],
[
33,
50
],
[
124,
53
],
[
33,
54
],
[
111,
56
],
[
117,
59
],
[
65,
64
],
[
127,
68
],
[
120,
71
],
[
103,
74
],
[
64,
76
],
[
124,
79
],
[
64,
80
],
[
121,
83
],
[
118,
84
],
[
115,
84
],
[
114,
86
],
[
121,
87
],
[
105,
89
],
[
121,
93
],
[
118,
94
],
[
115,
94
],
[
108,
96
],
[
109,
100
],
[
106,
100
],
[
112,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
121,
114
],
[
114,
115
],
[
117,
118
],
[
120,
121
],
[
123,
124
],
[
129,
127
],
[
129,
130
]
] |
[
"n, t = map(int,input().split())\na = list(map(int,input().split()))\namax = [a[-1]] * n\n\nfor i in range(n-2, -1, -1):\n amax[i] = max(amax[i+1], a[i])\n\ncnt = 0\nv = -10**10\nfor i in range(n-1):\n b = amax[i+1] - a[i]\n if b > v:\n v = b\n cnt = 1\n elif b == v:\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",
"amax = [a[-1]] * n",
"amax",
"[a[-1]] * n",
"[a[-1]]",
"a[-1]",
"a",
"-1",
"n",
"for i in range(n-2, -1, -1):\n amax[i] = max(amax[i+1], a[i])",
"i",
"range(n-2, -1, -1)",
"range",
"n-2",
"n",
"2",
"-1",
"-1",
"amax[i] = max(amax[i+1], a[i])",
"amax[i]",
"amax",
"i",
"max(amax[i+1], a[i])",
"max",
"amax[i+1]",
"amax",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"cnt = 0",
"cnt",
"0",
"v = -10**10",
"v",
"-10**10",
"-10",
"10",
"for i in range(n-1):\n b = amax[i+1] - a[i]\n if b > v:\n v = b\n cnt = 1\n elif b == v:\n cnt += 1",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"b = amax[i+1] - a[i]",
"b",
"amax[i+1] - a[i]",
"amax[i+1]",
"amax",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"if b > v:\n v = b\n cnt = 1\n elif b == v:\n cnt += 1",
"b > v",
"b",
"v",
"v = b",
"v",
"b",
"cnt = 1",
"cnt",
"1",
"elif b == v:\n cnt += 1",
"b == v",
"b",
"v",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"amax = [a[-1]] * n",
"[a[-1]] * n",
"amax",
"cnt = 1",
"1",
"cnt",
"cnt += 1",
"1",
"cnt",
"cnt = 0",
"0",
"cnt",
"v = b",
"b",
"v",
"v = -10**10",
"-10**10",
"v",
"b = amax[i+1] - a[i]",
"amax[i+1] - a[i]",
"b",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"n, t = map(int,input().split())",
"map(int,input().split())",
"n",
"t = map(int,input().split())",
"map(int,input().split())",
"t"
] |
n, t = map(int,input().split())
a = list(map(int,input().split()))
amax = [a[-1]] * n
for i in range(n-2, -1, -1):
amax[i] = max(amax[i+1], a[i])
cnt = 0
v = -10**10
for i in range(n-1):
b = amax[i+1] - a[i]
if b > v:
v = b
cnt = 1
elif b == v:
cnt += 1
print(cnt)
|
[
7,
15,
13,
13,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
12,
13,
12,
13,
12,
13,
12,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
39,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
2,
18,
13,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
12,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
12,
13,
10,
18,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13
] |
[
[
153,
31
],
[
123,
36
],
[
144,
43
],
[
148,
45
],
[
144,
46
],
[
111,
48
],
[
121,
50
],
[
138,
52
],
[
135,
55
],
[
112,
57
],
[
126,
60
],
[
64,
63
],
[
115,
66
],
[
136,
69
],
[
118,
69
],
[
112,
71
],
[
63,
72
],
[
117,
74
],
[
112,
76
],
[
63,
77
],
[
139,
80
],
[
127,
82
],
[
130,
82
],
[
142,
82
],
[
141,
84
],
[
129,
87
],
[
127,
90
],
[
130,
90
],
[
142,
90
],
[
112,
93
],
[
63,
94
],
[
136,
95
],
[
118,
95
],
[
139,
98
],
[
130,
100
],
[
142,
100
],
[
127,
100
],
[
139,
105
],
[
139,
109
],
[
111,
112
],
[
144,
115
],
[
117,
118
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
135,
136
],
[
138,
139
],
[
141,
142
],
[
144,
145
],
[
153,
154
]
] |
[
"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians\nfrom itertools import accumulate, permutations, combinations, product\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left\nfrom fractions import gcd\nfrom heapq import heappush, heappop\nfrom scipy.sparse import csr_matrix\nfrom scipy.sparse.csgraph import floyd_warshall\n\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\nN, T = MAP()\nA = LIST()\n\nlis = []\ntmp = A[0]\ntmp_max = 0\nfor i in range(N):\n\tif tmp > A[i]:\n\t\ttmp = A[i]\n\t\tlis.append(tmp_max)\n\t\ttmp_max = 0\n\telse:\n\t\ttmp_max = max(tmp_max, A[i]-tmp)\nlis.append(tmp_max)\n\nprint(lis.count(max(lis)))",
"import sys, re",
"sys",
"re",
"from collections import deque, defaultdict, Counter",
"from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians",
"from itertools import accumulate, permutations, combinations, product",
"from operator import itemgetter, mul",
"from copy import deepcopy",
"from string import ascii_lowercase, ascii_uppercase, digits",
"from bisect import bisect, bisect_left",
"from fractions import gcd",
"from heapq import heappush, heappop",
"from scipy.sparse import csr_matrix",
"from scipy.sparse.csgraph import floyd_warshall",
"def input(): return sys.stdin.readline().strip()",
"input",
"def INT(): return int(input())",
"INT",
"def MAP(): return map(int, input().split())",
"MAP",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"MOD = 10 ** 9 + 7",
"MOD",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"N, T = MAP()",
"N",
"MAP()",
"MAP",
"T",
"A = LIST()",
"A",
"LIST()",
"LIST",
"lis = []",
"lis",
"[]",
"tmp = A[0]",
"tmp",
"A[0]",
"A",
"0",
"tmp_max = 0",
"tmp_max",
"0",
"for i in range(N):\n\tif tmp > A[i]:\n\t\ttmp = A[i]\n\t\tlis.append(tmp_max)\n\t\ttmp_max = 0\n\telse:\n\t\ttmp_max = max(tmp_max, A[i]-tmp)",
"i",
"range(N)",
"range",
"N",
"if tmp > A[i]:\n\t\ttmp = A[i]\n\t\tlis.append(tmp_max)\n\t\ttmp_max = 0\n\telse:\n\t\ttmp_max = max(tmp_max, A[i]-tmp)",
"tmp > A[i]",
"tmp",
"A[i]",
"A",
"i",
"tmp = A[i]",
"tmp",
"A[i]",
"A",
"i",
"lis.append(tmp_max)",
"lis.append",
"lis",
"append",
"tmp_max",
"tmp_max = 0",
"tmp_max",
"0",
"tmp_max = max(tmp_max, A[i]-tmp)",
"tmp_max",
"max(tmp_max, A[i]-tmp)",
"max",
"tmp_max",
"A[i]-tmp",
"A[i]",
"A",
"i",
"tmp",
"lis.append(tmp_max)",
"lis.append",
"lis",
"append",
"tmp_max",
"print(lis.count(max(lis)))",
"print",
"lis.count(max(lis))",
"lis.count",
"lis",
"count",
"max(lis)",
"max",
"lis",
"A = LIST()",
"LIST()",
"A",
"N, T = MAP()",
"MAP()",
"N",
"tmp = A[i]",
"A[i]",
"tmp",
"def LIST(): return list(map(int, input().split()))",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"MOD = 10 ** 9 + 7",
"10 ** 9 + 7",
"MOD",
"tmp_max = 0",
"0",
"tmp_max",
"tmp_max = max(tmp_max, A[i]-tmp)",
"max(tmp_max, A[i]-tmp)",
"tmp_max",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"tmp = A[0]",
"A[0]",
"tmp",
"lis = []",
"[]",
"lis",
"tmp_max = 0",
"0",
"tmp_max",
"T = MAP()",
"MAP()",
"T",
"def MAP(): return map(int, input().split())",
"def MAP(): return map(int, input().split())",
"MAP",
"def INT(): return int(input())",
"def INT(): return int(input())",
"INT",
"INF = float('inf')",
"float('inf')",
"INF"
] |
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
N, T = MAP()
A = LIST()
lis = []
tmp = A[0]
tmp_max = 0
for i in range(N):
if tmp > A[i]:
tmp = A[i]
lis.append(tmp_max)
tmp_max = 0
else:
tmp_max = max(tmp_max, A[i]-tmp)
lis.append(tmp_max)
print(lis.count(max(lis)))
|
[
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,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
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,
4,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13
] |
[
[
128,
2
],
[
128,
11
],
[
113,
13
],
[
125,
25
],
[
131,
30
],
[
116,
33
],
[
101,
36
],
[
40,
39
],
[
96,
42
],
[
126,
45
],
[
120,
45
],
[
114,
47
],
[
39,
48
],
[
119,
50
],
[
114,
52
],
[
39,
53
],
[
122,
55
],
[
123,
59
],
[
132,
59
],
[
108,
59
],
[
114,
61
],
[
39,
62
],
[
107,
64
],
[
114,
66
],
[
39,
67
],
[
117,
70
],
[
99,
70
],
[
108,
72
],
[
123,
72
],
[
132,
72
],
[
120,
73
],
[
126,
73
],
[
110,
75
],
[
117,
79
],
[
99,
79
],
[
108,
81
],
[
123,
81
],
[
132,
81
],
[
120,
82
],
[
126,
82
],
[
98,
84
],
[
108,
86
],
[
123,
86
],
[
132,
86
],
[
120,
87
],
[
126,
87
],
[
104,
89
],
[
105,
93
],
[
111,
93
],
[
102,
93
],
[
128,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\nlo = 10**18\nhi = 0\nd = 0\nres = 0\n\n\nfor i in range(N):\n if lo > A[i]:\n lo = A[i]\n hi = 0\n if hi < A[i]:\n hi = A[i]\n if d == hi - lo:\n res += 1\n elif d < hi - lo:\n d = hi - lo\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",
"lo = 10**18",
"lo",
"10**18",
"10",
"18",
"hi = 0",
"hi",
"0",
"d = 0",
"d",
"0",
"res = 0",
"res",
"0",
"for i in range(N):\n if lo > A[i]:\n lo = A[i]\n hi = 0\n if hi < A[i]:\n hi = A[i]\n if d == hi - lo:\n res += 1\n elif d < hi - lo:\n d = hi - lo\n res = 1",
"i",
"range(N)",
"range",
"N",
"if lo > A[i]:\n lo = A[i]\n hi = 0\n ",
"lo > A[i]",
"lo",
"A[i]",
"A",
"i",
"lo = A[i]",
"lo",
"A[i]",
"A",
"i",
"hi = 0",
"hi",
"0",
"if hi < A[i]:\n hi = A[i]\n if d == hi - lo:\n res += 1\n elif d < hi - lo:\n d = hi - lo\n res = 1",
"hi < A[i]",
"hi",
"A[i]",
"A",
"i",
"hi = A[i]",
"hi",
"A[i]",
"A",
"i",
"if d == hi - lo:\n res += 1\n elif d < hi - lo:\n d = hi - lo\n res = 1",
"d == hi - lo",
"d",
"hi - lo",
"hi",
"lo",
"res += 1",
"res",
"1",
"elif d < hi - lo:\n d = hi - lo\n res = 1",
"d < hi - lo",
"d",
"hi - lo",
"hi",
"lo",
"d = hi - lo",
"d",
"hi - lo",
"hi",
"lo",
"res = 1",
"res",
"1",
"print(res)",
"print",
"res",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"d = hi - lo",
"hi - lo",
"d",
"res = 0",
"0",
"res",
"res = 1",
"1",
"res",
"hi = A[i]",
"A[i]",
"hi",
"res += 1",
"1",
"res",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"d = 0",
"0",
"d",
"lo = A[i]",
"A[i]",
"lo",
"hi = 0",
"0",
"hi",
"lo = 10**18",
"10**18",
"lo",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"hi = 0",
"0",
"hi"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
lo = 10**18
hi = 0
d = 0
res = 0
for i in range(N):
if lo > A[i]:
lo = A[i]
hi = 0
if hi < A[i]:
hi = A[i]
if d == hi - lo:
res += 1
elif d < hi - lo:
d = hi - lo
res = 1
print(res)
|
[
7,
15,
13,
0,
13,
18,
13,
13,
4,
18,
13,
13,
2,
17,
17,
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,
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,
39,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
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,
18,
13,
10,
4,
13,
10,
39,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13
] |
[
[
110,
4
],
[
140,
16
],
[
137,
23
],
[
111,
34
],
[
119,
38
],
[
111,
46
],
[
122,
50
],
[
111,
56
],
[
131,
60
],
[
138,
62
],
[
131,
63
],
[
113,
65
],
[
138,
67
],
[
116,
69
],
[
128,
73
],
[
114,
75
],
[
79,
78
],
[
126,
82
],
[
117,
85
],
[
114,
89
],
[
78,
90
],
[
129,
91
],
[
135,
91
],
[
134,
93
],
[
129,
96
],
[
135,
96
],
[
114,
98
],
[
78,
99
],
[
117,
104
],
[
117,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
],
[
131,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
]
] |
[
"import sys\nstdin = sys.stdin\nsys.setrecursionlimit(10**6)\nni = lambda: int(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nnn = lambda: list(stdin.readline().split())\nns = lambda: stdin.readline().rstrip()\n\nn,t = na()\na = na()\nb = [0]\nc = a[0]\nfor i in range(1,n):\n b.append(a[i]-c)\n c = min(c,a[i])\n\nprint(b.count(max(b)))",
"import sys",
"sys",
"stdin = sys.stdin",
"stdin",
"sys.stdin",
"sys",
"stdin",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"ni = lambda: int(ns())",
"ni",
"lambda: int(ns())",
"int(ns())",
"int",
"ns()",
"ns",
"na = lambda: list(map(int, stdin.readline().split()))",
"na",
"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",
"nn = lambda: list(stdin.readline().split())",
"nn",
"lambda: list(stdin.readline().split())",
"list(stdin.readline().split())",
"list",
"stdin.readline().split()",
"stdin.readline().split",
"stdin.readline()",
"stdin.readline",
"stdin",
"readline",
"split",
"ns = lambda: stdin.readline().rstrip()",
"ns",
"lambda: stdin.readline().rstrip()",
"stdin.readline().rstrip()",
"stdin.readline().rstrip",
"stdin.readline()",
"stdin.readline",
"stdin",
"readline",
"rstrip",
"n,t = na()",
"n",
"na()",
"na",
"t",
"a = na()",
"a",
"na()",
"na",
"b = [0]",
"b",
"[0]",
"0",
"c = a[0]",
"c",
"a[0]",
"a",
"0",
"for i in range(1,n):\n b.append(a[i]-c)\n c = min(c,a[i])",
"i",
"range(1,n)",
"range",
"1",
"n",
"b.append(a[i]-c)",
"b.append",
"b",
"append",
"a[i]-c",
"a[i]",
"a",
"i",
"c",
"c = min(c,a[i])",
"c",
"min(c,a[i])",
"min",
"c",
"a[i]",
"a",
"i",
"print(b.count(max(b)))",
"print",
"b.count(max(b))",
"b.count",
"b",
"count",
"max(b)",
"max",
"b",
"stdin = sys.stdin",
"sys.stdin",
"stdin",
"a = na()",
"na()",
"a",
"b = [0]",
"[0]",
"b",
"nn = lambda: list(stdin.readline().split())",
"lambda: list(stdin.readline().split())",
"nn",
"ns = lambda: stdin.readline().rstrip()",
"lambda: stdin.readline().rstrip()",
"ns",
"n,t = na()",
"na()",
"n",
"c = a[0]",
"a[0]",
"c",
"t = na()",
"na()",
"t",
"c = min(c,a[i])",
"min(c,a[i])",
"c",
"na = lambda: list(map(int, stdin.readline().split()))",
"lambda: list(map(int, stdin.readline().split()))",
"na",
"ni = lambda: int(ns())",
"lambda: int(ns())",
"ni"
] |
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
n,t = na()
a = na()
b = [0]
c = a[0]
for i in range(1,n):
b.append(a[i]-c)
c = min(c,a[i])
print(b.count(max(b)))
|
[
7,
15,
13,
15,
0,
13,
18,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
31,
13,
0,
13,
4,
13,
13,
13,
41,
28,
13,
13,
4,
13,
13,
13,
4,
2,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13
] |
[
[
64,
5
],
[
73,
12
],
[
65,
19
],
[
73,
21
],
[
73,
22
],
[
58,
25
],
[
59,
37
],
[
67,
43
],
[
70,
46
],
[
68,
49
],
[
68,
54
],
[
71,
56
],
[
58,
59
],
[
73,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
]
] |
[
"import sys\nfrom itertools import accumulate\nread = sys.stdin.read\n\nN, T, *A = map(int, read().split())\na_minimum = accumulate(A, min)\na = [i - j for i, j in zip(A, a_minimum)]\nminimum = max(a)\n\nprint(a.count(minimum))",
"import sys",
"sys",
"from itertools import accumulate",
"read = sys.stdin.read",
"read",
"sys.stdin.read",
"sys.stdin",
"sys",
"stdin",
"read",
"N, T, *A = map(int, read().split())",
"N",
"map(int, read().split())",
"map",
"int",
"read().split()",
"().split",
"()",
"read",
"split",
"T",
"*A",
"A",
"a_minimum = accumulate(A, min)",
"a_minimum",
"accumulate(A, min)",
"accumulate",
"A",
"min",
"i - j for i, j in zip(A, a_minimum)",
"for i, j in zip(A, a_minimum)",
"i",
"j",
"zip(A, a_minimum)",
"zip",
"A",
"a_minimum",
"for i, j in zip(A, a_minimum)",
"i - j",
"i",
"j",
"a = [i - j for i, j in zip(A, a_minimum)]",
"a",
"[i - j for i, j in zip(A, a_minimum)]",
"minimum = max(a)",
"minimum",
"max(a)",
"max",
"a",
"print(a.count(minimum))",
"print",
"a.count(minimum)",
"a.count",
"a",
"count",
"minimum",
"a_minimum = accumulate(A, min)",
"accumulate(A, min)",
"a_minimum",
"N, T, *A = map(int, read().split())",
"map(int, read().split())",
"N",
"read = sys.stdin.read",
"sys.stdin.read",
"read",
"a = [i - j for i, j in zip(A, a_minimum)]",
"[i - j for i, j in zip(A, a_minimum)]",
"a",
"minimum = max(a)",
"max(a)",
"minimum",
"T, *A = map(int, read().split())",
"map(int, read().split())",
"T"
] |
import sys
from itertools import accumulate
read = sys.stdin.read
N, T, *A = map(int, read().split())
a_minimum = accumulate(A, min)
a = [i - j for i, j in zip(A, a_minimum)]
minimum = max(a)
print(a.count(minimum))
|
[
7,
15,
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,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
2,
18,
13,
13,
13,
14,
2,
18,
13,
13,
13,
0,
18,
13,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13
] |
[
[
121,
3
],
[
121,
12
],
[
16,
14
],
[
112,
25
],
[
124,
30
],
[
109,
35
],
[
39,
38
],
[
122,
42
],
[
127,
44
],
[
38,
48
],
[
125,
49
],
[
107,
49
],
[
57,
52
],
[
113,
53
],
[
125,
54
],
[
107,
54
],
[
128,
55
],
[
60,
57
],
[
113,
58
],
[
125,
59
],
[
107,
59
],
[
128,
60
],
[
38,
65
],
[
125,
66
],
[
107,
66
],
[
106,
68
],
[
38,
71
],
[
128,
74
],
[
110,
75
],
[
101,
75
],
[
100,
77
],
[
128,
78
],
[
118,
80
],
[
113,
87
],
[
101,
92
],
[
110,
92
],
[
115,
94
],
[
116,
98
],
[
119,
98
],
[
128,
100
],
[
100,
101
],
[
121,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
]
] |
[
"from collections import defaultdict\n\nN, T = map(int, input().split())\n*a, = map(int, input().split())\nt = defaultdict(int)\nm = a[0]\np = 0\nfor i in range(1, N):\n c = a[i] - m\n if t[m] < c:\n t[m] = c\n if a[i] < m:\n m = a[i]\n if c > p:\n p = c\n\nans = 0\nfor k, v in t.items():\n if v == p:\n ans += 1\n\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, = map(int, input().split())",
"*a",
"a",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t = defaultdict(int)",
"t",
"defaultdict(int)",
"defaultdict",
"int",
"m = a[0]",
"m",
"a[0]",
"a",
"0",
"p = 0",
"p",
"0",
"for i in range(1, N):\n c = a[i] - m\n if t[m] < c:\n t[m] = c\n if a[i] < m:\n m = a[i]\n if c > p:\n p = c",
"i",
"range(1, N)",
"range",
"1",
"N",
"c = a[i] - m",
"c",
"a[i] - m",
"a[i]",
"a",
"i",
"m",
"if t[m] < c:\n t[m] = c\n ",
"t[m] < c",
"t[m]",
"t",
"m",
"c",
"t[m] = c",
"t[m]",
"t",
"m",
"c",
"if a[i] < m:\n m = a[i]\n ",
"a[i] < m",
"a[i]",
"a",
"i",
"m",
"m = a[i]",
"m",
"a[i]",
"a",
"i",
"if c > p:\n p = c",
"c > p",
"c",
"p",
"p = c",
"p",
"c",
"ans = 0",
"ans",
"0",
"for k, v in t.items():\n if v == p:\n ans += 1",
"k",
"v",
"t.items()",
"t.items",
"t",
"items",
"if v == p:\n ans += 1",
"v == p",
"v",
"p",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"p = c",
"c",
"p",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"m = a[i]",
"a[i]",
"m",
"p = 0",
"0",
"p",
"t = defaultdict(int)",
"defaultdict(int)",
"t",
"ans += 1",
"1",
"ans",
"ans = 0",
"0",
"ans",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"m = a[0]",
"a[0]",
"m",
"c = a[i] - m",
"a[i] - m",
"c"
] |
from collections import defaultdict
N, T = map(int, input().split())
*a, = map(int, input().split())
t = defaultdict(int)
m = a[0]
p = 0
for i in range(1, N):
c = a[i] - m
if t[m] < c:
t[m] = c
if a[i] < m:
m = a[i]
if c > p:
p = c
ans = 0
for k, v in t.items():
if v == p:
ans += 1
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
31,
13,
0,
13,
17,
0,
13,
17,
13,
17,
28,
13,
4,
13,
13,
14,
2,
13,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13
] |
[
[
85,
2
],
[
85,
15
],
[
85,
16
],
[
70,
19
],
[
67,
22
],
[
79,
24
],
[
28,
27
],
[
77,
30
],
[
71,
33
],
[
27,
36
],
[
80,
39
],
[
83,
39
],
[
27,
43
],
[
71,
44
],
[
80,
47
],
[
83,
47
],
[
27,
51
],
[
71,
52
],
[
82,
54
],
[
27,
58
],
[
71,
59
],
[
73,
61
],
[
74,
65
],
[
68,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
],
[
85,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
]
] |
[
"n, k, *a = map(int, open(0).read().split())\n\nmn = 1e18\nans, got = 1, 0\nfor i in range(n):\n if(mn>a[i]): mn = a[i]\n elif got==a[i]-mn: ans += 1\n elif got<a[i]-mn:\n got = a[i]-mn\n ans = 1\nprint(ans)",
"n, k, *a = map(int, open(0).read().split())",
"n",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"k",
"*a",
"a",
"mn = 1e18",
"mn",
"1e18",
"ans, got = 1, 0",
"ans",
"1",
"got",
"0",
"for i in range(n):\n if(mn>a[i]): mn = a[i]\n elif got==a[i]-mn: ans += 1\n elif got<a[i]-mn:\n got = a[i]-mn\n ans = 1",
"i",
"range(n)",
"range",
"n",
"if(mn>a[i]): mn = a[i]\n elif got==a[i]-mn: ans += 1\n elif got<a[i]-mn:\n got = a[i]-mn\n ans = 1",
"mn>a[i]",
"mn",
"a[i]",
"a",
"i",
"elif got==a[i]-mn: ans += 1\n ",
"got==a[i]-mn",
"got",
"a[i]-mn",
"a[i]",
"a",
"i",
"mn",
"elif got<a[i]-mn:\n got = a[i]-mn\n ans = 1",
"got<a[i]-mn",
"got",
"a[i]-mn",
"a[i]",
"a",
"i",
"mn",
"got = a[i]-mn",
"got",
"a[i]-mn",
"a[i]",
"a",
"i",
"mn",
"ans = 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans, got = 1, 0",
"1",
"ans",
"mn = 1e18",
"1e18",
"mn",
"ans = 1",
"1",
"ans",
"n, k, *a = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"n",
"got = 1, 0",
"0",
"got",
"got = a[i]-mn",
"a[i]-mn",
"got",
"k, *a = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"k"
] |
n, k, *a = map(int, open(0).read().split())
mn = 1e18
ans, got = 1, 0
for i in range(n):
if(mn>a[i]): mn = a[i]
elif got==a[i]-mn: ans += 1
elif got<a[i]-mn:
got = a[i]-mn
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,
41,
28,
13,
4,
13,
13,
4,
18,
13,
13,
0,
13,
13,
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,
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,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
134,
2
],
[
134,
11
],
[
122,
13
],
[
27,
26
],
[
135,
29
],
[
123,
32
],
[
26,
33
],
[
110,
35
],
[
39,
38
],
[
135,
42
],
[
50,
47
],
[
111,
48
],
[
38,
49
],
[
47,
52
],
[
111,
53
],
[
38,
54
],
[
111,
56
],
[
38,
58
],
[
116,
61
],
[
128,
64
],
[
68,
67
],
[
135,
70
],
[
117,
73
],
[
126,
73
],
[
47,
75
],
[
111,
76
],
[
67,
77
],
[
123,
79
],
[
67,
80
],
[
125,
82
],
[
47,
84
],
[
111,
85
],
[
67,
86
],
[
123,
88
],
[
67,
89
],
[
113,
91
],
[
117,
95
],
[
126,
95
],
[
47,
97
],
[
111,
98
],
[
67,
99
],
[
123,
101
],
[
67,
102
],
[
131,
104
],
[
132,
108
],
[
114,
108
],
[
129,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
134,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\nm = [a[i] for i in range(n)]\nfor i in range(n - 2, -1, -1):\n m[i] = max(m[i], m[i + 1])\nd = 0\nans = 0\nfor i in range(n):\n if d < m[i] - a[i]:\n d = m[i] - a[i]\n ans = 1\n elif d == m[i] - a[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",
"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[i] for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"a[i]",
"a",
"i",
"m = [a[i] for i in range(n)]",
"m",
"[a[i] for i in range(n)]",
"for i in range(n - 2, -1, -1):\n m[i] = max(m[i], m[i + 1])",
"i",
"range(n - 2, -1, -1)",
"range",
"n - 2",
"n",
"2",
"-1",
"-1",
"m[i] = max(m[i], m[i + 1])",
"m[i]",
"m",
"i",
"max(m[i], m[i + 1])",
"max",
"m[i]",
"m",
"i",
"m[i + 1]",
"m",
"i + 1",
"i",
"1",
"d = 0",
"d",
"0",
"ans = 0",
"ans",
"0",
"for i in range(n):\n if d < m[i] - a[i]:\n d = m[i] - a[i]\n ans = 1\n elif d == m[i] - a[i]:\n ans += 1",
"i",
"range(n)",
"range",
"n",
"if d < m[i] - a[i]:\n d = m[i] - a[i]\n ans = 1\n elif d == m[i] - a[i]:\n ans += 1",
"d < m[i] - a[i]",
"d",
"m[i] - a[i]",
"m[i]",
"m",
"i",
"a[i]",
"a",
"i",
"d = m[i] - a[i]",
"d",
"m[i] - a[i]",
"m[i]",
"m",
"i",
"a[i]",
"a",
"i",
"ans = 1",
"ans",
"1",
"elif d == m[i] - a[i]:\n ans += 1",
"d == m[i] - a[i]",
"d",
"m[i] - a[i]",
"m[i]",
"m",
"i",
"a[i]",
"a",
"i",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"m = [a[i] for i in range(n)]",
"[a[i] for i in range(n)]",
"m",
"ans = 1",
"1",
"ans",
"d = 0",
"0",
"d",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"d = m[i] - a[i]",
"m[i] - a[i]",
"d",
"ans = 0",
"0",
"ans",
"ans += 1",
"1",
"ans",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
m = [a[i] for i in range(n)]
for i in range(n - 2, -1, -1):
m[i] = max(m[i], m[i + 1])
d = 0
ans = 0
for i in range(n):
if d < m[i] - a[i]:
d = m[i] - a[i]
ans = 1
elif d == m[i] - a[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,
2,
17,
17,
17,
0,
13,
17,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
0,
13,
4,
13,
18,
13,
2,
13,
17,
13,
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,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
2,
13
] |
[
[
101,
2
],
[
101,
11
],
[
98,
13
],
[
116,
25
],
[
107,
32
],
[
110,
35
],
[
117,
36
],
[
86,
38
],
[
42,
41
],
[
99,
47
],
[
89,
49
],
[
99,
53
],
[
41,
55
],
[
111,
57
],
[
90,
57
],
[
119,
59
],
[
99,
62
],
[
41,
63
],
[
90,
64
],
[
111,
64
],
[
120,
67
],
[
108,
68
],
[
114,
68
],
[
113,
70
],
[
120,
71
],
[
92,
73
],
[
120,
77
],
[
108,
78
],
[
114,
78
],
[
104,
80
],
[
105,
84
],
[
93,
84
],
[
87,
84
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
101,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
117,
110
],
[
110,
111
],
[
120,
113
],
[
113,
114
],
[
116,
117
],
[
119,
120
]
] |
[
"# ans = 売る可能性がある場所の数 = 売って利益が最大値になる可能性がある場所\n# Tは関係ない\n\nN,T=map(int,input().split())\nA=list(map(int,input().split()))\n\n# 売る場所を一つず右にずらす\n# それより前の場所の最安値を持っておく\n# 差分のmaxvalを満たす回数をカウント、maxvalが更新されたら回数は1に戻す\n\nINF=10**9+1\nmaxval=0\nminval=INF\nans=0\nfor i in range(1,len(A)):\n minval=min(A[i-1],minval)\n diff=A[i]-minval\n if diff>maxval:\n maxval=diff\n ans=1\n elif diff==maxval:\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",
"INF=10**9+1",
"INF",
"10**9+1",
"10**9",
"10",
"9",
"1",
"maxval=0",
"maxval",
"0",
"minval=INF",
"minval",
"INF",
"ans=0",
"ans",
"0",
"for i in range(1,len(A)):\n minval=min(A[i-1],minval)\n diff=A[i]-minval\n if diff>maxval:\n maxval=diff\n ans=1\n elif diff==maxval:\n ans+=1",
"i",
"range(1,len(A))",
"range",
"1",
"len(A)",
"len",
"A",
"minval=min(A[i-1],minval)",
"minval",
"min(A[i-1],minval)",
"min",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"minval",
"diff=A[i]-minval",
"diff",
"A[i]-minval",
"A[i]",
"A",
"i",
"minval",
"if diff>maxval:\n maxval=diff\n ans=1\n elif diff==maxval:\n ans+=1",
"diff>maxval",
"diff",
"maxval",
"maxval=diff",
"maxval",
"diff",
"ans=1",
"ans",
"1",
"elif diff==maxval:\n ans+=1",
"diff==maxval",
"diff",
"maxval",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans=0",
"0",
"ans",
"minval=min(A[i-1],minval)",
"min(A[i-1],minval)",
"minval",
"ans=1",
"1",
"ans",
"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",
"ans+=1",
"1",
"ans",
"maxval=0",
"0",
"maxval",
"minval=INF",
"INF",
"minval",
"maxval=diff",
"diff",
"maxval",
"INF=10**9+1",
"10**9+1",
"INF",
"diff=A[i]-minval",
"A[i]-minval",
"diff"
] |
# ans = 売る可能性がある場所の数 = 売って利益が最大値になる可能性がある場所
# Tは関係ない
N,T=map(int,input().split())
A=list(map(int,input().split()))
# 売る場所を一つず右にずらす
# それより前の場所の最安値を持っておく
# 差分のmaxvalを満たす回数をカウント、maxvalが更新されたら回数は1に戻す
INF=10**9+1
maxval=0
minval=INF
ans=0
for i in range(1,len(A)):
minval=min(A[i-1],minval)
diff=A[i]-minval
if diff>maxval:
maxval=diff
ans=1
elif diff==maxval:
ans+=1
print(ans)
|
[
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,
39,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
18,
13,
39,
17,
0,
13,
2,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13
] |
[
[
4,
3
],
[
3,
12
],
[
105,
14
],
[
105,
16
],
[
20,
19
],
[
19,
28
],
[
90,
30
],
[
108,
33
],
[
114,
36
],
[
91,
38
],
[
93,
41
],
[
45,
44
],
[
91,
46
],
[
117,
50
],
[
44,
52
],
[
115,
53
],
[
88,
53
],
[
111,
55
],
[
118,
58
],
[
94,
59
],
[
112,
59
],
[
87,
61
],
[
44,
64
],
[
115,
65
],
[
88,
65
],
[
109,
68
],
[
118,
70
],
[
102,
72
],
[
109,
75
],
[
96,
77
],
[
109,
80
],
[
103,
82
],
[
97,
85
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
105,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
]
] |
[
"n, t = [int(i) for i in input().split()]\nA = [int(i) for i in input().split()]\n\nmax_list = []\ntmp = A[0]\nmax_tmp = -1011100011\nfor num in A[1:]:\n\tdiff = num - tmp\n\tmax_tmp = max(diff, max_tmp)\n\ttmp = min(num, tmp)\n\tmax_list.append(diff)\n\nmax_val = max(max_list)\nc = max_list.count(max_val)\nprint(c)",
"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",
"n, t = [int(i) for i in input().split()]",
"n",
"[int(i) for i in 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()]",
"max_list = []",
"max_list",
"[]",
"tmp = A[0]",
"tmp",
"A[0]",
"A",
"0",
"max_tmp = -1011100011",
"max_tmp",
"-1011100011",
"for num in A[1:]:\n\tdiff = num - tmp\n\tmax_tmp = max(diff, max_tmp)\n\ttmp = min(num, tmp)\n\tmax_list.append(diff)",
"num",
"A[1:]",
"A",
"1:",
"1",
"diff = num - tmp",
"diff",
"num - tmp",
"num",
"tmp",
"max_tmp = max(diff, max_tmp)",
"max_tmp",
"max(diff, max_tmp)",
"max",
"diff",
"max_tmp",
"tmp = min(num, tmp)",
"tmp",
"min(num, tmp)",
"min",
"num",
"tmp",
"max_list.append(diff)",
"max_list.append",
"max_list",
"append",
"diff",
"max_val = max(max_list)",
"max_val",
"max(max_list)",
"max",
"max_list",
"c = max_list.count(max_val)",
"c",
"max_list.count(max_val)",
"max_list.count",
"max_list",
"count",
"max_val",
"print(c)",
"print",
"c",
"tmp = min(num, tmp)",
"min(num, tmp)",
"tmp",
"A = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"A",
"max_tmp = -1011100011",
"-1011100011",
"max_tmp",
"c = max_list.count(max_val)",
"max_list.count(max_val)",
"c",
"n, t = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"n",
"max_val = max(max_list)",
"max(max_list)",
"max_val",
"t = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"t",
"max_list = []",
"[]",
"max_list",
"max_tmp = max(diff, max_tmp)",
"max(diff, max_tmp)",
"max_tmp",
"tmp = A[0]",
"A[0]",
"tmp",
"diff = num - tmp",
"num - tmp",
"diff"
] |
n, t = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
max_list = []
tmp = A[0]
max_tmp = -1011100011
for num in A[1:]:
diff = num - tmp
max_tmp = max(diff, max_tmp)
tmp = min(num, tmp)
max_list.append(diff)
max_val = max(max_list)
c = max_list.count(max_val)
print(c)
|
[
7,
15,
13,
13,
15,
15,
15,
15,
15,
15,
15,
15,
15,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
12,
13,
23,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
15,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
13,
0,
13,
39,
28,
13,
13,
4,
18,
13,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
13,
13,
10,
13,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
39,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13
] |
[
[
26,
25
],
[
108,
31
],
[
35,
35
],
[
137,
44
],
[
101,
49
],
[
122,
57
],
[
108,
59
],
[
122,
60
],
[
98,
62
],
[
105,
64
],
[
110,
66
],
[
138,
67
],
[
128,
69
],
[
73,
72
],
[
99,
72
],
[
129,
76
],
[
72,
79
],
[
111,
80
],
[
114,
80
],
[
72,
83
],
[
111,
84
],
[
114,
84
],
[
113,
86
],
[
72,
87
],
[
129,
92
],
[
129,
96
],
[
98,
99
],
[
101,
102
],
[
138,
110
],
[
110,
111
],
[
72,
113
],
[
113,
114
],
[
122,
120
],
[
122,
123
],
[
128,
129
],
[
137,
138
]
] |
[
"import sys, re\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd\nfrom itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase, ascii_uppercase, digits\nfrom bisect import bisect, bisect_left, insort, insort_left\nfrom heapq import heappush, heappop\nfrom functools import reduce, lru_cache\ndef input(): return sys.stdin.readline().strip()\ndef INT(): return int(input())\ndef MAP(): return map(int, input().split())\ndef LIST(): return list(map(int, input().split()))\ndef TUPLE(): return tuple(map(int, input().split()))\ndef ZIP(n): return zip(*(MAP() for _ in range(n)))\nsys.setrecursionlimit(10 ** 9)\nINF = float('inf')\nmod = 10 ** 9 + 7 \n#mod = 998244353\nfrom decimal import *\n#import numpy as np\n#decimal.getcontext().prec = 10\n\nN, T = MAP()\nA = LIST()\n\nmin_ = INF\nB = []\nfor i in A:\n\tB.append(i-min_)\n\tif i < min_:\n\t\tmin_ = i\n\nprint(B.count(max(B)))",
"import sys, re",
"sys",
"re",
"from collections import deque, defaultdict, Counter",
"from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd",
"from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby",
"from operator import itemgetter, mul",
"from copy import deepcopy",
"from string import ascii_lowercase, ascii_uppercase, digits",
"from bisect import bisect, bisect_left, insort, insort_left",
"from heapq import heappush, heappop",
"from functools import reduce, lru_cache",
"def input(): return sys.stdin.readline().strip()",
"input",
"def INT(): return int(input())",
"INT",
"def MAP(): return map(int, input().split())",
"MAP",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"def TUPLE(): return tuple(map(int, input().split()))",
"TUPLE",
"MAP() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"MAP()",
"MAP",
"def ZIP(n): return zip(*(MAP() for _ in range(n)))",
"ZIP",
"n",
"n",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"INF = float('inf')",
"INF",
"float('inf')",
"float",
"'inf'",
"mod = 10 ** 9 + 7",
"mod",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"from decimal import *",
"N, T = MAP()",
"N",
"MAP()",
"MAP",
"T",
"A = LIST()",
"A",
"LIST()",
"LIST",
"min_ = INF",
"min_",
"INF",
"B = []",
"B",
"[]",
"for i in A:\n\tB.append(i-min_)\n\tif i < min_:\n\t\tmin_ = i",
"i",
"A",
"B.append(i-min_)",
"B.append",
"B",
"append",
"i-min_",
"i",
"min_",
"if i < min_:\n\t\tmin_ = i",
"i < min_",
"i",
"min_",
"min_ = i",
"min_",
"i",
"print(B.count(max(B)))",
"print",
"B.count(max(B))",
"B.count",
"B",
"count",
"max(B)",
"max",
"B",
"A = LIST()",
"LIST()",
"A",
"mod = 10 ** 9 + 7",
"10 ** 9 + 7",
"mod",
"def LIST(): return list(map(int, input().split()))",
"def LIST(): return list(map(int, input().split()))",
"LIST",
"def MAP(): return map(int, input().split())",
"def MAP(): return map(int, input().split())",
"MAP",
"min_ = INF",
"INF",
"min_",
"min_ = i",
"i",
"min_",
"def INT(): return int(input())",
"def INT(): return int(input())",
"INT",
"T = MAP()",
"MAP()",
"T",
"N, T = MAP()",
"MAP()",
"N",
"def input(): return sys.stdin.readline().strip()",
"def input(): return sys.stdin.readline().strip()",
"input",
"B = []",
"[]",
"B",
"def TUPLE(): return tuple(map(int, input().split()))",
"def TUPLE(): return tuple(map(int, input().split()))",
"TUPLE",
"def ZIP(n): return zip(*(MAP() for _ in range(n)))",
"def ZIP(n): return zip(*(MAP() for _ in range(n)))",
"ZIP",
"INF = float('inf')",
"float('inf')",
"INF"
] |
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10
N, T = MAP()
A = LIST()
min_ = INF
B = []
for i in A:
B.append(i-min_)
if i < min_:
min_ = i
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,
17,
0,
13,
17,
0,
13,
2,
2,
17,
17,
17,
28,
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,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13
] |
[
[
99,
2
],
[
99,
11
],
[
72,
13
],
[
90,
25
],
[
75,
28
],
[
96,
31
],
[
39,
38
],
[
73,
38
],
[
93,
41
],
[
97,
44
],
[
94,
44
],
[
38,
45
],
[
84,
47
],
[
38,
49
],
[
94,
50
],
[
97,
50
],
[
85,
53
],
[
76,
54
],
[
88,
54
],
[
78,
56
],
[
87,
59
],
[
85,
60
],
[
85,
63
],
[
76,
64
],
[
88,
64
],
[
102,
66
],
[
103,
70
],
[
79,
70
],
[
91,
70
],
[
72,
73
],
[
75,
76
],
[
78,
79
],
[
99,
82
],
[
84,
85
],
[
85,
87
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
]
] |
[
"n, t = map(int, input().split())\nA = tuple(map(int, input().split()))\ncount = 0\nmaxdiff = 0\nmina = 10**9+1\nfor a in A:\n mina = min(mina, a)\n diff = a - mina\n if diff > maxdiff:\n count = 1\n maxdiff = diff\n elif diff == maxdiff:\n count += 1\nprint(count)",
"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",
"count = 0",
"count",
"0",
"maxdiff = 0",
"maxdiff",
"0",
"mina = 10**9+1",
"mina",
"10**9+1",
"10**9",
"10",
"9",
"1",
"for a in A:\n mina = min(mina, a)\n diff = a - mina\n if diff > maxdiff:\n count = 1\n maxdiff = diff\n elif diff == maxdiff:\n count += 1",
"a",
"A",
"mina = min(mina, a)",
"mina",
"min(mina, a)",
"min",
"mina",
"a",
"diff = a - mina",
"diff",
"a - mina",
"a",
"mina",
"if diff > maxdiff:\n count = 1\n maxdiff = diff\n elif diff == maxdiff:\n count += 1",
"diff > maxdiff",
"diff",
"maxdiff",
"count = 1",
"count",
"1",
"maxdiff = diff",
"maxdiff",
"diff",
"elif diff == maxdiff:\n count += 1",
"diff == maxdiff",
"diff",
"maxdiff",
"count += 1",
"count",
"1",
"print(count)",
"print",
"count",
"A = tuple(map(int, input().split()))",
"tuple(map(int, input().split()))",
"A",
"maxdiff = 0",
"0",
"maxdiff",
"count = 1",
"1",
"count",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"diff = a - mina",
"a - mina",
"diff",
"maxdiff = diff",
"diff",
"maxdiff",
"count = 0",
"0",
"count",
"mina = min(mina, a)",
"min(mina, a)",
"mina",
"mina = 10**9+1",
"10**9+1",
"mina",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"count += 1",
"1",
"count"
] |
n, t = map(int, input().split())
A = tuple(map(int, input().split()))
count = 0
maxdiff = 0
mina = 10**9+1
for a in A:
mina = min(mina, a)
diff = a - mina
if diff > maxdiff:
count = 1
maxdiff = diff
elif diff == maxdiff:
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,
17,
0,
13,
2,
17,
17,
0,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
2,
13,
13,
13,
0,
18,
13,
13,
17,
0,
13,
17,
28,
13,
13,
0,
18,
13,
13,
17,
14,
4,
18,
13,
13,
2,
13,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
102,
2
],
[
102,
11
],
[
87,
13
],
[
84,
25
],
[
99,
28
],
[
90,
33
],
[
37,
36
],
[
88,
36
],
[
96,
39
],
[
100,
42
],
[
97,
42
],
[
36,
43
],
[
111,
45
],
[
36,
49
],
[
97,
50
],
[
100,
50
],
[
91,
51
],
[
112,
51
],
[
56,
53
],
[
85,
54
],
[
36,
55
],
[
108,
58
],
[
62,
61
],
[
88,
61
],
[
67,
64
],
[
85,
65
],
[
61,
66
],
[
85,
71
],
[
61,
74
],
[
112,
75
],
[
91,
75
],
[
105,
78
],
[
106,
82
],
[
109,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
],
[
102,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\ndictA = {}\nminA = 10**13\nmaxD = 0\nfor ai in A:\n minA = min(minA, ai)\n maxD = max(ai-minA, maxD)\n dictA[ai] = True\nans = 0\nfor ai in A:\n dictA[ai] = False\n if dictA.get(ai + maxD, False):\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",
"dictA = {}",
"dictA",
"{}",
"minA = 10**13",
"minA",
"10**13",
"10",
"13",
"maxD = 0",
"maxD",
"0",
"for ai in A:\n minA = min(minA, ai)\n maxD = max(ai-minA, maxD)\n dictA[ai] = True",
"ai",
"A",
"minA = min(minA, ai)",
"minA",
"min(minA, ai)",
"min",
"minA",
"ai",
"maxD = max(ai-minA, maxD)",
"maxD",
"max(ai-minA, maxD)",
"max",
"ai-minA",
"ai",
"minA",
"maxD",
"dictA[ai] = True",
"dictA[ai]",
"dictA",
"ai",
"True",
"ans = 0",
"ans",
"0",
"for ai in A:\n dictA[ai] = False\n if dictA.get(ai + maxD, False):\n ans += 1",
"ai",
"A",
"dictA[ai] = False",
"dictA[ai]",
"dictA",
"ai",
"False",
"if dictA.get(ai + maxD, False):\n ans += 1",
"dictA.get(ai + maxD, False)",
"dictA.get",
"dictA",
"get",
"ai + maxD",
"ai",
"maxD",
"False",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"dictA = {}",
"{}",
"dictA",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"maxD = 0",
"0",
"maxD",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"minA = min(minA, ai)",
"min(minA, ai)",
"minA",
"minA = 10**13",
"10**13",
"minA",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"ans += 1",
"1",
"ans",
"ans = 0",
"0",
"ans",
"maxD = max(ai-minA, maxD)",
"max(ai-minA, maxD)",
"maxD"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
dictA = {}
minA = 10**13
maxD = 0
for ai in A:
minA = min(minA, ai)
maxD = max(ai-minA, maxD)
dictA[ai] = True
ans = 0
for ai in A:
dictA[ai] = False
if dictA.get(ai + maxD, False):
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,
2,
39,
13,
13,
28,
13,
4,
13,
13,
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,
14,
2,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13
] |
[
[
114,
2
],
[
114,
11
],
[
102,
13
],
[
117,
25
],
[
123,
30
],
[
115,
34
],
[
37,
36
],
[
115,
39
],
[
44,
41
],
[
124,
42
],
[
36,
43
],
[
124,
47
],
[
36,
49
],
[
103,
52
],
[
36,
53
],
[
105,
55
],
[
59,
58
],
[
115,
61
],
[
108,
63
],
[
106,
66
],
[
109,
66
],
[
103,
69
],
[
58,
70
],
[
41,
71
],
[
124,
72
],
[
58,
73
],
[
120,
75
],
[
79,
78
],
[
115,
81
],
[
109,
84
],
[
106,
84
],
[
103,
87
],
[
78,
88
],
[
41,
89
],
[
124,
90
],
[
78,
91
],
[
111,
93
],
[
112,
97
],
[
121,
97
],
[
114,
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()))\n\nINF = 10**10\nL_min = [INF] * N\nfor i in range(N):\n L_min[i] = min(L_min[i-1], A[i])\n#print(L_min)\n\nP_max = -1\nfor i in range(N):\n P_max = max(P_max, A[i] - L_min[i])\n#print(P_max)\n\nanswer = 0\nfor i in range(N):\n if P_max == A[i] - L_min[i]:\n answer += 1\nprint(answer)",
"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 = 10**10",
"INF",
"10**10",
"10",
"10",
"L_min = [INF] * N",
"L_min",
"[INF] * N",
"[INF]",
"INF",
"N",
"for i in range(N):\n L_min[i] = min(L_min[i-1], A[i])\n#print(L_min)",
"i",
"range(N)",
"range",
"N",
"L_min[i] = min(L_min[i-1], A[i])",
"L_min[i]",
"L_min",
"i",
"min(L_min[i-1], A[i])",
"min",
"L_min[i-1]",
"L_min",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"P_max = -1",
"P_max",
"-1",
"for i in range(N):\n P_max = max(P_max, A[i] - L_min[i])\n#print(P_max)",
"i",
"range(N)",
"range",
"N",
"P_max = max(P_max, A[i] - L_min[i])",
"P_max",
"max(P_max, A[i] - L_min[i])",
"max",
"P_max",
"A[i] - L_min[i]",
"A[i]",
"A",
"i",
"L_min[i]",
"L_min",
"i",
"answer = 0",
"answer",
"0",
"for i in range(N):\n if P_max == A[i] - L_min[i]:\n answer += 1",
"i",
"range(N)",
"range",
"N",
"if P_max == A[i] - L_min[i]:\n answer += 1",
"P_max == A[i] - L_min[i]",
"P_max",
"A[i] - L_min[i]",
"A[i]",
"A",
"i",
"L_min[i]",
"L_min",
"i",
"answer += 1",
"answer",
"1",
"print(answer)",
"print",
"answer",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"P_max = -1",
"-1",
"P_max",
"P_max = max(P_max, A[i] - L_min[i])",
"max(P_max, A[i] - L_min[i])",
"P_max",
"answer += 1",
"1",
"answer",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"INF = 10**10",
"10**10",
"INF",
"answer = 0",
"0",
"answer",
"L_min = [INF] * N",
"[INF] * N",
"L_min"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
INF = 10**10
L_min = [INF] * N
for i in range(N):
L_min[i] = min(L_min[i-1], A[i])
#print(L_min)
P_max = -1
for i in range(N):
P_max = max(P_max, A[i] - L_min[i])
#print(P_max)
answer = 0
for i in range(N):
if P_max == A[i] - L_min[i]:
answer += 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,
2,
13,
17,
28,
13,
13,
4,
13,
18,
13,
39,
17,
0,
13,
17,
0,
18,
13,
40,
13,
4,
13,
18,
13,
2,
40,
13,
17,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
13,
13,
0,
13,
2,
18,
13,
2,
13,
17,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
2,
13,
10,
17,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] |
[
[
121,
2
],
[
121,
11
],
[
127,
13
],
[
109,
25
],
[
122,
30
],
[
128,
38
],
[
43,
42
],
[
49,
45
],
[
110,
46
],
[
110,
52
],
[
118,
59
],
[
124,
62
],
[
128,
69
],
[
100,
71
],
[
110,
74
],
[
119,
81
],
[
107,
81
],
[
101,
82
],
[
106,
84
],
[
101,
85
],
[
112,
87
],
[
107,
91
],
[
119,
91
],
[
101,
92
],
[
103,
94
],
[
104,
98
],
[
113,
98
],
[
125,
98
],
[
100,
101
],
[
103,
104
],
[
101,
106
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
121,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\nmx = [0] * (N + 1)\nfor i, a in enumerate(A[::-1], start=1):\n mx[-i] = max(mx[-i + 1], a)\n\nmxD = 0\nans = 0\nfor i, a in enumerate(A):\n d = mx[i + 1] - a\n if mxD < d:\n mxD = d\n ans = 0\n if mxD == d:\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",
"mx = [0] * (N + 1)",
"mx",
"[0] * (N + 1)",
"[0]",
"0",
"N + 1",
"N",
"1",
"for i, a in enumerate(A[::-1], start=1):\n mx[-i] = max(mx[-i + 1], a)",
"i",
"a",
"enumerate(A[::-1], start=1)",
"enumerate",
"A[::-1]",
"A",
"::-1",
"-1",
"start=1",
"start",
"1",
"mx[-i] = max(mx[-i + 1], a)",
"mx[-i]",
"mx",
"-i",
"i",
"max(mx[-i + 1], a)",
"max",
"mx[-i + 1]",
"mx",
"-i + 1",
"-i",
"i",
"1",
"a",
"mxD = 0",
"mxD",
"0",
"ans = 0",
"ans",
"0",
"for i, a in enumerate(A):\n d = mx[i + 1] - a\n if mxD < d:\n mxD = d\n ans = 0\n if mxD == d:\n ans += 1",
"i",
"a",
"enumerate(A)",
"enumerate",
"A",
"d = mx[i + 1] - a",
"d",
"mx[i + 1] - a",
"mx[i + 1]",
"mx",
"i + 1",
"i",
"1",
"a",
"if mxD < d:\n mxD = d\n ans = 0\n ",
"mxD < d",
"mxD",
"d",
"mxD = d",
"mxD",
"d",
"ans = 0",
"ans",
"0",
"if mxD == d:\n ans += 1",
"mxD == d",
"mxD",
"d",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"d = mx[i + 1] - a",
"mx[i + 1] - a",
"d",
"ans += 1",
"1",
"ans",
"mxD = d",
"d",
"mxD",
"mx = [0] * (N + 1)",
"[0] * (N + 1)",
"mx",
"ans = 0",
"0",
"ans",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"mxD = 0",
"0",
"mxD",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"ans = 0",
"0",
"ans",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
mx = [0] * (N + 1)
for i, a in enumerate(A[::-1], start=1):
mx[-i] = max(mx[-i + 1], a)
mxD = 0
ans = 0
for i, a in enumerate(A):
d = mx[i + 1] - a
if mxD < d:
mxD = d
ans = 0
if mxD == d:
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,
17,
17,
28,
13,
13,
0,
13,
2,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
14,
40,
13,
13,
0,
13,
13,
0,
13,
4,
13,
4,
18,
13,
13,
4,
13,
18,
13,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13
] |
[
[
90,
2
],
[
90,
11
],
[
87,
13
],
[
96,
25
],
[
78,
28
],
[
34,
33
],
[
88,
33
],
[
81,
36
],
[
33,
38
],
[
79,
39
],
[
94,
39
],
[
82,
42
],
[
97,
43
],
[
48,
45
],
[
97,
46
],
[
82,
47
],
[
53,
50
],
[
97,
51
],
[
82,
52
],
[
33,
56
],
[
79,
57
],
[
94,
57
],
[
93,
59
],
[
33,
60
],
[
84,
62
],
[
97,
67
],
[
97,
72
],
[
85,
73
],
[
90,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
],
[
33,
93
],
[
93,
94
],
[
96,
97
]
] |
[
"n, t = map(int, input().split())\nA = list(map(int, input().split()))\nd = {}\nmin_ = 10**18\nfor a in A:\n p = a-min_\n if p not in d:\n d[p] = 1\n else:\n d[p] += 1\n if a <= min_:\n min_ = a\nM = max(d.keys())\nprint(d[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",
"d = {}",
"d",
"{}",
"min_ = 10**18",
"min_",
"10**18",
"10",
"18",
"for a in A:\n p = a-min_\n if p not in d:\n d[p] = 1\n else:\n d[p] += 1\n if a <= min_:\n min_ = a",
"a",
"A",
"p = a-min_",
"p",
"a-min_",
"a",
"min_",
"if p not in d:\n d[p] = 1\n else:\n d[p] += 1\n ",
"p not in d",
"p",
"d",
"d[p] = 1",
"d[p]",
"d",
"p",
"1",
"d[p] += 1",
"d[p]",
"d",
"p",
"1",
"if a <= min_:\n min_ = a",
"a <= min_",
"a",
"min_",
"min_ = a",
"min_",
"a",
"M = max(d.keys())",
"M",
"max(d.keys())",
"max",
"d.keys()",
"d.keys",
"d",
"keys",
"print(d[M])",
"print",
"d[M]",
"d",
"M",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"min_ = 10**18",
"10**18",
"min_",
"p = a-min_",
"a-min_",
"p",
"M = max(d.keys())",
"max(d.keys())",
"M",
"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",
"min_",
"d = {}",
"{}",
"d"
] |
n, t = map(int, input().split())
A = list(map(int, input().split()))
d = {}
min_ = 10**18
for a in A:
p = a-min_
if p not in d:
d[p] = 1
else:
d[p] += 1
if a <= min_:
min_ = a
M = max(d.keys())
print(d[M])
|
[
7,
15,
13,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
13,
4,
18,
13,
13,
4,
13,
17,
2,
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,
18,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
18,
13,
39,
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,
17,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
18,
13
] |
[
[
114,
4
],
[
120,
26
],
[
115,
33
],
[
120,
35
],
[
123,
37
],
[
115,
46
],
[
129,
49
],
[
124,
51
],
[
105,
54
],
[
99,
57
],
[
61,
60
],
[
124,
62
],
[
130,
67
],
[
127,
67
],
[
60,
68
],
[
126,
70
],
[
60,
71
],
[
106,
74
],
[
109,
74
],
[
60,
76
],
[
130,
77
],
[
127,
77
],
[
108,
79
],
[
60,
81
],
[
130,
82
],
[
127,
82
],
[
102,
84
],
[
106,
88
],
[
109,
88
],
[
60,
90
],
[
130,
91
],
[
127,
91
],
[
111,
93
],
[
112,
97
],
[
103,
97
],
[
100,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
120,
118
],
[
120,
121
],
[
123,
124
],
[
60,
126
],
[
126,
127
],
[
129,
130
]
] |
[
"# ABC047D\n\nimport sys\ninput = lambda : sys.stdin.readline().rstrip()\nsys.setrecursionlimit(max(1000, 10**9))\n\n\nn,t = map(int, input().split())\na = list(map(int, input().split()))\n\nm = a[0]\nbest = 0\ncount = 0\nfor num in a[1:]:\n if m>num:\n m = num\n elif best<num-m:\n best = num - m\n count = 1\n elif best==num-m:\n count += 1\nprint(count)",
"import sys",
"sys",
"input = lambda : sys.stdin.readline().rstrip()",
"input",
"lambda : sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"sys.setrecursionlimit(max(1000, 10**9))",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"max(1000, 10**9)",
"max",
"1000",
"10**9",
"10",
"9",
"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",
"best = 0",
"best",
"0",
"count = 0",
"count",
"0",
"for num in a[1:]:\n if m>num:\n m = num\n elif best<num-m:\n best = num - m\n count = 1\n elif best==num-m:\n count += 1",
"num",
"a[1:]",
"a",
"1:",
"1",
"if m>num:\n m = num\n elif best<num-m:\n best = num - m\n count = 1\n elif best==num-m:\n count += 1",
"m>num",
"m",
"num",
"m = num",
"m",
"num",
"elif best<num-m:\n best = num - m\n count = 1\n ",
"best<num-m",
"best",
"num-m",
"num",
"m",
"best = num - m",
"best",
"num - m",
"num",
"m",
"count = 1",
"count",
"1",
"elif best==num-m:\n count += 1",
"best==num-m",
"best",
"num-m",
"num",
"m",
"count += 1",
"count",
"1",
"print(count)",
"print",
"count",
"count = 0",
"0",
"count",
"count = 1",
"1",
"count",
"best = 0",
"0",
"best",
"best = num - m",
"num - m",
"best",
"count += 1",
"1",
"count",
"input = lambda : sys.stdin.readline().rstrip()",
"lambda : sys.stdin.readline().rstrip()",
"input",
"n,t = map(int, input().split())",
"map(int, input().split())",
"n",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"m = num",
"num",
"m",
"m = a[0]",
"a[0]",
"m"
] |
# ABC047D
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
n,t = map(int, input().split())
a = list(map(int, input().split()))
m = a[0]
best = 0
count = 0
for num in a[1:]:
if m>num:
m = num
elif best<num-m:
best = num - m
count = 1
elif best==num-m:
count += 1
print(count)
|
[
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,
13,
17,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
97,
2
],
[
97,
11
],
[
15,
14
],
[
14,
23
],
[
82,
25
],
[
88,
28
],
[
70,
30
],
[
94,
32
],
[
36,
35
],
[
83,
35
],
[
35,
39
],
[
71,
40
],
[
92,
40
],
[
91,
42
],
[
35,
43
],
[
76,
45
],
[
35,
47
],
[
71,
48
],
[
92,
48
],
[
77,
51
],
[
95,
52
],
[
80,
52
],
[
100,
54
],
[
77,
58
],
[
95,
59
],
[
80,
59
],
[
79,
61
],
[
77,
62
],
[
73,
64
],
[
74,
68
],
[
101,
68
],
[
89,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
77,
79
],
[
79,
80
],
[
82,
83
],
[
97,
86
],
[
88,
89
],
[
35,
91
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
]
] |
[
"N, T = map(int, input().split())\nA = [int(x) for x in input().split()]\ncost, buy, mprofit = 1, 10e9, 0\nfor a in A:\n if a < buy:\n buy = a\n else:\n profit = a - buy\n if profit == mprofit:\n cost += 1\n if profit > mprofit:\n mprofit = profit\n cost = 1\nprint(cost)",
"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()]",
"cost, buy, mprofit = 1, 10e9, 0",
"cost",
"1",
"buy",
"10e9",
"mprofit",
"0",
"for a in A:\n if a < buy:\n buy = a\n else:\n profit = a - buy\n if profit == mprofit:\n cost += 1\n if profit > mprofit:\n mprofit = profit\n cost = 1",
"a",
"A",
"if a < buy:\n buy = a\n else:\n profit = a - buy\n if profit == mprofit:\n cost += 1\n if profit > mprofit:\n mprofit = profit\n cost = 1",
"a < buy",
"a",
"buy",
"buy = a",
"buy",
"a",
"profit = a - buy",
"profit",
"a - buy",
"a",
"buy",
"if profit == mprofit:\n cost += 1\n ",
"profit == mprofit",
"profit",
"mprofit",
"cost += 1",
"cost",
"1",
"if profit > mprofit:\n mprofit = profit\n cost = 1",
"profit > mprofit",
"profit",
"mprofit",
"mprofit = profit",
"mprofit",
"profit",
"cost = 1",
"cost",
"1",
"print(cost)",
"print",
"cost",
"buy, mprofit = 1, 10e9, 0",
"10e9",
"buy",
"cost = 1",
"1",
"cost",
"profit = a - buy",
"a - buy",
"profit",
"mprofit = profit",
"profit",
"mprofit",
"A = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"A",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"cost, buy, mprofit = 1, 10e9, 0",
"1",
"cost",
"buy = a",
"a",
"buy",
"mprofit = 1, 10e9, 0",
"0",
"mprofit",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"cost += 1",
"1",
"cost"
] |
N, T = map(int, input().split())
A = [int(x) for x in input().split()]
cost, buy, mprofit = 1, 10e9, 0
for a in A:
if a < buy:
buy = a
else:
profit = a - buy
if profit == mprofit:
cost += 1
if profit > mprofit:
mprofit = profit
cost = 1
print(cost)
|
[
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,
4,
18,
2,
13,
17,
13,
0,
13,
2,
39,
4,
13,
17,
2,
17,
13,
12,
13,
0,
13,
2,
13,
17,
0,
18,
13,
13,
13,
42,
40,
13,
17,
0,
13,
2,
2,
13,
17,
17,
0,
18,
13,
13,
4,
13,
18,
13,
2,
2,
17,
13,
17,
18,
13,
2,
2,
17,
13,
17,
23,
13,
23,
13,
12,
13,
0,
13,
2,
13,
13,
0,
13,
2,
13,
13,
0,
13,
4,
13,
17,
42,
2,
13,
13,
14,
2,
13,
17,
0,
13,
17,
0,
13,
4,
13,
13,
18,
13,
2,
13,
17,
14,
2,
13,
17,
0,
13,
4,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
29,
13,
23,
13,
23,
13,
28,
13,
4,
13,
4,
13,
13,
4,
13,
13,
40,
18,
13,
13,
15,
0,
13,
4,
13,
13,
28,
13,
4,
13,
17,
13,
0,
13,
2,
40,
18,
13,
2,
13,
17,
4,
13,
13,
13,
14,
2,
13,
17,
0,
18,
13,
13,
17,
4,
13,
18,
13,
18,
4,
13,
4,
18,
13,
13,
17,
10,
2,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13
] |
[
[
237,
2
],
[
237,
11
],
[
231,
13
],
[
234,
25
],
[
229,
31
],
[
219,
35
],
[
235,
43
],
[
48,
47
],
[
235,
49
],
[
55,
52
],
[
220,
53
],
[
47,
54
],
[
88,
54
],
[
90,
55
],
[
47,
58
],
[
88,
58
],
[
61,
58
],
[
62,
61
],
[
47,
64
],
[
88,
64
],
[
61,
64
],
[
71,
68
],
[
220,
69
],
[
61,
70
],
[
47,
70
],
[
88,
70
],
[
220,
74
],
[
61,
78
],
[
47,
78
],
[
88,
78
],
[
220,
81
],
[
61,
85
],
[
47,
85
],
[
88,
85
],
[
88,
88
],
[
90,
90
],
[
95,
94
],
[
155,
96
],
[
235,
97
],
[
100,
99
],
[
157,
101
],
[
235,
102
],
[
105,
104
],
[
94,
110
],
[
147,
110
],
[
144,
110
],
[
99,
111
],
[
150,
111
],
[
117,
111
],
[
99,
114
],
[
150,
114
],
[
117,
114
],
[
118,
117
],
[
121,
120
],
[
104,
123
],
[
134,
123
],
[
120,
123
],
[
220,
125
],
[
117,
127
],
[
99,
127
],
[
150,
127
],
[
94,
131
],
[
147,
131
],
[
144,
131
],
[
135,
134
],
[
120,
137
],
[
104,
137
],
[
134,
137
],
[
220,
139
],
[
94,
141
],
[
147,
141
],
[
144,
141
],
[
145,
144
],
[
148,
147
],
[
151,
150
],
[
134,
153
],
[
120,
153
],
[
104,
153
],
[
155,
155
],
[
157,
157
],
[
160,
159
],
[
232,
164
],
[
241,
166
],
[
159,
167
],
[
232,
170
],
[
159,
171
],
[
243,
174
],
[
180,
179
],
[
229,
183
],
[
225,
185
],
[
232,
189
],
[
179,
191
],
[
223,
194
],
[
179,
195
],
[
229,
196
],
[
226,
199
],
[
205,
202
],
[
244,
203
],
[
226,
204
],
[
244,
209
],
[
244,
215
],
[
219,
220
],
[
225,
226
],
[
237,
229
],
[
231,
232
],
[
234,
235
],
[
237,
238
],
[
243,
244
]
] |
[
"N, T = map(int, input().split())\na = list(map(int, input().split()))\n\n# 準備\nN0 = 2 ** (N - 1).bit_length()\ndata = [float('inf')] * (2 * N0)\n\n# a_k の値を x に更新\ndef update(k, x):\n k += N0 - 1\n data[k] = x\n while k >= 0:\n k = (k - 1) // 2\n data[k] = min(data[2 * k + 1], data[2 * k + 2])\n\n# [a_l, a_(l+1), ..., a_(r-1)]の最小値を求める\ndef query(l, r):\n L = l + N0\n R = r + N0\n s = float('inf')\n while L < R:\n if R & 1:\n R -= 1\n s = min(s, data[R - 1])\n\n if L & 1:\n s = min(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\n# まずupdate()を使ってa_kの値を更新\nfor i in range(len(a)):\n update(i, -a[i])\n\nfrom collections import defaultdict\ndic = defaultdict(int)\nfor L in range(1, N):\n d = -a[L - 1] - query(L, N)\n if d > 0:\n dic[d] += 1\n\nprint(dic[sorted(dic.keys())[-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",
"N0 = 2 ** (N - 1).bit_length()",
"N0",
"2 ** (N - 1).bit_length()",
"2",
"(N - 1).bit_length()",
"N - 1).bit_length",
"N - 1",
"N",
"1",
"bit_length",
"data = [float('inf')] * (2 * N0)",
"data",
"[float('inf')] * (2 * N0)",
"[float('inf')]",
"float('inf')",
"float",
"'inf'",
"2 * N0",
"2",
"N0",
"def update(k, x):\n k += N0 - 1\n data[k] = x\n while k >= 0:\n k = (k - 1) // 2\n data[k] = min(data[2 * k + 1], data[2 * k + 2])\n\n# [a_l, a_(l+1), ..., a_(r-1)]の最小値を求める",
"update",
"k += N0 - 1",
"k",
"N0 - 1",
"N0",
"1",
"data[k] = x",
"data[k]",
"data",
"k",
"x",
"while k >= 0:\n k = (k - 1) // 2\n data[k] = min(data[2 * k + 1], data[2 * k + 2])\n\n# [a_l, a_(l+1), ..., a_(r-1)]の最小値を求める",
"k >= 0",
"k",
"0",
"k = (k - 1) // 2",
"k",
"(k - 1) // 2",
"k - 1",
"k",
"1",
"2",
"data[k] = min(data[2 * k + 1], data[2 * k + 2])",
"data[k]",
"data",
"k",
"min(data[2 * k + 1], data[2 * k + 2])",
"min",
"data[2 * k + 1]",
"data",
"2 * k + 1",
"2 * k",
"2",
"k",
"1",
"data[2 * k + 2]",
"data",
"2 * k + 2",
"2 * k",
"2",
"k",
"2",
"k",
"k",
"x",
"x",
"def query(l, r):\n L = l + N0\n R = r + N0\n s = float('inf')\n while L < R:\n if R & 1:\n R -= 1\n s = min(s, data[R - 1])\n\n if L & 1:\n s = min(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\n# まずupdate()を使ってa_kの値を更新",
"query",
"L = l + N0",
"L",
"l + N0",
"l",
"N0",
"R = r + N0",
"R",
"r + N0",
"r",
"N0",
"s = float('inf')",
"s",
"float('inf')",
"float",
"'inf'",
"while L < R:\n if R & 1:\n R -= 1\n s = min(s, data[R - 1])\n\n if L & 1:\n s = min(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n ",
"L < R",
"L",
"R",
"if R & 1:\n R -= 1\n s = min(s, data[R - 1])\n\n ",
"R & 1",
"R",
"1",
"R -= 1",
"R",
"1",
"s = min(s, data[R - 1])",
"s",
"min(s, data[R - 1])",
"min",
"s",
"data[R - 1]",
"data",
"R - 1",
"R",
"1",
"if L & 1:\n s = min(s, data[L - 1])\n L += 1\n ",
"L & 1",
"L",
"1",
"s = min(s, data[L - 1])",
"s",
"min(s, data[L - 1])",
"min",
"s",
"data[L - 1]",
"data",
"L - 1",
"L",
"1",
"L += 1",
"L",
"1",
"L >>= 1",
"L",
"1",
"R >>= 1",
"R",
"1",
"return s",
"s",
"l",
"l",
"r",
"r",
"for i in range(len(a)):\n update(i, -a[i])",
"i",
"range(len(a))",
"range",
"len(a)",
"len",
"a",
"update(i, -a[i])",
"update",
"i",
"-a[i]",
"a[i]",
"a",
"i",
"from collections import defaultdict",
"dic = defaultdict(int)",
"dic",
"defaultdict(int)",
"defaultdict",
"int",
"for L in range(1, N):\n d = -a[L - 1] - query(L, N)\n if d > 0:\n dic[d] += 1",
"L",
"range(1, N)",
"range",
"1",
"N",
"d = -a[L - 1] - query(L, N)",
"d",
"-a[L - 1] - query(L, N)",
"-a[L - 1]",
"a[L - 1]",
"a",
"L - 1",
"L",
"1",
"query(L, N)",
"query",
"L",
"N",
"if d > 0:\n dic[d] += 1",
"d > 0",
"d",
"0",
"dic[d] += 1",
"dic[d]",
"dic",
"d",
"1",
"print(dic[sorted(dic.keys())[-1]])",
"print",
"dic[sorted(dic.keys())[-1]]",
"dic",
"sorted(dic.keys())[-1]",
"(dic.keys())",
"sorted",
"dic.keys()",
"dic.keys",
"dic",
"keys",
"-1",
"data = [float('inf')] * (2 * N0)",
"[float('inf')] * (2 * N0)",
"data",
"def query(l, r):\n L = l + N0\n R = r + N0\n s = float('inf')\n while L < R:\n if R & 1:\n R -= 1\n s = min(s, data[R - 1])\n\n if L & 1:\n s = min(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\n# まずupdate()を使ってa_kの値を更新",
"def query(l, r):\n L = l + N0\n R = r + N0\n s = float('inf')\n while L < R:\n if R & 1:\n R -= 1\n s = min(s, data[R - 1])\n\n if L & 1:\n s = min(s, data[L - 1])\n L += 1\n L >>= 1\n R >>= 1\n return s\n\n\n# まずupdate()を使ってa_kの値を更新",
"query",
"d = -a[L - 1] - query(L, N)",
"-a[L - 1] - query(L, N)",
"d",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"N0 = 2 ** (N - 1).bit_length()",
"2 ** (N - 1).bit_length()",
"N0",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"def update(k, x):\n k += N0 - 1\n data[k] = x\n while k >= 0:\n k = (k - 1) // 2\n data[k] = min(data[2 * k + 1], data[2 * k + 2])\n\n# [a_l, a_(l+1), ..., a_(r-1)]の最小値を求める",
"def update(k, x):\n k += N0 - 1\n data[k] = x\n while k >= 0:\n k = (k - 1) // 2\n data[k] = min(data[2 * k + 1], data[2 * k + 2])\n\n# [a_l, a_(l+1), ..., a_(r-1)]の最小値を求める",
"update",
"dic = defaultdict(int)",
"defaultdict(int)",
"dic"
] |
N, T = map(int, input().split())
a = list(map(int, input().split()))
# 準備
N0 = 2 ** (N - 1).bit_length()
data = [float('inf')] * (2 * N0)
# a_k の値を x に更新
def update(k, x):
k += N0 - 1
data[k] = x
while k >= 0:
k = (k - 1) // 2
data[k] = min(data[2 * k + 1], data[2 * k + 2])
# [a_l, a_(l+1), ..., a_(r-1)]の最小値を求める
def query(l, r):
L = l + N0
R = r + N0
s = float('inf')
while L < R:
if R & 1:
R -= 1
s = min(s, data[R - 1])
if L & 1:
s = min(s, data[L - 1])
L += 1
L >>= 1
R >>= 1
return s
# まずupdate()を使ってa_kの値を更新
for i in range(len(a)):
update(i, -a[i])
from collections import defaultdict
dic = defaultdict(int)
for L in range(1, N):
d = -a[L - 1] - query(L, N)
if d > 0:
dic[d] += 1
print(dic[sorted(dic.keys())[-1]])
|
[
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,
0,
13,
2,
39,
17,
13,
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,
2,
13,
17,
18,
13,
13,
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,
39,
28,
13,
4,
13,
13,
4,
18,
13,
13,
39,
2,
18,
13,
13,
18,
13,
13,
18,
13,
13,
0,
13,
17,
4,
18,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
18,
13,
13,
17,
18,
18,
13,
2,
13,
17,
17,
14,
40,
18,
18,
13,
13,
17,
18,
18,
13,
2,
13,
17,
17,
0,
13,
17,
3,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] |
[
[
184,
2
],
[
184,
11
],
[
187,
13
],
[
190,
25
],
[
185,
29
],
[
34,
31
],
[
191,
32
],
[
188,
35
],
[
193,
38
],
[
185,
42
],
[
49,
44
],
[
194,
45
],
[
185,
47
],
[
188,
50
],
[
185,
52
],
[
56,
55
],
[
185,
59
],
[
64,
61
],
[
191,
62
],
[
55,
63
],
[
191,
67
],
[
55,
69
],
[
188,
72
],
[
55,
73
],
[
76,
75
],
[
185,
79
],
[
87,
84
],
[
194,
85
],
[
75,
86
],
[
194,
90
],
[
75,
92
],
[
188,
95
],
[
75,
96
],
[
178,
98
],
[
102,
101
],
[
185,
104
],
[
179,
107
],
[
84,
111
],
[
194,
112
],
[
101,
113
],
[
61,
114
],
[
191,
115
],
[
101,
116
],
[
191,
118
],
[
101,
119
],
[
181,
121
],
[
179,
125
],
[
129,
128
],
[
132,
131
],
[
185,
135
],
[
179,
140
],
[
131,
141
],
[
179,
145
],
[
131,
147
],
[
179,
154
],
[
131,
155
],
[
179,
159
],
[
131,
161
],
[
175,
165
],
[
176,
170
],
[
182,
170
],
[
184,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\nlist1=[0]*n\nlist1[0]=a[0]\nlist2=[0]*n\nlist2[n-1]=a[n-1]\nfor i in range(1,n):\n list1[i]=min(list1[i-1],a[i])\nfor i in range(n-2,-1,-1):\n list2[i]=max(list2[i+1],a[i])\nlst=[]\nfor i in range(n):\n lst.append([list2[i]-list1[i],list1[i]])\ncount=1\nlst.sort(reverse=True)\nfor i in range(1,n):\n if lst[i][0]==lst[i-1][0]:\n if lst[i][1]!=lst[i-1][1]:\n count+=1\n else:\n break\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",
"list1=[0]*n",
"list1",
"[0]*n",
"[0]",
"0",
"n",
"list1[0]=a[0]",
"list1[0]",
"list1",
"0",
"a[0]",
"a",
"0",
"list2=[0]*n",
"list2",
"[0]*n",
"[0]",
"0",
"n",
"list2[n-1]=a[n-1]",
"list2[n-1]",
"list2",
"n-1",
"n",
"1",
"a[n-1]",
"a",
"n-1",
"n",
"1",
"for i in range(1,n):\n list1[i]=min(list1[i-1],a[i])",
"i",
"range(1,n)",
"range",
"1",
"n",
"list1[i]=min(list1[i-1],a[i])",
"list1[i]",
"list1",
"i",
"min(list1[i-1],a[i])",
"min",
"list1[i-1]",
"list1",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"for i in range(n-2,-1,-1):\n list2[i]=max(list2[i+1],a[i])",
"i",
"range(n-2,-1,-1)",
"range",
"n-2",
"n",
"2",
"-1",
"-1",
"list2[i]=max(list2[i+1],a[i])",
"list2[i]",
"list2",
"i",
"max(list2[i+1],a[i])",
"max",
"list2[i+1]",
"list2",
"i+1",
"i",
"1",
"a[i]",
"a",
"i",
"lst=[]",
"lst",
"[]",
"for i in range(n):\n lst.append([list2[i]-list1[i],list1[i]])",
"i",
"range(n)",
"range",
"n",
"lst.append([list2[i]-list1[i],list1[i]])",
"lst.append",
"lst",
"append",
"[list2[i]-list1[i],list1[i]]",
"list2[i]-list1[i]",
"list2[i]",
"list2",
"i",
"list1[i]",
"list1",
"i",
"list1[i]",
"list1",
"i",
"count=1",
"count",
"1",
"lst.sort(reverse=True)",
"lst.sort",
"lst",
"sort",
"reverse=True",
"reverse",
"True",
"for i in range(1,n):\n if lst[i][0]==lst[i-1][0]:\n if lst[i][1]!=lst[i-1][1]:\n count+=1\n else:\n break",
"i",
"range(1,n)",
"range",
"1",
"n",
"if lst[i][0]==lst[i-1][0]:\n if lst[i][1]!=lst[i-1][1]:\n count+=1\n else:\n break",
"lst[i][0]==lst[i-1][0]",
"lst[i][0]",
"[i]",
"lst",
"i",
"0",
"lst[i-1][0]",
"[i-1]",
"lst",
"i-1",
"i",
"1",
"0",
"if lst[i][1]!=lst[i-1][1]:\n count+=1\n ",
"lst[i][1]!=lst[i-1][1]",
"lst[i][1]",
"[i]",
"lst",
"i",
"1",
"lst[i-1][1]",
"[i-1]",
"lst",
"i-1",
"i",
"1",
"1",
"count+=1",
"count",
"1",
"break",
"print(count)",
"print",
"count",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"count+=1",
"1",
"count",
"lst=[]",
"[]",
"lst",
"count=1",
"1",
"count",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"list1=[0]*n",
"[0]*n",
"list1",
"list2=[0]*n",
"[0]*n",
"list2"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
list1=[0]*n
list1[0]=a[0]
list2=[0]*n
list2[n-1]=a[n-1]
for i in range(1,n):
list1[i]=min(list1[i-1],a[i])
for i in range(n-2,-1,-1):
list2[i]=max(list2[i+1],a[i])
lst=[]
for i in range(n):
lst.append([list2[i]-list1[i],list1[i]])
count=1
lst.sort(reverse=True)
for i in range(1,n):
if lst[i][0]==lst[i-1][0]:
if lst[i][1]!=lst[i-1][1]:
count+=1
else:
break
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,
17,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
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,
18,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
93,
2
],
[
93,
11
],
[
78,
13
],
[
96,
25
],
[
72,
28
],
[
79,
30
],
[
90,
33
],
[
37,
36
],
[
79,
36
],
[
36,
40
],
[
73,
41
],
[
82,
41
],
[
81,
43
],
[
36,
44
],
[
36,
48
],
[
73,
49
],
[
82,
49
],
[
97,
50
],
[
76,
50
],
[
75,
52
],
[
36,
54
],
[
73,
55
],
[
82,
55
],
[
99,
57
],
[
36,
62
],
[
73,
63
],
[
82,
63
],
[
97,
64
],
[
76,
64
],
[
84,
66
],
[
85,
70
],
[
100,
70
],
[
91,
70
],
[
72,
73
],
[
75,
76
],
[
78,
79
],
[
36,
81
],
[
81,
82
],
[
84,
85
],
[
93,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
]
] |
[
"N,T=map(int,input().split())\nA=list(map(int,input().split()))\nt=0\nk=A[0]\nc=0\nfor i in A:\n if i<k:\n k=i\n elif i-k>t:\n t=i-k\n c=1\n elif i-k==t:\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",
"t=0",
"t",
"0",
"k=A[0]",
"k",
"A[0]",
"A",
"0",
"c=0",
"c",
"0",
"for i in A:\n if i<k:\n k=i\n elif i-k>t:\n t=i-k\n c=1\n elif i-k==t:\n c+=1",
"i",
"A",
"if i<k:\n k=i\n elif i-k>t:\n t=i-k\n c=1\n elif i-k==t:\n c+=1",
"i<k",
"i",
"k",
"k=i",
"k",
"i",
"elif i-k>t:\n t=i-k\n c=1\n ",
"i-k>t",
"i-k",
"i",
"k",
"t",
"t=i-k",
"t",
"i-k",
"i",
"k",
"c=1",
"c",
"1",
"elif i-k==t:\n c+=1",
"i-k==t",
"i-k",
"i",
"k",
"t",
"c+=1",
"c",
"1",
"print(c)",
"print",
"c",
"k=A[0]",
"A[0]",
"k",
"t=i-k",
"i-k",
"t",
"A=list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"k=i",
"i",
"k",
"c+=1",
"1",
"c",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"c=0",
"0",
"c",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"t=0",
"0",
"t",
"c=1",
"1",
"c"
] |
N,T=map(int,input().split())
A=list(map(int,input().split()))
t=0
k=A[0]
c=0
for i in A:
if i<k:
k=i
elif i-k>t:
t=i-k
c=1
elif i-k==t:
c+=1
print(c)
|
[
7,
12,
13,
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,
41,
28,
13,
4,
13,
13,
4,
17,
0,
13,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
16
],
[
19,
18
],
[
33,
32
],
[
4,
35
],
[
40,
39
],
[
43,
42
],
[
18,
44
],
[
48,
47
],
[
4,
50
],
[
53,
52
],
[
18,
54
],
[
47,
55
],
[
60,
57
],
[
39,
58
],
[
47,
59
],
[
52,
61
],
[
42,
62
],
[
64,
62
],
[
65,
64
],
[
52,
67
],
[
42,
68
],
[
64,
68
],
[
71,
70
],
[
39,
73
],
[
76,
75
],
[
79,
78
],
[
4,
81
],
[
57,
84
],
[
39,
85
],
[
78,
86
],
[
70,
87
],
[
90,
89
],
[
89,
93
],
[
75,
93
],
[
102,
99
]
] |
[
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n score_list = [0 for _ in range(N)]\n min_price = A[0]\n for i in range(N):\n a = A[i]\n score_list[i] = a - min_price\n min_price = min(a, min_price)\n max_score = max(score_list)\n ans = 0\n for i in range(N):\n if score_list[i] == max_score:\n ans += 1\n print(ans)\n\n\nif __name__ == '__main__':\n main()",
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n score_list = [0 for _ in range(N)]\n min_price = A[0]\n for i in range(N):\n a = A[i]\n score_list[i] = a - min_price\n min_price = min(a, min_price)\n max_score = max(score_list)\n ans = 0\n for i in range(N):\n if score_list[i] == max_score:\n ans += 1\n print(ans)",
"main",
"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",
"' '",
"0 for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"0",
"score_list = [0 for _ in range(N)]",
"score_list",
"[0 for _ in range(N)]",
"min_price = A[0]",
"min_price",
"A[0]",
"A",
"0",
"for i in range(N):\n a = A[i]\n score_list[i] = a - min_price\n min_price = min(a, min_price)\n ",
"i",
"range(N)",
"range",
"N",
"a = A[i]",
"a",
"A[i]",
"A",
"i",
"score_list[i] = a - min_price",
"score_list[i]",
"score_list",
"i",
"a - min_price",
"a",
"min_price",
"min_price = min(a, min_price)",
"min_price",
"min(a, min_price)",
"min",
"a",
"min_price",
"max_score = max(score_list)",
"max_score",
"max(score_list)",
"max",
"score_list",
"ans = 0",
"ans",
"0",
"for i in range(N):\n if score_list[i] == max_score:\n ans += 1\n ",
"i",
"range(N)",
"range",
"N",
"if score_list[i] == max_score:\n ans += 1\n ",
"score_list[i] == max_score",
"score_list[i]",
"score_list",
"i",
"max_score",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n score_list = [0 for _ in range(N)]\n min_price = A[0]\n for i in range(N):\n a = A[i]\n score_list[i] = a - min_price\n min_price = min(a, min_price)\n max_score = max(score_list)\n ans = 0\n for i in range(N):\n if score_list[i] == max_score:\n ans += 1\n print(ans)",
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n score_list = [0 for _ in range(N)]\n min_price = A[0]\n for i in range(N):\n a = A[i]\n score_list[i] = a - min_price\n min_price = min(a, min_price)\n max_score = max(score_list)\n ans = 0\n for i in range(N):\n if score_list[i] == max_score:\n ans += 1\n print(ans)",
"main"
] |
def main():
N, T = list(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))
score_list = [0 for _ in range(N)]
min_price = A[0]
for i in range(N):
a = A[i]
score_list[i] = a - min_price
min_price = min(a, min_price)
max_score = max(score_list)
ans = 0
for i in range(N):
if score_list[i] == max_score:
ans += 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,
2,
39,
17,
13,
0,
18,
13,
17,
18,
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,
41,
28,
13,
4,
13,
2,
13,
17,
4,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
13,
0,
13,
4,
18,
13,
13,
4,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13
] |
[
[
97,
2
],
[
97,
11
],
[
106,
13
],
[
109,
25
],
[
95,
29
],
[
34,
31
],
[
110,
32
],
[
107,
35
],
[
39,
38
],
[
95,
42
],
[
50,
47
],
[
110,
48
],
[
38,
49
],
[
107,
53
],
[
38,
54
],
[
110,
56
],
[
38,
58
],
[
63,
62
],
[
95,
66
],
[
110,
71
],
[
62,
73
],
[
107,
76
],
[
62,
77
],
[
103,
79
],
[
100,
82
],
[
104,
85
],
[
104,
89
],
[
101,
92
],
[
97,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
]
] |
[
"n, t = map(int, input().split())\nA = list(map(int, input().split()))\nB = [-1]*n\nB[-1] = A[-1]\nfor i in range(n-2, 0, -1):\n B[i] = max(A[i], B[i+1])\nL = [B[i+1]-A[i] for i in range(n-1)]\nans = L.count(max(L))\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",
"B = [-1]*n",
"B",
"[-1]*n",
"[-1]",
"-1",
"n",
"B[-1] = A[-1]",
"B[-1]",
"B",
"-1",
"A[-1]",
"A",
"-1",
"for i in range(n-2, 0, -1):\n B[i] = max(A[i], B[i+1])",
"i",
"range(n-2, 0, -1)",
"range",
"n-2",
"n",
"2",
"0",
"-1",
"B[i] = max(A[i], B[i+1])",
"B[i]",
"B",
"i",
"max(A[i], B[i+1])",
"max",
"A[i]",
"A",
"i",
"B[i+1]",
"B",
"i+1",
"i",
"1",
"B[i+1]-A[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)",
"B[i+1]-A[i]",
"B[i+1]",
"B",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"L = [B[i+1]-A[i] for i in range(n-1)]",
"L",
"[B[i+1]-A[i] for i in range(n-1)]",
"ans = L.count(max(L))",
"ans",
"L.count(max(L))",
"L.count",
"L",
"count",
"max(L)",
"max",
"L",
"print(ans)",
"print",
"ans",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"ans = L.count(max(L))",
"L.count(max(L))",
"ans",
"L = [B[i+1]-A[i] for i in range(n-1)]",
"[B[i+1]-A[i] for i in range(n-1)]",
"L",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"B = [-1]*n",
"[-1]*n",
"B"
] |
n, t = map(int, input().split())
A = list(map(int, input().split()))
B = [-1]*n
B[-1] = A[-1]
for i in range(n-2, 0, -1):
B[i] = max(A[i], B[i+1])
L = [B[i+1]-A[i] for i in range(n-1)]
ans = L.count(max(L))
print(ans)
|
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
13,
4,
18,
13,
13,
4,
18,
4,
13,
13,
0,
13,
18,
13,
13,
0,
13,
2,
13,
4,
18,
18,
13,
13,
13,
13,
4,
13,
4,
18,
2,
13,
4,
13,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
61,
4
],
[
61,
13
],
[
55,
15
],
[
27,
26
],
[
52,
31
],
[
56,
33
],
[
56,
40
],
[
53,
46
],
[
53,
49
],
[
52,
53
],
[
55,
56
],
[
61,
59
],
[
61,
62
]
] |
[
"import numpy as np\nN,T = map(int,input().split())\nA=np.array(input().split(),dtype=np.int32)\ns=A-np.minimum.accumulate(A)\nprint((s==max(s)).sum())",
"import numpy as np",
"numpy",
"N,T = map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"A=np.array(input().split(),dtype=np.int32)",
"A",
"np.array(input().split(),dtype=np.int32)",
"np.array",
"np",
"array",
"input().split()",
"().split",
"()",
"input",
"split",
"dtype=np.int32",
"dtype",
"np.int32",
"np",
"int32",
"s=A-np.minimum.accumulate(A)",
"s",
"A-np.minimum.accumulate(A)",
"A",
"np.minimum.accumulate(A)",
"np.minimum.accumulate",
"np.minimum",
"np",
"minimum",
"accumulate",
"A",
"print((s==max(s)).sum())",
"print",
"(s==max(s)).sum()",
"s==max(s)).sum",
"s==max(s)",
"s",
"max(s)",
"max",
"s",
"sum",
"s=A-np.minimum.accumulate(A)",
"A-np.minimum.accumulate(A)",
"s",
"A=np.array(input().split(),dtype=np.int32)",
"np.array(input().split(),dtype=np.int32)",
"A",
"N,T = map(int,input().split())",
"map(int,input().split())",
"N",
"T = map(int,input().split())",
"map(int,input().split())",
"T"
] |
import numpy as np
N,T = map(int,input().split())
A=np.array(input().split(),dtype=np.int32)
s=A-np.minimum.accumulate(A)
print((s==max(s)).sum())
|
[
7,
15,
13,
12,
13,
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,
39,
0,
13,
17,
0,
13,
40,
4,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
4,
13,
13,
17,
17,
17,
0,
13,
18,
13,
13,
4,
18,
13,
13,
13,
40,
13,
0,
18,
13,
13,
40,
18,
13,
17,
28,
13,
4,
13,
4,
13,
13,
0,
13,
18,
13,
13,
0,
13,
2,
18,
13,
13,
18,
13,
13,
14,
2,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
29,
13,
14,
2,
13,
17,
0,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
12,
13
] |
[
[
7,
6
],
[
7,
17
],
[
20,
19
],
[
32,
31
],
[
35,
34
],
[
38,
37
],
[
44,
43
],
[
47,
46
],
[
19,
52
],
[
58,
57
],
[
19,
59
],
[
46,
60
],
[
31,
65
],
[
57,
67
],
[
72,
69
],
[
34,
70
],
[
46,
71
],
[
31,
74
],
[
78,
77
],
[
19,
82
],
[
85,
84
],
[
19,
86
],
[
77,
87
],
[
90,
89
],
[
69,
91
],
[
34,
92
],
[
77,
93
],
[
19,
95
],
[
77,
96
],
[
89,
99
],
[
37,
103
],
[
106,
103
],
[
89,
104
],
[
107,
106
],
[
89,
107
],
[
110,
109
],
[
37,
113
],
[
106,
113
],
[
89,
114
],
[
117,
116
],
[
116,
119
],
[
109,
119
],
[
43,
119
],
[
132,
125
],
[
136,
127
],
[
133,
130
],
[
132,
133
]
] |
[
"import heapq\n\ndef solve():\n N, T = tuple(map(int, input().split()))\n AS = tuple(map(int, input().split()))\n\n # print(N, T)\n # print(AS)\n\n lis = []\n D = {}\n\n m = -float('inf')\n c = 0\n for i in range(len(AS) - 1, -1, -1):\n x = AS[i]\n heapq.heappush(lis, -x)\n D[i] = -lis[0]\n\n for i in range(len(AS)):\n x = AS[i]\n\n d = D[i] - AS[i]\n if d > 0:\n if m < d:\n m = d\n c = 1\n elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n return c\n\n\nif __name__ == '__main__':\n res = solve()\n print(res)",
"import heapq",
"heapq",
"def solve():\n N, T = tuple(map(int, input().split()))\n AS = tuple(map(int, input().split()))\n\n # print(N, T)\n # print(AS)\n\n lis = []\n D = {}\n\n m = -float('inf')\n c = 0\n for i in range(len(AS) - 1, -1, -1):\n x = AS[i]\n heapq.heappush(lis, -x)\n D[i] = -lis[0]\n\n for i in range(len(AS)):\n x = AS[i]\n\n d = D[i] - AS[i]\n if d > 0:\n if m < d:\n m = d\n c = 1\n elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n return c",
"solve",
"N, T = tuple(map(int, input().split()))",
"N",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"AS = tuple(map(int, input().split()))",
"AS",
"tuple(map(int, input().split()))",
"tuple",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"lis = []",
"lis",
"[]",
"D = {}",
"D",
"{}",
"m = -float('inf')",
"m",
"-float('inf')",
"float('inf')",
"float",
"'inf'",
"c = 0",
"c",
"0",
"for i in range(len(AS) - 1, -1, -1):\n x = AS[i]\n heapq.heappush(lis, -x)\n D[i] = -lis[0]\n\n ",
"i",
"range(len(AS) - 1, -1, -1)",
"range",
"len(AS) - 1",
"len(AS)",
"len",
"AS",
"1",
"-1",
"-1",
"x = AS[i]",
"x",
"AS[i]",
"AS",
"i",
"heapq.heappush(lis, -x)",
"heapq.heappush",
"heapq",
"heappush",
"lis",
"-x",
"x",
"D[i] = -lis[0]",
"D[i]",
"D",
"i",
"-lis[0]",
"lis[0]",
"lis",
"0",
"for i in range(len(AS)):\n x = AS[i]\n\n d = D[i] - AS[i]\n if d > 0:\n if m < d:\n m = d\n c = 1\n elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n ",
"i",
"range(len(AS))",
"range",
"len(AS)",
"len",
"AS",
"x = AS[i]",
"x",
"AS[i]",
"AS",
"i",
"d = D[i] - AS[i]",
"d",
"D[i] - AS[i]",
"D[i]",
"D",
"i",
"AS[i]",
"AS",
"i",
"if d > 0:\n if m < d:\n m = d\n c = 1\n elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n ",
"d > 0",
"d",
"0",
"if m < d:\n m = d\n c = 1\n elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n ",
"m < d",
"m",
"d",
"m = d",
"m",
"d",
"c = 1",
"c",
"1",
"elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n ",
"m == d",
"m",
"d",
"c += 1",
"c",
"1",
"return c",
"c",
"if __name__ == '__main__':\n res = solve()\n print(res)",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"res = solve()",
"res",
"solve()",
"solve",
"print(res)",
"print",
"res",
"res = solve()",
"solve()",
"res",
"def solve():\n N, T = tuple(map(int, input().split()))\n AS = tuple(map(int, input().split()))\n\n # print(N, T)\n # print(AS)\n\n lis = []\n D = {}\n\n m = -float('inf')\n c = 0\n for i in range(len(AS) - 1, -1, -1):\n x = AS[i]\n heapq.heappush(lis, -x)\n D[i] = -lis[0]\n\n for i in range(len(AS)):\n x = AS[i]\n\n d = D[i] - AS[i]\n if d > 0:\n if m < d:\n m = d\n c = 1\n elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n return c",
"def solve():\n N, T = tuple(map(int, input().split()))\n AS = tuple(map(int, input().split()))\n\n # print(N, T)\n # print(AS)\n\n lis = []\n D = {}\n\n m = -float('inf')\n c = 0\n for i in range(len(AS) - 1, -1, -1):\n x = AS[i]\n heapq.heappush(lis, -x)\n D[i] = -lis[0]\n\n for i in range(len(AS)):\n x = AS[i]\n\n d = D[i] - AS[i]\n if d > 0:\n if m < d:\n m = d\n c = 1\n elif m == d: # max と同じ値なら counter を ++\n c += 1\n\n return c",
"solve"
] |
import heapq
def solve():
N, T = tuple(map(int, input().split()))
AS = tuple(map(int, input().split()))
# print(N, T)
# print(AS)
lis = []
D = {}
m = -float('inf')
c = 0
for i in range(len(AS) - 1, -1, -1):
x = AS[i]
heapq.heappush(lis, -x)
D[i] = -lis[0]
for i in range(len(AS)):
x = AS[i]
d = D[i] - AS[i]
if d > 0:
if m < d:
m = d
c = 1
elif m == d: # max と同じ値なら counter を ++
c += 1
return c
if __name__ == '__main__':
res = solve()
print(res)
|
[
7,
15,
13,
0,
13,
4,
13,
13,
4,
18,
4,
18,
18,
13,
13,
13,
13,
13,
31,
13,
12,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
17,
0,
13,
18,
42,
17,
0,
13,
17,
14,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
3,
0,
13,
18,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
0,
13,
13,
0,
13,
13,
0,
13,
17,
29,
13,
14,
2,
13,
17,
0,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13
] |
[
[
136,
4
],
[
136,
17
],
[
136,
18
],
[
24,
23
],
[
27,
26
],
[
30,
29
],
[
33,
32
],
[
41,
35
],
[
41,
40
],
[
46,
45
],
[
45,
49
],
[
23,
49
],
[
137,
50
],
[
29,
53
],
[
114,
53
],
[
82,
53
],
[
32,
54
],
[
102,
54
],
[
63,
54
],
[
57,
56
],
[
29,
60
],
[
114,
60
],
[
82,
60
],
[
32,
61
],
[
102,
61
],
[
63,
61
],
[
64,
63
],
[
29,
64
],
[
114,
64
],
[
82,
64
],
[
67,
66
],
[
71,
70
],
[
45,
73
],
[
23,
73
],
[
70,
76
],
[
40,
77
],
[
111,
77
],
[
79,
77
],
[
80,
79
],
[
70,
80
],
[
83,
82
],
[
79,
84
],
[
40,
84
],
[
111,
84
],
[
35,
85
],
[
108,
85
],
[
70,
88
],
[
35,
89
],
[
108,
89
],
[
29,
92
],
[
114,
92
],
[
82,
92
],
[
63,
93
],
[
32,
93
],
[
102,
93
],
[
96,
95
],
[
29,
99
],
[
114,
99
],
[
82,
99
],
[
63,
100
],
[
32,
100
],
[
102,
100
],
[
103,
102
],
[
29,
103
],
[
114,
103
],
[
82,
103
],
[
106,
105
],
[
112,
108
],
[
70,
109
],
[
112,
111
],
[
70,
112
],
[
115,
114
],
[
105,
117
],
[
95,
117
],
[
66,
117
],
[
56,
117
],
[
26,
117
],
[
130,
123
],
[
140,
125
],
[
131,
128
],
[
130,
131
],
[
136,
134
],
[
136,
137
]
] |
[
"import sys\n\nn, t, *a = map(int, sys.stdin.read().split())\n\ndef main():\n r = 0\n cnt = 0\n prof = 0\n max_prof = 0\n buy_price = sell_price = a[0]\n while True:\n r += 1\n if r == n:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n break\n\n cur = a[r]\n if cur > sell_price:\n sell_price = cur\n prof = sell_price - buy_price\n elif cur > buy_price:\n pass\n else:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n buy_price = sell_price = cur\n prof = 0\n\n return cnt\n\nif __name__ == '__main__':\n ans = main()\n print(ans)",
"import sys",
"sys",
"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 r = 0\n cnt = 0\n prof = 0\n max_prof = 0\n buy_price = sell_price = a[0]\n while True:\n r += 1\n if r == n:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n break\n\n cur = a[r]\n if cur > sell_price:\n sell_price = cur\n prof = sell_price - buy_price\n elif cur > buy_price:\n pass\n else:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n buy_price = sell_price = cur\n prof = 0\n\n return cnt",
"main",
"r = 0",
"r",
"0",
"cnt = 0",
"cnt",
"0",
"prof = 0",
"prof",
"0",
"max_prof = 0",
"max_prof",
"0",
"buy_price = sell_price = a[0]",
"buy_price",
"a[0]",
"a",
"0",
"= sell_price = a[0]",
"sell_price",
"a[0]",
"while True:\n r += 1\n if r == n:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n break\n\n cur = a[r]\n if cur > sell_price:\n sell_price = cur\n prof = sell_price - buy_price\n elif cur > buy_price:\n pass\n else:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n buy_price = sell_price = cur\n prof = 0\n\n ",
"True",
"r += 1",
"r",
"1",
"if r == n:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n break\n\n ",
"r == n",
"r",
"n",
"if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n ",
"prof == max_prof",
"prof",
"max_prof",
"cnt += 1",
"cnt",
"1",
"elif prof > max_prof:\n max_prof = prof\n cnt = 1\n ",
"prof > max_prof",
"prof",
"max_prof",
"max_prof = prof",
"max_prof",
"prof",
"cnt = 1",
"cnt",
"1",
"break",
"cur = a[r]",
"cur",
"a[r]",
"a",
"r",
"if cur > sell_price:\n sell_price = cur\n prof = sell_price - buy_price\n elif cur > buy_price:\n pass\n else:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n buy_price = sell_price = cur\n prof = 0\n\n ",
"cur > sell_price",
"cur",
"sell_price",
"sell_price = cur",
"sell_price",
"cur",
"prof = sell_price - buy_price",
"prof",
"sell_price - buy_price",
"sell_price",
"buy_price",
"elif cur > buy_price:\n pass\n ",
"cur > buy_price",
"cur",
"buy_price",
"if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n ",
"prof == max_prof",
"prof",
"max_prof",
"cnt += 1",
"cnt",
"1",
"elif prof > max_prof:\n max_prof = prof\n cnt = 1\n ",
"prof > max_prof",
"prof",
"max_prof",
"max_prof = prof",
"max_prof",
"prof",
"cnt = 1",
"cnt",
"1",
"buy_price = sell_price = cur",
"buy_price",
"cur",
"= sell_price = cur",
"sell_price",
"cur",
"prof = 0",
"prof",
"0",
"return cnt",
"cnt",
"if __name__ == '__main__':\n ans = main()\n print(ans)",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"ans = main()",
"ans",
"main()",
"main",
"print(ans)",
"print",
"ans",
"ans = main()",
"main()",
"ans",
"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",
"def main():\n r = 0\n cnt = 0\n prof = 0\n max_prof = 0\n buy_price = sell_price = a[0]\n while True:\n r += 1\n if r == n:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n break\n\n cur = a[r]\n if cur > sell_price:\n sell_price = cur\n prof = sell_price - buy_price\n elif cur > buy_price:\n pass\n else:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n buy_price = sell_price = cur\n prof = 0\n\n return cnt",
"def main():\n r = 0\n cnt = 0\n prof = 0\n max_prof = 0\n buy_price = sell_price = a[0]\n while True:\n r += 1\n if r == n:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n break\n\n cur = a[r]\n if cur > sell_price:\n sell_price = cur\n prof = sell_price - buy_price\n elif cur > buy_price:\n pass\n else:\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1\n buy_price = sell_price = cur\n prof = 0\n\n return cnt",
"main"
] |
import sys
n, t, *a = map(int, sys.stdin.read().split())
def main():
r = 0
cnt = 0
prof = 0
max_prof = 0
buy_price = sell_price = a[0]
while True:
r += 1
if r == n:
if prof == max_prof:
cnt += 1
elif prof > max_prof:
max_prof = prof
cnt = 1
break
cur = a[r]
if cur > sell_price:
sell_price = cur
prof = sell_price - buy_price
elif cur > buy_price:
pass
else:
if prof == max_prof:
cnt += 1
elif prof > max_prof:
max_prof = prof
cnt = 1
buy_price = sell_price = cur
prof = 0
return cnt
if __name__ == '__main__':
ans = main()
print(ans)
|
[
7,
0,
13,
4,
13,
13,
4,
18,
4,
13,
13,
13,
0,
31,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
18,
13,
17,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
13,
18,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13
] |
[
[
87,
2
],
[
87,
11
],
[
15,
13
],
[
90,
24
],
[
81,
29
],
[
33,
32
],
[
82,
40
],
[
32,
45
],
[
91,
46
],
[
79,
46
],
[
32,
51
],
[
91,
52
],
[
79,
52
],
[
78,
54
],
[
32,
57
],
[
82,
60
],
[
84,
63
],
[
82,
66
],
[
82,
69
],
[
85,
73
],
[
87,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
]
] |
[
"n, t = map(int, input().split())\n*a, = map(int, input().split())\npurchase = a[0]\nprofit = []\nfor i in range(len(a)):\n profit.append(a[i] - purchase)\n if a[i] < purchase:\n purchase = a[i]\nprofit.sort()\nAnswer = profit.count(profit[-1])\nprint(Answer)",
"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",
"purchase = a[0]",
"purchase",
"a[0]",
"a",
"0",
"profit = []",
"profit",
"[]",
"for i in range(len(a)):\n profit.append(a[i] - purchase)\n if a[i] < purchase:\n purchase = a[i]",
"i",
"range(len(a))",
"range",
"len(a)",
"len",
"a",
"profit.append(a[i] - purchase)",
"profit.append",
"profit",
"append",
"a[i] - purchase",
"a[i]",
"a",
"i",
"purchase",
"if a[i] < purchase:\n purchase = a[i]",
"a[i] < purchase",
"a[i]",
"a",
"i",
"purchase",
"purchase = a[i]",
"purchase",
"a[i]",
"a",
"i",
"profit.sort()",
"profit.sort",
"profit",
"sort",
"Answer = profit.count(profit[-1])",
"Answer",
"profit.count(profit[-1])",
"profit.count",
"profit",
"count",
"profit[-1]",
"profit",
"-1",
"print(Answer)",
"print",
"Answer",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"purchase = a[i]",
"a[i]",
"purchase",
"profit = []",
"[]",
"profit",
"Answer = profit.count(profit[-1])",
"profit.count(profit[-1])",
"Answer",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"purchase = a[0]",
"a[0]",
"purchase"
] |
n, t = map(int, input().split())
*a, = map(int, input().split())
purchase = a[0]
profit = []
for i in range(len(a)):
profit.append(a[i] - purchase)
if a[i] < purchase:
purchase = a[i]
profit.sort()
Answer = profit.count(profit[-1])
print(Answer)
|
[
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,
2,
2,
17,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
14,
2,
13,
13,
0,
13,
13,
9,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13
] |
[
[
95,
4
],
[
113,
11
],
[
96,
18
],
[
113,
20
],
[
98,
22
],
[
96,
31
],
[
101,
34
],
[
107,
41
],
[
104,
44
],
[
48,
47
],
[
99,
47
],
[
47,
51
],
[
102,
52
],
[
84,
52
],
[
83,
54
],
[
47,
55
],
[
86,
58
],
[
47,
60
],
[
84,
61
],
[
102,
61
],
[
87,
64
],
[
108,
65
],
[
111,
65
],
[
110,
67
],
[
87,
68
],
[
92,
70
],
[
87,
74
],
[
108,
75
],
[
111,
75
],
[
116,
77
],
[
117,
81
],
[
93,
81
],
[
105,
81
],
[
47,
83
],
[
83,
84
],
[
86,
87
],
[
113,
90
],
[
92,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
87,
110
],
[
110,
111
],
[
113,
114
],
[
116,
117
]
] |
[
"import sys\nreadline = sys.stdin.readline\n\n# そこまでの最小値を記録する\n# 最小値との差が最大になった時点で、その値を記録し、1を計上\n# 最小値との差がこれまでの最大値と同じ場合は+1を計上\n# 最小値との差の最大値が更新された場合はまた1から計上\n# Tは関係ない\n\nN,T = map(int,readline().split())\nA = list(map(int,readline().split()))\n\nminval = 10 ** 9 + 1 # そこまでの最小値\nmaxdiff = 0 # そこまでの差の最大値\nans = 0\nfor a in A:\n if a < minval:\n minval = a\n continue\n diff = a - minval\n if diff > maxdiff:\n maxdiff = diff\n ans = 1\n elif diff == maxdiff:\n ans += 1\n\nprint(ans)",
"import sys",
"sys",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"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",
"minval = 10 ** 9 + 1",
"minval",
"10 ** 9 + 1",
"10 ** 9",
"10",
"9",
"1",
"maxdiff = 0",
"maxdiff",
"0",
"ans = 0",
"ans",
"0",
"for a in A:\n if a < minval:\n minval = a\n continue\n diff = a - minval\n if diff > maxdiff:\n maxdiff = diff\n ans = 1\n elif diff == maxdiff:\n ans += 1",
"a",
"A",
"if a < minval:\n minval = a\n continue\n ",
"a < minval",
"a",
"minval",
"minval = a",
"minval",
"a",
"continue",
"diff = a - minval",
"diff",
"a - minval",
"a",
"minval",
"if diff > maxdiff:\n maxdiff = diff\n ans = 1\n elif diff == maxdiff:\n ans += 1",
"diff > maxdiff",
"diff",
"maxdiff",
"maxdiff = diff",
"maxdiff",
"diff",
"ans = 1",
"ans",
"1",
"elif diff == maxdiff:\n ans += 1",
"diff == maxdiff",
"diff",
"maxdiff",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"minval = a",
"a",
"minval",
"diff = a - minval",
"a - minval",
"diff",
"N,T = map(int,readline().split())",
"map(int,readline().split())",
"N",
"ans = 1",
"1",
"ans",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"A = list(map(int,readline().split()))",
"list(map(int,readline().split()))",
"A",
"minval = 10 ** 9 + 1",
"10 ** 9 + 1",
"minval",
"ans = 0",
"0",
"ans",
"maxdiff = 0",
"0",
"maxdiff",
"maxdiff = diff",
"diff",
"maxdiff",
"T = map(int,readline().split())",
"map(int,readline().split())",
"T",
"ans += 1",
"1",
"ans"
] |
import sys
readline = sys.stdin.readline
# そこまでの最小値を記録する
# 最小値との差が最大になった時点で、その値を記録し、1を計上
# 最小値との差がこれまでの最大値と同じ場合は+1を計上
# 最小値との差の最大値が更新された場合はまた1から計上
# Tは関係ない
N,T = map(int,readline().split())
A = list(map(int,readline().split()))
minval = 10 ** 9 + 1 # そこまでの最小値
maxdiff = 0 # そこまでの差の最大値
ans = 0
for a in A:
if a < minval:
minval = a
continue
diff = a - minval
if diff > maxdiff:
maxdiff = diff
ans = 1
elif diff == maxdiff:
ans += 1
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,
39,
17,
17,
0,
13,
18,
13,
2,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
2,
13,
18,
13,
2,
2,
13,
17,
13,
14,
2,
13,
18,
13,
17,
0,
13,
39,
13,
17,
14,
2,
13,
18,
13,
17,
0,
18,
13,
17,
17,
0,
13,
4,
13,
13,
18,
13,
2,
2,
13,
17,
13,
4,
13,
18,
13,
17,
10,
39,
13,
10,
18,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13
] |
[
[
111,
2
],
[
111,
11
],
[
15,
14
],
[
14,
23
],
[
114,
25
],
[
96,
28
],
[
99,
33
],
[
115,
35
],
[
109,
37
],
[
41,
40
],
[
109,
44
],
[
117,
46
],
[
100,
48
],
[
103,
48
],
[
115,
50
],
[
109,
53
],
[
40,
55
],
[
118,
58
],
[
97,
60
],
[
106,
60
],
[
105,
63
],
[
118,
69
],
[
97,
71
],
[
106,
71
],
[
77,
74
],
[
97,
75
],
[
106,
75
],
[
102,
79
],
[
100,
82
],
[
103,
82
],
[
115,
84
],
[
109,
87
],
[
40,
89
],
[
106,
93
],
[
97,
93
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
111,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
]
] |
[
"#import heapq\nn,t = map(int,input().split())\nai = [int(i) for i in input().split()]\n\n\n#rev_ai = [ai[n-1]*(-1)]\n\nans = [0,0]\n\nmax_ai = ai[n-1]\n\n#heapq.heapify(rev_ai)\n#print(rev_ai)\nfor i in range(1,n):\n #print(ai[n-1-i])\n dif = max_ai - ai[n-1-i]\n if dif > ans[0]:\n ans = [dif,1]\n elif dif == ans[0]:\n ans[1] += 1\n #print(rev_ai[0])\n #heapq.heappush(rev_ai,ai[n-1-i]*(-1))\n max_ai = max(max_ai,ai[n-1-i])\n\nprint(ans[1])",
"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",
"ai = [int(i) for i in input().split()]",
"ai",
"[int(i) for i in input().split()]",
"ans = [0,0]",
"ans",
"[0,0]",
"0",
"0",
"max_ai = ai[n-1]",
"max_ai",
"ai[n-1]",
"ai",
"n-1",
"n",
"1",
"for i in range(1,n):\n #print(ai[n-1-i])\n dif = max_ai - ai[n-1-i]\n if dif > ans[0]:\n ans = [dif,1]\n elif dif == ans[0]:\n ans[1] += 1\n #print(rev_ai[0])\n #heapq.heappush(rev_ai,ai[n-1-i]*(-1))\n max_ai = max(max_ai,ai[n-1-i])",
"i",
"range(1,n)",
"range",
"1",
"n",
"dif = max_ai - ai[n-1-i]",
"dif",
"max_ai - ai[n-1-i]",
"max_ai",
"ai[n-1-i]",
"ai",
"n-1-i",
"n-1",
"n",
"1",
"i",
"if dif > ans[0]:\n ans = [dif,1]\n elif dif == ans[0]:\n ans[1] += 1\n #print(rev_ai[0])\n #heapq.heappush(rev_ai,ai[n-1-i]*(-1))\n ",
"dif > ans[0]",
"dif",
"ans[0]",
"ans",
"0",
"ans = [dif,1]",
"ans",
"[dif,1]",
"dif",
"1",
"elif dif == ans[0]:\n ans[1] += 1\n #print(rev_ai[0])\n #heapq.heappush(rev_ai,ai[n-1-i]*(-1))\n ",
"dif == ans[0]",
"dif",
"ans[0]",
"ans",
"0",
"ans[1] += 1",
"ans[1]",
"ans",
"1",
"1",
"max_ai = max(max_ai,ai[n-1-i])",
"max_ai",
"max(max_ai,ai[n-1-i])",
"max",
"max_ai",
"ai[n-1-i]",
"ai",
"n-1-i",
"n-1",
"n",
"1",
"i",
"print(ans[1])",
"print",
"ans[1]",
"ans",
"1",
"ans = [0,0]",
"[0,0]",
"ans",
"max_ai = ai[n-1]",
"ai[n-1]",
"max_ai",
"max_ai = max(max_ai,ai[n-1-i])",
"max(max_ai,ai[n-1-i])",
"max_ai",
"ans = [dif,1]",
"[dif,1]",
"ans",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"ai = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"ai",
"dif = max_ai - ai[n-1-i]",
"max_ai - ai[n-1-i]",
"dif"
] |
#import heapq
n,t = map(int,input().split())
ai = [int(i) for i in input().split()]
#rev_ai = [ai[n-1]*(-1)]
ans = [0,0]
max_ai = ai[n-1]
#heapq.heapify(rev_ai)
#print(rev_ai)
for i in range(1,n):
#print(ai[n-1-i])
dif = max_ai - ai[n-1-i]
if dif > ans[0]:
ans = [dif,1]
elif dif == ans[0]:
ans[1] += 1
#print(rev_ai[0])
#heapq.heappush(rev_ai,ai[n-1-i]*(-1))
max_ai = max(max_ai,ai[n-1-i])
print(ans[1])
|
[
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,
4,
13,
17,
13,
0,
18,
13,
17,
18,
13,
17,
0,
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,
28,
13,
4,
13,
13,
0,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
18,
13,
13,
18,
13,
13,
14,
2,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
143,
2
],
[
143,
11
],
[
137,
13
],
[
128,
25
],
[
144,
31
],
[
36,
33
],
[
129,
34
],
[
138,
37
],
[
149,
40
],
[
44,
43
],
[
144,
47
],
[
129,
51
],
[
43,
53
],
[
138,
56
],
[
43,
57
],
[
62,
59
],
[
129,
60
],
[
43,
61
],
[
138,
63
],
[
43,
64
],
[
69,
66
],
[
129,
67
],
[
43,
68
],
[
129,
70
],
[
43,
72
],
[
76,
75
],
[
144,
78
],
[
131,
80
],
[
138,
83
],
[
75,
84
],
[
66,
85
],
[
59,
85
],
[
129,
86
],
[
75,
87
],
[
134,
89
],
[
132,
92
],
[
150,
93
],
[
135,
93
],
[
146,
95
],
[
99,
98
],
[
144,
101
],
[
140,
103
],
[
138,
106
],
[
98,
107
],
[
66,
108
],
[
59,
108
],
[
129,
109
],
[
98,
110
],
[
141,
113
],
[
132,
113
],
[
135,
114
],
[
150,
114
],
[
125,
116
],
[
126,
120
],
[
147,
120
],
[
143,
123
],
[
125,
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()))\nmin=[float(\"inf\")]*n\nmin[0]=a[0]\nm=0\nfor i in range(1,n):\n if min[i-1]>a[i]:\n min[i]=a[i]\n else:\n min[i]=min[i-1]\nfor i in range(n):\n r=a[i]-min[i]\n m=max(r,m)\nans=0\nfor i in range(n):\n r=a[i]-min[i]\n if r==m:\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",
"min=[float(\"inf\")]*n",
"min",
"[float(\"inf\")]*n",
"[float(\"inf\")]",
"float(\"inf\")",
"float",
"\"inf\"",
"n",
"min[0]=a[0]",
"min[0]",
"min",
"0",
"a[0]",
"a",
"0",
"m=0",
"m",
"0",
"for i in range(1,n):\n if min[i-1]>a[i]:\n min[i]=a[i]\n else:\n min[i]=min[i-1]",
"i",
"range(1,n)",
"range",
"1",
"n",
"if min[i-1]>a[i]:\n min[i]=a[i]\n else:\n min[i]=min[i-1]",
"min[i-1]>a[i]",
"min[i-1]",
"min",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"min[i]=a[i]",
"min[i]",
"min",
"i",
"a[i]",
"a",
"i",
"min[i]=min[i-1]",
"min[i]",
"min",
"i",
"min[i-1]",
"min",
"i-1",
"i",
"1",
"for i in range(n):\n r=a[i]-min[i]\n m=max(r,m)",
"i",
"range(n)",
"range",
"n",
"r=a[i]-min[i]",
"r",
"a[i]-min[i]",
"a[i]",
"a",
"i",
"min[i]",
"min",
"i",
"m=max(r,m)",
"m",
"max(r,m)",
"max",
"r",
"m",
"ans=0",
"ans",
"0",
"for i in range(n):\n r=a[i]-min[i]\n if r==m:\n ans+=1",
"i",
"range(n)",
"range",
"n",
"r=a[i]-min[i]",
"r",
"a[i]-min[i]",
"a[i]",
"a",
"i",
"min[i]",
"min",
"i",
"if r==m:\n ans+=1",
"r==m",
"r",
"m",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"ans+=1",
"1",
"ans",
"min=[float(\"inf\")]*n",
"[float(\"inf\")]*n",
"min",
"r=a[i]-min[i]",
"a[i]-min[i]",
"r",
"m=max(r,m)",
"max(r,m)",
"m",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"r=a[i]-min[i]",
"a[i]-min[i]",
"r",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"ans=0",
"0",
"ans",
"m=0",
"0",
"m"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
min=[float("inf")]*n
min[0]=a[0]
m=0
for i in range(1,n):
if min[i-1]>a[i]:
min[i]=a[i]
else:
min[i]=min[i-1]
for i in range(n):
r=a[i]-min[i]
m=max(r,m)
ans=0
for i in range(n):
r=a[i]-min[i]
if r==m:
ans+=1
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,
39,
17,
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,
4,
13,
17,
2,
18,
13,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
17,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
39,
13
] |
[
[
101,
2
],
[
101,
11
],
[
15,
14
],
[
14,
23
],
[
98,
25
],
[
110,
28
],
[
107,
32
],
[
99,
34
],
[
38,
37
],
[
102,
41
],
[
95,
43
],
[
108,
46
],
[
96,
46
],
[
99,
48
],
[
37,
50
],
[
111,
54
],
[
99,
61
],
[
37,
62
],
[
96,
63
],
[
108,
63
],
[
111,
66
],
[
70,
69
],
[
104,
72
],
[
76,
75
],
[
102,
79
],
[
111,
83
],
[
111,
86
],
[
75,
87
],
[
105,
90
],
[
101,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
]
] |
[
"n, t = map(int, input().split())\na = [int(x) for x in input().split()]\nlst = [0]\nmina = a[0]\nfor i in range(1, n):\n mina = min(mina, a[i-1])\n lst.append(max(0, a[i]-mina))\n\nlst.sort(reverse=True)\ncnt = 1\nfor i in range(1, n):\n if lst[0] == lst[i]: cnt += 1\n else: break\n\nprint(cnt)",
"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()]",
"lst = [0]",
"lst",
"[0]",
"0",
"mina = a[0]",
"mina",
"a[0]",
"a",
"0",
"for i in range(1, n):\n mina = min(mina, a[i-1])\n lst.append(max(0, a[i]-mina))",
"i",
"range(1, n)",
"range",
"1",
"n",
"mina = min(mina, a[i-1])",
"mina",
"min(mina, a[i-1])",
"min",
"mina",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"lst.append(max(0, a[i]-mina))",
"lst.append",
"lst",
"append",
"max(0, a[i]-mina)",
"max",
"0",
"a[i]-mina",
"a[i]",
"a",
"i",
"mina",
"lst.sort(reverse=True)",
"lst.sort",
"lst",
"sort",
"reverse=True",
"reverse",
"True",
"cnt = 1",
"cnt",
"1",
"for i in range(1, n):\n if lst[0] == lst[i]: cnt += 1\n else: break",
"i",
"range(1, n)",
"range",
"1",
"n",
"if lst[0] == lst[i]: cnt += 1\n else: break",
"lst[0] == lst[i]",
"lst[0]",
"lst",
"0",
"lst[i]",
"lst",
"i",
"print(cnt)",
"print",
"cnt",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"mina = min(mina, a[i-1])",
"min(mina, a[i-1])",
"mina",
"a = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"a",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"cnt = 1",
"1",
"cnt",
"mina = a[0]",
"a[0]",
"mina",
"lst = [0]",
"[0]",
"lst"
] |
n, t = map(int, input().split())
a = [int(x) for x in input().split()]
lst = [0]
mina = a[0]
for i in range(1, n):
mina = min(mina, a[i-1])
lst.append(max(0, a[i]-mina))
lst.sort(reverse=True)
cnt = 1
for i in range(1, n):
if lst[0] == lst[i]: cnt += 1
else: break
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,
13,
0,
13,
2,
17,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
2,
18,
13,
13,
13,
15,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
13,
4,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
13,
3,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13
] |
[
[
95,
2
],
[
95,
11
],
[
113,
13
],
[
101,
25
],
[
96,
29
],
[
89,
31
],
[
37,
36
],
[
96,
40
],
[
104,
42
],
[
90,
45
],
[
105,
45
],
[
114,
47
],
[
36,
49
],
[
55,
52
],
[
102,
53
],
[
36,
54
],
[
114,
57
],
[
36,
58
],
[
105,
59
],
[
90,
59
],
[
110,
62
],
[
102,
65
],
[
107,
67
],
[
111,
76
],
[
80,
79
],
[
98,
82
],
[
99,
87
],
[
108,
87
],
[
89,
90
],
[
95,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
]
] |
[
"n,T=map(int,input().split())\na=list(map(int,input().split()))\nb=[0]*n\nmn=10**18\nfor i in range(1,n):\n mn=min(mn,a[i-1])\n b[i]=a[i]-mn\n# print(b)\nfrom collections import Counter\nc=Counter(b)\nans=0\nfor k,v in sorted(c.items(),reverse=1):\n ans+=v\n break\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",
"b=[0]*n",
"b",
"[0]*n",
"[0]",
"0",
"n",
"mn=10**18",
"mn",
"10**18",
"10",
"18",
"for i in range(1,n):\n mn=min(mn,a[i-1])\n b[i]=a[i]-mn\n# print(b)",
"i",
"range(1,n)",
"range",
"1",
"n",
"mn=min(mn,a[i-1])",
"mn",
"min(mn,a[i-1])",
"min",
"mn",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"b[i]=a[i]-mn",
"b[i]",
"b",
"i",
"a[i]-mn",
"a[i]",
"a",
"i",
"mn",
"from collections import Counter",
"c=Counter(b)",
"c",
"Counter(b)",
"Counter",
"b",
"ans=0",
"ans",
"0",
"for k,v in sorted(c.items(),reverse=1):\n ans+=v\n break",
"k",
"v",
"sorted(c.items(),reverse=1)",
"sorted",
"c.items()",
"c.items",
"c",
"items",
"reverse=1",
"reverse",
"1",
"ans+=v",
"ans",
"v",
"break",
"print(ans)",
"print",
"ans",
"mn=10**18",
"10**18",
"mn",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"n,T=map(int,input().split())",
"map(int,input().split())",
"n",
"ans+=v",
"v",
"ans",
"b=[0]*n",
"[0]*n",
"b",
"mn=min(mn,a[i-1])",
"min(mn,a[i-1])",
"mn",
"ans=0",
"0",
"ans",
"c=Counter(b)",
"Counter(b)",
"c",
"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=[0]*n
mn=10**18
for i in range(1,n):
mn=min(mn,a[i-1])
b[i]=a[i]-mn
# print(b)
from collections import Counter
c=Counter(b)
ans=0
for k,v in sorted(c.items(),reverse=1):
ans+=v
break
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,
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,
13,
18,
13,
2,
13,
17,
0,
18,
13,
17,
18,
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,
41,
28,
13,
4,
13,
13,
4,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13
] |
[
[
155,
2
],
[
155,
11
],
[
161,
13
],
[
164,
25
],
[
144,
29
],
[
152,
31
],
[
144,
35
],
[
40,
37
],
[
165,
38
],
[
162,
41
],
[
45,
44
],
[
144,
48
],
[
53,
50
],
[
165,
51
],
[
44,
52
],
[
162,
56
],
[
44,
57
],
[
165,
59
],
[
44,
61
],
[
67,
64
],
[
153,
65
],
[
162,
68
],
[
72,
71
],
[
144,
75
],
[
83,
80
],
[
153,
81
],
[
71,
82
],
[
162,
86
],
[
71,
87
],
[
153,
89
],
[
71,
91
],
[
96,
95
],
[
144,
98
],
[
80,
101
],
[
153,
102
],
[
95,
103
],
[
50,
104
],
[
165,
105
],
[
95,
106
],
[
146,
108
],
[
149,
111
],
[
147,
114
],
[
158,
116
],
[
120,
119
],
[
144,
122
],
[
162,
127
],
[
119,
128
],
[
50,
129
],
[
165,
130
],
[
119,
131
],
[
150,
132
],
[
140,
134
],
[
141,
138
],
[
159,
138
],
[
140,
141
],
[
155,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
164,
165
]
] |
[
"N, T = map(int,input().split())\nA = list(map(int,input().split()))\nm = [0]*N\nM = [0]*N\nm[0] = A[0]\nfor k in range(1,N):\n m[k] = min(A[k],m[k-1])\n\nM[-1] = A[-1]\nfor k in range(N-2,-1,-1):\n M[k] = max(A[k],M[k+1])\n\nD = [M[k]-m[k] for k in range(N)]\nP = max(D)\n\nans = 0\nfor k in range(N):\n if A[k]-m[k] == P:\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",
"m = [0]*N",
"m",
"[0]*N",
"[0]",
"0",
"N",
"M = [0]*N",
"M",
"[0]*N",
"[0]",
"0",
"N",
"m[0] = A[0]",
"m[0]",
"m",
"0",
"A[0]",
"A",
"0",
"for k in range(1,N):\n m[k] = min(A[k],m[k-1])",
"k",
"range(1,N)",
"range",
"1",
"N",
"m[k] = min(A[k],m[k-1])",
"m[k]",
"m",
"k",
"min(A[k],m[k-1])",
"min",
"A[k]",
"A",
"k",
"m[k-1]",
"m",
"k-1",
"k",
"1",
"M[-1] = A[-1]",
"M[-1]",
"M",
"-1",
"A[-1]",
"A",
"-1",
"for k in range(N-2,-1,-1):\n M[k] = max(A[k],M[k+1])",
"k",
"range(N-2,-1,-1)",
"range",
"N-2",
"N",
"2",
"-1",
"-1",
"M[k] = max(A[k],M[k+1])",
"M[k]",
"M",
"k",
"max(A[k],M[k+1])",
"max",
"A[k]",
"A",
"k",
"M[k+1]",
"M",
"k+1",
"k",
"1",
"M[k]-m[k] for k in range(N)",
"for k in range(N)",
"k",
"range(N)",
"range",
"N",
"for k in range(N)",
"M[k]-m[k]",
"M[k]",
"M",
"k",
"m[k]",
"m",
"k",
"D = [M[k]-m[k] for k in range(N)]",
"D",
"[M[k]-m[k] for k in range(N)]",
"P = max(D)",
"P",
"max(D)",
"max",
"D",
"ans = 0",
"ans",
"0",
"for k in range(N):\n if A[k]-m[k] == P:\n ans += 1",
"k",
"range(N)",
"range",
"N",
"if A[k]-m[k] == P:\n ans += 1",
"A[k]-m[k] == P",
"A[k]-m[k]",
"A[k]",
"A",
"k",
"m[k]",
"m",
"k",
"P",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"N, T = map(int,input().split())",
"map(int,input().split())",
"N",
"D = [M[k]-m[k] for k in range(N)]",
"[M[k]-m[k] for k in range(N)]",
"D",
"P = max(D)",
"max(D)",
"P",
"M = [0]*N",
"[0]*N",
"M",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"ans = 0",
"0",
"ans",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"m = [0]*N",
"[0]*N",
"m"
] |
N, T = map(int,input().split())
A = list(map(int,input().split()))
m = [0]*N
M = [0]*N
m[0] = A[0]
for k in range(1,N):
m[k] = min(A[k],m[k-1])
M[-1] = A[-1]
for k in range(N-2,-1,-1):
M[k] = max(A[k],M[k+1])
D = [M[k]-m[k] for k in range(N)]
P = max(D)
ans = 0
for k in range(N):
if A[k]-m[k] == P:
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,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
13,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13
] |
[
[
103,
2
],
[
103,
11
],
[
94,
13
],
[
88,
25
],
[
95,
27
],
[
109,
30
],
[
91,
33
],
[
37,
36
],
[
104,
40
],
[
89,
43
],
[
86,
43
],
[
95,
45
],
[
36,
46
],
[
85,
48
],
[
95,
50
],
[
36,
51
],
[
95,
56
],
[
36,
57
],
[
89,
58
],
[
86,
58
],
[
92,
59
],
[
113,
59
],
[
106,
61
],
[
112,
64
],
[
95,
67
],
[
36,
68
],
[
89,
69
],
[
86,
69
],
[
95,
74
],
[
36,
75
],
[
89,
76
],
[
86,
76
],
[
92,
77
],
[
113,
77
],
[
100,
79
],
[
101,
83
],
[
107,
83
],
[
110,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
103,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
]
] |
[
"N, T = map(int,input().split())\nA = list(map(int,input().split()))\nMIN = A[0]\nans = 0\ndiff = 0\nfor i in range(1, N):\n if MIN > A[i]:\n MIN = A[i]\n elif A[i] - MIN > diff:\n ans = 1\n diff = A[i] - MIN\n elif A[i] - MIN == diff:\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",
"MIN = A[0]",
"MIN",
"A[0]",
"A",
"0",
"ans = 0",
"ans",
"0",
"diff = 0",
"diff",
"0",
"for i in range(1, N):\n if MIN > A[i]:\n MIN = A[i]\n elif A[i] - MIN > diff:\n ans = 1\n diff = A[i] - MIN\n elif A[i] - MIN == diff:\n ans += 1",
"i",
"range(1, N)",
"range",
"1",
"N",
"if MIN > A[i]:\n MIN = A[i]\n elif A[i] - MIN > diff:\n ans = 1\n diff = A[i] - MIN\n elif A[i] - MIN == diff:\n ans += 1",
"MIN > A[i]",
"MIN",
"A[i]",
"A",
"i",
"MIN = A[i]",
"MIN",
"A[i]",
"A",
"i",
"elif A[i] - MIN > diff:\n ans = 1\n diff = A[i] - MIN\n ",
"A[i] - MIN > diff",
"A[i] - MIN",
"A[i]",
"A",
"i",
"MIN",
"diff",
"ans = 1",
"ans",
"1",
"diff = A[i] - MIN",
"diff",
"A[i] - MIN",
"A[i]",
"A",
"i",
"MIN",
"elif A[i] - MIN == diff:\n ans += 1",
"A[i] - MIN == diff",
"A[i] - MIN",
"A[i]",
"A",
"i",
"MIN",
"diff",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"MIN = A[i]",
"A[i]",
"MIN",
"MIN = A[0]",
"A[0]",
"MIN",
"diff = 0",
"0",
"diff",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"ans += 1",
"1",
"ans",
"N, T = map(int,input().split())",
"map(int,input().split())",
"N",
"ans = 1",
"1",
"ans",
"ans = 0",
"0",
"ans",
"diff = A[i] - MIN",
"A[i] - MIN",
"diff"
] |
N, T = map(int,input().split())
A = list(map(int,input().split()))
MIN = A[0]
ans = 0
diff = 0
for i in range(1, N):
if MIN > A[i]:
MIN = A[i]
elif A[i] - MIN > diff:
ans = 1
diff = A[i] - MIN
elif A[i] - MIN == diff:
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,
17,
0,
13,
2,
39,
17,
13,
0,
18,
13,
17,
18,
13,
17,
28,
13,
18,
4,
13,
2,
13,
17,
39,
17,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
28,
13,
4,
13,
2,
13,
17,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13
] |
[
[
130,
2
],
[
130,
11
],
[
124,
13
],
[
127,
25
],
[
121,
28
],
[
106,
31
],
[
110,
35
],
[
40,
37
],
[
107,
38
],
[
125,
41
],
[
45,
44
],
[
110,
49
],
[
57,
54
],
[
107,
55
],
[
44,
56
],
[
107,
60
],
[
44,
62
],
[
125,
65
],
[
44,
66
],
[
69,
68
],
[
110,
72
],
[
133,
75
],
[
107,
78
],
[
68,
80
],
[
125,
83
],
[
68,
84
],
[
134,
87
],
[
128,
88
],
[
113,
88
],
[
118,
90
],
[
134,
94
],
[
128,
95
],
[
113,
95
],
[
112,
97
],
[
134,
98
],
[
115,
100
],
[
116,
104
],
[
119,
104
],
[
122,
104
],
[
106,
107
],
[
130,
110
],
[
134,
112
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\nmax_prof = 0\ncnt = 0\nmax_after = [0] * N\nmax_after[-1] = A[-1]\nfor i in range(N-1)[::-1]:\n max_after[i] = max(max_after[i+1], A[i])\nfor i in range(N-1):\n prof = max_after[i+1] - A[i]\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\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",
"max_prof = 0",
"max_prof",
"0",
"cnt = 0",
"cnt",
"0",
"max_after = [0] * N",
"max_after",
"[0] * N",
"[0]",
"0",
"N",
"max_after[-1] = A[-1]",
"max_after[-1]",
"max_after",
"-1",
"A[-1]",
"A",
"-1",
"for i in range(N-1)[::-1]:\n max_after[i] = max(max_after[i+1], A[i])",
"i",
"range(N-1)[::-1]",
"(N-1)",
"range",
"N-1",
"N",
"1",
"::-1",
"-1",
"max_after[i] = max(max_after[i+1], A[i])",
"max_after[i]",
"max_after",
"i",
"max(max_after[i+1], A[i])",
"max",
"max_after[i+1]",
"max_after",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"for i in range(N-1):\n prof = max_after[i+1] - A[i]\n if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"prof = max_after[i+1] - A[i]",
"prof",
"max_after[i+1] - A[i]",
"max_after[i+1]",
"max_after",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"if prof == max_prof:\n cnt += 1\n elif prof > max_prof:\n max_prof = prof\n cnt = 1",
"prof == max_prof",
"prof",
"max_prof",
"cnt += 1",
"cnt",
"1",
"elif prof > max_prof:\n max_prof = prof\n cnt = 1",
"prof > max_prof",
"prof",
"max_prof",
"max_prof = prof",
"max_prof",
"prof",
"cnt = 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"max_after = [0] * N",
"[0] * N",
"max_after",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"max_prof = prof",
"prof",
"max_prof",
"cnt = 1",
"1",
"cnt",
"cnt += 1",
"1",
"cnt",
"cnt = 0",
"0",
"cnt",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"max_prof = 0",
"0",
"max_prof",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"prof = max_after[i+1] - A[i]",
"max_after[i+1] - A[i]",
"prof"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
max_prof = 0
cnt = 0
max_after = [0] * N
max_after[-1] = A[-1]
for i in range(N-1)[::-1]:
max_after[i] = max(max_after[i+1], A[i])
for i in range(N-1):
prof = max_after[i+1] - A[i]
if prof == max_prof:
cnt += 1
elif prof > max_prof:
max_prof = prof
cnt = 1
print(cnt)
|
[
7,
6,
13,
17,
12,
13,
17,
0,
13,
2,
17,
4,
18,
2,
4,
13,
13,
17,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
2,
39,
13,
2,
17,
13,
28,
13,
4,
13,
4,
13,
13,
0,
18,
18,
13,
13,
2,
13,
13,
18,
13,
13,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
18,
18,
13,
13,
13,
4,
18,
13,
13,
18,
18,
13,
13,
2,
17,
13,
18,
18,
13,
13,
2,
2,
17,
13,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
13,
13,
42,
2,
13,
17,
0,
13,
17,
0,
18,
13,
13,
4,
18,
13,
13,
18,
13,
2,
17,
13,
18,
13,
2,
2,
17,
13,
17,
23,
13,
23,
13,
23,
13,
12,
13,
0,
13,
18,
13,
13,
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,
13,
0,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
17,
0,
13,
4,
18,
13,
13,
13,
18,
18,
13,
13,
13,
0,
13,
17,
29,
4,
18,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
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,
14,
2,
13,
17,
4,
13,
17,
29,
0,
13,
4,
13,
13,
13,
4,
13,
17,
0,
13,
4,
13,
13,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
2,
13,
17,
0,
13,
4,
18,
13,
13,
17,
2,
13,
17,
0,
13,
4,
18,
13,
13,
13,
2,
13,
17,
0,
13,
4,
13,
13,
2,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
17,
2,
13,
17,
0,
13,
4,
18,
13,
13,
13,
2,
13,
17,
14,
2,
2,
13,
13,
13,
14,
2,
13,
18,
13,
13,
4,
18,
13,
13,
13,
2,
13,
17,
4,
18,
13,
13,
13,
2,
13,
17,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
6,
13
] |
[
[
9,
8
],
[
100,
16
],
[
23,
20
],
[
98,
21
],
[
8,
23
],
[
28,
25
],
[
98,
26
],
[
102,
28
],
[
33,
30
],
[
98,
31
],
[
104,
33
],
[
38,
35
],
[
98,
36
],
[
8,
43
],
[
46,
45
],
[
100,
50
],
[
59,
52
],
[
35,
53
],
[
98,
54
],
[
45,
57
],
[
8,
58
],
[
100,
60
],
[
45,
61
],
[
64,
63
],
[
8,
67
],
[
77,
72
],
[
35,
73
],
[
98,
74
],
[
63,
76
],
[
25,
78
],
[
98,
79
],
[
35,
82
],
[
98,
83
],
[
63,
87
],
[
35,
89
],
[
98,
90
],
[
63,
95
],
[
98,
98
],
[
100,
100
],
[
102,
102
],
[
104,
104
],
[
109,
108
],
[
150,
110
],
[
114,
113
],
[
150,
115
],
[
121,
118
],
[
113,
119
],
[
108,
120
],
[
152,
120
],
[
154,
121
],
[
108,
124
],
[
152,
124
],
[
127,
124
],
[
128,
127
],
[
133,
130
],
[
113,
131
],
[
127,
132
],
[
108,
132
],
[
152,
132
],
[
150,
135
],
[
113,
138
],
[
127,
141
],
[
108,
141
],
[
152,
141
],
[
113,
143
],
[
127,
147
],
[
108,
147
],
[
152,
147
],
[
150,
150
],
[
152,
152
],
[
154,
154
],
[
159,
158
],
[
232,
160
],
[
163,
162
],
[
232,
164
],
[
168,
167
],
[
232,
169
],
[
173,
172
],
[
232,
174
],
[
167,
178
],
[
234,
178
],
[
200,
178
],
[
197,
178
],
[
172,
179
],
[
236,
179
],
[
222,
179
],
[
207,
179
],
[
167,
182
],
[
234,
182
],
[
200,
182
],
[
197,
182
],
[
186,
185
],
[
232,
188
],
[
158,
190
],
[
185,
190
],
[
232,
193
],
[
167,
195
],
[
234,
195
],
[
200,
195
],
[
197,
195
],
[
198,
197
],
[
201,
200
],
[
172,
204
],
[
236,
204
],
[
222,
204
],
[
207,
204
],
[
208,
207
],
[
211,
210
],
[
232,
213
],
[
162,
215
],
[
210,
215
],
[
232,
218
],
[
207,
220
],
[
172,
220
],
[
236,
220
],
[
222,
220
],
[
223,
222
],
[
232,
227
],
[
185,
229
],
[
158,
229
],
[
210,
230
],
[
162,
230
],
[
232,
232
],
[
234,
234
],
[
236,
236
],
[
243,
242
],
[
250,
249
],
[
250,
258
],
[
261,
260
],
[
242,
269
],
[
249,
273
],
[
281,
280
],
[
260,
283
],
[
290,
289
],
[
260,
292
],
[
297,
296
],
[
300,
299
],
[
249,
304
],
[
308,
307
],
[
280,
310
],
[
156,
311
],
[
299,
314
],
[
318,
317
],
[
289,
320
],
[
156,
321
],
[
299,
322
],
[
249,
324
],
[
328,
327
],
[
296,
330
],
[
327,
330
],
[
317,
332
],
[
307,
333
],
[
336,
335
],
[
339,
338
],
[
249,
341
],
[
344,
343
],
[
280,
346
],
[
156,
347
],
[
338,
350
],
[
354,
353
],
[
289,
356
],
[
156,
357
],
[
338,
358
],
[
249,
360
],
[
353,
365
],
[
317,
365
],
[
343,
366
],
[
307,
366
],
[
327,
367
],
[
296,
367
],
[
343,
370
],
[
307,
370
],
[
260,
372
],
[
338,
373
],
[
280,
376
],
[
106,
377
],
[
338,
378
],
[
343,
380
],
[
307,
380
],
[
289,
384
],
[
106,
385
],
[
338,
386
],
[
353,
388
],
[
317,
388
],
[
392,
391
],
[
391,
395
],
[
335,
395
],
[
404,
401
]
] |
[
"class SegmentTree():\n \"\"\"\n update, get を提供するSegmentTree\n\n Attributes\n ----------\n __n : int\n 葉の数。2 ^ i - 1\n __dot :\n Segment function\n __e: int\n 単位元\n __node: list\n Segment Tree\n \"\"\"\n def __init__(self, A, dot, e):\n \"\"\"\n Parameters\n ----------\n A : list\n 対象の配列\n dot :\n Segment function\n e : int\n 単位元\n \"\"\"\n n = 2 ** (len(A) - 1).bit_length()\n self.__n = n\n self.__dot = dot\n self.__e = e\n self.__node = [e] * (2 * n)\n for i in range(len(A)):\n self.__node[i + n] = A[i]\n for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n \n def update(self, i, c):\n i += self.__n\n node = self.__node\n node[i] = c\n while i > 1:\n i //= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n def get(self, l, r):\n vl, vr = self.__e, self.__e\n l += self.__n\n r += self.__n\n while (l < r):\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l //= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r //= 2\n return self.__dot(vl, vr)\n\n\ndef 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 if N == 2:\n print(1)\n return\n \n L = SegmentTree(A, min, float('inf'))\n R = SegmentTree(A, max, 0)\n\n profit = 0\n for i in range(1, N + 1):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n profit = max(profit, r - l)\n \n cnt = 0\n for i in range(N):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n if r - l == profit:\n if l == A[i]:\n L.update(i, l - 1)\n else:\n R.update(i, r + 1)\n cnt += 1\n \n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()",
"class SegmentTree():\n \"\"\"\n update, get を提供するSegmentTree\n\n Attributes\n ----------\n __n : int\n 葉の数。2 ^ i - 1\n __dot :\n Segment function\n __e: int\n 単位元\n __node: list\n Segment Tree\n \"\"\"\n def __init__(self, A, dot, e):\n \"\"\"\n Parameters\n ----------\n A : list\n 対象の配列\n dot :\n Segment function\n e : int\n 単位元\n \"\"\"\n n = 2 ** (len(A) - 1).bit_length()\n self.__n = n\n self.__dot = dot\n self.__e = e\n self.__node = [e] * (2 * n)\n for i in range(len(A)):\n self.__node[i + n] = A[i]\n for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n \n def update(self, i, c):\n i += self.__n\n node = self.__node\n node[i] = c\n while i > 1:\n i //= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n def get(self, l, r):\n vl, vr = self.__e, self.__e\n l += self.__n\n r += self.__n\n while (l < r):\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l //= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r //= 2\n return self.__dot(vl, vr)",
"SegmentTree",
"\"\"\"\n update, get を提供するSegmentTree\n\n Attributes\n ----------\n __n : int\n 葉の数。2 ^ i - 1\n __dot :\n Segment function\n __e: int\n 単位元\n __node: list\n Segment Tree\n \"\"\"",
"def __init__(self, A, dot, e):\n \"\"\"\n Parameters\n ----------\n A : list\n 対象の配列\n dot :\n Segment function\n e : int\n 単位元\n \"\"\"\n n = 2 ** (len(A) - 1).bit_length()\n self.__n = n\n self.__dot = dot\n self.__e = e\n self.__node = [e] * (2 * n)\n for i in range(len(A)):\n self.__node[i + n] = A[i]\n for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n \n ",
"__init__",
"\"\"\"\n Parameters\n ----------\n A : list\n 対象の配列\n dot :\n Segment function\n e : int\n 単位元\n \"\"\"",
"n = 2 ** (len(A) - 1).bit_length()",
"n",
"2 ** (len(A) - 1).bit_length()",
"2",
"(len(A) - 1).bit_length()",
"len(A) - 1).bit_length",
"len(A) - 1",
"len(A)",
"len",
"A",
"1",
"bit_length",
"self.__n = n",
"self.__n",
"self",
"__n",
"n",
"self.__dot = dot",
"self.__dot",
"self",
"__dot",
"dot",
"self.__e = e",
"self.__e",
"self",
"__e",
"e",
"self.__node = [e] * (2 * n)",
"self.__node",
"self",
"__node",
"[e] * (2 * n)",
"[e]",
"e",
"2 * n",
"2",
"n",
"for i in range(len(A)):\n self.__node[i + n] = A[i]\n ",
"i",
"range(len(A))",
"range",
"len(A)",
"len",
"A",
"self.__node[i + n] = A[i]",
"self.__node[i + n]",
"self.__node",
"self",
"__node",
"i + n",
"i",
"n",
"A[i]",
"A",
"i",
"for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n \n ",
"i",
"range(n - 1, 0, -1)",
"range",
"n - 1",
"n",
"1",
"0",
"-1",
"self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])",
"self.__node[i]",
"self.__node",
"self",
"__node",
"i",
"self.__dot(self.__node[2 * i], self.__node[2 * i + 1])",
"self.__dot",
"self",
"__dot",
"self.__node[2 * i]",
"self.__node",
"self",
"__node",
"2 * i",
"2",
"i",
"self.__node[2 * i + 1]",
"self.__node",
"self",
"__node",
"2 * i + 1",
"2 * i",
"2",
"i",
"1",
"self",
"self",
"A",
"A",
"dot",
"dot",
"e",
"e",
"def update(self, i, c):\n i += self.__n\n node = self.__node\n node[i] = c\n while i > 1:\n i //= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n ",
"update",
"i += self.__n",
"i",
"self.__n",
"self",
"__n",
"node = self.__node",
"node",
"self.__node",
"self",
"__node",
"node[i] = c",
"node[i]",
"node",
"i",
"c",
"while i > 1:\n i //= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n ",
"i > 1",
"i",
"1",
"i //= 2",
"i",
"2",
"node[i] = self.__dot(node[2 * i], node[2 * i + 1])",
"node[i]",
"node",
"i",
"self.__dot(node[2 * i], node[2 * i + 1])",
"self.__dot",
"self",
"__dot",
"node[2 * i]",
"node",
"2 * i",
"2",
"i",
"node[2 * i + 1]",
"node",
"2 * i + 1",
"2 * i",
"2",
"i",
"1",
"self",
"self",
"i",
"i",
"c",
"c",
"def get(self, l, r):\n vl, vr = self.__e, self.__e\n l += self.__n\n r += self.__n\n while (l < r):\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l //= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r //= 2\n return self.__dot(vl, vr)",
"get",
"vl, vr = self.__e, self.__e",
"vl",
"self.__e",
"self",
"__e",
"vr",
"self.__e",
"self",
"__e",
"l += self.__n",
"l",
"self.__n",
"self",
"__n",
"r += self.__n",
"r",
"self.__n",
"self",
"__n",
"while (l < r):\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l //= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r //= 2\n ",
"l < r",
"l",
"r",
"if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n ",
"l & 1",
"l",
"1",
"vl = self.__dot(vl, self.__node[l])",
"vl",
"self.__dot(vl, self.__node[l])",
"self.__dot",
"self",
"__dot",
"vl",
"self.__node[l]",
"self.__node",
"self",
"__node",
"l",
"l += 1",
"l",
"1",
"l //= 2",
"l",
"2",
"if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n ",
"r & 1",
"r",
"1",
"r -= 1",
"r",
"1",
"vr = self.__dot(vr, self.__node[r])",
"vr",
"self.__dot(vr, self.__node[r])",
"self.__dot",
"self",
"__dot",
"vr",
"self.__node[r]",
"self.__node",
"self",
"__node",
"r",
"r //= 2",
"r",
"2",
"return self.__dot(vl, vr)",
"self.__dot(vl, vr)",
"self.__dot",
"self",
"__dot",
"vl",
"vr",
"self",
"self",
"l",
"l",
"r",
"r",
"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 if N == 2:\n print(1)\n return\n \n L = SegmentTree(A, min, float('inf'))\n R = SegmentTree(A, max, 0)\n\n profit = 0\n for i in range(1, N + 1):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n profit = max(profit, r - l)\n \n cnt = 0\n for i in range(N):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n if r - l == profit:\n if l == A[i]:\n L.update(i, l - 1)\n else:\n R.update(i, r + 1)\n cnt += 1\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",
"if N == 2:\n print(1)\n return\n \n ",
"N == 2",
"N",
"2",
"print(1)",
"print",
"1",
"return",
"L = SegmentTree(A, min, float('inf'))",
"L",
"SegmentTree(A, min, float('inf'))",
"SegmentTree",
"A",
"min",
"float('inf')",
"float",
"'inf'",
"R = SegmentTree(A, max, 0)",
"R",
"SegmentTree(A, max, 0)",
"SegmentTree",
"A",
"max",
"0",
"profit = 0",
"profit",
"0",
"for i in range(1, N + 1):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n profit = max(profit, r - l)\n \n ",
"i",
"range(1, N + 1)",
"range",
"1",
"N + 1",
"N",
"1",
"l = L.get(0, i + 1)",
"l",
"L.get(0, i + 1)",
"L.get",
"L",
"get",
"0",
"i + 1",
"i",
"1",
"r = R.get(i, N + 1)",
"r",
"R.get(i, N + 1)",
"R.get",
"R",
"get",
"i",
"N + 1",
"N",
"1",
"profit = max(profit, r - l)",
"profit",
"max(profit, r - l)",
"max",
"profit",
"r - l",
"r",
"l",
"cnt = 0",
"cnt",
"0",
"for i in range(N):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n if r - l == profit:\n if l == A[i]:\n L.update(i, l - 1)\n else:\n R.update(i, r + 1)\n cnt += 1\n \n ",
"i",
"range(N)",
"range",
"N",
"l = L.get(0, i + 1)",
"l",
"L.get(0, i + 1)",
"L.get",
"L",
"get",
"0",
"i + 1",
"i",
"1",
"r = R.get(i, N + 1)",
"r",
"R.get(i, N + 1)",
"R.get",
"R",
"get",
"i",
"N + 1",
"N",
"1",
"if r - l == profit:\n if l == A[i]:\n L.update(i, l - 1)\n else:\n R.update(i, r + 1)\n cnt += 1\n \n ",
"r - l == profit",
"r - l",
"r",
"l",
"profit",
"if l == A[i]:\n L.update(i, l - 1)\n else:\n R.update(i, r + 1)\n ",
"l == A[i]",
"l",
"A[i]",
"A",
"i",
"L.update(i, l - 1)",
"L.update",
"L",
"update",
"i",
"l - 1",
"l",
"1",
"R.update(i, r + 1)",
"R.update",
"R",
"update",
"i",
"r + 1",
"r",
"1",
"cnt += 1",
"cnt",
"1",
"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 if N == 2:\n print(1)\n return\n \n L = SegmentTree(A, min, float('inf'))\n R = SegmentTree(A, max, 0)\n\n profit = 0\n for i in range(1, N + 1):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n profit = max(profit, r - l)\n \n cnt = 0\n for i in range(N):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n if r - l == profit:\n if l == A[i]:\n L.update(i, l - 1)\n else:\n R.update(i, r + 1)\n cnt += 1\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 if N == 2:\n print(1)\n return\n \n L = SegmentTree(A, min, float('inf'))\n R = SegmentTree(A, max, 0)\n\n profit = 0\n for i in range(1, N + 1):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n profit = max(profit, r - l)\n \n cnt = 0\n for i in range(N):\n l = L.get(0, i + 1)\n r = R.get(i, N + 1)\n if r - l == profit:\n if l == A[i]:\n L.update(i, l - 1)\n else:\n R.update(i, r + 1)\n cnt += 1\n \n print(cnt)",
"main",
"class SegmentTree():\n \"\"\"\n update, get を提供するSegmentTree\n\n Attributes\n ----------\n __n : int\n 葉の数。2 ^ i - 1\n __dot :\n Segment function\n __e: int\n 単位元\n __node: list\n Segment Tree\n \"\"\"\n def __init__(self, A, dot, e):\n \"\"\"\n Parameters\n ----------\n A : list\n 対象の配列\n dot :\n Segment function\n e : int\n 単位元\n \"\"\"\n n = 2 ** (len(A) - 1).bit_length()\n self.__n = n\n self.__dot = dot\n self.__e = e\n self.__node = [e] * (2 * n)\n for i in range(len(A)):\n self.__node[i + n] = A[i]\n for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n \n def update(self, i, c):\n i += self.__n\n node = self.__node\n node[i] = c\n while i > 1:\n i //= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n def get(self, l, r):\n vl, vr = self.__e, self.__e\n l += self.__n\n r += self.__n\n while (l < r):\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l //= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r //= 2\n return self.__dot(vl, vr)",
"class SegmentTree():\n \"\"\"\n update, get を提供するSegmentTree\n\n Attributes\n ----------\n __n : int\n 葉の数。2 ^ i - 1\n __dot :\n Segment function\n __e: int\n 単位元\n __node: list\n Segment Tree\n \"\"\"\n def __init__(self, A, dot, e):\n \"\"\"\n Parameters\n ----------\n A : list\n 対象の配列\n dot :\n Segment function\n e : int\n 単位元\n \"\"\"\n n = 2 ** (len(A) - 1).bit_length()\n self.__n = n\n self.__dot = dot\n self.__e = e\n self.__node = [e] * (2 * n)\n for i in range(len(A)):\n self.__node[i + n] = A[i]\n for i in range(n - 1, 0, -1):\n self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])\n \n def update(self, i, c):\n i += self.__n\n node = self.__node\n node[i] = c\n while i > 1:\n i //= 2\n node[i] = self.__dot(node[2 * i], node[2 * i + 1])\n\n def get(self, l, r):\n vl, vr = self.__e, self.__e\n l += self.__n\n r += self.__n\n while (l < r):\n if l & 1:\n vl = self.__dot(vl, self.__node[l])\n l += 1\n l //= 2\n if r & 1:\n r -= 1\n vr = self.__dot(vr, self.__node[r])\n r //= 2\n return self.__dot(vl, vr)",
"SegmentTree"
] |
class SegmentTree():
"""
update, get を提供するSegmentTree
Attributes
----------
__n : int
葉の数。2 ^ i - 1
__dot :
Segment function
__e: int
単位元
__node: list
Segment Tree
"""
def __init__(self, A, dot, e):
"""
Parameters
----------
A : list
対象の配列
dot :
Segment function
e : int
単位元
"""
n = 2 ** (len(A) - 1).bit_length()
self.__n = n
self.__dot = dot
self.__e = e
self.__node = [e] * (2 * n)
for i in range(len(A)):
self.__node[i + n] = A[i]
for i in range(n - 1, 0, -1):
self.__node[i] = self.__dot(self.__node[2 * i], self.__node[2 * i + 1])
def update(self, i, c):
i += self.__n
node = self.__node
node[i] = c
while i > 1:
i //= 2
node[i] = self.__dot(node[2 * i], node[2 * i + 1])
def get(self, l, r):
vl, vr = self.__e, self.__e
l += self.__n
r += self.__n
while (l < r):
if l & 1:
vl = self.__dot(vl, self.__node[l])
l += 1
l //= 2
if r & 1:
r -= 1
vr = self.__dot(vr, self.__node[r])
r //= 2
return self.__dot(vl, vr)
def main():
import sys
readline = sys.stdin.readline
# readlines = sys.stdin.readlines
N, T = map(int, input().split())
A = list(map(int, readline().split()))
if N == 2:
print(1)
return
L = SegmentTree(A, min, float('inf'))
R = SegmentTree(A, max, 0)
profit = 0
for i in range(1, N + 1):
l = L.get(0, i + 1)
r = R.get(i, N + 1)
profit = max(profit, r - l)
cnt = 0
for i in range(N):
l = L.get(0, i + 1)
r = R.get(i, N + 1)
if r - l == profit:
if l == A[i]:
L.update(i, l - 1)
else:
R.update(i, r + 1)
cnt += 1
print(cnt)
if __name__ == "__main__":
main()
|
[
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,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
28,
13,
4,
13,
13,
0,
18,
13,
18,
13,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
18,
13,
13,
18,
13,
2,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13
] |
[
[
109,
3
],
[
109,
12
],
[
118,
14
],
[
112,
26
],
[
119,
28
],
[
127,
31
],
[
35,
34
],
[
110,
38
],
[
121,
40
],
[
113,
43
],
[
122,
43
],
[
119,
45
],
[
34,
46
],
[
130,
48
],
[
128,
51
],
[
131,
51
],
[
119,
54
],
[
34,
55
],
[
122,
56
],
[
113,
56
],
[
106,
58
],
[
64,
63
],
[
110,
66
],
[
73,
68
],
[
107,
69
],
[
119,
71
],
[
63,
72
],
[
63,
73
],
[
124,
75
],
[
79,
78
],
[
110,
81
],
[
68,
84
],
[
107,
85
],
[
119,
87
],
[
78,
88
],
[
107,
90
],
[
119,
93
],
[
78,
94
],
[
131,
95
],
[
128,
95
],
[
115,
97
],
[
116,
101
],
[
125,
101
],
[
109,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
130,
131
]
] |
[
"from collections import defaultdict\nn,t=map(int,input().split())\na=list(map(int,input().split()))\nmin_v=a[0]\ndiv=0\nfor i in range(1,n):\n min_v=min(min_v,a[i])\n div=max(div,a[i]-min_v)\nd=defaultdict(int)\nfor i in range(n):\n d[a[i]]=i\nans=0\nfor i in range(n):\n if d[a[i]]<d[a[i]+div]:\n ans+=1\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=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"min_v=a[0]",
"min_v",
"a[0]",
"a",
"0",
"div=0",
"div",
"0",
"for i in range(1,n):\n min_v=min(min_v,a[i])\n div=max(div,a[i]-min_v)",
"i",
"range(1,n)",
"range",
"1",
"n",
"min_v=min(min_v,a[i])",
"min_v",
"min(min_v,a[i])",
"min",
"min_v",
"a[i]",
"a",
"i",
"div=max(div,a[i]-min_v)",
"div",
"max(div,a[i]-min_v)",
"max",
"div",
"a[i]-min_v",
"a[i]",
"a",
"i",
"min_v",
"d=defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"for i in range(n):\n d[a[i]]=i",
"i",
"range(n)",
"range",
"n",
"d[a[i]]=i",
"d[a[i]]",
"d",
"a[i]",
"a",
"i",
"i",
"ans=0",
"ans",
"0",
"for i in range(n):\n if d[a[i]]<d[a[i]+div]:\n ans+=1",
"i",
"range(n)",
"range",
"n",
"if d[a[i]]<d[a[i]+div]:\n ans+=1",
"d[a[i]]<d[a[i]+div]",
"d[a[i]]",
"d",
"a[i]",
"a",
"i",
"d[a[i]+div]",
"d",
"a[i]+div",
"a[i]",
"a",
"i",
"div",
"ans+=1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"d=defaultdict(int)",
"defaultdict(int)",
"d",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"min_v=a[0]",
"a[0]",
"min_v",
"ans+=1",
"1",
"ans",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"min_v=min(min_v,a[i])",
"min(min_v,a[i])",
"min_v",
"ans=0",
"0",
"ans",
"div=0",
"0",
"div",
"div=max(div,a[i]-min_v)",
"max(div,a[i]-min_v)",
"div"
] |
from collections import defaultdict
n,t=map(int,input().split())
a=list(map(int,input().split()))
min_v=a[0]
div=0
for i in range(1,n):
min_v=min(min_v,a[i])
div=max(div,a[i]-min_v)
d=defaultdict(int)
for i in range(n):
d[a[i]]=i
ans=0
for i in range(n):
if d[a[i]]<d[a[i]+div]:
ans+=1
print(ans)
|
[
7,
15,
13,
15,
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,
39,
18,
13,
17,
28,
13,
18,
13,
39,
17,
0,
13,
4,
13,
13,
4,
18,
13,
13,
2,
13,
13,
4,
13,
13,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
0,
13,
18,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13
] |
[
[
90,
6
],
[
90,
19
],
[
90,
20
],
[
26,
25
],
[
29,
28
],
[
35,
34
],
[
41,
40
],
[
28,
43
],
[
25,
46
],
[
34,
49
],
[
40,
50
],
[
28,
53
],
[
34,
54
],
[
28,
57
],
[
40,
58
],
[
61,
60
],
[
25,
63
],
[
66,
65
],
[
60,
67
],
[
60,
72
],
[
65,
76
],
[
85,
82
],
[
90,
88
],
[
90,
91
]
] |
[
"import sys\nfrom heapq import heappush, heappop\nfrom collections import Counter\n\nn, t, *a = map(int, sys.stdin.read().split())\n\ndef main():\n cand = []\n hq = [a[0]]\n for x in a[1:]:\n y = heappop(hq)\n cand.append(x - y)\n heappush(hq, x)\n heappush(hq, y)\n c = Counter(cand)\n ans = c[max(c.keys())]\n print(ans)\n \nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"from heapq import heappush, heappop",
"from collections import Counter",
"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 hq = [a[0]]\n for x in a[1:]:\n y = heappop(hq)\n cand.append(x - y)\n heappush(hq, x)\n heappush(hq, y)\n c = Counter(cand)\n ans = c[max(c.keys())]\n print(ans)\n ",
"main",
"cand = []",
"cand",
"[]",
"hq = [a[0]]",
"hq",
"[a[0]]",
"a[0]",
"a",
"0",
"for x in a[1:]:\n y = heappop(hq)\n cand.append(x - y)\n heappush(hq, x)\n heappush(hq, y)\n ",
"x",
"a[1:]",
"a",
"1:",
"1",
"y = heappop(hq)",
"y",
"heappop(hq)",
"heappop",
"hq",
"cand.append(x - y)",
"cand.append",
"cand",
"append",
"x - y",
"x",
"y",
"heappush(hq, x)",
"heappush",
"hq",
"x",
"heappush(hq, y)",
"heappush",
"hq",
"y",
"c = Counter(cand)",
"c",
"Counter(cand)",
"Counter",
"cand",
"ans = c[max(c.keys())]",
"ans",
"c[max(c.keys())]",
"c",
"max(c.keys())",
"max",
"c.keys()",
"c.keys",
"c",
"keys",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n cand = []\n hq = [a[0]]\n for x in a[1:]:\n y = heappop(hq)\n cand.append(x - y)\n heappush(hq, x)\n heappush(hq, y)\n c = Counter(cand)\n ans = c[max(c.keys())]\n print(ans)\n ",
"def main():\n cand = []\n hq = [a[0]]\n for x in a[1:]:\n y = heappop(hq)\n cand.append(x - y)\n heappush(hq, x)\n heappush(hq, y)\n c = Counter(cand)\n ans = c[max(c.keys())]\n print(ans)\n ",
"main",
"n, t, *a = map(int, sys.stdin.read().split())",
"map(int, sys.stdin.read().split())",
"n",
"t, *a = map(int, sys.stdin.read().split())",
"map(int, sys.stdin.read().split())",
"t"
] |
import sys
from heapq import heappush, heappop
from collections import Counter
n, t, *a = map(int, sys.stdin.read().split())
def main():
cand = []
hq = [a[0]]
for x in a[1:]:
y = heappop(hq)
cand.append(x - y)
heappush(hq, x)
heappush(hq, y)
c = Counter(cand)
ans = c[max(c.keys())]
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,
2,
2,
17,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
40,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
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,
4,
13,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] |
[
[
95,
2
],
[
95,
11
],
[
107,
13
],
[
89,
25
],
[
110,
32
],
[
98,
35
],
[
39,
38
],
[
93,
41
],
[
108,
45
],
[
38,
46
],
[
90,
47
],
[
102,
47
],
[
101,
49
],
[
108,
51
],
[
38,
52
],
[
111,
55
],
[
87,
55
],
[
108,
58
],
[
38,
59
],
[
102,
60
],
[
90,
60
],
[
113,
62
],
[
111,
66
],
[
87,
66
],
[
108,
69
],
[
38,
70
],
[
102,
71
],
[
90,
71
],
[
104,
73
],
[
86,
76
],
[
108,
79
],
[
38,
80
],
[
102,
81
],
[
90,
81
],
[
105,
84
],
[
114,
84
],
[
99,
84
],
[
86,
87
],
[
89,
90
],
[
95,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\n\nmini = 10**9+1\ndiff = 0\nans = 1\nfor i in range(n):\n if a[i] <= mini:\n mini = a[i]\n\n if diff == a[i] - mini:\n ans += 1\n elif diff < a[i] - mini:\n ans = 1\n diff = a[i] - mini\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",
"mini = 10**9+1",
"mini",
"10**9+1",
"10**9",
"10",
"9",
"1",
"diff = 0",
"diff",
"0",
"ans = 1",
"ans",
"1",
"for i in range(n):\n if a[i] <= mini:\n mini = a[i]\n\n if diff == a[i] - mini:\n ans += 1\n elif diff < a[i] - mini:\n ans = 1\n diff = a[i] - mini",
"i",
"range(n)",
"range",
"n",
"if a[i] <= mini:\n mini = a[i]\n\n ",
"a[i] <= mini",
"a[i]",
"a",
"i",
"mini",
"mini = a[i]",
"mini",
"a[i]",
"a",
"i",
"if diff == a[i] - mini:\n ans += 1\n elif diff < a[i] - mini:\n ans = 1\n diff = a[i] - mini",
"diff == a[i] - mini",
"diff",
"a[i] - mini",
"a[i]",
"a",
"i",
"mini",
"ans += 1",
"ans",
"1",
"elif diff < a[i] - mini:\n ans = 1\n diff = a[i] - mini",
"diff < a[i] - mini",
"diff",
"a[i] - mini",
"a[i]",
"a",
"i",
"mini",
"ans = 1",
"ans",
"1",
"diff = a[i] - mini",
"diff",
"a[i] - mini",
"a[i]",
"a",
"i",
"mini",
"print(ans)",
"print",
"ans",
"diff = a[i] - mini",
"a[i] - mini",
"diff",
"mini = 10**9+1",
"10**9+1",
"mini",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"ans = 1",
"1",
"ans",
"mini = a[i]",
"a[i]",
"mini",
"ans = 1",
"1",
"ans",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"diff = 0",
"0",
"diff",
"ans += 1",
"1",
"ans"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
mini = 10**9+1
diff = 0
ans = 1
for i in range(n):
if a[i] <= mini:
mini = a[i]
if diff == a[i] - mini:
ans += 1
elif diff < a[i] - mini:
ans = 1
diff = a[i] - mini
print(ans)
|
[
7,
15,
13,
12,
13,
0,
13,
18,
18,
13,
13,
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,
39,
0,
13,
39,
18,
13,
17,
4,
13,
39,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
18,
13,
17,
4,
18,
13,
13,
39,
2,
18,
13,
13,
18,
13,
17,
18,
13,
17,
14,
2,
18,
13,
17,
18,
13,
13,
4,
18,
18,
13,
17,
13,
13,
0,
13,
39,
18,
13,
13,
4,
13,
39,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
12,
18,
13,
17,
23,
0,
13,
17,
0,
13,
18,
18,
13,
17,
17,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
40,
18,
13,
17,
13,
0,
13,
17,
0,
13,
18,
13,
17,
4,
13,
4,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
7,
6
],
[
14,
13
],
[
6,
20
],
[
14,
22
],
[
26,
24
],
[
6,
32
],
[
36,
35
],
[
39,
38
],
[
49,
48
],
[
13,
52
],
[
48,
57
],
[
38,
59
],
[
92,
59
],
[
35,
63
],
[
48,
69
],
[
38,
71
],
[
92,
71
],
[
38,
74
],
[
92,
74
],
[
38,
79
],
[
92,
79
],
[
48,
83
],
[
38,
87
],
[
92,
87
],
[
48,
90
],
[
93,
92
],
[
48,
96
],
[
35,
103
],
[
107,
106
],
[
110,
109
],
[
117,
116
],
[
120,
119
],
[
35,
122
],
[
127,
126
],
[
131,
130
],
[
134,
133
],
[
35,
133
],
[
133,
138
],
[
119,
140
],
[
143,
142
],
[
146,
145
],
[
133,
147
],
[
142,
153
],
[
130,
153
],
[
145,
156
],
[
126,
156
],
[
165,
162
]
] |
[
"import sys\ndef main():\n input = sys.stdin.readline\n N,T=map(int, input().split())\n *A,=map(int, input().split())\n R=[]\n mn=(A[0],set([0]))\n for i in range(1,N):\n if A[i] > mn[0]:\n R.append((A[i] - mn[0], mn[1]))\n elif mn[0] == A[i]:\n mn[1].add(i)\n else:\n mn = (A[i],set([i]))\n R.sort(reverse=True, key=lambda x:x[0])\n ans = 0\n mx = R[0][0]\n tmp1 = set()\n cnt = 0\n for r in R:\n if r[0] != mx: break\n cnt += 1\n tmp1 |= r[1]\n print(min(cnt, len(tmp1)))\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"def main():\n input = sys.stdin.readline\n N,T=map(int, input().split())\n *A,=map(int, input().split())\n R=[]\n mn=(A[0],set([0]))\n for i in range(1,N):\n if A[i] > mn[0]:\n R.append((A[i] - mn[0], mn[1]))\n elif mn[0] == A[i]:\n mn[1].add(i)\n else:\n mn = (A[i],set([i]))\n R.sort(reverse=True, key=lambda x:x[0])\n ans = 0\n mx = R[0][0]\n tmp1 = set()\n cnt = 0\n for r in R:\n if r[0] != mx: break\n cnt += 1\n tmp1 |= r[1]\n print(min(cnt, len(tmp1)))",
"main",
"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,=map(int, input().split())",
"*A",
"A",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"R=[]",
"R",
"[]",
"mn=(A[0],set([0]))",
"mn",
"(A[0],set([0]))",
"A[0]",
"A",
"0",
"set([0])",
"set",
"[0]",
"0",
"for i in range(1,N):\n if A[i] > mn[0]:\n R.append((A[i] - mn[0], mn[1]))\n elif mn[0] == A[i]:\n mn[1].add(i)\n else:\n mn = (A[i],set([i]))\n ",
"i",
"range(1,N)",
"range",
"1",
"N",
"if A[i] > mn[0]:\n R.append((A[i] - mn[0], mn[1]))\n elif mn[0] == A[i]:\n mn[1].add(i)\n else:\n mn = (A[i],set([i]))\n ",
"A[i] > mn[0]",
"A[i]",
"A",
"i",
"mn[0]",
"mn",
"0",
"R.append((A[i] - mn[0], mn[1]))",
"R.append",
"R",
"append",
"(A[i] - mn[0], mn[1])",
"A[i] - mn[0]",
"A[i]",
"A",
"i",
"mn[0]",
"mn",
"0",
"mn[1]",
"mn",
"1",
"elif mn[0] == A[i]:\n mn[1].add(i)\n ",
"mn[0] == A[i]",
"mn[0]",
"mn",
"0",
"A[i]",
"A",
"i",
"mn[1].add(i)",
"[1].add",
"[1]",
"mn",
"1",
"add",
"i",
"mn = (A[i],set([i]))",
"mn",
"(A[i],set([i]))",
"A[i]",
"A",
"i",
"set([i])",
"set",
"[i]",
"i",
"R.sort(reverse=True, key=lambda x:x[0])",
"R.sort",
"R",
"sort",
"reverse=True",
"reverse",
"True",
"key=lambda x:x[0]",
"key",
"lambda x:x[0]",
"x[0]",
"x",
"0",
"x",
"ans = 0",
"ans",
"0",
"mx = R[0][0]",
"mx",
"R[0][0]",
"[0]",
"R",
"0",
"0",
"tmp1 = set()",
"tmp1",
"set()",
"set",
"cnt = 0",
"cnt",
"0",
"for r in R:\n if r[0] != mx: break\n cnt += 1\n tmp1 |= r[1]\n ",
"r",
"R",
"if r[0] != mx: break\n ",
"r[0] != mx",
"r[0]",
"r",
"0",
"mx",
"cnt += 1",
"cnt",
"1",
"tmp1 |= r[1]",
"tmp1",
"r[1]",
"r",
"1",
"print(min(cnt, len(tmp1)))",
"print",
"min(cnt, len(tmp1))",
"min",
"cnt",
"len(tmp1)",
"len",
"tmp1",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n input = sys.stdin.readline\n N,T=map(int, input().split())\n *A,=map(int, input().split())\n R=[]\n mn=(A[0],set([0]))\n for i in range(1,N):\n if A[i] > mn[0]:\n R.append((A[i] - mn[0], mn[1]))\n elif mn[0] == A[i]:\n mn[1].add(i)\n else:\n mn = (A[i],set([i]))\n R.sort(reverse=True, key=lambda x:x[0])\n ans = 0\n mx = R[0][0]\n tmp1 = set()\n cnt = 0\n for r in R:\n if r[0] != mx: break\n cnt += 1\n tmp1 |= r[1]\n print(min(cnt, len(tmp1)))",
"def main():\n input = sys.stdin.readline\n N,T=map(int, input().split())\n *A,=map(int, input().split())\n R=[]\n mn=(A[0],set([0]))\n for i in range(1,N):\n if A[i] > mn[0]:\n R.append((A[i] - mn[0], mn[1]))\n elif mn[0] == A[i]:\n mn[1].add(i)\n else:\n mn = (A[i],set([i]))\n R.sort(reverse=True, key=lambda x:x[0])\n ans = 0\n mx = R[0][0]\n tmp1 = set()\n cnt = 0\n for r in R:\n if r[0] != mx: break\n cnt += 1\n tmp1 |= r[1]\n print(min(cnt, len(tmp1)))",
"main"
] |
import sys
def main():
input = sys.stdin.readline
N,T=map(int, input().split())
*A,=map(int, input().split())
R=[]
mn=(A[0],set([0]))
for i in range(1,N):
if A[i] > mn[0]:
R.append((A[i] - mn[0], mn[1]))
elif mn[0] == A[i]:
mn[1].add(i)
else:
mn = (A[i],set([i]))
R.sort(reverse=True, key=lambda x:x[0])
ans = 0
mx = R[0][0]
tmp1 = set()
cnt = 0
for r in R:
if r[0] != mx: break
cnt += 1
tmp1 |= r[1]
print(min(cnt, len(tmp1)))
if __name__ == '__main__':
main()
|
[
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,
4,
13,
13,
42,
2,
13,
2,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
42,
2,
2,
13,
2,
13,
17,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
42,
2,
2,
13,
2,
13,
17,
40,
18,
13,
13,
18,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
13,
0,
18,
13,
2,
13,
13,
4,
13,
13,
13,
0,
13,
17,
4,
13,
18,
13,
4,
13,
4,
18,
13,
13,
10,
17,
13,
10,
2,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
199,
3
],
[
199,
12
],
[
196,
14
],
[
160,
26
],
[
178,
31
],
[
202,
34
],
[
179,
40
],
[
176,
40
],
[
158,
40
],
[
185,
40
],
[
200,
42
],
[
197,
47
],
[
179,
48
],
[
176,
48
],
[
158,
48
],
[
185,
48
],
[
161,
49
],
[
164,
49
],
[
172,
51
],
[
163,
54
],
[
197,
56
],
[
179,
57
],
[
176,
57
],
[
158,
57
],
[
185,
57
],
[
179,
61
],
[
185,
61
],
[
176,
61
],
[
158,
61
],
[
200,
63
],
[
197,
67
],
[
179,
68
],
[
185,
68
],
[
176,
68
],
[
158,
68
],
[
197,
70
],
[
179,
72
],
[
185,
72
],
[
176,
72
],
[
158,
72
],
[
181,
75
],
[
184,
78
],
[
197,
83
],
[
179,
84
],
[
176,
84
],
[
158,
84
],
[
185,
84
],
[
197,
86
],
[
179,
88
],
[
176,
88
],
[
158,
88
],
[
185,
88
],
[
187,
91
],
[
179,
96
],
[
158,
96
],
[
185,
96
],
[
176,
96
],
[
200,
98
],
[
197,
102
],
[
179,
103
],
[
158,
103
],
[
185,
103
],
[
176,
103
],
[
197,
105
],
[
179,
107
],
[
158,
107
],
[
185,
107
],
[
176,
107
],
[
197,
112
],
[
179,
113
],
[
158,
113
],
[
185,
113
],
[
176,
113
],
[
197,
115
],
[
179,
117
],
[
158,
117
],
[
185,
117
],
[
176,
117
],
[
169,
120
],
[
190,
123
],
[
157,
126
],
[
166,
129
],
[
197,
131
],
[
158,
132
],
[
185,
132
],
[
179,
132
],
[
176,
132
],
[
139,
134
],
[
203,
135
],
[
167,
137
],
[
164,
138
],
[
161,
138
],
[
191,
141
],
[
170,
141
],
[
188,
141
],
[
182,
142
],
[
173,
142
],
[
175,
144
],
[
203,
149
],
[
203,
154
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
199,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
]
] |
[
"from collections import defaultdict\n# d = defaultdict(int)で0で初期化\n# d = defaultdict(lambda: 100)で100で初期化\nn, t = map(int, input().split())\na = list(map(int, input().split()))\nmn = 1 << 32\ni = 0\nd = defaultdict(int)\nwhile i < n - 1:\n if a[i] < mn:\n eqmn = 1\n mn = a[i]\n while i < n - 1 and a[i] == a[i + 1]:\n eqmn += 1\n i += 1\n\n elif a[i] < a[i + 1]:\n eqmx = 1\n while i < n - 1 and a[i] <= a[i + 1]:\n if a[i] == a[i + 1]:\n eqmx += 1\n else:\n eqmx = 1\n i += 1\n mx = a[i]\n d[mx - mn] += min(eqmx, eqmn)\n\n else:\n i += 1\n\nprint(d[max(d.keys())])",
"from collections import defaultdict",
"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",
"mn = 1 << 32",
"mn",
"1 << 32",
"1",
"32",
"i = 0",
"i",
"0",
"d = defaultdict(int)",
"d",
"defaultdict(int)",
"defaultdict",
"int",
"while i < n - 1:\n if a[i] < mn:\n eqmn = 1\n mn = a[i]\n while i < n - 1 and a[i] == a[i + 1]:\n eqmn += 1\n i += 1\n\n elif a[i] < a[i + 1]:\n eqmx = 1\n while i < n - 1 and a[i] <= a[i + 1]:\n if a[i] == a[i + 1]:\n eqmx += 1\n else:\n eqmx = 1\n i += 1\n mx = a[i]\n d[mx - mn] += min(eqmx, eqmn)\n\n else:\n i += 1",
"i < n - 1",
"i",
"n - 1",
"n",
"1",
"if a[i] < mn:\n eqmn = 1\n mn = a[i]\n while i < n - 1 and a[i] == a[i + 1]:\n eqmn += 1\n i += 1\n\n elif a[i] < a[i + 1]:\n eqmx = 1\n while i < n - 1 and a[i] <= a[i + 1]:\n if a[i] == a[i + 1]:\n eqmx += 1\n else:\n eqmx = 1\n i += 1\n mx = a[i]\n d[mx - mn] += min(eqmx, eqmn)\n\n else:\n i += 1",
"a[i] < mn",
"a[i]",
"a",
"i",
"mn",
"eqmn = 1",
"eqmn",
"1",
"mn = a[i]",
"mn",
"a[i]",
"a",
"i",
"while i < n - 1 and a[i] == a[i + 1]:\n eqmn += 1\n i += 1\n\n ",
"i < n - 1 and a[i] == a[i + 1]",
"i < n - 1",
"i",
"n - 1",
"n",
"1",
"a[i] == a[i + 1]",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"eqmn += 1",
"eqmn",
"1",
"i += 1",
"i",
"1",
"elif a[i] < a[i + 1]:\n eqmx = 1\n while i < n - 1 and a[i] <= a[i + 1]:\n if a[i] == a[i + 1]:\n eqmx += 1\n else:\n eqmx = 1\n i += 1\n mx = a[i]\n d[mx - mn] += min(eqmx, eqmn)\n\n ",
"a[i] < a[i + 1]",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"eqmx = 1",
"eqmx",
"1",
"while i < n - 1 and a[i] <= a[i + 1]:\n if a[i] == a[i + 1]:\n eqmx += 1\n else:\n eqmx = 1\n i += 1\n ",
"i < n - 1 and a[i] <= a[i + 1]",
"i < n - 1",
"i",
"n - 1",
"n",
"1",
"a[i] <= a[i + 1]",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"if a[i] == a[i + 1]:\n eqmx += 1\n else:\n eqmx = 1\n ",
"a[i] == a[i + 1]",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"eqmx += 1",
"eqmx",
"1",
"eqmx = 1",
"eqmx",
"1",
"i += 1",
"i",
"1",
"mx = a[i]",
"mx",
"a[i]",
"a",
"i",
"d[mx - mn] += min(eqmx, eqmn)",
"d[mx - mn]",
"d",
"mx - mn",
"mx",
"mn",
"min(eqmx, eqmn)",
"min",
"eqmx",
"eqmn",
"i += 1",
"i",
"1",
"print(d[max(d.keys())])",
"print",
"d[max(d.keys())]",
"d",
"max(d.keys())",
"max",
"d.keys()",
"d.keys",
"d",
"keys",
"i += 1",
"1",
"i",
"mn = 1 << 32",
"1 << 32",
"mn",
"mn = a[i]",
"a[i]",
"mn",
"mx = a[i]",
"a[i]",
"mx",
"eqmx += 1",
"1",
"eqmx",
"eqmn = 1",
"1",
"eqmn",
"i += 1",
"1",
"i",
"i = 0",
"0",
"i",
"eqmn += 1",
"1",
"eqmn",
"i += 1",
"1",
"i",
"eqmx = 1",
"1",
"eqmx",
"eqmx = 1",
"1",
"eqmx",
"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())",
"map(int, input().split())",
"n",
"d = defaultdict(int)",
"defaultdict(int)",
"d"
] |
from collections import defaultdict
# d = defaultdict(int)で0で初期化
# d = defaultdict(lambda: 100)で100で初期化
n, t = map(int, input().split())
a = list(map(int, input().split()))
mn = 1 << 32
i = 0
d = defaultdict(int)
while i < n - 1:
if a[i] < mn:
eqmn = 1
mn = a[i]
while i < n - 1 and a[i] == a[i + 1]:
eqmn += 1
i += 1
elif a[i] < a[i + 1]:
eqmx = 1
while i < n - 1 and a[i] <= a[i + 1]:
if a[i] == a[i + 1]:
eqmx += 1
else:
eqmx = 1
i += 1
mx = a[i]
d[mx - mn] += min(eqmx, eqmn)
else:
i += 1
print(d[max(d.keys())])
|
[
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,
0,
13,
17,
28,
13,
18,
13,
39,
17,
14,
2,
13,
13,
0,
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,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13
] |
[
[
99,
2
],
[
99,
11
],
[
93,
13
],
[
75,
25
],
[
96,
28
],
[
94,
30
],
[
84,
33
],
[
37,
36
],
[
94,
38
],
[
36,
43
],
[
97,
44
],
[
88,
44
],
[
87,
46
],
[
36,
47
],
[
36,
51
],
[
97,
52
],
[
88,
52
],
[
76,
53
],
[
103,
53
],
[
102,
55
],
[
36,
57
],
[
97,
58
],
[
88,
58
],
[
90,
60
],
[
36,
65
],
[
97,
66
],
[
88,
66
],
[
76,
67
],
[
103,
67
],
[
78,
69
],
[
79,
73
],
[
91,
73
],
[
85,
73
],
[
75,
76
],
[
78,
79
],
[
99,
82
],
[
84,
85
],
[
36,
87
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\n# 最大収益\nmax_income = 0\n# リンゴの最低価格\nmin_num = A[0]\n# 青木君が減らさないといけない組の数\ncomb = 0\n \n# 2つ目の町から探索\n# n = 現在の町のリンゴの価格\nfor n in A[1:]:\n # 最低価格を更新する\n if n < min_num:\n min_num = n\n \n # 最大利益を更新する\n elif n - min_num > max_income:\n max_income = n-min_num\n # 組数を1にする\n comb =1\n \n # 最大利益を持つ組が2個あった場合、\n elif n - min_num == max_income:\n # 組数を1増やす\n comb +=1\n \n\nprint(comb)",
"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_income = 0",
"max_income",
"0",
"min_num = A[0]",
"min_num",
"A[0]",
"A",
"0",
"comb = 0",
"comb",
"0",
"for n in A[1:]:\n # 最低価格を更新する\n if n < min_num:\n min_num = n\n \n # 最大利益を更新する\n elif n - min_num > max_income:\n max_income = n-min_num\n # 組数を1にする\n comb =1\n \n # 最大利益を持つ組が2個あった場合、\n elif n - min_num == max_income:\n # 組数を1増やす\n comb +=1\n ",
"n",
"A[1:]",
"A",
"1:",
"1",
"if n < min_num:\n min_num = n\n \n # 最大利益を更新する\n elif n - min_num > max_income:\n max_income = n-min_num\n # 組数を1にする\n comb =1\n \n # 最大利益を持つ組が2個あった場合、\n elif n - min_num == max_income:\n # 組数を1増やす\n comb +=1\n ",
"n < min_num",
"n",
"min_num",
"min_num = n",
"min_num",
"n",
"elif n - min_num > max_income:\n max_income = n-min_num\n # 組数を1にする\n comb =1\n \n # 最大利益を持つ組が2個あった場合、\n ",
"n - min_num > max_income",
"n - min_num",
"n",
"min_num",
"max_income",
"max_income = n-min_num",
"max_income",
"n-min_num",
"n",
"min_num",
"comb =1",
"comb",
"1",
"elif n - min_num == max_income:\n # 組数を1増やす\n comb +=1\n ",
"n - min_num == max_income",
"n - min_num",
"n",
"min_num",
"max_income",
"comb +=1",
"comb",
"1",
"print(comb)",
"print",
"comb",
"max_income = 0",
"0",
"max_income",
"comb +=1",
"1",
"comb",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"comb = 0",
"0",
"comb",
"min_num = n",
"n",
"min_num",
"comb =1",
"1",
"comb",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"min_num = A[0]",
"A[0]",
"min_num",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"max_income = n-min_num",
"n-min_num",
"max_income"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
# 最大収益
max_income = 0
# リンゴの最低価格
min_num = A[0]
# 青木君が減らさないといけない組の数
comb = 0
# 2つ目の町から探索
# n = 現在の町のリンゴの価格
for n in A[1:]:
# 最低価格を更新する
if n < min_num:
min_num = n
# 最大利益を更新する
elif n - min_num > max_income:
max_income = n-min_num
# 組数を1にする
comb =1
# 最大利益を持つ組が2個あった場合、
elif n - min_num == max_income:
# 組数を1増やす
comb +=1
print(comb)
|
[
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,
18,
13,
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,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13
] |
[
[
99,
2
],
[
99,
11
],
[
78,
13
],
[
84,
25
],
[
79,
27
],
[
81,
31
],
[
85,
33
],
[
90,
36
],
[
93,
39
],
[
43,
42
],
[
85,
42
],
[
82,
46
],
[
88,
46
],
[
42,
47
],
[
87,
49
],
[
42,
50
],
[
82,
54
],
[
88,
54
],
[
42,
55
],
[
91,
56
],
[
103,
56
],
[
105,
58
],
[
82,
63
],
[
88,
63
],
[
42,
64
],
[
91,
65
],
[
103,
65
],
[
108,
67
],
[
102,
70
],
[
82,
72
],
[
88,
72
],
[
42,
73
],
[
109,
76
],
[
106,
76
],
[
94,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
42,
87
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
99,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
]
] |
[
"N,T = map(int,input().split())\nA = list(map(int,input().split()))\nar = A[::-1]\nmaxa = ar[0]\ndiff = 0\ncount = 0\nfor i in ar:\n if maxa < i:\n maxa = i\n else:\n if maxa - i == diff:\n count += 1\n elif maxa - i > diff:\n count = 1\n diff = maxa -i\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",
"ar = A[::-1]",
"ar",
"A[::-1]",
"A",
"::-1",
"-1",
"maxa = ar[0]",
"maxa",
"ar[0]",
"ar",
"0",
"diff = 0",
"diff",
"0",
"count = 0",
"count",
"0",
"for i in ar:\n if maxa < i:\n maxa = i\n else:\n if maxa - i == diff:\n count += 1\n elif maxa - i > diff:\n count = 1\n diff = maxa -i",
"i",
"ar",
"if maxa < i:\n maxa = i\n else:\n if maxa - i == diff:\n count += 1\n elif maxa - i > diff:\n count = 1\n diff = maxa -i",
"maxa < i",
"maxa",
"i",
"maxa = i",
"maxa",
"i",
"if maxa - i == diff:\n count += 1\n elif maxa - i > diff:\n count = 1\n diff = maxa -i",
"maxa - i == diff",
"maxa - i",
"maxa",
"i",
"diff",
"count += 1",
"count",
"1",
"elif maxa - i > diff:\n count = 1\n diff = maxa -i",
"maxa - i > diff",
"maxa - i",
"maxa",
"i",
"diff",
"count = 1",
"count",
"1",
"diff = maxa -i",
"diff",
"maxa -i",
"maxa",
"i",
"print(count)",
"print",
"count",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"maxa = ar[0]",
"ar[0]",
"maxa",
"ar = A[::-1]",
"A[::-1]",
"ar",
"maxa = i",
"i",
"maxa",
"diff = 0",
"0",
"diff",
"count = 0",
"0",
"count",
"N,T = map(int,input().split())",
"map(int,input().split())",
"N",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"diff = maxa -i",
"maxa -i",
"diff",
"count += 1",
"1",
"count",
"count = 1",
"1",
"count"
] |
N,T = map(int,input().split())
A = list(map(int,input().split()))
ar = A[::-1]
maxa = ar[0]
diff = 0
count = 0
for i in ar:
if maxa < i:
maxa = i
else:
if maxa - i == diff:
count += 1
elif maxa - i > diff:
count = 1
diff = maxa -i
print(count)
|
[
7,
15,
13,
0,
13,
4,
13,
17,
12,
13,
0,
13,
39,
13,
17,
13,
0,
13,
17,
0,
13,
39,
28,
13,
13,
4,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
39,
39,
13,
13,
13,
14,
2,
2,
13,
13,
13,
4,
18,
13,
13,
39,
13,
13,
13,
4,
13,
4,
13,
13,
29,
23,
13,
23,
13,
23,
13,
12,
13,
12,
13,
28,
13,
18,
13,
13,
28,
13,
4,
18,
13,
13,
27,
13,
0,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
0,
13,
4,
13,
4,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
4,
13,
13,
0,
13,
13,
4,
13,
13,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13
] |
[
[
147,
4
],
[
12,
11
],
[
12,
15
],
[
18,
17
],
[
21,
20
],
[
81,
27
],
[
11,
31
],
[
33,
31
],
[
34,
33
],
[
37,
36
],
[
11,
42
],
[
33,
42
],
[
17,
43
],
[
45,
43
],
[
46,
45
],
[
11,
48
],
[
33,
48
],
[
51,
50
],
[
11,
60
],
[
33,
60
],
[
17,
61
],
[
45,
61
],
[
20,
64
],
[
50,
64
],
[
50,
74
],
[
20,
74
],
[
77,
77
],
[
79,
79
],
[
81,
81
],
[
88,
87
],
[
93,
92
],
[
87,
95
],
[
92,
98
],
[
101,
100
],
[
85,
102
],
[
105,
104
],
[
100,
109
],
[
112,
111
],
[
100,
116
],
[
120,
119
],
[
104,
122
],
[
100,
128
],
[
131,
130
],
[
145,
133
],
[
104,
134
],
[
111,
135
],
[
130,
136
],
[
151,
142
],
[
147,
148
]
] |
[
"#!/usr/bin/env python3\nimport sys\nINF = float(\"inf\")\n\n\ndef solve(N: int, T: int, A: \"List[int]\"):\n\n amin, amin_i = (INF, -1)\n gmax = 0\n cand = []\n\n for i, a in enumerate(A):\n if a < amin:\n amin = a\n amin_i = i\n else:\n if a-amin > gmax:\n gmax = a-amin\n cand = [(gmax, amin_i, i)]\n elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n print(len(cand))\n return\n\n\ndef main():\n\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n T = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, T, A)\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"INF = float(\"inf\")",
"INF",
"float(\"inf\")",
"float",
"\"inf\"",
"def solve(N: int, T: int, A: \"List[int]\"):\n\n amin, amin_i = (INF, -1)\n gmax = 0\n cand = []\n\n for i, a in enumerate(A):\n if a < amin:\n amin = a\n amin_i = i\n else:\n if a-amin > gmax:\n gmax = a-amin\n cand = [(gmax, amin_i, i)]\n elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n print(len(cand))\n return",
"solve",
"amin, amin_i = (INF, -1)",
"amin",
"(INF, -1)",
"INF",
"-1",
"amin_i",
"gmax = 0",
"gmax",
"0",
"cand = []",
"cand",
"[]",
"for i, a in enumerate(A):\n if a < amin:\n amin = a\n amin_i = i\n else:\n if a-amin > gmax:\n gmax = a-amin\n cand = [(gmax, amin_i, i)]\n elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n ",
"i",
"a",
"enumerate(A)",
"enumerate",
"A",
"if a < amin:\n amin = a\n amin_i = i\n else:\n if a-amin > gmax:\n gmax = a-amin\n cand = [(gmax, amin_i, i)]\n elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n ",
"a < amin",
"a",
"amin",
"amin = a",
"amin",
"a",
"amin_i = i",
"amin_i",
"i",
"if a-amin > gmax:\n gmax = a-amin\n cand = [(gmax, amin_i, i)]\n elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n ",
"a-amin > gmax",
"a-amin",
"a",
"amin",
"gmax",
"gmax = a-amin",
"gmax",
"a-amin",
"a",
"amin",
"cand = [(gmax, amin_i, i)]",
"cand",
"[(gmax, amin_i, i)]",
"(gmax, amin_i, i)",
"gmax",
"amin_i",
"i",
"elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n ",
"a-amin == gmax",
"a-amin",
"a",
"amin",
"gmax",
"cand.append((gmax, amin_i, i))",
"cand.append",
"cand",
"append",
"(gmax, amin_i, i)",
"gmax",
"amin_i",
"i",
"print(len(cand))",
"print",
"len(cand)",
"len",
"cand",
"return",
"N: int",
"N",
"T: int",
"T",
"A: \"List[int]\"",
"A",
"def main():\n\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n T = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, T, A)",
"main",
"def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n ",
"iterate_tokens",
"for line in sys.stdin:\n for word in line.split():\n yield word\n ",
"line",
"sys.stdin",
"sys",
"stdin",
"for word in line.split():\n yield word\n ",
"word",
"line.split()",
"line.split",
"line",
"split",
"yield word",
"word",
"tokens = iterate_tokens()",
"tokens",
"iterate_tokens()",
"iterate_tokens",
"N = int(next(tokens))",
"N",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"T = int(next(tokens))",
"T",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"int(next(tokens)) for _ in range(N)",
"for _ in range(N)",
"_",
"range(N)",
"range",
"N",
"for _ in range(N)",
"int(next(tokens))",
"int",
"next(tokens)",
"next",
"tokens",
"A = [int(next(tokens)) for _ in range(N)]",
"A",
"[int(next(tokens)) for _ in range(N)]",
"solve(N, T, A)",
"solve",
"N",
"T",
"A",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def solve(N: int, T: int, A: \"List[int]\"):\n\n amin, amin_i = (INF, -1)\n gmax = 0\n cand = []\n\n for i, a in enumerate(A):\n if a < amin:\n amin = a\n amin_i = i\n else:\n if a-amin > gmax:\n gmax = a-amin\n cand = [(gmax, amin_i, i)]\n elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n print(len(cand))\n return",
"def solve(N: int, T: int, A: \"List[int]\"):\n\n amin, amin_i = (INF, -1)\n gmax = 0\n cand = []\n\n for i, a in enumerate(A):\n if a < amin:\n amin = a\n amin_i = i\n else:\n if a-amin > gmax:\n gmax = a-amin\n cand = [(gmax, amin_i, i)]\n elif a-amin == gmax:\n cand.append((gmax, amin_i, i))\n print(len(cand))\n return",
"solve",
"INF = float(\"inf\")",
"float(\"inf\")",
"INF",
"def main():\n\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n T = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, T, A)",
"def main():\n\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n T = int(next(tokens)) # type: int\n A = [int(next(tokens)) for _ in range(N)] # type: \"List[int]\"\n solve(N, T, A)",
"main"
] |
#!/usr/bin/env python3
import sys
INF = float("inf")
def solve(N: int, T: int, A: "List[int]"):
amin, amin_i = (INF, -1)
gmax = 0
cand = []
for i, a in enumerate(A):
if a < amin:
amin = a
amin_i = i
else:
if a-amin > gmax:
gmax = a-amin
cand = [(gmax, amin_i, i)]
elif a-amin == gmax:
cand.append((gmax, amin_i, i))
print(len(cand))
return
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
N = int(next(tokens)) # type: int
T = int(next(tokens)) # type: int
A = [int(next(tokens)) for _ in range(N)] # type: "List[int]"
solve(N, T, A)
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,
18,
13,
17,
0,
13,
2,
39,
13,
2,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
18,
13,
2,
13,
17,
2,
18,
13,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13
] |
[
[
75,
2
],
[
75,
11
],
[
87,
13
],
[
84,
25
],
[
88,
27
],
[
81,
30
],
[
76,
35
],
[
39,
38
],
[
76,
42
],
[
78,
44
],
[
85,
47
],
[
79,
47
],
[
88,
49
],
[
38,
50
],
[
57,
52
],
[
82,
53
],
[
38,
55
],
[
88,
59
],
[
38,
60
],
[
79,
61
],
[
85,
61
],
[
82,
66
],
[
82,
70
],
[
75,
73
],
[
75,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
87,
88
]
] |
[
"n,t=map(int,input().split())\nA=list(map(int,input().split()))\n\nb=A[0]\nB=[b]*(n-1)\nfor i in range(1,n):\n b=min(b,A[i])\n B[i-1]=A[i]-b\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(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b=A[0]",
"b",
"A[0]",
"A",
"0",
"B=[b]*(n-1)",
"B",
"[b]*(n-1)",
"[b]",
"b",
"n-1",
"n",
"1",
"for i in range(1,n):\n b=min(b,A[i])\n B[i-1]=A[i]-b",
"i",
"range(1,n)",
"range",
"1",
"n",
"b=min(b,A[i])",
"b",
"min(b,A[i])",
"min",
"b",
"A[i]",
"A",
"i",
"B[i-1]=A[i]-b",
"B[i-1]",
"B",
"i-1",
"i",
"1",
"A[i]-b",
"A[i]",
"A",
"i",
"b",
"print(B.count(max(B)))",
"print",
"B.count(max(B))",
"B.count",
"B",
"count",
"max(B)",
"max",
"B",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"b=min(b,A[i])",
"min(b,A[i])",
"b",
"B=[b]*(n-1)",
"[b]*(n-1)",
"B",
"b=A[0]",
"A[0]",
"b",
"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=A[0]
B=[b]*(n-1)
for i in range(1,n):
b=min(b,A[i])
B[i-1]=A[i]-b
print(B.count(max(B)))
|
[
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,
39,
17,
13,
0,
13,
18,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
13,
2,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
16,
15
],
[
28,
27
],
[
4,
31
],
[
34,
33
],
[
15,
35
],
[
39,
38
],
[
15,
40
],
[
44,
43
],
[
4,
47
],
[
15,
51
],
[
43,
52
],
[
33,
53
],
[
73,
53
],
[
55,
53
],
[
56,
55
],
[
15,
57
],
[
43,
58
],
[
63,
60
],
[
27,
61
],
[
43,
62
],
[
55,
64
],
[
33,
64
],
[
73,
64
],
[
38,
65
],
[
78,
65
],
[
15,
69
],
[
43,
70
],
[
38,
71
],
[
78,
71
],
[
74,
73
],
[
15,
75
],
[
43,
76
],
[
79,
78
],
[
15,
80
],
[
43,
81
],
[
27,
86
],
[
27,
90
],
[
99,
96
]
] |
[
"def main():\n n,t = map(int,input().split())\n a = list(map(int,input().split()))\n b = [0]*n\n ma = a[0]\n mi = a[0]\n\n for i in range(1,n):\n if a[i] > ma:\n ma = a[i]\n b[i] = ma-mi\n if a[i] < mi:\n ma = a[i]\n mi = a[i]\n print(b.count(max(b)))\n\nif __name__ == '__main__':\n main()",
"def main():\n n,t = map(int,input().split())\n a = list(map(int,input().split()))\n b = [0]*n\n ma = a[0]\n mi = a[0]\n\n for i in range(1,n):\n if a[i] > ma:\n ma = a[i]\n b[i] = ma-mi\n if a[i] < mi:\n ma = a[i]\n mi = a[i]\n print(b.count(max(b)))",
"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",
"b = [0]*n",
"b",
"[0]*n",
"[0]",
"0",
"n",
"ma = a[0]",
"ma",
"a[0]",
"a",
"0",
"mi = a[0]",
"mi",
"a[0]",
"a",
"0",
"for i in range(1,n):\n if a[i] > ma:\n ma = a[i]\n b[i] = ma-mi\n if a[i] < mi:\n ma = a[i]\n mi = a[i]\n ",
"i",
"range(1,n)",
"range",
"1",
"n",
"if a[i] > ma:\n ma = a[i]\n b[i] = ma-mi\n ",
"a[i] > ma",
"a[i]",
"a",
"i",
"ma",
"ma = a[i]",
"ma",
"a[i]",
"a",
"i",
"b[i] = ma-mi",
"b[i]",
"b",
"i",
"ma-mi",
"ma",
"mi",
"if a[i] < mi:\n ma = a[i]\n mi = a[i]\n ",
"a[i] < mi",
"a[i]",
"a",
"i",
"mi",
"ma = a[i]",
"ma",
"a[i]",
"a",
"i",
"mi = a[i]",
"mi",
"a[i]",
"a",
"i",
"print(b.count(max(b)))",
"print",
"b.count(max(b))",
"b.count",
"b",
"count",
"max(b)",
"max",
"b",
"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 b = [0]*n\n ma = a[0]\n mi = a[0]\n\n for i in range(1,n):\n if a[i] > ma:\n ma = a[i]\n b[i] = ma-mi\n if a[i] < mi:\n ma = a[i]\n mi = a[i]\n print(b.count(max(b)))",
"def main():\n n,t = map(int,input().split())\n a = list(map(int,input().split()))\n b = [0]*n\n ma = a[0]\n mi = a[0]\n\n for i in range(1,n):\n if a[i] > ma:\n ma = a[i]\n b[i] = ma-mi\n if a[i] < mi:\n ma = a[i]\n mi = a[i]\n print(b.count(max(b)))",
"main"
] |
def main():
n,t = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*n
ma = a[0]
mi = a[0]
for i in range(1,n):
if a[i] > ma:
ma = a[i]
b[i] = ma-mi
if a[i] < mi:
ma = a[i]
mi = a[i]
print(b.count(max(b)))
if __name__ == '__main__':
main()
|
[
7,
15,
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,
4,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
13,
4,
13,
4,
13,
2,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
60,
4
],
[
60,
13
],
[
54,
15
],
[
51,
27
],
[
55,
33
],
[
55,
40
],
[
52,
46
],
[
52,
49
],
[
51,
52
],
[
54,
55
],
[
60,
58
],
[
60,
61
]
] |
[
"import numpy as np\nN,T = map(int,input().split())\nA = list(map(int,input().split()))\nC = np.array(A)-np.minimum.accumulate(A)\nprint(sum(C==max(C)))",
"import numpy as np",
"numpy",
"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 = np.array(A)-np.minimum.accumulate(A)",
"C",
"np.array(A)-np.minimum.accumulate(A)",
"np.array(A)",
"np.array",
"np",
"array",
"A",
"np.minimum.accumulate(A)",
"np.minimum.accumulate",
"np.minimum",
"np",
"minimum",
"accumulate",
"A",
"print(sum(C==max(C)))",
"print",
"sum(C==max(C))",
"sum",
"C==max(C)",
"C",
"max(C)",
"max",
"C",
"C = np.array(A)-np.minimum.accumulate(A)",
"np.array(A)-np.minimum.accumulate(A)",
"C",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"N,T = map(int,input().split())",
"map(int,input().split())",
"N",
"T = map(int,input().split())",
"map(int,input().split())",
"T"
] |
import numpy as np
N,T = map(int,input().split())
A = list(map(int,input().split()))
C = np.array(A)-np.minimum.accumulate(A)
print(sum(C==max(C)))
|
[
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,
0,
13,
4,
13,
13,
0,
13,
18,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13
] |
[
[
81,
5
],
[
81,
18
],
[
81,
19
],
[
25,
24
],
[
28,
27
],
[
33,
32
],
[
24,
39
],
[
32,
42
],
[
27,
43
],
[
45,
43
],
[
46,
45
],
[
27,
48
],
[
45,
48
],
[
32,
49
],
[
52,
51
],
[
24,
54
],
[
57,
56
],
[
51,
58
],
[
51,
63
],
[
56,
67
],
[
79,
73
],
[
81,
76
],
[
81,
82
]
] |
[
"import sys\nfrom collections import Counter\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 c = Counter(cand)\n ans = c[max(c.keys())]\n print(ans)\n \nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"from collections import Counter",
"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 c = Counter(cand)\n ans = c[max(c.keys())]\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",
"c = Counter(cand)",
"c",
"Counter(cand)",
"Counter",
"cand",
"ans = c[max(c.keys())]",
"ans",
"c[max(c.keys())]",
"c",
"max(c.keys())",
"max",
"c.keys()",
"c.keys",
"c",
"keys",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"t, *a = map(int, sys.stdin.read().split())",
"map(int, sys.stdin.read().split())",
"t",
"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 c = Counter(cand)\n ans = c[max(c.keys())]\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 c = Counter(cand)\n ans = c[max(c.keys())]\n print(ans)\n ",
"main",
"n, t, *a = map(int, sys.stdin.read().split())",
"map(int, sys.stdin.read().split())",
"n"
] |
import sys
from collections import Counter
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)
c = Counter(cand)
ans = c[max(c.keys())]
print(ans)
if __name__ == '__main__':
main()
|
[
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,
18,
13,
17,
0,
13,
39,
28,
13,
18,
13,
39,
17,
4,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
4,
13,
18,
13,
4,
13,
4,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
39,
13
] |
[
[
83,
3
],
[
83,
12
],
[
16,
15
],
[
15,
24
],
[
86,
26
],
[
80,
29
],
[
87,
31
],
[
89,
34
],
[
38,
37
],
[
87,
39
],
[
90,
44
],
[
37,
47
],
[
81,
48
],
[
78,
48
],
[
77,
50
],
[
81,
53
],
[
78,
53
],
[
37,
54
],
[
74,
56
],
[
90,
59
],
[
75,
63
],
[
75,
68
],
[
83,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
],
[
89,
90
]
] |
[
"from collections import Counter\nN, T = map(int, input().split())\nA = [int(i) for i in input().split()]\nm = A[0]\nB = []\nfor a in A[1:]:\n B.append(a - m)\n m = min(m, a)\nc = Counter(B)\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",
"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()]",
"m = A[0]",
"m",
"A[0]",
"A",
"0",
"B = []",
"B",
"[]",
"for a in A[1:]:\n B.append(a - m)\n m = min(m, a)",
"a",
"A[1:]",
"A",
"1:",
"1",
"B.append(a - m)",
"B.append",
"B",
"append",
"a - m",
"a",
"m",
"m = min(m, a)",
"m",
"min(m, a)",
"min",
"m",
"a",
"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",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"c = Counter(B)",
"Counter(B)",
"c",
"m = min(m, a)",
"min(m, a)",
"m",
"m = A[0]",
"A[0]",
"m",
"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",
"B = []",
"[]",
"B"
] |
from collections import Counter
N, T = map(int, input().split())
A = [int(i) for i in input().split()]
m = A[0]
B = []
for a in A[1:]:
B.append(a - m)
m = min(m, a)
c = Counter(B)
print(c[max(c.keys())])
|
[
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,
39,
0,
13,
17,
28,
13,
13,
4,
13,
13,
14,
2,
13,
13,
0,
13,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
2,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
13,
39,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
13,
18,
13,
17,
4,
18,
13,
13,
17,
0,
13,
18,
13,
13,
0,
13,
4,
13,
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,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
193,
2
],
[
193,
11
],
[
172,
13
],
[
178,
25
],
[
169,
30
],
[
202,
33
],
[
173,
40
],
[
179,
43
],
[
191,
43
],
[
190,
46
],
[
170,
50
],
[
154,
54
],
[
191,
59
],
[
179,
59
],
[
203,
60
],
[
155,
60
],
[
170,
63
],
[
181,
69
],
[
170,
71
],
[
196,
75
],
[
175,
78
],
[
157,
81
],
[
85,
84
],
[
173,
89
],
[
84,
92
],
[
182,
94
],
[
170,
94
],
[
182,
98
],
[
170,
98
],
[
187,
102
],
[
173,
104
],
[
84,
105
],
[
199,
107
],
[
176,
110
],
[
167,
110
],
[
164,
110
],
[
158,
111
],
[
152,
111
],
[
149,
111
],
[
163,
113
],
[
148,
116
],
[
173,
121
],
[
84,
122
],
[
188,
123
],
[
191,
123
],
[
179,
123
],
[
166,
125
],
[
173,
131
],
[
84,
132
],
[
188,
133
],
[
191,
133
],
[
179,
133
],
[
155,
134
],
[
203,
134
],
[
151,
136
],
[
160,
139
],
[
167,
142
],
[
164,
142
],
[
176,
142
],
[
152,
143
],
[
149,
143
],
[
158,
143
],
[
161,
146
],
[
200,
146
],
[
197,
146
],
[
148,
149
],
[
151,
152
],
[
154,
155
],
[
157,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
193,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
],
[
196,
197
],
[
199,
200
],
[
202,
203
]
] |
[
"# coding: utf-8\n# Your code here!\nN,T=map(int,input().split())\nA=list(map(int,input().split()))\n\nbuy=10**9\nbuy_loc=[]\nbenefit=0\nfor index,item in enumerate(A):\n if buy>item:\n buy=item\n buy_loc.append(index)\n benefit=max(item-buy,benefit)\n\nbuy_loc.append(10**6)\nbuy_loc=buy_loc[::-1]\n\nans=0\nbuy_count=0\nsell_count=0\nfor i in range(len(A)):\n if i==buy_loc[-1]:\n buy_loc.pop(-1)\n buy=A[i]\n #print(buy_count,sell_count)\n ans+=min(buy_count,sell_count)\n buy_count=0\n sell_count=0\n if A[i]==buy:\n buy_count+=1\n if A[i]-buy==benefit:\n sell_count+=1\n\nans+=min(buy_count,sell_count)\nprint(ans)\n#print(benefit)\n#print(buy_loc)",
"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",
"buy=10**9",
"buy",
"10**9",
"10",
"9",
"buy_loc=[]",
"buy_loc",
"[]",
"benefit=0",
"benefit",
"0",
"for index,item in enumerate(A):\n if buy>item:\n buy=item\n buy_loc.append(index)\n benefit=max(item-buy,benefit)",
"index",
"item",
"enumerate(A)",
"enumerate",
"A",
"if buy>item:\n buy=item\n buy_loc.append(index)\n ",
"buy>item",
"buy",
"item",
"buy=item",
"buy",
"item",
"buy_loc.append(index)",
"buy_loc.append",
"buy_loc",
"append",
"index",
"benefit=max(item-buy,benefit)",
"benefit",
"max(item-buy,benefit)",
"max",
"item-buy",
"item",
"buy",
"benefit",
"buy_loc.append(10**6)",
"buy_loc.append",
"buy_loc",
"append",
"10**6",
"10",
"6",
"buy_loc=buy_loc[::-1]",
"buy_loc",
"buy_loc[::-1]",
"buy_loc",
"::-1",
"-1",
"ans=0",
"ans",
"0",
"buy_count=0",
"buy_count",
"0",
"sell_count=0",
"sell_count",
"0",
"for i in range(len(A)):\n if i==buy_loc[-1]:\n buy_loc.pop(-1)\n buy=A[i]\n #print(buy_count,sell_count)\n ans+=min(buy_count,sell_count)\n buy_count=0\n sell_count=0\n if A[i]==buy:\n buy_count+=1\n if A[i]-buy==benefit:\n sell_count+=1",
"i",
"range(len(A))",
"range",
"len(A)",
"len",
"A",
"if i==buy_loc[-1]:\n buy_loc.pop(-1)\n buy=A[i]\n #print(buy_count,sell_count)\n ans+=min(buy_count,sell_count)\n buy_count=0\n sell_count=0\n ",
"i==buy_loc[-1]",
"i",
"buy_loc[-1]",
"buy_loc",
"-1",
"buy_loc.pop(-1)",
"buy_loc.pop",
"buy_loc",
"pop",
"-1",
"buy=A[i]",
"buy",
"A[i]",
"A",
"i",
"ans+=min(buy_count,sell_count)",
"ans",
"min(buy_count,sell_count)",
"min",
"buy_count",
"sell_count",
"buy_count=0",
"buy_count",
"0",
"sell_count=0",
"sell_count",
"0",
"if A[i]==buy:\n buy_count+=1\n ",
"A[i]==buy",
"A[i]",
"A",
"i",
"buy",
"buy_count+=1",
"buy_count",
"1",
"if A[i]-buy==benefit:\n sell_count+=1",
"A[i]-buy==benefit",
"A[i]-buy",
"A[i]",
"A",
"i",
"buy",
"benefit",
"sell_count+=1",
"sell_count",
"1",
"ans+=min(buy_count,sell_count)",
"ans",
"min(buy_count,sell_count)",
"min",
"buy_count",
"sell_count",
"print(ans)",
"print",
"ans",
"sell_count=0",
"0",
"sell_count",
"sell_count+=1",
"1",
"sell_count",
"benefit=max(item-buy,benefit)",
"max(item-buy,benefit)",
"benefit",
"sell_count=0",
"0",
"sell_count",
"ans+=min(buy_count,sell_count)",
"min(buy_count,sell_count)",
"ans",
"buy_count=0",
"0",
"buy_count",
"buy_count+=1",
"1",
"buy_count",
"buy_loc=[]",
"[]",
"buy_loc",
"A=list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"buy_count=0",
"0",
"buy_count",
"buy=10**9",
"10**9",
"buy",
"buy_loc=buy_loc[::-1]",
"buy_loc[::-1]",
"buy_loc",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"buy=A[i]",
"A[i]",
"buy",
"buy=item",
"item",
"buy",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"ans=0",
"0",
"ans",
"ans+=min(buy_count,sell_count)",
"min(buy_count,sell_count)",
"ans",
"benefit=0",
"0",
"benefit"
] |
# coding: utf-8
# Your code here!
N,T=map(int,input().split())
A=list(map(int,input().split()))
buy=10**9
buy_loc=[]
benefit=0
for index,item in enumerate(A):
if buy>item:
buy=item
buy_loc.append(index)
benefit=max(item-buy,benefit)
buy_loc.append(10**6)
buy_loc=buy_loc[::-1]
ans=0
buy_count=0
sell_count=0
for i in range(len(A)):
if i==buy_loc[-1]:
buy_loc.pop(-1)
buy=A[i]
#print(buy_count,sell_count)
ans+=min(buy_count,sell_count)
buy_count=0
sell_count=0
if A[i]==buy:
buy_count+=1
if A[i]-buy==benefit:
sell_count+=1
ans+=min(buy_count,sell_count)
print(ans)
#print(benefit)
#print(buy_loc)
|
[
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,
17,
0,
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,
0,
13,
17,
14,
2,
2,
18,
13,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
18,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
112,
2
],
[
112,
11
],
[
15,
14
],
[
14,
23
],
[
100,
25
],
[
91,
28
],
[
101,
30
],
[
115,
33
],
[
103,
36
],
[
40,
39
],
[
89,
43
],
[
101,
47
],
[
39,
48
],
[
92,
49
],
[
98,
49
],
[
97,
51
],
[
101,
53
],
[
39,
54
],
[
101,
59
],
[
39,
60
],
[
92,
61
],
[
98,
61
],
[
116,
62
],
[
95,
62
],
[
94,
64
],
[
101,
67
],
[
39,
68
],
[
92,
69
],
[
98,
69
],
[
109,
71
],
[
101,
77
],
[
39,
78
],
[
92,
79
],
[
98,
79
],
[
116,
80
],
[
95,
80
],
[
106,
82
],
[
107,
86
],
[
110,
86
],
[
104,
86
],
[
112,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
]
] |
[
"N, T = map(int, input().split())\nA = [int(x) for x in input().split()]\n\nminA = A[0]\nmaxG = 0\nans = 0\nfor i in range(1,N) :\n if A[i] < minA :\n minA = A[i]\n else :\n if A[i] - minA > maxG :\n maxG = A[i] - minA\n ans = 1\n elif A[i] - minA == maxG :\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",
"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()]",
"minA = A[0]",
"minA",
"A[0]",
"A",
"0",
"maxG = 0",
"maxG",
"0",
"ans = 0",
"ans",
"0",
"for i in range(1,N) :\n if A[i] < minA :\n minA = A[i]\n else :\n if A[i] - minA > maxG :\n maxG = A[i] - minA\n ans = 1\n elif A[i] - minA == maxG :\n ans += 1",
"i",
"range(1,N)",
"range",
"1",
"N",
"if A[i] < minA :\n minA = A[i]\n else :\n if A[i] - minA > maxG :\n maxG = A[i] - minA\n ans = 1\n elif A[i] - minA == maxG :\n ans += 1",
"A[i] < minA",
"A[i]",
"A",
"i",
"minA",
"minA = A[i]",
"minA",
"A[i]",
"A",
"i",
"if A[i] - minA > maxG :\n maxG = A[i] - minA\n ans = 1\n elif A[i] - minA == maxG :\n ans += 1",
"A[i] - minA > maxG",
"A[i] - minA",
"A[i]",
"A",
"i",
"minA",
"maxG",
"maxG = A[i] - minA",
"maxG",
"A[i] - minA",
"A[i]",
"A",
"i",
"minA",
"ans = 1",
"ans",
"1",
"elif A[i] - minA == maxG :\n ans += 1",
"A[i] - minA == maxG",
"A[i] - minA",
"A[i]",
"A",
"i",
"minA",
"maxG",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"minA = A[0]",
"A[0]",
"minA",
"maxG = A[i] - minA",
"A[i] - minA",
"maxG",
"minA = A[i]",
"A[i]",
"minA",
"A = [int(x) for x in input().split()]",
"[int(x) for x in input().split()]",
"A",
"ans = 0",
"0",
"ans",
"ans += 1",
"1",
"ans",
"ans = 1",
"1",
"ans",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"maxG = 0",
"0",
"maxG"
] |
N, T = map(int, input().split())
A = [int(x) for x in input().split()]
minA = A[0]
maxG = 0
ans = 0
for i in range(1,N) :
if A[i] < minA :
minA = A[i]
else :
if A[i] - minA > maxG :
maxG = A[i] - minA
ans = 1
elif A[i] - minA == maxG :
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,
13,
18,
13,
17,
28,
13,
4,
13,
4,
13,
13,
0,
18,
13,
13,
13,
14,
2,
18,
13,
13,
13,
0,
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,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13
] |
[
[
96,
2
],
[
96,
11
],
[
108,
13
],
[
90,
25
],
[
97,
29
],
[
105,
31
],
[
109,
33
],
[
37,
36
],
[
97,
41
],
[
46,
43
],
[
91,
44
],
[
36,
45
],
[
106,
46
],
[
100,
46
],
[
109,
50
],
[
36,
51
],
[
106,
52
],
[
100,
52
],
[
99,
54
],
[
109,
56
],
[
36,
57
],
[
102,
59
],
[
97,
63
],
[
66,
65
],
[
97,
68
],
[
73,
70
],
[
103,
71
],
[
65,
72
],
[
43,
74
],
[
91,
75
],
[
65,
76
],
[
109,
78
],
[
65,
79
],
[
103,
84
],
[
103,
88
],
[
90,
91
],
[
96,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
]
] |
[
"n, t = map(int, input().split())\naas = list(map(int, input().split()))\nmaxs = [0]*n\nmax_a = aas[-1]\nfor i in reversed(range(n)):\n maxs[i] = max_a\n if aas[i] > max_a:\n max_a = aas[i]\ndifs = [0]*n\nfor i in range(n):\n difs[i] = maxs[i] - aas[i]\nprint(difs.count(max(difs)))",
"n, t = map(int, input().split())",
"n",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"aas = list(map(int, input().split()))",
"aas",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"maxs = [0]*n",
"maxs",
"[0]*n",
"[0]",
"0",
"n",
"max_a = aas[-1]",
"max_a",
"aas[-1]",
"aas",
"-1",
"for i in reversed(range(n)):\n maxs[i] = max_a\n if aas[i] > max_a:\n max_a = aas[i]",
"i",
"reversed(range(n))",
"reversed",
"range(n)",
"range",
"n",
"maxs[i] = max_a",
"maxs[i]",
"maxs",
"i",
"max_a",
"if aas[i] > max_a:\n max_a = aas[i]",
"aas[i] > max_a",
"aas[i]",
"aas",
"i",
"max_a",
"max_a = aas[i]",
"max_a",
"aas[i]",
"aas",
"i",
"difs = [0]*n",
"difs",
"[0]*n",
"[0]",
"0",
"n",
"for i in range(n):\n difs[i] = maxs[i] - aas[i]",
"i",
"range(n)",
"range",
"n",
"difs[i] = maxs[i] - aas[i]",
"difs[i]",
"difs",
"i",
"maxs[i] - aas[i]",
"maxs[i]",
"maxs",
"i",
"aas[i]",
"aas",
"i",
"print(difs.count(max(difs)))",
"print",
"difs.count(max(difs))",
"difs.count",
"difs",
"count",
"max(difs)",
"max",
"difs",
"maxs = [0]*n",
"[0]*n",
"maxs",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"max_a = aas[i]",
"aas[i]",
"max_a",
"difs = [0]*n",
"[0]*n",
"difs",
"max_a = aas[-1]",
"aas[-1]",
"max_a",
"aas = list(map(int, input().split()))",
"list(map(int, input().split()))",
"aas"
] |
n, t = map(int, input().split())
aas = list(map(int, input().split()))
maxs = [0]*n
max_a = aas[-1]
for i in reversed(range(n)):
maxs[i] = max_a
if aas[i] > max_a:
max_a = aas[i]
difs = [0]*n
for i in range(n):
difs[i] = maxs[i] - aas[i]
print(difs.count(max(difs)))
|
[
7,
12,
13,
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,
0,
13,
18,
13,
2,
13,
17,
13,
17,
0,
13,
18,
13,
2,
13,
17,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
13,
18,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
4,
18,
13,
13,
21,
22,
17,
2,
13,
13,
22,
17,
13,
22,
17,
13,
0,
13,
13,
13,
17,
0,
13,
13,
13,
17,
4,
18,
13,
13,
21,
22,
17,
2,
13,
13,
22,
17,
13,
22,
17,
13,
41,
28,
13,
13,
4,
18,
13,
17,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
13,
14,
2,
18,
13,
17,
13,
9,
0,
13,
4,
13,
18,
13,
17,
18,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
16
],
[
19,
18
],
[
32,
31
],
[
36,
35
],
[
18,
37
],
[
4,
39
],
[
42,
41
],
[
45,
44
],
[
18,
46
],
[
4,
48
],
[
51,
50
],
[
54,
53
],
[
4,
57
],
[
63,
62
],
[
18,
64
],
[
53,
65
],
[
62,
68
],
[
35,
69
],
[
111,
69
],
[
71,
69
],
[
72,
71
],
[
62,
72
],
[
75,
74
],
[
62,
78
],
[
35,
79
],
[
111,
79
],
[
71,
79
],
[
82,
81
],
[
62,
85
],
[
44,
86
],
[
116,
86
],
[
89,
88
],
[
62,
92
],
[
44,
93
],
[
116,
93
],
[
31,
96
],
[
112,
111
],
[
62,
112
],
[
114,
113
],
[
117,
116
],
[
62,
117
],
[
119,
118
],
[
31,
122
],
[
139,
138
],
[
31,
138
],
[
138,
142
],
[
146,
145
],
[
151,
150
],
[
154,
153
],
[
31,
153
],
[
153,
158
],
[
145,
160
],
[
164,
163
],
[
153,
167
],
[
153,
170
],
[
163,
174
],
[
150,
174
],
[
183,
180
]
] |
[
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n target_list = list()\n price_buy, town_num_buy = A[N - 1], 1\n price_sell, town_num_sell = A[N - 1], 1\n for t in range(N - 2, -1, -1):\n price = A[t]\n if price < price_buy:\n price_buy = price\n town_num_buy = 1\n elif price == price_buy:\n town_num_buy += 1\n elif price == price_sell:\n town_num_sell += 1\n elif price > price_sell:\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n price_buy, town_num_buy = price, 1\n price_sell, town_num_sell = price, 1\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n max_score = max([target['score'] for target in target_list])\n ans = 0\n for target in target_list:\n if target['score'] < max_score:\n continue\n ans += min(target['town_num_buy'], target['town_num_sell'])\n print(ans)\n\n\nif __name__ == '__main__':\n main()",
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n target_list = list()\n price_buy, town_num_buy = A[N - 1], 1\n price_sell, town_num_sell = A[N - 1], 1\n for t in range(N - 2, -1, -1):\n price = A[t]\n if price < price_buy:\n price_buy = price\n town_num_buy = 1\n elif price == price_buy:\n town_num_buy += 1\n elif price == price_sell:\n town_num_sell += 1\n elif price > price_sell:\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n price_buy, town_num_buy = price, 1\n price_sell, town_num_sell = price, 1\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n max_score = max([target['score'] for target in target_list])\n ans = 0\n for target in target_list:\n if target['score'] < max_score:\n continue\n ans += min(target['town_num_buy'], target['town_num_sell'])\n print(ans)",
"main",
"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",
"' '",
"target_list = list()",
"target_list",
"list()",
"list",
"price_buy, town_num_buy = A[N - 1], 1",
"price_buy",
"A[N - 1]",
"A",
"N - 1",
"N",
"1",
"town_num_buy",
"1",
"price_sell, town_num_sell = A[N - 1], 1",
"price_sell",
"A[N - 1]",
"A",
"N - 1",
"N",
"1",
"town_num_sell",
"1",
"for t in range(N - 2, -1, -1):\n price = A[t]\n if price < price_buy:\n price_buy = price\n town_num_buy = 1\n elif price == price_buy:\n town_num_buy += 1\n elif price == price_sell:\n town_num_sell += 1\n elif price > price_sell:\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n price_buy, town_num_buy = price, 1\n price_sell, town_num_sell = price, 1\n ",
"t",
"range(N - 2, -1, -1)",
"range",
"N - 2",
"N",
"2",
"-1",
"-1",
"price = A[t]",
"price",
"A[t]",
"A",
"t",
"if price < price_buy:\n price_buy = price\n town_num_buy = 1\n elif price == price_buy:\n town_num_buy += 1\n elif price == price_sell:\n town_num_sell += 1\n elif price > price_sell:\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n price_buy, town_num_buy = price, 1\n price_sell, town_num_sell = price, 1\n ",
"price < price_buy",
"price",
"price_buy",
"price_buy = price",
"price_buy",
"price",
"town_num_buy = 1",
"town_num_buy",
"1",
"elif price == price_buy:\n town_num_buy += 1\n ",
"price == price_buy",
"price",
"price_buy",
"town_num_buy += 1",
"town_num_buy",
"1",
"elif price == price_sell:\n town_num_sell += 1\n ",
"price == price_sell",
"price",
"price_sell",
"town_num_sell += 1",
"town_num_sell",
"1",
"elif price > price_sell:\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n price_buy, town_num_buy = price, 1\n price_sell, town_num_sell = price, 1\n ",
"price > price_sell",
"price",
"price_sell",
"target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })",
"target_list.append",
"target_list",
"append",
"{\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n }",
"'score'",
"'score'",
"price_sell - price_buy",
"price_sell",
"price_buy",
"'town_num_buy'",
"'town_num_buy'",
"town_num_buy",
"'town_num_sell'",
"'town_num_sell'",
"town_num_sell",
"price_buy, town_num_buy = price, 1",
"price_buy",
"price",
"town_num_buy",
"1",
"price_sell, town_num_sell = price, 1",
"price_sell",
"price",
"town_num_sell",
"1",
"target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })",
"target_list.append",
"target_list",
"append",
"{\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n }",
"'score'",
"'score'",
"price_sell - price_buy",
"price_sell",
"price_buy",
"'town_num_buy'",
"'town_num_buy'",
"town_num_buy",
"'town_num_sell'",
"'town_num_sell'",
"town_num_sell",
"target['score'] for target in target_list",
"for target in target_list",
"target",
"target_list",
"for target in target_list",
"target['score']",
"target",
"'score'",
"max_score = max([target['score'] for target in target_list])",
"max_score",
"max([target['score'] for target in target_list])",
"max",
"[target['score'] for target in target_list]",
"ans = 0",
"ans",
"0",
"for target in target_list:\n if target['score'] < max_score:\n continue\n ans += min(target['town_num_buy'], target['town_num_sell'])\n ",
"target",
"target_list",
"if target['score'] < max_score:\n continue\n ",
"target['score'] < max_score",
"target['score']",
"target",
"'score'",
"max_score",
"continue",
"ans += min(target['town_num_buy'], target['town_num_sell'])",
"ans",
"min(target['town_num_buy'], target['town_num_sell'])",
"min",
"target['town_num_buy']",
"target",
"'town_num_buy'",
"target['town_num_sell']",
"target",
"'town_num_sell'",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n target_list = list()\n price_buy, town_num_buy = A[N - 1], 1\n price_sell, town_num_sell = A[N - 1], 1\n for t in range(N - 2, -1, -1):\n price = A[t]\n if price < price_buy:\n price_buy = price\n town_num_buy = 1\n elif price == price_buy:\n town_num_buy += 1\n elif price == price_sell:\n town_num_sell += 1\n elif price > price_sell:\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n price_buy, town_num_buy = price, 1\n price_sell, town_num_sell = price, 1\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n max_score = max([target['score'] for target in target_list])\n ans = 0\n for target in target_list:\n if target['score'] < max_score:\n continue\n ans += min(target['town_num_buy'], target['town_num_sell'])\n print(ans)",
"def main():\n N, T = list(map(int, input().split(' ')))\n A = list(map(int, input().split(' ')))\n target_list = list()\n price_buy, town_num_buy = A[N - 1], 1\n price_sell, town_num_sell = A[N - 1], 1\n for t in range(N - 2, -1, -1):\n price = A[t]\n if price < price_buy:\n price_buy = price\n town_num_buy = 1\n elif price == price_buy:\n town_num_buy += 1\n elif price == price_sell:\n town_num_sell += 1\n elif price > price_sell:\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n price_buy, town_num_buy = price, 1\n price_sell, town_num_sell = price, 1\n target_list.append({\n 'score': price_sell - price_buy,\n 'town_num_buy': town_num_buy,\n 'town_num_sell': town_num_sell\n })\n max_score = max([target['score'] for target in target_list])\n ans = 0\n for target in target_list:\n if target['score'] < max_score:\n continue\n ans += min(target['town_num_buy'], target['town_num_sell'])\n print(ans)",
"main"
] |
def main():
N, T = list(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))
target_list = list()
price_buy, town_num_buy = A[N - 1], 1
price_sell, town_num_sell = A[N - 1], 1
for t in range(N - 2, -1, -1):
price = A[t]
if price < price_buy:
price_buy = price
town_num_buy = 1
elif price == price_buy:
town_num_buy += 1
elif price == price_sell:
town_num_sell += 1
elif price > price_sell:
target_list.append({
'score': price_sell - price_buy,
'town_num_buy': town_num_buy,
'town_num_sell': town_num_sell
})
price_buy, town_num_buy = price, 1
price_sell, town_num_sell = price, 1
target_list.append({
'score': price_sell - price_buy,
'town_num_buy': town_num_buy,
'town_num_sell': town_num_sell
})
max_score = max([target['score'] for target in target_list])
ans = 0
for target in target_list:
if target['score'] < max_score:
continue
ans += min(target['town_num_buy'], target['town_num_sell'])
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,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
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,
17,
14,
2,
2,
18,
13,
13,
18,
13,
13,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13
] |
[
[
98,
2
],
[
98,
11
],
[
95,
13
],
[
113,
25
],
[
90,
27
],
[
107,
30
],
[
34,
33
],
[
90,
38
],
[
96,
42
],
[
33,
43
],
[
96,
45
],
[
114,
46
],
[
102,
46
],
[
101,
48
],
[
33,
49
],
[
96,
54
],
[
114,
55
],
[
102,
55
],
[
96,
57
],
[
33,
58
],
[
108,
59
],
[
105,
59
],
[
110,
61
],
[
96,
67
],
[
114,
68
],
[
102,
68
],
[
96,
70
],
[
33,
71
],
[
108,
72
],
[
105,
72
],
[
92,
74
],
[
104,
77
],
[
96,
80
],
[
114,
81
],
[
102,
81
],
[
96,
83
],
[
33,
84
],
[
93,
87
],
[
111,
87
],
[
98,
90
],
[
92,
93
],
[
95,
96
],
[
98,
99
],
[
33,
101
],
[
101,
102
],
[
104,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
]
] |
[
"N,T=map(int,input().split())\nA=list(map(int,input().split()))\n\nr=N-1\np=-1\nfor l in reversed(range(N)):\n if A[l]>A[r]:\n r=l\n else:\n if A[r]-A[l]==p:\n ans+=1\n elif A[r]-A[l]>p:\n ans=1\n p=A[r]-A[l]\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",
"r=N-1",
"r",
"N-1",
"N",
"1",
"p=-1",
"p",
"-1",
"for l in reversed(range(N)):\n if A[l]>A[r]:\n r=l\n else:\n if A[r]-A[l]==p:\n ans+=1\n elif A[r]-A[l]>p:\n ans=1\n p=A[r]-A[l]\n ",
"l",
"reversed(range(N))",
"reversed",
"range(N)",
"range",
"N",
"if A[l]>A[r]:\n r=l\n else:\n if A[r]-A[l]==p:\n ans+=1\n elif A[r]-A[l]>p:\n ans=1\n p=A[r]-A[l]\n ",
"A[l]>A[r]",
"A[l]",
"A",
"l",
"A[r]",
"A",
"r",
"r=l",
"r",
"l",
"if A[r]-A[l]==p:\n ans+=1\n elif A[r]-A[l]>p:\n ans=1\n p=A[r]-A[l]\n ",
"A[r]-A[l]==p",
"A[r]-A[l]",
"A[r]",
"A",
"r",
"A[l]",
"A",
"l",
"p",
"ans+=1",
"ans",
"1",
"elif A[r]-A[l]>p:\n ans=1\n p=A[r]-A[l]\n ",
"A[r]-A[l]>p",
"A[r]-A[l]",
"A[r]",
"A",
"r",
"A[l]",
"A",
"l",
"p",
"ans=1",
"ans",
"1",
"p=A[r]-A[l]",
"p",
"A[r]-A[l]",
"A[r]",
"A",
"r",
"A[l]",
"A",
"l",
"print(ans)",
"print",
"ans",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"ans=1",
"1",
"ans",
"A=list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"r=l",
"l",
"r",
"p=A[r]-A[l]",
"A[r]-A[l]",
"p",
"p=-1",
"-1",
"p",
"ans+=1",
"1",
"ans",
"r=N-1",
"N-1",
"r"
] |
N,T=map(int,input().split())
A=list(map(int,input().split()))
r=N-1
p=-1
for l in reversed(range(N)):
if A[l]>A[r]:
r=l
else:
if A[r]-A[l]==p:
ans+=1
elif A[r]-A[l]>p:
ans=1
p=A[r]-A[l]
print(ans)
|
[
7,
12,
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,
18,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
13
],
[
17,
15
],
[
27,
26
],
[
32,
31
],
[
35,
34
],
[
38,
37
],
[
41,
40
],
[
37,
42
],
[
26,
43
],
[
66,
43
],
[
31,
46
],
[
49,
46
],
[
40,
47
],
[
50,
49
],
[
40,
50
],
[
53,
52
],
[
31,
56
],
[
49,
56
],
[
40,
57
],
[
60,
59
],
[
26,
63
],
[
66,
63
],
[
37,
64
],
[
67,
66
],
[
37,
67
],
[
59,
70
],
[
52,
70
],
[
34,
70
],
[
79,
76
]
] |
[
"def main():\n N, T = map(int, input().split())\n *A, = map(int, input().split())\n\n mi = A[0]\n d_ma = -1\n cnt = 0\n for x in A:\n d = x - mi\n if d_ma < d:\n d_ma = d\n cnt = 1\n elif d_ma == d:\n cnt += 1\n if mi > x:\n mi = x\n\n print(cnt)\n\n\nif __name__ == '__main__':\n main()",
"def main():\n N, T = map(int, input().split())\n *A, = map(int, input().split())\n\n mi = A[0]\n d_ma = -1\n cnt = 0\n for x in A:\n d = x - mi\n if d_ma < d:\n d_ma = d\n cnt = 1\n elif d_ma == d:\n cnt += 1\n if mi > x:\n mi = x\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, = map(int, input().split())",
"*A",
"A",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mi = A[0]",
"mi",
"A[0]",
"A",
"0",
"d_ma = -1",
"d_ma",
"-1",
"cnt = 0",
"cnt",
"0",
"for x in A:\n d = x - mi\n if d_ma < d:\n d_ma = d\n cnt = 1\n elif d_ma == d:\n cnt += 1\n if mi > x:\n mi = x\n\n ",
"x",
"A",
"d = x - mi",
"d",
"x - mi",
"x",
"mi",
"if d_ma < d:\n d_ma = d\n cnt = 1\n elif d_ma == d:\n cnt += 1\n ",
"d_ma < d",
"d_ma",
"d",
"d_ma = d",
"d_ma",
"d",
"cnt = 1",
"cnt",
"1",
"elif d_ma == d:\n cnt += 1\n ",
"d_ma == d",
"d_ma",
"d",
"cnt += 1",
"cnt",
"1",
"if mi > x:\n mi = x\n\n ",
"mi > x",
"mi",
"x",
"mi = x",
"mi",
"x",
"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, = map(int, input().split())\n\n mi = A[0]\n d_ma = -1\n cnt = 0\n for x in A:\n d = x - mi\n if d_ma < d:\n d_ma = d\n cnt = 1\n elif d_ma == d:\n cnt += 1\n if mi > x:\n mi = x\n\n print(cnt)",
"def main():\n N, T = map(int, input().split())\n *A, = map(int, input().split())\n\n mi = A[0]\n d_ma = -1\n cnt = 0\n for x in A:\n d = x - mi\n if d_ma < d:\n d_ma = d\n cnt = 1\n elif d_ma == d:\n cnt += 1\n if mi > x:\n mi = x\n\n print(cnt)",
"main"
] |
def main():
N, T = map(int, input().split())
*A, = map(int, input().split())
mi = A[0]
d_ma = -1
cnt = 0
for x in A:
d = x - mi
if d_ma < d:
d_ma = d
cnt = 1
elif d_ma == d:
cnt += 1
if mi > x:
mi = x
print(cnt)
if __name__ == '__main__':
main()
|
[
7,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
2,
39,
17,
13,
0,
18,
13,
2,
13,
17,
18,
13,
2,
13,
17,
28,
13,
4,
13,
17,
13,
0,
18,
13,
2,
2,
13,
13,
17,
4,
13,
18,
13,
2,
13,
13,
18,
13,
2,
2,
13,
13,
17,
0,
13,
4,
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,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
2,
18,
13,
2,
13,
17,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
15,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
2,
2,
17,
17,
17,
0,
13,
4,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
4,
13,
10,
12,
13
] |
[
[
5,
4
],
[
5,
7
],
[
10,
9
],
[
14,
13
],
[
4,
17
],
[
24,
19
],
[
13,
20
],
[
4,
22
],
[
9,
25
],
[
4,
27
],
[
31,
30
],
[
4,
34
],
[
43,
36
],
[
13,
37
],
[
4,
40
],
[
30,
41
],
[
13,
46
],
[
4,
48
],
[
30,
49
],
[
9,
51
],
[
4,
54
],
[
30,
55
],
[
59,
58
],
[
64,
63
],
[
4,
67
],
[
71,
70
],
[
58,
73
],
[
70,
73
],
[
13,
76
],
[
63,
78
],
[
9,
81
],
[
63,
82
],
[
85,
84
],
[
90,
89
],
[
4,
93
],
[
13,
99
],
[
89,
101
],
[
9,
104
],
[
89,
105
],
[
70,
106
],
[
58,
106
],
[
109,
108
],
[
108,
112
],
[
84,
112
],
[
147,
124
],
[
153,
131
],
[
142,
136
],
[
147,
148
],
[
153,
154
]
] |
[
"def examD():\n N, T =LI()\n A = LI()\n maXI = [0]*N\n maXI[N-1] = A[N-1]\n for i in range(1,N):\n maXI[N-i-1] = max(maXI[N-i],A[N-i-1])\n maXAD = int(0)\n for i in range(N-1):\n maXAD = max(maXAD,maXI[i+1]-A[i])\n cur = int(0)\n for i in range(N-1):\n if maXI[i+1]-A[i]==maXAD:\n cur +=1\n print(cur)\n\n\n\nimport sys\ndef I(): return int(sys.stdin.readline())\ndef LI(): return list(map(int,sys.stdin.readline().split()))\ndef LS(): return sys.stdin.readline().split()\ndef S(): return sys.stdin.readline().strip()\nmod = 10**9 + 7\ninf = float('inf')\n\nexamD()",
"def examD():\n N, T =LI()\n A = LI()\n maXI = [0]*N\n maXI[N-1] = A[N-1]\n for i in range(1,N):\n maXI[N-i-1] = max(maXI[N-i],A[N-i-1])\n maXAD = int(0)\n for i in range(N-1):\n maXAD = max(maXAD,maXI[i+1]-A[i])\n cur = int(0)\n for i in range(N-1):\n if maXI[i+1]-A[i]==maXAD:\n cur +=1\n print(cur)",
"examD",
"N, T =LI()",
"N",
"LI()",
"LI",
"T",
"A = LI()",
"A",
"LI()",
"LI",
"maXI = [0]*N",
"maXI",
"[0]*N",
"[0]",
"0",
"N",
"maXI[N-1] = A[N-1]",
"maXI[N-1]",
"maXI",
"N-1",
"N",
"1",
"A[N-1]",
"A",
"N-1",
"N",
"1",
"for i in range(1,N):\n maXI[N-i-1] = max(maXI[N-i],A[N-i-1])\n ",
"i",
"range(1,N)",
"range",
"1",
"N",
"maXI[N-i-1] = max(maXI[N-i],A[N-i-1])",
"maXI[N-i-1]",
"maXI",
"N-i-1",
"N-i",
"N",
"i",
"1",
"max(maXI[N-i],A[N-i-1])",
"max",
"maXI[N-i]",
"maXI",
"N-i",
"N",
"i",
"A[N-i-1]",
"A",
"N-i-1",
"N-i",
"N",
"i",
"1",
"maXAD = int(0)",
"maXAD",
"int(0)",
"int",
"0",
"for i in range(N-1):\n maXAD = max(maXAD,maXI[i+1]-A[i])\n ",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"maXAD = max(maXAD,maXI[i+1]-A[i])",
"maXAD",
"max(maXAD,maXI[i+1]-A[i])",
"max",
"maXAD",
"maXI[i+1]-A[i]",
"maXI[i+1]",
"maXI",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"cur = int(0)",
"cur",
"int(0)",
"int",
"0",
"for i in range(N-1):\n if maXI[i+1]-A[i]==maXAD:\n cur +=1\n ",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"if maXI[i+1]-A[i]==maXAD:\n cur +=1\n ",
"maXI[i+1]-A[i]==maXAD",
"maXI[i+1]-A[i]",
"maXI[i+1]",
"maXI",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"maXAD",
"cur +=1",
"cur",
"1",
"print(cur)",
"print",
"cur",
"import sys",
"sys",
"def I(): return int(sys.stdin.readline())",
"I",
"def LI(): return list(map(int,sys.stdin.readline().split()))",
"LI",
"def LS(): return sys.stdin.readline().split()",
"LS",
"def S(): return sys.stdin.readline().strip()",
"S",
"mod = 10**9 + 7",
"mod",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"inf = float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"examD()",
"examD",
"def LS(): return sys.stdin.readline().split()",
"def LS(): return sys.stdin.readline().split()",
"LS",
"def examD():\n N, T =LI()\n A = LI()\n maXI = [0]*N\n maXI[N-1] = A[N-1]\n for i in range(1,N):\n maXI[N-i-1] = max(maXI[N-i],A[N-i-1])\n maXAD = int(0)\n for i in range(N-1):\n maXAD = max(maXAD,maXI[i+1]-A[i])\n cur = int(0)\n for i in range(N-1):\n if maXI[i+1]-A[i]==maXAD:\n cur +=1\n print(cur)",
"def examD():\n N, T =LI()\n A = LI()\n maXI = [0]*N\n maXI[N-1] = A[N-1]\n for i in range(1,N):\n maXI[N-i-1] = max(maXI[N-i],A[N-i-1])\n maXAD = int(0)\n for i in range(N-1):\n maXAD = max(maXAD,maXI[i+1]-A[i])\n cur = int(0)\n for i in range(N-1):\n if maXI[i+1]-A[i]==maXAD:\n cur +=1\n print(cur)",
"examD",
"def S(): return sys.stdin.readline().strip()",
"def S(): return sys.stdin.readline().strip()",
"S",
"mod = 10**9 + 7",
"10**9 + 7",
"mod",
"def LI(): return list(map(int,sys.stdin.readline().split()))",
"def LI(): return list(map(int,sys.stdin.readline().split()))",
"LI",
"inf = float('inf')",
"float('inf')",
"inf",
"def I(): return int(sys.stdin.readline())",
"def I(): return int(sys.stdin.readline())",
"I"
] |
def examD():
N, T =LI()
A = LI()
maXI = [0]*N
maXI[N-1] = A[N-1]
for i in range(1,N):
maXI[N-i-1] = max(maXI[N-i],A[N-i-1])
maXAD = int(0)
for i in range(N-1):
maXAD = max(maXAD,maXI[i+1]-A[i])
cur = int(0)
for i in range(N-1):
if maXI[i+1]-A[i]==maXAD:
cur +=1
print(cur)
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')
examD()
|
[
7,
15,
13,
15,
13,
15,
13,
15,
13,
15,
15,
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,
18,
13,
17,
2,
39,
17,
2,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
2,
18,
13,
17,
18,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
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,
2,
13,
10,
17,
13
] |
[
[
116,
13
],
[
116,
22
],
[
107,
24
],
[
113,
36
],
[
108,
40
],
[
117,
46
],
[
50,
49
],
[
117,
53
],
[
108,
57
],
[
49,
58
],
[
114,
60
],
[
49,
62
],
[
119,
65
],
[
108,
68
],
[
114,
71
],
[
75,
74
],
[
117,
78
],
[
104,
80
],
[
84,
83
],
[
117,
86
],
[
108,
91
],
[
83,
92
],
[
114,
94
],
[
83,
95
],
[
120,
96
],
[
122,
98
],
[
123,
102
],
[
105,
102
],
[
104,
105
],
[
107,
108
],
[
116,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
]
] |
[
"#coding: utf-8\nimport math\nimport heapq\nimport bisect\nimport numpy as np\nfrom collections import Counter, deque\nimport itertools\n#from scipy.misc import comb\n\nN,T = map(int, input().split())\nA = list(map(int, input().split()))\n\nAmin = [A[0]] + [0]*(N-1)\nfor i in range(1,N):\n if A[i] < Amin[i-1]: Amin[i] = A[i]\n else: Amin[i] = Amin[i-1]\n\nB = A[0] - Amin[0]\nfor i in range(1,N): B = max(B, A[i]-Amin[i])\n\nans = 0\nfor i in range(N):\n if A[i] - Amin[i] == B:\n ans += 1\n\nprint(ans)",
"import math",
"math",
"import heapq",
"heapq",
"import bisect",
"bisect",
"import numpy as np",
"numpy",
"from collections import Counter, deque",
"import itertools",
"itertools",
"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",
"Amin = [A[0]] + [0]*(N-1)",
"Amin",
"[A[0]] + [0]*(N-1)",
"[A[0]]",
"A[0]",
"A",
"0",
"[0]*(N-1)",
"[0]",
"0",
"N-1",
"N",
"1",
"for i in range(1,N):\n if A[i] < Amin[i-1]: Amin[i] = A[i]\n else: Amin[i] = Amin[i-1]",
"i",
"range(1,N)",
"range",
"1",
"N",
"if A[i] < Amin[i-1]: Amin[i] = A[i]\n else: Amin[i] = Amin[i-1]",
"A[i] < Amin[i-1]",
"A[i]",
"A",
"i",
"Amin[i-1]",
"Amin",
"i-1",
"i",
"1",
"B = A[0] - Amin[0]",
"B",
"A[0] - Amin[0]",
"A[0]",
"A",
"0",
"Amin[0]",
"Amin",
"0",
"for i in range(1,N): B = max(B, A[i]-Amin[i])",
"i",
"range(1,N)",
"range",
"1",
"N",
"ans = 0",
"ans",
"0",
"for i in range(N):\n if A[i] - Amin[i] == B:\n ans += 1",
"i",
"range(N)",
"range",
"N",
"if A[i] - Amin[i] == B:\n ans += 1",
"A[i] - Amin[i] == B",
"A[i] - Amin[i]",
"A[i]",
"A",
"i",
"Amin[i]",
"Amin",
"i",
"B",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"ans = 0",
"0",
"ans",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"Amin = [A[0]] + [0]*(N-1)",
"[A[0]] + [0]*(N-1)",
"Amin",
"N,T = map(int, input().split())",
"map(int, input().split())",
"N",
"B = A[0] - Amin[0]",
"A[0] - Amin[0]",
"B",
"ans += 1",
"1",
"ans"
] |
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
import itertools
#from scipy.misc import comb
N,T = map(int, input().split())
A = list(map(int, input().split()))
Amin = [A[0]] + [0]*(N-1)
for i in range(1,N):
if A[i] < Amin[i-1]: Amin[i] = A[i]
else: Amin[i] = Amin[i-1]
B = A[0] - Amin[0]
for i in range(1,N): B = max(B, A[i]-Amin[i])
ans = 0
for i in range(N):
if A[i] - Amin[i] == B:
ans += 1
print(ans)
|
[
7,
15,
13,
15,
15,
6,
13,
12,
13,
0,
18,
13,
13,
39,
0,
18,
13,
13,
39,
0,
18,
13,
13,
4,
13,
12,
17,
23,
13,
12,
13,
4,
13,
18,
13,
13,
13,
4,
13,
18,
13,
13,
40,
13,
0,
18,
18,
13,
13,
13,
17,
23,
13,
23,
13,
12,
13,
0,
18,
18,
13,
13,
13,
4,
13,
17,
2,
18,
18,
13,
13,
13,
17,
23,
13,
23,
13,
12,
13,
42,
2,
18,
13,
13,
2,
18,
18,
13,
13,
40,
18,
18,
13,
13,
17,
17,
4,
13,
18,
13,
13,
29,
8,
18,
13,
13,
40,
18,
18,
13,
13,
17,
17,
23,
13,
12,
13,
42,
2,
18,
13,
13,
2,
18,
18,
13,
13,
18,
18,
13,
13,
17,
17,
4,
13,
18,
13,
13,
29,
8,
18,
13,
13,
18,
18,
13,
13,
17,
17,
23,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
18,
18,
18,
13,
13,
13,
13,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
12,
4,
18,
4,
18,
4,
13,
13,
13,
17,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
0,
13,
12,
13,
23,
41,
28,
13,
4,
13,
40,
13,
4,
13,
17,
4,
2,
13,
4,
13,
17,
0,
13,
12,
13,
41,
28,
13,
4,
13,
13,
4,
4,
13,
0,
13,
12,
13,
23,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
4,
13,
4,
18,
13,
13,
18,
13,
17,
0,
13,
39,
0,
13,
17,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
14,
2,
13,
13,
0,
13,
2,
13,
17,
4,
18,
13,
13,
39,
13,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
0,
13,
13,
14,
2,
2,
13,
17,
13,
4,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
39,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
13,
13,
0,
13,
4,
13,
18,
13,
39,
13,
13,
0,
13,
4,
13,
18,
13,
39,
13,
13,
0,
13,
4,
18,
18,
13,
39,
13,
13,
13,
13,
0,
13,
4,
18,
18,
13,
39,
13,
13,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
4,
13,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
4,
13,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
6,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
18,
13
] |
[
[
13,
10
],
[
28,
11
],
[
18,
15
],
[
28,
16
],
[
23,
20
],
[
28,
21
],
[
28,
28
],
[
52,
34
],
[
54,
36
],
[
52,
40
],
[
54,
43
],
[
50,
45
],
[
52,
47
],
[
54,
49
],
[
52,
52
],
[
54,
54
],
[
63,
58
],
[
74,
60
],
[
76,
62
],
[
74,
69
],
[
76,
71
],
[
74,
74
],
[
76,
76
],
[
114,
82
],
[
114,
87
],
[
114,
92
],
[
114,
99
],
[
114,
104
],
[
114,
109
],
[
114,
114
],
[
150,
120
],
[
150,
125
],
[
150,
129
],
[
150,
136
],
[
150,
141
],
[
150,
145
],
[
150,
150
],
[
504,
152
],
[
495,
161
],
[
471,
170
],
[
501,
179
],
[
496,
184
],
[
483,
186
],
[
496,
194
],
[
492,
197
],
[
496,
204
],
[
498,
209
],
[
496,
219
],
[
224,
223
],
[
499,
229
],
[
480,
231
],
[
238,
237
],
[
496,
239
],
[
237,
241
],
[
237,
247
],
[
486,
252
],
[
258,
257
],
[
487,
263
],
[
468,
265
],
[
477,
270
],
[
505,
278
],
[
284,
283
],
[
484,
285
],
[
284,
286
],
[
289,
288
],
[
499,
290
],
[
293,
292
],
[
292,
297
],
[
30,
298
],
[
288,
300
],
[
304,
303
],
[
307,
306
],
[
310,
309
],
[
313,
312
],
[
288,
314
],
[
318,
317
],
[
283,
320
],
[
323,
322
],
[
292,
325
],
[
116,
326
],
[
312,
329
],
[
353,
329
],
[
322,
330
],
[
333,
332
],
[
317,
334
],
[
303,
338
],
[
346,
345
],
[
317,
346
],
[
349,
348
],
[
317,
350
],
[
354,
353
],
[
322,
354
],
[
317,
358
],
[
283,
360
],
[
292,
363
],
[
30,
364
],
[
288,
366
],
[
317,
368
],
[
303,
372
],
[
380,
379
],
[
383,
382
],
[
391,
390
],
[
288,
394
],
[
400,
399
],
[
288,
403
],
[
409,
408
],
[
288,
412
],
[
390,
417
],
[
322,
417
],
[
420,
419
],
[
288,
423
],
[
399,
428
],
[
399,
432
],
[
390,
433
],
[
322,
433
],
[
379,
434
],
[
436,
434
],
[
437,
436
],
[
399,
438
],
[
390,
439
],
[
322,
439
],
[
442,
441
],
[
419,
444
],
[
408,
445
],
[
399,
449
],
[
390,
450
],
[
322,
450
],
[
379,
451
],
[
436,
451
],
[
454,
453
],
[
419,
456
],
[
408,
457
],
[
453,
460
],
[
441,
460
],
[
382,
460
],
[
475,
466
],
[
468,
469
],
[
471,
472
],
[
477,
478
],
[
480,
481
],
[
483,
484
],
[
486,
487
],
[
492,
493
],
[
495,
496
],
[
498,
499
],
[
501,
502
],
[
504,
505
]
] |
[
"import sys\nfrom heapq import heappush, heappop\nfrom collections import defaultdict\n\n\nclass HeapSet:\n def __init__(self):\n self.minQue = []\n self.maxQue = []\n self.counter = defaultdict(lambda: 0)\n\n def insert(self, x):\n heappush(self.minQue, x)\n heappush(self.maxQue, -x)\n self.counter[x] += 1\n\n def delete(self, x):\n self.counter[x] = max(0, self.counter[x] - 1)\n\n def get_max(self):\n while self.maxQue and self.counter[-self.maxQue[0]] == 0:\n heappop(self.maxQue)\n return -self.maxQue[0] if self.maxQue else None\n\n def get_min(self):\n while self.minQue and self.counter[self.minQue[0]] == 0:\n heappop(self.minQue)\n return self.minQue[0] if self.minQue else None\n\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nin_n = lambda: int(readline())\nin_nn = lambda: map(int, readline().split())\nin_s = lambda: readline().rstrip().decode('utf-8')\nin_nl = lambda: list(map(int, readline().split()))\nin_nl2 = lambda H: [in_nl() for _ in range(H)]\nin_map = lambda: [s == ord('.') for s in readline() if s != ord('\\n')]\nin_map2 = lambda H: [in_map() for _ in range(H)]\nin_all = lambda: map(int, read().split())\n\n\ndef main():\n\n N, T = in_nn()\n A = in_nl()\n\n la = HeapSet()\n la.insert(A[0])\n\n min_sect = []\n ind_l = 0\n ind_r = 1\n pre_min = A[0]\n for i in range(N):\n min_a = la.get_min()\n if pre_min == min_a:\n ind_r = i + 1\n else:\n min_sect.append((pre_min, ind_l, ind_r))\n ind_l = i\n ind_r = i + 1\n\n pre_min = min_a\n if i + 1 < N:\n la.insert(A[i + 1])\n else:\n min_sect.append((min_a, ind_l, ind_r))\n\n max_benefit = -1\n ans = 0\n for min_a, l, r in min_sect:\n min_a = min(A[l:r])\n max_a = max(A[l:r])\n min_cnt = A[l:r].count(min_a)\n max_cnt = A[l:r].count(max_a)\n if max_a - min_a > max_benefit:\n max_benefit = max_a - min_a\n ans = min(max_cnt, min_cnt)\n elif max_a - min_a == max_benefit:\n ans += min(max_cnt, min_cnt)\n\n print(ans)\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"from heapq import heappush, heappop",
"from collections import defaultdict",
"class HeapSet:\n def __init__(self):\n self.minQue = []\n self.maxQue = []\n self.counter = defaultdict(lambda: 0)\n\n def insert(self, x):\n heappush(self.minQue, x)\n heappush(self.maxQue, -x)\n self.counter[x] += 1\n\n def delete(self, x):\n self.counter[x] = max(0, self.counter[x] - 1)\n\n def get_max(self):\n while self.maxQue and self.counter[-self.maxQue[0]] == 0:\n heappop(self.maxQue)\n return -self.maxQue[0] if self.maxQue else None\n\n def get_min(self):\n while self.minQue and self.counter[self.minQue[0]] == 0:\n heappop(self.minQue)\n return self.minQue[0] if self.minQue else None",
"HeapSet",
"def __init__(self):\n self.minQue = []\n self.maxQue = []\n self.counter = defaultdict(lambda: 0)\n\n ",
"__init__",
"self.minQue = []",
"self.minQue",
"self",
"minQue",
"[]",
"self.maxQue = []",
"self.maxQue",
"self",
"maxQue",
"[]",
"self.counter = defaultdict(lambda: 0)",
"self.counter",
"self",
"counter",
"defaultdict(lambda: 0)",
"defaultdict",
"lambda: 0",
"0",
"self",
"self",
"def insert(self, x):\n heappush(self.minQue, x)\n heappush(self.maxQue, -x)\n self.counter[x] += 1\n\n ",
"insert",
"heappush(self.minQue, x)",
"heappush",
"self.minQue",
"self",
"minQue",
"x",
"heappush(self.maxQue, -x)",
"heappush",
"self.maxQue",
"self",
"maxQue",
"-x",
"x",
"self.counter[x] += 1",
"self.counter[x]",
"self.counter",
"self",
"counter",
"x",
"1",
"self",
"self",
"x",
"x",
"def delete(self, x):\n self.counter[x] = max(0, self.counter[x] - 1)\n\n ",
"delete",
"self.counter[x] = max(0, self.counter[x] - 1)",
"self.counter[x]",
"self.counter",
"self",
"counter",
"x",
"max(0, self.counter[x] - 1)",
"max",
"0",
"self.counter[x] - 1",
"self.counter[x]",
"self.counter",
"self",
"counter",
"x",
"1",
"self",
"self",
"x",
"x",
"def get_max(self):\n while self.maxQue and self.counter[-self.maxQue[0]] == 0:\n heappop(self.maxQue)\n return -self.maxQue[0] if self.maxQue else None\n\n ",
"get_max",
"while self.maxQue and self.counter[-self.maxQue[0]] == 0:\n heappop(self.maxQue)\n ",
"self.maxQue and self.counter[-self.maxQue[0]] == 0",
"self.maxQue",
"self",
"maxQue",
"self.counter[-self.maxQue[0]] == 0",
"self.counter[-self.maxQue[0]]",
"self.counter",
"self",
"counter",
"-self.maxQue[0]",
"self.maxQue[0]",
"self.maxQue",
"self",
"maxQue",
"0",
"0",
"heappop(self.maxQue)",
"heappop",
"self.maxQue",
"self",
"maxQue",
"return -self.maxQue[0] if self.maxQue else None",
"-self.maxQue[0] if self.maxQue else None",
"self.maxQue",
"self",
"maxQue",
"-self.maxQue[0]",
"self.maxQue[0]",
"self.maxQue",
"self",
"maxQue",
"0",
"None",
"self",
"self",
"def get_min(self):\n while self.minQue and self.counter[self.minQue[0]] == 0:\n heappop(self.minQue)\n return self.minQue[0] if self.minQue else None",
"get_min",
"while self.minQue and self.counter[self.minQue[0]] == 0:\n heappop(self.minQue)\n ",
"self.minQue and self.counter[self.minQue[0]] == 0",
"self.minQue",
"self",
"minQue",
"self.counter[self.minQue[0]] == 0",
"self.counter[self.minQue[0]]",
"self.counter",
"self",
"counter",
"self.minQue[0]",
"self.minQue",
"self",
"minQue",
"0",
"0",
"heappop(self.minQue)",
"heappop",
"self.minQue",
"self",
"minQue",
"return self.minQue[0] if self.minQue else None",
"self.minQue[0] if self.minQue else None",
"self.minQue",
"self",
"minQue",
"self.minQue[0]",
"self.minQue",
"self",
"minQue",
"0",
"None",
"self",
"self",
"read = sys.stdin.buffer.read",
"read",
"sys.stdin.buffer.read",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"read",
"readline = sys.stdin.buffer.readline",
"readline",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"readlines = sys.stdin.buffer.readlines",
"readlines",
"sys.stdin.buffer.readlines",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readlines",
"in_n = lambda: int(readline())",
"in_n",
"lambda: int(readline())",
"int(readline())",
"int",
"readline()",
"readline",
"in_nn = lambda: map(int, readline().split())",
"in_nn",
"lambda: map(int, readline().split())",
"map(int, readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"in_s = lambda: readline().rstrip().decode('utf-8')",
"in_s",
"lambda: readline().rstrip().decode('utf-8')",
"readline().rstrip().decode('utf-8')",
"().rstrip().decode",
"().rstrip()",
"().rstrip",
"()",
"readline",
"rstrip",
"decode",
"'utf-8'",
"in_nl = lambda: list(map(int, readline().split()))",
"in_nl",
"lambda: list(map(int, readline().split()))",
"list(map(int, readline().split()))",
"list",
"map(int, readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"in_nl() for _ in range(H)",
"for _ in range(H)",
"_",
"range(H)",
"range",
"H",
"for _ in range(H)",
"in_nl()",
"in_nl",
"in_nl2 = lambda H: [in_nl() for _ in range(H)]",
"in_nl2",
"lambda H: [in_nl() for _ in range(H)]",
"[in_nl() for _ in range(H)]",
"H",
"s == ord('.') for s in readline() if s != ord('\\n')",
"for s in readline() if s != ord('\\n')",
"s",
"readline()",
"readline",
"s != ord('\\n')",
"s",
"ord('\\n')",
"ord",
"'\\n'",
"if s != ord('\\n')",
"s == ord('.')",
"s",
"ord('.')",
"ord",
"'.'",
"in_map = lambda: [s == ord('.') for s in readline() if s != ord('\\n')]",
"in_map",
"lambda: [s == ord('.') for s in readline() if s != ord('\\n')]",
"[s == ord('.') for s in readline() if s != ord('\\n')]",
"in_map() for _ in range(H)",
"for _ in range(H)",
"_",
"range(H)",
"range",
"H",
"for _ in range(H)",
"in_map()",
"in_map",
"in_map2 = lambda H: [in_map() for _ in range(H)]",
"in_map2",
"lambda H: [in_map() for _ in range(H)]",
"[in_map() for _ in range(H)]",
"H",
"in_all = lambda: map(int, read().split())",
"in_all",
"lambda: map(int, read().split())",
"map(int, read().split())",
"map",
"int",
"read().split()",
"().split",
"()",
"read",
"split",
"def main():\n\n N, T = in_nn()\n A = in_nl()\n\n la = HeapSet()\n la.insert(A[0])\n\n min_sect = []\n ind_l = 0\n ind_r = 1\n pre_min = A[0]\n for i in range(N):\n min_a = la.get_min()\n if pre_min == min_a:\n ind_r = i + 1\n else:\n min_sect.append((pre_min, ind_l, ind_r))\n ind_l = i\n ind_r = i + 1\n\n pre_min = min_a\n if i + 1 < N:\n la.insert(A[i + 1])\n else:\n min_sect.append((min_a, ind_l, ind_r))\n\n max_benefit = -1\n ans = 0\n for min_a, l, r in min_sect:\n min_a = min(A[l:r])\n max_a = max(A[l:r])\n min_cnt = A[l:r].count(min_a)\n max_cnt = A[l:r].count(max_a)\n if max_a - min_a > max_benefit:\n max_benefit = max_a - min_a\n ans = min(max_cnt, min_cnt)\n elif max_a - min_a == max_benefit:\n ans += min(max_cnt, min_cnt)\n\n print(ans)",
"main",
"N, T = in_nn()",
"N",
"in_nn()",
"in_nn",
"T",
"A = in_nl()",
"A",
"in_nl()",
"in_nl",
"la = HeapSet()",
"la",
"HeapSet()",
"HeapSet",
"la.insert(A[0])",
"la.insert",
"la",
"insert",
"A[0]",
"A",
"0",
"min_sect = []",
"min_sect",
"[]",
"ind_l = 0",
"ind_l",
"0",
"ind_r = 1",
"ind_r",
"1",
"pre_min = A[0]",
"pre_min",
"A[0]",
"A",
"0",
"for i in range(N):\n min_a = la.get_min()\n if pre_min == min_a:\n ind_r = i + 1\n else:\n min_sect.append((pre_min, ind_l, ind_r))\n ind_l = i\n ind_r = i + 1\n\n pre_min = min_a\n if i + 1 < N:\n la.insert(A[i + 1])\n else:\n min_sect.append((min_a, ind_l, ind_r))\n\n ",
"i",
"range(N)",
"range",
"N",
"min_a = la.get_min()",
"min_a",
"la.get_min()",
"la.get_min",
"la",
"get_min",
"if pre_min == min_a:\n ind_r = i + 1\n else:\n min_sect.append((pre_min, ind_l, ind_r))\n ind_l = i\n ind_r = i + 1\n\n ",
"pre_min == min_a",
"pre_min",
"min_a",
"ind_r = i + 1",
"ind_r",
"i + 1",
"i",
"1",
"min_sect.append((pre_min, ind_l, ind_r))",
"min_sect.append",
"min_sect",
"append",
"(pre_min, ind_l, ind_r)",
"pre_min",
"ind_l",
"ind_r",
"ind_l = i",
"ind_l",
"i",
"ind_r = i + 1",
"ind_r",
"i + 1",
"i",
"1",
"pre_min = min_a",
"pre_min",
"min_a",
"if i + 1 < N:\n la.insert(A[i + 1])\n ",
"i + 1 < N",
"i + 1",
"i",
"1",
"N",
"la.insert(A[i + 1])",
"la.insert",
"la",
"insert",
"A[i + 1]",
"A",
"i + 1",
"i",
"1",
"min_sect.append((min_a, ind_l, ind_r))",
"min_sect.append",
"min_sect",
"append",
"(min_a, ind_l, ind_r)",
"min_a",
"ind_l",
"ind_r",
"max_benefit = -1",
"max_benefit",
"-1",
"ans = 0",
"ans",
"0",
"for min_a, l, r in min_sect:\n min_a = min(A[l:r])\n max_a = max(A[l:r])\n min_cnt = A[l:r].count(min_a)\n max_cnt = A[l:r].count(max_a)\n if max_a - min_a > max_benefit:\n max_benefit = max_a - min_a\n ans = min(max_cnt, min_cnt)\n elif max_a - min_a == max_benefit:\n ans += min(max_cnt, min_cnt)\n\n ",
"min_a",
"l",
"r",
"min_sect",
"min_a = min(A[l:r])",
"min_a",
"min(A[l:r])",
"min",
"A[l:r]",
"A",
"l:r",
"l",
"r",
"max_a = max(A[l:r])",
"max_a",
"max(A[l:r])",
"max",
"A[l:r]",
"A",
"l:r",
"l",
"r",
"min_cnt = A[l:r].count(min_a)",
"min_cnt",
"A[l:r].count(min_a)",
"[l:r].count",
"[l:r]",
"A",
"l:r",
"l",
"r",
"count",
"min_a",
"max_cnt = A[l:r].count(max_a)",
"max_cnt",
"A[l:r].count(max_a)",
"[l:r].count",
"[l:r]",
"A",
"l:r",
"l",
"r",
"count",
"max_a",
"if max_a - min_a > max_benefit:\n max_benefit = max_a - min_a\n ans = min(max_cnt, min_cnt)\n elif max_a - min_a == max_benefit:\n ans += min(max_cnt, min_cnt)\n\n ",
"max_a - min_a > max_benefit",
"max_a - min_a",
"max_a",
"min_a",
"max_benefit",
"max_benefit = max_a - min_a",
"max_benefit",
"max_a - min_a",
"max_a",
"min_a",
"ans = min(max_cnt, min_cnt)",
"ans",
"min(max_cnt, min_cnt)",
"min",
"max_cnt",
"min_cnt",
"elif max_a - min_a == max_benefit:\n ans += min(max_cnt, min_cnt)\n\n ",
"max_a - min_a == max_benefit",
"max_a - min_a",
"max_a",
"min_a",
"max_benefit",
"ans += min(max_cnt, min_cnt)",
"ans",
"min(max_cnt, min_cnt)",
"min",
"max_cnt",
"min_cnt",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"in_map2 = lambda H: [in_map() for _ in range(H)]",
"lambda H: [in_map() for _ in range(H)]",
"in_map2",
"readlines = sys.stdin.buffer.readlines",
"sys.stdin.buffer.readlines",
"readlines",
"def main():\n\n N, T = in_nn()\n A = in_nl()\n\n la = HeapSet()\n la.insert(A[0])\n\n min_sect = []\n ind_l = 0\n ind_r = 1\n pre_min = A[0]\n for i in range(N):\n min_a = la.get_min()\n if pre_min == min_a:\n ind_r = i + 1\n else:\n min_sect.append((pre_min, ind_l, ind_r))\n ind_l = i\n ind_r = i + 1\n\n pre_min = min_a\n if i + 1 < N:\n la.insert(A[i + 1])\n else:\n min_sect.append((min_a, ind_l, ind_r))\n\n max_benefit = -1\n ans = 0\n for min_a, l, r in min_sect:\n min_a = min(A[l:r])\n max_a = max(A[l:r])\n min_cnt = A[l:r].count(min_a)\n max_cnt = A[l:r].count(max_a)\n if max_a - min_a > max_benefit:\n max_benefit = max_a - min_a\n ans = min(max_cnt, min_cnt)\n elif max_a - min_a == max_benefit:\n ans += min(max_cnt, min_cnt)\n\n print(ans)",
"def main():\n\n N, T = in_nn()\n A = in_nl()\n\n la = HeapSet()\n la.insert(A[0])\n\n min_sect = []\n ind_l = 0\n ind_r = 1\n pre_min = A[0]\n for i in range(N):\n min_a = la.get_min()\n if pre_min == min_a:\n ind_r = i + 1\n else:\n min_sect.append((pre_min, ind_l, ind_r))\n ind_l = i\n ind_r = i + 1\n\n pre_min = min_a\n if i + 1 < N:\n la.insert(A[i + 1])\n else:\n min_sect.append((min_a, ind_l, ind_r))\n\n max_benefit = -1\n ans = 0\n for min_a, l, r in min_sect:\n min_a = min(A[l:r])\n max_a = max(A[l:r])\n min_cnt = A[l:r].count(min_a)\n max_cnt = A[l:r].count(max_a)\n if max_a - min_a > max_benefit:\n max_benefit = max_a - min_a\n ans = min(max_cnt, min_cnt)\n elif max_a - min_a == max_benefit:\n ans += min(max_cnt, min_cnt)\n\n print(ans)",
"main",
"in_all = lambda: map(int, read().split())",
"lambda: map(int, read().split())",
"in_all",
"in_nl2 = lambda H: [in_nl() for _ in range(H)]",
"lambda H: [in_nl() for _ in range(H)]",
"in_nl2",
"in_nn = lambda: map(int, readline().split())",
"lambda: map(int, readline().split())",
"in_nn",
"in_map = lambda: [s == ord('.') for s in readline() if s != ord('\\n')]",
"lambda: [s == ord('.') for s in readline() if s != ord('\\n')]",
"in_map",
"class HeapSet:\n def __init__(self):\n self.minQue = []\n self.maxQue = []\n self.counter = defaultdict(lambda: 0)\n\n def insert(self, x):\n heappush(self.minQue, x)\n heappush(self.maxQue, -x)\n self.counter[x] += 1\n\n def delete(self, x):\n self.counter[x] = max(0, self.counter[x] - 1)\n\n def get_max(self):\n while self.maxQue and self.counter[-self.maxQue[0]] == 0:\n heappop(self.maxQue)\n return -self.maxQue[0] if self.maxQue else None\n\n def get_min(self):\n while self.minQue and self.counter[self.minQue[0]] == 0:\n heappop(self.minQue)\n return self.minQue[0] if self.minQue else None",
"class HeapSet:\n def __init__(self):\n self.minQue = []\n self.maxQue = []\n self.counter = defaultdict(lambda: 0)\n\n def insert(self, x):\n heappush(self.minQue, x)\n heappush(self.maxQue, -x)\n self.counter[x] += 1\n\n def delete(self, x):\n self.counter[x] = max(0, self.counter[x] - 1)\n\n def get_max(self):\n while self.maxQue and self.counter[-self.maxQue[0]] == 0:\n heappop(self.maxQue)\n return -self.maxQue[0] if self.maxQue else None\n\n def get_min(self):\n while self.minQue and self.counter[self.minQue[0]] == 0:\n heappop(self.minQue)\n return self.minQue[0] if self.minQue else None",
"HeapSet",
"in_s = lambda: readline().rstrip().decode('utf-8')",
"lambda: readline().rstrip().decode('utf-8')",
"in_s",
"readline = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"readline",
"in_nl = lambda: list(map(int, readline().split()))",
"lambda: list(map(int, readline().split()))",
"in_nl",
"in_n = lambda: int(readline())",
"lambda: int(readline())",
"in_n",
"read = sys.stdin.buffer.read",
"sys.stdin.buffer.read",
"read"
] |
import sys
from heapq import heappush, heappop
from collections import defaultdict
class HeapSet:
def __init__(self):
self.minQue = []
self.maxQue = []
self.counter = defaultdict(lambda: 0)
def insert(self, x):
heappush(self.minQue, x)
heappush(self.maxQue, -x)
self.counter[x] += 1
def delete(self, x):
self.counter[x] = max(0, self.counter[x] - 1)
def get_max(self):
while self.maxQue and self.counter[-self.maxQue[0]] == 0:
heappop(self.maxQue)
return -self.maxQue[0] if self.maxQue else None
def get_min(self):
while self.minQue and self.counter[self.minQue[0]] == 0:
heappop(self.minQue)
return self.minQue[0] if self.minQue else None
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())
def main():
N, T = in_nn()
A = in_nl()
la = HeapSet()
la.insert(A[0])
min_sect = []
ind_l = 0
ind_r = 1
pre_min = A[0]
for i in range(N):
min_a = la.get_min()
if pre_min == min_a:
ind_r = i + 1
else:
min_sect.append((pre_min, ind_l, ind_r))
ind_l = i
ind_r = i + 1
pre_min = min_a
if i + 1 < N:
la.insert(A[i + 1])
else:
min_sect.append((min_a, ind_l, ind_r))
max_benefit = -1
ans = 0
for min_a, l, r in min_sect:
min_a = min(A[l:r])
max_a = max(A[l:r])
min_cnt = A[l:r].count(min_a)
max_cnt = A[l:r].count(max_a)
if max_a - min_a > max_benefit:
max_benefit = max_a - min_a
ans = min(max_cnt, min_cnt)
elif max_a - min_a == max_benefit:
ans += min(max_cnt, min_cnt)
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,
18,
13,
39,
28,
13,
4,
13,
4,
13,
2,
13,
17,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
4,
13,
13,
13,
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,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13
] |
[
[
123,
2
],
[
123,
11
],
[
111,
13
],
[
126,
25
],
[
112,
27
],
[
31,
30
],
[
121,
36
],
[
42,
39
],
[
127,
40
],
[
30,
41
],
[
39,
44
],
[
127,
45
],
[
30,
46
],
[
127,
48
],
[
30,
50
],
[
129,
53
],
[
57,
56
],
[
121,
60
],
[
117,
63
],
[
127,
66
],
[
56,
68
],
[
112,
71
],
[
56,
72
],
[
138,
74
],
[
130,
77
],
[
139,
77
],
[
118,
78
],
[
132,
80
],
[
84,
83
],
[
121,
87
],
[
135,
90
],
[
127,
93
],
[
83,
95
],
[
112,
98
],
[
83,
99
],
[
136,
102
],
[
118,
102
],
[
139,
103
],
[
130,
103
],
[
114,
105
],
[
115,
109
],
[
133,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
123,
121
],
[
123,
124
],
[
126,
127
],
[
129,
130
],
[
132,
133
],
[
135,
136
],
[
138,
139
]
] |
[
"N,T=map(int,input().split())\nalist=list(map(int,input().split()))\n#print(alist)\n\narlist=alist[:]\nfor i in reversed(range(N-1)):\n arlist[i]=max(arlist[i],arlist[i+1]) \n#print(arlist)\n\nmax_diff=0\nfor i in range(N-1):\n diff=arlist[i+1]-alist[i]\n max_diff=max(max_diff,diff)\n\nmax_diff_cnt=0\nfor i in range(N-1):\n diff=arlist[i+1]-alist[i]\n if diff==max_diff:\n max_diff_cnt+=1\n#print(max_diff,max_diff_cnt)\n\nprint(max_diff_cnt)",
"N,T=map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"alist=list(map(int,input().split()))",
"alist",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"arlist=alist[:]",
"arlist",
"alist[:]",
"alist",
":",
"for i in reversed(range(N-1)):\n arlist[i]=max(arlist[i],arlist[i+1]) \n#print(arlist)",
"i",
"reversed(range(N-1))",
"reversed",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"arlist[i]=max(arlist[i],arlist[i+1])",
"arlist[i]",
"arlist",
"i",
"max(arlist[i],arlist[i+1])",
"max",
"arlist[i]",
"arlist",
"i",
"arlist[i+1]",
"arlist",
"i+1",
"i",
"1",
"max_diff=0",
"max_diff",
"0",
"for i in range(N-1):\n diff=arlist[i+1]-alist[i]\n max_diff=max(max_diff,diff)",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"diff=arlist[i+1]-alist[i]",
"diff",
"arlist[i+1]-alist[i]",
"arlist[i+1]",
"arlist",
"i+1",
"i",
"1",
"alist[i]",
"alist",
"i",
"max_diff=max(max_diff,diff)",
"max_diff",
"max(max_diff,diff)",
"max",
"max_diff",
"diff",
"max_diff_cnt=0",
"max_diff_cnt",
"0",
"for i in range(N-1):\n diff=arlist[i+1]-alist[i]\n if diff==max_diff:\n max_diff_cnt+=1\n#print(max_diff,max_diff_cnt)",
"i",
"range(N-1)",
"range",
"N-1",
"N",
"1",
"diff=arlist[i+1]-alist[i]",
"diff",
"arlist[i+1]-alist[i]",
"arlist[i+1]",
"arlist",
"i+1",
"i",
"1",
"alist[i]",
"alist",
"i",
"if diff==max_diff:\n max_diff_cnt+=1\n#print(max_diff,max_diff_cnt)",
"diff==max_diff",
"diff",
"max_diff",
"max_diff_cnt+=1",
"max_diff_cnt",
"1",
"print(max_diff_cnt)",
"print",
"max_diff_cnt",
"alist=list(map(int,input().split()))",
"list(map(int,input().split()))",
"alist",
"max_diff_cnt+=1",
"1",
"max_diff_cnt",
"diff=arlist[i+1]-alist[i]",
"arlist[i+1]-alist[i]",
"diff",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"arlist=alist[:]",
"alist[:]",
"arlist",
"max_diff=0",
"0",
"max_diff",
"max_diff_cnt=0",
"0",
"max_diff_cnt",
"diff=arlist[i+1]-alist[i]",
"arlist[i+1]-alist[i]",
"diff",
"max_diff=max(max_diff,diff)",
"max(max_diff,diff)",
"max_diff"
] |
N,T=map(int,input().split())
alist=list(map(int,input().split()))
#print(alist)
arlist=alist[:]
for i in reversed(range(N-1)):
arlist[i]=max(arlist[i],arlist[i+1])
#print(arlist)
max_diff=0
for i in range(N-1):
diff=arlist[i+1]-alist[i]
max_diff=max(max_diff,diff)
max_diff_cnt=0
for i in range(N-1):
diff=arlist[i+1]-alist[i]
if diff==max_diff:
max_diff_cnt+=1
#print(max_diff,max_diff_cnt)
print(max_diff_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,
18,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
18,
13,
39,
17,
0,
13,
4,
13,
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,
14,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
17,
13
] |
[
[
103,
2
],
[
103,
11
],
[
106,
13
],
[
97,
25
],
[
107,
27
],
[
118,
30
],
[
109,
33
],
[
94,
36
],
[
40,
39
],
[
107,
41
],
[
100,
45
],
[
98,
48
],
[
101,
48
],
[
39,
49
],
[
124,
51
],
[
39,
52
],
[
119,
55
],
[
116,
55
],
[
125,
57
],
[
101,
58
],
[
98,
58
],
[
115,
60
],
[
125,
62
],
[
101,
63
],
[
98,
63
],
[
127,
65
],
[
119,
69
],
[
116,
69
],
[
125,
71
],
[
101,
72
],
[
98,
72
],
[
112,
76
],
[
121,
79
],
[
88,
82
],
[
113,
86
],
[
128,
86
],
[
95,
86
],
[
88,
89
],
[
103,
92
],
[
94,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
39,
124
],
[
124,
125
],
[
127,
128
]
] |
[
"n,t=map(int,input().split())\nl=list(map(int,input().split()))\nmi=l[0]\nri=0\nt=0\nans=0\nfor i in l[1:]:\n mi=min(mi,i)\n ma=i \n if ri<ma-mi:\n ri=ma-mi\n ans=1\n elif ri==ma-mi:\n if t:\n ans+=1\n t=0\n else:\n t=1\nprint(ans)",
"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",
"mi=l[0]",
"mi",
"l[0]",
"l",
"0",
"ri=0",
"ri",
"0",
"t=0",
"t",
"0",
"ans=0",
"ans",
"0",
"for i in l[1:]:\n mi=min(mi,i)\n ma=i \n if ri<ma-mi:\n ri=ma-mi\n ans=1\n elif ri==ma-mi:\n if t:\n ans+=1\n t=0\n else:\n t=1",
"i",
"l[1:]",
"l",
"1:",
"1",
"mi=min(mi,i)",
"mi",
"min(mi,i)",
"min",
"mi",
"i",
"ma=i",
"ma",
"i",
"if ri<ma-mi:\n ri=ma-mi\n ans=1\n elif ri==ma-mi:\n if t:\n ans+=1\n t=0\n else:\n t=1",
"ri<ma-mi",
"ri",
"ma-mi",
"ma",
"mi",
"ri=ma-mi",
"ri",
"ma-mi",
"ma",
"mi",
"ans=1",
"ans",
"1",
"elif ri==ma-mi:\n if t:\n ans+=1\n t=0\n ",
"ri==ma-mi",
"ri",
"ma-mi",
"ma",
"mi",
"if t:\n ans+=1\n t=0\n ",
"t",
"ans+=1",
"ans",
"1",
"t=0",
"t",
"0",
"t=1",
"t",
"1",
"print(ans)",
"print",
"ans",
"t=1",
"1",
"t",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"ans=0",
"0",
"ans",
"mi=l[0]",
"l[0]",
"mi",
"mi=min(mi,i)",
"min(mi,i)",
"mi",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"l=list(map(int,input().split()))",
"list(map(int,input().split()))",
"l",
"t=0",
"0",
"t",
"ans+=1",
"1",
"ans",
"ri=ma-mi",
"ma-mi",
"ri",
"ri=0",
"0",
"ri",
"t=0",
"0",
"t",
"ma=i",
"i",
"ma",
"ans=1",
"1",
"ans"
] |
n,t=map(int,input().split())
l=list(map(int,input().split()))
mi=l[0]
ri=0
t=0
ans=0
for i in l[1:]:
mi=min(mi,i)
ma=i
if ri<ma-mi:
ri=ma-mi
ans=1
elif ri==ma-mi:
if t:
ans+=1
t=0
else:
t=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,
17,
0,
13,
39,
0,
13,
4,
13,
39,
0,
13,
4,
13,
39,
28,
13,
4,
13,
17,
4,
13,
13,
0,
13,
2,
2,
4,
13,
13,
13,
17,
14,
2,
13,
18,
13,
2,
13,
17,
0,
13,
18,
13,
2,
13,
17,
0,
13,
39,
2,
13,
17,
14,
2,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
2,
13,
17,
14,
2,
2,
13,
18,
13,
13,
13,
0,
13,
2,
13,
18,
13,
13,
0,
13,
4,
13,
39,
13,
0,
13,
4,
13,
13,
14,
2,
2,
13,
18,
13,
13,
13,
4,
18,
13,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
13,
4,
13,
4,
13,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13
] |
[
[
167,
2
],
[
167,
11
],
[
155,
13
],
[
173,
25
],
[
158,
28
],
[
194,
31
],
[
179,
34
],
[
197,
39
],
[
45,
44
],
[
156,
50
],
[
161,
52
],
[
156,
57
],
[
44,
58
],
[
159,
62
],
[
186,
62
],
[
156,
64
],
[
162,
66
],
[
185,
69
],
[
156,
71
],
[
162,
73
],
[
176,
76
],
[
162,
79
],
[
159,
83
],
[
186,
83
],
[
156,
85
],
[
162,
87
],
[
195,
91
],
[
177,
91
],
[
162,
94
],
[
186,
99
],
[
159,
99
],
[
156,
101
],
[
162,
102
],
[
174,
103
],
[
192,
103
],
[
191,
105
],
[
186,
107
],
[
159,
107
],
[
156,
109
],
[
162,
110
],
[
188,
112
],
[
182,
118
],
[
177,
121
],
[
195,
121
],
[
186,
125
],
[
159,
125
],
[
156,
127
],
[
162,
128
],
[
174,
129
],
[
192,
129
],
[
180,
132
],
[
189,
132
],
[
162,
134
],
[
170,
136
],
[
177,
139
],
[
195,
139
],
[
189,
148
],
[
180,
148
],
[
171,
153
],
[
183,
153
],
[
198,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
167,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
176,
177
],
[
179,
180
],
[
182,
183
],
[
185,
186
],
[
188,
189
],
[
191,
192
],
[
194,
195
],
[
197,
198
]
] |
[
"n,t=map(int,input().split())\na=list(map(int,input().split()))\n\n\ndiff_v=0\nmax_a_v=0\nmax_a_pos=[]\naa=set([])\nbb=set([])\n\nfor i in range(1,len(a)):\n index=len(a)-i-1\n if max_a_v<a[index+1]:\n max_a_v=a[index+1]\n max_a_pos=[index+1]\n elif max_a_v==a[index+1]:\n max_a_pos.append(index+1)\n\n if max_a_v-a[index]>diff_v:\n diff_v=max_a_v-a[index]\n aa=set([index])\n bb=set(max_a_pos)\n elif max_a_v-a[index]==diff_v:\n aa.add(index)\n bb|=set(max_a_pos)\n #print(a[index],max_a_v,diff_v,aa,bb)\n\nprint(min(len(list(aa)),len(list(bb))))\n\n\n \n\n \n\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",
"diff_v=0",
"diff_v",
"0",
"max_a_v=0",
"max_a_v",
"0",
"max_a_pos=[]",
"max_a_pos",
"[]",
"aa=set([])",
"aa",
"set([])",
"set",
"[]",
"bb=set([])",
"bb",
"set([])",
"set",
"[]",
"for i in range(1,len(a)):\n index=len(a)-i-1\n if max_a_v<a[index+1]:\n max_a_v=a[index+1]\n max_a_pos=[index+1]\n elif max_a_v==a[index+1]:\n max_a_pos.append(index+1)\n\n if max_a_v-a[index]>diff_v:\n diff_v=max_a_v-a[index]\n aa=set([index])\n bb=set(max_a_pos)\n elif max_a_v-a[index]==diff_v:\n aa.add(index)\n bb|=set(max_a_pos)\n #print(a[index],max_a_v,diff_v,aa,bb)",
"i",
"range(1,len(a))",
"range",
"1",
"len(a)",
"len",
"a",
"index=len(a)-i-1",
"index",
"len(a)-i-1",
"len(a)-i",
"len(a)",
"len",
"a",
"i",
"1",
"if max_a_v<a[index+1]:\n max_a_v=a[index+1]\n max_a_pos=[index+1]\n elif max_a_v==a[index+1]:\n max_a_pos.append(index+1)\n\n ",
"max_a_v<a[index+1]",
"max_a_v",
"a[index+1]",
"a",
"index+1",
"index",
"1",
"max_a_v=a[index+1]",
"max_a_v",
"a[index+1]",
"a",
"index+1",
"index",
"1",
"max_a_pos=[index+1]",
"max_a_pos",
"[index+1]",
"index+1",
"index",
"1",
"elif max_a_v==a[index+1]:\n max_a_pos.append(index+1)\n\n ",
"max_a_v==a[index+1]",
"max_a_v",
"a[index+1]",
"a",
"index+1",
"index",
"1",
"max_a_pos.append(index+1)",
"max_a_pos.append",
"max_a_pos",
"append",
"index+1",
"index",
"1",
"if max_a_v-a[index]>diff_v:\n diff_v=max_a_v-a[index]\n aa=set([index])\n bb=set(max_a_pos)\n elif max_a_v-a[index]==diff_v:\n aa.add(index)\n bb|=set(max_a_pos)\n #print(a[index],max_a_v,diff_v,aa,bb)",
"max_a_v-a[index]>diff_v",
"max_a_v-a[index]",
"max_a_v",
"a[index]",
"a",
"index",
"diff_v",
"diff_v=max_a_v-a[index]",
"diff_v",
"max_a_v-a[index]",
"max_a_v",
"a[index]",
"a",
"index",
"aa=set([index])",
"aa",
"set([index])",
"set",
"[index]",
"index",
"bb=set(max_a_pos)",
"bb",
"set(max_a_pos)",
"set",
"max_a_pos",
"elif max_a_v-a[index]==diff_v:\n aa.add(index)\n bb|=set(max_a_pos)\n #print(a[index],max_a_v,diff_v,aa,bb)",
"max_a_v-a[index]==diff_v",
"max_a_v-a[index]",
"max_a_v",
"a[index]",
"a",
"index",
"diff_v",
"aa.add(index)",
"aa.add",
"aa",
"add",
"index",
"bb|=set(max_a_pos)",
"bb",
"set(max_a_pos)",
"set",
"max_a_pos",
"print(min(len(list(aa)),len(list(bb))))",
"print",
"min(len(list(aa)),len(list(bb)))",
"min",
"len(list(aa))",
"len",
"list(aa)",
"list",
"aa",
"len(list(bb))",
"len",
"list(bb)",
"list",
"bb",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"max_a_v=0",
"0",
"max_a_v",
"index=len(a)-i-1",
"len(a)-i-1",
"index",
"n,t=map(int,input().split())",
"map(int,input().split())",
"n",
"t=map(int,input().split())",
"map(int,input().split())",
"t",
"bb|=set(max_a_pos)",
"set(max_a_pos)",
"bb",
"diff_v=0",
"0",
"diff_v",
"max_a_pos=[index+1]",
"[index+1]",
"max_a_pos",
"aa=set([])",
"set([])",
"aa",
"bb=set(max_a_pos)",
"set(max_a_pos)",
"bb",
"max_a_v=a[index+1]",
"a[index+1]",
"max_a_v",
"aa=set([index])",
"set([index])",
"aa",
"diff_v=max_a_v-a[index]",
"max_a_v-a[index]",
"diff_v",
"max_a_pos=[]",
"[]",
"max_a_pos",
"bb=set([])",
"set([])",
"bb"
] |
n,t=map(int,input().split())
a=list(map(int,input().split()))
diff_v=0
max_a_v=0
max_a_pos=[]
aa=set([])
bb=set([])
for i in range(1,len(a)):
index=len(a)-i-1
if max_a_v<a[index+1]:
max_a_v=a[index+1]
max_a_pos=[index+1]
elif max_a_v==a[index+1]:
max_a_pos.append(index+1)
if max_a_v-a[index]>diff_v:
diff_v=max_a_v-a[index]
aa=set([index])
bb=set(max_a_pos)
elif max_a_v-a[index]==diff_v:
aa.add(index)
bb|=set(max_a_pos)
#print(a[index],max_a_v,diff_v,aa,bb)
print(min(len(list(aa)),len(list(bb))))
|
[
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,
4,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
13,
4,
13,
4,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] |
[
[
79,
2
],
[
79,
11
],
[
70,
13
],
[
76,
25
],
[
68,
29
],
[
73,
31
],
[
37,
36
],
[
68,
39
],
[
82,
41
],
[
74,
44
],
[
83,
44
],
[
71,
46
],
[
36,
47
],
[
52,
49
],
[
77,
50
],
[
36,
51
],
[
71,
54
],
[
36,
55
],
[
83,
56
],
[
74,
56
],
[
77,
61
],
[
77,
65
],
[
79,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
]
] |
[
"n,t = map(int,input().split())\na = list(map(int,input().split()))\nans = [0]*n\nflag = float(\"inf\")\nfor i in range(n):\n flag = min(flag,a[i])\n ans[i] = a[i]-flag\nprint(ans.count(max(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",
"ans = [0]*n",
"ans",
"[0]*n",
"[0]",
"0",
"n",
"flag = float(\"inf\")",
"flag",
"float(\"inf\")",
"float",
"\"inf\"",
"for i in range(n):\n flag = min(flag,a[i])\n ans[i] = a[i]-flag",
"i",
"range(n)",
"range",
"n",
"flag = min(flag,a[i])",
"flag",
"min(flag,a[i])",
"min",
"flag",
"a[i]",
"a",
"i",
"ans[i] = a[i]-flag",
"ans[i]",
"ans",
"i",
"a[i]-flag",
"a[i]",
"a",
"i",
"flag",
"print(ans.count(max(ans)))",
"print",
"ans.count(max(ans))",
"ans.count",
"ans",
"count",
"max(ans)",
"max",
"ans",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"flag = float(\"inf\")",
"float(\"inf\")",
"flag",
"ans = [0]*n",
"[0]*n",
"ans",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"flag = min(flag,a[i])",
"min(flag,a[i])",
"flag"
] |
n,t = map(int,input().split())
a = list(map(int,input().split()))
ans = [0]*n
flag = float("inf")
for i in range(n):
flag = min(flag,a[i])
ans[i] = a[i]-flag
print(ans.count(max(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,
4,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
13,
4,
18,
13,
13,
13,
0,
13,
39,
28,
13,
13,
4,
13,
13,
13,
4,
18,
13,
13,
2,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
13,
13,
18,
13,
17,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13
] |
[
[
90,
2
],
[
90,
11
],
[
78,
13
],
[
96,
25
],
[
99,
28
],
[
34,
33
],
[
79,
33
],
[
81,
36
],
[
33,
39
],
[
100,
40
],
[
82,
40
],
[
97,
43
],
[
82,
45
],
[
100,
45
],
[
84,
47
],
[
79,
54
],
[
97,
55
],
[
85,
58
],
[
93,
64
],
[
85,
67
],
[
94,
72
],
[
85,
72
],
[
94,
75
],
[
85,
75
],
[
78,
79
],
[
81,
82
],
[
84,
85
],
[
90,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
]
] |
[
"n,t = map(int,input().split())\nal = list(map(int,input().split()))\n\nbl = []\n\nmin_a = float(\"inf\")\nfor a in al:\n min_a = min(a, min_a)\n bl.append(min_a)\n\ncl = []\n\nfor a,b in zip(al, bl):\n cl.append(a-b)\n\ncl = sorted(cl)\n\nprint(cl.count(cl[-1]))",
"n,t = map(int,input().split())",
"n",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t",
"al = list(map(int,input().split()))",
"al",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"bl = []",
"bl",
"[]",
"min_a = float(\"inf\")",
"min_a",
"float(\"inf\")",
"float",
"\"inf\"",
"for a in al:\n min_a = min(a, min_a)\n bl.append(min_a)",
"a",
"al",
"min_a = min(a, min_a)",
"min_a",
"min(a, min_a)",
"min",
"a",
"min_a",
"bl.append(min_a)",
"bl.append",
"bl",
"append",
"min_a",
"cl = []",
"cl",
"[]",
"for a,b in zip(al, bl):\n cl.append(a-b)",
"a",
"b",
"zip(al, bl)",
"zip",
"al",
"bl",
"cl.append(a-b)",
"cl.append",
"cl",
"append",
"a-b",
"a",
"b",
"cl = sorted(cl)",
"cl",
"sorted(cl)",
"sorted",
"cl",
"print(cl.count(cl[-1]))",
"print",
"cl.count(cl[-1])",
"cl.count",
"cl",
"count",
"cl[-1]",
"cl",
"-1",
"al = list(map(int,input().split()))",
"list(map(int,input().split()))",
"al",
"min_a = min(a, min_a)",
"min(a, min_a)",
"min_a",
"cl = []",
"[]",
"cl",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"cl = sorted(cl)",
"sorted(cl)",
"cl",
"bl = []",
"[]",
"bl",
"min_a = float(\"inf\")",
"float(\"inf\")",
"min_a"
] |
n,t = map(int,input().split())
al = list(map(int,input().split()))
bl = []
min_a = float("inf")
for a in al:
min_a = min(a, min_a)
bl.append(min_a)
cl = []
for a,b in zip(al, bl):
cl.append(a-b)
cl = sorted(cl)
print(cl.count(cl[-1]))
|
[
7,
0,
13,
4,
13,
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,
13,
13,
0,
13,
13,
28,
13,
13,
4,
13,
13,
0,
13,
4,
13,
13,
13,
0,
18,
13,
13,
13,
0,
13,
2,
39,
40,
13,
13,
0,
13,
40,
13,
28,
13,
13,
4,
13,
18,
13,
39,
17,
0,
13,
4,
13,
13,
13,
0,
18,
13,
13,
13,
4,
18,
13,
13,
0,
13,
17,
28,
13,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
2,
13,
13,
0,
13,
17,
28,
13,
13,
4,
13,
13,
13,
14,
40,
2,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13,
10,
40,
13,
10,
13,
13,
10,
17,
13,
10,
2,
13
] |
[
[
143,
2
],
[
140,
7
],
[
140,
16
],
[
155,
18
],
[
158,
30
],
[
132,
34
],
[
164,
36
],
[
144,
37
],
[
156,
43
],
[
149,
45
],
[
165,
48
],
[
150,
48
],
[
54,
51
],
[
159,
52
],
[
150,
54
],
[
165,
54
],
[
170,
56
],
[
144,
60
],
[
132,
61
],
[
161,
63
],
[
144,
65
],
[
156,
72
],
[
137,
76
],
[
162,
79
],
[
138,
79
],
[
85,
82
],
[
171,
83
],
[
138,
85
],
[
162,
85
],
[
171,
88
],
[
152,
91
],
[
159,
98
],
[
171,
99
],
[
134,
101
],
[
153,
104
],
[
135,
104
],
[
138,
106
],
[
162,
106
],
[
150,
107
],
[
165,
107
],
[
167,
109
],
[
156,
116
],
[
171,
117
],
[
135,
122
],
[
153,
122
],
[
138,
123
],
[
162,
123
],
[
146,
125
],
[
147,
129
],
[
168,
129
],
[
140,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
],
[
146,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
144,
164
],
[
164,
165
],
[
167,
168
],
[
170,
171
]
] |
[
"inf = float('inf')\n\nN, T = map(int, input().split())\nA = list(map(int, input().split()))\n\ncm = [inf] * N\nm = inf\nfor i, a in enumerate(A):\n m = min(m, a)\n cm[i] = m\n\ncM = [-inf] * N\nM = -inf\nfor i, a in enumerate(A[::-1]):\n M = max(M, a)\n cM[i] = M\ncM.reverse()\n\ndiff = 0\nfor m, M in zip(cm, cM):\n diff = max(diff, M - m)\n\nans = 0\nfor a, M in zip(A, cM):\n if a + diff <= M:\n ans += 1\nprint(ans)",
"inf = float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"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",
"cm = [inf] * N",
"cm",
"[inf] * N",
"[inf]",
"inf",
"N",
"m = inf",
"m",
"inf",
"for i, a in enumerate(A):\n m = min(m, a)\n cm[i] = m",
"i",
"a",
"enumerate(A)",
"enumerate",
"A",
"m = min(m, a)",
"m",
"min(m, a)",
"min",
"m",
"a",
"cm[i] = m",
"cm[i]",
"cm",
"i",
"m",
"cM = [-inf] * N",
"cM",
"[-inf] * N",
"[-inf]",
"-inf",
"inf",
"N",
"M = -inf",
"M",
"-inf",
"inf",
"for i, a in enumerate(A[::-1]):\n M = max(M, a)\n cM[i] = M",
"i",
"a",
"enumerate(A[::-1])",
"enumerate",
"A[::-1]",
"A",
"::-1",
"-1",
"M = max(M, a)",
"M",
"max(M, a)",
"max",
"M",
"a",
"cM[i] = M",
"cM[i]",
"cM",
"i",
"M",
"cM.reverse()",
"cM.reverse",
"cM",
"reverse",
"diff = 0",
"diff",
"0",
"for m, M in zip(cm, cM):\n diff = max(diff, M - m)",
"m",
"M",
"zip(cm, cM)",
"zip",
"cm",
"cM",
"diff = max(diff, M - m)",
"diff",
"max(diff, M - m)",
"max",
"diff",
"M - m",
"M",
"m",
"ans = 0",
"ans",
"0",
"for a, M in zip(A, cM):\n if a + diff <= M:\n ans += 1",
"a",
"M",
"zip(A, cM)",
"zip",
"A",
"cM",
"if a + diff <= M:\n ans += 1",
"a + diff <= M",
"a + diff",
"a",
"diff",
"M",
"ans += 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"diff = max(diff, M - m)",
"max(diff, M - m)",
"diff",
"M = max(M, a)",
"max(M, a)",
"M",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"inf = float('inf')",
"float('inf')",
"inf",
"ans += 1",
"1",
"ans",
"m = min(m, a)",
"min(m, a)",
"m",
"diff = 0",
"0",
"diff",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"cm = [inf] * N",
"[inf] * N",
"cm",
"M = -inf",
"-inf",
"M",
"m = inf",
"inf",
"m",
"ans = 0",
"0",
"ans",
"cM = [-inf] * N",
"[-inf] * N",
"cM"
] |
inf = float('inf')
N, T = map(int, input().split())
A = list(map(int, input().split()))
cm = [inf] * N
m = inf
for i, a in enumerate(A):
m = min(m, a)
cm[i] = m
cM = [-inf] * N
M = -inf
for i, a in enumerate(A[::-1]):
M = max(M, a)
cM[i] = M
cM.reverse()
diff = 0
for m, M in zip(cm, cM):
diff = max(diff, M - m)
ans = 0
for a, M in zip(A, cM):
if a + diff <= M:
ans += 1
print(ans)
|
[
7,
15,
13,
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,
17,
0,
13,
39,
28,
13,
4,
13,
17,
13,
4,
18,
13,
13,
13,
39,
40,
18,
13,
13,
13,
0,
13,
2,
40,
18,
18,
13,
17,
17,
13,
0,
13,
39,
4,
18,
13,
13,
13,
39,
40,
13,
13,
18,
18,
13,
17,
17,
28,
13,
4,
13,
17,
2,
13,
17,
42,
40,
18,
18,
13,
17,
17,
13,
4,
18,
13,
13,
13,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
13,
14,
40,
13,
2,
40,
18,
18,
13,
17,
17,
13,
0,
13,
2,
40,
18,
18,
13,
17,
17,
13,
4,
18,
13,
13,
13,
39,
40,
13,
13,
18,
18,
13,
17,
17,
0,
13,
2,
39,
17,
13,
0,
13,
2,
39,
17,
13,
42,
13,
0,
13,
4,
18,
13,
13,
13,
14,
2,
40,
18,
13,
17,
13,
3,
14,
2,
18,
13,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
17,
14,
2,
18,
13,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
17,
14,
2,
18,
13,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
17,
14,
2,
18,
13,
18,
13,
17,
17,
0,
18,
13,
18,
13,
17,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
17,
18,
13,
13,
0,
13,
4,
13,
17,
18,
13,
13,
4,
13,
4,
13,
13,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
13,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13
] |
[
[
327,
4
],
[
327,
13
],
[
17,
16
],
[
16,
25
],
[
330,
27
],
[
342,
30
],
[
331,
32
],
[
333,
35
],
[
291,
38
],
[
42,
41
],
[
328,
45
],
[
292,
50
],
[
331,
54
],
[
41,
55
],
[
315,
58
],
[
292,
63
],
[
343,
66
],
[
318,
68
],
[
319,
74
],
[
316,
77
],
[
292,
81
],
[
86,
85
],
[
328,
90
],
[
292,
96
],
[
85,
99
],
[
292,
104
],
[
343,
107
],
[
325,
107
],
[
331,
109
],
[
85,
110
],
[
324,
112
],
[
331,
114
],
[
85,
115
],
[
321,
117
],
[
85,
118
],
[
316,
121
],
[
337,
121
],
[
292,
126
],
[
325,
129
],
[
343,
129
],
[
336,
131
],
[
292,
136
],
[
325,
139
],
[
343,
139
],
[
319,
144
],
[
337,
147
],
[
316,
147
],
[
292,
151
],
[
303,
155
],
[
328,
159
],
[
294,
161
],
[
328,
165
],
[
306,
169
],
[
319,
174
],
[
307,
179
],
[
337,
181
],
[
316,
181
],
[
304,
186
],
[
307,
188
],
[
197,
192
],
[
304,
193
],
[
307,
195
],
[
204,
199
],
[
295,
200
],
[
307,
202
],
[
295,
208
],
[
307,
210
],
[
219,
214
],
[
304,
215
],
[
307,
217
],
[
226,
221
],
[
295,
222
],
[
307,
224
],
[
304,
230
],
[
307,
232
],
[
241,
236
],
[
304,
237
],
[
307,
239
],
[
295,
245
],
[
307,
247
],
[
256,
251
],
[
295,
252
],
[
307,
254
],
[
339,
258
],
[
300,
261
],
[
265,
264
],
[
328,
267
],
[
297,
269
],
[
304,
274
],
[
264,
275
],
[
309,
277
],
[
295,
282
],
[
264,
283
],
[
298,
288
],
[
340,
288
],
[
310,
289
],
[
301,
289
],
[
291,
292
],
[
294,
295
],
[
297,
298
],
[
300,
301
],
[
303,
304
],
[
306,
307
],
[
309,
310
],
[
327,
313
],
[
315,
316
],
[
318,
319
],
[
85,
321
],
[
321,
322
],
[
324,
325
],
[
327,
328
],
[
330,
331
],
[
333,
334
],
[
336,
337
],
[
339,
340
],
[
342,
343
]
] |
[
"import heapq\n\nN,T = map(int, input().split())\nA = [int(a) for a in input().split()]\n\nl = A[0]\nl_idx = 0\nr = []\nfor i in range(1, N):\n heapq.heappush(r, (-A[i], i))\n\nb = -r[0][0] - l\nh = []\nheapq.heappush(h, (-b, l_idx, r[0][1]))\nfor i in range(1, N-1):\n while r[0][1] <= i:\n heapq.heappop(r)\n if l > A[i]:\n l = A[i]\n l_idx = i\n if b <= -r[0][0]-l:\n b = -r[0][0]-l\n heapq.heappush(h, (-b, l_idx, r[0][1]))\n \nused1 = [0]*N\nused2 = [0]*N\nwhile h:\n t = heapq.heappop(h)\n if -t[0] < b:\n break\n if used1[t[2]] == 1:\n used1[t[2]] = -1\n used2[t[2]] = -1\n if used2[t[1]] == 1:\n used1[t[1]] = -1\n used2[t[1]] = -1\n if used1[t[1]] == 0:\n used1[t[1]] = 1\n if used2[t[2]] == 0:\n used2[t[2]] = 1\n \ncnt1 = 0\ncnt2 = 0\nfor i in range(N):\n cnt1 += max(0, used1[i])\n cnt2 += max(0, used2[i])\n \nprint(min(cnt1, cnt2))",
"import heapq",
"heapq",
"N,T = map(int, input().split())",
"N",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"int(a) for a in input().split()",
"for a in input().split()",
"a",
"input().split()",
"().split",
"()",
"input",
"split",
"for a in input().split()",
"int(a)",
"int",
"a",
"A = [int(a) for a in input().split()]",
"A",
"[int(a) for a in input().split()]",
"l = A[0]",
"l",
"A[0]",
"A",
"0",
"l_idx = 0",
"l_idx",
"0",
"r = []",
"r",
"[]",
"for i in range(1, N):\n heapq.heappush(r, (-A[i], i))",
"i",
"range(1, N)",
"range",
"1",
"N",
"heapq.heappush(r, (-A[i], i))",
"heapq.heappush",
"heapq",
"heappush",
"r",
"(-A[i], i)",
"-A[i]",
"A[i]",
"A",
"i",
"i",
"b = -r[0][0] - l",
"b",
"-r[0][0] - l",
"-r[0][0]",
"r[0][0]",
"[0]",
"r",
"0",
"0",
"l",
"h = []",
"h",
"[]",
"heapq.heappush(h, (-b, l_idx, r[0][1]))",
"heapq.heappush",
"heapq",
"heappush",
"h",
"(-b, l_idx, r[0][1])",
"-b",
"b",
"l_idx",
"r[0][1]",
"[0]",
"r",
"0",
"1",
"for i in range(1, N-1):\n while r[0][1] <= i:\n heapq.heappop(r)\n if l > A[i]:\n l = A[i]\n l_idx = i\n if b <= -r[0][0]-l:\n b = -r[0][0]-l\n heapq.heappush(h, (-b, l_idx, r[0][1]))\n ",
"i",
"range(1, N-1)",
"range",
"1",
"N-1",
"N",
"1",
"while r[0][1] <= i:\n heapq.heappop(r)\n ",
"r[0][1] <= i",
"r[0][1]",
"[0]",
"r",
"0",
"1",
"i",
"heapq.heappop(r)",
"heapq.heappop",
"heapq",
"heappop",
"r",
"if l > A[i]:\n l = A[i]\n l_idx = i\n ",
"l > A[i]",
"l",
"A[i]",
"A",
"i",
"l = A[i]",
"l",
"A[i]",
"A",
"i",
"l_idx = i",
"l_idx",
"i",
"if b <= -r[0][0]-l:\n b = -r[0][0]-l\n heapq.heappush(h, (-b, l_idx, r[0][1]))\n ",
"b <= -r[0][0]-l",
"b",
"-r[0][0]-l",
"-r[0][0]",
"r[0][0]",
"[0]",
"r",
"0",
"0",
"l",
"b = -r[0][0]-l",
"b",
"-r[0][0]-l",
"-r[0][0]",
"r[0][0]",
"[0]",
"r",
"0",
"0",
"l",
"heapq.heappush(h, (-b, l_idx, r[0][1]))",
"heapq.heappush",
"heapq",
"heappush",
"h",
"(-b, l_idx, r[0][1])",
"-b",
"b",
"l_idx",
"r[0][1]",
"[0]",
"r",
"0",
"1",
"used1 = [0]*N",
"used1",
"[0]*N",
"[0]",
"0",
"N",
"used2 = [0]*N",
"used2",
"[0]*N",
"[0]",
"0",
"N",
"while h:\n t = heapq.heappop(h)\n if -t[0] < b:\n break\n if used1[t[2]] == 1:\n used1[t[2]] = -1\n used2[t[2]] = -1\n if used2[t[1]] == 1:\n used1[t[1]] = -1\n used2[t[1]] = -1\n if used1[t[1]] == 0:\n used1[t[1]] = 1\n if used2[t[2]] == 0:\n used2[t[2]] = 1\n ",
"h",
"t = heapq.heappop(h)",
"t",
"heapq.heappop(h)",
"heapq.heappop",
"heapq",
"heappop",
"h",
"if -t[0] < b:\n break\n ",
"-t[0] < b",
"-t[0]",
"t[0]",
"t",
"0",
"b",
"break",
"if used1[t[2]] == 1:\n used1[t[2]] = -1\n used2[t[2]] = -1\n ",
"used1[t[2]] == 1",
"used1[t[2]]",
"used1",
"t[2]",
"t",
"2",
"1",
"used1[t[2]] = -1",
"used1[t[2]]",
"used1",
"t[2]",
"t",
"2",
"-1",
"used2[t[2]] = -1",
"used2[t[2]]",
"used2",
"t[2]",
"t",
"2",
"-1",
"if used2[t[1]] == 1:\n used1[t[1]] = -1\n used2[t[1]] = -1\n ",
"used2[t[1]] == 1",
"used2[t[1]]",
"used2",
"t[1]",
"t",
"1",
"1",
"used1[t[1]] = -1",
"used1[t[1]]",
"used1",
"t[1]",
"t",
"1",
"-1",
"used2[t[1]] = -1",
"used2[t[1]]",
"used2",
"t[1]",
"t",
"1",
"-1",
"if used1[t[1]] == 0:\n used1[t[1]] = 1\n ",
"used1[t[1]] == 0",
"used1[t[1]]",
"used1",
"t[1]",
"t",
"1",
"0",
"used1[t[1]] = 1",
"used1[t[1]]",
"used1",
"t[1]",
"t",
"1",
"1",
"if used2[t[2]] == 0:\n used2[t[2]] = 1\n ",
"used2[t[2]] == 0",
"used2[t[2]]",
"used2",
"t[2]",
"t",
"2",
"0",
"used2[t[2]] = 1",
"used2[t[2]]",
"used2",
"t[2]",
"t",
"2",
"1",
"cnt1 = 0",
"cnt1",
"0",
"cnt2 = 0",
"cnt2",
"0",
"for i in range(N):\n cnt1 += max(0, used1[i])\n cnt2 += max(0, used2[i])\n ",
"i",
"range(N)",
"range",
"N",
"cnt1 += max(0, used1[i])",
"cnt1",
"max(0, used1[i])",
"max",
"0",
"used1[i]",
"used1",
"i",
"cnt2 += max(0, used2[i])",
"cnt2",
"max(0, used2[i])",
"max",
"0",
"used2[i]",
"used2",
"i",
"print(min(cnt1, cnt2))",
"print",
"min(cnt1, cnt2)",
"min",
"cnt1",
"cnt2",
"r = []",
"[]",
"r",
"used2 = [0]*N",
"[0]*N",
"used2",
"cnt1 += max(0, used1[i])",
"max(0, used1[i])",
"cnt1",
"cnt2 = 0",
"0",
"cnt2",
"used1 = [0]*N",
"[0]*N",
"used1",
"t = heapq.heappop(h)",
"heapq.heappop(h)",
"t",
"cnt2 += max(0, used2[i])",
"max(0, used2[i])",
"cnt2",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"b = -r[0][0] - l",
"-r[0][0] - l",
"b",
"h = []",
"[]",
"h",
"l_idx = i",
"i",
"l_idx",
"l = A[i]",
"A[i]",
"l",
"N,T = map(int, input().split())",
"map(int, input().split())",
"N",
"A = [int(a) for a in input().split()]",
"[int(a) for a in input().split()]",
"A",
"l_idx = 0",
"0",
"l_idx",
"b = -r[0][0]-l",
"-r[0][0]-l",
"b",
"cnt1 = 0",
"0",
"cnt1",
"l = A[0]",
"A[0]",
"l"
] |
import heapq
N,T = map(int, input().split())
A = [int(a) for a in input().split()]
l = A[0]
l_idx = 0
r = []
for i in range(1, N):
heapq.heappush(r, (-A[i], i))
b = -r[0][0] - l
h = []
heapq.heappush(h, (-b, l_idx, r[0][1]))
for i in range(1, N-1):
while r[0][1] <= i:
heapq.heappop(r)
if l > A[i]:
l = A[i]
l_idx = i
if b <= -r[0][0]-l:
b = -r[0][0]-l
heapq.heappush(h, (-b, l_idx, r[0][1]))
used1 = [0]*N
used2 = [0]*N
while h:
t = heapq.heappop(h)
if -t[0] < b:
break
if used1[t[2]] == 1:
used1[t[2]] = -1
used2[t[2]] = -1
if used2[t[1]] == 1:
used1[t[1]] = -1
used2[t[1]] = -1
if used1[t[1]] == 0:
used1[t[1]] = 1
if used2[t[2]] == 0:
used2[t[2]] = 1
cnt1 = 0
cnt2 = 0
for i in range(N):
cnt1 += max(0, used1[i])
cnt2 += max(0, used2[i])
print(min(cnt1, cnt2))
|
[
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,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
18,
13,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
13,
14,
2,
13,
13,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
18,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13
] |
[
[
99,
2
],
[
99,
13
],
[
111,
15
],
[
102,
27
],
[
114,
30
],
[
112,
32
],
[
105,
35
],
[
39,
38
],
[
91,
42
],
[
112,
46
],
[
38,
47
],
[
115,
48
],
[
94,
48
],
[
96,
50
],
[
112,
53
],
[
38,
54
],
[
115,
55
],
[
94,
55
],
[
108,
57
],
[
106,
60
],
[
109,
60
],
[
97,
61
],
[
97,
64
],
[
103,
65
],
[
70,
67
],
[
103,
68
],
[
97,
69
],
[
75,
72
],
[
103,
73
],
[
97,
74
],
[
93,
77
],
[
115,
80
],
[
94,
80
],
[
112,
82
],
[
38,
83
],
[
103,
87
],
[
109,
88
],
[
106,
88
],
[
99,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
]
] |
[
"n,t=list(map(int,input().split()))\na=list(map(int,input().split()))\n\ndp={}\nmina=a[0]\nmaxdiff=0\n\nfor i in range(1,n):\n if a[i]>mina:\n diff=a[i]-mina\n maxdiff=max(maxdiff,diff)\n\n if diff in dp:\n dp[diff]+=1\n else:\n dp[diff]=1\n \n mina=min(mina,a[i])\n\nprint(dp[maxdiff])",
"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",
"dp={}",
"dp",
"{}",
"mina=a[0]",
"mina",
"a[0]",
"a",
"0",
"maxdiff=0",
"maxdiff",
"0",
"for i in range(1,n):\n if a[i]>mina:\n diff=a[i]-mina\n maxdiff=max(maxdiff,diff)\n\n if diff in dp:\n dp[diff]+=1\n else:\n dp[diff]=1\n \n mina=min(mina,a[i])",
"i",
"range(1,n)",
"range",
"1",
"n",
"if a[i]>mina:\n diff=a[i]-mina\n maxdiff=max(maxdiff,diff)\n\n if diff in dp:\n dp[diff]+=1\n else:\n dp[diff]=1\n \n ",
"a[i]>mina",
"a[i]",
"a",
"i",
"mina",
"diff=a[i]-mina",
"diff",
"a[i]-mina",
"a[i]",
"a",
"i",
"mina",
"maxdiff=max(maxdiff,diff)",
"maxdiff",
"max(maxdiff,diff)",
"max",
"maxdiff",
"diff",
"if diff in dp:\n dp[diff]+=1\n else:\n dp[diff]=1\n \n ",
"diff in dp",
"diff",
"dp",
"dp[diff]+=1",
"dp[diff]",
"dp",
"diff",
"1",
"dp[diff]=1",
"dp[diff]",
"dp",
"diff",
"1",
"mina=min(mina,a[i])",
"mina",
"min(mina,a[i])",
"min",
"mina",
"a[i]",
"a",
"i",
"print(dp[maxdiff])",
"print",
"dp[maxdiff]",
"dp",
"maxdiff",
"n,t=list(map(int,input().split()))",
"list(map(int,input().split()))",
"n",
"mina=min(mina,a[i])",
"min(mina,a[i])",
"mina",
"diff=a[i]-mina",
"a[i]-mina",
"diff",
"t=list(map(int,input().split()))",
"list(map(int,input().split()))",
"t",
"dp={}",
"{}",
"dp",
"maxdiff=0",
"0",
"maxdiff",
"maxdiff=max(maxdiff,diff)",
"max(maxdiff,diff)",
"maxdiff",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"mina=a[0]",
"a[0]",
"mina"
] |
n,t=list(map(int,input().split()))
a=list(map(int,input().split()))
dp={}
mina=a[0]
maxdiff=0
for i in range(1,n):
if a[i]>mina:
diff=a[i]-mina
maxdiff=max(maxdiff,diff)
if diff in dp:
dp[diff]+=1
else:
dp[diff]=1
mina=min(mina,a[i])
print(dp[maxdiff])
|
[
7,
15,
13,
15,
0,
13,
18,
18,
13,
13,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
39,
0,
13,
2,
2,
17,
17,
17,
28,
13,
13,
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,
18,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
72,
5
],
[
73,
22
],
[
90,
25
],
[
79,
27
],
[
90,
28
],
[
75,
30
],
[
79,
32
],
[
87,
34
],
[
84,
37
],
[
45,
44
],
[
76,
44
],
[
96,
47
],
[
85,
50
],
[
97,
50
],
[
44,
51
],
[
88,
54
],
[
44,
57
],
[
97,
58
],
[
85,
58
],
[
93,
60
],
[
88,
63
],
[
94,
67
],
[
88,
70
],
[
72,
73
],
[
75,
76
],
[
90,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
]
] |
[
"# https://atcoder.jp/contests/abc047/tasks/arc063_b\n#\n# 高橋くんが利益を上げる状況は街iで安く仕入れてi+jで高く売ること\n# min と maxの差が最大になる点がいくつ存在するかをカウントすれば良い\n#\n\n\nimport sys\nfrom collections import Counter\nread = sys.stdin.readline\n\n\ndef read_ints():\n return list(map(int, read().split()))\n\n\nN, T = read_ints()\nA = read_ints()\n\n\n# minの点を覚えておく\n# 各点に足して差を出す(その点を使うと達成可能な利益)\n# minはちゃんと更新\nscores = []\nmi = 10**9 + 7\nfor a in A:\n mi = min(mi, a)\n scores.append(a - mi)\n\nans = Counter(scores)\nprint(ans[max(scores)])",
"import sys",
"sys",
"from collections import Counter",
"read = sys.stdin.readline",
"read",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def read_ints():\n return list(map(int, read().split()))",
"read_ints",
"return list(map(int, read().split()))",
"list(map(int, read().split()))",
"list",
"map(int, read().split())",
"map",
"int",
"read().split()",
"().split",
"()",
"read",
"split",
"N, T = read_ints()",
"N",
"read_ints()",
"read_ints",
"T",
"A = read_ints()",
"A",
"read_ints()",
"read_ints",
"scores = []",
"scores",
"[]",
"mi = 10**9 + 7",
"mi",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"for a in A:\n mi = min(mi, a)\n scores.append(a - mi)",
"a",
"A",
"mi = min(mi, a)",
"mi",
"min(mi, a)",
"min",
"mi",
"a",
"scores.append(a - mi)",
"scores.append",
"scores",
"append",
"a - mi",
"a",
"mi",
"ans = Counter(scores)",
"ans",
"Counter(scores)",
"Counter",
"scores",
"print(ans[max(scores)])",
"print",
"ans[max(scores)]",
"ans",
"max(scores)",
"max",
"scores",
"read = sys.stdin.readline",
"sys.stdin.readline",
"read",
"A = read_ints()",
"read_ints()",
"A",
"def read_ints():\n return list(map(int, read().split()))",
"def read_ints():\n return list(map(int, read().split()))",
"read_ints",
"T = read_ints()",
"read_ints()",
"T",
"mi = 10**9 + 7",
"10**9 + 7",
"mi",
"scores = []",
"[]",
"scores",
"N, T = read_ints()",
"read_ints()",
"N",
"ans = Counter(scores)",
"Counter(scores)",
"ans",
"mi = min(mi, a)",
"min(mi, a)",
"mi"
] |
# https://atcoder.jp/contests/abc047/tasks/arc063_b
#
# 高橋くんが利益を上げる状況は街iで安く仕入れてi+jで高く売ること
# min と maxの差が最大になる点がいくつ存在するかをカウントすれば良い
#
import sys
from collections import Counter
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
N, T = read_ints()
A = read_ints()
# minの点を覚えておく
# 各点に足して差を出す(その点を使うと達成可能な利益)
# minはちゃんと更新
scores = []
mi = 10**9 + 7
for a in A:
mi = min(mi, a)
scores.append(a - mi)
ans = Counter(scores)
print(ans[max(scores)])
|
[
7,
15,
13,
13,
15,
0,
13,
12,
4,
18,
18,
13,
13,
13,
13,
23,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
12,
13,
14,
13,
4,
13,
13,
23,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
39,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
18,
13,
18,
13,
17,
17,
0,
13,
18,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
18,
13,
13,
0,
18,
13,
13,
17,
14,
2,
13,
13,
0,
13,
13,
14,
40,
2,
13,
13,
13,
14,
2,
2,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
39,
40,
13,
13,
13,
14,
40,
13,
13,
0,
18,
13,
13,
17,
4,
18,
13,
13,
13,
13,
0,
13,
17,
0,
13,
17,
42,
2,
4,
13,
13,
17,
0,
13,
4,
18,
13,
13,
13,
13,
13,
14,
2,
13,
17,
0,
13,
13,
14,
40,
13,
13,
3,
0,
13,
4,
13,
18,
13,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13,
10,
12,
13,
10,
18,
13,
10,
13,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
268,
6
],
[
253,
17
],
[
262,
24
],
[
244,
37
],
[
208,
48
],
[
58,
56
],
[
58,
58
],
[
277,
60
],
[
245,
62
],
[
277,
63
],
[
217,
65
],
[
263,
67
],
[
220,
69
],
[
241,
72
],
[
271,
77
],
[
87,
82
],
[
272,
83
],
[
218,
85
],
[
247,
89
],
[
218,
91
],
[
223,
94
],
[
98,
97
],
[
233,
101
],
[
265,
103
],
[
218,
105
],
[
97,
106
],
[
111,
108
],
[
272,
109
],
[
266,
110
],
[
266,
114
],
[
248,
115
],
[
239,
115
],
[
238,
117
],
[
266,
118
],
[
266,
122
],
[
239,
123
],
[
248,
123
],
[
224,
124
],
[
257,
124
],
[
266,
128
],
[
239,
129
],
[
248,
129
],
[
224,
130
],
[
257,
130
],
[
256,
132
],
[
266,
134
],
[
239,
135
],
[
248,
135
],
[
235,
137
],
[
257,
140
],
[
224,
140
],
[
236,
145
],
[
242,
146
],
[
151,
148
],
[
242,
149
],
[
236,
150
],
[
221,
156
],
[
236,
157
],
[
214,
159
],
[
205,
162
],
[
221,
168
],
[
274,
171
],
[
221,
176
],
[
274,
177
],
[
274,
178
],
[
206,
181
],
[
251,
181
],
[
250,
184
],
[
212,
185
],
[
251,
188
],
[
206,
188
],
[
212,
189
],
[
229,
192
],
[
272,
196
],
[
275,
197
],
[
239,
197
],
[
248,
197
],
[
108,
198
],
[
272,
199
],
[
260,
200
],
[
266,
200
],
[
230,
203
],
[
215,
203
],
[
205,
206
],
[
208,
209
],
[
274,
212
],
[
214,
215
],
[
217,
218
],
[
220,
221
],
[
223,
224
],
[
229,
230
],
[
277,
233
],
[
235,
236
],
[
266,
238
],
[
238,
239
],
[
241,
242
],
[
244,
245
],
[
247,
248
],
[
212,
250
],
[
250,
251
],
[
253,
254
],
[
256,
257
],
[
274,
260
],
[
262,
263
],
[
265,
266
],
[
268,
269
],
[
271,
272
],
[
274,
275
],
[
277,
278
]
] |
[
"import sys,heapq\nfrom collections import defaultdict\nprintn = lambda x: sys.stdout.write(x)\ninn = lambda : int(input())\ninl = lambda: list(map(int, input().split()))\ninm = lambda: map(int, input().split())\nDBG = True # and False\n\ndef ddprint(x):\n if DBG:\n print(x)\n\nn,t = inm()\na = inl()\nheappair = []\nhpair = defaultdict(int)\nhcnt = defaultdict(int)\nhcnt[a[0]] = 1\nmn = a[0]\ndif = 0\nfor i in range(1,n):\n z = a[i]\n hcnt[z] += 1\n if z<mn:\n mn = z\n if z-mn>=dif:\n if z-mn>dif:\n dif = z-mn\n e = (-dif,mn,z)\n if e not in hpair:\n hpair[e] = 1\n heapq.heappush(heappair,e)\ncnt = 0\nv = 1\nwhile len(heappair)>0:\n mdif,mn,z = heapq.heappop(heappair)\n if v==1:\n v = mdif\n if v != mdif:\n break\n cnt += min(hcnt[mn],hcnt[z])\nprint(cnt) ",
"import sys,heapq",
"sys",
"heapq",
"from collections import defaultdict",
"printn = lambda x: sys.stdout.write(x)",
"printn",
"lambda x: sys.stdout.write(x)",
"sys.stdout.write(x)",
"sys.stdout.write",
"sys.stdout",
"sys",
"stdout",
"write",
"x",
"x",
"inn = lambda : int(input())",
"inn",
"lambda : int(input())",
"int(input())",
"int",
"input()",
"input",
"inl = lambda: list(map(int, input().split()))",
"inl",
"lambda: list(map(int, input().split()))",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"inm = lambda: map(int, input().split())",
"inm",
"lambda: map(int, input().split())",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"DBG = True",
"DBG",
"True",
"def ddprint(x):\n if DBG:\n print(x)",
"ddprint",
"if DBG:\n print(x)",
"DBG",
"print(x)",
"print",
"x",
"x",
"x",
"n,t = inm()",
"n",
"inm()",
"inm",
"t",
"a = inl()",
"a",
"inl()",
"inl",
"heappair = []",
"heappair",
"[]",
"hpair = defaultdict(int)",
"hpair",
"defaultdict(int)",
"defaultdict",
"int",
"hcnt = defaultdict(int)",
"hcnt",
"defaultdict(int)",
"defaultdict",
"int",
"hcnt[a[0]] = 1",
"hcnt[a[0]]",
"hcnt",
"a[0]",
"a",
"0",
"1",
"mn = a[0]",
"mn",
"a[0]",
"a",
"0",
"dif = 0",
"dif",
"0",
"for i in range(1,n):\n z = a[i]\n hcnt[z] += 1\n if z<mn:\n mn = z\n if z-mn>=dif:\n if z-mn>dif:\n dif = z-mn\n e = (-dif,mn,z)\n if e not in hpair:\n hpair[e] = 1\n heapq.heappush(heappair,e)",
"i",
"range(1,n)",
"range",
"1",
"n",
"z = a[i]",
"z",
"a[i]",
"a",
"i",
"hcnt[z] += 1",
"hcnt[z]",
"hcnt",
"z",
"1",
"if z<mn:\n mn = z\n ",
"z<mn",
"z",
"mn",
"mn = z",
"mn",
"z",
"if z-mn>=dif:\n if z-mn>dif:\n dif = z-mn\n e = (-dif,mn,z)\n if e not in hpair:\n hpair[e] = 1\n heapq.heappush(heappair,e)",
"z-mn>=dif",
"z-mn",
"z",
"mn",
"dif",
"if z-mn>dif:\n dif = z-mn\n ",
"z-mn>dif",
"z-mn",
"z",
"mn",
"dif",
"dif = z-mn",
"dif",
"z-mn",
"z",
"mn",
"e = (-dif,mn,z)",
"e",
"(-dif,mn,z)",
"-dif",
"dif",
"mn",
"z",
"if e not in hpair:\n hpair[e] = 1\n heapq.heappush(heappair,e)",
"e not in hpair",
"e",
"hpair",
"hpair[e] = 1",
"hpair[e]",
"hpair",
"e",
"1",
"heapq.heappush(heappair,e)",
"heapq.heappush",
"heapq",
"heappush",
"heappair",
"e",
"cnt = 0",
"cnt",
"0",
"v = 1",
"v",
"1",
"while len(heappair)>0:\n mdif,mn,z = heapq.heappop(heappair)\n if v==1:\n v = mdif\n if v != mdif:\n break\n cnt += min(hcnt[mn],hcnt[z])",
"len(heappair)>0",
"len(heappair)",
"len",
"heappair",
"0",
"mdif,mn,z = heapq.heappop(heappair)",
"mdif",
"heapq.heappop(heappair)",
"heapq.heappop",
"heapq",
"heappop",
"heappair",
"mn",
"z",
"if v==1:\n v = mdif\n ",
"v==1",
"v",
"1",
"v = mdif",
"v",
"mdif",
"if v != mdif:\n break\n ",
"v != mdif",
"v",
"mdif",
"break",
"cnt += min(hcnt[mn],hcnt[z])",
"cnt",
"min(hcnt[mn],hcnt[z])",
"min",
"hcnt[mn]",
"hcnt",
"mn",
"hcnt[z]",
"hcnt",
"z",
"print(cnt)",
"print",
"cnt",
"v = 1",
"1",
"v",
"DBG = True",
"True",
"DBG",
"mdif,mn,z = heapq.heappop(heappair)",
"heapq.heappop(heappair)",
"mdif",
"cnt = 0",
"0",
"cnt",
"a = inl()",
"inl()",
"a",
"heappair = []",
"[]",
"heappair",
"dif = 0",
"0",
"dif",
"def ddprint(x):\n if DBG:\n print(x)",
"def ddprint(x):\n if DBG:\n print(x)",
"ddprint",
"cnt += min(hcnt[mn],hcnt[z])",
"min(hcnt[mn],hcnt[z])",
"cnt",
"n,t = inm()",
"inm()",
"n",
"e = (-dif,mn,z)",
"(-dif,mn,z)",
"e",
"mn = z",
"z",
"mn",
"hpair = defaultdict(int)",
"defaultdict(int)",
"hpair",
"inm = lambda: map(int, input().split())",
"lambda: map(int, input().split())",
"inm",
"mn = a[0]",
"a[0]",
"mn",
"v = mdif",
"mdif",
"v",
"inn = lambda : int(input())",
"lambda : int(input())",
"inn",
"dif = z-mn",
"z-mn",
"dif",
"z = heapq.heappop(heappair)",
"heapq.heappop(heappair)",
"z",
"inl = lambda: list(map(int, input().split()))",
"lambda: list(map(int, input().split()))",
"inl",
"z = a[i]",
"a[i]",
"z",
"printn = lambda x: sys.stdout.write(x)",
"lambda x: sys.stdout.write(x)",
"printn",
"hcnt = defaultdict(int)",
"defaultdict(int)",
"hcnt",
"mn,z = heapq.heappop(heappair)",
"heapq.heappop(heappair)",
"mn",
"t = inm()",
"inm()",
"t"
] |
import sys,heapq
from collections import defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
DBG = True # and False
def ddprint(x):
if DBG:
print(x)
n,t = inm()
a = inl()
heappair = []
hpair = defaultdict(int)
hcnt = defaultdict(int)
hcnt[a[0]] = 1
mn = a[0]
dif = 0
for i in range(1,n):
z = a[i]
hcnt[z] += 1
if z<mn:
mn = z
if z-mn>=dif:
if z-mn>dif:
dif = z-mn
e = (-dif,mn,z)
if e not in hpair:
hpair[e] = 1
heapq.heappush(heappair,e)
cnt = 0
v = 1
while len(heappair)>0:
mdif,mn,z = heapq.heappop(heappair)
if v==1:
v = mdif
if v != mdif:
break
cnt += min(hcnt[mn],hcnt[z])
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,
18,
13,
17,
28,
13,
4,
13,
17,
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,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
13,
10,
4,
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,
2,
13
] |
[
[
103,
2
],
[
103,
11
],
[
82,
13
],
[
97,
25
],
[
85,
28
],
[
106,
31
],
[
83,
33
],
[
37,
36
],
[
104,
40
],
[
83,
45
],
[
36,
46
],
[
107,
47
],
[
101,
47
],
[
98,
48
],
[
110,
48
],
[
91,
50
],
[
83,
56
],
[
36,
57
],
[
107,
58
],
[
101,
58
],
[
98,
59
],
[
110,
59
],
[
109,
61
],
[
83,
64
],
[
36,
65
],
[
107,
66
],
[
101,
66
],
[
88,
68
],
[
100,
71
],
[
107,
74
],
[
101,
74
],
[
83,
76
],
[
36,
77
],
[
89,
80
],
[
92,
80
],
[
86,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
103,
95
],
[
97,
98
],
[
100,
101
],
[
103,
104
],
[
106,
107
],
[
109,
110
]
] |
[
"N, T = map(int,input().split())\nAN = list(map(int,input().split()))\n\nmaximum = 0\nans = 0\nleft = AN[0]\n\nfor n in range(1,N):\n if AN[n]-left == maximum:\n ans += 1\n elif AN[n]-left > maximum:\n maximum = AN[n]-left\n ans = 1\n\n left = min(left,AN[n])\n\nprint(ans)",
"N, T = map(int,input().split())",
"N",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"T",
"AN = list(map(int,input().split()))",
"AN",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"maximum = 0",
"maximum",
"0",
"ans = 0",
"ans",
"0",
"left = AN[0]",
"left",
"AN[0]",
"AN",
"0",
"for n in range(1,N):\n if AN[n]-left == maximum:\n ans += 1\n elif AN[n]-left > maximum:\n maximum = AN[n]-left\n ans = 1\n\n left = min(left,AN[n])",
"n",
"range(1,N)",
"range",
"1",
"N",
"if AN[n]-left == maximum:\n ans += 1\n elif AN[n]-left > maximum:\n maximum = AN[n]-left\n ans = 1\n\n ",
"AN[n]-left == maximum",
"AN[n]-left",
"AN[n]",
"AN",
"n",
"left",
"maximum",
"ans += 1",
"ans",
"1",
"elif AN[n]-left > maximum:\n maximum = AN[n]-left\n ans = 1\n\n ",
"AN[n]-left > maximum",
"AN[n]-left",
"AN[n]",
"AN",
"n",
"left",
"maximum",
"maximum = AN[n]-left",
"maximum",
"AN[n]-left",
"AN[n]",
"AN",
"n",
"left",
"ans = 1",
"ans",
"1",
"left = min(left,AN[n])",
"left",
"min(left,AN[n])",
"min",
"left",
"AN[n]",
"AN",
"n",
"print(ans)",
"print",
"ans",
"AN = list(map(int,input().split()))",
"list(map(int,input().split()))",
"AN",
"ans = 0",
"0",
"ans",
"ans = 1",
"1",
"ans",
"ans += 1",
"1",
"ans",
"T = map(int,input().split())",
"map(int,input().split())",
"T",
"maximum = 0",
"0",
"maximum",
"left = min(left,AN[n])",
"min(left,AN[n])",
"left",
"N, T = map(int,input().split())",
"map(int,input().split())",
"N",
"left = AN[0]",
"AN[0]",
"left",
"maximum = AN[n]-left",
"AN[n]-left",
"maximum"
] |
N, T = map(int,input().split())
AN = list(map(int,input().split()))
maximum = 0
ans = 0
left = AN[0]
for n in range(1,N):
if AN[n]-left == maximum:
ans += 1
elif AN[n]-left > maximum:
maximum = AN[n]-left
ans = 1
left = min(left,AN[n])
print(ans)
|
[
7,
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,
39,
18,
13,
17,
0,
13,
39,
18,
13,
17,
28,
13,
4,
13,
17,
13,
4,
18,
13,
13,
4,
13,
18,
13,
17,
18,
13,
13,
28,
13,
18,
4,
13,
17,
2,
13,
17,
39,
17,
4,
18,
13,
13,
4,
13,
18,
13,
17,
18,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
39,
28,
13,
4,
13,
17,
2,
13,
17,
14,
2,
2,
18,
13,
2,
13,
17,
18,
13,
13,
13,
4,
18,
13,
13,
13,
14,
2,
2,
18,
13,
2,
13,
17,
18,
13,
13,
13,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
39,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
39,
13,
10,
39,
13,
10,
2,
13,
10,
4,
13,
10,
39,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13
] |
[
[
158,
3
],
[
158,
12
],
[
170,
14
],
[
152,
26
],
[
171,
29
],
[
167,
32
],
[
171,
35
],
[
39,
38
],
[
147,
42
],
[
153,
45
],
[
153,
50
],
[
171,
53
],
[
38,
54
],
[
57,
56
],
[
147,
62
],
[
168,
68
],
[
168,
73
],
[
171,
76
],
[
56,
77
],
[
168,
80
],
[
164,
83
],
[
149,
86
],
[
90,
89
],
[
147,
94
],
[
168,
100
],
[
89,
102
],
[
171,
105
],
[
89,
106
],
[
165,
107
],
[
156,
107
],
[
150,
110
],
[
162,
110
],
[
89,
112
],
[
168,
117
],
[
89,
119
],
[
171,
122
],
[
89,
123
],
[
165,
124
],
[
156,
124
],
[
155,
126
],
[
168,
129
],
[
89,
131
],
[
153,
134
],
[
89,
135
],
[
161,
137
],
[
162,
144
],
[
150,
144
],
[
158,
147
],
[
149,
150
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
]
] |
[
"\"\"\"from collections import *\nfrom itertools import *\nfrom bisect import *\nfrom heapq import *\n\nimport math\nfrom fractions import gcd\"\"\"\n\nN,T=map(int,input().split())\nA=list(map(int,input().split()))\nruimin=[A[0]]\nruimax=[A[-1]]\nfor i in range(1,N):\n ruimin.append(min(ruimin[-1],A[i]))\nfor i in range(0,N-1)[::-1]:\n ruimax.append(max(ruimax[-1],A[i]))\nruimax.reverse()\n\nvalue=1\nlst=[]\nfor i in range(0,N-1):\n if ruimax[i+1]-A[i]==value:\n lst.append(i)\n elif ruimax[i+1]-A[i]>value:\n value=ruimax[i+1]-ruimin[i]\n lst=[i]\n\nprint(len(lst))",
"\"\"\"from collections import *\nfrom itertools import *\nfrom bisect import *\nfrom heapq import *\n\nimport math\nfrom fractions import gcd\"\"\"",
"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",
"ruimin=[A[0]]",
"ruimin",
"[A[0]]",
"A[0]",
"A",
"0",
"ruimax=[A[-1]]",
"ruimax",
"[A[-1]]",
"A[-1]",
"A",
"-1",
"for i in range(1,N):\n ruimin.append(min(ruimin[-1],A[i]))",
"i",
"range(1,N)",
"range",
"1",
"N",
"ruimin.append(min(ruimin[-1],A[i]))",
"ruimin.append",
"ruimin",
"append",
"min(ruimin[-1],A[i])",
"min",
"ruimin[-1]",
"ruimin",
"-1",
"A[i]",
"A",
"i",
"for i in range(0,N-1)[::-1]:\n ruimax.append(max(ruimax[-1],A[i]))",
"i",
"range(0,N-1)[::-1]",
"(0,N-1)",
"range",
"0",
"N-1",
"N",
"1",
"::-1",
"-1",
"ruimax.append(max(ruimax[-1],A[i]))",
"ruimax.append",
"ruimax",
"append",
"max(ruimax[-1],A[i])",
"max",
"ruimax[-1]",
"ruimax",
"-1",
"A[i]",
"A",
"i",
"ruimax.reverse()",
"ruimax.reverse",
"ruimax",
"reverse",
"value=1",
"value",
"1",
"lst=[]",
"lst",
"[]",
"for i in range(0,N-1):\n if ruimax[i+1]-A[i]==value:\n lst.append(i)\n elif ruimax[i+1]-A[i]>value:\n value=ruimax[i+1]-ruimin[i]\n lst=[i]",
"i",
"range(0,N-1)",
"range",
"0",
"N-1",
"N",
"1",
"if ruimax[i+1]-A[i]==value:\n lst.append(i)\n elif ruimax[i+1]-A[i]>value:\n value=ruimax[i+1]-ruimin[i]\n lst=[i]",
"ruimax[i+1]-A[i]==value",
"ruimax[i+1]-A[i]",
"ruimax[i+1]",
"ruimax",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"value",
"lst.append(i)",
"lst.append",
"lst",
"append",
"i",
"elif ruimax[i+1]-A[i]>value:\n value=ruimax[i+1]-ruimin[i]\n lst=[i]",
"ruimax[i+1]-A[i]>value",
"ruimax[i+1]-A[i]",
"ruimax[i+1]",
"ruimax",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"value",
"value=ruimax[i+1]-ruimin[i]",
"value",
"ruimax[i+1]-ruimin[i]",
"ruimax[i+1]",
"ruimax",
"i+1",
"i",
"1",
"ruimin[i]",
"ruimin",
"i",
"lst=[i]",
"lst",
"[i]",
"i",
"print(len(lst))",
"print",
"len(lst)",
"len",
"lst",
"N,T=map(int,input().split())",
"map(int,input().split())",
"N",
"lst=[]",
"[]",
"lst",
"ruimin=[A[0]]",
"[A[0]]",
"ruimin",
"value=ruimax[i+1]-ruimin[i]",
"ruimax[i+1]-ruimin[i]",
"value",
"T=map(int,input().split())",
"map(int,input().split())",
"T",
"lst=[i]",
"[i]",
"lst",
"value=1",
"1",
"value",
"ruimax=[A[-1]]",
"[A[-1]]",
"ruimax",
"A=list(map(int,input().split()))",
"list(map(int,input().split()))",
"A"
] |
"""from collections import *
from itertools import *
from bisect import *
from heapq import *
import math
from fractions import gcd"""
N,T=map(int,input().split())
A=list(map(int,input().split()))
ruimin=[A[0]]
ruimax=[A[-1]]
for i in range(1,N):
ruimin.append(min(ruimin[-1],A[i]))
for i in range(0,N-1)[::-1]:
ruimax.append(max(ruimax[-1],A[i]))
ruimax.reverse()
value=1
lst=[]
for i in range(0,N-1):
if ruimax[i+1]-A[i]==value:
lst.append(i)
elif ruimax[i+1]-A[i]>value:
value=ruimax[i+1]-ruimin[i]
lst=[i]
print(len(lst))
|
[
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,
39,
28,
13,
13,
0,
13,
4,
13,
13,
13,
4,
18,
13,
13,
2,
13,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
13,
18,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] |
[
[
80,
2
],
[
80,
11
],
[
74,
13
],
[
65,
25
],
[
83,
30
],
[
34,
33
],
[
75,
33
],
[
68,
36
],
[
66,
39
],
[
69,
39
],
[
33,
40
],
[
84,
43
],
[
33,
46
],
[
69,
47
],
[
66,
47
],
[
84,
50
],
[
77,
53
],
[
84,
56
],
[
84,
59
],
[
78,
63
],
[
65,
66
],
[
68,
69
],
[
80,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
]
] |
[
"n,t = map(int,input().split())\nA = list(map(int,input().split()))\nb = float('inf')\nB = []\nfor a in A:\n b = min(b,a)\n B.append(a-b)\nB.sort()\ncnt = B.count(B[-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",
"b = float('inf')",
"b",
"float('inf')",
"float",
"'inf'",
"B = []",
"B",
"[]",
"for a in A:\n b = min(b,a)\n B.append(a-b)",
"a",
"A",
"b = min(b,a)",
"b",
"min(b,a)",
"min",
"b",
"a",
"B.append(a-b)",
"B.append",
"B",
"append",
"a-b",
"a",
"b",
"B.sort()",
"B.sort",
"B",
"sort",
"cnt = B.count(B[-1])",
"cnt",
"B.count(B[-1])",
"B.count",
"B",
"count",
"B[-1]",
"B",
"-1",
"print(cnt)",
"print",
"cnt",
"b = float('inf')",
"float('inf')",
"b",
"b = min(b,a)",
"min(b,a)",
"b",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"cnt = B.count(B[-1])",
"B.count(B[-1])",
"cnt",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"B = []",
"[]",
"B"
] |
n,t = map(int,input().split())
A = list(map(int,input().split()))
b = float('inf')
B = []
for a in A:
b = min(b,a)
B.append(a-b)
B.sort()
cnt = B.count(B[-1])
print(cnt)
|
[
7,
15,
13,
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,
41,
28,
13,
4,
13,
13,
4,
39,
17,
0,
13,
13,
0,
13,
18,
13,
17,
28,
13,
4,
13,
13,
14,
40,
13,
18,
13,
2,
40,
13,
17,
0,
13,
18,
13,
2,
40,
13,
17,
0,
18,
13,
2,
40,
13,
17,
13,
0,
13,
18,
13,
17,
0,
13,
18,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
2,
13,
17,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
13,
17,
0,
13,
18,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
2,
13,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
4,
13,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
18,
13
] |
[
[
211,
4
],
[
211,
13
],
[
17,
16
],
[
16,
25
],
[
190,
27
],
[
32,
31
],
[
200,
34
],
[
214,
39
],
[
220,
42
],
[
191,
44
],
[
48,
47
],
[
200,
50
],
[
221,
53
],
[
185,
53
],
[
191,
55
],
[
47,
58
],
[
184,
61
],
[
191,
63
],
[
47,
66
],
[
75,
69
],
[
215,
70
],
[
47,
73
],
[
185,
75
],
[
221,
75
],
[
202,
77
],
[
191,
79
],
[
187,
82
],
[
215,
84
],
[
172,
87
],
[
181,
90
],
[
163,
93
],
[
166,
96
],
[
196,
99
],
[
103,
102
],
[
200,
106
],
[
203,
110
],
[
161,
110
],
[
191,
112
],
[
102,
113
],
[
160,
115
],
[
191,
117
],
[
102,
118
],
[
175,
120
],
[
178,
123
],
[
215,
125
],
[
102,
126
],
[
193,
128
],
[
179,
130
],
[
188,
130
],
[
161,
131
],
[
203,
131
],
[
194,
134
],
[
173,
135
],
[
218,
135
],
[
217,
137
],
[
194,
138
],
[
169,
140
],
[
194,
145
],
[
173,
146
],
[
218,
146
],
[
176,
148
],
[
164,
148
],
[
209,
148
],
[
205,
151
],
[
208,
154
],
[
206,
158
],
[
170,
158
],
[
182,
158
],
[
160,
161
],
[
163,
164
],
[
166,
167
],
[
169,
170
],
[
172,
173
],
[
175,
176
],
[
178,
179
],
[
181,
182
],
[
184,
185
],
[
187,
188
],
[
190,
191
],
[
193,
194
],
[
196,
197
],
[
211,
200
],
[
202,
203
],
[
205,
206
],
[
208,
209
],
[
211,
212
],
[
214,
215
],
[
194,
217
],
[
217,
218
],
[
220,
221
]
] |
[
"import copy\n \nn, t = map(int, input().split())\nL = [int(i) for i in input().split()]\n\nLL = [[0] for i in range(n)]\ntmax = L[-1]\nfor i in range(n):\n if tmax <= L[-i-1]:\n tmax = L[-i-1]\n LL[-i-1] = tmax\n \nminvalue = L[0]\nmaxvalue = LL[0]\nsubt = 0\ncount = 1\nflag = 0\nflagg = 0\nj = 0\nfor i in range(n-1):\n if minvalue > L[i]:\n minvalue = L[i]\n flag = 1\n \n maxvalue = LL[i]\n \n #if maxvalue == L[i]:\n #LL = LL[i-j+1:]\n #maxvalue = max(LL)\n #j = i+1\n \n tsubt = maxvalue - minvalue\n if tsubt > subt:\n subt = tsubt\n count = 1\n elif tsubt == subt and flag == 1:\n count += 1\n flag = 0\n #print(\"L[i]:{0}, min:{1}, max:{2}, subt:{3}, count:{4}\".format(L[i], minvalue, maxvalue, subt, count))\n \nprint(count)",
"import copy",
"copy",
"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()]",
"[0] for i in range(n)",
"for i in range(n)",
"i",
"range(n)",
"range",
"n",
"for i in range(n)",
"[0]",
"0",
"LL = [[0] for i in range(n)]",
"LL",
"[[0] for i in range(n)]",
"tmax = L[-1]",
"tmax",
"L[-1]",
"L",
"-1",
"for i in range(n):\n if tmax <= L[-i-1]:\n tmax = L[-i-1]\n LL[-i-1] = tmax\n ",
"i",
"range(n)",
"range",
"n",
"if tmax <= L[-i-1]:\n tmax = L[-i-1]\n ",
"tmax <= L[-i-1]",
"tmax",
"L[-i-1]",
"L",
"-i-1",
"-i",
"i",
"1",
"tmax = L[-i-1]",
"tmax",
"L[-i-1]",
"L",
"-i-1",
"-i",
"i",
"1",
"LL[-i-1] = tmax",
"LL[-i-1]",
"LL",
"-i-1",
"-i",
"i",
"1",
"tmax",
"minvalue = L[0]",
"minvalue",
"L[0]",
"L",
"0",
"maxvalue = LL[0]",
"maxvalue",
"LL[0]",
"LL",
"0",
"subt = 0",
"subt",
"0",
"count = 1",
"count",
"1",
"flag = 0",
"flag",
"0",
"flagg = 0",
"flagg",
"0",
"j = 0",
"j",
"0",
"for i in range(n-1):\n if minvalue > L[i]:\n minvalue = L[i]\n flag = 1\n \n maxvalue = LL[i]\n \n #if maxvalue == L[i]:\n #LL = LL[i-j+1:]\n #maxvalue = max(LL)\n #j = i+1\n \n tsubt = maxvalue - minvalue\n if tsubt > subt:\n subt = tsubt\n count = 1\n elif tsubt == subt and flag == 1:\n count += 1\n flag = 0\n #print(\"L[i]:{0}, min:{1}, max:{2}, subt:{3}, count:{4}\".format(L[i], minvalue, maxvalue, subt, count))\n ",
"i",
"range(n-1)",
"range",
"n-1",
"n",
"1",
"if minvalue > L[i]:\n minvalue = L[i]\n flag = 1\n \n ",
"minvalue > L[i]",
"minvalue",
"L[i]",
"L",
"i",
"minvalue = L[i]",
"minvalue",
"L[i]",
"L",
"i",
"flag = 1",
"flag",
"1",
"maxvalue = LL[i]",
"maxvalue",
"LL[i]",
"LL",
"i",
"tsubt = maxvalue - minvalue",
"tsubt",
"maxvalue - minvalue",
"maxvalue",
"minvalue",
"if tsubt > subt:\n subt = tsubt\n count = 1\n elif tsubt == subt and flag == 1:\n count += 1\n ",
"tsubt > subt",
"tsubt",
"subt",
"subt = tsubt",
"subt",
"tsubt",
"count = 1",
"count",
"1",
"elif tsubt == subt and flag == 1:\n count += 1\n ",
"tsubt == subt and flag == 1",
"tsubt == subt",
"tsubt",
"subt",
"flag == 1",
"flag",
"1",
"count += 1",
"count",
"1",
"flag = 0",
"flag",
"0",
"print(count)",
"print",
"count",
"minvalue = L[i]",
"L[i]",
"minvalue",
"flag = 0",
"0",
"flag",
"flagg = 0",
"0",
"flagg",
"count = 1",
"1",
"count",
"subt = 0",
"0",
"subt",
"flag = 1",
"1",
"flag",
"maxvalue = LL[i]",
"LL[i]",
"maxvalue",
"count = 1",
"1",
"count",
"tmax = L[-i-1]",
"L[-i-1]",
"tmax",
"maxvalue = LL[0]",
"LL[0]",
"maxvalue",
"L = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"L",
"tsubt = maxvalue - minvalue",
"maxvalue - minvalue",
"tsubt",
"j = 0",
"0",
"j",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"minvalue = L[0]",
"L[0]",
"minvalue",
"count += 1",
"1",
"count",
"flag = 0",
"0",
"flag",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"LL = [[0] for i in range(n)]",
"[[0] for i in range(n)]",
"LL",
"subt = tsubt",
"tsubt",
"subt",
"tmax = L[-1]",
"L[-1]",
"tmax"
] |
import copy
n, t = map(int, input().split())
L = [int(i) for i in input().split()]
LL = [[0] for i in range(n)]
tmax = L[-1]
for i in range(n):
if tmax <= L[-i-1]:
tmax = L[-i-1]
LL[-i-1] = tmax
minvalue = L[0]
maxvalue = LL[0]
subt = 0
count = 1
flag = 0
flagg = 0
j = 0
for i in range(n-1):
if minvalue > L[i]:
minvalue = L[i]
flag = 1
maxvalue = LL[i]
#if maxvalue == L[i]:
#LL = LL[i-j+1:]
#maxvalue = max(LL)
#j = i+1
tsubt = maxvalue - minvalue
if tsubt > subt:
subt = tsubt
count = 1
elif tsubt == subt and flag == 1:
count += 1
flag = 0
#print("L[i]:{0}, min:{1}, max:{2}, subt:{3}, count:{4}".format(L[i], minvalue, maxvalue, subt, count))
print(count)
|
[
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,
17,
0,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
17,
13,
14,
2,
13,
18,
13,
13,
0,
13,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
2,
18,
13,
13,
13,
0,
13,
17,
4,
13,
13,
10,
13,
13,
10,
13,
13,
10,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13
] |
[
[
4,
3
],
[
3,
12
],
[
99,
14
],
[
99,
16
],
[
20,
19
],
[
19,
28
],
[
93,
30
],
[
102,
33
],
[
114,
36
],
[
117,
39
],
[
94,
41
],
[
45,
44
],
[
97,
48
],
[
118,
51
],
[
112,
51
],
[
94,
53
],
[
44,
54
],
[
111,
56
],
[
94,
58
],
[
44,
59
],
[
115,
62
],
[
121,
62
],
[
94,
65
],
[
44,
66
],
[
112,
67
],
[
118,
67
],
[
105,
69
],
[
120,
72
],
[
94,
75
],
[
44,
76
],
[
112,
77
],
[
118,
77
],
[
115,
80
],
[
121,
80
],
[
94,
83
],
[
44,
84
],
[
112,
85
],
[
118,
85
],
[
108,
87
],
[
109,
91
],
[
106,
91
],
[
103,
91
],
[
93,
94
],
[
99,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
120,
121
]
] |
[
"n,t=[int(i) for i in input().split()]\na=[int(i) for i in input().split()]\n\nc=0\ndif=0\nm=a[0]\nfor i in range(1,n):\n if(m>a[i]):\n m=a[i]\n if(dif<a[i]-m):\n c=1\n dif=a[i]-m\n elif(dif==a[i]-m):\n c+=1\nprint(c)",
"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",
"n,t=[int(i) for i in input().split()]",
"n",
"[int(i) for i in 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",
"dif=0",
"dif",
"0",
"m=a[0]",
"m",
"a[0]",
"a",
"0",
"for i in range(1,n):\n if(m>a[i]):\n m=a[i]\n if(dif<a[i]-m):\n c=1\n dif=a[i]-m\n elif(dif==a[i]-m):\n c+=1",
"i",
"range(1,n)",
"range",
"1",
"n",
"if(m>a[i]):\n m=a[i]\n ",
"m>a[i]",
"m",
"a[i]",
"a",
"i",
"m=a[i]",
"m",
"a[i]",
"a",
"i",
"if(dif<a[i]-m):\n c=1\n dif=a[i]-m\n elif(dif==a[i]-m):\n c+=1",
"dif<a[i]-m",
"dif",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"c=1",
"c",
"1",
"dif=a[i]-m",
"dif",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"elif(dif==a[i]-m):\n c+=1",
"dif==a[i]-m",
"dif",
"a[i]-m",
"a[i]",
"a",
"i",
"m",
"c+=1",
"c",
"1",
"print(c)",
"print",
"c",
"a=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"a",
"n,t=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"n",
"t=[int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"t",
"c=0",
"0",
"c",
"c=1",
"1",
"c",
"c+=1",
"1",
"c",
"m=a[i]",
"a[i]",
"m",
"dif=0",
"0",
"dif",
"m=a[0]",
"a[0]",
"m",
"dif=a[i]-m",
"a[i]-m",
"dif"
] |
n,t=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
c=0
dif=0
m=a[0]
for i in range(1,n):
if(m>a[i]):
m=a[i]
if(dif<a[i]-m):
c=1
dif=a[i]-m
elif(dif==a[i]-m):
c+=1
print(c)
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
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,
17,
0,
13,
17,
0,
13,
18,
13,
17,
0,
13,
18,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
4,
13,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
4,
13,
10,
18,
13,
10,
12,
13
] |
[
[
94,
4
],
[
14,
13
],
[
95,
20
],
[
14,
22
],
[
25,
24
],
[
95,
33
],
[
37,
36
],
[
40,
39
],
[
43,
42
],
[
24,
44
],
[
48,
47
],
[
24,
49
],
[
53,
52
],
[
24,
52
],
[
56,
55
],
[
42,
58
],
[
55,
58
],
[
52,
59
],
[
62,
61
],
[
47,
64
],
[
61,
64
],
[
52,
65
],
[
68,
67
],
[
52,
69
],
[
61,
70
],
[
47,
70
],
[
36,
73
],
[
83,
73
],
[
67,
74
],
[
77,
76
],
[
36,
80
],
[
83,
80
],
[
67,
81
],
[
84,
83
],
[
67,
84
],
[
87,
86
],
[
86,
90
],
[
76,
90
],
[
39,
90
],
[
98,
92
],
[
94,
95
]
] |
[
"# import numpy as np\n# import math\nimport sys\ninput = sys.stdin.readline\n\ndef main():\n N,T = map(int,input().split())\n A = list(map(int,input().split()))\n\n maxgain = 0\n time = 0\n maxcost = A[0]\n mincost = A[0]\n\n for now in A:\n # print(now)\n maxcost = max(maxcost,now)\n mincost = min(mincost,now)\n temp = now - mincost\n # print(temp)\n if maxgain == temp:\n time += 1\n elif maxgain < temp:\n maxgain = temp\n time = 1\n # print(maxgain)\n # print(time)\n\n print(time)\n\n\n\nmain()",
"import sys",
"sys",
"input = sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"def main():\n N,T = map(int,input().split())\n A = list(map(int,input().split()))\n\n maxgain = 0\n time = 0\n maxcost = A[0]\n mincost = A[0]\n\n for now in A:\n # print(now)\n maxcost = max(maxcost,now)\n mincost = min(mincost,now)\n temp = now - mincost\n # print(temp)\n if maxgain == temp:\n time += 1\n elif maxgain < temp:\n maxgain = temp\n time = 1\n # print(maxgain)\n # print(time)\n\n print(time)",
"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",
"maxgain = 0",
"maxgain",
"0",
"time = 0",
"time",
"0",
"maxcost = A[0]",
"maxcost",
"A[0]",
"A",
"0",
"mincost = A[0]",
"mincost",
"A[0]",
"A",
"0",
"for now in A:\n # print(now)\n maxcost = max(maxcost,now)\n mincost = min(mincost,now)\n temp = now - mincost\n # print(temp)\n if maxgain == temp:\n time += 1\n elif maxgain < temp:\n maxgain = temp\n time = 1\n # print(maxgain)\n # print(time)\n\n ",
"now",
"A",
"maxcost = max(maxcost,now)",
"maxcost",
"max(maxcost,now)",
"max",
"maxcost",
"now",
"mincost = min(mincost,now)",
"mincost",
"min(mincost,now)",
"min",
"mincost",
"now",
"temp = now - mincost",
"temp",
"now - mincost",
"now",
"mincost",
"if maxgain == temp:\n time += 1\n elif maxgain < temp:\n maxgain = temp\n time = 1\n # print(maxgain)\n # print(time)\n\n ",
"maxgain == temp",
"maxgain",
"temp",
"time += 1",
"time",
"1",
"elif maxgain < temp:\n maxgain = temp\n time = 1\n # print(maxgain)\n # print(time)\n\n ",
"maxgain < temp",
"maxgain",
"temp",
"maxgain = temp",
"maxgain",
"temp",
"time = 1",
"time",
"1",
"print(time)",
"print",
"time",
"main()",
"main",
"input = sys.stdin.readline",
"sys.stdin.readline",
"input",
"def main():\n N,T = map(int,input().split())\n A = list(map(int,input().split()))\n\n maxgain = 0\n time = 0\n maxcost = A[0]\n mincost = A[0]\n\n for now in A:\n # print(now)\n maxcost = max(maxcost,now)\n mincost = min(mincost,now)\n temp = now - mincost\n # print(temp)\n if maxgain == temp:\n time += 1\n elif maxgain < temp:\n maxgain = temp\n time = 1\n # print(maxgain)\n # print(time)\n\n print(time)",
"def main():\n N,T = map(int,input().split())\n A = list(map(int,input().split()))\n\n maxgain = 0\n time = 0\n maxcost = A[0]\n mincost = A[0]\n\n for now in A:\n # print(now)\n maxcost = max(maxcost,now)\n mincost = min(mincost,now)\n temp = now - mincost\n # print(temp)\n if maxgain == temp:\n time += 1\n elif maxgain < temp:\n maxgain = temp\n time = 1\n # print(maxgain)\n # print(time)\n\n print(time)",
"main"
] |
# import numpy as np
# import math
import sys
input = sys.stdin.readline
def main():
N,T = map(int,input().split())
A = list(map(int,input().split()))
maxgain = 0
time = 0
maxcost = A[0]
mincost = A[0]
for now in A:
# print(now)
maxcost = max(maxcost,now)
mincost = min(mincost,now)
temp = now - mincost
# print(temp)
if maxgain == temp:
time += 1
elif maxgain < temp:
maxgain = temp
time = 1
# print(maxgain)
# print(time)
print(time)
main()
|
[
7,
15,
13,
0,
13,
18,
18,
18,
13,
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,
2,
2,
17,
17,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
13,
18,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
13,
15,
0,
13,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
18,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
13,
4,
13,
13,
10,
39,
13,
10,
18,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
13,
13
] |
[
[
127,
4
],
[
133,
13
],
[
128,
20
],
[
133,
22
],
[
139,
24
],
[
128,
33
],
[
109,
36
],
[
118,
39
],
[
47,
46
],
[
131,
49
],
[
140,
53
],
[
46,
54
],
[
119,
55
],
[
113,
55
],
[
112,
57
],
[
140,
59
],
[
46,
60
],
[
113,
63
],
[
119,
63
],
[
140,
65
],
[
46,
66
],
[
110,
69
],
[
140,
73
],
[
46,
74
],
[
113,
75
],
[
119,
75
],
[
121,
78
],
[
110,
81
],
[
124,
83
],
[
115,
86
],
[
122,
93
],
[
116,
98
],
[
143,
98
],
[
136,
100
],
[
142,
103
],
[
137,
107
],
[
125,
107
],
[
109,
110
],
[
112,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
133,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
142,
143
]
] |
[
"import sys\nreadline = sys.stdin.buffer.readline\n\nn,t = map(int,readline().split())\nlst1 = list(map(int,readline().split()))\ncounter = []\nmn = 10**9+1\n\nfor i in range(n):\n if lst1[i] < mn:\n mn = lst1[i]\n if mn < lst1[i]:\n counter.append(lst1[i]-mn)\n\nfrom collections import Counter\nc = Counter(counter)\n\nans = 0\nmx = 0\nfor key,value in c.items():\n if key > mx:\n ans = value\n mx = key\n\nprint(ans)",
"import sys",
"sys",
"readline = sys.stdin.buffer.readline",
"readline",
"sys.stdin.buffer.readline",
"sys.stdin.buffer",
"sys.stdin",
"sys",
"stdin",
"buffer",
"readline",
"n,t = map(int,readline().split())",
"n",
"map(int,readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"t",
"lst1 = list(map(int,readline().split()))",
"lst1",
"list(map(int,readline().split()))",
"list",
"map(int,readline().split())",
"map",
"int",
"readline().split()",
"().split",
"()",
"readline",
"split",
"counter = []",
"counter",
"[]",
"mn = 10**9+1",
"mn",
"10**9+1",
"10**9",
"10",
"9",
"1",
"for i in range(n):\n if lst1[i] < mn:\n mn = lst1[i]\n if mn < lst1[i]:\n counter.append(lst1[i]-mn)",
"i",
"range(n)",
"range",
"n",
"if lst1[i] < mn:\n mn = lst1[i]\n ",
"lst1[i] < mn",
"lst1[i]",
"lst1",
"i",
"mn",
"mn = lst1[i]",
"mn",
"lst1[i]",
"lst1",
"i",
"if mn < lst1[i]:\n counter.append(lst1[i]-mn)",
"mn < lst1[i]",
"mn",
"lst1[i]",
"lst1",
"i",
"counter.append(lst1[i]-mn)",
"counter.append",
"counter",
"append",
"lst1[i]-mn",
"lst1[i]",
"lst1",
"i",
"mn",
"from collections import Counter",
"c = Counter(counter)",
"c",
"Counter(counter)",
"Counter",
"counter",
"ans = 0",
"ans",
"0",
"mx = 0",
"mx",
"0",
"for key,value in c.items():\n if key > mx:\n ans = value\n mx = key",
"key",
"value",
"c.items()",
"c.items",
"c",
"items",
"if key > mx:\n ans = value\n mx = key",
"key > mx",
"key",
"mx",
"ans = value",
"ans",
"value",
"mx = key",
"mx",
"key",
"print(ans)",
"print",
"ans",
"counter = []",
"[]",
"counter",
"mn = lst1[i]",
"lst1[i]",
"mn",
"mx = 0",
"0",
"mx",
"mn = 10**9+1",
"10**9+1",
"mn",
"c = Counter(counter)",
"Counter(counter)",
"c",
"ans = 0",
"0",
"ans",
"readline = sys.stdin.buffer.readline",
"sys.stdin.buffer.readline",
"readline",
"n,t = map(int,readline().split())",
"map(int,readline().split())",
"n",
"t = map(int,readline().split())",
"map(int,readline().split())",
"t",
"ans = value",
"value",
"ans",
"lst1 = list(map(int,readline().split()))",
"list(map(int,readline().split()))",
"lst1",
"mx = key",
"key",
"mx"
] |
import sys
readline = sys.stdin.buffer.readline
n,t = map(int,readline().split())
lst1 = list(map(int,readline().split()))
counter = []
mn = 10**9+1
for i in range(n):
if lst1[i] < mn:
mn = lst1[i]
if mn < lst1[i]:
counter.append(lst1[i]-mn)
from collections import Counter
c = Counter(counter)
ans = 0
mx = 0
for key,value in c.items():
if key > mx:
ans = value
mx = key
print(ans)
|
[
7,
15,
15,
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,
0,
13,
4,
13,
13,
28,
13,
4,
13,
17,
13,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
28,
13,
4,
13,
2,
13,
17,
17,
17,
0,
18,
13,
2,
13,
17,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
2,
4,
13,
13,
4,
13,
13,
0,
13,
2,
4,
13,
13,
4,
13,
13,
4,
13,
4,
18,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] |
[
[
116,
4
],
[
116,
13
],
[
17,
15
],
[
119,
26
],
[
113,
31
],
[
37,
36
],
[
117,
40
],
[
45,
42
],
[
120,
43
],
[
36,
44
],
[
120,
48
],
[
36,
50
],
[
42,
52
],
[
120,
53
],
[
36,
54
],
[
57,
56
],
[
117,
60
],
[
70,
65
],
[
114,
66
],
[
56,
68
],
[
114,
73
],
[
56,
74
],
[
114,
76
],
[
56,
78
],
[
122,
81
],
[
114,
85
],
[
120,
88
],
[
125,
90
],
[
120,
97
],
[
126,
104
],
[
123,
108
],
[
116,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
],
[
125,
126
]
] |
[
"from copy import*\nfrom numpy import*\na,b=map(int,input().split())\n*c,=map(int,input().split())\nc1=deepcopy(c)\nc2=deepcopy(c)\n\nfor i in range(1,a):\n c1[i]=min(c1[i-1],c1[i])\nfor i in range(a-1,0,-1):\n c2[i-1]=max(c2[i],c2[i-1])\n\n#print(c1,c2)\nd=array(c2)-array(c1)\nd2=array(c)-array(c1)\nprint(list(d2).count(max(d)))",
"from copy import*",
"from numpy import*",
"a,b=map(int,input().split())",
"a",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"b",
"*c,=map(int,input().split())",
"*c",
"c",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"c1=deepcopy(c)",
"c1",
"deepcopy(c)",
"deepcopy",
"c",
"c2=deepcopy(c)",
"c2",
"deepcopy(c)",
"deepcopy",
"c",
"for i in range(1,a):\n c1[i]=min(c1[i-1],c1[i])",
"i",
"range(1,a)",
"range",
"1",
"a",
"c1[i]=min(c1[i-1],c1[i])",
"c1[i]",
"c1",
"i",
"min(c1[i-1],c1[i])",
"min",
"c1[i-1]",
"c1",
"i-1",
"i",
"1",
"c1[i]",
"c1",
"i",
"for i in range(a-1,0,-1):\n c2[i-1]=max(c2[i],c2[i-1])\n\n#print(c1,c2)",
"i",
"range(a-1,0,-1)",
"range",
"a-1",
"a",
"1",
"0",
"-1",
"c2[i-1]=max(c2[i],c2[i-1])",
"c2[i-1]",
"c2",
"i-1",
"i",
"1",
"max(c2[i],c2[i-1])",
"max",
"c2[i]",
"c2",
"i",
"c2[i-1]",
"c2",
"i-1",
"i",
"1",
"d=array(c2)-array(c1)",
"d",
"array(c2)-array(c1)",
"array(c2)",
"array",
"c2",
"array(c1)",
"array",
"c1",
"d2=array(c)-array(c1)",
"d2",
"array(c)-array(c1)",
"array(c)",
"array",
"c",
"array(c1)",
"array",
"c1",
"print(list(d2).count(max(d)))",
"print",
"list(d2).count(max(d))",
"(d2).count",
"(d2)",
"list",
"d2",
"count",
"max(d)",
"max",
"d",
"b=map(int,input().split())",
"map(int,input().split())",
"b",
"c2=deepcopy(c)",
"deepcopy(c)",
"c2",
"a,b=map(int,input().split())",
"map(int,input().split())",
"a",
"c1=deepcopy(c)",
"deepcopy(c)",
"c1",
"d=array(c2)-array(c1)",
"array(c2)-array(c1)",
"d",
"d2=array(c)-array(c1)",
"array(c)-array(c1)",
"d2"
] |
from copy import*
from numpy import*
a,b=map(int,input().split())
*c,=map(int,input().split())
c1=deepcopy(c)
c2=deepcopy(c)
for i in range(1,a):
c1[i]=min(c1[i-1],c1[i])
for i in range(a-1,0,-1):
c2[i-1]=max(c2[i],c2[i-1])
#print(c1,c2)
d=array(c2)-array(c1)
d2=array(c)-array(c1)
print(list(d2).count(max(d)))
|
[
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,
17,
28,
13,
18,
4,
13,
13,
39,
17,
4,
18,
13,
13,
4,
13,
18,
13,
17,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
13,
0,
13,
39,
28,
13,
4,
13,
13,
4,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
4,
18,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
14,
2,
18,
13,
17,
18,
13,
13,
0,
13,
17,
4,
13,
13,
3,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
39,
13
] |
[
[
118,
2
],
[
118,
11
],
[
121,
13
],
[
124,
25
],
[
30,
29
],
[
119,
33
],
[
125,
38
],
[
125,
43
],
[
122,
46
],
[
29,
47
],
[
125,
50
],
[
125,
54
],
[
115,
57
],
[
61,
60
],
[
119,
63
],
[
116,
66
],
[
125,
70
],
[
60,
71
],
[
122,
73
],
[
60,
74
],
[
116,
77
],
[
81,
80
],
[
109,
83
],
[
87,
86
],
[
119,
89
],
[
116,
93
],
[
116,
96
],
[
86,
97
],
[
106,
99
],
[
110,
103
],
[
107,
103
],
[
106,
107
],
[
109,
110
],
[
118,
113
],
[
115,
116
],
[
118,
119
],
[
121,
122
],
[
124,
125
]
] |
[
"#14:18\nn,t = map(int,input().split())\na = list(map(int,input().split()))\nb = [0]\nfor i in range(n)[::-1]:\n b.append(max(b[-1],a[i]))\nb.reverse()\nb.pop()\n#print(b)\nc = []\nfor i in range(n):\n c.append(b[i]-a[i])\nc.sort(reverse=True)\n#print(c)\ncnt = 0\nfor i in range(n):\n if c[0] == c[i]:\n cnt += 1\n else:\n print(cnt)\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",
"b = [0]",
"b",
"[0]",
"0",
"for i in range(n)[::-1]:\n b.append(max(b[-1],a[i]))",
"i",
"range(n)[::-1]",
"(n)",
"range",
"n",
"::-1",
"-1",
"b.append(max(b[-1],a[i]))",
"b.append",
"b",
"append",
"max(b[-1],a[i])",
"max",
"b[-1]",
"b",
"-1",
"a[i]",
"a",
"i",
"b.reverse()",
"b.reverse",
"b",
"reverse",
"b.pop()",
"b.pop",
"b",
"pop",
"c = []",
"c",
"[]",
"for i in range(n):\n c.append(b[i]-a[i])",
"i",
"range(n)",
"range",
"n",
"c.append(b[i]-a[i])",
"c.append",
"c",
"append",
"b[i]-a[i]",
"b[i]",
"b",
"i",
"a[i]",
"a",
"i",
"c.sort(reverse=True)",
"c.sort",
"c",
"sort",
"reverse=True",
"reverse",
"True",
"cnt = 0",
"cnt",
"0",
"for i in range(n):\n if c[0] == c[i]:\n cnt += 1\n else:\n print(cnt)\n break",
"i",
"range(n)",
"range",
"n",
"if c[0] == c[i]:\n cnt += 1\n else:\n print(cnt)\n break",
"c[0] == c[i]",
"c[0]",
"c",
"0",
"c[i]",
"c",
"i",
"cnt += 1",
"cnt",
"1",
"print(cnt)",
"print",
"cnt",
"break",
"cnt += 1",
"1",
"cnt",
"cnt = 0",
"0",
"cnt",
"t = map(int,input().split())",
"map(int,input().split())",
"t",
"c = []",
"[]",
"c",
"n,t = map(int,input().split())",
"map(int,input().split())",
"n",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"b = [0]",
"[0]",
"b"
] |
#14:18
n,t = map(int,input().split())
a = list(map(int,input().split()))
b = [0]
for i in range(n)[::-1]:
b.append(max(b[-1],a[i]))
b.reverse()
b.pop()
#print(b)
c = []
for i in range(n):
c.append(b[i]-a[i])
c.sort(reverse=True)
#print(c)
cnt = 0
for i in range(n):
if c[0] == c[i]:
cnt += 1
else:
print(cnt)
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,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
4,
13,
13,
13,
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,
4,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] |
[
[
99,
2
],
[
99,
11
],
[
90,
13
],
[
102,
25
],
[
93,
28
],
[
75,
31
],
[
84,
34
],
[
38,
37
],
[
91,
37
],
[
72,
40
],
[
76,
43
],
[
73,
43
],
[
37,
44
],
[
85,
47
],
[
88,
47
],
[
37,
49
],
[
73,
50
],
[
76,
50
],
[
81,
52
],
[
85,
56
],
[
88,
56
],
[
37,
58
],
[
73,
59
],
[
76,
59
],
[
87,
61
],
[
37,
63
],
[
73,
64
],
[
76,
64
],
[
96,
66
],
[
97,
70
],
[
82,
70
],
[
103,
70
],
[
72,
73
],
[
75,
76
],
[
99,
79
],
[
81,
82
],
[
84,
85
],
[
87,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\n\nans = 0\nsame = 0\nmn = 1100000000\ndif = 0\nfor x in a:\n mn = min(mn, x)\n if dif == x - mn:\n ans += 1\n if dif < x - mn:\n dif = x - mn\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",
"ans = 0",
"ans",
"0",
"same = 0",
"same",
"0",
"mn = 1100000000",
"mn",
"1100000000",
"dif = 0",
"dif",
"0",
"for x in a:\n mn = min(mn, x)\n if dif == x - mn:\n ans += 1\n if dif < x - mn:\n dif = x - mn\n ans = 1\n ",
"x",
"a",
"mn = min(mn, x)",
"mn",
"min(mn, x)",
"min",
"mn",
"x",
"if dif == x - mn:\n ans += 1\n ",
"dif == x - mn",
"dif",
"x - mn",
"x",
"mn",
"ans += 1",
"ans",
"1",
"if dif < x - mn:\n dif = x - mn\n ans = 1\n ",
"dif < x - mn",
"dif",
"x - mn",
"x",
"mn",
"dif = x - mn",
"dif",
"x - mn",
"x",
"mn",
"ans = 1",
"ans",
"1",
"print(ans)",
"print",
"ans",
"mn = min(mn, x)",
"min(mn, x)",
"mn",
"mn = 1100000000",
"1100000000",
"mn",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"ans += 1",
"1",
"ans",
"dif = 0",
"0",
"dif",
"dif = x - mn",
"x - mn",
"dif",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"same = 0",
"0",
"same",
"ans = 1",
"1",
"ans",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"ans = 0",
"0",
"ans"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
same = 0
mn = 1100000000
dif = 0
for x in a:
mn = min(mn, x)
if dif == x - mn:
ans += 1
if dif < x - mn:
dif = x - mn
ans = 1
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,
14,
2,
2,
13,
17,
17,
0,
13,
17,
15,
0,
13,
39,
0,
13,
2,
39,
4,
13,
17,
13,
28,
13,
4,
13,
13,
14,
2,
13,
17,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
39,
28,
13,
13,
4,
13,
13,
13,
4,
13,
13,
2,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
42,
13,
0,
13,
4,
13,
13,
14,
2,
13,
13,
0,
13,
17,
3,
4,
13,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
39,
13
] |
[
[
148,
2
],
[
148,
11
],
[
15,
14
],
[
14,
23
],
[
127,
25
],
[
143,
30
],
[
130,
34
],
[
136,
38
],
[
133,
41
],
[
149,
47
],
[
50,
49
],
[
149,
52
],
[
49,
55
],
[
61,
58
],
[
134,
59
],
[
49,
60
],
[
128,
62
],
[
49,
63
],
[
68,
65
],
[
134,
66
],
[
49,
67
],
[
134,
71
],
[
49,
73
],
[
128,
76
],
[
49,
77
],
[
151,
79
],
[
128,
86
],
[
134,
87
],
[
152,
90
],
[
145,
95
],
[
124,
98
],
[
152,
101
],
[
139,
105
],
[
152,
108
],
[
140,
111
],
[
125,
112
],
[
121,
114
],
[
122,
119
],
[
146,
119
],
[
121,
122
],
[
124,
125
],
[
127,
128
],
[
130,
131
],
[
133,
134
],
[
136,
137
],
[
139,
140
],
[
148,
143
],
[
145,
146
],
[
148,
149
],
[
151,
152
]
] |
[
"N,T = map(int, input().split())\nA = [int(i) for i in input().split()]\n\n# 買う数 == 売る数\nif T % 2 == 1:\n T -= 1\n\nfrom heapq import heappop,heappush\n\nplace = []\nMINA = [float(\"inf\")] * N\nfor i in range(N):\n if i == 0:\n MINA[i] = A[i]\n else:\n MINA[i] = min(MINA[i-1], A[i])\n\nsub = []\nfor a,m in zip(A,MINA):\n heappush(sub, m - a)\n\nans = 1\nMAXSUB = heappop(sub)\nwhile sub:\n s = heappop(sub)\n if s == MAXSUB:\n ans += 1\n else:\n break\n\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()]",
"if T % 2 == 1:\n T -= 1",
"T % 2 == 1",
"T % 2",
"T",
"2",
"1",
"T -= 1",
"T",
"1",
"from heapq import heappop,heappush",
"place = []",
"place",
"[]",
"MINA = [float(\"inf\")] * N",
"MINA",
"[float(\"inf\")] * N",
"[float(\"inf\")]",
"float(\"inf\")",
"float",
"\"inf\"",
"N",
"for i in range(N):\n if i == 0:\n MINA[i] = A[i]\n else:\n MINA[i] = min(MINA[i-1], A[i])",
"i",
"range(N)",
"range",
"N",
"if i == 0:\n MINA[i] = A[i]\n else:\n MINA[i] = min(MINA[i-1], A[i])",
"i == 0",
"i",
"0",
"MINA[i] = A[i]",
"MINA[i]",
"MINA",
"i",
"A[i]",
"A",
"i",
"MINA[i] = min(MINA[i-1], A[i])",
"MINA[i]",
"MINA",
"i",
"min(MINA[i-1], A[i])",
"min",
"MINA[i-1]",
"MINA",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"sub = []",
"sub",
"[]",
"for a,m in zip(A,MINA):\n heappush(sub, m - a)",
"a",
"m",
"zip(A,MINA)",
"zip",
"A",
"MINA",
"heappush(sub, m - a)",
"heappush",
"sub",
"m - a",
"m",
"a",
"ans = 1",
"ans",
"1",
"MAXSUB = heappop(sub)",
"MAXSUB",
"heappop(sub)",
"heappop",
"sub",
"while sub:\n s = heappop(sub)\n if s == MAXSUB:\n ans += 1\n else:\n break",
"sub",
"s = heappop(sub)",
"s",
"heappop(sub)",
"heappop",
"sub",
"if s == MAXSUB:\n ans += 1\n else:\n break",
"s == MAXSUB",
"s",
"MAXSUB",
"ans += 1",
"ans",
"1",
"break",
"print(ans)",
"print",
"ans",
"ans += 1",
"1",
"ans",
"MAXSUB = heappop(sub)",
"heappop(sub)",
"MAXSUB",
"A = [int(i) for i in input().split()]",
"[int(i) for i in input().split()]",
"A",
"T -= 1",
"1",
"T",
"MINA = [float(\"inf\")] * N",
"[float(\"inf\")] * N",
"MINA",
"place = []",
"[]",
"place",
"s = heappop(sub)",
"heappop(sub)",
"s",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"ans = 1",
"1",
"ans",
"N,T = map(int, input().split())",
"map(int, input().split())",
"N",
"sub = []",
"[]",
"sub"
] |
N,T = map(int, input().split())
A = [int(i) for i in input().split()]
# 買う数 == 売る数
if T % 2 == 1:
T -= 1
from heapq import heappop,heappush
place = []
MINA = [float("inf")] * N
for i in range(N):
if i == 0:
MINA[i] = A[i]
else:
MINA[i] = min(MINA[i-1], A[i])
sub = []
for a,m in zip(A,MINA):
heappush(sub, m - a)
ans = 1
MAXSUB = heappop(sub)
while sub:
s = heappop(sub)
if s == MAXSUB:
ans += 1
else:
break
print(ans)
|
[
7,
15,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
18,
18,
13,
13,
13,
15,
15,
15,
15,
15,
15,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
28,
13,
13,
23,
12,
13,
23,
13,
12,
13,
12,
13,
12,
13,
12,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
2,
4,
13,
13,
17,
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,
4,
4,
13,
4,
13,
13,
4,
18,
13,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
0,
13,
13,
0,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
13,
4,
13,
13,
0,
13,
2,
13,
13,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
4,
13,
10,
18,
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,
12,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] |
[
[
220,
11
],
[
217,
24
],
[
253,
29
],
[
39,
38
],
[
44,
44
],
[
56,
55
],
[
221,
59
],
[
55,
65
],
[
74,
73
],
[
83,
83
],
[
87,
86
],
[
212,
92
],
[
96,
96
],
[
100,
99
],
[
227,
105
],
[
109,
109
],
[
113,
112
],
[
221,
114
],
[
112,
123
],
[
137,
136
],
[
242,
138
],
[
137,
139
],
[
142,
141
],
[
212,
143
],
[
146,
145
],
[
218,
146
],
[
149,
148
],
[
152,
151
],
[
155,
154
],
[
141,
161
],
[
164,
163
],
[
145,
166
],
[
196,
166
],
[
151,
169
],
[
179,
169
],
[
163,
170
],
[
173,
172
],
[
151,
176
],
[
179,
176
],
[
163,
177
],
[
180,
179
],
[
163,
180
],
[
183,
182
],
[
145,
186
],
[
196,
186
],
[
190,
189
],
[
145,
193
],
[
196,
193
],
[
197,
196
],
[
200,
199
],
[
182,
203
],
[
172,
203
],
[
154,
203
],
[
251,
209
],
[
217,
218
],
[
220,
221
],
[
253,
254
]
] |
[
"#\n# ⋀_⋀ \n# (・ω・) \n# ./ U ∽ U\\n# │* 合 *│\n# │* 格 *│ \n# │* 祈 *│ \n# │* 願 *│ \n# │* *│ \n#  ̄\n#\nimport sys\nsys.setrecursionlimit(10**6)\ninput=sys.stdin.readline\nfrom math import floor,ceil,sqrt,factorial,log #log2ないyp\nfrom heapq import heappop, heappush, heappushpop\nfrom collections import Counter,defaultdict,deque\nfrom itertools import accumulate,permutations,combinations,product,combinations_with_replacement\nfrom bisect import bisect_left,bisect_right\nfrom copy import deepcopy\ninf=float('inf')\nmod = 10**9+7\ndef pprint(*A): \n for a in A: print(*a,sep='\\n')\ndef INT_(n): return int(n)-1\ndef MI(): return map(int,input().split())\ndef MF(): return map(float, input().split())\ndef MI_(): return map(INT_,input().split())\ndef LI(): return list(MI())\ndef LI_(): return [int(x) - 1 for x in input().split()]\ndef LF(): return list(MF())\ndef LIN(n:int): return [I() for _ in range(n)]\ndef LLIN(n: int): return [LI() for _ in range(n)]\ndef LLIN_(n: int): return [LI_() for _ in range(n)]\ndef LLI(): return [list(map(int, l.split() )) for l in input()]\ndef I(): return int(input())\ndef F(): return float(input())\ndef ST(): return input().replace('\\n', '')\ndef main():\n N,T=MI()\n A=LI()\n mini = inf\n mini_cnt = 0\n max_profit = 0\n ans = 0\n for i,a in enumerate(A):\n profit = a-mini\n if max_profit==profit:\n ans += 1\n if max_profit<profit:\n max_profit = profit\n ans = 1\n if mini==a:\n mini_cnt+=1\n if mini>a:\n mini=a\n mini_cnt=1\n print(ans)\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"input=sys.stdin.readline",
"input",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"from math import floor,ceil,sqrt,factorial,log",
"from heapq import heappop, heappush, heappushpop",
"from collections import Counter,defaultdict,deque",
"from itertools import accumulate,permutations,combinations,product,combinations_with_replacement",
"from bisect import bisect_left,bisect_right",
"from copy import deepcopy",
"inf=float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"mod = 10**9+7",
"mod",
"10**9+7",
"10**9",
"10",
"9",
"7",
"def pprint(*A): \n for a in A: print(*a,sep='\\n')",
"pprint",
"for a in A: print(*a,sep='",
"a",
"A",
"*A",
"def INT_(n): return int(n)-1",
"INT_",
"n",
"n",
"def MI(): return map(int,input().split())",
"MI",
"def MF(): return map(float, input().split())",
"MF",
"def MI_(): return map(INT_,input().split())",
"MI_",
"def LI(): return list(MI())",
"LI",
"int(x) - 1 for x in input().split()",
"for x in input().split()",
"x",
"input().split()",
"().split",
"()",
"input",
"split",
"for x in input().split()",
"int(x) - 1",
"int(x)",
"int",
"x",
"1",
"def LI_(): return [int(x) - 1 for x in input().split()]",
"LI_",
"def LF(): return list(MF())",
"LF",
"I() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"I()",
"I",
"def LIN(n:int): return [I() for _ in range(n)]",
"LIN",
"n:int",
"n",
"LI() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"LI()",
"LI",
"def LLIN(n: int): return [LI() for _ in range(n)]",
"LLIN",
"n: int",
"n",
"LI_() for _ in range(n)",
"for _ in range(n)",
"_",
"range(n)",
"range",
"n",
"for _ in range(n)",
"LI_()",
"LI_",
"def LLIN_(n: int): return [LI_() for _ in range(n)]",
"LLIN_",
"n: int",
"n",
"list(map(int, l.split() )) for l in input()",
"for l in input()",
"l",
"input()",
"input",
"for l in input()",
"list(map(int, l.split() ))",
"list",
"map(int, l.split() )",
"map",
"int",
"l.split()",
"l.split",
"l",
"split",
"def LLI(): return [list(map(int, l.split() )) for l in input()]",
"LLI",
"def I(): return int(input())",
"I",
"def F(): return float(input())",
"F",
"def ST(): return input().replace('\\n', '')",
"ST",
"def main():\n N,T=MI()\n A=LI()\n mini = inf\n mini_cnt = 0\n max_profit = 0\n ans = 0\n for i,a in enumerate(A):\n profit = a-mini\n if max_profit==profit:\n ans += 1\n if max_profit<profit:\n max_profit = profit\n ans = 1\n if mini==a:\n mini_cnt+=1\n if mini>a:\n mini=a\n mini_cnt=1\n print(ans)",
"main",
"N,T=MI()",
"N",
"MI()",
"MI",
"T",
"A=LI()",
"A",
"LI()",
"LI",
"mini = inf",
"mini",
"inf",
"mini_cnt = 0",
"mini_cnt",
"0",
"max_profit = 0",
"max_profit",
"0",
"ans = 0",
"ans",
"0",
"for i,a in enumerate(A):\n profit = a-mini\n if max_profit==profit:\n ans += 1\n if max_profit<profit:\n max_profit = profit\n ans = 1\n if mini==a:\n mini_cnt+=1\n if mini>a:\n mini=a\n mini_cnt=1\n ",
"i",
"a",
"enumerate(A)",
"enumerate",
"A",
"profit = a-mini",
"profit",
"a-mini",
"a",
"mini",
"if max_profit==profit:\n ans += 1\n ",
"max_profit==profit",
"max_profit",
"profit",
"ans += 1",
"ans",
"1",
"if max_profit<profit:\n max_profit = profit\n ans = 1\n ",
"max_profit<profit",
"max_profit",
"profit",
"max_profit = profit",
"max_profit",
"profit",
"ans = 1",
"ans",
"1",
"if mini==a:\n mini_cnt+=1\n ",
"mini==a",
"mini",
"a",
"mini_cnt+=1",
"mini_cnt",
"1",
"if mini>a:\n mini=a\n mini_cnt=1\n ",
"mini>a",
"mini",
"a",
"mini=a",
"mini",
"a",
"mini_cnt=1",
"mini_cnt",
"1",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def LI(): return list(MI())",
"def LI(): return list(MI())",
"LI",
"def MF(): return map(float, input().split())",
"def MF(): return map(float, input().split())",
"MF",
"inf=float('inf')",
"float('inf')",
"inf",
"input=sys.stdin.readline",
"sys.stdin.readline",
"input",
"def INT_(n): return int(n)-1",
"def INT_(n): return int(n)-1",
"INT_",
"def LI_(): return [int(x) - 1 for x in input().split()]",
"def LI_(): return [int(x) - 1 for x in input().split()]",
"LI_",
"def ST(): return input().replace('\\n', '')",
"def ST(): return input().replace('\\n', '')",
"ST",
"def LLIN(n: int): return [LI() for _ in range(n)]",
"def LLIN(n: int): return [LI() for _ in range(n)]",
"LLIN",
"def pprint(*A): \n for a in A: print(*a,sep='\\n')",
"def pprint(*A): \n for a in A: print(*a,sep='\\n')",
"pprint",
"def MI_(): return map(INT_,input().split())",
"def MI_(): return map(INT_,input().split())",
"MI_",
"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 F(): return float(input())",
"def F(): return float(input())",
"F",
"def main():\n N,T=MI()\n A=LI()\n mini = inf\n mini_cnt = 0\n max_profit = 0\n ans = 0\n for i,a in enumerate(A):\n profit = a-mini\n if max_profit==profit:\n ans += 1\n if max_profit<profit:\n max_profit = profit\n ans = 1\n if mini==a:\n mini_cnt+=1\n if mini>a:\n mini=a\n mini_cnt=1\n print(ans)",
"def main():\n N,T=MI()\n A=LI()\n mini = inf\n mini_cnt = 0\n max_profit = 0\n ans = 0\n for i,a in enumerate(A):\n profit = a-mini\n if max_profit==profit:\n ans += 1\n if max_profit<profit:\n max_profit = profit\n ans = 1\n if mini==a:\n mini_cnt+=1\n if mini>a:\n mini=a\n mini_cnt=1\n print(ans)",
"main",
"mod = 10**9+7",
"10**9+7",
"mod",
"def LF(): return list(MF())",
"def LF(): return list(MF())",
"LF",
"def LIN(n:int): return [I() for _ in range(n)]",
"def LIN(n:int): return [I() for _ in range(n)]",
"LIN",
"def LLIN_(n: int): return [LI_() for _ in range(n)]",
"def LLIN_(n: int): return [LI_() for _ in range(n)]",
"LLIN_",
"def LLI(): return [list(map(int, l.split() )) for l in input()]",
"def LLI(): return [list(map(int, l.split() )) for l in input()]",
"LLI"
] |
#
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A):
for a in A: print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
N,T=MI()
A=LI()
mini = inf
mini_cnt = 0
max_profit = 0
ans = 0
for i,a in enumerate(A):
profit = a-mini
if max_profit==profit:
ans += 1
if max_profit<profit:
max_profit = profit
ans = 1
if mini==a:
mini_cnt+=1
if mini>a:
mini=a
mini_cnt=1
print(ans)
if __name__ == '__main__':
main()
|
[
7,
15,
13,
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,
18,
13,
13,
4,
13,
0,
13,
4,
18,
18,
13,
13,
13,
13,
0,
13,
2,
13,
13,
0,
13,
4,
18,
2,
13,
4,
18,
13,
13,
13,
4,
13,
13,
10,
2,
13,
10,
18,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13
] |
[
[
87,
6
],
[
102,
11
],
[
111,
18
],
[
88,
29
],
[
93,
33
],
[
88,
39
],
[
105,
43
],
[
112,
45
],
[
105,
46
],
[
96,
48
],
[
112,
54
],
[
108,
56
],
[
97,
63
],
[
84,
65
],
[
97,
67
],
[
109,
68
],
[
99,
70
],
[
85,
74
],
[
85,
77
],
[
100,
82
],
[
84,
85
],
[
87,
88
],
[
105,
91
],
[
93,
94
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
]
] |
[
"import sys\nimport numpy as np\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 = np.array(rl())\nA_cummin = np.minimum.accumulate(A)\nB = A - A_cummin\n\nanswer = (B == B.max()).sum()\nprint(answer)",
"import sys",
"sys",
"import numpy as np",
"numpy",
"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 = np.array(rl())",
"A",
"np.array(rl())",
"np.array",
"np",
"array",
"rl()",
"rl",
"A_cummin = np.minimum.accumulate(A)",
"A_cummin",
"np.minimum.accumulate(A)",
"np.minimum.accumulate",
"np.minimum",
"np",
"minimum",
"accumulate",
"A",
"B = A - A_cummin",
"B",
"A - A_cummin",
"A",
"A_cummin",
"answer = (B == B.max()).sum()",
"answer",
"(B == B.max()).sum()",
"B == B.max()).sum",
"B == B.max()",
"B",
"B.max()",
"B.max",
"B",
"max",
"sum",
"print(answer)",
"print",
"answer",
"B = A - A_cummin",
"A - A_cummin",
"B",
"stdin = sys.stdin",
"sys.stdin",
"stdin",
"T = rl()",
"rl()",
"T",
"rs = lambda: stdin.readline().rstrip()",
"lambda: stdin.readline().rstrip()",
"rs",
"A = np.array(rl())",
"np.array(rl())",
"A",
"answer = (B == B.max()).sum()",
"(B == B.max()).sum()",
"answer",
"ri = lambda: int(rs())",
"lambda: int(rs())",
"ri",
"N, T = rl()",
"rl()",
"N",
"A_cummin = np.minimum.accumulate(A)",
"np.minimum.accumulate(A)",
"A_cummin",
"rl = lambda: list(map(int, stdin.readline().split()))",
"lambda: list(map(int, stdin.readline().split()))",
"rl"
] |
import sys
import numpy as np
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 = np.array(rl())
A_cummin = np.minimum.accumulate(A)
B = A - A_cummin
answer = (B == B.max()).sum()
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,
18,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
13,
0,
13,
2,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
17,
0,
13,
4,
13,
13,
18,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
13,
13,
10,
18,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
101,
2
],
[
101,
11
],
[
104,
13
],
[
92,
25
],
[
105,
27
],
[
83,
30
],
[
95,
33
],
[
37,
36
],
[
102,
40
],
[
98,
42
],
[
105,
45
],
[
36,
46
],
[
93,
47
],
[
108,
47
],
[
84,
50
],
[
90,
50
],
[
99,
51
],
[
89,
53
],
[
99,
54
],
[
80,
56
],
[
84,
60
],
[
90,
60
],
[
99,
61
],
[
86,
63
],
[
107,
66
],
[
93,
69
],
[
108,
69
],
[
105,
71
],
[
36,
72
],
[
87,
75
],
[
81,
75
],
[
96,
75
],
[
101,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
],
[
99,
89
],
[
89,
90
],
[
92,
93
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
104,
105
],
[
107,
108
]
] |
[
"N, T = map(int, input().split())\nA = list(map(int, input().split()))\n\nmin_town_price = A[0]\nmax_profit = -1\nmax_profit_pairs = 0\nfor i in range(1, N):\n profit = A[i] - min_town_price\n if max_profit < profit:\n max_profit = profit\n max_profit_pairs = 1\n elif max_profit == profit:\n max_profit_pairs += 1\n min_town_price = min(min_town_price, A[i])\nprint(max_profit_pairs)",
"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_town_price = A[0]",
"min_town_price",
"A[0]",
"A",
"0",
"max_profit = -1",
"max_profit",
"-1",
"max_profit_pairs = 0",
"max_profit_pairs",
"0",
"for i in range(1, N):\n profit = A[i] - min_town_price\n if max_profit < profit:\n max_profit = profit\n max_profit_pairs = 1\n elif max_profit == profit:\n max_profit_pairs += 1\n min_town_price = min(min_town_price, A[i])",
"i",
"range(1, N)",
"range",
"1",
"N",
"profit = A[i] - min_town_price",
"profit",
"A[i] - min_town_price",
"A[i]",
"A",
"i",
"min_town_price",
"if max_profit < profit:\n max_profit = profit\n max_profit_pairs = 1\n elif max_profit == profit:\n max_profit_pairs += 1\n ",
"max_profit < profit",
"max_profit",
"profit",
"max_profit = profit",
"max_profit",
"profit",
"max_profit_pairs = 1",
"max_profit_pairs",
"1",
"elif max_profit == profit:\n max_profit_pairs += 1\n ",
"max_profit == profit",
"max_profit",
"profit",
"max_profit_pairs += 1",
"max_profit_pairs",
"1",
"min_town_price = min(min_town_price, A[i])",
"min_town_price",
"min(min_town_price, A[i])",
"min",
"min_town_price",
"A[i]",
"A",
"i",
"print(max_profit_pairs)",
"print",
"max_profit_pairs",
"T = map(int, input().split())",
"map(int, input().split())",
"T",
"max_profit_pairs = 1",
"1",
"max_profit_pairs",
"max_profit = -1",
"-1",
"max_profit",
"max_profit_pairs += 1",
"1",
"max_profit_pairs",
"max_profit = profit",
"profit",
"max_profit",
"min_town_price = A[0]",
"A[0]",
"min_town_price",
"max_profit_pairs = 0",
"0",
"max_profit_pairs",
"profit = A[i] - min_town_price",
"A[i] - min_town_price",
"profit",
"N, T = map(int, input().split())",
"map(int, input().split())",
"N",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"min_town_price = min(min_town_price, A[i])",
"min(min_town_price, A[i])",
"min_town_price"
] |
N, T = map(int, input().split())
A = list(map(int, input().split()))
min_town_price = A[0]
max_profit = -1
max_profit_pairs = 0
for i in range(1, N):
profit = A[i] - min_town_price
if max_profit < profit:
max_profit = profit
max_profit_pairs = 1
elif max_profit == profit:
max_profit_pairs += 1
min_town_price = min(min_town_price, A[i])
print(max_profit_pairs)
|
[
7,
15,
13,
4,
18,
13,
13,
17,
0,
13,
4,
13,
17,
0,
13,
2,
2,
17,
17,
17,
0,
13,
12,
4,
18,
4,
18,
18,
13,
13,
13,
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,
2,
13,
17,
17,
17,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
4,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
4,
13,
4,
13,
17,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13
] |
[
[
114,
9
],
[
123,
14
],
[
117,
21
],
[
36,
35
],
[
118,
42
],
[
36,
44
],
[
47,
46
],
[
118,
55
],
[
59,
58
],
[
35,
62
],
[
67,
64
],
[
58,
65
],
[
46,
68
],
[
72,
71
],
[
35,
75
],
[
83,
80
],
[
58,
81
],
[
71,
82
],
[
46,
86
],
[
71,
87
],
[
58,
89
],
[
71,
91
],
[
95,
94
],
[
58,
99
],
[
46,
104
],
[
121,
112
],
[
114,
115
],
[
117,
118
],
[
123,
124
]
] |
[
"import sys\nsys.setrecursionlimit(2147483647)\nINF=float(\"inf\")\nMOD=10**9+7\ninput=lambda :sys.stdin.readline().rstrip()\ndef resolve():\n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n S=[None]*n\n S[-1]=A[-1]\n for i in range(n-2,-1,-1):\n S[i]=max(A[i],S[i+1])\n d=max(S[i+1]-A[i] for i in range(n-1))\n print(sum(1 for i in range(n-1) if(S[i+1]-A[i]==d)))\nresolve()",
"import sys",
"sys",
"sys.setrecursionlimit(2147483647)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"2147483647",
"INF=float(\"inf\")",
"INF",
"float(\"inf\")",
"float",
"\"inf\"",
"MOD=10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"input=lambda :sys.stdin.readline().rstrip()",
"input",
"lambda :sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip()",
"sys.stdin.readline().rstrip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"rstrip",
"def resolve():\n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n S=[None]*n\n S[-1]=A[-1]\n for i in range(n-2,-1,-1):\n S[i]=max(A[i],S[i+1])\n d=max(S[i+1]-A[i] for i in range(n-1))\n print(sum(1 for i in range(n-1) if(S[i+1]-A[i]==d)))",
"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",
"S=[None]*n",
"S",
"[None]*n",
"[None]",
"None",
"n",
"S[-1]=A[-1]",
"S[-1]",
"S",
"-1",
"A[-1]",
"A",
"-1",
"for i in range(n-2,-1,-1):\n S[i]=max(A[i],S[i+1])\n ",
"i",
"range(n-2,-1,-1)",
"range",
"n-2",
"n",
"2",
"-1",
"-1",
"S[i]=max(A[i],S[i+1])",
"S[i]",
"S",
"i",
"max(A[i],S[i+1])",
"max",
"A[i]",
"A",
"i",
"S[i+1]",
"S",
"i+1",
"i",
"1",
"d=max(S[i+1]-A[i] for i in range(n-1))",
"d",
"max(S[i+1]-A[i] for i in range(n-1))",
"max",
"S[i+1]-A[i]",
"S[i+1]",
"S",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"print(sum(1 for i in range(n-1) if(S[i+1]-A[i]==d)))",
"print",
"sum(1 for i in range(n-1) if(S[i+1]-A[i]==d))",
"sum",
"1",
"resolve()",
"resolve",
"INF=float(\"inf\")",
"float(\"inf\")",
"INF",
"input=lambda :sys.stdin.readline().rstrip()",
"lambda :sys.stdin.readline().rstrip()",
"input",
"def resolve():\n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n S=[None]*n\n S[-1]=A[-1]\n for i in range(n-2,-1,-1):\n S[i]=max(A[i],S[i+1])\n d=max(S[i+1]-A[i] for i in range(n-1))\n print(sum(1 for i in range(n-1) if(S[i+1]-A[i]==d)))",
"def resolve():\n n,t=map(int,input().split())\n A=list(map(int,input().split()))\n S=[None]*n\n S[-1]=A[-1]\n for i in range(n-2,-1,-1):\n S[i]=max(A[i],S[i+1])\n d=max(S[i+1]-A[i] for i in range(n-1))\n print(sum(1 for i in range(n-1) if(S[i+1]-A[i]==d)))",
"resolve",
"MOD=10**9+7",
"10**9+7",
"MOD"
] |
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,t=map(int,input().split())
A=list(map(int,input().split()))
S=[None]*n
S[-1]=A[-1]
for i in range(n-2,-1,-1):
S[i]=max(A[i],S[i+1])
d=max(S[i+1]-A[i] for i in range(n-1))
print(sum(1 for i in range(n-1) if(S[i+1]-A[i]==d)))
resolve()
|
[
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,
2,
39,
17,
13,
28,
13,
4,
13,
13,
14,
2,
13,
17,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
4,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
18,
13,
39,
17,
0,
13,
18,
13,
39,
17,
0,
13,
2,
39,
17,
13,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
18,
13,
13,
13,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
18,
13
] |
[
[
134,
2
],
[
134,
11
],
[
122,
13
],
[
125,
25
],
[
123,
27
],
[
128,
31
],
[
135,
35
],
[
38,
37
],
[
135,
40
],
[
37,
43
],
[
49,
46
],
[
129,
47
],
[
37,
48
],
[
126,
50
],
[
123,
50
],
[
37,
51
],
[
56,
53
],
[
129,
54
],
[
37,
55
],
[
126,
59
],
[
123,
59
],
[
37,
60
],
[
129,
62
],
[
37,
64
],
[
116,
67
],
[
126,
69
],
[
123,
69
],
[
143,
73
],
[
129,
75
],
[
140,
79
],
[
135,
83
],
[
86,
85
],
[
135,
88
],
[
93,
90
],
[
141,
91
],
[
85,
92
],
[
53,
94
],
[
46,
94
],
[
144,
95
],
[
129,
95
],
[
85,
96
],
[
117,
98
],
[
126,
98
],
[
123,
98
],
[
85,
99
],
[
137,
101
],
[
141,
104
],
[
131,
106
],
[
141,
109
],
[
138,
111
],
[
132,
114
],
[
116,
117
],
[
134,
120
],
[
122,
123
],
[
125,
126
],
[
128,
129
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
140,
141
],
[
143,
144
]
] |
[
"n, t = map(int, input().split())\na = list(map(int, input().split()))\n\na = a[::-1]\nm = [0] * n\n\n\nfor i in range(n):\n if i == 0:\n m[i] = a[i]\n else:\n m[i] = max(a[i], m[i-1])\n\na = a[::-1]\nm = m[::-1]\n\n#print(m)\n\nsa = [0] * n\nfor i in range(n):\n sa[i] = m[i] - a[i]\n\n#print(sa)\n\nans_max = max(sa)\nans = sa.count(ans_max)\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",
"a = a[::-1]",
"a",
"a[::-1]",
"a",
"::-1",
"-1",
"m = [0] * n",
"m",
"[0] * n",
"[0]",
"0",
"n",
"for i in range(n):\n if i == 0:\n m[i] = a[i]\n else:\n m[i] = max(a[i], m[i-1])",
"i",
"range(n)",
"range",
"n",
"if i == 0:\n m[i] = a[i]\n else:\n m[i] = max(a[i], m[i-1])",
"i == 0",
"i",
"0",
"m[i] = a[i]",
"m[i]",
"m",
"i",
"a[i]",
"a",
"i",
"m[i] = max(a[i], m[i-1])",
"m[i]",
"m",
"i",
"max(a[i], m[i-1])",
"max",
"a[i]",
"a",
"i",
"m[i-1]",
"m",
"i-1",
"i",
"1",
"a = a[::-1]",
"a",
"a[::-1]",
"a",
"::-1",
"-1",
"m = m[::-1]",
"m",
"m[::-1]",
"m",
"::-1",
"-1",
"sa = [0] * n",
"sa",
"[0] * n",
"[0]",
"0",
"n",
"for i in range(n):\n sa[i] = m[i] - a[i]\n\n#print(sa)",
"i",
"range(n)",
"range",
"n",
"sa[i] = m[i] - a[i]",
"sa[i]",
"sa",
"i",
"m[i] - a[i]",
"m[i]",
"m",
"i",
"a[i]",
"a",
"i",
"ans_max = max(sa)",
"ans_max",
"max(sa)",
"max",
"sa",
"ans = sa.count(ans_max)",
"ans",
"sa.count(ans_max)",
"sa.count",
"sa",
"count",
"ans_max",
"print(ans)",
"print",
"ans",
"a = a[::-1]",
"a[::-1]",
"a",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"a = a[::-1]",
"a[::-1]",
"a",
"m = [0] * n",
"[0] * n",
"m",
"ans = sa.count(ans_max)",
"sa.count(ans_max)",
"ans",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"ans_max = max(sa)",
"max(sa)",
"ans_max",
"sa = [0] * n",
"[0] * n",
"sa",
"m = m[::-1]",
"m[::-1]",
"m"
] |
n, t = map(int, input().split())
a = list(map(int, input().split()))
a = a[::-1]
m = [0] * n
for i in range(n):
if i == 0:
m[i] = a[i]
else:
m[i] = max(a[i], m[i-1])
a = a[::-1]
m = m[::-1]
#print(m)
sa = [0] * n
for i in range(n):
sa[i] = m[i] - a[i]
#print(sa)
ans_max = max(sa)
ans = sa.count(ans_max)
print(ans)
|
[
7,
15,
0,
13,
4,
13,
13,
4,
18,
4,
18,
4,
13,
17,
13,
13,
13,
31,
13,
0,
13,
4,
13,
13,
0,
13,
2,
2,
17,
17,
17,
28,
13,
4,
13,
13,
0,
13,
4,
13,
13,
18,
13,
13,
0,
18,
13,
2,
18,
13,
13,
13,
17,
4,
13,
18,
13,
4,
13,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] |
[
[
70,
3
],
[
70,
16
],
[
70,
17
],
[
73,
20
],
[
61,
25
],
[
33,
32
],
[
71,
35
],
[
67,
37
],
[
62,
40
],
[
68,
40
],
[
32,
43
],
[
52,
45
],
[
74,
46
],
[
32,
50
],
[
68,
51
],
[
62,
51
],
[
74,
56
],
[
74,
59
],
[
61,
62
],
[
70,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
]
] |
[
"from collections import defaultdict\n\nN, T, *A = map(int, open(0).read().split())\n\nctr = defaultdict(int)\nm = 10 ** 9 + 7\nfor i in range(N):\n m = min(m, A[i])\n ctr[A[i] - m] += 1\n\nprint(ctr[max(ctr)])",
"from collections import defaultdict",
"N, T, *A = map(int, open(0).read().split())",
"N",
"map(int, open(0).read().split())",
"map",
"int",
"open(0).read().split()",
"(0).read().split",
"(0).read()",
"(0).read",
"(0)",
"open",
"0",
"read",
"split",
"T",
"*A",
"A",
"ctr = defaultdict(int)",
"ctr",
"defaultdict(int)",
"defaultdict",
"int",
"m = 10 ** 9 + 7",
"m",
"10 ** 9 + 7",
"10 ** 9",
"10",
"9",
"7",
"for i in range(N):\n m = min(m, A[i])\n ctr[A[i] - m] += 1",
"i",
"range(N)",
"range",
"N",
"m = min(m, A[i])",
"m",
"min(m, A[i])",
"min",
"m",
"A[i]",
"A",
"i",
"ctr[A[i] - m] += 1",
"ctr[A[i] - m]",
"ctr",
"A[i] - m",
"A[i]",
"A",
"i",
"m",
"1",
"print(ctr[max(ctr)])",
"print",
"ctr[max(ctr)]",
"ctr",
"max(ctr)",
"max",
"ctr",
"m = 10 ** 9 + 7",
"10 ** 9 + 7",
"m",
"T, *A = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"T",
"m = min(m, A[i])",
"min(m, A[i])",
"m",
"N, T, *A = map(int, open(0).read().split())",
"map(int, open(0).read().split())",
"N",
"ctr = defaultdict(int)",
"defaultdict(int)",
"ctr"
] |
from collections import defaultdict
N, T, *A = map(int, open(0).read().split())
ctr = defaultdict(int)
m = 10 ** 9 + 7
for i in range(N):
m = min(m, A[i])
ctr[A[i] - m] += 1
print(ctr[max(ctr)])
|
[
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,
41,
28,
13,
13,
4,
18,
13,
13,
4,
39,
13,
13,
0,
13,
13,
4,
18,
13,
13,
0,
13,
17,
4,
13,
18,
18,
13,
17,
17,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13,
10,
18,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13
] |
[
[
107,
3
],
[
107,
12
],
[
113,
14
],
[
116,
26
],
[
122,
29
],
[
33,
32
],
[
114,
34
],
[
123,
39
],
[
126,
39
],
[
32,
40
],
[
125,
42
],
[
32,
43
],
[
117,
46
],
[
126,
48
],
[
123,
48
],
[
119,
50
],
[
117,
52
],
[
128,
56
],
[
114,
65
],
[
120,
66
],
[
117,
66
],
[
73,
68
],
[
129,
69
],
[
129,
80
],
[
110,
87
],
[
111,
91
],
[
95,
94
],
[
111,
100
],
[
107,
105
],
[
107,
108
],
[
110,
111
],
[
113,
114
],
[
116,
117
],
[
119,
120
],
[
122,
123
],
[
32,
125
],
[
125,
126
],
[
128,
129
]
] |
[
"from collections import defaultdict\nn, t = map(int, input().split())\nA = list(map(int, input().split()))\n\nMAX_S = []\nmax_tmp = 0\nfor a in A[::-1]:\n if max_tmp < a:\n max_tmp = a\n MAX_S.append(max_tmp)\nMAX_S = MAX_S[::-1]\ncnt = defaultdict(int)\nfor a, s in zip(A, MAX_S):\n cnt[s-a] += 1\n\nc = [(k, v) for k, v in cnt.items()]\nc.sort(reverse=True)\nprint(c[0][-1])",
"from collections import defaultdict",
"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_S = []",
"MAX_S",
"[]",
"max_tmp = 0",
"max_tmp",
"0",
"for a in A[::-1]:\n if max_tmp < a:\n max_tmp = a\n MAX_S.append(max_tmp)",
"a",
"A[::-1]",
"A",
"::-1",
"-1",
"if max_tmp < a:\n max_tmp = a\n ",
"max_tmp < a",
"max_tmp",
"a",
"max_tmp = a",
"max_tmp",
"a",
"MAX_S.append(max_tmp)",
"MAX_S.append",
"MAX_S",
"append",
"max_tmp",
"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",
"(k, v) for k, v in cnt.items()",
"for k, v in cnt.items()",
"k",
"v",
"cnt.items()",
"cnt.items",
"cnt",
"items",
"for k, v in cnt.items()",
"(k, v)",
"k",
"v",
"c = [(k, v) for k, v in cnt.items()]",
"c",
"[(k, v) for k, v in cnt.items()]",
"c.sort(reverse=True)",
"c.sort",
"c",
"sort",
"reverse=True",
"reverse",
"True",
"print(c[0][-1])",
"print",
"c[0][-1]",
"[0]",
"c",
"0",
"-1",
"t = map(int, input().split())",
"map(int, input().split())",
"t",
"n, t = map(int, input().split())",
"map(int, input().split())",
"n",
"c = [(k, v) for k, v in cnt.items()]",
"[(k, v) for k, v in cnt.items()]",
"c",
"A = list(map(int, input().split()))",
"list(map(int, input().split()))",
"A",
"MAX_S = []",
"[]",
"MAX_S",
"MAX_S = MAX_S[::-1]",
"MAX_S[::-1]",
"MAX_S",
"max_tmp = 0",
"0",
"max_tmp",
"max_tmp = a",
"a",
"max_tmp",
"cnt = defaultdict(int)",
"defaultdict(int)",
"cnt"
] |
from collections import defaultdict
n, t = map(int, input().split())
A = list(map(int, input().split()))
MAX_S = []
max_tmp = 0
for a in A[::-1]:
if max_tmp < a:
max_tmp = a
MAX_S.append(max_tmp)
MAX_S = MAX_S[::-1]
cnt = defaultdict(int)
for a, s in zip(A, MAX_S):
cnt[s-a] += 1
c = [(k, v) for k, v in cnt.items()]
c.sort(reverse=True)
print(c[0][-1])
|
[
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,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
39,
13,
14,
2,
18,
13,
13,
13,
0,
13,
4,
13,
13,
2,
13,
18,
13,
13,
0,
13,
4,
13,
0,
13,
39,
2,
13,
17,
0,
13,
18,
13,
17,
28,
13,
4,
13,
2,
13,
17,
17,
17,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
0,
13,
39,
13,
14,
2,
18,
13,
13,
13,
14,
2,
2,
13,
18,
13,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
39,
13,
10,
39,
13,
10,
4,
13
] |
[
[
162,
2
],
[
162,
12
],
[
150,
14
],
[
165,
27
],
[
159,
30
],
[
151,
32
],
[
36,
35
],
[
163,
39
],
[
151,
46
],
[
35,
47
],
[
160,
48
],
[
145,
48
],
[
144,
50
],
[
151,
52
],
[
35,
53
],
[
168,
55
],
[
151,
61
],
[
35,
62
],
[
160,
63
],
[
145,
63
],
[
174,
65
],
[
166,
68
],
[
175,
68
],
[
160,
70
],
[
145,
70
],
[
151,
72
],
[
35,
73
],
[
138,
75
],
[
156,
79
],
[
163,
82
],
[
153,
85
],
[
151,
87
],
[
91,
90
],
[
163,
94
],
[
151,
101
],
[
90,
102
],
[
154,
103
],
[
145,
103
],
[
160,
103
],
[
148,
103
],
[
147,
105
],
[
151,
107
],
[
90,
108
],
[
171,
110
],
[
151,
116
],
[
90,
117
],
[
154,
118
],
[
145,
118
],
[
160,
118
],
[
148,
118
],
[
154,
122
],
[
145,
122
],
[
160,
122
],
[
148,
122
],
[
151,
124
],
[
90,
125
],
[
175,
126
],
[
166,
126
],
[
139,
129
],
[
90,
131
],
[
139,
136
],
[
138,
139
],
[
162,
142
],
[
144,
145
],
[
147,
148
],
[
150,
151
],
[
153,
154
],
[
156,
157
],
[
159,
160
],
[
162,
163
],
[
165,
166
],
[
168,
169
],
[
171,
172
],
[
174,
175
]
] |
[
"# -*- coding: utf-8 -*-\nN, T = map(int, input().split(' '))\nA = list(map(int, input().split(' ')))\n\nmax_diff = 0\nmax_value = A[-1]\nfor i in range(N-2, -1, -1):\n if A[i] > max_value:\n max_value = A[i]\n buf = [i]\n elif A[i] == max_value:\n pass\n else:\n max_diff = max(max_diff, max_value - A[i])\n\n\nindices = set()\nbuf = [N-1]\nmax_value = A[-1]\nfor i in range(N-2, -1, -1):\n if A[i] > max_value:\n max_value = A[i]\n buf = [i]\n elif A[i] == max_value:\n pass\n else:\n if max_value - A[i] == max_diff:\n indices.add(i)\n\n# print(indices)\nprint(len(indices))",
"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_diff = 0",
"max_diff",
"0",
"max_value = A[-1]",
"max_value",
"A[-1]",
"A",
"-1",
"for i in range(N-2, -1, -1):\n if A[i] > max_value:\n max_value = A[i]\n buf = [i]\n elif A[i] == max_value:\n pass\n else:\n max_diff = max(max_diff, max_value - A[i])",
"i",
"range(N-2, -1, -1)",
"range",
"N-2",
"N",
"2",
"-1",
"-1",
"if A[i] > max_value:\n max_value = A[i]\n buf = [i]\n elif A[i] == max_value:\n pass\n else:\n max_diff = max(max_diff, max_value - A[i])",
"A[i] > max_value",
"A[i]",
"A",
"i",
"max_value",
"max_value = A[i]",
"max_value",
"A[i]",
"A",
"i",
"buf = [i]",
"buf",
"[i]",
"i",
"elif A[i] == max_value:\n pass\n ",
"A[i] == max_value",
"A[i]",
"A",
"i",
"max_value",
"max_diff = max(max_diff, max_value - A[i])",
"max_diff",
"max(max_diff, max_value - A[i])",
"max",
"max_diff",
"max_value - A[i]",
"max_value",
"A[i]",
"A",
"i",
"indices = set()",
"indices",
"set()",
"set",
"buf = [N-1]",
"buf",
"[N-1]",
"N-1",
"N",
"1",
"max_value = A[-1]",
"max_value",
"A[-1]",
"A",
"-1",
"for i in range(N-2, -1, -1):\n if A[i] > max_value:\n max_value = A[i]\n buf = [i]\n elif A[i] == max_value:\n pass\n else:\n if max_value - A[i] == max_diff:\n indices.add(i)\n\n# print(indices)",
"i",
"range(N-2, -1, -1)",
"range",
"N-2",
"N",
"2",
"-1",
"-1",
"if A[i] > max_value:\n max_value = A[i]\n buf = [i]\n elif A[i] == max_value:\n pass\n else:\n if max_value - A[i] == max_diff:\n indices.add(i)\n\n# print(indices)",
"A[i] > max_value",
"A[i]",
"A",
"i",
"max_value",
"max_value = A[i]",
"max_value",
"A[i]",
"A",
"i",
"buf = [i]",
"buf",
"[i]",
"i",
"elif A[i] == max_value:\n pass\n ",
"A[i] == max_value",
"A[i]",
"A",
"i",
"max_value",
"if max_value - A[i] == max_diff:\n indices.add(i)\n\n# print(indices)",
"max_value - A[i] == max_diff",
"max_value - A[i]",
"max_value",
"A[i]",
"A",
"i",
"max_diff",
"indices.add(i)",
"indices.add",
"indices",
"add",
"i",
"print(len(indices))",
"print",
"len(indices)",
"len",
"indices",
"indices = set()",
"set()",
"indices",
"T = map(int, input().split(' '))",
"map(int, input().split(' '))",
"T",
"max_value = A[i]",
"A[i]",
"max_value",
"max_value = A[i]",
"A[i]",
"max_value",
"A = list(map(int, input().split(' ')))",
"list(map(int, input().split(' ')))",
"A",
"max_value = A[-1]",
"A[-1]",
"max_value",
"buf = [N-1]",
"[N-1]",
"buf",
"max_value = A[-1]",
"A[-1]",
"max_value",
"N, T = map(int, input().split(' '))",
"map(int, input().split(' '))",
"N",
"max_diff = 0",
"0",
"max_diff",
"buf = [i]",
"[i]",
"buf",
"buf = [i]",
"[i]",
"buf",
"max_diff = max(max_diff, max_value - A[i])",
"max(max_diff, max_value - A[i])",
"max_diff"
] |
# -*- coding: utf-8 -*-
N, T = map(int, input().split(' '))
A = list(map(int, input().split(' ')))
max_diff = 0
max_value = A[-1]
for i in range(N-2, -1, -1):
if A[i] > max_value:
max_value = A[i]
buf = [i]
elif A[i] == max_value:
pass
else:
max_diff = max(max_diff, max_value - A[i])
indices = set()
buf = [N-1]
max_value = A[-1]
for i in range(N-2, -1, -1):
if A[i] > max_value:
max_value = A[i]
buf = [i]
elif A[i] == max_value:
pass
else:
if max_value - A[i] == max_diff:
indices.add(i)
# print(indices)
print(len(indices))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.