node_ids
listlengths 4
1.4k
| edge_index
listlengths 1
2.22k
| text
listlengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
4,
18,
13,
2,
13,
18,
13,
13,
0,
18,
13,
13,
4,
18,
13,
2,
13,
18,
13,
13,
0,
13,
4,
18,
13,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
126,
8
],
[
126,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
17,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
25,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
55,
57
],
[
11,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
60,
62
],
[
11,
63
],
[
63,
64
],
[
63,
65
],
[
11,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
85,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
78,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
113,
115
],
[
110,
116
],
[
11,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
9,
123
],
[
123,
124
],
[
0,
125
],
[
125,
126
],
[
125,
127
]
]
| [
"//package abc176;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] ip = br.readLine().split(\" \");\n\t\tint[] ary = new int[N];\n\t\t\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}\n\t\t\n\t\tint prev = ary[0];\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 1 ; i < N ; i++) {\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] ip = br.readLine().split(\" \");\n\t\tint[] ary = new int[N];\n\t\t\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}\n\t\t\n\t\tint prev = ary[0];\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 1 ; i < N ; i++) {\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"Main",
"public static void main(String[] args) throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] ip = br.readLine().split(\" \");\n\t\tint[] ary = new int[N];\n\t\t\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}\n\t\t\n\t\tint prev = ary[0];\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 1 ; i < N ; i++) {\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] ip = br.readLine().split(\" \");\n\t\tint[] ary = new int[N];\n\t\t\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}\n\t\t\n\t\tint prev = ary[0];\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 1 ; i < N ; i++) {\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int N = Integer.parseInt(br.readLine());",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] ip = br.readLine().split(\" \");",
"ip",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] ary = new int[N];",
"ary",
"new int[N]",
"N",
"for(int i = 0 ; i < N ; i++) {\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}",
"{\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}",
"ary[i] = Integer.parseInt(ip[i])",
"ary[i]",
"ary",
"i",
"Integer.parseInt(ip[i])",
"Integer.parseInt",
"Integer",
"ip[i]",
"ip",
"i",
"int prev = ary[0];",
"prev",
"ary[0]",
"ary",
"0",
"long ans = 0;",
"ans",
"0",
"for(int i = 1 ; i < N ; i++) {\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}",
"int i = 1 ;",
"int i = 1 ;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}",
"{\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}",
"if(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}",
"prev > ary[i]",
"prev",
"ary[i]",
"ary",
"i",
"{\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}",
"ans += Math.abs(prev-ary[i])",
"ans",
"Math.abs(prev-ary[i])",
"Math.abs",
"Math",
"prev-ary[i]",
"prev",
"ary[i]",
"ary",
"i",
"ary[i] += Math.abs(prev-ary[i])",
"ary[i]",
"ary",
"i",
"Math.abs(prev-ary[i])",
"Math.abs",
"Math",
"prev-ary[i]",
"prev",
"ary[i]",
"ary",
"i",
"prev = Math.max(ary[i], prev)",
"prev",
"Math.max(ary[i], prev)",
"Math.max",
"Math",
"ary[i]",
"ary",
"i",
"prev",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] ip = br.readLine().split(\" \");\n\t\tint[] ary = new int[N];\n\t\t\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}\n\t\t\n\t\tint prev = ary[0];\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 1 ; i < N ; i++) {\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] ip = br.readLine().split(\" \");\n\t\tint[] ary = new int[N];\n\t\t\n\t\tfor(int i = 0 ; i < N ; i++) {\n\t\t\tary[i] = Integer.parseInt(ip[i]);\n\t\t}\n\t\t\n\t\tint prev = ary[0];\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 1 ; i < N ; i++) {\n\t\t\tif(prev > ary[i]) {\n\t\t\t\tans += Math.abs(prev-ary[i]);\n\t\t\t\tary[i] += Math.abs(prev-ary[i]);\n\t\t\t}\n\t\t\tprev = Math.max(ary[i], prev);\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"Main"
]
| //package abc176;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
String[] ip = br.readLine().split(" ");
int[] ary = new int[N];
for(int i = 0 ; i < N ; i++) {
ary[i] = Integer.parseInt(ip[i]);
}
int prev = ary[0];
long ans = 0;
for(int i = 1 ; i < N ; i++) {
if(prev > ary[i]) {
ans += Math.abs(prev-ary[i]);
ary[i] += Math.abs(prev-ary[i]);
}
prev = Math.max(ary[i], prev);
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
40,
17,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
89,
5
],
[
89,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
25,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
8,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
6,
86
],
[
86,
87
],
[
0,
88
],
[
88,
89
],
[
88,
90
]
]
| [
"import java.util.Scanner;\n \npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int last = -1;\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }\n long ans = 0;\n for (int i = 0; i < n; i++) {\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int last = -1;\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }\n long ans = 0;\n for (int i = 0; i < n; i++) {\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int last = -1;\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }\n long ans = 0;\n for (int i = 0; i < n; i++) {\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int last = -1;\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }\n long ans = 0;\n for (int i = 0; i < n; i++) {\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }\n System.out.println(ans);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int last = -1;",
"last",
"-1",
"1",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] nums = new int[n];",
"nums",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n nums[i] = scanner.nextInt();\n }",
"{\n nums[i] = scanner.nextInt();\n }",
"nums[i] = scanner.nextInt()",
"nums[i]",
"nums",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long ans = 0;",
"ans",
"0",
"for (int i = 0; i < n; i++) {\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }",
"{\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }",
"int cur = nums[i];",
"cur",
"nums[i]",
"nums",
"i",
"if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }",
"cur < last",
"cur",
"last",
"{\n ans += (last - cur);\n }",
"ans += (last - cur)",
"ans",
"(last - cur)",
"last",
"cur",
"{\n last = cur;\n }",
"last = cur",
"last",
"cur",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int last = -1;\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }\n long ans = 0;\n for (int i = 0; i < n; i++) {\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int last = -1;\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) {\n nums[i] = scanner.nextInt();\n }\n long ans = 0;\n for (int i = 0; i < n; i++) {\n int cur = nums[i];\n if (cur < last) {\n ans += (last - cur);\n } else {\n last = cur;\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int last = -1;
int n = scanner.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] = scanner.nextInt();
}
long ans = 0;
for (int i = 0; i < n; i++) {
int cur = nums[i];
if (cur < last) {
ans += (last - cur);
} else {
last = cur;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
18,
13,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
50,
51
],
[
50,
52
],
[
45,
53
],
[
53,
54
],
[
54,
55
],
[
45,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
8,
63
],
[
63,
64
],
[
63,
65
],
[
8,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
66,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
86,
87
],
[
86,
88
],
[
79,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
100,
101
],
[
100,
102
],
[
89,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
8,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
115,
117
],
[
110,
118
],
[
118,
119
],
[
119,
120
],
[
110,
121
],
[
122,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
8,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
6,
134
],
[
134,
135
]
]
| [
"import java.util.*;\n \nclass Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n //人数\n int n = sc.nextInt();\n //身長\n long[] h = new long[n];\n \n for(int i = 0;i < n;i++){\n h[i] = sc.nextLong();\n }\n \n \n \n long[] step = new long[n];\n for(int i = 0;i < n;i++){\n step[i] = 0;\n }\n long ans = 0;\n for(int i = 1;i < n;i++){\n if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }\n }\n \n for(int i = 0;i < n;i++){\n ans += step[i];\n }\n System.out.print(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n //人数\n int n = sc.nextInt();\n //身長\n long[] h = new long[n];\n \n for(int i = 0;i < n;i++){\n h[i] = sc.nextLong();\n }\n \n \n \n long[] step = new long[n];\n for(int i = 0;i < n;i++){\n step[i] = 0;\n }\n long ans = 0;\n for(int i = 1;i < n;i++){\n if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }\n }\n \n for(int i = 0;i < n;i++){\n ans += step[i];\n }\n System.out.print(ans);\n }\n}",
"Main",
"public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n //人数\n int n = sc.nextInt();\n //身長\n long[] h = new long[n];\n \n for(int i = 0;i < n;i++){\n h[i] = sc.nextLong();\n }\n \n \n \n long[] step = new long[n];\n for(int i = 0;i < n;i++){\n step[i] = 0;\n }\n long ans = 0;\n for(int i = 1;i < n;i++){\n if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }\n }\n \n for(int i = 0;i < n;i++){\n ans += step[i];\n }\n System.out.print(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n //人数\n int n = sc.nextInt();\n //身長\n long[] h = new long[n];\n \n for(int i = 0;i < n;i++){\n h[i] = sc.nextLong();\n }\n \n \n \n long[] step = new long[n];\n for(int i = 0;i < n;i++){\n step[i] = 0;\n }\n long ans = 0;\n for(int i = 1;i < n;i++){\n if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }\n }\n \n for(int i = 0;i < n;i++){\n ans += step[i];\n }\n System.out.print(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] h = new long[n];",
"h",
"new long[n]",
"n",
"for(int i = 0;i < n;i++){\n h[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n h[i] = sc.nextLong();\n }",
"{\n h[i] = sc.nextLong();\n }",
"h[i] = sc.nextLong()",
"h[i]",
"h",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long[] step = new long[n];",
"step",
"new long[n]",
"n",
"for(int i = 0;i < n;i++){\n step[i] = 0;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n step[i] = 0;\n }",
"{\n step[i] = 0;\n }",
"step[i] = 0",
"step[i]",
"step",
"i",
"0",
"long ans = 0;",
"ans",
"0",
"for(int i = 1;i < n;i++){\n if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }\n }",
"{\n if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }\n }",
"if(h[i - 1] > h[i]){\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }",
"h[i - 1] > h[i]",
"h[i - 1]",
"h",
"i - 1",
"i",
"1",
"h[i]",
"h",
"i",
"{\n step[i] = h[i - 1] - h[i];\n h[i] += step[i];\n }",
"step[i] = h[i - 1] - h[i]",
"step[i]",
"step",
"i",
"h[i - 1] - h[i]",
"h[i - 1]",
"h",
"i - 1",
"i",
"1",
"h[i]",
"h",
"i",
"h[i] += step[i]",
"h[i]",
"h",
"i",
"step[i]",
"step",
"i",
"for(int i = 0;i < n;i++){\n ans += step[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ans += step[i];\n }",
"{\n ans += step[i];\n }",
"ans += step[i]",
"ans",
"step[i]",
"step",
"i",
"System.out.print(ans)",
"System.out.print",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args"
]
| import java.util.*;
class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
//人数
int n = sc.nextInt();
//身長
long[] h = new long[n];
for(int i = 0;i < n;i++){
h[i] = sc.nextLong();
}
long[] step = new long[n];
for(int i = 0;i < n;i++){
step[i] = 0;
}
long ans = 0;
for(int i = 1;i < n;i++){
if(h[i - 1] > h[i]){
step[i] = h[i - 1] - h[i];
h[i] += step[i];
}
}
for(int i = 0;i < n;i++){
ans += step[i];
}
System.out.print(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
17,
2,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
18,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
211,
29
],
[
211,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
35,
37
],
[
32,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
32,
43
],
[
43,
44
],
[
43,
45
],
[
32,
46
],
[
46,
47
],
[
46,
48
],
[
32,
49
],
[
49,
50
],
[
49,
51
],
[
32,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
52,
56
],
[
52,
57
],
[
32,
58
],
[
58,
59
],
[
59,
60
],
[
30,
61
],
[
61,
62
],
[
211,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
67,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
67,
79
],
[
79,
80
],
[
79,
81
],
[
67,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
67,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
99,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
67,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
65,
124
],
[
124,
125
],
[
65,
126
],
[
126,
127
],
[
65,
128
],
[
128,
129
],
[
211,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
130,
134
],
[
134,
135
],
[
130,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
130,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
147,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
157,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
146,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
130,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
175,
178
],
[
178,
179
],
[
130,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
187,
192
],
[
192,
193
],
[
192,
194
],
[
187,
195
],
[
195,
196
],
[
196,
197
],
[
187,
198
],
[
199,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
204,
205
],
[
182,
206
],
[
206,
207
],
[
180,
208
],
[
208,
209
],
[
0,
210
],
[
210,
211
],
[
210,
212
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\nimport java.io.IOException;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author lucasr\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, MyScanner sc, PrintWriter out) {\n int N = sc.nextInt();\n int[] vals = sc.nextIntArray(N);\n long ans = 0, max = vals[0];\n for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }\n out.println(ans);\n }\n\n }\n\n static class MyScanner {\n private BufferedReader br;\n private StringTokenizer tokenizer;\n\n public MyScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, MyScanner sc, PrintWriter out) {\n int N = sc.nextInt();\n int[] vals = sc.nextIntArray(N);\n long ans = 0, max = vals[0];\n for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }\n out.println(ans);\n }\n\n }\n\n static class MyScanner {\n private BufferedReader br;\n private StringTokenizer tokenizer;\n\n public MyScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"MyScanner in = new MyScanner(inputStream);",
"in",
"new MyScanner(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"CStep solver = new CStep();",
"solver",
"new CStep()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class CStep {\n public void solve(int testNumber, MyScanner sc, PrintWriter out) {\n int N = sc.nextInt();\n int[] vals = sc.nextIntArray(N);\n long ans = 0, max = vals[0];\n for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }\n out.println(ans);\n }\n\n }",
"CStep",
"public void solve(int testNumber, MyScanner sc, PrintWriter out) {\n int N = sc.nextInt();\n int[] vals = sc.nextIntArray(N);\n long ans = 0, max = vals[0];\n for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }\n out.println(ans);\n }",
"solve",
"{\n int N = sc.nextInt();\n int[] vals = sc.nextIntArray(N);\n long ans = 0, max = vals[0];\n for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }\n out.println(ans);\n }",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] vals = sc.nextIntArray(N);",
"vals",
"sc.nextIntArray(N)",
"sc.nextIntArray",
"sc",
"N",
"long ans = 0",
"ans",
"0",
"max = vals[0];",
"max",
"vals[0]",
"vals",
"0",
"for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }",
"{\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }",
"ans += Math.max(0, max - vals[i])",
"ans",
"Math.max(0, max - vals[i])",
"Math.max",
"Math",
"0",
"max - vals[i]",
"max",
"vals[i]",
"vals",
"i",
"max = Math.max(max, vals[i])",
"max",
"Math.max(max, vals[i])",
"Math.max",
"Math",
"max",
"vals[i]",
"vals",
"i",
"out.println(ans)",
"out.println",
"out",
"ans",
"int testNumber",
"testNumber",
"MyScanner sc",
"sc",
"PrintWriter out",
"out",
"static class MyScanner {\n private BufferedReader br;\n private StringTokenizer tokenizer;\n\n public MyScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }\n\n }",
"MyScanner",
"private BufferedReader br;",
"br",
"private StringTokenizer tokenizer;",
"tokenizer",
"public MyScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }",
"MyScanner",
"{\n br = new BufferedReader(new InputStreamReader(is));\n }",
"br = new BufferedReader(new InputStreamReader(is))",
"br",
"new BufferedReader(new InputStreamReader(is))",
"InputStream is",
"is",
"public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"next",
"{\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }",
"while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"tokenizer == null || !tokenizer.hasMoreTokens()",
"tokenizer == null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n tokenizer = new StringTokenizer(br.readLine());\n }",
"tokenizer = new StringTokenizer(br.readLine())",
"tokenizer",
"new StringTokenizer(br.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"public int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public int[] nextIntArray(int n) {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }",
"nextIntArray",
"{\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }",
"int[] ret = new int[n];",
"ret",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ret[i] = nextInt();\n }",
"{\n ret[i] = nextInt();\n }",
"ret[i] = nextInt()",
"ret[i]",
"ret",
"i",
"nextInt()",
"nextInt",
"return ret;",
"ret",
"int n",
"n",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, MyScanner sc, PrintWriter out) {\n int N = sc.nextInt();\n int[] vals = sc.nextIntArray(N);\n long ans = 0, max = vals[0];\n for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }\n out.println(ans);\n }\n\n }\n\n static class MyScanner {\n private BufferedReader br;\n private StringTokenizer tokenizer;\n\n public MyScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n MyScanner in = new MyScanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, MyScanner sc, PrintWriter out) {\n int N = sc.nextInt();\n int[] vals = sc.nextIntArray(N);\n long ans = 0, max = vals[0];\n for (int i = 1; i < N; i++) {\n ans += Math.max(0, max - vals[i]);\n max = Math.max(max, vals[i]);\n }\n out.println(ans);\n }\n\n }\n\n static class MyScanner {\n private BufferedReader br;\n private StringTokenizer tokenizer;\n\n public MyScanner(InputStream is) {\n br = new BufferedReader(new InputStreamReader(is));\n }\n\n public String next() {\n while (tokenizer == null || !tokenizer.hasMoreTokens()) {\n try {\n tokenizer = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n }\n return tokenizer.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public int[] nextIntArray(int n) {\n int[] ret = new int[n];\n for (int i = 0; i < n; i++) {\n ret[i] = nextInt();\n }\n return ret;\n }\n\n }\n}",
"Main"
]
| import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author lucasr
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
MyScanner in = new MyScanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
CStep solver = new CStep();
solver.solve(1, in, out);
out.close();
}
static class CStep {
public void solve(int testNumber, MyScanner sc, PrintWriter out) {
int N = sc.nextInt();
int[] vals = sc.nextIntArray(N);
long ans = 0, max = vals[0];
for (int i = 1; i < N; i++) {
ans += Math.max(0, max - vals[i]);
max = Math.max(max, vals[i]);
}
out.println(ans);
}
}
static class MyScanner {
private BufferedReader br;
private StringTokenizer tokenizer;
public MyScanner(InputStream is) {
br = new BufferedReader(new InputStreamReader(is));
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(br.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public int[] nextIntArray(int n) {
int[] ret = new int[n];
for (int i = 0; i < n; i++) {
ret[i] = nextInt();
}
return ret;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
13,
9,
14,
2,
13,
13,
30,
0,
13,
4,
18,
13,
4,
18,
4,
18,
13,
13,
4,
18,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
91,
8
],
[
91,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
43,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
68,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
58,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
11,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
9,
88
],
[
88,
89
],
[
0,
90
],
[
90,
91
],
[
90,
92
]
]
| [
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tBigInteger bordersum = BigInteger.ZERO;\n\t\tint tmpborder = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(bordersum);\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tBigInteger bordersum = BigInteger.ZERO;\n\t\tint tmpborder = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(bordersum);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tBigInteger bordersum = BigInteger.ZERO;\n\t\tint tmpborder = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(bordersum);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tBigInteger bordersum = BigInteger.ZERO;\n\t\tint tmpborder = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(bordersum);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.nextLine()",
"sc.nextLine",
"sc",
"BigInteger bordersum = BigInteger.ZERO;",
"bordersum",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"int tmpborder = 0;",
"tmpborder",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}",
"int tmp = sc.nextInt();",
"tmp",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}",
"i == 0",
"i",
"0",
"{\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}",
"tmpborder = tmp",
"tmpborder",
"tmp",
"continue;",
"if (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}",
"tmp < tmpborder",
"tmp",
"tmpborder",
"{\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t}",
"bordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)))",
"bordersum",
"bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)))",
"bordersum.add",
"bordersum",
"BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp))",
"BigInteger.valueOf(tmpborder).subtract",
"BigInteger.valueOf(tmpborder)",
"BigInteger.valueOf",
"BigInteger",
"tmpborder",
"BigInteger.valueOf(tmp)",
"BigInteger.valueOf",
"BigInteger",
"tmp",
"{\n\t\t\t\ttmpborder = tmp;\n\t\t\t}",
"tmpborder = tmp",
"tmpborder",
"tmp",
"System.out.println(bordersum)",
"System.out.println",
"System.out",
"System",
"System.out",
"bordersum",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tBigInteger bordersum = BigInteger.ZERO;\n\t\tint tmpborder = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(bordersum);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\t\tBigInteger bordersum = BigInteger.ZERO;\n\t\tint tmpborder = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint tmp = sc.nextInt();\n\t\t\tif (i == 0) {\n\t\t\t\ttmpborder = tmp;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (tmp < tmpborder) {\n\t\t\t\tbordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));\n\t\t\t} else {\n\t\t\t\ttmpborder = tmp;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(bordersum);\n\t}\n}",
"Main"
]
| import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
BigInteger bordersum = BigInteger.ZERO;
int tmpborder = 0;
for (int i = 0; i < n; i++) {
int tmp = sc.nextInt();
if (i == 0) {
tmpborder = tmp;
continue;
}
if (tmp < tmpborder) {
bordersum = bordersum.add(BigInteger.valueOf(tmpborder).subtract(BigInteger.valueOf(tmp)));
} else {
tmpborder = tmp;
}
}
System.out.println(bordersum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
42,
40,
4,
18,
13,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
217,
20
],
[
217,
21
],
[
21,
22
],
[
21,
23
],
[
217,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
26,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
43,
45
],
[
26,
46
],
[
46,
47
],
[
46,
48
],
[
26,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
49,
59
],
[
59,
60
],
[
60,
61
],
[
49,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
63,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
26,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
24,
86
],
[
86,
87
],
[
217,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
96,
107
],
[
108,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
108,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
108,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
108,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
90,
132
],
[
132,
133
],
[
133,
134
],
[
132,
135
],
[
88,
136
],
[
136,
137
],
[
217,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
149,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
154,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
148,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
138,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
173,
176
],
[
176,
177
],
[
138,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
185,
190
],
[
190,
191
],
[
190,
192
],
[
185,
193
],
[
193,
194
],
[
194,
195
],
[
185,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
201,
202
],
[
180,
203
],
[
203,
204
],
[
178,
205
],
[
205,
206
],
[
138,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
211,
214
],
[
214,
215
],
[
0,
216
],
[
216,
217
],
[
216,
218
]
]
| [
"\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.Random;\nimport java.util.StringTokenizer;\n\n//Main\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint n=sc.nextInt();\n\t\tint a[]=sc.readArray(n);\n\t\tint prev=a[0];\n\t\tlong ans=0;\n\t\tfor (int i = 1; i < a.length; i++) {\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tstatic final Random random = new Random();\n\n\tstatic void ruffleSort(int[] a) {\n\t\tint n = a.length;//shuffle, then sort \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}\n\t\tArrays.sort(a);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tint[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Random;",
"Random",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint n=sc.nextInt();\n\t\tint a[]=sc.readArray(n);\n\t\tint prev=a[0];\n\t\tlong ans=0;\n\t\tfor (int i = 1; i < a.length; i++) {\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tstatic final Random random = new Random();\n\n\tstatic void ruffleSort(int[] a) {\n\t\tint n = a.length;//shuffle, then sort \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}\n\t\tArrays.sort(a);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tint[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\n}",
"Main",
"static final Random random = new Random();",
"random",
"new Random()",
"public static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint n=sc.nextInt();\n\t\tint a[]=sc.readArray(n);\n\t\tint prev=a[0];\n\t\tlong ans=0;\n\t\tfor (int i = 1; i < a.length; i++) {\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}",
"main",
"{\n\t\tFastScanner sc = new FastScanner();\n\t\tint n=sc.nextInt();\n\t\tint a[]=sc.readArray(n);\n\t\tint prev=a[0];\n\t\tlong ans=0;\n\t\tfor (int i = 1; i < a.length; i++) {\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a[]=sc.readArray(n);",
"a",
"sc.readArray(n)",
"sc.readArray",
"sc",
"n",
"int prev=a[0];",
"prev",
"a[0]",
"a",
"0",
"long ans=0;",
"ans",
"0",
"for (int i = 1; i < a.length; i++) {\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}",
"{\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}",
"prev=Math.max(prev, a[i])",
"prev",
"Math.max(prev, a[i])",
"Math.max",
"Math",
"prev",
"a[i]",
"a",
"i",
"ans+=prev-a[i]",
"ans",
"prev-a[i]",
"prev",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static void ruffleSort(int[] a) {\n\t\tint n = a.length;//shuffle, then sort \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}\n\t\tArrays.sort(a);\n\t}",
"ruffleSort",
"{\n\t\tint n = a.length;//shuffle, then sort \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}\n\t\tArrays.sort(a);\n\t}",
"int n = a.length;",
"n",
"a.length",
"a",
"a.length",
"for (int i = 0; i < n; i++) {\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}",
"{\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}",
"int oi = random.nextInt(n)",
"oi",
"random.nextInt(n)",
"random.nextInt",
"random",
"n",
"temp = a[oi];",
"temp",
"a[oi]",
"a",
"oi",
"a[oi] = a[i]",
"a[oi]",
"a",
"oi",
"a[i]",
"a",
"i",
"a[i] = temp",
"a[i]",
"a",
"i",
"temp",
"Arrays.sort(a)",
"Arrays.sort",
"Arrays",
"a",
"int[] a",
"a",
"static class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tint[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}",
"FastScanner",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringTokenizer st = new StringTokenizer(\"\");",
"st",
"new StringTokenizer(\"\")",
"String next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}",
"next",
"{\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}",
"while (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"try {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t}",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"nextInt",
"{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"int[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"readArray",
"{\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextInt();",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"nextLong",
"{\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint n=sc.nextInt();\n\t\tint a[]=sc.readArray(n);\n\t\tint prev=a[0];\n\t\tlong ans=0;\n\t\tfor (int i = 1; i < a.length; i++) {\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tstatic final Random random = new Random();\n\n\tstatic void ruffleSort(int[] a) {\n\t\tint n = a.length;//shuffle, then sort \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}\n\t\tArrays.sort(a);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tint[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tint n=sc.nextInt();\n\t\tint a[]=sc.readArray(n);\n\t\tint prev=a[0];\n\t\tlong ans=0;\n\t\tfor (int i = 1; i < a.length; i++) {\n\t\t\t\n\t\t\tprev=Math.max(prev, a[i]);\n\t\t\t\n\t\t\tans+=prev-a[i];\n\t\t\t\n\t\t}\n\t\tSystem.out.println(ans);\n\n\t}\n\n\tstatic final Random random = new Random();\n\n\tstatic void ruffleSort(int[] a) {\n\t\tint n = a.length;//shuffle, then sort \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tint oi = random.nextInt(n), temp = a[oi];\n\t\t\ta[oi] = a[i];\n\t\t\ta[i] = temp;\n\t\t}\n\t\tArrays.sort(a);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tString next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tint nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tint[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tlong nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\n}",
"Main"
]
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
//Main
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n=sc.nextInt();
int a[]=sc.readArray(n);
int prev=a[0];
long ans=0;
for (int i = 1; i < a.length; i++) {
prev=Math.max(prev, a[i]);
ans+=prev-a[i];
}
System.out.println(ans);
}
static final Random random = new Random();
static void ruffleSort(int[] a) {
int n = a.length;//shuffle, then sort
for (int i = 0; i < n; i++) {
int oi = random.nextInt(n), temp = a[oi];
a[oi] = a[i];
a[i] = temp;
}
Arrays.sort(a);
}
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
14,
2,
2,
13,
17,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
0,
13,
13,
0,
13,
2,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
90,
5
],
[
90,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
47,
49
],
[
39,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
68,
70
],
[
39,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
8,
84
],
[
84,
85
],
[
85,
86
],
[
6,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
]
| [
"import java.util.Scanner;\n\n/**\n * C - Step\n * N 人が 1 列に並んでおり、前から i 番目の人の身長は Ai です。\n * それぞれの人の足元に、高さが 0 以上の踏み台を設置し、全ての人が次の条件を満たすようにしたいです。\n * 条件:踏み台を込めて身長を比較したとき、自分より前に、自分より背の高い人が存在しない\n * この条件を満たす時の、踏み台の高さの合計の最小値を求めてください。\n */\npublic class Main {\n\n public static void main( String[] args ) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n long result = 0;\n long before = 0;\n for( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main( String[] args ) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n long result = 0;\n long before = 0;\n for( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"Main",
"public static void main( String[] args ) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n long result = 0;\n long before = 0;\n for( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }\n\n System.out.println( result );\n\n sc.close();\n }",
"main",
"{\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n long result = 0;\n long before = 0;\n for( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }\n\n System.out.println( result );\n\n sc.close();\n }",
"Scanner sc = new Scanner( System.in );",
"sc",
"new Scanner( System.in )",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long result = 0;",
"result",
"0",
"long before = 0;",
"before",
"0",
"for( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }",
"{\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long step = 0;",
"step",
"0",
"if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }",
"i > 0 && a[i] < before",
"i > 0",
"i",
"0",
"a[i] < before",
"a[i]",
"a",
"i",
"before",
"{\n step = before - a[i];\n result += step;\n }",
"step = before - a[i]",
"step",
"before - a[i]",
"before",
"a[i]",
"a",
"i",
"result += step",
"result",
"step",
"before = a[i] + step",
"before",
"a[i] + step",
"a[i]",
"a",
"i",
"step",
"System.out.println( result )",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n\n public static void main( String[] args ) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n long result = 0;\n long before = 0;\n for( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"public class Main {\n\n public static void main( String[] args ) {\n\n Scanner sc = new Scanner( System.in );\n // 入力値\n int n = sc.nextInt();\n long[] a = new long[n];\n\n long result = 0;\n long before = 0;\n for( int i = 0; i < n; i++ ) {\n a[i] = sc.nextLong();\n long step = 0;\n if( i > 0 && a[i] < before ) {\n step = before - a[i];\n result += step;\n }\n before = a[i] + step;\n }\n\n System.out.println( result );\n\n sc.close();\n }\n}",
"Main"
]
| import java.util.Scanner;
/**
* C - Step
* N 人が 1 列に並んでおり、前から i 番目の人の身長は Ai です。
* それぞれの人の足元に、高さが 0 以上の踏み台を設置し、全ての人が次の条件を満たすようにしたいです。
* 条件:踏み台を込めて身長を比較したとき、自分より前に、自分より背の高い人が存在しない
* この条件を満たす時の、踏み台の高さの合計の最小値を求めてください。
*/
public class Main {
public static void main( String[] args ) {
Scanner sc = new Scanner( System.in );
// 入力値
int n = sc.nextInt();
long[] a = new long[n];
long result = 0;
long before = 0;
for( int i = 0; i < n; i++ ) {
a[i] = sc.nextLong();
long step = 0;
if( i > 0 && a[i] < before ) {
step = before - a[i];
result += step;
}
before = a[i] + step;
}
System.out.println( result );
sc.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
13,
17,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
2,
13,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
94,
8
],
[
94,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
52,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
73,
75
],
[
62,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
11,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
9,
91
],
[
91,
92
],
[
0,
93
],
[
93,
94
],
[
93,
95
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\t// write your code here\n\n Scanner scan = new Scanner(System.in);\nint N = scan.nextInt();\nlong A[]=new long [N];\nlong p=0;\nfor(int i=0;i<N;i++){\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}\nSystem.out.println(p);\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n\t// write your code here\n\n Scanner scan = new Scanner(System.in);\nint N = scan.nextInt();\nlong A[]=new long [N];\nlong p=0;\nfor(int i=0;i<N;i++){\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}\nSystem.out.println(p);\n }\n}",
"Main",
"public static void main(String[] args) {\n\t// write your code here\n\n Scanner scan = new Scanner(System.in);\nint N = scan.nextInt();\nlong A[]=new long [N];\nlong p=0;\nfor(int i=0;i<N;i++){\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}\nSystem.out.println(p);\n }",
"main",
"{\n\t// write your code here\n\n Scanner scan = new Scanner(System.in);\nint N = scan.nextInt();\nlong A[]=new long [N];\nlong p=0;\nfor(int i=0;i<N;i++){\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}\nSystem.out.println(p);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long A[]=new long [N];",
"A",
"new long [N]",
"N",
"long p=0;",
"p",
"0",
"for(int i=0;i<N;i++){\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}",
"{\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}",
"A[i]=scan.nextLong()",
"A[i]",
"A",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}",
"i>0",
"i",
"0",
"{if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}",
"if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}",
"A[i]<A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{p=p+A[i-1]-A[i];\n A[i]=A[i-1];}",
"p=p+A[i-1]-A[i]",
"p",
"p+A[i-1]-A[i]",
"p+A[i-1]",
"p",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i]=A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"System.out.println(p)",
"System.out.println",
"System.out",
"System",
"System.out",
"p",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n\t// write your code here\n\n Scanner scan = new Scanner(System.in);\nint N = scan.nextInt();\nlong A[]=new long [N];\nlong p=0;\nfor(int i=0;i<N;i++){\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}\nSystem.out.println(p);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n\t// write your code here\n\n Scanner scan = new Scanner(System.in);\nint N = scan.nextInt();\nlong A[]=new long [N];\nlong p=0;\nfor(int i=0;i<N;i++){\n A[i]=scan.nextLong();\n if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];\n A[i]=A[i-1];}}\n\n}\nSystem.out.println(p);\n }\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
long A[]=new long [N];
long p=0;
for(int i=0;i<N;i++){
A[i]=scan.nextLong();
if(i>0){if(A[i]<A[i-1]){p=p+A[i-1]-A[i];
A[i]=A[i-1];}}
}
System.out.println(p);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
30,
0,
13,
4,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
68,
5
],
[
68,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
41,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
54,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
6,
65
],
[
65,
66
],
[
0,
67
],
[
67,
68
],
[
67,
69
]
]
| [
"\nimport java.util.Scanner;\n\n/**\n * Created by enpingkuang on 2020/9/10 11:18 下午\n */\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long max = 0;\n long ans = 0;\n for(int i = 0;i<n;i++){\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long max = 0;\n long ans = 0;\n for(int i = 0;i<n;i++){\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long max = 0;\n long ans = 0;\n for(int i = 0;i<n;i++){\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long max = 0;\n long ans = 0;\n for(int i = 0;i<n;i++){\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }\n System.out.println(ans);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long max = 0;",
"max",
"0",
"long ans = 0;",
"ans",
"0",
"for(int i = 0;i<n;i++){\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }",
"{\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }",
"int tmp = scanner.nextInt();",
"tmp",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }",
"tmp < max",
"tmp",
"max",
"{\n ans += (max-tmp);\n }",
"ans += (max-tmp)",
"ans",
"(max-tmp)",
"max",
"tmp",
"{\n max = Math.max(tmp,max);\n }",
"max = Math.max(tmp,max)",
"max",
"Math.max(tmp,max)",
"Math.max",
"Math",
"tmp",
"max",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long max = 0;\n long ans = 0;\n for(int i = 0;i<n;i++){\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n long max = 0;\n long ans = 0;\n for(int i = 0;i<n;i++){\n int tmp = scanner.nextInt();\n if(tmp < max){\n ans += (max-tmp);\n }else{\n max = Math.max(tmp,max);\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
|
import java.util.Scanner;
/**
* Created by enpingkuang on 2020/9/10 11:18 下午
*/
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long max = 0;
long ans = 0;
for(int i = 0;i<n;i++){
int tmp = scanner.nextInt();
if(tmp < max){
ans += (max-tmp);
}else{
max = Math.max(tmp,max);
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
4,
13,
20,
23,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
2,
17,
13,
17,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
37,
20,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
29,
17,
0,
13,
20,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
2,
2,
17,
13,
17,
13,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
282,
32
],
[
282,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
35,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
43,
45
],
[
35,
46
],
[
46,
47
],
[
46,
48
],
[
35,
49
],
[
49,
50
],
[
49,
51
],
[
35,
52
],
[
52,
53
],
[
52,
54
],
[
35,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
55,
59
],
[
55,
60
],
[
35,
61
],
[
61,
62
],
[
62,
63
],
[
33,
64
],
[
64,
65
],
[
282,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
70,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
70,
85
],
[
85,
86
],
[
85,
87
],
[
70,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
93,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
88,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
101,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
70,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
68,
125
],
[
125,
126
],
[
68,
127
],
[
127,
128
],
[
68,
129
],
[
129,
130
],
[
282,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
131,
135
],
[
135,
136
],
[
131,
137
],
[
137,
138
],
[
137,
139
],
[
131,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
140,
146
],
[
146,
147
],
[
131,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
148,
154
],
[
154,
155
],
[
131,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
170,
170
],
[
170,
171
],
[
170,
172
],
[
170,
173
],
[
158,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
174,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
187,
191
],
[
191,
192
],
[
184,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
197,
198
],
[
193,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
199,
203
],
[
203,
204
],
[
193,
205
],
[
205,
206
],
[
205,
207
],
[
158,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
158,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
213,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
218,
223
],
[
225,
224
],
[
224,
225
],
[
225,
226
],
[
225,
227
],
[
224,
228
],
[
225,
229
],
[
158,
230
],
[
230,
231
],
[
131,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
236,
239
],
[
239,
240
],
[
131,
241
],
[
241,
242
],
[
241,
243
],
[
243,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
245,
248
],
[
248,
249
],
[
131,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
253,
254
],
[
253,
255
],
[
252,
257
],
[
257,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
257,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
264,
266
],
[
257,
267
],
[
267,
268
],
[
268,
269
],
[
257,
270
],
[
270,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
275,
276
],
[
252,
277
],
[
277,
278
],
[
250,
279
],
[
279,
280
],
[
0,
281
],
[
281,
282
],
[
281,
283
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.io.PrintStream;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\nimport java.io.BufferedReader;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author Eric\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n long res = 0;\n int n = in.nextInt();\n long[] a = in.nextArrLong(n);\n long last = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }\n out.print(res);\n //out.print(\"Case #\"+ testNumber + \": \");\n }\n\n }\n\n static class FastReader {\n public BufferedReader br;\n public StringTokenizer st;\n String context = null;\n\n public FastReader(InputStream in) {\n this(new InputStreamReader(in));\n }\n\n public FastReader(InputStreamReader input) {\n br = new BufferedReader(input);\n }\n\n public String next() {\n if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }\n while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }\n String res = st.nextToken();\n if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }\n return res;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextArrLong(int n) {\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++)\n a[i] = nextLong();\n return a;\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.io.PrintStream;",
"PrintStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n long res = 0;\n int n = in.nextInt();\n long[] a = in.nextArrLong(n);\n long last = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }\n out.print(res);\n //out.print(\"Case #\"+ testNumber + \": \");\n }\n\n }\n\n static class FastReader {\n public BufferedReader br;\n public StringTokenizer st;\n String context = null;\n\n public FastReader(InputStream in) {\n this(new InputStreamReader(in));\n }\n\n public FastReader(InputStreamReader input) {\n br = new BufferedReader(input);\n }\n\n public String next() {\n if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }\n while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }\n String res = st.nextToken();\n if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }\n return res;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextArrLong(int n) {\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++)\n a[i] = nextLong();\n return a;\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"FastReader in = new FastReader(inputStream);",
"in",
"new FastReader(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"CStep solver = new CStep();",
"solver",
"new CStep()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class CStep {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n long res = 0;\n int n = in.nextInt();\n long[] a = in.nextArrLong(n);\n long last = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }\n out.print(res);\n //out.print(\"Case #\"+ testNumber + \": \");\n }\n\n }",
"CStep",
"public void solve(int testNumber, FastReader in, PrintWriter out) {\n long res = 0;\n int n = in.nextInt();\n long[] a = in.nextArrLong(n);\n long last = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }\n out.print(res);\n //out.print(\"Case #\"+ testNumber + \": \");\n }",
"solve",
"{\n long res = 0;\n int n = in.nextInt();\n long[] a = in.nextArrLong(n);\n long last = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }\n out.print(res);\n //out.print(\"Case #\"+ testNumber + \": \");\n }",
"long res = 0;",
"res",
"0",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long[] a = in.nextArrLong(n);",
"a",
"in.nextArrLong(n)",
"in.nextArrLong",
"in",
"n",
"long last = 0;",
"last",
"0",
"for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }",
"{\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }",
"if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }",
"a[i] < last",
"a[i]",
"a",
"i",
"last",
"{\n res += last - a[i];\n }",
"res += last - a[i]",
"res",
"last - a[i]",
"last",
"a[i]",
"a",
"i",
"{\n last = a[i];\n }",
"last = a[i]",
"last",
"a[i]",
"a",
"i",
"out.print(res)",
"out.print",
"out",
"res",
"int testNumber",
"testNumber",
"FastReader in",
"in",
"PrintWriter out",
"out",
"static class FastReader {\n public BufferedReader br;\n public StringTokenizer st;\n String context = null;\n\n public FastReader(InputStream in) {\n this(new InputStreamReader(in));\n }\n\n public FastReader(InputStreamReader input) {\n br = new BufferedReader(input);\n }\n\n public String next() {\n if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }\n while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }\n String res = st.nextToken();\n if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }\n return res;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextArrLong(int n) {\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++)\n a[i] = nextLong();\n return a;\n }\n\n }",
"FastReader",
"public BufferedReader br;",
"br",
"public StringTokenizer st;",
"st",
"String context = null;",
"context",
"null",
"public FastReader(InputStream in) {\n this(new InputStreamReader(in));\n }",
"FastReader",
"{\n this(new InputStreamReader(in));\n }",
"this(new InputStreamReader(in))",
"this",
"new InputStreamReader(in)",
"InputStream in",
"in",
"public FastReader(InputStreamReader input) {\n br = new BufferedReader(input);\n }",
"FastReader",
"{\n br = new BufferedReader(input);\n }",
"br = new BufferedReader(input)",
"br",
"new BufferedReader(input)",
"InputStreamReader input",
"input",
"public String next() {\n if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }\n while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }\n String res = st.nextToken();\n if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }\n return res;\n }",
"next",
"{\n if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }\n while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }\n String res = st.nextToken();\n if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }\n return res;\n }",
"if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }",
"context != null",
"context",
"null",
"{\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }",
"System.err.print(\"[\" + context + \"] Wait for input ...\")",
"System.err.print",
"System.err",
"System",
"System.err",
"\"[\" + context + \"] Wait for input ...\"",
"\"[\" + context + \"] Wait for input ...\"",
"\"[\"",
"context",
"\"] Wait for input ...\"",
"while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }",
"try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }",
"catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }",
"IOException e",
"{\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"throw new RuntimeException(\"Could not read\");",
"new RuntimeException(\"Could not read\")",
"{\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n }",
"String s = br.readLine();",
"s",
"br.readLine()",
"br.readLine",
"br",
"if (s == null)\n return null;",
"s == null",
"s",
"null",
"return null;",
"null",
"st = new StringTokenizer(s)",
"st",
"new StringTokenizer(s)",
"String res = st.nextToken();",
"res",
"st.nextToken()",
"st.nextToken",
"st",
"if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }",
"context != null",
"context",
"null",
"{\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }",
"System.err.println(\"[\" + context + \"] ... received : \" + res)",
"System.err.println",
"System.err",
"System",
"System.err",
"\"[\" + context + \"] ... received : \" + res",
"\"] ... received : \"",
"\"[\" + context + \"] ... received : \" + res",
"\"[\"",
"context",
"\"] ... received : \"",
"res",
"return res;",
"res",
"public int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public long[] nextArrLong(int n) {\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++)\n a[i] = nextLong();\n return a;\n }",
"nextArrLong",
"{\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++)\n a[i] = nextLong();\n return a;\n }",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < a.length; i++)\n a[i] = nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"a[i] = nextLong();",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n long res = 0;\n int n = in.nextInt();\n long[] a = in.nextArrLong(n);\n long last = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }\n out.print(res);\n //out.print(\"Case #\"+ testNumber + \": \");\n }\n\n }\n\n static class FastReader {\n public BufferedReader br;\n public StringTokenizer st;\n String context = null;\n\n public FastReader(InputStream in) {\n this(new InputStreamReader(in));\n }\n\n public FastReader(InputStreamReader input) {\n br = new BufferedReader(input);\n }\n\n public String next() {\n if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }\n while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }\n String res = st.nextToken();\n if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }\n return res;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextArrLong(int n) {\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++)\n a[i] = nextLong();\n return a;\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, FastReader in, PrintWriter out) {\n long res = 0;\n int n = in.nextInt();\n long[] a = in.nextArrLong(n);\n long last = 0;\n for (int i = 0; i < n; i++) {\n if (a[i] < last) {\n res += last - a[i];\n } else {\n last = a[i];\n }\n }\n out.print(res);\n //out.print(\"Case #\"+ testNumber + \": \");\n }\n\n }\n\n static class FastReader {\n public BufferedReader br;\n public StringTokenizer st;\n String context = null;\n\n public FastReader(InputStream in) {\n this(new InputStreamReader(in));\n }\n\n public FastReader(InputStreamReader input) {\n br = new BufferedReader(input);\n }\n\n public String next() {\n if (context != null) {\n System.err.print(\"[\" + context + \"] Wait for input ...\");\n }\n while (st == null || !st.hasMoreElements()) {\n try {\n String s = br.readLine();\n if (s == null)\n return null;\n st = new StringTokenizer(s);\n } catch (IOException e) {\n e.printStackTrace();\n throw new RuntimeException(\"Could not read\");\n }\n }\n String res = st.nextToken();\n if (context != null) {\n System.err.println(\"[\" + context + \"] ... received : \" + res);\n }\n return res;\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public long[] nextArrLong(int n) {\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++)\n a[i] = nextLong();\n return a;\n }\n\n }\n}",
"Main"
]
| import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Eric
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
FastReader in = new FastReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
CStep solver = new CStep();
solver.solve(1, in, out);
out.close();
}
static class CStep {
public void solve(int testNumber, FastReader in, PrintWriter out) {
long res = 0;
int n = in.nextInt();
long[] a = in.nextArrLong(n);
long last = 0;
for (int i = 0; i < n; i++) {
if (a[i] < last) {
res += last - a[i];
} else {
last = a[i];
}
}
out.print(res);
//out.print("Case #"+ testNumber + ": ");
}
}
static class FastReader {
public BufferedReader br;
public StringTokenizer st;
String context = null;
public FastReader(InputStream in) {
this(new InputStreamReader(in));
}
public FastReader(InputStreamReader input) {
br = new BufferedReader(input);
}
public String next() {
if (context != null) {
System.err.print("[" + context + "] Wait for input ...");
}
while (st == null || !st.hasMoreElements()) {
try {
String s = br.readLine();
if (s == null)
return null;
st = new StringTokenizer(s);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException("Could not read");
}
}
String res = st.nextToken();
if (context != null) {
System.err.println("[" + context + "] ... received : " + res);
}
return res;
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public long[] nextArrLong(int n) {
long[] a = new long[n];
for (int i = 0; i < a.length; i++)
a[i] = nextLong();
return a;
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
95,
5
],
[
95,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
28,
30
],
[
21,
31
],
[
31,
32
],
[
32,
33
],
[
21,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
58,
60
],
[
51,
61
],
[
61,
62
],
[
62,
63
],
[
51,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
66,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
6,
92
],
[
92,
93
],
[
0,
94
],
[
94,
95
],
[
94,
96
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = sc.nextLong();\n }\n long max = a[0];\n long ans = 0l;\n for (int i = 1; i < a.length; i++) {\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = sc.nextLong();\n }\n long max = a[0];\n long ans = 0l;\n for (int i = 1; i < a.length; i++) {\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = sc.nextLong();\n }\n long max = a[0];\n long ans = 0l;\n for (int i = 1; i < a.length; i++) {\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = sc.nextLong();\n }\n long max = a[0];\n long ans = 0l;\n for (int i = 1; i < a.length; i++) {\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < a.length; i++) {\n a[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n }",
"{\n a[i] = sc.nextLong();\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long max = a[0];",
"max",
"a[0]",
"a",
"0",
"long ans = 0l;",
"ans",
"0l",
"for (int i = 1; i < a.length; i++) {\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }",
"{\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }",
"if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }",
"a[i] <= max",
"a[i]",
"a",
"i",
"max",
"{\n ans += max - a[i];\n }",
"ans += max - a[i]",
"ans",
"max - a[i]",
"max",
"a[i]",
"a",
"i",
"{\n max = a[i];\n }",
"max = a[i]",
"max",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = sc.nextLong();\n }\n long max = a[0];\n long ans = 0l;\n for (int i = 1; i < a.length; i++) {\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < a.length; i++) {\n a[i] = sc.nextLong();\n }\n long max = a[0];\n long ans = 0l;\n for (int i = 1; i < a.length; i++) {\n if(a[i] <= max) {\n ans += max - a[i];\n } else {\n max = a[i];\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for (int i = 0; i < a.length; i++) {
a[i] = sc.nextLong();
}
long max = a[0];
long ans = 0l;
for (int i = 1; i < a.length; i++) {
if(a[i] <= max) {
ans += max - a[i];
} else {
max = a[i];
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
9,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
97,
5
],
[
97,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
8,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
43,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
56,
66
],
[
56,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
76,
77
],
[
76,
78
],
[
67,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
8,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
6,
94
],
[
94,
95
],
[
0,
96
],
[
96,
97
],
[
96,
98
]
]
| [
"import java.util.Scanner;\n\npublic class Main{\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n for(int i = 0; i < N; i++)\n a[i] = sc.nextInt();\n\n long answer = 0;\n for(int i = 1; i < N; i++) {\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }\n\n System.out.println(answer);\n }\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n for(int i = 0; i < N; i++)\n a[i] = sc.nextInt();\n\n long answer = 0;\n for(int i = 1; i < N; i++) {\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }\n\n System.out.println(answer);\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n for(int i = 0; i < N; i++)\n a[i] = sc.nextInt();\n\n long answer = 0;\n for(int i = 1; i < N; i++) {\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }\n\n System.out.println(answer);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n for(int i = 0; i < N; i++)\n a[i] = sc.nextInt();\n\n long answer = 0;\n for(int i = 1; i < N; i++) {\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }\n\n System.out.println(answer);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] a = new int[N];",
"a",
"new int[N]",
"N",
"for(int i = 0; i < N; i++)\n a[i] = sc.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"a[i] = sc.nextInt();",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long answer = 0;",
"answer",
"0",
"for(int i = 1; i < N; i++) {\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }",
"{\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }",
"if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }",
"a[i] >= a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"continue;",
"{\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }",
"answer += a[i - 1] - a[i]",
"answer",
"a[i - 1] - a[i]",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"a[i] = a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"String[] args",
"args",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n for(int i = 0; i < N; i++)\n a[i] = sc.nextInt();\n\n long answer = 0;\n for(int i = 1; i < N; i++) {\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }\n\n System.out.println(answer);\n }\n\n}",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] a = new int[N];\n for(int i = 0; i < N; i++)\n a[i] = sc.nextInt();\n\n long answer = 0;\n for(int i = 1; i < N; i++) {\n if(a[i] >= a[i - 1])\n continue;\n else {\n answer += a[i - 1] - a[i];\n a[i] = a[i - 1];\n }\n }\n\n System.out.println(answer);\n }\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] a = new int[N];
for(int i = 0; i < N; i++)
a[i] = sc.nextInt();
long answer = 0;
for(int i = 1; i < N; i++) {
if(a[i] >= a[i - 1])
continue;
else {
answer += a[i - 1] - a[i];
a[i] = a[i - 1];
}
}
System.out.println(answer);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
0,
13,
4,
18,
13,
41,
13,
20,
13,
0,
13,
4,
18,
13,
17,
17,
41,
13,
4,
18,
13,
18,
13,
17,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
100,
5
],
[
100,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
34,
38
],
[
8,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
41,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
64,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
6,
97
],
[
97,
98
],
[
0,
99
],
[
99,
100
],
[
99,
101
]
]
| [
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int n = Integer.parseInt(line);\n \n line = sc.nextLine();\n String HeiSt[] = new String[n];\n HeiSt = line.split(\" \", 0);\n int hei0 = Integer.parseInt(HeiSt[0]);\n int hei1;\n long step = 0;\n \n for(int i = 1; i < n; i++){\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }\n \n System.out.println(step);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int n = Integer.parseInt(line);\n \n line = sc.nextLine();\n String HeiSt[] = new String[n];\n HeiSt = line.split(\" \", 0);\n int hei0 = Integer.parseInt(HeiSt[0]);\n int hei1;\n long step = 0;\n \n for(int i = 1; i < n; i++){\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }\n \n System.out.println(step);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int n = Integer.parseInt(line);\n \n line = sc.nextLine();\n String HeiSt[] = new String[n];\n HeiSt = line.split(\" \", 0);\n int hei0 = Integer.parseInt(HeiSt[0]);\n int hei1;\n long step = 0;\n \n for(int i = 1; i < n; i++){\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }\n \n System.out.println(step);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int n = Integer.parseInt(line);\n \n line = sc.nextLine();\n String HeiSt[] = new String[n];\n HeiSt = line.split(\" \", 0);\n int hei0 = Integer.parseInt(HeiSt[0]);\n int hei1;\n long step = 0;\n \n for(int i = 1; i < n; i++){\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }\n \n System.out.println(step);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String line = sc.nextLine();",
"line",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int n = Integer.parseInt(line);",
"n",
"Integer.parseInt(line)",
"Integer.parseInt",
"Integer",
"line",
"line = sc.nextLine()",
"line",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String HeiSt[] = new String[n];",
"HeiSt",
"new String[n]",
"n",
"HeiSt = line.split(\" \", 0)",
"HeiSt",
"line.split(\" \", 0)",
"line.split",
"line",
"\" \"",
"0",
"int hei0 = Integer.parseInt(HeiSt[0]);",
"hei0",
"Integer.parseInt(HeiSt[0])",
"Integer.parseInt",
"Integer",
"HeiSt[0]",
"HeiSt",
"0",
"int hei1;",
"hei1",
"long step = 0;",
"step",
"0",
"for(int i = 1; i < n; i++){\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }",
"{\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }",
"hei1 = Integer.parseInt(HeiSt[i])",
"hei1",
"Integer.parseInt(HeiSt[i])",
"Integer.parseInt",
"Integer",
"HeiSt[i]",
"HeiSt",
"i",
"if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }",
"hei0 > hei1",
"hei0",
"hei1",
"{\n step += hei0 - hei1;\n }",
"step += hei0 - hei1",
"step",
"hei0 - hei1",
"hei0",
"hei1",
"if(hei0 < hei1){\n hei0 = hei1;\n }",
"hei0 < hei1",
"hei0",
"hei1",
"{\n hei0 = hei1;\n }",
"hei0 = hei1",
"hei0",
"hei1",
"System.out.println(step)",
"System.out.println",
"System.out",
"System",
"System.out",
"step",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int n = Integer.parseInt(line);\n \n line = sc.nextLine();\n String HeiSt[] = new String[n];\n HeiSt = line.split(\" \", 0);\n int hei0 = Integer.parseInt(HeiSt[0]);\n int hei1;\n long step = 0;\n \n for(int i = 1; i < n; i++){\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }\n \n System.out.println(step);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n String line = sc.nextLine();\n int n = Integer.parseInt(line);\n \n line = sc.nextLine();\n String HeiSt[] = new String[n];\n HeiSt = line.split(\" \", 0);\n int hei0 = Integer.parseInt(HeiSt[0]);\n int hei1;\n long step = 0;\n \n for(int i = 1; i < n; i++){\n hei1 = Integer.parseInt(HeiSt[i]);\n if(hei0 > hei1){\n step += hei0 - hei1;\n }else if(hei0 < hei1){\n hei0 = hei1;\n }\n }\n \n System.out.println(step);\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
int n = Integer.parseInt(line);
line = sc.nextLine();
String HeiSt[] = new String[n];
HeiSt = line.split(" ", 0);
int hei0 = Integer.parseInt(HeiSt[0]);
int hei1;
long step = 0;
for(int i = 1; i < n; i++){
hei1 = Integer.parseInt(HeiSt[i]);
if(hei0 > hei1){
step += hei0 - hei1;
}else if(hei0 < hei1){
hei0 = hei1;
}
}
System.out.println(step);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
98,
5
],
[
98,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
8,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
43,
53
],
[
53,
54
],
[
54,
55
],
[
43,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
58,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
68,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
86,
87
],
[
86,
88
],
[
8,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
6,
95
],
[
95,
96
],
[
0,
97
],
[
97,
98
],
[
97,
99
]
]
| [
"import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc= new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long [201000];\n for(int i =0; i < N; i++) A[i] = sc.nextLong();\n long humidai = 0;\n for(int i = 0; i < N - 1; i++){\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }\n System.out.println(humidai);\n } \n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc= new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long [201000];\n for(int i =0; i < N; i++) A[i] = sc.nextLong();\n long humidai = 0;\n for(int i = 0; i < N - 1; i++){\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }\n System.out.println(humidai);\n } \n}",
"Main",
"public static void main(String[] args) {\n Scanner sc= new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long [201000];\n for(int i =0; i < N; i++) A[i] = sc.nextLong();\n long humidai = 0;\n for(int i = 0; i < N - 1; i++){\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }\n System.out.println(humidai);\n }",
"main",
"{\n Scanner sc= new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long [201000];\n for(int i =0; i < N; i++) A[i] = sc.nextLong();\n long humidai = 0;\n for(int i = 0; i < N - 1; i++){\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }\n System.out.println(humidai);\n }",
"Scanner sc= new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] A = new long [201000];",
"A",
"new long [201000]",
"201000",
"for(int i =0; i < N; i++) A[i] = sc.nextLong();",
"int i =0;",
"int i =0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"A[i] = sc.nextLong();",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long humidai = 0;",
"humidai",
"0",
"for(int i = 0; i < N - 1; i++){\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N - 1",
"i",
"N - 1",
"N",
"1",
"i++",
"i++",
"i",
"{\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }",
"{\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }",
"if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }",
"A[i] > A[i + 1]",
"A[i]",
"A",
"i",
"A[i + 1]",
"A",
"i + 1",
"i",
"1",
"{\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }",
"humidai += (A[i] - A[i +1])",
"humidai",
"(A[i] - A[i +1])",
"A[i]",
"A",
"i",
"A[i +1]",
"A",
"i +1",
"i",
"1",
"A[i+1] = A[i]",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"System.out.println(humidai)",
"System.out.println",
"System.out",
"System",
"System.out",
"humidai",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc= new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long [201000];\n for(int i =0; i < N; i++) A[i] = sc.nextLong();\n long humidai = 0;\n for(int i = 0; i < N - 1; i++){\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }\n System.out.println(humidai);\n } \n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc= new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long [201000];\n for(int i =0; i < N; i++) A[i] = sc.nextLong();\n long humidai = 0;\n for(int i = 0; i < N - 1; i++){\n if(A[i] > A[i + 1]){\n humidai += (A[i] - A[i +1]);\n A[i+1] = A[i];\n }\n }\n System.out.println(humidai);\n } \n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int N = sc.nextInt();
long[] A = new long [201000];
for(int i =0; i < N; i++) A[i] = sc.nextLong();
long humidai = 0;
for(int i = 0; i < N - 1; i++){
if(A[i] > A[i + 1]){
humidai += (A[i] - A[i +1]);
A[i+1] = A[i];
}
}
System.out.println(humidai);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
83,
8
],
[
83,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
11,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
11,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
34,
44
],
[
44,
45
],
[
45,
46
],
[
34,
47
],
[
48,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
48,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
54,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
11,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
9,
80
],
[
80,
81
],
[
0,
82
],
[
82,
83
],
[
82,
84
]
]
| [
"import java.util.Scanner;\nimport java.util.Arrays;\n\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int n = sc.nextInt();\n/* int[] a = new int[n]\n for(int i=0;i<n;i++){\n a[i]=sc.nextInt();\n }\n*/ \n int x = 0;\n int y = 0;\n long diff = 0;\n x= sc.nextInt();\n for(int i=0; i<n-1; i++){\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }\n System.out.println(diff);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int n = sc.nextInt();\n/* int[] a = new int[n]\n for(int i=0;i<n;i++){\n a[i]=sc.nextInt();\n }\n*/ \n int x = 0;\n int y = 0;\n long diff = 0;\n x= sc.nextInt();\n for(int i=0; i<n-1; i++){\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }\n System.out.println(diff);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int n = sc.nextInt();\n/* int[] a = new int[n]\n for(int i=0;i<n;i++){\n a[i]=sc.nextInt();\n }\n*/ \n int x = 0;\n int y = 0;\n long diff = 0;\n x= sc.nextInt();\n for(int i=0; i<n-1; i++){\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }\n System.out.println(diff);\n }",
"main",
"{\n Scanner sc =new Scanner(System.in);\n int n = sc.nextInt();\n/* int[] a = new int[n]\n for(int i=0;i<n;i++){\n a[i]=sc.nextInt();\n }\n*/ \n int x = 0;\n int y = 0;\n long diff = 0;\n x= sc.nextInt();\n for(int i=0; i<n-1; i++){\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }\n System.out.println(diff);\n }",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int x = 0;",
"x",
"0",
"int y = 0;",
"y",
"0",
"long diff = 0;",
"diff",
"0",
"x= sc.nextInt()",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0; i<n-1; i++){\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"{\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }",
"{\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }",
"y= sc.nextInt()",
"y",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }",
"y<x",
"y",
"x",
"{\n diff = diff+x-y;\n }",
"diff = diff+x-y",
"diff",
"diff+x-y",
"diff+x",
"diff",
"x",
"y",
"if(x<y){\n x=y;\n }",
"x<y",
"x",
"y",
"{\n x=y;\n }",
"x=y",
"x",
"y",
"System.out.println(diff)",
"System.out.println",
"System.out",
"System",
"System.out",
"diff",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int n = sc.nextInt();\n/* int[] a = new int[n]\n for(int i=0;i<n;i++){\n a[i]=sc.nextInt();\n }\n*/ \n int x = 0;\n int y = 0;\n long diff = 0;\n x= sc.nextInt();\n for(int i=0; i<n-1; i++){\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }\n System.out.println(diff);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc =new Scanner(System.in);\n int n = sc.nextInt();\n/* int[] a = new int[n]\n for(int i=0;i<n;i++){\n a[i]=sc.nextInt();\n }\n*/ \n int x = 0;\n int y = 0;\n long diff = 0;\n x= sc.nextInt();\n for(int i=0; i<n-1; i++){\n y= sc.nextInt();\n// System.out.print(y+\" \");\n if(y<x){\n diff = diff+x-y;\n }else if(x<y){\n x=y;\n }\n// System.out.println(x);\n }\n System.out.println(diff);\n }\n}",
"Main"
]
| import java.util.Scanner;
import java.util.Arrays;
public class Main{
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int n = sc.nextInt();
/* int[] a = new int[n]
for(int i=0;i<n;i++){
a[i]=sc.nextInt();
}
*/
int x = 0;
int y = 0;
long diff = 0;
x= sc.nextInt();
for(int i=0; i<n-1; i++){
y= sc.nextInt();
// System.out.print(y+" ");
if(y<x){
diff = diff+x-y;
}else if(x<y){
x=y;
}
// System.out.println(x);
}
System.out.println(diff);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
2,
13,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
91,
5
],
[
91,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
60,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
8,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
6,
88
],
[
88,
89
],
[
0,
90
],
[
90,
91
],
[
90,
92
]
]
| [
"import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n long A[]=new long[N];\n for(int i=0; i<N; i++){\n A[i]=sc.nextInt();\n }\n long res = 0;\n long max = 0;\n for(int i=0; i<N; i++){\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }\n\t\tSystem.out.println(res);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n long A[]=new long[N];\n for(int i=0; i<N; i++){\n A[i]=sc.nextInt();\n }\n long res = 0;\n long max = 0;\n for(int i=0; i<N; i++){\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }\n\t\tSystem.out.println(res);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n long A[]=new long[N];\n for(int i=0; i<N; i++){\n A[i]=sc.nextInt();\n }\n long res = 0;\n long max = 0;\n for(int i=0; i<N; i++){\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }\n\t\tSystem.out.println(res);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n long A[]=new long[N];\n for(int i=0; i<N; i++){\n A[i]=sc.nextInt();\n }\n long res = 0;\n long max = 0;\n for(int i=0; i<N; i++){\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }\n\t\tSystem.out.println(res);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long A[]=new long[N];",
"A",
"new long[N]",
"N",
"for(int i=0; i<N; i++){\n A[i]=sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i]=sc.nextInt();\n }",
"{\n A[i]=sc.nextInt();\n }",
"A[i]=sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long res = 0;",
"res",
"0",
"long max = 0;",
"max",
"0",
"for(int i=0; i<N; i++){\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }",
"{\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }",
"if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }",
"A[i]<max",
"A[i]",
"A",
"i",
"max",
"{\n res = res + max - A[i];\n }",
"res = res + max - A[i]",
"res",
"res + max - A[i]",
"res + max",
"res",
"max",
"A[i]",
"A",
"i",
"{\n max = A[i];\n }",
"max = A[i]",
"max",
"A[i]",
"A",
"i",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n long A[]=new long[N];\n for(int i=0; i<N; i++){\n A[i]=sc.nextInt();\n }\n long res = 0;\n long max = 0;\n for(int i=0; i<N; i++){\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }\n\t\tSystem.out.println(res);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n long A[]=new long[N];\n for(int i=0; i<N; i++){\n A[i]=sc.nextInt();\n }\n long res = 0;\n long max = 0;\n for(int i=0; i<N; i++){\n if(A[i]<max){\n res = res + max - A[i];\n }else{\n max = A[i];\n }\n \n }\n\t\tSystem.out.println(res);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long A[]=new long[N];
for(int i=0; i<N; i++){
A[i]=sc.nextInt();
}
long res = 0;
long max = 0;
for(int i=0; i<N; i++){
if(A[i]<max){
res = res + max - A[i];
}else{
max = A[i];
}
}
System.out.println(res);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
14,
2,
13,
17,
30,
0,
18,
13,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
90,
5
],
[
90,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
44,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
59,
65
],
[
65,
66
],
[
65,
67
],
[
56,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
78,
80
],
[
8,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
6,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong count = 0;\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong count = 0;\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong count = 0;\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong count = 0;\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long count = 0;",
"count",
"0",
"for(int i = 1; i < n; i++) {\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}",
"{\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}",
"long s = a[i-1] - a[i];",
"s",
"a[i-1] - a[i]",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"if(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}",
"s > 0",
"s",
"0",
"{\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}",
"a[i] += s",
"a[i]",
"a",
"i",
"s",
"count += s",
"count",
"s",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong count = 0;\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlong count = 0;\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tlong s = a[i-1] - a[i];\n\t\t\tif(s > 0) {\n\t\t\t\ta[i] += s;\n\t\t\t\tcount += s;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(count);\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for(int i = 0; i < n; i++) {
a[i] = sc.nextLong();
}
long count = 0;
for(int i = 1; i < n; i++) {
long s = a[i-1] - a[i];
if(s > 0) {
a[i] += s;
count += s;
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
2,
13,
13,
0,
18,
13,
2,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
69,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
69,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
92,
93
],
[
92,
94
],
[
8,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
6,
101
],
[
101,
102
]
]
| [
"import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n }\n long sum = 0;\n for (int i = 0; i < n - 1; i++) {\n if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }\n }\n System.out.println(sum);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n }\n long sum = 0;\n for (int i = 0; i < n - 1; i++) {\n if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }\n }\n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n }\n long sum = 0;\n for (int i = 0; i < n - 1; i++) {\n if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n }\n long sum = 0;\n for (int i = 0; i < n - 1; i++) {\n if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }\n }\n System.out.println(sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = sc.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextLong();\n }",
"{\n a[i] = sc.nextLong();\n }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long sum = 0;",
"sum",
"0",
"for (int i = 0; i < n - 1; i++) {\n if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n - 1",
"i",
"n - 1",
"n",
"1",
"i++",
"i++",
"i",
"{\n if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }\n }",
"{\n if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }\n }",
"if(a[i] > a[i + 1]) {\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }",
"a[i] > a[i + 1]",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"{\n long dai = a[i] - a[i + 1];\n sum = sum + dai;\n a[i + 1] = a[i];\n }",
"long dai = a[i] - a[i + 1];",
"dai",
"a[i] - a[i + 1]",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"sum = sum + dai",
"sum",
"sum + dai",
"sum",
"dai",
"a[i + 1] = a[i]",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"a[i]",
"a",
"i",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args"
]
| import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextLong();
}
long sum = 0;
for (int i = 0; i < n - 1; i++) {
if(a[i] > a[i + 1]) {
long dai = a[i] - a[i + 1];
sum = sum + dai;
a[i + 1] = a[i];
}
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
41,
13,
17,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
0,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
77,
8
],
[
77,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
38,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
38,
57
],
[
57,
58
],
[
57,
59
],
[
38,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
11,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
11,
71
],
[
71,
72
],
[
72,
73
],
[
9,
74
],
[
74,
75
],
[
0,
76
],
[
76,
77
],
[
76,
78
]
]
| [
"import java.util.Scanner;\nimport java.util.Arrays;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int beforeA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int beforeA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int beforeA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }\n System.out.println(ans);\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int beforeA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }\n System.out.println(ans);\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int beforeA = 0;",
"beforeA",
"0",
"long ans = 0;",
"ans",
"0",
"for (int cnt = 0; cnt < n; cnt++) {\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }",
"int cnt = 0;",
"int cnt = 0;",
"cnt",
"0",
"cnt < n",
"cnt",
"n",
"cnt++",
"cnt++",
"cnt",
"{\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }",
"{\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int step = 0;",
"step",
"0",
"if (beforeA > a) {\n step = beforeA - a;\n }",
"beforeA > a",
"beforeA",
"a",
"{\n step = beforeA - a;\n }",
"step = beforeA - a",
"step",
"beforeA - a",
"beforeA",
"a",
"ans += step",
"ans",
"step",
"beforeA = a + step",
"beforeA",
"a + step",
"a",
"step",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int beforeA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int beforeA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n int a = sc.nextInt();\n int step = 0;\n if (beforeA > a) {\n step = beforeA - a;\n }\n ans += step;\n beforeA = a + step;\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"Main"
]
| import java.util.Scanner;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int beforeA = 0;
long ans = 0;
for (int cnt = 0; cnt < n; cnt++) {
int a = sc.nextInt();
int step = 0;
if (beforeA > a) {
step = beforeA - a;
}
ans += step;
beforeA = a + step;
}
System.out.println(ans);
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
14,
2,
13,
17,
30,
0,
13,
13,
0,
18,
13,
2,
13,
17,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
97,
5
],
[
97,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
61,
67
],
[
67,
68
],
[
67,
69
],
[
58,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
8,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
6,
94
],
[
94,
95
],
[
0,
96
],
[
96,
97
],
[
96,
98
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong A[] = new long[N];\n\n\t\tlong ans = 0L;\n\n\t\tfor(int i = 0; i<N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i<N-1; i++) {\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong A[] = new long[N];\n\n\t\tlong ans = 0L;\n\n\t\tfor(int i = 0; i<N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i<N-1; i++) {\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong A[] = new long[N];\n\n\t\tlong ans = 0L;\n\n\t\tfor(int i = 0; i<N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i<N-1; i++) {\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong A[] = new long[N];\n\n\t\tlong ans = 0L;\n\n\t\tfor(int i = 0; i<N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i<N-1; i++) {\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long A[] = new long[N];",
"A",
"new long[N]",
"N",
"long ans = 0L;",
"ans",
"0L",
"for(int i = 0; i<N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextLong();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextLong();\n\t\t}",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"for(int i = 0; i<N-1; i++) {\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<N-1",
"i",
"N-1",
"N",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}",
"{\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}",
"long x =A[i+1] - A[i];",
"x",
"A[i+1] - A[i]",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"A[i]",
"A",
"i",
"if(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}",
"x<0",
"x",
"0",
"{\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}",
"ans -= x",
"ans",
"x",
"A[i+1] -=x",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"x",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String args[]",
"args",
"public class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong A[] = new long[N];\n\n\t\tlong ans = 0L;\n\n\t\tfor(int i = 0; i<N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i<N-1; i++) {\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tlong A[] = new long[N];\n\n\t\tlong ans = 0L;\n\n\t\tfor(int i = 0; i<N; i++) {\n\t\t\tA[i] = sc.nextLong();\n\t\t}\n\n\t\tfor(int i = 0; i<N-1; i++) {\n\t\t\tlong x =A[i+1] - A[i];\n\t\t\tif(x<0) {\n\t\t\t\tans -= x;\n\t\t\t\tA[i+1] -=x;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long A[] = new long[N];
long ans = 0L;
for(int i = 0; i<N; i++) {
A[i] = sc.nextLong();
}
for(int i = 0; i<N-1; i++) {
long x =A[i+1] - A[i];
if(x<0) {
ans -= x;
A[i+1] -=x;
}
}
System.out.println(ans);
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
18,
13,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
18,
13,
13,
0,
13,
8,
2,
18,
13,
13,
13,
2,
13,
18,
13,
13,
17,
4,
18,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
32
],
[
32,
33
],
[
32,
34
],
[
11,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
47,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
57,
61
],
[
61,
62
],
[
61,
63
],
[
47,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
66,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
66,
77
],
[
11,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
9,
82
],
[
82,
83
]
]
| [
"import java.util.*;\nimport java.io.*;\nclass Main{\n\tpublic static void main(String[]args){\n\t\tScanner in=new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out, true);\n\t\tint n = in.nextInt();\n\t\tlong max = Integer.MIN_VALUE;\n\t\tlong a[]=new long[n];\n\t\tlong sum = 0;\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=in.nextLong();\n\t\t\tmax = Math.max(max, a[i]);\n\t\t\tsum += (a[i] < max) ? (max - a[i]) : 0;\n\t\t}\n\t\tout.println(sum);\n\t}\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main{\n\tpublic static void main(String[]args){\n\t\tScanner in=new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out, true);\n\t\tint n = in.nextInt();\n\t\tlong max = Integer.MIN_VALUE;\n\t\tlong a[]=new long[n];\n\t\tlong sum = 0;\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=in.nextLong();\n\t\t\tmax = Math.max(max, a[i]);\n\t\t\tsum += (a[i] < max) ? (max - a[i]) : 0;\n\t\t}\n\t\tout.println(sum);\n\t}\n}",
"Main",
"public static void main(String[]args){\n\t\tScanner in=new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out, true);\n\t\tint n = in.nextInt();\n\t\tlong max = Integer.MIN_VALUE;\n\t\tlong a[]=new long[n];\n\t\tlong sum = 0;\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=in.nextLong();\n\t\t\tmax = Math.max(max, a[i]);\n\t\t\tsum += (a[i] < max) ? (max - a[i]) : 0;\n\t\t}\n\t\tout.println(sum);\n\t}",
"main",
"{\n\t\tScanner in=new Scanner(System.in);\n\t\tPrintWriter out = new PrintWriter(System.out, true);\n\t\tint n = in.nextInt();\n\t\tlong max = Integer.MIN_VALUE;\n\t\tlong a[]=new long[n];\n\t\tlong sum = 0;\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=in.nextLong();\n\t\t\tmax = Math.max(max, a[i]);\n\t\t\tsum += (a[i] < max) ? (max - a[i]) : 0;\n\t\t}\n\t\tout.println(sum);\n\t}",
"Scanner in=new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"PrintWriter out = new PrintWriter(System.out, true);",
"out",
"new PrintWriter(System.out, true)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long max = Integer.MIN_VALUE;",
"max",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"long a[]=new long[n];",
"a",
"new long[n]",
"n",
"long sum = 0;",
"sum",
"0",
"for(int i=0;i<n;i++){\n\t\t\ta[i]=in.nextLong();\n\t\t\tmax = Math.max(max, a[i]);\n\t\t\tsum += (a[i] < max) ? (max - a[i]) : 0;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i]=in.nextLong();\n\t\t\tmax = Math.max(max, a[i]);\n\t\t\tsum += (a[i] < max) ? (max - a[i]) : 0;\n\t\t}",
"{\n\t\t\ta[i]=in.nextLong();\n\t\t\tmax = Math.max(max, a[i]);\n\t\t\tsum += (a[i] < max) ? (max - a[i]) : 0;\n\t\t}",
"a[i]=in.nextLong()",
"a[i]",
"a",
"i",
"in.nextLong()",
"in.nextLong",
"in",
"max = Math.max(max, a[i])",
"max",
"Math.max(max, a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"sum += (a[i] < max) ? (max - a[i]) : 0",
"sum",
"(a[i] < max) ? (max - a[i]) : 0",
"(a[i] < max)",
"a[i]",
"a",
"i",
"max",
"(max - a[i])",
"max",
"a[i]",
"a",
"i",
"0",
"out.println(sum)",
"out.println",
"out",
"sum",
"String[]args",
"args"
]
| import java.util.*;
import java.io.*;
class Main{
public static void main(String[]args){
Scanner in=new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out, true);
int n = in.nextInt();
long max = Integer.MIN_VALUE;
long a[]=new long[n];
long sum = 0;
for(int i=0;i<n;i++){
a[i]=in.nextLong();
max = Math.max(max, a[i]);
sum += (a[i] < max) ? (max - a[i]) : 0;
}
out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
64,
5
],
[
64,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
41,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
6,
61
],
[
61,
62
],
[
0,
63
],
[
63,
64
],
[
63,
65
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n\t int n = sc.nextInt();\n\t int bfLength = 0;\n\t long stepSum = 0;\n\t for (int i = 0; i < n; i++) {\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }\n\t System.out.println(stepSum);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n\t int n = sc.nextInt();\n\t int bfLength = 0;\n\t long stepSum = 0;\n\t for (int i = 0; i < n; i++) {\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }\n\t System.out.println(stepSum);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n\t int n = sc.nextInt();\n\t int bfLength = 0;\n\t long stepSum = 0;\n\t for (int i = 0; i < n; i++) {\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }\n\t System.out.println(stepSum);\n\t}",
"main",
"{\n\t Scanner sc = new Scanner(System.in);\n\t int n = sc.nextInt();\n\t int bfLength = 0;\n\t long stepSum = 0;\n\t for (int i = 0; i < n; i++) {\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }\n\t System.out.println(stepSum);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int bfLength = 0;",
"bfLength",
"0",
"long stepSum = 0;",
"stepSum",
"0",
"for (int i = 0; i < n; i++) {\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }",
"{\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }",
"bfLength > a",
"bfLength",
"a",
"{\n\t\t \tstepSum += (bfLength - a);\n\t\t }",
"stepSum += (bfLength - a)",
"stepSum",
"(bfLength - a)",
"bfLength",
"a",
"{\n\t\t \tbfLength = a;\n\t\t }",
"bfLength = a",
"bfLength",
"a",
"System.out.println(stepSum)",
"System.out.println",
"System.out",
"System",
"System.out",
"stepSum",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n\t int n = sc.nextInt();\n\t int bfLength = 0;\n\t long stepSum = 0;\n\t for (int i = 0; i < n; i++) {\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }\n\t System.out.println(stepSum);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t Scanner sc = new Scanner(System.in);\n\t int n = sc.nextInt();\n\t int bfLength = 0;\n\t long stepSum = 0;\n\t for (int i = 0; i < n; i++) {\n\t\t int a = sc.nextInt();\n\t\t if (bfLength > a) {\n\t\t \tstepSum += (bfLength - a);\n\t\t } else {\n\t\t \tbfLength = a;\n\t\t }\n\t }\n\t System.out.println(stepSum);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int bfLength = 0;
long stepSum = 0;
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
if (bfLength > a) {
stepSum += (bfLength - a);
} else {
bfLength = a;
}
}
System.out.println(stepSum);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
30,
9,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
102,
5
],
[
102,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
33,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
61,
67
],
[
67,
68
],
[
67,
69
],
[
60,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
70,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
60,
91
],
[
91,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
6,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
]
| [
"import java.util.Scanner;\npublic class Main {\npublic static void main(String[] args) {\nScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] x = new int[N];\n for(int i=0; i<N; i++) {\n int A = sc.nextInt();\n x[i] = A;\n }\n long plus = 0;\n for(int i=1; i<N; i++) {\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }\n System.out.println(plus);\n }\n }",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\npublic static void main(String[] args) {\nScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] x = new int[N];\n for(int i=0; i<N; i++) {\n int A = sc.nextInt();\n x[i] = A;\n }\n long plus = 0;\n for(int i=1; i<N; i++) {\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }\n System.out.println(plus);\n }\n }",
"Main",
"public static void main(String[] args) {\nScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] x = new int[N];\n for(int i=0; i<N; i++) {\n int A = sc.nextInt();\n x[i] = A;\n }\n long plus = 0;\n for(int i=1; i<N; i++) {\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }\n System.out.println(plus);\n }",
"main",
"{\nScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] x = new int[N];\n for(int i=0; i<N; i++) {\n int A = sc.nextInt();\n x[i] = A;\n }\n long plus = 0;\n for(int i=1; i<N; i++) {\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }\n System.out.println(plus);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] x = new int[N];",
"x",
"new int[N]",
"N",
"for(int i=0; i<N; i++) {\n int A = sc.nextInt();\n x[i] = A;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int A = sc.nextInt();\n x[i] = A;\n }",
"{\n int A = sc.nextInt();\n x[i] = A;\n }",
"int A = sc.nextInt();",
"A",
"sc.nextInt()",
"sc.nextInt",
"sc",
"x[i] = A",
"x[i]",
"x",
"i",
"A",
"long plus = 0;",
"plus",
"0",
"for(int i=1; i<N; i++) {\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }",
"{\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }",
"if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }",
"x[i-1] > x[i]",
"x[i-1]",
"x",
"i-1",
"i",
"1",
"x[i]",
"x",
"i",
"{\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n }",
"plus+=x[i-1]-x[i]",
"plus",
"x[i-1]-x[i]",
"x[i-1]",
"x",
"i-1",
"i",
"1",
"x[i]",
"x",
"i",
"x[i]=x[i-1]",
"x[i]",
"x",
"i",
"x[i-1]",
"x",
"i-1",
"i",
"1",
"{\n continue;\n }",
"continue;",
"System.out.println(plus)",
"System.out.println",
"System.out",
"System",
"System.out",
"plus",
"String[] args",
"args",
"public class Main {\npublic static void main(String[] args) {\nScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] x = new int[N];\n for(int i=0; i<N; i++) {\n int A = sc.nextInt();\n x[i] = A;\n }\n long plus = 0;\n for(int i=1; i<N; i++) {\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }\n System.out.println(plus);\n }\n }",
"public class Main {\npublic static void main(String[] args) {\nScanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int[] x = new int[N];\n for(int i=0; i<N; i++) {\n int A = sc.nextInt();\n x[i] = A;\n }\n long plus = 0;\n for(int i=1; i<N; i++) {\n if(x[i-1] > x[i]) {\n plus+=x[i-1]-x[i];\n //x[i]+=x[i-1]-x[i];\n x[i]=x[i-1];\n } else {\n continue;\n }\n }\n System.out.println(plus);\n }\n }",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] x = new int[N];
for(int i=0; i<N; i++) {
int A = sc.nextInt();
x[i] = A;
}
long plus = 0;
for(int i=1; i<N; i++) {
if(x[i-1] > x[i]) {
plus+=x[i-1]-x[i];
//x[i]+=x[i-1]-x[i];
x[i]=x[i-1];
} else {
continue;
}
}
System.out.println(plus);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
102,
5
],
[
102,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
44,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
58,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
76,
77
],
[
76,
78
],
[
67,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
67,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
6,
99
],
[
99,
100
],
[
0,
101
],
[
101,
102
],
[
101,
103
]
]
| [
"import java.util.Scanner;\npublic class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long[] arr = new long[n];\n long sum = 0;\n for(int i=0;i<n;i++){\n arr[i] = scan.nextLong();\n }\n \n for(int i=1;i<n;i++){\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }\n System.out.println(sum);\n \n \n }\n \n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long[] arr = new long[n];\n long sum = 0;\n for(int i=0;i<n;i++){\n arr[i] = scan.nextLong();\n }\n \n for(int i=1;i<n;i++){\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }\n System.out.println(sum);\n \n \n }\n \n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long[] arr = new long[n];\n long sum = 0;\n for(int i=0;i<n;i++){\n arr[i] = scan.nextLong();\n }\n \n for(int i=1;i<n;i++){\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }\n System.out.println(sum);\n \n \n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long[] arr = new long[n];\n long sum = 0;\n for(int i=0;i<n;i++){\n arr[i] = scan.nextLong();\n }\n \n for(int i=1;i<n;i++){\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }\n System.out.println(sum);\n \n \n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"long sum = 0;",
"sum",
"0",
"for(int i=0;i<n;i++){\n arr[i] = scan.nextLong();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = scan.nextLong();\n }",
"{\n arr[i] = scan.nextLong();\n }",
"arr[i] = scan.nextLong()",
"arr[i]",
"arr",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"for(int i=1;i<n;i++){\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }",
"{\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }",
"if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }",
"arr[i-1] > arr[i]",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"arr[i]",
"arr",
"i",
"{\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }",
"long d = arr[i-1] - arr[i];",
"d",
"arr[i-1] - arr[i]",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"arr[i]",
"arr",
"i",
"arr[i] = arr[i] + d",
"arr[i]",
"arr",
"i",
"arr[i] + d",
"arr[i]",
"arr",
"i",
"d",
"sum = sum + d",
"sum",
"sum + d",
"sum",
"d",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long[] arr = new long[n];\n long sum = 0;\n for(int i=0;i<n;i++){\n arr[i] = scan.nextLong();\n }\n \n for(int i=1;i<n;i++){\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }\n System.out.println(sum);\n \n \n }\n \n}",
"public class Main {\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n long[] arr = new long[n];\n long sum = 0;\n for(int i=0;i<n;i++){\n arr[i] = scan.nextLong();\n }\n \n for(int i=1;i<n;i++){\n if(arr[i-1] > arr[i]){\n long d = arr[i-1] - arr[i];\n arr[i] = arr[i] + d;\n sum = sum + d;\n }\n }\n System.out.println(sum);\n \n \n }\n \n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long[] arr = new long[n];
long sum = 0;
for(int i=0;i<n;i++){
arr[i] = scan.nextLong();
}
for(int i=1;i<n;i++){
if(arr[i-1] > arr[i]){
long d = arr[i-1] - arr[i];
arr[i] = arr[i] + d;
sum = sum + d;
}
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
88,
5
],
[
88,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
8,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
65,
69
],
[
69,
70
],
[
69,
71
],
[
62,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
8,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
6,
85
],
[
85,
86
],
[
0,
87
],
[
87,
88
],
[
87,
89
]
]
| [
"import java.util.*;\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t int n = sc.nextInt();\n\t\t long a[] = new long[n];\n\t\t long max = 0;\n\t\t long chk = 0;\n\t\t long min = 1000000000;\n\t\t for(int i=0;i<n;i++){\n\t\t a[i] = sc.nextLong();\n\t\t }\n\t\t \n\t\t for(int i=0;i<n;i++){\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }\n\t\t System.out.println(chk);\n\t \n \n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t int n = sc.nextInt();\n\t\t long a[] = new long[n];\n\t\t long max = 0;\n\t\t long chk = 0;\n\t\t long min = 1000000000;\n\t\t for(int i=0;i<n;i++){\n\t\t a[i] = sc.nextLong();\n\t\t }\n\t\t \n\t\t for(int i=0;i<n;i++){\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }\n\t\t System.out.println(chk);\n\t \n \n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t int n = sc.nextInt();\n\t\t long a[] = new long[n];\n\t\t long max = 0;\n\t\t long chk = 0;\n\t\t long min = 1000000000;\n\t\t for(int i=0;i<n;i++){\n\t\t a[i] = sc.nextLong();\n\t\t }\n\t\t \n\t\t for(int i=0;i<n;i++){\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }\n\t\t System.out.println(chk);\n\t \n \n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t int n = sc.nextInt();\n\t\t long a[] = new long[n];\n\t\t long max = 0;\n\t\t long chk = 0;\n\t\t long min = 1000000000;\n\t\t for(int i=0;i<n;i++){\n\t\t a[i] = sc.nextLong();\n\t\t }\n\t\t \n\t\t for(int i=0;i<n;i++){\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }\n\t\t System.out.println(chk);\n\t \n \n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long a[] = new long[n];",
"a",
"new long[n]",
"n",
"long max = 0;",
"max",
"0",
"long chk = 0;",
"chk",
"0",
"long min = 1000000000;",
"min",
"1000000000",
"for(int i=0;i<n;i++){\n\t\t a[i] = sc.nextLong();\n\t\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t a[i] = sc.nextLong();\n\t\t }",
"{\n\t\t a[i] = sc.nextLong();\n\t\t }",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"for(int i=0;i<n;i++){\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }",
"{\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }",
"max = Math.max(max,a[i])",
"max",
"Math.max(max,a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"chk += max - a[i]",
"chk",
"max - a[i]",
"max",
"a[i]",
"a",
"i",
"System.out.println(chk)",
"System.out.println",
"System.out",
"System",
"System.out",
"chk",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t int n = sc.nextInt();\n\t\t long a[] = new long[n];\n\t\t long max = 0;\n\t\t long chk = 0;\n\t\t long min = 1000000000;\n\t\t for(int i=0;i<n;i++){\n\t\t a[i] = sc.nextLong();\n\t\t }\n\t\t \n\t\t for(int i=0;i<n;i++){\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }\n\t\t System.out.println(chk);\n\t \n \n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t int n = sc.nextInt();\n\t\t long a[] = new long[n];\n\t\t long max = 0;\n\t\t long chk = 0;\n\t\t long min = 1000000000;\n\t\t for(int i=0;i<n;i++){\n\t\t a[i] = sc.nextLong();\n\t\t }\n\t\t \n\t\t for(int i=0;i<n;i++){\n\t\t max = Math.max(max,a[i]);\n\t\t chk += max - a[i];\n\t\t }\n\t\t System.out.println(chk);\n\t \n \n\t}\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long a[] = new long[n];
long max = 0;
long chk = 0;
long min = 1000000000;
for(int i=0;i<n;i++){
a[i] = sc.nextLong();
}
for(int i=0;i<n;i++){
max = Math.max(max,a[i]);
chk += max - a[i];
}
System.out.println(chk);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
101,
5
],
[
101,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
58,
60
],
[
51,
61
],
[
61,
62
],
[
62,
63
],
[
51,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
66,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
6,
98
],
[
98,
99
],
[
0,
100
],
[
100,
101
],
[
100,
102
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong steps = 0;\n\t\tlong level;\n\t\t\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlevel = a[0];\n\t\t\n\t\tfor(int i = 0; i < n -1; i++) {\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(steps);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong steps = 0;\n\t\tlong level;\n\t\t\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlevel = a[0];\n\t\t\n\t\tfor(int i = 0; i < n -1; i++) {\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(steps);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong steps = 0;\n\t\tlong level;\n\t\t\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlevel = a[0];\n\t\t\n\t\tfor(int i = 0; i < n -1; i++) {\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(steps);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong steps = 0;\n\t\tlong level;\n\t\t\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlevel = a[0];\n\t\t\n\t\tfor(int i = 0; i < n -1; i++) {\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(steps);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long steps = 0;",
"steps",
"0",
"long level;",
"level",
"for(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"{\n\t\t\ta[i] = sc.nextLong();\n\t\t}",
"a[i] = sc.nextLong()",
"a[i]",
"a",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"level = a[0]",
"level",
"a[0]",
"a",
"0",
"for(int i = 0; i < n -1; i++) {\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n -1",
"i",
"n -1",
"n",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}",
"if(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}",
"level > a[i + 1]",
"level",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"{\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t}",
"steps += (level - a[i + 1])",
"steps",
"(level - a[i + 1])",
"level",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"{\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}",
"level = a[i + 1]",
"level",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"System.out.println(steps)",
"System.out.println",
"System.out",
"System",
"System.out",
"steps",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong steps = 0;\n\t\tlong level;\n\t\t\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlevel = a[0];\n\t\t\n\t\tfor(int i = 0; i < n -1; i++) {\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(steps);\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong[] a = new long[n];\n\t\tlong steps = 0;\n\t\tlong level;\n\t\t\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextLong();\n\t\t}\n\t\t\n\t\tlevel = a[0];\n\t\t\n\t\tfor(int i = 0; i < n -1; i++) {\n\t\t\tif(level > a[i + 1]) {\n\t\t\t\tsteps += (level - a[i + 1]);\n\t\t\t} else {\n\t\t\t\tlevel = a[i + 1];\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(steps);\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
long steps = 0;
long level;
for(int i = 0; i < n; i++) {
a[i] = sc.nextLong();
}
level = a[0];
for(int i = 0; i < n -1; i++) {
if(level > a[i + 1]) {
steps += (level - a[i + 1]);
} else {
level = a[i + 1];
}
}
System.out.println(steps);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
9,
0,
13,
18,
13,
13,
0,
13,
18,
13,
2,
13,
17,
14,
2,
13,
13,
30,
9,
41,
13,
2,
13,
13,
0,
13,
13,
0,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
109,
5
],
[
109,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
62,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
62,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
62,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
62,
92
],
[
92,
93
],
[
92,
94
],
[
62,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
8,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
6,
106
],
[
106,
107
],
[
0,
108
],
[
108,
109
],
[
108,
110
]
]
| [
"import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n \t\n \tlong[] arr = new long[n];\n\n \tfor(int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\t\tlong pre = 0;\n \tlong now = 0;\n \tlong sum = 0;\n \tfor(int i = 0; i<n; i++){\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }\n System.out.println(sum);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n \t\n \tlong[] arr = new long[n];\n\n \tfor(int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\t\tlong pre = 0;\n \tlong now = 0;\n \tlong sum = 0;\n \tfor(int i = 0; i<n; i++){\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }\n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n \t\n \tlong[] arr = new long[n];\n\n \tfor(int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\t\tlong pre = 0;\n \tlong now = 0;\n \tlong sum = 0;\n \tfor(int i = 0; i<n; i++){\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }\n System.out.println(sum);\n }",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n \t\n \tlong[] arr = new long[n];\n\n \tfor(int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\t\tlong pre = 0;\n \tlong now = 0;\n \tlong sum = 0;\n \tfor(int i = 0; i<n; i++){\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }\n System.out.println(sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] arr = new long[n];",
"arr",
"new long[n]",
"n",
"for(int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = sc.nextInt();\n }",
"{\n arr[i] = sc.nextInt();\n }",
"arr[i] = sc.nextInt()",
"arr[i]",
"arr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long pre = 0;",
"pre",
"0",
"long now = 0;",
"now",
"0",
"long sum = 0;",
"sum",
"0",
"for(int i = 0; i<n; i++){\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }",
"{\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }",
"if (i == 0){\n continue;\n }",
"i == 0",
"i",
"0",
"{\n continue;\n }",
"continue;",
"now = arr[i]",
"now",
"arr[i]",
"arr",
"i",
"pre = arr[i-1]",
"pre",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"if(now > pre){\n continue;\n }",
"now > pre",
"now",
"pre",
"{\n continue;\n }",
"continue;",
"long step = pre - now;",
"step",
"pre - now",
"pre",
"now",
"sum += step",
"sum",
"step",
"arr[i] = pre",
"arr[i]",
"arr",
"i",
"pre",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n \t\n \tlong[] arr = new long[n];\n\n \tfor(int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\t\tlong pre = 0;\n \tlong now = 0;\n \tlong sum = 0;\n \tfor(int i = 0; i<n; i++){\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }\n System.out.println(sum);\n }\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n \t\n \tlong[] arr = new long[n];\n\n \tfor(int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\t\tlong pre = 0;\n \tlong now = 0;\n \tlong sum = 0;\n \tfor(int i = 0; i<n; i++){\n if (i == 0){\n continue;\n }\n now = arr[i];\n pre = arr[i-1];\n if(now > pre){\n continue;\n }\n long step = pre - now;\n sum += step;\n arr[i] = pre;\n }\n System.out.println(sum);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] arr = new long[n];
for(int i = 0; i<n; i++){
arr[i] = sc.nextInt();
}
long pre = 0;
long now = 0;
long sum = 0;
for(int i = 0; i<n; i++){
if (i == 0){
continue;
}
now = arr[i];
pre = arr[i-1];
if(now > pre){
continue;
}
long step = pre - now;
sum += step;
arr[i] = pre;
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
41,
13,
20,
28,
13,
13,
30,
30,
41,
13,
4,
18,
13,
13,
14,
2,
13,
13,
30,
0,
13,
4,
18,
13,
20,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
75,
11
],
[
75,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
14,
37
],
[
37,
38
],
[
37,
39
],
[
14,
40
],
[
40,
41
],
[
40,
42
],
[
40,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
44,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
51,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
14,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
12,
72
],
[
72,
73
],
[
0,
74
],
[
74,
75
],
[
74,
76
]
]
| [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.math.BigInteger;\n\npublic class Main{\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\t\n\t\tint max = 0;\n\t\tBigInteger sum = new BigInteger(\"0\");\n\t\tfor(String str : strs){\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main{\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\t\n\t\tint max = 0;\n\t\tBigInteger sum = new BigInteger(\"0\");\n\t\tfor(String str : strs){\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n}",
"Main",
"public static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\t\n\t\tint max = 0;\n\t\tBigInteger sum = new BigInteger(\"0\");\n\t\tfor(String str : strs){\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\t\n\t\tint max = 0;\n\t\tBigInteger sum = new BigInteger(\"0\");\n\t\tfor(String str : strs){\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int N = Integer.parseInt(br.readLine());",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] strs = br.readLine().split(\" \");",
"strs",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int max = 0;",
"max",
"0",
"BigInteger sum = new BigInteger(\"0\");",
"sum",
"new BigInteger(\"0\")",
"for(String str : strs){\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}",
"String str",
"strs",
"{\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}",
"int n = Integer.parseInt(str);",
"n",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"if(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}",
"n < max",
"n",
"max",
"{\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}",
"sum = sum.add(new BigInteger(\"\" + (max - n)))",
"sum",
"sum.add(new BigInteger(\"\" + (max - n)))",
"sum.add",
"sum",
"new BigInteger(\"\" + (max - n))",
"{\n\t\t\t\tmax = n;\n\t\t\t}",
"max = n",
"max",
"n",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\t\n\t\tint max = 0;\n\t\tBigInteger sum = new BigInteger(\"0\");\n\t\tfor(String str : strs){\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args)throws Exception{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\t\n\t\tint max = 0;\n\t\tBigInteger sum = new BigInteger(\"0\");\n\t\tfor(String str : strs){\n\t\t\tint n = Integer.parseInt(str);\n\t\t\tif(n < max){\n\t\t\t\tsum = sum.add(new BigInteger(\"\" + (max - n)));\n\t\t\t}else{\n\t\t\t\tmax = n;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(sum);\n\t}\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main{
public static void main(String[] args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
String[] strs = br.readLine().split(" ");
int max = 0;
BigInteger sum = new BigInteger("0");
for(String str : strs){
int n = Integer.parseInt(str);
if(n < max){
sum = sum.add(new BigInteger("" + (max - n)));
}else{
max = n;
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
17,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
96,
5
],
[
96,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
44,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
63,
69
],
[
69,
70
],
[
69,
71
],
[
56,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
6,
93
],
[
93,
94
],
[
0,
95
],
[
95,
96
],
[
95,
97
]
]
| [
"import java.util.*;\npublic class Main\n{\n public static void main(String[] args)\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=s.nextInt();\n }\n long ans=0;\n for(int i=1;i<n;i++)\n {\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=s.nextInt();\n }\n long ans=0;\n for(int i=1;i<n;i++)\n {\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args)\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=s.nextInt();\n }\n long ans=0;\n for(int i=1;i<n;i++)\n {\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=s.nextInt();\n }\n long ans=0;\n for(int i=1;i<n;i++)\n {\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }\n System.out.println(ans);\n }",
"Scanner s=new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int n=s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"int a[]=new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0;i<n;i++)\n {\n a[i]=s.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]=s.nextInt();\n }",
"{\n a[i]=s.nextInt();\n }",
"a[i]=s.nextInt()",
"a[i]",
"a",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"long ans=0;",
"ans",
"0",
"for(int i=1;i<n;i++)\n {\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }",
"{\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }",
"ans+=Math.max(0,a[i-1]-a[i])",
"ans",
"Math.max(0,a[i-1]-a[i])",
"Math.max",
"Math",
"0",
"a[i-1]-a[i]",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"a[i]=Math.max(a[i],a[i-1])",
"a[i]",
"a",
"i",
"Math.max(a[i],a[i-1])",
"Math.max",
"Math",
"a[i]",
"a",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=s.nextInt();\n }\n long ans=0;\n for(int i=1;i<n;i++)\n {\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }\n System.out.println(ans);\n }\n}",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner s=new Scanner(System.in);\n int n=s.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=s.nextInt();\n }\n long ans=0;\n for(int i=1;i<n;i++)\n {\n ans+=Math.max(0,a[i-1]-a[i]);\n a[i]=Math.max(a[i],a[i-1]);\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
{
a[i]=s.nextInt();
}
long ans=0;
for(int i=1;i<n;i++)
{
ans+=Math.max(0,a[i-1]-a[i]);
a[i]=Math.max(a[i],a[i-1]);
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
112,
8
],
[
112,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
11,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
47,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
59,
67
],
[
67,
68
],
[
68,
69
],
[
59,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
91,
92
],
[
91,
93
],
[
82,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
58,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
9,
109
],
[
109,
110
],
[
0,
111
],
[
111,
112
],
[
111,
113
]
]
| [
"import java.util.*; \nimport java.lang.*; \n\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n \n int N = scan.nextInt();\n long[] A = new long[N];\n \n for(int i=0; i<N;i++){\n A[i] = scan.nextLong();\n }\n \n long sum = 0;\n \n if(N==1){\n System.out.println(0);\n }else{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n } \n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n \n int N = scan.nextInt();\n long[] A = new long[N];\n \n for(int i=0; i<N;i++){\n A[i] = scan.nextLong();\n }\n \n long sum = 0;\n \n if(N==1){\n System.out.println(0);\n }else{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n } \n }\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n \n int N = scan.nextInt();\n long[] A = new long[N];\n \n for(int i=0; i<N;i++){\n A[i] = scan.nextLong();\n }\n \n long sum = 0;\n \n if(N==1){\n System.out.println(0);\n }else{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n } \n }",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n \n int N = scan.nextInt();\n long[] A = new long[N];\n \n for(int i=0; i<N;i++){\n A[i] = scan.nextLong();\n }\n \n long sum = 0;\n \n if(N==1){\n System.out.println(0);\n }else{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n } \n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"for(int i=0; i<N;i++){\n A[i] = scan.nextLong();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = scan.nextLong();\n }",
"{\n A[i] = scan.nextLong();\n }",
"A[i] = scan.nextLong()",
"A[i]",
"A",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"long sum = 0;",
"sum",
"0",
"if(N==1){\n System.out.println(0);\n }else{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n }",
"N==1",
"N",
"1",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n }",
"for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }",
"{\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }",
"if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }",
"A[i-1]>=A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"{\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }",
"sum += A[i-1] -A[i]",
"sum",
"A[i-1] -A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n \n int N = scan.nextInt();\n long[] A = new long[N];\n \n for(int i=0; i<N;i++){\n A[i] = scan.nextLong();\n }\n \n long sum = 0;\n \n if(N==1){\n System.out.println(0);\n }else{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n } \n }\n}",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n \n int N = scan.nextInt();\n long[] A = new long[N];\n \n for(int i=0; i<N;i++){\n A[i] = scan.nextLong();\n }\n \n long sum = 0;\n \n if(N==1){\n System.out.println(0);\n }else{\n for(int i=1; i<N;i++){\n if(A[i-1]>=A[i]){\n sum += A[i-1] -A[i];\n A[i] = A[i-1]; \n }\n }\n System.out.println(sum);\n } \n }\n}",
"Main"
]
| import java.util.*;
import java.lang.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
long[] A = new long[N];
for(int i=0; i<N;i++){
A[i] = scan.nextLong();
}
long sum = 0;
if(N==1){
System.out.println(0);
}else{
for(int i=1; i<N;i++){
if(A[i-1]>=A[i]){
sum += A[i-1] -A[i];
A[i] = A[i-1];
}
}
System.out.println(sum);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
14,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
68,
5
],
[
68,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
41,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
6,
65
],
[
65,
66
],
[
0,
67
],
[
67,
68
],
[
67,
69
]
]
| [
"\nimport java.util.Scanner;\n\npublic class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n final int N = sc.nextInt();\n \n int currTop = 0;\n long steps = 0;\n \n for (int i = 0; i < N; i++) {\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }\n \n System.out.println(steps);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n final int N = sc.nextInt();\n \n int currTop = 0;\n long steps = 0;\n \n for (int i = 0; i < N; i++) {\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }\n \n System.out.println(steps);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n final int N = sc.nextInt();\n \n int currTop = 0;\n long steps = 0;\n \n for (int i = 0; i < N; i++) {\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }\n \n System.out.println(steps);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n final int N = sc.nextInt();\n \n int currTop = 0;\n long steps = 0;\n \n for (int i = 0; i < N; i++) {\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }\n \n System.out.println(steps);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"final int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int currTop = 0;",
"currTop",
"0",
"long steps = 0;",
"steps",
"0",
"for (int i = 0; i < N; i++) {\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }",
"{\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }",
"int A = sc.nextInt();",
"A",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }",
"A < currTop",
"A",
"currTop",
"{\n steps += currTop - A;\n }",
"steps += currTop - A",
"steps",
"currTop - A",
"currTop",
"A",
"if (currTop < A) {\n currTop = A;\n }",
"currTop < A",
"currTop",
"A",
"{\n currTop = A;\n }",
"currTop = A",
"currTop",
"A",
"System.out.println(steps)",
"System.out.println",
"System.out",
"System",
"System.out",
"steps",
"String[] args",
"args",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n final int N = sc.nextInt();\n \n int currTop = 0;\n long steps = 0;\n \n for (int i = 0; i < N; i++) {\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }\n \n System.out.println(steps);\n }\n}",
"public class Main {\n \n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n final int N = sc.nextInt();\n \n int currTop = 0;\n long steps = 0;\n \n for (int i = 0; i < N; i++) {\n int A = sc.nextInt(); \n \n if (A < currTop) {\n steps += currTop - A;\n } else if (currTop < A) {\n currTop = A;\n }\n }\n \n System.out.println(steps);\n }\n}",
"Main"
]
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
int currTop = 0;
long steps = 0;
for (int i = 0; i < N; i++) {
int A = sc.nextInt();
if (A < currTop) {
steps += currTop - A;
} else if (currTop < A) {
currTop = A;
}
}
System.out.println(steps);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
9,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
96,
5
],
[
96,
6
],
[
6,
7
],
[
6,
8
],
[
96,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
11,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
11,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
11,
45
],
[
45,
46
],
[
45,
47
],
[
11,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
61,
67
],
[
61,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
68,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
68,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
11,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
9,
93
],
[
93,
94
],
[
0,
95
],
[
95,
96
],
[
95,
97
]
]
| [
"import java.util.*;\npublic class Main\n{\n public static Scanner sc = new Scanner(System.in);\n public static void main(String[]args)\n {\n int n = sc.nextInt();\n int[]height = new int[n];\n for(int i=0;i<n;i++)\n height[i]=sc.nextInt();\n int max = height[0];\n long total =0;\n for(int i=1;i<n;i++)\n {\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }\n System.out.println(total);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main\n{\n public static Scanner sc = new Scanner(System.in);\n public static void main(String[]args)\n {\n int n = sc.nextInt();\n int[]height = new int[n];\n for(int i=0;i<n;i++)\n height[i]=sc.nextInt();\n int max = height[0];\n long total =0;\n for(int i=1;i<n;i++)\n {\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }\n System.out.println(total);\n }\n}",
"Main",
"public static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String[]args)\n {\n int n = sc.nextInt();\n int[]height = new int[n];\n for(int i=0;i<n;i++)\n height[i]=sc.nextInt();\n int max = height[0];\n long total =0;\n for(int i=1;i<n;i++)\n {\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }\n System.out.println(total);\n }",
"main",
"{\n int n = sc.nextInt();\n int[]height = new int[n];\n for(int i=0;i<n;i++)\n height[i]=sc.nextInt();\n int max = height[0];\n long total =0;\n for(int i=1;i<n;i++)\n {\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }\n System.out.println(total);\n }",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[]height = new int[n];",
"height",
"new int[n]",
"n",
"for(int i=0;i<n;i++)\n height[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"height[i]=sc.nextInt();",
"height[i]=sc.nextInt()",
"height[i]",
"height",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int max = height[0];",
"max",
"height[0]",
"height",
"0",
"long total =0;",
"total",
"0",
"for(int i=1;i<n;i++)\n {\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }",
"{\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }",
"if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }",
"height[i]==max",
"height[i]",
"height",
"i",
"max",
"continue;",
"if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }",
"height[i]<max",
"height[i]",
"height",
"i",
"max",
"total+=max-height[i]",
"total",
"max-height[i]",
"max",
"height[i]",
"height",
"i",
"{\n max = height[i];\n }",
"max = height[i]",
"max",
"height[i]",
"height",
"i",
"System.out.println(total)",
"System.out.println",
"System.out",
"System",
"System.out",
"total",
"String[]args",
"args",
"public class Main\n{\n public static Scanner sc = new Scanner(System.in);\n public static void main(String[]args)\n {\n int n = sc.nextInt();\n int[]height = new int[n];\n for(int i=0;i<n;i++)\n height[i]=sc.nextInt();\n int max = height[0];\n long total =0;\n for(int i=1;i<n;i++)\n {\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }\n System.out.println(total);\n }\n}",
"public class Main\n{\n public static Scanner sc = new Scanner(System.in);\n public static void main(String[]args)\n {\n int n = sc.nextInt();\n int[]height = new int[n];\n for(int i=0;i<n;i++)\n height[i]=sc.nextInt();\n int max = height[0];\n long total =0;\n for(int i=1;i<n;i++)\n {\n if(height[i]==max)\n continue;\n else if(height[i]<max)\n total+=max-height[i];\n else\n {\n max = height[i];\n }\n }\n System.out.println(total);\n }\n}",
"Main"
]
| import java.util.*;
public class Main
{
public static Scanner sc = new Scanner(System.in);
public static void main(String[]args)
{
int n = sc.nextInt();
int[]height = new int[n];
for(int i=0;i<n;i++)
height[i]=sc.nextInt();
int max = height[0];
long total =0;
for(int i=1;i<n;i++)
{
if(height[i]==max)
continue;
else if(height[i]<max)
total+=max-height[i];
else
{
max = height[i];
}
}
System.out.println(total);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
2,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
14,
2,
13,
17,
30,
0,
13,
13,
4,
18,
13,
2,
13,
17,
2,
4,
18,
13,
2,
13,
17,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
107,
8
],
[
107,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
21,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
42,
43
],
[
43,
44
],
[
11,
45
],
[
45,
46
],
[
45,
47
],
[
11,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
48,
58
],
[
58,
59
],
[
59,
60
],
[
48,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
65,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
73,
74
],
[
73,
75
],
[
62,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
11,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
9,
104
],
[
104,
105
],
[
0,
106
],
[
106,
107
],
[
106,
108
]
]
| [
"import java.util.ArrayList;\nimport java.util.Scanner;\n \npublic class Main {\n \n\tpublic static void main(String[] args) {\n \n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n \n\t\tArrayList<Long> array = new ArrayList<>();\n \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray.add(sc.nextLong());\n\t\t}\n \n\t\tlong sum = 0;\n\t\tfor (int j = 0; j < n - 1; j++) {\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}\n \n\t\tSystem.out.println(sum);\n \n\t}\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n \n\tpublic static void main(String[] args) {\n \n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n \n\t\tArrayList<Long> array = new ArrayList<>();\n \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray.add(sc.nextLong());\n\t\t}\n \n\t\tlong sum = 0;\n\t\tfor (int j = 0; j < n - 1; j++) {\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}\n \n\t\tSystem.out.println(sum);\n \n\t}\n}",
"Main",
"public static void main(String[] args) {\n \n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n \n\t\tArrayList<Long> array = new ArrayList<>();\n \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray.add(sc.nextLong());\n\t\t}\n \n\t\tlong sum = 0;\n\t\tfor (int j = 0; j < n - 1; j++) {\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}\n \n\t\tSystem.out.println(sum);\n \n\t}",
"main",
"{\n \n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n \n\t\tArrayList<Long> array = new ArrayList<>();\n \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray.add(sc.nextLong());\n\t\t}\n \n\t\tlong sum = 0;\n\t\tfor (int j = 0; j < n - 1; j++) {\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}\n \n\t\tSystem.out.println(sum);\n \n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.nextLine()",
"sc.nextLine",
"sc",
"ArrayList<Long> array = new ArrayList<>();",
"array",
"new ArrayList<>()",
"for (int i = 0; i < n; i++) {\n\t\t\tarray.add(sc.nextLong());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarray.add(sc.nextLong());\n\t\t}",
"{\n\t\t\tarray.add(sc.nextLong());\n\t\t}",
"array.add(sc.nextLong())",
"array.add",
"array",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long sum = 0;",
"sum",
"0",
"for (int j = 0; j < n - 1; j++) {\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n - 1",
"j",
"n - 1",
"n",
"1",
"j++",
"j++",
"j",
"{\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}",
"{\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}",
"long diff = array.get(j) - array.get(j + 1);",
"diff",
"array.get(j) - array.get(j + 1)",
"array.get(j)",
"array.get",
"array",
"j",
"array.get(j + 1)",
"array.get",
"array",
"j + 1",
"j",
"1",
"if (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}",
"diff > 0",
"diff",
"0",
"{\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}",
"sum += diff",
"sum",
"diff",
"array.set(j + 1, array.get(j + 1) + diff)",
"array.set",
"array",
"j + 1",
"j",
"1",
"array.get(j + 1) + diff",
"array.get(j + 1)",
"array.get",
"array",
"j + 1",
"j",
"1",
"diff",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n \n\tpublic static void main(String[] args) {\n \n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n \n\t\tArrayList<Long> array = new ArrayList<>();\n \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray.add(sc.nextLong());\n\t\t}\n \n\t\tlong sum = 0;\n\t\tfor (int j = 0; j < n - 1; j++) {\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}\n \n\t\tSystem.out.println(sum);\n \n\t}\n}",
"public class Main {\n \n\tpublic static void main(String[] args) {\n \n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n \n\t\tArrayList<Long> array = new ArrayList<>();\n \n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray.add(sc.nextLong());\n\t\t}\n \n\t\tlong sum = 0;\n\t\tfor (int j = 0; j < n - 1; j++) {\n\t\t\tlong diff = array.get(j) - array.get(j + 1);\n\t\t\tif (diff > 0) {\n\t\t\t\tsum += diff;\n\t\t\t\tarray.set(j + 1, array.get(j + 1) + diff);\n\t\t\t}\n\t\t}\n \n\t\tSystem.out.println(sum);\n \n\t}\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
sc.nextLine();
ArrayList<Long> array = new ArrayList<>();
for (int i = 0; i < n; i++) {
array.add(sc.nextLong());
}
long sum = 0;
for (int j = 0; j < n - 1; j++) {
long diff = array.get(j) - array.get(j + 1);
if (diff > 0) {
sum += diff;
array.set(j + 1, array.get(j + 1) + diff);
}
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
2,
13,
17,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
88,
5
],
[
88,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
44,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
61,
67
],
[
67,
68
],
[
67,
69
],
[
58,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
8,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
6,
85
],
[
85,
86
],
[
0,
87
],
[
87,
88
],
[
87,
89
]
]
| [
"import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long ans = 0;\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long ans = 0;\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long ans = 0;\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long ans = 0;\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"long ans = 0;",
"ans",
"0",
"for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }",
"{\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }",
"i>0 && A[i]<A[i-1]",
"i>0",
"i",
"0",
"A[i]<A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }",
"ans+=A[i-1]-A[i]",
"ans",
"A[i-1]-A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long ans = 0;\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n\tpublic static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long[] A = new long[N];\n long ans = 0;\n for(int i=0;i<N;i++){\n A[i] = sc.nextLong();\n if(i>0 && A[i]<A[i-1]){\n ans+=A[i-1]-A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] A = new long[N];
long ans = 0;
for(int i=0;i<N;i++){
A[i] = sc.nextLong();
if(i>0 && A[i]<A[i-1]){
ans+=A[i-1]-A[i];
A[i] = A[i-1];
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
66,
5
],
[
66,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
35,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
8,
60
],
[
60,
61
],
[
61,
62
],
[
6,
63
],
[
63,
64
],
[
0,
65
],
[
65,
66
],
[
65,
67
]
]
| [
"import java.util.Scanner;\n\n \npublic class Main {\n \n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong max = 0;\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}\n\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n \n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong max = 0;\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong max = 0;\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"main",
"{\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong max = 0;\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long max = 0;",
"max",
"0",
"long ans = 0;",
"ans",
"0",
"for(int i = 0; i < n; i++) {\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}",
"{\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}",
"int height = sc.nextInt();",
"height",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}",
"max < height",
"max",
"height",
"{\n\t\t\t\tmax = height;\n\t\t\t}",
"max = height",
"max",
"height",
"ans += max - height",
"ans",
"max - height",
"max",
"height",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n \n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong max = 0;\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"public class Main {\n \n\tpublic static void main(String[] args) {\n\t\t\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong max = 0;\n\t\tlong ans = 0;\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint height = sc.nextInt();\n\t\t\tif(max < height) {\n\t\t\t\tmax = height;\n\t\t\t}\n\t\t\tans += max - height;\n\t\t}\n\t\t\n\t\tSystem.out.println(ans);\n\t\tsc.close();\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long max = 0;
long ans = 0;
for(int i = 0; i < n; i++) {
int height = sc.nextInt();
if(max < height) {
max = height;
}
ans += max - height;
}
System.out.println(ans);
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
2,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
74,
11
],
[
74,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
14,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
31,
42
],
[
43,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
14,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
12,
71
],
[
71,
72
],
[
0,
73
],
[
73,
74
],
[
73,
75
]
]
| [
"import java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = sc.nextLong();\n\n\t\tlong result = 0;\n\t\tlong num = sc.nextLong();\n\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Iterator;",
"Iterator",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = sc.nextLong();\n\n\t\tlong result = 0;\n\t\tlong num = sc.nextLong();\n\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = sc.nextLong();\n\n\t\tlong result = 0;\n\t\tlong num = sc.nextLong();\n\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = sc.nextLong();\n\n\t\tlong result = 0;\n\t\tlong num = sc.nextLong();\n\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long n = sc.nextLong();",
"n",
"sc.nextLong()",
"sc.nextLong",
"sc",
"long result = 0;",
"result",
"0",
"long num = sc.nextLong();",
"num",
"sc.nextLong()",
"sc.nextLong",
"sc",
"for (int i = 1; i < n; i++) {\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}",
"{\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}",
"long a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}",
"a >= num",
"a",
"num",
"{\n\t\t\t\tnum = a;\n\t\t\t}",
"num = a",
"num",
"a",
"{\n\t\t\t\tresult = result + num - a;\n\t\t\t}",
"result = result + num - a",
"result",
"result + num - a",
"result + num",
"result",
"num",
"a",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = sc.nextLong();\n\n\t\tlong result = 0;\n\t\tlong num = sc.nextLong();\n\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tlong n = sc.nextLong();\n\n\t\tlong result = 0;\n\t\tlong num = sc.nextLong();\n\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tlong a = sc.nextInt();\n\t\t\tif (a >= num) {\n\t\t\t\tnum = a;\n\t\t\t} else {\n\t\t\t\tresult = result + num - a;\n\t\t\t}\n\t\t}\n\n\t\tSystem.out.println(result);\n\n\t}\n\n}",
"Main"
]
| import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
long result = 0;
long num = sc.nextLong();
for (int i = 1; i < n; i++) {
long a = sc.nextInt();
if (a >= num) {
num = a;
} else {
result = result + num - a;
}
}
System.out.println(result);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
17,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
42,
40,
4,
18,
13,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
2,
13,
17,
4,
18,
13,
13,
17,
0,
18,
13,
17,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
2,
13,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
30,
11,
1,
41,
13,
2,
13,
13,
2,
13,
18,
13,
13,
1,
0,
13,
13,
30,
30,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
2,
13,
17,
30,
14,
2,
2,
13,
17,
17,
30,
0,
13,
2,
13,
13,
40,
13,
30,
0,
13,
2,
13,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
523,
8
],
[
523,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
11,
13
],
[
523,
14
],
[
14,
15
],
[
14,
16
],
[
523,
17
],
[
17,
18
],
[
17,
19
],
[
523,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
22,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
22,
37
],
[
37,
38
],
[
37,
39
],
[
22,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
40,
52
],
[
52,
53
],
[
53,
54
],
[
40,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
58,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
67,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
87,
89
],
[
22,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
20,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
98,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
109,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
114,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
108,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
98,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
135,
137
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
141,
145
],
[
131,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
131,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
155,
165
],
[
165,
166
],
[
166,
167
],
[
155,
168
],
[
169,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
170,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
181,
183
],
[
177,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
177,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
177,
193
],
[
194,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
195,
199
],
[
131,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
202,
204
],
[
200,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
207,
209
],
[
200,
210
],
[
210,
211
],
[
211,
212
],
[
200,
213
],
[
214,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
216,
220
],
[
215,
221
],
[
221,
222
],
[
222,
223
],
[
221,
224
],
[
131,
225
],
[
225,
226
],
[
129,
227
],
[
227,
228
],
[
98,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
231,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
235,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
241,
245
],
[
240,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
249,
250
],
[
249,
251
],
[
246,
252
],
[
252,
253
],
[
240,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
257,
258
],
[
257,
259
],
[
254,
260
],
[
260,
261
],
[
260,
262
],
[
231,
263
],
[
263,
264
],
[
229,
265
],
[
265,
266
],
[
229,
267
],
[
267,
268
],
[
98,
269
],
[
269,
270
],
[
269,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
273,
275
],
[
272,
276
],
[
276,
277
],
[
277,
278
],
[
271,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
280,
283
],
[
283,
284
],
[
283,
285
],
[
269,
286
],
[
286,
287
],
[
269,
288
],
[
288,
289
],
[
98,
290
],
[
290,
291
],
[
290,
292
],
[
292,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
293,
297
],
[
297,
298
],
[
298,
299
],
[
292,
300
],
[
300,
301
],
[
301,
302
],
[
301,
303
],
[
301,
304
],
[
304,
305
],
[
304,
306
],
[
290,
307
],
[
307,
308
],
[
290,
309
],
[
309,
310
],
[
98,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
314,
316
],
[
313,
317
],
[
317,
318
],
[
317,
319
],
[
317,
320
],
[
320,
321
],
[
321,
322
],
[
322,
323
],
[
321,
324
],
[
313,
325
],
[
325,
326
],
[
326,
327
],
[
325,
328
],
[
313,
329
],
[
329,
330
],
[
330,
331
],
[
331,
332
],
[
331,
333
],
[
329,
334
],
[
334,
335
],
[
334,
336
],
[
336,
337
],
[
336,
338
],
[
329,
339
],
[
339,
340
],
[
340,
341
],
[
329,
342
],
[
343,
343
],
[
343,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
344,
348
],
[
348,
349
],
[
349,
350
],
[
348,
351
],
[
313,
352
],
[
352,
353
],
[
311,
354
],
[
354,
355
],
[
98,
356
],
[
356,
357
],
[
356,
358
],
[
358,
359
],
[
359,
360
],
[
359,
361
],
[
358,
362
],
[
362,
363
],
[
362,
364
],
[
362,
365
],
[
365,
366
],
[
366,
367
],
[
367,
368
],
[
366,
369
],
[
358,
370
],
[
370,
371
],
[
371,
372
],
[
370,
373
],
[
358,
374
],
[
374,
375
],
[
375,
376
],
[
376,
377
],
[
376,
378
],
[
374,
379
],
[
379,
380
],
[
379,
381
],
[
381,
382
],
[
382,
383
],
[
374,
384
],
[
384,
385
],
[
385,
386
],
[
374,
387
],
[
388,
388
],
[
388,
389
],
[
389,
390
],
[
390,
391
],
[
390,
392
],
[
389,
393
],
[
393,
394
],
[
394,
395
],
[
393,
396
],
[
358,
397
],
[
397,
398
],
[
356,
399
],
[
399,
400
],
[
98,
401
],
[
401,
402
],
[
401,
403
],
[
403,
404
],
[
404,
405
],
[
404,
406
],
[
403,
407
],
[
407,
408
],
[
407,
409
],
[
407,
410
],
[
410,
411
],
[
411,
412
],
[
412,
413
],
[
411,
414
],
[
403,
415
],
[
415,
416
],
[
416,
417
],
[
415,
418
],
[
403,
419
],
[
419,
420
],
[
420,
421
],
[
421,
422
],
[
421,
423
],
[
419,
424
],
[
424,
425
],
[
424,
426
],
[
426,
427
],
[
426,
428
],
[
419,
429
],
[
429,
430
],
[
430,
431
],
[
419,
432
],
[
433,
433
],
[
433,
434
],
[
434,
435
],
[
435,
436
],
[
435,
437
],
[
434,
438
],
[
438,
439
],
[
439,
440
],
[
438,
441
],
[
403,
442
],
[
442,
443
],
[
401,
444
],
[
444,
445
],
[
98,
446
],
[
446,
447
],
[
446,
448
],
[
448,
449
],
[
449,
450
],
[
450,
451
],
[
451,
452
],
[
450,
453
],
[
453,
454
],
[
98,
455
],
[
455,
456
],
[
455,
457
],
[
457,
458
],
[
458,
459
],
[
458,
460
],
[
457,
462
],
[
462,
463
],
[
463,
464
],
[
464,
465
],
[
464,
466
],
[
462,
467
],
[
467,
468
],
[
467,
469
],
[
462,
470
],
[
470,
471
],
[
471,
472
],
[
462,
473
],
[
473,
474
],
[
474,
475
],
[
475,
476
],
[
475,
477
],
[
474,
478
],
[
478,
479
],
[
457,
480
],
[
480,
481
],
[
455,
482
],
[
482,
483
],
[
98,
484
],
[
484,
485
],
[
484,
486
],
[
486,
487
],
[
487,
488
],
[
488,
489
],
[
489,
490
],
[
488,
491
],
[
491,
492
],
[
98,
493
],
[
493,
494
],
[
493,
495
],
[
495,
496
],
[
496,
497
],
[
496,
498
],
[
495,
500
],
[
500,
501
],
[
501,
502
],
[
502,
503
],
[
502,
504
],
[
500,
505
],
[
505,
506
],
[
505,
507
],
[
500,
508
],
[
508,
509
],
[
509,
510
],
[
500,
511
],
[
511,
512
],
[
512,
513
],
[
513,
514
],
[
513,
515
],
[
512,
516
],
[
516,
517
],
[
495,
518
],
[
518,
519
],
[
493,
520
],
[
520,
521
],
[
0,
522
],
[
522,
523
],
[
522,
524
]
]
| [
"import java.util.*;\nimport java.io.*;\npublic class Main\n{\n\tstatic final int mod=(int)1e9+7;\n\tstatic final int inf=(int)1e9;\n\tstatic final long INF=(long)1e18;\n\tpublic static void main(String[] args)\n\t{\n\t\tFastScanner fs=new FastScanner();\n\t\tint n=fs.nextInt();\n\t\tlong arr[]=fs.longreadArray(n);\n\t\tlong s=0;\n\t\tfor(int i=0;i<arr.length-1;i++)\n\t\t{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(s);\n\t}\n}\nclass FastScanner \n{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\t\tpublic String next() \n\t\t{\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t\t\n\t\t}\n\t\tArrayList<Integer> sieve(int n)\n\t\t{\n\t\t\tArrayList<Integer> primes = new ArrayList<Integer>();\n\t\t\tboolean arr[]=new boolean[n+1];\n\t\t\tArrays.fill(arr,true);\n\t\t\tarr[0]=arr[1]=false;\n\t\t\tfor(int i=2;i*i<=n;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)primes.add(i);\n\t\t\t}\n\t\t\treturn primes;\n\t\t}\n\t\tlong pow(long x,long n)\n\t\t{\n\t\t\tlong res=1;\n\t\t\twhile(n>0)\n\t\t\t{\n\t\t\t \tif(n%2!=0)\n\t\t\t \t{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}\n\t\t\t \telse\n\t\t\t \t{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\t\tint gcd(int a,int b)\n\t\t{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn gcd(b,a%b);\n\t\t}\n\t\tlong longgcd(long a,long b)\n\t\t{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn longgcd(b,a%b);\n\t\t}\n\t\tint[] sort(int arr[])\n\t\t{\n\t\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\tfor(int i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\t\tchar[] charsort(char arr[])\n\t {\n\t \tArrayList<Character> list = new ArrayList<>();\n\t \tfor(char c:arr)list.add(c);\n\t \tCollections.sort(list);\n\t \tfor(int i=0;i<list.size();i++)\n\t \t{\n\t \t\tarr[i]=list.get(i);\n\t \t}\n\t \treturn arr;\n\t }\n\t\tlong[] longsort(long arr[])\n\t\t{\n\t\t\tArrayList<Long> list = new ArrayList<Long>();\n\t\t\tfor(long i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\t\tpublic int nextInt() \n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tpublic int[] readArray(int n)\n\t\t{\n\t\t\tint[] arr=new int[n];\n\t\t\tfor (int i=0; i<n; i++) arr[i]=nextInt();\n\t\t\treturn arr;\n\t\t}\t\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\tpublic long[] longreadArray(int n) \n\t\t{\n\t\t\tlong[] a=new long[n];\n\t\t\tfor (int i=0; i<n; i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main\n{\n\tstatic final int mod=(int)1e9+7;\n\tstatic final int inf=(int)1e9;\n\tstatic final long INF=(long)1e18;\n\tpublic static void main(String[] args)\n\t{\n\t\tFastScanner fs=new FastScanner();\n\t\tint n=fs.nextInt();\n\t\tlong arr[]=fs.longreadArray(n);\n\t\tlong s=0;\n\t\tfor(int i=0;i<arr.length-1;i++)\n\t\t{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(s);\n\t}\n}",
"Main",
"static final int mod=(int)1e9+7;",
"mod",
"(int)1e9+7",
"(int)1e9",
"7",
"static final int inf=(int)1e9;",
"inf",
"(int)1e9",
"static final long INF=(long)1e18;",
"INF",
"(long)1e18",
"public static void main(String[] args)\n\t{\n\t\tFastScanner fs=new FastScanner();\n\t\tint n=fs.nextInt();\n\t\tlong arr[]=fs.longreadArray(n);\n\t\tlong s=0;\n\t\tfor(int i=0;i<arr.length-1;i++)\n\t\t{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(s);\n\t}",
"main",
"{\n\t\tFastScanner fs=new FastScanner();\n\t\tint n=fs.nextInt();\n\t\tlong arr[]=fs.longreadArray(n);\n\t\tlong s=0;\n\t\tfor(int i=0;i<arr.length-1;i++)\n\t\t{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(s);\n\t}",
"FastScanner fs=new FastScanner();",
"fs",
"new FastScanner()",
"int n=fs.nextInt();",
"n",
"fs.nextInt()",
"fs.nextInt",
"fs",
"long arr[]=fs.longreadArray(n);",
"arr",
"fs.longreadArray(n)",
"fs.longreadArray",
"fs",
"n",
"long s=0;",
"s",
"0",
"for(int i=0;i<arr.length-1;i++)\n\t\t{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr.length-1",
"i",
"arr.length-1",
"arr.length",
"arr",
"arr.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}",
"if(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}",
"arr[i+1]<arr[i]",
"arr[i+1]",
"arr",
"i+1",
"i",
"1",
"arr[i]",
"arr",
"i",
"{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}",
"s=s+(arr[i]-arr[i+1])",
"s",
"s+(arr[i]-arr[i+1])",
"s",
"(arr[i]-arr[i+1])",
"arr[i]",
"arr",
"i",
"arr[i+1]",
"arr",
"i+1",
"i",
"1",
"arr[i+1]=arr[i]",
"arr[i+1]",
"arr",
"i+1",
"i",
"1",
"arr[i]",
"arr",
"i",
"System.out.println(s)",
"System.out.println",
"System.out",
"System",
"System.out",
"s",
"String[] args",
"args",
"class FastScanner \n{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\t\tpublic String next() \n\t\t{\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t\t\n\t\t}\n\t\tArrayList<Integer> sieve(int n)\n\t\t{\n\t\t\tArrayList<Integer> primes = new ArrayList<Integer>();\n\t\t\tboolean arr[]=new boolean[n+1];\n\t\t\tArrays.fill(arr,true);\n\t\t\tarr[0]=arr[1]=false;\n\t\t\tfor(int i=2;i*i<=n;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)primes.add(i);\n\t\t\t}\n\t\t\treturn primes;\n\t\t}\n\t\tlong pow(long x,long n)\n\t\t{\n\t\t\tlong res=1;\n\t\t\twhile(n>0)\n\t\t\t{\n\t\t\t \tif(n%2!=0)\n\t\t\t \t{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}\n\t\t\t \telse\n\t\t\t \t{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\t\tint gcd(int a,int b)\n\t\t{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn gcd(b,a%b);\n\t\t}\n\t\tlong longgcd(long a,long b)\n\t\t{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn longgcd(b,a%b);\n\t\t}\n\t\tint[] sort(int arr[])\n\t\t{\n\t\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\tfor(int i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\t\tchar[] charsort(char arr[])\n\t {\n\t \tArrayList<Character> list = new ArrayList<>();\n\t \tfor(char c:arr)list.add(c);\n\t \tCollections.sort(list);\n\t \tfor(int i=0;i<list.size();i++)\n\t \t{\n\t \t\tarr[i]=list.get(i);\n\t \t}\n\t \treturn arr;\n\t }\n\t\tlong[] longsort(long arr[])\n\t\t{\n\t\t\tArrayList<Long> list = new ArrayList<Long>();\n\t\t\tfor(long i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}\n\t\tpublic int nextInt() \n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\tpublic int[] readArray(int n)\n\t\t{\n\t\t\tint[] arr=new int[n];\n\t\t\tfor (int i=0; i<n; i++) arr[i]=nextInt();\n\t\t\treturn arr;\n\t\t}\t\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t\tpublic long[] longreadArray(int n) \n\t\t{\n\t\t\tlong[] a=new long[n];\n\t\t\tfor (int i=0; i<n; i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}\n}",
"FastScanner",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringTokenizer st = new StringTokenizer(\"\");",
"st",
"new StringTokenizer(\"\")",
"public String next() \n\t\t{\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t\t\n\t\t}",
"next",
"{\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t\t\n\t\t}",
"while (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"try {\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\t\tst=new StringTokenizer(br.readLine());\n\t\t\t\t}",
"st=new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"ArrayList<Integer> sieve(int n)\n\t\t{\n\t\t\tArrayList<Integer> primes = new ArrayList<Integer>();\n\t\t\tboolean arr[]=new boolean[n+1];\n\t\t\tArrays.fill(arr,true);\n\t\t\tarr[0]=arr[1]=false;\n\t\t\tfor(int i=2;i*i<=n;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)primes.add(i);\n\t\t\t}\n\t\t\treturn primes;\n\t\t}",
"sieve",
"{\n\t\t\tArrayList<Integer> primes = new ArrayList<Integer>();\n\t\t\tboolean arr[]=new boolean[n+1];\n\t\t\tArrays.fill(arr,true);\n\t\t\tarr[0]=arr[1]=false;\n\t\t\tfor(int i=2;i*i<=n;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)primes.add(i);\n\t\t\t}\n\t\t\treturn primes;\n\t\t}",
"ArrayList<Integer> primes = new ArrayList<Integer>();",
"primes",
"new ArrayList<Integer>()",
"boolean arr[]=new boolean[n+1];",
"arr",
"new boolean[n+1]",
"n+1",
"n",
"1",
"Arrays.fill(arr,true)",
"Arrays.fill",
"Arrays",
"arr",
"true",
"arr[0]=arr[1]=false",
"arr[0]",
"arr",
"0",
"arr[1]=false",
"arr[1]",
"arr",
"1",
"false",
"for(int i=2;i*i<=n;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"int i=2;",
"int i=2;",
"i",
"2",
"i*i<=n",
"i*i",
"i",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"if(arr[i]==true)\n\t\t\t\t{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}",
"arr[i]==true",
"arr[i]",
"arr",
"i",
"true",
"{\n\t\t\t\t\tfor(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}\n\t\t\t\t}",
"for(int j=i*i;j<arr.length;j+=i)\n\t\t\t\t\t{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}",
"int j=i*i;",
"int j=i*i;",
"j",
"i*i",
"i",
"i",
"j<arr.length",
"j",
"arr.length",
"arr",
"arr.length",
"j+=i",
"j+=i",
"j",
"i",
"{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}",
"{\n\t\t\t\t\t\tarr[j]=false;\n\t\t\t\t\t}",
"arr[j]=false",
"arr[j]",
"arr",
"j",
"false",
"for(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tif(arr[i]==true)primes.add(i);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(arr[i]==true)primes.add(i);\n\t\t\t}",
"{\n\t\t\t\tif(arr[i]==true)primes.add(i);\n\t\t\t}",
"if(arr[i]==true)primes.add(i);",
"arr[i]==true",
"arr[i]",
"arr",
"i",
"true",
"primes.add(i)",
"primes.add",
"primes",
"i",
"return primes;",
"primes",
"int n",
"n",
"long pow(long x,long n)\n\t\t{\n\t\t\tlong res=1;\n\t\t\twhile(n>0)\n\t\t\t{\n\t\t\t \tif(n%2!=0)\n\t\t\t \t{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}\n\t\t\t \telse\n\t\t\t \t{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}",
"pow",
"{\n\t\t\tlong res=1;\n\t\t\twhile(n>0)\n\t\t\t{\n\t\t\t \tif(n%2!=0)\n\t\t\t \t{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}\n\t\t\t \telse\n\t\t\t \t{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}\n\t\t\t}\n\t\t\treturn res;\n\t\t}",
"long res=1;",
"res",
"1",
"while(n>0)\n\t\t\t{\n\t\t\t \tif(n%2!=0)\n\t\t\t \t{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}\n\t\t\t \telse\n\t\t\t \t{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}\n\t\t\t}",
"n>0",
"n",
"0",
"{\n\t\t\t \tif(n%2!=0)\n\t\t\t \t{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}\n\t\t\t \telse\n\t\t\t \t{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}\n\t\t\t}",
"if(n%2!=0)\n\t\t\t \t{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}\n\t\t\t \telse\n\t\t\t \t{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}",
"n%2!=0",
"n%2",
"n",
"2",
"0",
"{\n\t\t\t \t\tres=(res*x);n--;\n\t\t\t \t}",
"res=(res*x)",
"res",
"(res*x)",
"res",
"x",
"n--",
"n",
"{\n\t\t\t \t\tx=(x*x);n/=2;\n\t\t\t \t}",
"x=(x*x)",
"x",
"(x*x)",
"x",
"x",
"n/=2",
"n",
"2",
"return res;",
"res",
"long x",
"x",
"long n",
"n",
"int gcd(int a,int b)\n\t\t{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn gcd(b,a%b);\n\t\t}",
"gcd",
"{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn gcd(b,a%b);\n\t\t}",
"if(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}",
"b==0",
"b",
"0",
"{\n\t\t\t\treturn a;\n\t\t\t}",
"return a;",
"a",
"return gcd(b,a%b);",
"gcd(b,a%b)",
"gcd",
"b",
"a%b",
"a",
"b",
"int a",
"a",
"int b",
"b",
"long longgcd(long a,long b)\n\t\t{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn longgcd(b,a%b);\n\t\t}",
"longgcd",
"{\n\t\t\tif(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}\n\t\t\treturn longgcd(b,a%b);\n\t\t}",
"if(b==0)\n\t\t\t{\n\t\t\t\treturn a;\n\t\t\t}",
"b==0",
"b",
"0",
"{\n\t\t\t\treturn a;\n\t\t\t}",
"return a;",
"a",
"return longgcd(b,a%b);",
"longgcd(b,a%b)",
"longgcd",
"b",
"a%b",
"a",
"b",
"long a",
"a",
"long b",
"b",
"int[] sort(int arr[])\n\t\t{\n\t\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\tfor(int i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}",
"sort",
"{\n\t\t\tArrayList<Integer> list = new ArrayList<Integer>();\n\t\t\tfor(int i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}",
"ArrayList<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"for(int i:arr)list.add(i);",
"int i",
"arr",
"list.add(i);",
"list.add(i)",
"list.add",
"list",
"i",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"for(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}",
"{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}",
"arr[i]=list.get(i)",
"arr[i]",
"arr",
"i",
"list.get(i)",
"list.get",
"list",
"i",
"return arr;",
"arr",
"int arr[]",
"arr",
"char[] charsort(char arr[])\n\t {\n\t \tArrayList<Character> list = new ArrayList<>();\n\t \tfor(char c:arr)list.add(c);\n\t \tCollections.sort(list);\n\t \tfor(int i=0;i<list.size();i++)\n\t \t{\n\t \t\tarr[i]=list.get(i);\n\t \t}\n\t \treturn arr;\n\t }",
"charsort",
"{\n\t \tArrayList<Character> list = new ArrayList<>();\n\t \tfor(char c:arr)list.add(c);\n\t \tCollections.sort(list);\n\t \tfor(int i=0;i<list.size();i++)\n\t \t{\n\t \t\tarr[i]=list.get(i);\n\t \t}\n\t \treturn arr;\n\t }",
"ArrayList<Character> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"for(char c:arr)list.add(c);",
"char c",
"arr",
"list.add(c);",
"list.add(c)",
"list.add",
"list",
"c",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"for(int i=0;i<list.size();i++)\n\t \t{\n\t \t\tarr[i]=list.get(i);\n\t \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<list.size()",
"i",
"list.size()",
"list.size",
"list",
"i++",
"i++",
"i",
"{\n\t \t\tarr[i]=list.get(i);\n\t \t}",
"{\n\t \t\tarr[i]=list.get(i);\n\t \t}",
"arr[i]=list.get(i)",
"arr[i]",
"arr",
"i",
"list.get(i)",
"list.get",
"list",
"i",
"return arr;",
"arr",
"char arr[]",
"arr",
"long[] longsort(long arr[])\n\t\t{\n\t\t\tArrayList<Long> list = new ArrayList<Long>();\n\t\t\tfor(long i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}",
"longsort",
"{\n\t\t\tArrayList<Long> list = new ArrayList<Long>();\n\t\t\tfor(long i:arr)list.add(i);\n\t\t\tCollections.sort(list);\n\t\t\tfor(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}\n\t\t\treturn arr;\n\t\t}",
"ArrayList<Long> list = new ArrayList<Long>();",
"list",
"new ArrayList<Long>()",
"for(long i:arr)list.add(i);",
"long i",
"arr",
"list.add(i);",
"list.add(i)",
"list.add",
"list",
"i",
"Collections.sort(list)",
"Collections.sort",
"Collections",
"list",
"for(int i=0;i<arr.length;i++)\n\t\t\t{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}",
"{\n\t\t\t\tarr[i]=list.get(i);\n\t\t\t}",
"arr[i]=list.get(i)",
"arr[i]",
"arr",
"i",
"list.get(i)",
"list.get",
"list",
"i",
"return arr;",
"arr",
"long arr[]",
"arr",
"public int nextInt() \n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"nextInt",
"{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public int[] readArray(int n)\n\t\t{\n\t\t\tint[] arr=new int[n];\n\t\t\tfor (int i=0; i<n; i++) arr[i]=nextInt();\n\t\t\treturn arr;\n\t\t}",
"readArray",
"{\n\t\t\tint[] arr=new int[n];\n\t\t\tfor (int i=0; i<n; i++) arr[i]=nextInt();\n\t\t\treturn arr;\n\t\t}",
"int[] arr=new int[n];",
"arr",
"new int[n]",
"n",
"for (int i=0; i<n; i++) arr[i]=nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"arr[i]=nextInt();",
"arr[i]=nextInt()",
"arr[i]",
"arr",
"i",
"nextInt()",
"nextInt",
"return arr;",
"arr",
"int n",
"n",
"public long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"nextLong",
"{\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public long[] longreadArray(int n) \n\t\t{\n\t\t\tlong[] a=new long[n];\n\t\t\tfor (int i=0; i<n; i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}",
"longreadArray",
"{\n\t\t\tlong[] a=new long[n];\n\t\t\tfor (int i=0; i<n; i++) a[i]=nextLong();\n\t\t\treturn a;\n\t\t}",
"long[] a=new long[n];",
"a",
"new long[n]",
"n",
"for (int i=0; i<n; i++) a[i]=nextLong();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=nextLong();",
"a[i]=nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"public class Main\n{\n\tstatic final int mod=(int)1e9+7;\n\tstatic final int inf=(int)1e9;\n\tstatic final long INF=(long)1e18;\n\tpublic static void main(String[] args)\n\t{\n\t\tFastScanner fs=new FastScanner();\n\t\tint n=fs.nextInt();\n\t\tlong arr[]=fs.longreadArray(n);\n\t\tlong s=0;\n\t\tfor(int i=0;i<arr.length-1;i++)\n\t\t{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(s);\n\t}\n}",
"public class Main\n{\n\tstatic final int mod=(int)1e9+7;\n\tstatic final int inf=(int)1e9;\n\tstatic final long INF=(long)1e18;\n\tpublic static void main(String[] args)\n\t{\n\t\tFastScanner fs=new FastScanner();\n\t\tint n=fs.nextInt();\n\t\tlong arr[]=fs.longreadArray(n);\n\t\tlong s=0;\n\t\tfor(int i=0;i<arr.length-1;i++)\n\t\t{\n\t\t\tif(arr[i+1]<arr[i])\n\t\t\t{\n\t\t\t\ts=s+(arr[i]-arr[i+1]);\n\t\t\t\tarr[i+1]=arr[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(s);\n\t}\n}",
"Main"
]
| import java.util.*;
import java.io.*;
public class Main
{
static final int mod=(int)1e9+7;
static final int inf=(int)1e9;
static final long INF=(long)1e18;
public static void main(String[] args)
{
FastScanner fs=new FastScanner();
int n=fs.nextInt();
long arr[]=fs.longreadArray(n);
long s=0;
for(int i=0;i<arr.length-1;i++)
{
if(arr[i+1]<arr[i])
{
s=s+(arr[i]-arr[i+1]);
arr[i+1]=arr[i];
}
}
System.out.println(s);
}
}
class FastScanner
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public String next()
{
while (!st.hasMoreTokens())
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
ArrayList<Integer> sieve(int n)
{
ArrayList<Integer> primes = new ArrayList<Integer>();
boolean arr[]=new boolean[n+1];
Arrays.fill(arr,true);
arr[0]=arr[1]=false;
for(int i=2;i*i<=n;i++)
{
if(arr[i]==true)
{
for(int j=i*i;j<arr.length;j+=i)
{
arr[j]=false;
}
}
}
for(int i=0;i<arr.length;i++)
{
if(arr[i]==true)primes.add(i);
}
return primes;
}
long pow(long x,long n)
{
long res=1;
while(n>0)
{
if(n%2!=0)
{
res=(res*x);n--;
}
else
{
x=(x*x);n/=2;
}
}
return res;
}
int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
long longgcd(long a,long b)
{
if(b==0)
{
return a;
}
return longgcd(b,a%b);
}
int[] sort(int arr[])
{
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i:arr)list.add(i);
Collections.sort(list);
for(int i=0;i<arr.length;i++)
{
arr[i]=list.get(i);
}
return arr;
}
char[] charsort(char arr[])
{
ArrayList<Character> list = new ArrayList<>();
for(char c:arr)list.add(c);
Collections.sort(list);
for(int i=0;i<list.size();i++)
{
arr[i]=list.get(i);
}
return arr;
}
long[] longsort(long arr[])
{
ArrayList<Long> list = new ArrayList<Long>();
for(long i:arr)list.add(i);
Collections.sort(list);
for(int i=0;i<arr.length;i++)
{
arr[i]=list.get(i);
}
return arr;
}
public int nextInt()
{
return Integer.parseInt(next());
}
public int[] readArray(int n)
{
int[] arr=new int[n];
for (int i=0; i<n; i++) arr[i]=nextInt();
return arr;
}
public long nextLong()
{
return Long.parseLong(next());
}
public long[] longreadArray(int n)
{
long[] a=new long[n];
for (int i=0; i<n; i++) a[i]=nextLong();
return a;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
13,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
90,
5
],
[
90,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
67,
69
],
[
64,
70
],
[
61,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
8,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
8,
84
],
[
84,
85
],
[
85,
86
],
[
6,
87
],
[
87,
88
],
[
0,
89
],
[
89,
90
],
[
89,
91
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\t\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlong stool = 0;\n\t\tint max = a[0];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}\n\t\t\n\t\tSystem.out.println(stool);\n\t\t\n\t\tin.close();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\t\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlong stool = 0;\n\t\tint max = a[0];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}\n\t\t\n\t\tSystem.out.println(stool);\n\t\t\n\t\tin.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\t\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlong stool = 0;\n\t\tint max = a[0];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}\n\t\t\n\t\tSystem.out.println(stool);\n\t\t\n\t\tin.close();\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\t\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlong stool = 0;\n\t\tint max = a[0];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}\n\t\t\n\t\tSystem.out.println(stool);\n\t\t\n\t\tin.close();\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"a[i] = in.nextInt()",
"a[i]",
"a",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"long stool = 0;",
"stool",
"0",
"int max = a[0];",
"max",
"a[0]",
"a",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}",
"{\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}",
"max = Math.max(a[i], max)",
"max",
"Math.max(a[i], max)",
"Math.max",
"Math",
"a[i]",
"a",
"i",
"max",
"stool += max - a[i]",
"stool",
"max - a[i]",
"max",
"a[i]",
"a",
"i",
"System.out.println(stool)",
"System.out.println",
"System.out",
"System",
"System.out",
"stool",
"in.close()",
"in.close",
"in",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\t\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlong stool = 0;\n\t\tint max = a[0];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}\n\t\t\n\t\tSystem.out.println(stool);\n\t\t\n\t\tin.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\t\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tlong stool = 0;\n\t\tint max = a[0];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tmax = Math.max(a[i], max);\n\t\t\tstool += max - a[i];\n\t\t}\n\t\t\n\t\tSystem.out.println(stool);\n\t\t\n\t\tin.close();\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = in.nextInt();
}
long stool = 0;
int max = a[0];
for (int i = 0; i < n; i++) {
max = Math.max(a[i], max);
stool += max - a[i];
}
System.out.println(stool);
in.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
13,
18,
13,
13,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
92,
8
],
[
92,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
11,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
11,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
63,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
11,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
11,
86
],
[
86,
87
],
[
87,
88
],
[
9,
89
],
[
89,
90
],
[
0,
91
],
[
91,
92
],
[
91,
93
]
]
| [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n long ans = 0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < n; i++) {\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n long ans = 0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < n; i++) {\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n long ans = 0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < n; i++) {\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }\n System.out.println(ans);\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n long ans = 0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < n; i++) {\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }\n System.out.println(ans);\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = sc.nextInt();",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans = 0;",
"ans",
"0",
"int max = Integer.MIN_VALUE;",
"max",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"for (int i = 0; i < n; i++) {\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }",
"{\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }",
"max = Math.max(max, a[i])",
"max",
"Math.max(max, a[i])",
"Math.max",
"Math",
"max",
"a[i]",
"a",
"i",
"ans += max - a[i]",
"ans",
"max - a[i]",
"max",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n long ans = 0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < n; i++) {\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n long ans = 0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < n; i++) {\n max = Math.max(max, a[i]);\n ans += max - a[i];\n }\n System.out.println(ans);\n sc.close();\n }\n}",
"Main"
]
| import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = sc.nextInt();
long ans = 0;
int max = Integer.MIN_VALUE;
for (int i = 0; i < n; i++) {
max = Math.max(max, a[i]);
ans += max - a[i];
}
System.out.println(ans);
sc.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
12,
13,
30,
4,
18,
13,
12,
13,
30,
4,
18,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
13,
4,
13,
17,
12,
13,
30,
29,
4,
13,
4,
13,
17,
12,
13,
30,
41,
13,
4,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
29,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
29,
13,
12,
13,
30,
41,
13,
4,
18,
13,
13,
14,
2,
13,
13,
30,
29,
4,
18,
13,
13,
13,
14,
2,
13,
13,
30,
29,
4,
18,
13,
13,
13,
30,
37,
20,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
13,
29,
20,
23,
13,
23,
13,
12,
13,
30,
4,
18,
13,
17,
17,
4,
18,
13,
17,
17,
4,
18,
13,
17,
17,
4,
13,
4,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
4,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
30,
0,
13,
2,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
4,
13,
13,
6,
13,
41,
13,
20,
41,
13,
17,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
38,
5,
13,
30,
30,
42,
2,
0,
13,
4,
18,
13,
17,
30,
4,
18,
13,
13,
0,
13,
4,
18,
13,
12,
13,
30,
29,
2,
13,
13,
12,
13,
30,
14,
4,
13,
30,
29,
4,
18,
13,
40,
13,
30,
37,
20,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
394,
11
],
[
394,
12
],
[
12,
13
],
[
12,
14
],
[
394,
15
],
[
15,
16
],
[
15,
17
],
[
394,
18
],
[
18,
19
],
[
18,
20
],
[
394,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
394,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
27,
34
],
[
34,
35
],
[
394,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
38,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
36,
51
],
[
51,
52
],
[
394,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
394,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
394,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
394,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
83,
84
],
[
394,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
394,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
98,
102
],
[
394,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
107,
111
],
[
394,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
114,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
114,
147
],
[
147,
148
],
[
394,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
151,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
159,
169
],
[
169,
170
],
[
170,
171
],
[
159,
172
],
[
173,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
174,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
180,
181
],
[
181,
182
],
[
180,
183
],
[
151,
184
],
[
184,
185
],
[
394,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
191,
194
],
[
188,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
195,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
201,
204
],
[
201,
205
],
[
195,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
206,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
212,
216
],
[
206,
217
],
[
217,
218
],
[
218,
219
],
[
186,
220
],
[
220,
221
],
[
186,
222
],
[
222,
223
],
[
394,
224
],
[
224,
225
],
[
224,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
230,
231
],
[
229,
232
],
[
226,
233
],
[
233,
234
],
[
224,
235
],
[
235,
236
],
[
224,
237
],
[
237,
238
],
[
394,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
242,
245
],
[
242,
246
],
[
241,
247
],
[
247,
248
],
[
248,
249
],
[
247,
250
],
[
247,
251
],
[
241,
252
],
[
252,
253
],
[
253,
254
],
[
252,
255
],
[
252,
256
],
[
241,
257
],
[
257,
258
],
[
241,
259
],
[
259,
260
],
[
239,
261
],
[
261,
262
],
[
394,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
265,
270
],
[
270,
271
],
[
270,
272
],
[
272,
273
],
[
265,
274
],
[
274,
275
],
[
274,
276
],
[
265,
277
],
[
277,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
277,
282
],
[
282,
283
],
[
282,
284
],
[
277,
285
],
[
285,
286
],
[
286,
287
],
[
277,
288
],
[
289,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
292,
295
],
[
295,
296
],
[
295,
297
],
[
291,
298
],
[
298,
299
],
[
299,
300
],
[
298,
301
],
[
290,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
305,
306
],
[
306,
307
],
[
307,
308
],
[
306,
309
],
[
309,
310
],
[
309,
311
],
[
305,
312
],
[
312,
313
],
[
313,
314
],
[
312,
315
],
[
302,
316
],
[
316,
317
],
[
317,
318
],
[
316,
319
],
[
316,
320
],
[
320,
321
],
[
321,
322
],
[
320,
323
],
[
323,
324
],
[
323,
325
],
[
265,
326
],
[
326,
327
],
[
326,
328
],
[
394,
329
],
[
329,
330
],
[
329,
331
],
[
331,
332
],
[
331,
333
],
[
329,
334
],
[
334,
335
],
[
334,
336
],
[
329,
337
],
[
337,
338
],
[
329,
339
],
[
339,
340
],
[
329,
341
],
[
341,
342
],
[
341,
343
],
[
343,
344
],
[
344,
345
],
[
344,
346
],
[
343,
347
],
[
347,
348
],
[
348,
349
],
[
348,
350
],
[
347,
351
],
[
351,
352
],
[
352,
353
],
[
353,
354
],
[
354,
355
],
[
354,
356
],
[
356,
357
],
[
357,
358
],
[
353,
359
],
[
352,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
361,
364
],
[
343,
365
],
[
365,
366
],
[
365,
367
],
[
367,
368
],
[
368,
369
],
[
329,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
373,
374
],
[
374,
375
],
[
374,
376
],
[
329,
377
],
[
377,
378
],
[
377,
379
],
[
379,
380
],
[
380,
381
],
[
381,
382
],
[
380,
383
],
[
383,
384
],
[
384,
385
],
[
385,
386
],
[
386,
387
],
[
385,
388
],
[
388,
389
],
[
380,
390
],
[
390,
391
],
[
391,
392
],
[
0,
393
],
[
393,
394
],
[
393,
395
]
]
| [
"import java.util.*; import java.io.*; import java.math.*;\npublic class Main{\n\t//Don't have to see. start------------------------------------------\n\tstatic class InputIterator{\n\t\tArrayList<String> inputLine = new ArrayList<String>(1024);\n\t\tint index = 0; int max; String read;\n\t\tInputIterator(){\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttry{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}\n\t\t\tmax = inputLine.size();\n\t\t}\n\t\tboolean hasNext(){return (index < max);}\n\t\tString next(){\n\t\t\tif(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}\n\t\t}\n\t}\n\tstatic HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();\n\tstatic InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic void flush(){out.flush();}\n\tstatic void myout(Object t){out.println(t);}\n\tstatic void myerr(Object t){System.err.print(\"debug:\");System.err.println(t);}\n\tstatic String next(){return ii.next();}\n\tstatic boolean hasNext(){return ii.hasNext();}\n\tstatic int nextInt(){return Integer.parseInt(next());}\n\tstatic long nextLong(){return Long.parseLong(next());}\n\tstatic double nextDouble(){return Double.parseDouble(next());}\n\tstatic ArrayList<String> nextStrArray(){return myconv(next(), 8);}\n\tstatic ArrayList<String> nextCharArray(){return myconv(next(), 0);}\n\tstatic ArrayList<Integer> nextIntArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic ArrayList<Long> nextLongArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic String myconv(Object list, int no){//only join\n\t\tString joinString = CONVSTR.get(no);\n\t\tif(list instanceof String[]){\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}else if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}\n\t}\n\tstatic ArrayList<String> myconv(String str, int no){//only split\n\t\tString splitString = CONVSTR.get(no);\n\t\treturn new ArrayList<String>(Arrays.asList(str.split(splitString)));\n\t}\n\tpublic static void main(String[] args){\n\t\tCONVSTR.put(8, \" \"); CONVSTR.put(9, \"\\n\"); CONVSTR.put(0, \"\");\n\t\tsolve();flush();\n\t}\n\t//Don't have to see. end------------------------------------------\n\tstatic void solve(){//Here is the main function\n\t\tint N = nextInt();\n\t\tArrayList<Long> list = nextLongArray();\n\t\tlong output = 0;\n\t\tfor(int i = 1; i < N; i++){\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}\n\t\tmyout(output);\n\t}\n\t//Method addition frame start\n\n\n\n\t//Method addition frame end\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main{\n\t//Don't have to see. start------------------------------------------\n\tstatic class InputIterator{\n\t\tArrayList<String> inputLine = new ArrayList<String>(1024);\n\t\tint index = 0; int max; String read;\n\t\tInputIterator(){\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttry{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}\n\t\t\tmax = inputLine.size();\n\t\t}\n\t\tboolean hasNext(){return (index < max);}\n\t\tString next(){\n\t\t\tif(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}\n\t\t}\n\t}\n\tstatic HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();\n\tstatic InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic void flush(){out.flush();}\n\tstatic void myout(Object t){out.println(t);}\n\tstatic void myerr(Object t){System.err.print(\"debug:\");System.err.println(t);}\n\tstatic String next(){return ii.next();}\n\tstatic boolean hasNext(){return ii.hasNext();}\n\tstatic int nextInt(){return Integer.parseInt(next());}\n\tstatic long nextLong(){return Long.parseLong(next());}\n\tstatic double nextDouble(){return Double.parseDouble(next());}\n\tstatic ArrayList<String> nextStrArray(){return myconv(next(), 8);}\n\tstatic ArrayList<String> nextCharArray(){return myconv(next(), 0);}\n\tstatic ArrayList<Integer> nextIntArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic ArrayList<Long> nextLongArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic String myconv(Object list, int no){//only join\n\t\tString joinString = CONVSTR.get(no);\n\t\tif(list instanceof String[]){\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}else if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}\n\t}\n\tstatic ArrayList<String> myconv(String str, int no){//only split\n\t\tString splitString = CONVSTR.get(no);\n\t\treturn new ArrayList<String>(Arrays.asList(str.split(splitString)));\n\t}\n\tpublic static void main(String[] args){\n\t\tCONVSTR.put(8, \" \"); CONVSTR.put(9, \"\\n\"); CONVSTR.put(0, \"\");\n\t\tsolve();flush();\n\t}\n\t//Don't have to see. end------------------------------------------\n\tstatic void solve(){//Here is the main function\n\t\tint N = nextInt();\n\t\tArrayList<Long> list = nextLongArray();\n\t\tlong output = 0;\n\t\tfor(int i = 1; i < N; i++){\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}\n\t\tmyout(output);\n\t}\n\t//Method addition frame start\n\n\n\n\t//Method addition frame end\n}",
"Main",
"static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();",
"CONVSTR",
"new HashMap<Integer, String>()",
"static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.",
"ii",
"new InputIterator()",
"static PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"static void flush(){out.flush();}",
"flush",
"{out.flush();}",
"out.flush()",
"out.flush",
"out",
"static void myout(Object t){out.println(t);}",
"myout",
"{out.println(t);}",
"out.println(t)",
"out.println",
"out",
"t",
"Object t",
"t",
"static void myerr(Object t){System.err.print(\"debug:\");System.err.println(t);}",
"myerr",
"{System.err.print(\"debug:\");System.err.println(t);}",
"System.err.print(\"debug:\")",
"System.err.print",
"System.err",
"System",
"System.err",
"\"debug:\"",
"System.err.println(t)",
"System.err.println",
"System.err",
"System",
"System.err",
"t",
"Object t",
"t",
"static String next(){return ii.next();}",
"next",
"{return ii.next();}",
"return ii.next();",
"ii.next()",
"ii.next",
"ii",
"static boolean hasNext(){return ii.hasNext();}",
"hasNext",
"{return ii.hasNext();}",
"return ii.hasNext();",
"ii.hasNext()",
"ii.hasNext",
"ii",
"static int nextInt(){return Integer.parseInt(next());}",
"nextInt",
"{return Integer.parseInt(next());}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"static long nextLong(){return Long.parseLong(next());}",
"nextLong",
"{return Long.parseLong(next());}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"static double nextDouble(){return Double.parseDouble(next());}",
"nextDouble",
"{return Double.parseDouble(next());}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"static ArrayList<String> nextStrArray(){return myconv(next(), 8);}",
"nextStrArray",
"{return myconv(next(), 8);}",
"return myconv(next(), 8);",
"myconv(next(), 8)",
"myconv",
"next()",
"next",
"8",
"static ArrayList<String> nextCharArray(){return myconv(next(), 0);}",
"nextCharArray",
"{return myconv(next(), 0);}",
"return myconv(next(), 0);",
"myconv(next(), 0)",
"myconv",
"next()",
"next",
"0",
"static ArrayList<Integer> nextIntArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}",
"nextIntArray",
"{\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}",
"ArrayList<String> input = nextStrArray();",
"input",
"nextStrArray()",
"nextStrArray",
"ArrayList<Integer> ret = new ArrayList<Integer>(input.size());",
"ret",
"new ArrayList<Integer>(input.size())",
"for(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < input.size()",
"i",
"input.size()",
"input.size",
"input",
"i++",
"i++",
"i",
"{\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}",
"{\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}",
"ret.add(Integer.parseInt(input.get(i)))",
"ret.add",
"ret",
"Integer.parseInt(input.get(i))",
"Integer.parseInt",
"Integer",
"input.get(i)",
"input.get",
"input",
"i",
"return ret;",
"ret",
"static ArrayList<Long> nextLongArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}",
"nextLongArray",
"{\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}",
"ArrayList<String> input = nextStrArray();",
"input",
"nextStrArray()",
"nextStrArray",
"ArrayList<Long> ret = new ArrayList<Long>(input.size());",
"ret",
"new ArrayList<Long>(input.size())",
"for(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < input.size()",
"i",
"input.size()",
"input.size",
"input",
"i++",
"i++",
"i",
"{\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}",
"{\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}",
"ret.add(Long.parseLong(input.get(i)))",
"ret.add",
"ret",
"Long.parseLong(input.get(i))",
"Long.parseLong",
"Long",
"input.get(i)",
"input.get",
"input",
"i",
"return ret;",
"ret",
"static String myconv(Object list, int no){//only join\n\t\tString joinString = CONVSTR.get(no);\n\t\tif(list instanceof String[]){\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}else if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}\n\t}",
"myconv",
"{//only join\n\t\tString joinString = CONVSTR.get(no);\n\t\tif(list instanceof String[]){\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}else if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}\n\t}",
"String joinString = CONVSTR.get(no);",
"joinString",
"CONVSTR.get(no)",
"CONVSTR.get",
"CONVSTR",
"no",
"if(list instanceof String[]){\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}else if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}",
"list instanceof String[]",
"list",
"String[]",
"{\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}",
"return String.join(joinString, (String[])list);",
"String.join(joinString, (String[])list)",
"String.join",
"String",
"joinString",
"(String[])list",
"if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}",
"list instanceof ArrayList",
"list",
"ArrayList",
"{\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}",
"return String.join(joinString, (ArrayList)list);",
"String.join(joinString, (ArrayList)list)",
"String.join",
"String",
"joinString",
"(ArrayList)list",
"{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}",
"throw new ClassCastException(\"Don't join\");",
"new ClassCastException(\"Don't join\")",
"Object list",
"list",
"int no",
"no",
"static ArrayList<String> myconv(String str, int no){//only split\n\t\tString splitString = CONVSTR.get(no);\n\t\treturn new ArrayList<String>(Arrays.asList(str.split(splitString)));\n\t}",
"myconv",
"{//only split\n\t\tString splitString = CONVSTR.get(no);\n\t\treturn new ArrayList<String>(Arrays.asList(str.split(splitString)));\n\t}",
"String splitString = CONVSTR.get(no);",
"splitString",
"CONVSTR.get(no)",
"CONVSTR.get",
"CONVSTR",
"no",
"return new ArrayList<String>(Arrays.asList(str.split(splitString)));",
"new ArrayList<String>(Arrays.asList(str.split(splitString)))",
"String str",
"str",
"int no",
"no",
"public static void main(String[] args){\n\t\tCONVSTR.put(8, \" \"); CONVSTR.put(9, \"\\n\"); CONVSTR.put(0, \"\");\n\t\tsolve();flush();\n\t}",
"main",
"{\n\t\tCONVSTR.put(8, \" \"); CONVSTR.put(9, \"\\n\"); CONVSTR.put(0, \"\");\n\t\tsolve();flush();\n\t}",
"CONVSTR.put(8, \" \")",
"CONVSTR.put",
"CONVSTR",
"8",
"\" \"",
"CONVSTR.put(9, \"\\n\")",
"CONVSTR.put",
"CONVSTR",
"9",
"\"\\n\"",
"CONVSTR.put(0, \"\")",
"CONVSTR.put",
"CONVSTR",
"0",
"\"\"",
"solve()",
"solve",
"flush()",
"flush",
"String[] args",
"args",
"//Don't have to see. end------------------------------------------\n\tstatic void solve(){//Here is the main function\n\t\tint N = nextInt();\n\t\tArrayList<Long> list = nextLongArray();\n\t\tlong output = 0;\n\t\tfor(int i = 1; i < N; i++){\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}\n\t\tmyout(output);\n\t}",
"solve",
"{//Here is the main function\n\t\tint N = nextInt();\n\t\tArrayList<Long> list = nextLongArray();\n\t\tlong output = 0;\n\t\tfor(int i = 1; i < N; i++){\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}\n\t\tmyout(output);\n\t}",
"int N = nextInt();",
"N",
"nextInt()",
"nextInt",
"ArrayList<Long> list = nextLongArray();",
"list",
"nextLongArray()",
"nextLongArray",
"long output = 0;",
"output",
"0",
"for(int i = 1; i < N; i++){\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}",
"if(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}",
"list.get(i - 1) > list.get(i)",
"list.get(i - 1)",
"list.get",
"list",
"i - 1",
"i",
"1",
"list.get(i)",
"list.get",
"list",
"i",
"{\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}",
"output += list.get(i - 1) - list.get(i)",
"output",
"list.get(i - 1) - list.get(i)",
"list.get(i - 1)",
"list.get",
"list",
"i - 1",
"i",
"1",
"list.get(i)",
"list.get",
"list",
"i",
"list.set(i, list.get(i - 1))",
"list.set",
"list",
"i",
"list.get(i - 1)",
"list.get",
"list",
"i - 1",
"i",
"1",
"myout(output)",
"myout",
"output",
"static class InputIterator{\n\t\tArrayList<String> inputLine = new ArrayList<String>(1024);\n\t\tint index = 0; int max; String read;\n\t\tInputIterator(){\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttry{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}\n\t\t\tmax = inputLine.size();\n\t\t}\n\t\tboolean hasNext(){return (index < max);}\n\t\tString next(){\n\t\t\tif(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}\n\t\t}\n\t}",
"InputIterator",
"ArrayList<String> inputLine = new ArrayList<String>(1024);",
"inputLine",
"new ArrayList<String>(1024)",
"int index = 0;",
"index",
"0",
"int max;",
"max",
"String read;",
"read",
"InputIterator(){\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttry{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}\n\t\t\tmax = inputLine.size();\n\t\t}",
"InputIterator",
"{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttry{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}\n\t\t\tmax = inputLine.size();\n\t\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"try{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}",
"catch(IOException e){}",
"IOException e",
"{}",
"{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}",
"while((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}",
"(read = br.readLine()) != null",
"(read = br.readLine())",
"read",
"br.readLine()",
"br.readLine",
"br",
"null",
"{\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}",
"inputLine.add(read)",
"inputLine.add",
"inputLine",
"read",
"max = inputLine.size()",
"max",
"inputLine.size()",
"inputLine.size",
"inputLine",
"boolean hasNext(){return (index < max);}",
"hasNext",
"{return (index < max);}",
"return (index < max);",
"(index < max)",
"index",
"max",
"String next(){\n\t\t\tif(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}\n\t\t}",
"next",
"{\n\t\t\tif(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}\n\t\t}",
"if(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}",
"hasNext()",
"hasNext",
"{\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}",
"return inputLine.get(index++);",
"inputLine.get(index++)",
"inputLine.get",
"inputLine",
"index++",
"index",
"{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}",
"throw new IndexOutOfBoundsException(\"There is no more input\");",
"new IndexOutOfBoundsException(\"There is no more input\")",
"public class Main{\n\t//Don't have to see. start------------------------------------------\n\tstatic class InputIterator{\n\t\tArrayList<String> inputLine = new ArrayList<String>(1024);\n\t\tint index = 0; int max; String read;\n\t\tInputIterator(){\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttry{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}\n\t\t\tmax = inputLine.size();\n\t\t}\n\t\tboolean hasNext(){return (index < max);}\n\t\tString next(){\n\t\t\tif(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}\n\t\t}\n\t}\n\tstatic HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();\n\tstatic InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic void flush(){out.flush();}\n\tstatic void myout(Object t){out.println(t);}\n\tstatic void myerr(Object t){System.err.print(\"debug:\");System.err.println(t);}\n\tstatic String next(){return ii.next();}\n\tstatic boolean hasNext(){return ii.hasNext();}\n\tstatic int nextInt(){return Integer.parseInt(next());}\n\tstatic long nextLong(){return Long.parseLong(next());}\n\tstatic double nextDouble(){return Double.parseDouble(next());}\n\tstatic ArrayList<String> nextStrArray(){return myconv(next(), 8);}\n\tstatic ArrayList<String> nextCharArray(){return myconv(next(), 0);}\n\tstatic ArrayList<Integer> nextIntArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic ArrayList<Long> nextLongArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic String myconv(Object list, int no){//only join\n\t\tString joinString = CONVSTR.get(no);\n\t\tif(list instanceof String[]){\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}else if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}\n\t}\n\tstatic ArrayList<String> myconv(String str, int no){//only split\n\t\tString splitString = CONVSTR.get(no);\n\t\treturn new ArrayList<String>(Arrays.asList(str.split(splitString)));\n\t}\n\tpublic static void main(String[] args){\n\t\tCONVSTR.put(8, \" \"); CONVSTR.put(9, \"\\n\"); CONVSTR.put(0, \"\");\n\t\tsolve();flush();\n\t}\n\t//Don't have to see. end------------------------------------------\n\tstatic void solve(){//Here is the main function\n\t\tint N = nextInt();\n\t\tArrayList<Long> list = nextLongArray();\n\t\tlong output = 0;\n\t\tfor(int i = 1; i < N; i++){\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}\n\t\tmyout(output);\n\t}\n\t//Method addition frame start\n\n\n\n\t//Method addition frame end\n}",
"public class Main{\n\t//Don't have to see. start------------------------------------------\n\tstatic class InputIterator{\n\t\tArrayList<String> inputLine = new ArrayList<String>(1024);\n\t\tint index = 0; int max; String read;\n\t\tInputIterator(){\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\ttry{\n\t\t\t\twhile((read = br.readLine()) != null){\n\t\t\t\t\tinputLine.add(read);\n\t\t\t\t}\n\t\t\t}catch(IOException e){}\n\t\t\tmax = inputLine.size();\n\t\t}\n\t\tboolean hasNext(){return (index < max);}\n\t\tString next(){\n\t\t\tif(hasNext()){\n\t\t\t\treturn inputLine.get(index++);\n\t\t\t}else{\n\t\t\t\tthrow new IndexOutOfBoundsException(\"There is no more input\");\n\t\t\t}\n\t\t}\n\t}\n\tstatic HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();\n\tstatic InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tstatic void flush(){out.flush();}\n\tstatic void myout(Object t){out.println(t);}\n\tstatic void myerr(Object t){System.err.print(\"debug:\");System.err.println(t);}\n\tstatic String next(){return ii.next();}\n\tstatic boolean hasNext(){return ii.hasNext();}\n\tstatic int nextInt(){return Integer.parseInt(next());}\n\tstatic long nextLong(){return Long.parseLong(next());}\n\tstatic double nextDouble(){return Double.parseDouble(next());}\n\tstatic ArrayList<String> nextStrArray(){return myconv(next(), 8);}\n\tstatic ArrayList<String> nextCharArray(){return myconv(next(), 0);}\n\tstatic ArrayList<Integer> nextIntArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Integer.parseInt(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic ArrayList<Long> nextLongArray(){\n\t\tArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());\n\t\tfor(int i = 0; i < input.size(); i++){\n\t\t\tret.add(Long.parseLong(input.get(i)));\n\t\t}\n\t\treturn ret;\n\t}\n\tstatic String myconv(Object list, int no){//only join\n\t\tString joinString = CONVSTR.get(no);\n\t\tif(list instanceof String[]){\n\t\t\treturn String.join(joinString, (String[])list);\n\t\t}else if(list instanceof ArrayList){\n\t\t\treturn String.join(joinString, (ArrayList)list);\n\t\t}else{\n\t\t\tthrow new ClassCastException(\"Don't join\");\n\t\t}\n\t}\n\tstatic ArrayList<String> myconv(String str, int no){//only split\n\t\tString splitString = CONVSTR.get(no);\n\t\treturn new ArrayList<String>(Arrays.asList(str.split(splitString)));\n\t}\n\tpublic static void main(String[] args){\n\t\tCONVSTR.put(8, \" \"); CONVSTR.put(9, \"\\n\"); CONVSTR.put(0, \"\");\n\t\tsolve();flush();\n\t}\n\t//Don't have to see. end------------------------------------------\n\tstatic void solve(){//Here is the main function\n\t\tint N = nextInt();\n\t\tArrayList<Long> list = nextLongArray();\n\t\tlong output = 0;\n\t\tfor(int i = 1; i < N; i++){\n\t\t\tif(list.get(i - 1) > list.get(i)){\n\t\t\t\toutput += list.get(i - 1) - list.get(i);\n\t\t\t\tlist.set(i, list.get(i - 1));\n\t\t\t}\n\t\t}\n\t\tmyout(output);\n\t}\n\t//Method addition frame start\n\n\n\n\t//Method addition frame end\n}",
"Main"
]
| import java.util.*; import java.io.*; import java.math.*;
public class Main{
//Don't have to see. start------------------------------------------
static class InputIterator{
ArrayList<String> inputLine = new ArrayList<String>(1024);
int index = 0; int max; String read;
InputIterator(){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try{
while((read = br.readLine()) != null){
inputLine.add(read);
}
}catch(IOException e){}
max = inputLine.size();
}
boolean hasNext(){return (index < max);}
String next(){
if(hasNext()){
return inputLine.get(index++);
}else{
throw new IndexOutOfBoundsException("There is no more input");
}
}
}
static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
static PrintWriter out = new PrintWriter(System.out);
static void flush(){out.flush();}
static void myout(Object t){out.println(t);}
static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
static String next(){return ii.next();}
static boolean hasNext(){return ii.hasNext();}
static int nextInt(){return Integer.parseInt(next());}
static long nextLong(){return Long.parseLong(next());}
static double nextDouble(){return Double.parseDouble(next());}
static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
static ArrayList<Integer> nextIntArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Integer.parseInt(input.get(i)));
}
return ret;
}
static ArrayList<Long> nextLongArray(){
ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
for(int i = 0; i < input.size(); i++){
ret.add(Long.parseLong(input.get(i)));
}
return ret;
}
static String myconv(Object list, int no){//only join
String joinString = CONVSTR.get(no);
if(list instanceof String[]){
return String.join(joinString, (String[])list);
}else if(list instanceof ArrayList){
return String.join(joinString, (ArrayList)list);
}else{
throw new ClassCastException("Don't join");
}
}
static ArrayList<String> myconv(String str, int no){//only split
String splitString = CONVSTR.get(no);
return new ArrayList<String>(Arrays.asList(str.split(splitString)));
}
public static void main(String[] args){
CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
solve();flush();
}
//Don't have to see. end------------------------------------------
static void solve(){//Here is the main function
int N = nextInt();
ArrayList<Long> list = nextLongArray();
long output = 0;
for(int i = 1; i < N; i++){
if(list.get(i - 1) > list.get(i)){
output += list.get(i - 1) - list.get(i);
list.set(i, list.get(i - 1));
}
}
myout(output);
}
//Method addition frame start
//Method addition frame end
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
13,
13,
0,
13,
2,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
14,
2,
13,
40,
17,
30,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
30,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
37,
20,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
4,
18,
13,
13,
29,
4,
13,
13,
23,
13,
12,
13,
30,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
12,
13,
30,
29,
4,
13,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
23,
13,
6,
13,
12,
13,
23,
13,
6,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
0,
18,
36,
13,
20,
23,
13,
12,
13,
30,
4,
18,
13,
12,
13,
30,
4,
18,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
396,
35
],
[
396,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
38,
49
],
[
49,
50
],
[
49,
51
],
[
38,
52
],
[
52,
53
],
[
52,
54
],
[
38,
55
],
[
55,
56
],
[
55,
57
],
[
38,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
58,
62
],
[
58,
63
],
[
38,
64
],
[
64,
65
],
[
65,
66
],
[
36,
67
],
[
67,
68
],
[
396,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
77,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
82,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
82,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
82,
99
],
[
99,
100
],
[
99,
101
],
[
82,
102
],
[
102,
103
],
[
102,
104
],
[
102,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
109,
113
],
[
106,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
82,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
71,
123
],
[
123,
124
],
[
71,
125
],
[
125,
126
],
[
71,
127
],
[
127,
128
],
[
396,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
129,
137
],
[
137,
138
],
[
129,
139
],
[
139,
140
],
[
129,
141
],
[
141,
142
],
[
129,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
143,
151
],
[
151,
152
],
[
129,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
156,
161
],
[
161,
162
],
[
162,
163
],
[
155,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
172,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
181,
184
],
[
168,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
185,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
155,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
129,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
200,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
212,
213
],
[
200,
214
],
[
214,
215
],
[
214,
216
],
[
200,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
217,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
221,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
200,
230
],
[
230,
231
],
[
230,
232
],
[
200,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
233,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
244,
245
],
[
244,
246
],
[
239,
247
],
[
247,
248
],
[
248,
249
],
[
238,
250
],
[
250,
251
],
[
250,
252
],
[
238,
253
],
[
253,
254
],
[
253,
255
],
[
255,
256
],
[
255,
257
],
[
238,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
200,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
129,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
269,
270
],
[
270,
271
],
[
270,
272
],
[
269,
273
],
[
273,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
275,
278
],
[
268,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
266,
283
],
[
283,
284
],
[
129,
285
],
[
285,
286
],
[
285,
287
],
[
287,
288
],
[
288,
289
],
[
292,
290
],
[
302,
291
],
[
299,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
292,
296
],
[
296,
297
],
[
296,
298
],
[
299,
299
],
[
299,
300
],
[
299,
301
],
[
302,
302
],
[
302,
303
],
[
302,
304
],
[
292,
305
],
[
305,
306
],
[
305,
307
],
[
307,
308
],
[
285,
309
],
[
309,
310
],
[
129,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
315,
318
],
[
311,
319
],
[
319,
320
],
[
129,
321
],
[
321,
322
],
[
321,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
323,
328
],
[
328,
329
],
[
329,
330
],
[
330,
331
],
[
330,
332
],
[
328,
333
],
[
333,
334
],
[
333,
335
],
[
328,
336
],
[
336,
337
],
[
337,
338
],
[
328,
339
],
[
339,
340
],
[
340,
341
],
[
341,
342
],
[
341,
343
],
[
340,
344
],
[
344,
345
],
[
323,
346
],
[
346,
347
],
[
321,
348
],
[
348,
349
],
[
321,
350
],
[
350,
351
],
[
129,
352
],
[
352,
353
],
[
352,
354
],
[
354,
355
],
[
354,
356
],
[
356,
357
],
[
396,
358
],
[
358,
359
],
[
358,
360
],
[
360,
361
],
[
358,
362
],
[
362,
363
],
[
362,
364
],
[
364,
365
],
[
365,
366
],
[
365,
367
],
[
362,
368
],
[
368,
369
],
[
358,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
373,
374
],
[
374,
375
],
[
374,
376
],
[
373,
377
],
[
370,
378
],
[
378,
379
],
[
358,
380
],
[
380,
381
],
[
380,
382
],
[
382,
383
],
[
383,
384
],
[
384,
385
],
[
358,
386
],
[
386,
387
],
[
386,
388
],
[
388,
389
],
[
389,
390
],
[
390,
391
],
[
389,
392
],
[
386,
393
],
[
393,
394
],
[
0,
395
],
[
395,
396
],
[
395,
397
]
]
| [
"import java.io.OutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.BufferedWriter;\nimport java.io.Writer;\nimport java.io.OutputStreamWriter;\nimport java.util.InputMismatchException;\nimport java.io.IOException;\nimport java.io.InputStream;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int[] nextIntArray(int n) {\n return nextIntArray(n, 0);\n }\n\n public int[] nextIntArray(int n, int startFrom) {\n int[] array = new int[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}\n",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.io.BufferedWriter;",
"BufferedWriter",
"java.io",
"import java.io.Writer;",
"Writer",
"java.io",
"import java.io.OutputStreamWriter;",
"OutputStreamWriter",
"java.io",
"import java.util.InputMismatchException;",
"InputMismatchException",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int[] nextIntArray(int n) {\n return nextIntArray(n, 0);\n }\n\n public int[] nextIntArray(int n, int startFrom) {\n int[] array = new int[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputStream);",
"in",
"new InputReader(inputStream)",
"OutputWriter out = new OutputWriter(outputStream);",
"out",
"new OutputWriter(outputStream)",
"CStep solver = new CStep();",
"solver",
"new CStep()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class CStep {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }\n }\n\n }",
"CStep",
"public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }\n }",
"solve",
"{\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }\n }",
"int ntc = 1;",
"ntc",
"1",
"while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }",
"(ntc--) > 0",
"(ntc--)",
"ntc",
"0",
"{\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] arr = in.nextIntArray(n);",
"arr",
"in.nextIntArray(n)",
"in.nextIntArray",
"in",
"n",
"int max = arr[0];",
"max",
"arr[0]",
"arr",
"0",
"long sum = 0;",
"sum",
"0",
"for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }",
"int x",
"arr",
"{\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }",
"{\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }",
"max = Math.max(x, max)",
"max",
"Math.max(x, max)",
"Math.max",
"Math",
"x",
"max",
"sum += (max - x)",
"sum",
"(max - x)",
"max",
"x",
"out.println(sum)",
"out.println",
"out",
"sum",
"int testNumber",
"testNumber",
"InputReader in",
"in",
"OutputWriter out",
"out",
"static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int[] nextIntArray(int n) {\n return nextIntArray(n, 0);\n }\n\n public int[] nextIntArray(int n, int startFrom) {\n int[] array = new int[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }",
"InputReader",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar;",
"curChar",
"private int numChars;",
"numChars",
"private InputReader.SpaceCharFilter filter;",
"filter",
"public InputReader(InputStream stream) {\n this.stream = stream;\n }",
"InputReader",
"{\n this.stream = stream;\n }",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"read",
"{\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }",
"if (numChars == -1) {\n throw new InputMismatchException();\n }",
"numChars == -1",
"numChars",
"-1",
"1",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar >= numChars",
"curChar",
"numChars",
"{\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }",
"curChar = 0",
"curChar",
"0",
"try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }",
"catch (IOException e) {\n throw new InputMismatchException();\n }",
"IOException e",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"{\n numChars = stream.read(buf);\n }",
"numChars = stream.read(buf)",
"numChars",
"stream.read(buf)",
"stream.read",
"stream",
"buf",
"if (numChars <= 0) {\n return -1;\n }",
"numChars <= 0",
"numChars",
"0",
"{\n return -1;\n }",
"return -1;",
"-1",
"1",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"nextInt",
"{\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }",
"int c = read();",
"c",
"read()",
"read",
"while (isSpaceChar(c)) {\n c = read();\n }",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n c = read();\n }",
"c = read()",
"c",
"read()",
"read",
"int sgn = 1;",
"sgn",
"1",
"if (c == '-') {\n sgn = -1;\n c = read();\n }",
"c == '-'",
"c",
"'-'",
"{\n sgn = -1;\n c = read();\n }",
"sgn = -1",
"sgn",
"-1",
"1",
"c = read()",
"c",
"read()",
"read",
"int res = 0;",
"res",
"0",
"do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));",
"!isSpaceChar(c)",
"isSpaceChar(c)",
"isSpaceChar",
"c",
"{\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n }",
"if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }",
"c < '0' || c > '9'",
"c < '0'",
"c",
"'0'",
"c > '9'",
"c",
"'9'",
"{\n throw new InputMismatchException();\n }",
"throw new InputMismatchException();",
"new InputMismatchException()",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = read()",
"c",
"read()",
"read",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"isSpaceChar",
"{\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }",
"if (filter != null) {\n return filter.isSpaceChar(c);\n }",
"filter != null",
"filter",
"null",
"{\n return filter.isSpaceChar(c);\n }",
"return filter.isSpaceChar(c);",
"filter.isSpaceChar(c)",
"filter.isSpaceChar",
"filter",
"c",
"return isWhitespace(c);",
"isWhitespace(c)",
"isWhitespace",
"c",
"int c",
"c",
"public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"isWhitespace",
"{\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public int[] nextIntArray(int n) {\n return nextIntArray(n, 0);\n }",
"nextIntArray",
"{\n return nextIntArray(n, 0);\n }",
"return nextIntArray(n, 0);",
"nextIntArray(n, 0)",
"nextIntArray",
"n",
"0",
"int n",
"n",
"public int[] nextIntArray(int n, int startFrom) {\n int[] array = new int[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextInt();\n return array;\n }",
"nextIntArray",
"{\n int[] array = new int[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextInt();\n return array;\n }",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"for (int i = startFrom; i < n; ++i) array[i] = nextInt();",
"int i = startFrom;",
"int i = startFrom;",
"i",
"startFrom",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"array[i] = nextInt();",
"array[i] = nextInt()",
"array[i]",
"array",
"i",
"nextInt()",
"nextInt",
"return array;",
"array",
"int n",
"n",
"int startFrom",
"startFrom",
"public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }",
"SpaceCharFilter",
"public boolean isSpaceChar(int ch);",
"isSpaceChar",
"int ch",
"ch",
"static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }",
"OutputWriter",
"private final PrintWriter writer;",
"writer",
"public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }",
"OutputWriter",
"{\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }",
"writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)))",
"writer",
"new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)))",
"OutputStream outputStream",
"outputStream",
"public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }",
"OutputWriter",
"{\n this.writer = new PrintWriter(writer);\n }",
"this.writer = new PrintWriter(writer)",
"this.writer",
"this",
"this.writer",
"new PrintWriter(writer)",
"Writer writer",
"writer",
"public void close() {\n writer.close();\n }",
"close",
"{\n writer.close();\n }",
"writer.close()",
"writer.close",
"writer",
"public void println(long i) {\n writer.println(i);\n }",
"println",
"{\n writer.println(i);\n }",
"writer.println(i)",
"writer.println",
"writer",
"i",
"long i",
"i",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int[] nextIntArray(int n) {\n return nextIntArray(n, 0);\n }\n\n public int[] nextIntArray(int n, int startFrom) {\n int[] array = new int[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n InputReader in = new InputReader(inputStream);\n OutputWriter out = new OutputWriter(outputStream);\n CStep solver = new CStep();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class CStep {\n public void solve(int testNumber, InputReader in, OutputWriter out) {\n int ntc = 1;\n// ntc = in.nextInt();\n while ((ntc--) > 0) {\n int n = in.nextInt();\n int[] arr = in.nextIntArray(n);\n int max = arr[0];\n long sum = 0;\n for (int x : arr) {\n max = Math.max(x, max);\n// out.print((max-x)+\" \");\n sum += (max - x);\n }\n out.println(sum);\n }\n }\n\n }\n\n static class InputReader {\n private InputStream stream;\n private byte[] buf = new byte[1024];\n private int curChar;\n private int numChars;\n private InputReader.SpaceCharFilter filter;\n\n public InputReader(InputStream stream) {\n this.stream = stream;\n }\n\n public int read() {\n if (numChars == -1) {\n throw new InputMismatchException();\n }\n if (curChar >= numChars) {\n curChar = 0;\n try {\n numChars = stream.read(buf);\n } catch (IOException e) {\n throw new InputMismatchException();\n }\n if (numChars <= 0) {\n return -1;\n }\n }\n return buf[curChar++];\n }\n\n public int nextInt() {\n int c = read();\n while (isSpaceChar(c)) {\n c = read();\n }\n int sgn = 1;\n if (c == '-') {\n sgn = -1;\n c = read();\n }\n int res = 0;\n do {\n if (c < '0' || c > '9') {\n throw new InputMismatchException();\n }\n res *= 10;\n res += c - '0';\n c = read();\n } while (!isSpaceChar(c));\n return res * sgn;\n }\n\n public boolean isSpaceChar(int c) {\n if (filter != null) {\n return filter.isSpaceChar(c);\n }\n return isWhitespace(c);\n }\n\n public static boolean isWhitespace(int c) {\n return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n }\n\n public int[] nextIntArray(int n) {\n return nextIntArray(n, 0);\n }\n\n public int[] nextIntArray(int n, int startFrom) {\n int[] array = new int[n];\n for (int i = startFrom; i < n; ++i) array[i] = nextInt();\n return array;\n }\n\n public interface SpaceCharFilter {\n public boolean isSpaceChar(int ch);\n\n }\n\n }\n\n static class OutputWriter {\n private final PrintWriter writer;\n\n public OutputWriter(OutputStream outputStream) {\n writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));\n }\n\n public OutputWriter(Writer writer) {\n this.writer = new PrintWriter(writer);\n }\n\n public void close() {\n writer.close();\n }\n\n public void println(long i) {\n writer.println(i);\n }\n\n }\n}",
"Main"
]
| import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
CStep solver = new CStep();
solver.solve(1, in, out);
out.close();
}
static class CStep {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int ntc = 1;
// ntc = in.nextInt();
while ((ntc--) > 0) {
int n = in.nextInt();
int[] arr = in.nextIntArray(n);
int max = arr[0];
long sum = 0;
for (int x : arr) {
max = Math.max(x, max);
// out.print((max-x)+" ");
sum += (max - x);
}
out.println(sum);
}
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int nextInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public int[] nextIntArray(int n) {
return nextIntArray(n, 0);
}
public int[] nextIntArray(int n, int startFrom) {
int[] array = new int[n];
for (int i = startFrom; i < n; ++i) array[i] = nextInt();
return array;
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void close() {
writer.close();
}
public void println(long i) {
writer.println(i);
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
18,
13,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
41,
13,
2,
13,
13,
0,
13,
4,
18,
13,
4,
18,
13,
13,
0,
13,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
85,
8
],
[
85,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
11,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
42,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
55,
57
],
[
52,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
52,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
48,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
11,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
9,
82
],
[
82,
83
],
[
0,
84
],
[
84,
85
],
[
84,
86
]
]
| [
"import java.math.BigInteger;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger sum = BigInteger.ZERO;\n\n long a1 = sc.nextInt();\n for (int i = 1; i < n; i++) {\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }\n System.out.println(sum);\n }\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger sum = BigInteger.ZERO;\n\n long a1 = sc.nextInt();\n for (int i = 1; i < n; i++) {\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }\n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger sum = BigInteger.ZERO;\n\n long a1 = sc.nextInt();\n for (int i = 1; i < n; i++) {\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger sum = BigInteger.ZERO;\n\n long a1 = sc.nextInt();\n for (int i = 1; i < n; i++) {\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }\n System.out.println(sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BigInteger sum = BigInteger.ZERO;",
"sum",
"BigInteger.ZERO",
"BigInteger",
"BigInteger.ZERO",
"long a1 = sc.nextInt();",
"a1",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 1; i < n; i++) {\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }",
"{\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }",
"long a2 = sc.nextLong();",
"a2",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }",
"a1 > a2",
"a1",
"a2",
"{\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n }",
"long x = a1 - a2;",
"x",
"a1 - a2",
"a1",
"a2",
"sum = sum.add(BigInteger.valueOf(x))",
"sum",
"sum.add(BigInteger.valueOf(x))",
"sum.add",
"sum",
"BigInteger.valueOf(x)",
"BigInteger.valueOf",
"BigInteger",
"x",
"a1 = a2 + x",
"a1",
"a2 + x",
"a2",
"x",
"{\n a1 = a2;\n }",
"a1 = a2",
"a1",
"a2",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger sum = BigInteger.ZERO;\n\n long a1 = sc.nextInt();\n for (int i = 1; i < n; i++) {\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }\n System.out.println(sum);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n BigInteger sum = BigInteger.ZERO;\n\n long a1 = sc.nextInt();\n for (int i = 1; i < n; i++) {\n long a2 = sc.nextLong();\n if (a1 > a2) {\n long x = a1 - a2;\n sum = sum.add(BigInteger.valueOf(x));\n a1 = a2 + x;\n } else {\n a1 = a2;\n }\n }\n System.out.println(sum);\n }\n}",
"Main"
]
| import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
BigInteger sum = BigInteger.ZERO;
long a1 = sc.nextInt();
for (int i = 1; i < n; i++) {
long a2 = sc.nextLong();
if (a1 > a2) {
long x = a1 - a2;
sum = sum.add(BigInteger.valueOf(x));
a1 = a2 + x;
} else {
a1 = a2;
}
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
0,
13,
4,
18,
13,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
74,
5
],
[
74,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
48,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
55,
59
],
[
52,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
6,
71
],
[
71,
72
],
[
0,
73
],
[
73,
74
],
[
73,
75
]
]
| [
"import java.util.*;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc= new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t\ta[i]=sc.nextInt();\n\t\t\n\t\tint max=a[0];\n\t\t\n\t\tlong step=0;\n\t\tfor(int i : a)\n\t\t{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}\n\t\tSystem.out.println(step);\n\t}\n\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc= new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t\ta[i]=sc.nextInt();\n\t\t\n\t\tint max=a[0];\n\t\t\n\t\tlong step=0;\n\t\tfor(int i : a)\n\t\t{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}\n\t\tSystem.out.println(step);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc= new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t\ta[i]=sc.nextInt();\n\t\t\n\t\tint max=a[0];\n\t\t\n\t\tlong step=0;\n\t\tfor(int i : a)\n\t\t{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}\n\t\tSystem.out.println(step);\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc= new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t\ta[i]=sc.nextInt();\n\t\t\n\t\tint max=a[0];\n\t\t\n\t\tlong step=0;\n\t\tfor(int i : a)\n\t\t{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}\n\t\tSystem.out.println(step);\n\t}",
"Scanner sc= new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a[]=new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0;i<n;i++)\n\t\t\ta[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=sc.nextInt();",
"a[i]=sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int max=a[0];",
"max",
"a[0]",
"a",
"0",
"long step=0;",
"step",
"0",
"for(int i : a)\n\t\t{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}",
"int i",
"a",
"{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}",
"{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}",
"max=Math.max(i, max)",
"max",
"Math.max(i, max)",
"Math.max",
"Math",
"i",
"max",
"step+=max-i",
"step",
"max-i",
"max",
"i",
"System.out.println(step)",
"System.out.println",
"System.out",
"System",
"System.out",
"step",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc= new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t\ta[i]=sc.nextInt();\n\t\t\n\t\tint max=a[0];\n\t\t\n\t\tlong step=0;\n\t\tfor(int i : a)\n\t\t{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}\n\t\tSystem.out.println(step);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tScanner sc= new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint a[]=new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t\ta[i]=sc.nextInt();\n\t\t\n\t\tint max=a[0];\n\t\t\n\t\tlong step=0;\n\t\tfor(int i : a)\n\t\t{\n\t\t\tmax=Math.max(i, max);\n\t\t\tstep+=max-i;\n\t\t}\n\t\tSystem.out.println(step);\n\t}\n\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
int max=a[0];
long step=0;
for(int i : a)
{
max=Math.max(i, max);
step+=max-i;
}
System.out.println(step);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
20,
23,
13,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
29,
18,
13,
40,
13,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
37,
20,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
349,
11
],
[
349,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
14,
47
],
[
47,
48
],
[
47,
49
],
[
14,
50
],
[
50,
51
],
[
50,
52
],
[
14,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
66,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
66,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
14,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
349,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
92,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
98,
105
],
[
105,
106
],
[
105,
107
],
[
98,
109
],
[
109,
110
],
[
109,
111
],
[
98,
112
],
[
112,
113
],
[
112,
114
],
[
98,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
118,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
129,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
125,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
117,
150
],
[
150,
151
],
[
98,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
155,
163
],
[
163,
164
],
[
164,
165
],
[
98,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
174,
176
],
[
166,
177
],
[
177,
178
],
[
98,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
183,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
189,
191
],
[
182,
192
],
[
192,
193
],
[
181,
194
],
[
194,
195
],
[
195,
196
],
[
98,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
200,
204
],
[
204,
205
],
[
199,
206
],
[
206,
207
],
[
206,
208
],
[
199,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
199,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
213,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
217,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
199,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
98,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
233,
237
],
[
237,
238
],
[
232,
239
],
[
239,
240
],
[
239,
241
],
[
232,
242
],
[
242,
243
],
[
242,
244
],
[
232,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
232,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
253,
257
],
[
257,
258
],
[
257,
259
],
[
259,
260
],
[
232,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
262,
266
],
[
266,
267
],
[
266,
268
],
[
261,
269
],
[
269,
270
],
[
270,
271
],
[
232,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
276,
280
],
[
280,
281
],
[
280,
282
],
[
275,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
283,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
289,
291
],
[
275,
292
],
[
292,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
293,
298
],
[
298,
299
],
[
299,
300
],
[
299,
301
],
[
292,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
304,
308
],
[
292,
309
],
[
309,
310
],
[
310,
311
],
[
274,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
98,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
321,
322
],
[
318,
323
],
[
323,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
327,
328
],
[
327,
329
],
[
324,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
332,
334
],
[
323,
335
],
[
335,
336
],
[
318,
337
],
[
337,
338
],
[
98,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
344,
345
],
[
343,
346
],
[
346,
347
],
[
0,
348
],
[
348,
349
],
[
348,
350
]
]
| [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.*;\n\npublic class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t}\n\t\t\n\t\tlong max = 0, sum = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}\n\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\t\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tprivate int readByte() {\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}\n\t\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\t\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}\n\t\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\t\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t}\n\t\t\n\t\tlong max = 0, sum = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}",
"Main",
"public Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t}\n\t\t\n\t\tlong max = 0, sum = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"Main",
"{\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t}\n\t\t\n\t\tlong max = 0, sum = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"FastScanner scanner = new FastScanner();",
"scanner",
"new FastScanner()",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = scanner.nextLong();\n\t\t}",
"{\n\t\t\tA[i] = scanner.nextLong();\n\t\t}",
"A[i] = scanner.nextLong()",
"A[i]",
"A",
"i",
"scanner.nextLong()",
"scanner.nextLong",
"scanner",
"long max = 0",
"max",
"0",
"sum = 0;",
"sum",
"0",
"for (int i = 0; i < N; i++) {\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}",
"if (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}",
"max <= A[i]",
"max",
"A[i]",
"A",
"i",
"{\n\t\t\t\tmax = A[i];\n\t\t\t}",
"max = A[i]",
"max",
"A[i]",
"A",
"i",
"{\n\t\t\t\tsum += max - A[i];\n\t\t\t}",
"sum += max - A[i]",
"sum",
"max - A[i]",
"max",
"A[i]",
"A",
"i",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"public static void main(String[] args) {\n\t\tnew Main();\n\t}",
"main",
"{\n\t\tnew Main();\n\t}",
"new Main()",
"String[] args",
"args",
"class FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\t\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tprivate int readByte() {\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}\n\t\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\t\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}\n\t\n\tpublic String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\t\n\tpublic long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\t\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}\n\t\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"hasNextByte",
"{\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"if (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr < buflen",
"ptr",
"buflen",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"{\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr = 0",
"ptr",
"0",
"try {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"IOException e",
"{\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t}",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}",
"buflen <= 0",
"buflen",
"0",
"{\n\t\t\t\treturn false;\n\t\t\t}",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}",
"readByte",
"{\n\t\tif (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;\n\t}",
"if (hasNextByte()) return buffer[ptr++];\n\t\telse return -1;",
"hasNextByte()",
"hasNextByte",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}",
"isPrintableChar",
"{\n\t\treturn 33 <= c && c <= 126;\n\t}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}",
"hasNext",
"{\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;\n\t\treturn hasNextByte();\n\t}",
"while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"next",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"nextLong",
"{\n\t\tif (!hasNext()) throw new NoSuchElementException();\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"if (!hasNext()) throw new NoSuchElementException();",
"!hasNext()",
"hasNext()",
"hasNext",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"b == '-'",
"b",
"'-'",
"{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"true",
"{\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"if ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\t\treturn minus ? -n : n;\n\t\t\t}",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"nextInt",
"{\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n\t\treturn (int) nl;\n\t}",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();",
"nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE",
"nl < Integer.MIN_VALUE",
"nl",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"nl > Integer.MAX_VALUE",
"nl",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}",
"nextDouble",
"{\n\t\treturn Double.parseDouble(next());\n\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t}\n\t\t\n\t\tlong max = 0, sum = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}",
"public class Main {\n\t\n\tpublic Main() {\n\t\tFastScanner scanner = new FastScanner();\n\t\tint N = scanner.nextInt();\n\t\t\n\t\tlong[] A = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scanner.nextLong();\n\t\t}\n\t\t\n\t\tlong max = 0, sum = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (max <= A[i]){\n\t\t\t\tmax = A[i];\n\t\t\t} else {\n\t\t\t\tsum += max - A[i];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\tnew Main();\n\t}\n}",
"Main"
]
| import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main {
public Main() {
FastScanner scanner = new FastScanner();
int N = scanner.nextInt();
long[] A = new long[N];
for (int i = 0; i < N; i++) {
A[i] = scanner.nextLong();
}
long max = 0, sum = 0;
for (int i = 0; i < N; i++) {
if (max <= A[i]){
max = A[i];
} else {
sum += max - A[i];
}
}
System.out.println(sum);
}
public static void main(String[] args) {
new Main();
}
}
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte()) return buffer[ptr++];
else return -1;
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
return hasNextByte();
}
public String next() {
if (!hasNext()) throw new NoSuchElementException();
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) throw new NoSuchElementException();
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
return (int) nl;
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
103,
11
],
[
103,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
27,
29
],
[
14,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
14,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
63,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
76,
82
],
[
82,
83
],
[
82,
84
],
[
73,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
14,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
12,
100
],
[
100,
101
],
[
0,
102
],
[
102,
103
],
[
102,
104
]
]
| [
"import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] arr = new int[n];\n\n long ans = 0;\n\n for (int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\n for (int i = 1; i<n; i++){\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] arr = new int[n];\n\n long ans = 0;\n\n for (int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\n for (int i = 1; i<n; i++){\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] arr = new int[n];\n\n long ans = 0;\n\n for (int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\n for (int i = 1; i<n; i++){\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] arr = new int[n];\n\n long ans = 0;\n\n for (int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\n for (int i = 1; i<n; i++){\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"long ans = 0;",
"ans",
"0",
"for (int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = sc.nextInt();\n }",
"{\n arr[i] = sc.nextInt();\n }",
"arr[i] = sc.nextInt()",
"arr[i]",
"arr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 1; i<n; i++){\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }",
"{\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }",
"if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }",
"arr[i] < arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"{\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }",
"ans += (arr[i-1]-arr[i])",
"ans",
"(arr[i-1]-arr[i])",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"arr[i]",
"arr",
"i",
"arr[i] = arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] arr = new int[n];\n\n long ans = 0;\n\n for (int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\n for (int i = 1; i<n; i++){\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int n = sc.nextInt();\n\n int[] arr = new int[n];\n\n long ans = 0;\n\n for (int i = 0; i<n; i++){\n arr[i] = sc.nextInt();\n }\n\n for (int i = 1; i<n; i++){\n if (arr[i] < arr[i-1]){\n ans += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.*;
import java.io.*;
import java.lang.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
long ans = 0;
for (int i = 0; i<n; i++){
arr[i] = sc.nextInt();
}
for (int i = 1; i<n; i++){
if (arr[i] < arr[i-1]){
ans += (arr[i-1]-arr[i]);
arr[i] = arr[i-1];
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
68,
11
],
[
68,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
14,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
41,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
49,
53
],
[
41,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
14,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
12,
65
],
[
65,
66
],
[
0,
67
],
[
67,
68
],
[
67,
69
]
]
| [
"import java.util.*;\nimport java.lang.*;\nimport java.math.BigInteger;\npublic class Main{\n public static void main(String arg[])\n {\n Scanner sc=new Scanner(System.in);\n \n int n=sc.nextInt();\n long t=0;\n int max=0;\n for(int i=0;i<n;i++)\n {\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }\n System.out.println(t);\n \n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main{\n public static void main(String arg[])\n {\n Scanner sc=new Scanner(System.in);\n \n int n=sc.nextInt();\n long t=0;\n int max=0;\n for(int i=0;i<n;i++)\n {\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }\n System.out.println(t);\n \n }\n}",
"Main",
"public static void main(String arg[])\n {\n Scanner sc=new Scanner(System.in);\n \n int n=sc.nextInt();\n long t=0;\n int max=0;\n for(int i=0;i<n;i++)\n {\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }\n System.out.println(t);\n \n }",
"main",
"{\n Scanner sc=new Scanner(System.in);\n \n int n=sc.nextInt();\n long t=0;\n int max=0;\n for(int i=0;i<n;i++)\n {\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }\n System.out.println(t);\n \n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long t=0;",
"t",
"0",
"int max=0;",
"max",
"0",
"for(int i=0;i<n;i++)\n {\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }",
"{\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }",
"int x=sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"max=Math.max(max, x)",
"max",
"Math.max(max, x)",
"Math.max",
"Math",
"max",
"x",
"t+=max-x",
"t",
"max-x",
"max",
"x",
"System.out.println(t)",
"System.out.println",
"System.out",
"System",
"System.out",
"t",
"String arg[]",
"arg",
"public class Main{\n public static void main(String arg[])\n {\n Scanner sc=new Scanner(System.in);\n \n int n=sc.nextInt();\n long t=0;\n int max=0;\n for(int i=0;i<n;i++)\n {\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }\n System.out.println(t);\n \n }\n}",
"public class Main{\n public static void main(String arg[])\n {\n Scanner sc=new Scanner(System.in);\n \n int n=sc.nextInt();\n long t=0;\n int max=0;\n for(int i=0;i<n;i++)\n {\n int x=sc.nextInt();\n max=Math.max(max, x);\n t+=max-x;\n }\n System.out.println(t);\n \n }\n}",
"Main"
]
| import java.util.*;
import java.lang.*;
import java.math.BigInteger;
public class Main{
public static void main(String arg[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long t=0;
int max=0;
for(int i=0;i<n;i++)
{
int x=sc.nextInt();
max=Math.max(max, x);
t+=max-x;
}
System.out.println(t);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
2,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
105,
5
],
[
105,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
69,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
6,
102
],
[
102,
103
],
[
0,
104
],
[
104,
105
],
[
104,
106
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] =new long[N];\n long count=0;\n \n for(int i=0;i<N;i++){\n A[i]=sc.nextLong();\n }\n \n for(int i=0;i<N-1;i++){\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }\n \n System.out.println(count);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] =new long[N];\n long count=0;\n \n for(int i=0;i<N;i++){\n A[i]=sc.nextLong();\n }\n \n for(int i=0;i<N-1;i++){\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }\n \n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] =new long[N];\n long count=0;\n \n for(int i=0;i<N;i++){\n A[i]=sc.nextLong();\n }\n \n for(int i=0;i<N-1;i++){\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }\n \n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] =new long[N];\n long count=0;\n \n for(int i=0;i<N;i++){\n A[i]=sc.nextLong();\n }\n \n for(int i=0;i<N-1;i++){\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }\n \n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long A[] =new long[N];",
"A",
"new long[N]",
"N",
"long count=0;",
"count",
"0",
"for(int i=0;i<N;i++){\n A[i]=sc.nextLong();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i]=sc.nextLong();\n }",
"{\n A[i]=sc.nextLong();\n }",
"A[i]=sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"for(int i=0;i<N-1;i++){\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N-1",
"i",
"N-1",
"N",
"1",
"i++",
"i++",
"i",
"{\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }",
"{\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }",
"if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }",
"A[i]>A[i+1]",
"A[i]",
"A",
"i",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"{\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }",
"count+=A[i]-A[i+1]",
"count",
"A[i]-A[i+1]",
"A[i]",
"A",
"i",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"A[i+1]+=A[i]-A[i+1]",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"A[i]-A[i+1]",
"A[i]",
"A",
"i",
"A[i+1]",
"A",
"i+1",
"i",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] =new long[N];\n long count=0;\n \n for(int i=0;i<N;i++){\n A[i]=sc.nextLong();\n }\n \n for(int i=0;i<N-1;i++){\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }\n \n System.out.println(count);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n long A[] =new long[N];\n long count=0;\n \n for(int i=0;i<N;i++){\n A[i]=sc.nextLong();\n }\n \n for(int i=0;i<N-1;i++){\n if(A[i]>A[i+1]){\n count+=A[i]-A[i+1];\n A[i+1]+=A[i]-A[i+1];\n }\n }\n \n System.out.println(count);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long A[] =new long[N];
long count=0;
for(int i=0;i<N;i++){
A[i]=sc.nextLong();
}
for(int i=0;i<N-1;i++){
if(A[i]>A[i+1]){
count+=A[i]-A[i+1];
A[i+1]+=A[i]-A[i+1];
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
92,
5
],
[
92,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
10,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
39
],
[
39,
40
],
[
40,
41
],
[
10,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
44,
46
],
[
10,
47
],
[
47,
48
],
[
47,
49
],
[
10,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
63,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
63,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
10,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
6,
89
],
[
89,
90
],
[
0,
91
],
[
91,
92
],
[
91,
93
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[]args) {\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}\n\n\n\t}\n\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[]args) {\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}\n\n\n\t}\n\n\n}",
"Main",
"public static void main(String[]args) {\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}\n\n\n\t}",
"main",
"{\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}\n\n\n\t}",
"try(Scanner scan = new Scanner(System.in)){\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}",
"{\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}",
"Scanner scan = new Scanner(System.in)",
"Scanner scan = new Scanner(System.in)",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long[]A = new long[N];",
"A",
"new long[N]",
"N",
"for(int i = 0;i<N;i++)A[i] = scan.nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"A[i] = scan.nextLong();",
"A[i] = scan.nextLong()",
"A[i]",
"A",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"long ki = A[0];",
"ki",
"A[0]",
"A",
"0",
"long goukei = 0;",
"goukei",
"0",
"for(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}",
"{\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}",
"if(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}",
"ki<=A[i]",
"ki",
"A[i]",
"A",
"i",
"{\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}",
"ki=A[i]",
"ki",
"A[i]",
"A",
"i",
"{\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}",
"goukei+=ki-A[i]",
"goukei",
"ki-A[i]",
"ki",
"A[i]",
"A",
"i",
"System.out.println(goukei)",
"System.out.println",
"System.out",
"System",
"System.out",
"goukei",
"String[]args",
"args",
"public class Main {\n\tpublic static void main(String[]args) {\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}\n\n\n\t}\n\n\n}",
"public class Main {\n\tpublic static void main(String[]args) {\n\t\ttry(Scanner scan = new Scanner(System.in)){\n\t\t\tint N = scan.nextInt();\n\t\t\tlong[]A = new long[N];\n\t\t\tfor(int i = 0;i<N;i++)A[i] = scan.nextLong();\n\n\n\t\t\tlong ki = A[0];\n\t\t\tlong goukei = 0;\n\t\t\tfor(int i = 1;i<N;i++) {\n\t\t\t\tif(ki<=A[i]) {\n\t\t\t\t\tki=A[i];\n\t\t\t\t\t//System.out.println(0);\n\t\t\t\t}else {\n\t\t\t\t\tgoukei+=ki-A[i];\n\t\t\t\t\t//System.out.println(ki-A[i]);\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tSystem.out.println(goukei);\n\n\n\n\n\t\t}\n\n\n\t}\n\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[]args) {
try(Scanner scan = new Scanner(System.in)){
int N = scan.nextInt();
long[]A = new long[N];
for(int i = 0;i<N;i++)A[i] = scan.nextLong();
long ki = A[0];
long goukei = 0;
for(int i = 1;i<N;i++) {
if(ki<=A[i]) {
ki=A[i];
//System.out.println(0);
}else {
goukei+=ki-A[i];
//System.out.println(ki-A[i]);
}
}
System.out.println(goukei);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
101,
5
],
[
101,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
44,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
58,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
76,
77
],
[
76,
78
],
[
67,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
83,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
6,
98
],
[
98,
99
],
[
0,
100
],
[
100,
101
],
[
100,
102
]
]
| [
"import java.util.*;\npublic class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n long len = 0;\n for(int i = 1; i < n; i++){\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }\n System.out.println(len);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n long len = 0;\n for(int i = 1; i < n; i++){\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }\n System.out.println(len);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n long len = 0;\n for(int i = 1; i < n; i++){\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }\n System.out.println(len);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n long len = 0;\n for(int i = 1; i < n; i++){\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }\n System.out.println(len);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextInt();\n }",
"{\n a[i] = sc.nextInt();\n }",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long len = 0;",
"len",
"0",
"for(int i = 1; i < n; i++){\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }",
"{\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }",
"if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }",
"a[i-1] > a[i]",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"{\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }",
"len += a[i-1] - a[i]",
"len",
"a[i-1] - a[i]",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"a[i] += a[i-1]-a[i]",
"a[i]",
"a",
"i",
"a[i-1]-a[i]",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"System.out.println(len)",
"System.out.println",
"System.out",
"System",
"System.out",
"len",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n long len = 0;\n for(int i = 1; i < n; i++){\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }\n System.out.println(len);\n }\n}",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long[] a = new long[n];\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n long len = 0;\n for(int i = 1; i < n; i++){\n if(a[i-1] > a[i]){\n len += a[i-1] - a[i];\n a[i] += a[i-1]-a[i];\n }\n }\n System.out.println(len);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long[] a = new long[n];
for(int i = 0; i < n; i++){
a[i] = sc.nextInt();
}
long len = 0;
for(int i = 1; i < n; i++){
if(a[i-1] > a[i]){
len += a[i-1] - a[i];
a[i] += a[i-1]-a[i];
}
}
System.out.println(len);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
18,
13,
13,
13,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
42,
40,
4,
18,
13,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
281,
17
],
[
281,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
20,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
20,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
20,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
20,
43
],
[
43,
44
],
[
43,
45
],
[
20,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
46,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
64,
66
],
[
61,
67
],
[
58,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
20,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
20,
81
],
[
81,
82
],
[
82,
83
],
[
18,
84
],
[
84,
85
],
[
281,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
92,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
88,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
88,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
104,
114
],
[
114,
115
],
[
115,
116
],
[
104,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
86,
126
],
[
126,
127
],
[
281,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
134,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
130,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
142,
146
],
[
146,
147
],
[
147,
148
],
[
130,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
149,
159
],
[
159,
160
],
[
160,
161
],
[
149,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
128,
171
],
[
171,
172
],
[
281,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
178,
179
],
[
178,
180
],
[
173,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
184,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
189,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
183,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
173,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
208,
211
],
[
211,
212
],
[
173,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
215,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
220,
225
],
[
225,
226
],
[
225,
227
],
[
220,
228
],
[
228,
229
],
[
229,
230
],
[
220,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
232,
236
],
[
236,
237
],
[
215,
238
],
[
238,
239
],
[
213,
240
],
[
240,
241
],
[
173,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
244,
249
],
[
249,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
249,
254
],
[
254,
255
],
[
254,
256
],
[
249,
257
],
[
257,
258
],
[
258,
259
],
[
249,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
261,
265
],
[
265,
266
],
[
244,
267
],
[
267,
268
],
[
242,
269
],
[
269,
270
],
[
173,
271
],
[
271,
272
],
[
271,
273
],
[
273,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
275,
278
],
[
278,
279
],
[
0,
280
],
[
280,
281
],
[
280,
282
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.util.*;\npublic class Main {\n public static void main(String[] args) {\n// Scanner sc = new Scanner(System.in);\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int n=sc.nextInt();\n int a[]=sc.readArray(n);\n int max=a[0];\n long sum=0;\n for (int i=1;i<n;i++){\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }\n System.out.println(sum);\n\n out.flush();\n\n }\n\n\n\n\n\n\n\n\n\n static void sort(int[] a) {\n ArrayList<Integer> l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n static void sortReverse(long[] a) {\n ArrayList<Long> l=new ArrayList<>();\n for (long i:a) l.add(i);\n// Collections.sort.(l);\n Collections.sort(l,Collections.reverseOrder());\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n String next() {\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n long[] readArrayLong(long n) {\n long[] a=new long[(int)n];\n for (int i=0; i<n; i++) a[i]=nextLong();\n return a;\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n// Scanner sc = new Scanner(System.in);\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int n=sc.nextInt();\n int a[]=sc.readArray(n);\n int max=a[0];\n long sum=0;\n for (int i=1;i<n;i++){\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }\n System.out.println(sum);\n\n out.flush();\n\n }\n\n\n\n\n\n\n\n\n\n static void sort(int[] a) {\n ArrayList<Integer> l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n static void sortReverse(long[] a) {\n ArrayList<Long> l=new ArrayList<>();\n for (long i:a) l.add(i);\n// Collections.sort.(l);\n Collections.sort(l,Collections.reverseOrder());\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n String next() {\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n long[] readArrayLong(long n) {\n long[] a=new long[(int)n];\n for (int i=0; i<n; i++) a[i]=nextLong();\n return a;\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n\n\n}",
"Main",
"public static void main(String[] args) {\n// Scanner sc = new Scanner(System.in);\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int n=sc.nextInt();\n int a[]=sc.readArray(n);\n int max=a[0];\n long sum=0;\n for (int i=1;i<n;i++){\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }\n System.out.println(sum);\n\n out.flush();\n\n }",
"main",
"{\n// Scanner sc = new Scanner(System.in);\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int n=sc.nextInt();\n int a[]=sc.readArray(n);\n int max=a[0];\n long sum=0;\n for (int i=1;i<n;i++){\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }\n System.out.println(sum);\n\n out.flush();\n\n }",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a[]=sc.readArray(n);",
"a",
"sc.readArray(n)",
"sc.readArray",
"sc",
"n",
"int max=a[0];",
"max",
"a[0]",
"a",
"0",
"long sum=0;",
"sum",
"0",
"for (int i=1;i<n;i++){\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }",
"{\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }",
"max=Math.max(a[i],max)",
"max",
"Math.max(a[i],max)",
"Math.max",
"Math",
"a[i]",
"a",
"i",
"max",
"sum+=max-a[i]",
"sum",
"max-a[i]",
"max",
"a[i]",
"a",
"i",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"static void sort(int[] a) {\n ArrayList<Integer> l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }",
"sort",
"{\n ArrayList<Integer> l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }",
"ArrayList<Integer> l=new ArrayList<>();",
"l",
"new ArrayList<>()",
"for (int i:a) l.add(i);",
"int i",
"a",
"l.add(i);",
"l.add(i)",
"l.add",
"l",
"i",
"Collections.sort(l)",
"Collections.sort",
"Collections",
"l",
"for (int i=0; i<a.length; i++) a[i]=l.get(i);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"a[i]=l.get(i);",
"a[i]=l.get(i)",
"a[i]",
"a",
"i",
"l.get(i)",
"l.get",
"l",
"i",
"int[] a",
"a",
"static void sortReverse(long[] a) {\n ArrayList<Long> l=new ArrayList<>();\n for (long i:a) l.add(i);\n// Collections.sort.(l);\n Collections.sort(l,Collections.reverseOrder());\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }",
"sortReverse",
"{\n ArrayList<Long> l=new ArrayList<>();\n for (long i:a) l.add(i);\n// Collections.sort.(l);\n Collections.sort(l,Collections.reverseOrder());\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }",
"ArrayList<Long> l=new ArrayList<>();",
"l",
"new ArrayList<>()",
"for (long i:a) l.add(i);",
"long i",
"a",
"l.add(i);",
"l.add(i)",
"l.add",
"l",
"i",
"Collections.sort(l,Collections.reverseOrder())",
"Collections.sort",
"Collections",
"l",
"Collections.reverseOrder()",
"Collections.reverseOrder",
"Collections",
"for (int i=0; i<a.length; i++) a[i]=l.get(i);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"a[i]=l.get(i);",
"a[i]=l.get(i)",
"a[i]",
"a",
"i",
"l.get(i)",
"l.get",
"l",
"i",
"long[] a",
"a",
"static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n String next() {\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n long[] readArrayLong(long n) {\n long[] a=new long[(int)n];\n for (int i=0; i<n; i++) a[i]=nextLong();\n return a;\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n }",
"FastScanner",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringTokenizer st=new StringTokenizer(\"\");",
"st",
"new StringTokenizer(\"\")",
"String next() {\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }",
"next",
"{\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }",
"while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n st=new StringTokenizer(br.readLine());\n }",
"st=new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }",
"readArray",
"{\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }",
"int[] a=new int[n];",
"a",
"new int[n]",
"n",
"for (int i=0; i<n; i++) a[i]=nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=nextInt();",
"a[i]=nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"long[] readArrayLong(long n) {\n long[] a=new long[(int)n];\n for (int i=0; i<n; i++) a[i]=nextLong();\n return a;\n }",
"readArrayLong",
"{\n long[] a=new long[(int)n];\n for (int i=0; i<n; i++) a[i]=nextLong();\n return a;\n }",
"long[] a=new long[(int)n];",
"a",
"new long[(int)n]",
"(int)n",
"for (int i=0; i<n; i++) a[i]=nextLong();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=nextLong();",
"a[i]=nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"long n",
"n",
"long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public class Main {\n public static void main(String[] args) {\n// Scanner sc = new Scanner(System.in);\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int n=sc.nextInt();\n int a[]=sc.readArray(n);\n int max=a[0];\n long sum=0;\n for (int i=1;i<n;i++){\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }\n System.out.println(sum);\n\n out.flush();\n\n }\n\n\n\n\n\n\n\n\n\n static void sort(int[] a) {\n ArrayList<Integer> l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n static void sortReverse(long[] a) {\n ArrayList<Long> l=new ArrayList<>();\n for (long i:a) l.add(i);\n// Collections.sort.(l);\n Collections.sort(l,Collections.reverseOrder());\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n String next() {\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n long[] readArrayLong(long n) {\n long[] a=new long[(int)n];\n for (int i=0; i<n; i++) a[i]=nextLong();\n return a;\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n\n\n}",
"public class Main {\n public static void main(String[] args) {\n// Scanner sc = new Scanner(System.in);\n FastScanner sc = new FastScanner();\n PrintWriter out = new PrintWriter(System.out);\n int n=sc.nextInt();\n int a[]=sc.readArray(n);\n int max=a[0];\n long sum=0;\n for (int i=1;i<n;i++){\n max=Math.max(a[i],max);\n sum+=max-a[i];\n\n\n }\n System.out.println(sum);\n\n out.flush();\n\n }\n\n\n\n\n\n\n\n\n\n static void sort(int[] a) {\n ArrayList<Integer> l=new ArrayList<>();\n for (int i:a) l.add(i);\n Collections.sort(l);\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n static void sortReverse(long[] a) {\n ArrayList<Long> l=new ArrayList<>();\n for (long i:a) l.add(i);\n// Collections.sort.(l);\n Collections.sort(l,Collections.reverseOrder());\n for (int i=0; i<a.length; i++) a[i]=l.get(i);\n }\n\n static class FastScanner {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n StringTokenizer st=new StringTokenizer(\"\");\n String next() {\n while (!st.hasMoreTokens())\n try {\n st=new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n return st.nextToken();\n }\n\n int nextInt() {\n return Integer.parseInt(next());\n }\n int[] readArray(int n) {\n int[] a=new int[n];\n for (int i=0; i<n; i++) a[i]=nextInt();\n return a;\n }\n long[] readArrayLong(long n) {\n long[] a=new long[(int)n];\n for (int i=0; i<n; i++) a[i]=nextLong();\n return a;\n }\n long nextLong() {\n return Long.parseLong(next());\n }\n }\n\n\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int n=sc.nextInt();
int a[]=sc.readArray(n);
int max=a[0];
long sum=0;
for (int i=1;i<n;i++){
max=Math.max(a[i],max);
sum+=max-a[i];
}
System.out.println(sum);
out.flush();
}
static void sort(int[] a) {
ArrayList<Integer> l=new ArrayList<>();
for (int i:a) l.add(i);
Collections.sort(l);
for (int i=0; i<a.length; i++) a[i]=l.get(i);
}
static void sortReverse(long[] a) {
ArrayList<Long> l=new ArrayList<>();
for (long i:a) l.add(i);
// Collections.sort.(l);
Collections.sort(l,Collections.reverseOrder());
for (int i=0; i<a.length; i++) a[i]=l.get(i);
}
static class FastScanner {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
String next() {
while (!st.hasMoreTokens())
try {
st=new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a=new int[n];
for (int i=0; i<n; i++) a[i]=nextInt();
return a;
}
long[] readArrayLong(long n) {
long[] a=new long[(int)n];
for (int i=0; i<n; i++) a[i]=nextLong();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
99,
5
],
[
99,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
69,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
87,
89
],
[
8,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
6,
96
],
[
96,
97
],
[
0,
98
],
[
98,
99
],
[
98,
100
]
]
| [
"import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\t\t// 身長の入力\n \tint[] tall = new int[n];\n\t\tfor(int i=0;i<n;i++){\n tall[i]= sc.nextInt();\n }\n \n /*--------------------------------*/\n long ans =0;\n for(int l = 0; l<n-1;l++){\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }\n System.out.println(ans);\n\t}\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\t\t// 身長の入力\n \tint[] tall = new int[n];\n\t\tfor(int i=0;i<n;i++){\n tall[i]= sc.nextInt();\n }\n \n /*--------------------------------*/\n long ans =0;\n for(int l = 0; l<n-1;l++){\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }\n System.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\t\t// 身長の入力\n \tint[] tall = new int[n];\n\t\tfor(int i=0;i<n;i++){\n tall[i]= sc.nextInt();\n }\n \n /*--------------------------------*/\n long ans =0;\n for(int l = 0; l<n-1;l++){\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }\n System.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\t\t// 身長の入力\n \tint[] tall = new int[n];\n\t\tfor(int i=0;i<n;i++){\n tall[i]= sc.nextInt();\n }\n \n /*--------------------------------*/\n long ans =0;\n for(int l = 0; l<n-1;l++){\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }\n System.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] tall = new int[n];",
"tall",
"new int[n]",
"n",
"for(int i=0;i<n;i++){\n tall[i]= sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n tall[i]= sc.nextInt();\n }",
"{\n tall[i]= sc.nextInt();\n }",
"tall[i]= sc.nextInt()",
"tall[i]",
"tall",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans =0;",
"ans",
"0",
"for(int l = 0; l<n-1;l++){\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }",
"int l = 0;",
"int l = 0;",
"l",
"0",
"l<n-1",
"l",
"n-1",
"n",
"1",
"l++",
"l++",
"l",
"{\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }",
"{\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }",
"if(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}",
"tall[l] > tall[l+1]",
"tall[l]",
"tall",
"l",
"tall[l+1]",
"tall",
"l+1",
"l",
"1",
"{\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}",
"ans += tall[l] - tall[l+1]",
"ans",
"tall[l] - tall[l+1]",
"tall[l]",
"tall",
"l",
"tall[l+1]",
"tall",
"l+1",
"l",
"1",
"tall[l+1] = tall[l]",
"tall[l+1]",
"tall",
"l+1",
"l",
"1",
"tall[l]",
"tall",
"l",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\t\t// 身長の入力\n \tint[] tall = new int[n];\n\t\tfor(int i=0;i<n;i++){\n tall[i]= sc.nextInt();\n }\n \n /*--------------------------------*/\n long ans =0;\n for(int l = 0; l<n-1;l++){\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }\n System.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t// 整数の入力\n\t\tint n = sc.nextInt();\n\t\t// 身長の入力\n \tint[] tall = new int[n];\n\t\tfor(int i=0;i<n;i++){\n tall[i]= sc.nextInt();\n }\n \n /*--------------------------------*/\n long ans =0;\n for(int l = 0; l<n-1;l++){\n \tif(tall[l] > tall[l+1]){\n \t\tans += tall[l] - tall[l+1];\n \t\ttall[l+1] = tall[l];\n \t}\n }\n System.out.println(ans);\n\t}\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
int n = sc.nextInt();
// 身長の入力
int[] tall = new int[n];
for(int i=0;i<n;i++){
tall[i]= sc.nextInt();
}
/*--------------------------------*/
long ans =0;
for(int l = 0; l<n-1;l++){
if(tall[l] > tall[l+1]){
ans += tall[l] - tall[l+1];
tall[l+1] = tall[l];
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
95,
5
],
[
95,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
55,
56
],
[
56,
57
],
[
47,
58
],
[
59,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
59,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
72,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
6,
92
],
[
92,
93
],
[
0,
94
],
[
94,
95
],
[
94,
96
]
]
| [
"import java.util.*;\n \npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int array[] = new int[num];\n for(int i = 0;i < num;i++){\n array[i] = sc.nextInt();\n }\n long count = 0;\n int max = 0;\n for(int i = 0;i < num;i++){\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }\n System.out.println(count);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int array[] = new int[num];\n for(int i = 0;i < num;i++){\n array[i] = sc.nextInt();\n }\n long count = 0;\n int max = 0;\n for(int i = 0;i < num;i++){\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int array[] = new int[num];\n for(int i = 0;i < num;i++){\n array[i] = sc.nextInt();\n }\n long count = 0;\n int max = 0;\n for(int i = 0;i < num;i++){\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int array[] = new int[num];\n for(int i = 0;i < num;i++){\n array[i] = sc.nextInt();\n }\n long count = 0;\n int max = 0;\n for(int i = 0;i < num;i++){\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int array[] = new int[num];",
"array",
"new int[num]",
"num",
"for(int i = 0;i < num;i++){\n array[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n array[i] = sc.nextInt();\n }",
"{\n array[i] = sc.nextInt();\n }",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long count = 0;",
"count",
"0",
"int max = 0;",
"max",
"0",
"for(int i = 0;i < num;i++){\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }",
"{\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }",
"if(max < array[i]){\n max = array[i];\n }",
"max < array[i]",
"max",
"array[i]",
"array",
"i",
"{\n max = array[i];\n }",
"max = array[i]",
"max",
"array[i]",
"array",
"i",
"if(array[i] < max){\n count += max - array[i];\n }",
"array[i] < max",
"array[i]",
"array",
"i",
"max",
"{\n count += max - array[i];\n }",
"count += max - array[i]",
"count",
"max - array[i]",
"max",
"array[i]",
"array",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int array[] = new int[num];\n for(int i = 0;i < num;i++){\n array[i] = sc.nextInt();\n }\n long count = 0;\n int max = 0;\n for(int i = 0;i < num;i++){\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }\n System.out.println(count);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int array[] = new int[num];\n for(int i = 0;i < num;i++){\n array[i] = sc.nextInt();\n }\n long count = 0;\n int max = 0;\n for(int i = 0;i < num;i++){\n if(max < array[i]){\n max = array[i];\n }\n if(array[i] < max){\n count += max - array[i];\n }\n }\n System.out.println(count);\n }\n}",
"Main"
]
| import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int array[] = new int[num];
for(int i = 0;i < num;i++){
array[i] = sc.nextInt();
}
long count = 0;
int max = 0;
for(int i = 0;i < num;i++){
if(max < array[i]){
max = array[i];
}
if(array[i] < max){
count += max - array[i];
}
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
13,
0,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
12,
13,
30,
14,
2,
2,
13,
17,
40,
4,
18,
13,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
8,
2,
13,
17,
18,
13,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
40,
13,
30,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
279,
11
],
[
279,
12
],
[
12,
13
],
[
279,
14
],
[
14,
15
],
[
279,
16
],
[
16,
17
],
[
16,
18
],
[
279,
19
],
[
19,
20
],
[
19,
21
],
[
279,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
22,
28
],
[
28,
29
],
[
279,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
41
],
[
41,
42
],
[
41,
43
],
[
32,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
44,
52
],
[
52,
53
],
[
53,
54
],
[
44,
55
],
[
56,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
32,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
63,
74
],
[
75,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
75,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
91,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
32,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
279,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
111,
120
],
[
120,
121
],
[
120,
122
],
[
110,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
279,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
279,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
140,
141
],
[
279,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
149,
150
],
[
279,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
158,
159
],
[
279,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
168,
170
],
[
164,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
160,
180
],
[
180,
181
],
[
160,
182
],
[
182,
183
],
[
160,
184
],
[
184,
185
],
[
279,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
188,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
192,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
199,
201
],
[
192,
202
],
[
202,
203
],
[
203,
204
],
[
192,
205
],
[
206,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
209,
212
],
[
212,
213
],
[
212,
214
],
[
206,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
217,
219
],
[
206,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
220,
224
],
[
224,
225
],
[
224,
226
],
[
206,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
227,
231
],
[
186,
232
],
[
232,
233
],
[
279,
234
],
[
234,
235
],
[
234,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
238,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
244,
248
],
[
237,
249
],
[
249,
250
],
[
249,
251
],
[
237,
252
],
[
252,
253
],
[
253,
254
],
[
252,
255
],
[
255,
256
],
[
237,
257
],
[
258,
258
],
[
258,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
261,
263
],
[
258,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
264,
268
],
[
268,
269
],
[
268,
270
],
[
258,
271
],
[
271,
272
],
[
272,
273
],
[
272,
274
],
[
271,
275
],
[
234,
276
],
[
276,
277
],
[
0,
278
],
[
278,
279
],
[
278,
280
]
]
| [
"//package main;\n\nimport java.io.*;\nimport java.util.*;\nimport java.math.*;\n\npublic final class Main {\n BufferedReader br;\n StringTokenizer stk;\n \n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n \n {\n stk = null;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n long mod = 998244353;\n StringBuilder res = new StringBuilder(1000005);\n void run() throws Exception {\n int n = ni();\n long[] a = new long[n];\n long ans = 0;\n for(int i = 0; i < n; i++) {\n a[i] = nl();\n }\n for(int i = 1; i < n; i++) {\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }\n System.out.println(ans);\n }\n \n //Reader & Writer\n String nextToken() throws Exception {\n if (stk == null || !stk.hasMoreTokens())\n stk = new StringTokenizer(br.readLine(), \" \");\n return stk.nextToken();\n }\n\n String nt() throws Exception {\n return nextToken();\n }\n\n int ni() throws Exception {\n return Integer.parseInt(nextToken());\n }\n\n long nl() throws Exception {\n return Long.parseLong(nextToken());\n }\n \n double nd() throws Exception {\n return Double.parseDouble(nextToken());\n }\n \n //Some Misc methods\n int get(int l, int r, int[] a) {\n return l == 0 ? a[r] : a[r] - a[l - 1];\n }\n \n void shuffle(long[] a) {\n Random r = new Random();\n for(int i = 0; i < a.length; i++) {\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }\n }\n \n void reverse(int[] a) {\n for(int i = 0, j = a.length - 1; i < j; i++, j--) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public final class Main {\n BufferedReader br;\n StringTokenizer stk;\n \n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n \n {\n stk = null;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n long mod = 998244353;\n StringBuilder res = new StringBuilder(1000005);\n void run() throws Exception {\n int n = ni();\n long[] a = new long[n];\n long ans = 0;\n for(int i = 0; i < n; i++) {\n a[i] = nl();\n }\n for(int i = 1; i < n; i++) {\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }\n System.out.println(ans);\n }\n \n //Reader & Writer\n String nextToken() throws Exception {\n if (stk == null || !stk.hasMoreTokens())\n stk = new StringTokenizer(br.readLine(), \" \");\n return stk.nextToken();\n }\n\n String nt() throws Exception {\n return nextToken();\n }\n\n int ni() throws Exception {\n return Integer.parseInt(nextToken());\n }\n\n long nl() throws Exception {\n return Long.parseLong(nextToken());\n }\n \n double nd() throws Exception {\n return Double.parseDouble(nextToken());\n }\n \n //Some Misc methods\n int get(int l, int r, int[] a) {\n return l == 0 ? a[r] : a[r] - a[l - 1];\n }\n \n void shuffle(long[] a) {\n Random r = new Random();\n for(int i = 0; i < a.length; i++) {\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }\n }\n \n void reverse(int[] a) {\n for(int i = 0, j = a.length - 1; i < j; i++, j--) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }\n}",
"Main",
"BufferedReader br;",
"br",
"StringTokenizer stk;",
"stk",
"long mod = 998244353;",
"mod",
"998244353",
"StringBuilder res = new StringBuilder(1000005);",
"res",
"new StringBuilder(1000005)",
"public static void main(String[] args) throws Exception {\n new Main().run();\n }",
"main",
"{\n new Main().run();\n }",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"void run() throws Exception {\n int n = ni();\n long[] a = new long[n];\n long ans = 0;\n for(int i = 0; i < n; i++) {\n a[i] = nl();\n }\n for(int i = 1; i < n; i++) {\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }\n System.out.println(ans);\n }",
"run",
"{\n int n = ni();\n long[] a = new long[n];\n long ans = 0;\n for(int i = 0; i < n; i++) {\n a[i] = nl();\n }\n for(int i = 1; i < n; i++) {\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }\n System.out.println(ans);\n }",
"int n = ni();",
"n",
"ni()",
"ni",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"long ans = 0;",
"ans",
"0",
"for(int i = 0; i < n; i++) {\n a[i] = nl();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = nl();\n }",
"{\n a[i] = nl();\n }",
"a[i] = nl()",
"a[i]",
"a",
"i",
"nl()",
"nl",
"for(int i = 1; i < n; i++) {\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }",
"{\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }",
"long diff = a[i] - a[i - 1];",
"diff",
"a[i] - a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }",
"diff < 0",
"diff",
"0",
"{\n ans += -diff;\n a[i] += -diff;\n }",
"ans += -diff",
"ans",
"-diff",
"diff",
"a[i] += -diff",
"a[i]",
"a",
"i",
"-diff",
"diff",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"//Reader & Writer\n String nextToken() throws Exception {\n if (stk == null || !stk.hasMoreTokens())\n stk = new StringTokenizer(br.readLine(), \" \");\n return stk.nextToken();\n }",
"nextToken",
"{\n if (stk == null || !stk.hasMoreTokens())\n stk = new StringTokenizer(br.readLine(), \" \");\n return stk.nextToken();\n }",
"if (stk == null || !stk.hasMoreTokens())\n stk = new StringTokenizer(br.readLine(), \" \");",
"stk == null || !stk.hasMoreTokens()",
"stk == null",
"stk",
"null",
"!stk.hasMoreTokens()",
"stk.hasMoreTokens()",
"stk.hasMoreTokens",
"stk",
"stk = new StringTokenizer(br.readLine(), \" \")",
"stk",
"new StringTokenizer(br.readLine(), \" \")",
"return stk.nextToken();",
"stk.nextToken()",
"stk.nextToken",
"stk",
"String nt() throws Exception {\n return nextToken();\n }",
"nt",
"{\n return nextToken();\n }",
"return nextToken();",
"nextToken()",
"nextToken",
"int ni() throws Exception {\n return Integer.parseInt(nextToken());\n }",
"ni",
"{\n return Integer.parseInt(nextToken());\n }",
"return Integer.parseInt(nextToken());",
"Integer.parseInt(nextToken())",
"Integer.parseInt",
"Integer",
"nextToken()",
"nextToken",
"long nl() throws Exception {\n return Long.parseLong(nextToken());\n }",
"nl",
"{\n return Long.parseLong(nextToken());\n }",
"return Long.parseLong(nextToken());",
"Long.parseLong(nextToken())",
"Long.parseLong",
"Long",
"nextToken()",
"nextToken",
"double nd() throws Exception {\n return Double.parseDouble(nextToken());\n }",
"nd",
"{\n return Double.parseDouble(nextToken());\n }",
"return Double.parseDouble(nextToken());",
"Double.parseDouble(nextToken())",
"Double.parseDouble",
"Double",
"nextToken()",
"nextToken",
"//Some Misc methods\n int get(int l, int r, int[] a) {\n return l == 0 ? a[r] : a[r] - a[l - 1];\n }",
"get",
"{\n return l == 0 ? a[r] : a[r] - a[l - 1];\n }",
"return l == 0 ? a[r] : a[r] - a[l - 1];",
"l == 0 ? a[r] : a[r] - a[l - 1]",
"l == 0",
"l",
"0",
"a[r]",
"a",
"r",
"a[r] - a[l - 1]",
"a[r]",
"a",
"r",
"a[l - 1]",
"a",
"l - 1",
"l",
"1",
"int l",
"l",
"int r",
"r",
"int[] a",
"a",
"void shuffle(long[] a) {\n Random r = new Random();\n for(int i = 0; i < a.length; i++) {\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }\n }",
"shuffle",
"{\n Random r = new Random();\n for(int i = 0; i < a.length; i++) {\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }\n }",
"Random r = new Random();",
"r",
"new Random()",
"for(int i = 0; i < a.length; i++) {\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }",
"{\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }",
"int idx = r.nextInt(a.length);",
"idx",
"r.nextInt(a.length)",
"r.nextInt",
"r",
"a.length",
"a",
"a.length",
"long temp = a[i];",
"temp",
"a[i]",
"a",
"i",
"a[i] = a[idx]",
"a[i]",
"a",
"i",
"a[idx]",
"a",
"idx",
"a[idx] = temp",
"a[idx]",
"a",
"idx",
"temp",
"long[] a",
"a",
"void reverse(int[] a) {\n for(int i = 0, j = a.length - 1; i < j; i++, j--) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }",
"reverse",
"{\n for(int i = 0, j = a.length - 1; i < j; i++, j--) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }",
"for(int i = 0, j = a.length - 1; i < j; i++, j--) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }",
"int i = 0, j = a.length - 1;",
"int i = 0",
"i",
"0",
"j = a.length - 1;",
"j",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"i < j",
"i",
"j",
"i++, j--",
"i++",
"i",
"j--",
"j",
"{\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }",
"{\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }",
"int temp = a[i];",
"temp",
"a[i]",
"a",
"i",
"a[i] = a[j]",
"a[i]",
"a",
"i",
"a[j]",
"a",
"j",
"a[j] = temp",
"a[j]",
"a",
"j",
"temp",
"int[] a",
"a",
"public final class Main {\n BufferedReader br;\n StringTokenizer stk;\n \n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n \n {\n stk = null;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n long mod = 998244353;\n StringBuilder res = new StringBuilder(1000005);\n void run() throws Exception {\n int n = ni();\n long[] a = new long[n];\n long ans = 0;\n for(int i = 0; i < n; i++) {\n a[i] = nl();\n }\n for(int i = 1; i < n; i++) {\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }\n System.out.println(ans);\n }\n \n //Reader & Writer\n String nextToken() throws Exception {\n if (stk == null || !stk.hasMoreTokens())\n stk = new StringTokenizer(br.readLine(), \" \");\n return stk.nextToken();\n }\n\n String nt() throws Exception {\n return nextToken();\n }\n\n int ni() throws Exception {\n return Integer.parseInt(nextToken());\n }\n\n long nl() throws Exception {\n return Long.parseLong(nextToken());\n }\n \n double nd() throws Exception {\n return Double.parseDouble(nextToken());\n }\n \n //Some Misc methods\n int get(int l, int r, int[] a) {\n return l == 0 ? a[r] : a[r] - a[l - 1];\n }\n \n void shuffle(long[] a) {\n Random r = new Random();\n for(int i = 0; i < a.length; i++) {\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }\n }\n \n void reverse(int[] a) {\n for(int i = 0, j = a.length - 1; i < j; i++, j--) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }\n}",
"public final class Main {\n BufferedReader br;\n StringTokenizer stk;\n \n public static void main(String[] args) throws Exception {\n new Main().run();\n }\n \n {\n stk = null;\n br = new BufferedReader(new InputStreamReader(System.in));\n }\n \n long mod = 998244353;\n StringBuilder res = new StringBuilder(1000005);\n void run() throws Exception {\n int n = ni();\n long[] a = new long[n];\n long ans = 0;\n for(int i = 0; i < n; i++) {\n a[i] = nl();\n }\n for(int i = 1; i < n; i++) {\n long diff = a[i] - a[i - 1];\n if(diff < 0) {\n ans += -diff;\n a[i] += -diff;\n }\n }\n System.out.println(ans);\n }\n \n //Reader & Writer\n String nextToken() throws Exception {\n if (stk == null || !stk.hasMoreTokens())\n stk = new StringTokenizer(br.readLine(), \" \");\n return stk.nextToken();\n }\n\n String nt() throws Exception {\n return nextToken();\n }\n\n int ni() throws Exception {\n return Integer.parseInt(nextToken());\n }\n\n long nl() throws Exception {\n return Long.parseLong(nextToken());\n }\n \n double nd() throws Exception {\n return Double.parseDouble(nextToken());\n }\n \n //Some Misc methods\n int get(int l, int r, int[] a) {\n return l == 0 ? a[r] : a[r] - a[l - 1];\n }\n \n void shuffle(long[] a) {\n Random r = new Random();\n for(int i = 0; i < a.length; i++) {\n int idx = r.nextInt(a.length);\n long temp = a[i];\n a[i] = a[idx];\n a[idx] = temp;\n }\n }\n \n void reverse(int[] a) {\n for(int i = 0, j = a.length - 1; i < j; i++, j--) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n }\n}",
"Main"
]
| //package main;
import java.io.*;
import java.util.*;
import java.math.*;
public final class Main {
BufferedReader br;
StringTokenizer stk;
public static void main(String[] args) throws Exception {
new Main().run();
}
{
stk = null;
br = new BufferedReader(new InputStreamReader(System.in));
}
long mod = 998244353;
StringBuilder res = new StringBuilder(1000005);
void run() throws Exception {
int n = ni();
long[] a = new long[n];
long ans = 0;
for(int i = 0; i < n; i++) {
a[i] = nl();
}
for(int i = 1; i < n; i++) {
long diff = a[i] - a[i - 1];
if(diff < 0) {
ans += -diff;
a[i] += -diff;
}
}
System.out.println(ans);
}
//Reader & Writer
String nextToken() throws Exception {
if (stk == null || !stk.hasMoreTokens())
stk = new StringTokenizer(br.readLine(), " ");
return stk.nextToken();
}
String nt() throws Exception {
return nextToken();
}
int ni() throws Exception {
return Integer.parseInt(nextToken());
}
long nl() throws Exception {
return Long.parseLong(nextToken());
}
double nd() throws Exception {
return Double.parseDouble(nextToken());
}
//Some Misc methods
int get(int l, int r, int[] a) {
return l == 0 ? a[r] : a[r] - a[l - 1];
}
void shuffle(long[] a) {
Random r = new Random();
for(int i = 0; i < a.length; i++) {
int idx = r.nextInt(a.length);
long temp = a[i];
a[i] = a[idx];
a[idx] = temp;
}
}
void reverse(int[] a) {
for(int i = 0, j = a.length - 1; i < j; i++, j--) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
0,
18,
13,
17,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
17,
26
],
[
26,
27
],
[
26,
28
],
[
17,
30
],
[
30,
31
],
[
30,
32
],
[
17,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
17,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
60,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
73,
79
],
[
79,
80
],
[
79,
81
],
[
70,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
17,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
15,
97
],
[
97,
98
]
]
| [
"\nimport java.util.Scanner;\nimport java.util.Comparator;\nimport java.util.Arrays;\nimport java.math.BigInteger;\nclass Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n long A[] = new long[N];\n long add = 0;\n A[0] = scan.nextLong();\n for(int i = 1; i < N; i++){\n A[i] = scan.nextLong();\n if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(add);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Comparator;",
"Comparator",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n long A[] = new long[N];\n long add = 0;\n A[0] = scan.nextLong();\n for(int i = 1; i < N; i++){\n A[i] = scan.nextLong();\n if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(add);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n long A[] = new long[N];\n long add = 0;\n A[0] = scan.nextLong();\n for(int i = 1; i < N; i++){\n A[i] = scan.nextLong();\n if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(add);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int N = scan.nextInt();\n long A[] = new long[N];\n long add = 0;\n A[0] = scan.nextLong();\n for(int i = 1; i < N; i++){\n A[i] = scan.nextLong();\n if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(add);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"long A[] = new long[N];",
"A",
"new long[N]",
"N",
"long add = 0;",
"add",
"0",
"A[0] = scan.nextLong()",
"A[0]",
"A",
"0",
"scan.nextLong()",
"scan.nextLong",
"scan",
"for(int i = 1; i < N; i++){\n A[i] = scan.nextLong();\n if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = scan.nextLong();\n if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }\n }",
"{\n A[i] = scan.nextLong();\n if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }\n }",
"A[i] = scan.nextLong()",
"A[i]",
"A",
"i",
"scan.nextLong()",
"scan.nextLong",
"scan",
"if(A[i] < A[i-1]){\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }",
"A[i] < A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{\n add += A[i-1] -A[i];\n A[i] = A[i-1];\n }",
"add += A[i-1] -A[i]",
"add",
"A[i-1] -A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"System.out.println(add)",
"System.out.println",
"System.out",
"System",
"System.out",
"add",
"String[] args",
"args"
]
|
import java.util.Scanner;
import java.util.Comparator;
import java.util.Arrays;
import java.math.BigInteger;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
long A[] = new long[N];
long add = 0;
A[0] = scan.nextLong();
for(int i = 1; i < N; i++){
A[i] = scan.nextLong();
if(A[i] < A[i-1]){
add += A[i-1] -A[i];
A[i] = A[i-1];
}
}
System.out.println(add);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
2,
17,
17,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
4,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
6,
13,
41,
13,
12,
13,
30,
4,
13,
18,
13,
13,
12,
13,
30,
0,
18,
36,
13,
20,
23,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
4,
18,
18,
36,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
13,
18,
13,
13,
37,
20,
29,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
40,
17,
30,
41,
13,
17,
41,
13,
4,
18,
13,
42,
2,
2,
2,
2,
13,
17,
2,
17,
13,
2,
13,
17,
2,
13,
17,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
41,
13,
2,
13,
17,
42,
17,
30,
0,
13,
4,
18,
13,
14,
2,
2,
13,
17,
2,
17,
13,
29,
2,
13,
13,
0,
13,
17,
0,
13,
2,
13,
17,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
18,
13,
13,
30,
41,
13,
17,
41,
13,
4,
18,
13,
42,
2,
2,
2,
2,
13,
17,
2,
17,
13,
2,
13,
17,
2,
13,
17,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
18,
13,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
41,
13,
2,
13,
17,
42,
17,
30,
0,
13,
4,
18,
13,
14,
2,
2,
13,
17,
2,
17,
13,
3,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
13,
17,
29,
2,
13,
13,
41,
13,
17,
0,
13,
4,
18,
13,
42,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
17,
0,
13,
4,
18,
13,
29,
2,
2,
13,
13,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
4,
18,
13,
42,
4,
18,
13,
13,
30,
0,
13,
4,
18,
13,
29,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
20,
41,
13,
4,
18,
13,
42,
4,
18,
13,
13,
30,
0,
13,
4,
18,
13,
42,
2,
2,
13,
40,
17,
40,
4,
18,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
18,
13,
29,
4,
18,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
29,
17,
30,
41,
13,
20,
41,
13,
4,
18,
13,
42,
2,
2,
13,
40,
17,
2,
13,
17,
30,
4,
18,
13,
13,
0,
13,
4,
18,
13,
29,
4,
18,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
2,
4,
13,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
2,
13,
17,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
2,
4,
13,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
2,
13,
17,
4,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
777,
11
],
[
777,
12
],
[
12,
13
],
[
777,
14
],
[
14,
15
],
[
777,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
18,
20
],
[
777,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
23,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
23,
35
],
[
35,
36
],
[
35,
37
],
[
23,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
58,
60
],
[
51,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
64,
70
],
[
70,
71
],
[
70,
72
],
[
61,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
23,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
777,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
86,
92
],
[
92,
93
],
[
777,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
96,
103
],
[
103,
104
],
[
96,
105
],
[
105,
106
],
[
106,
107
],
[
96,
108
],
[
108,
109
],
[
109,
110
],
[
96,
111
],
[
111,
112
],
[
112,
113
],
[
777,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
114,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
126,
134
],
[
134,
135
],
[
114,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
139,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
114,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
154,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
160,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
159,
171
],
[
171,
172
],
[
154,
173
],
[
173,
174
],
[
114,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
181,
185
],
[
185,
186
],
[
186,
187
],
[
178,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
188,
192
],
[
192,
193
],
[
192,
194
],
[
194,
195
],
[
195,
196
],
[
188,
197
],
[
197,
198
],
[
199,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
200,
204
],
[
204,
205
],
[
204,
206
],
[
199,
207
],
[
207,
208
],
[
207,
209
],
[
199,
210
],
[
210,
211
],
[
210,
212
],
[
197,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
188,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
219,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
226,
227
],
[
223,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
231,
232
],
[
219,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
188,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
245,
247
],
[
188,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
254,
255
],
[
250,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
257,
261
],
[
261,
262
],
[
261,
263
],
[
256,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
250,
268
],
[
268,
269
],
[
268,
270
],
[
250,
271
],
[
271,
272
],
[
271,
273
],
[
273,
274
],
[
273,
275
],
[
114,
276
],
[
276,
277
],
[
276,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
282,
286
],
[
286,
287
],
[
287,
288
],
[
287,
289
],
[
279,
290
],
[
290,
291
],
[
291,
292
],
[
291,
293
],
[
290,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
297,
298
],
[
290,
299
],
[
299,
300
],
[
301,
301
],
[
301,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
302,
306
],
[
306,
307
],
[
306,
308
],
[
301,
309
],
[
309,
310
],
[
309,
311
],
[
301,
312
],
[
312,
313
],
[
312,
314
],
[
299,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
318,
319
],
[
319,
320
],
[
290,
321
],
[
321,
322
],
[
322,
323
],
[
322,
324
],
[
321,
325
],
[
325,
326
],
[
326,
327
],
[
326,
328
],
[
328,
329
],
[
325,
330
],
[
330,
331
],
[
330,
332
],
[
332,
333
],
[
333,
334
],
[
321,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
335,
339
],
[
339,
340
],
[
340,
341
],
[
340,
342
],
[
342,
343
],
[
343,
344
],
[
290,
345
],
[
345,
346
],
[
345,
347
],
[
347,
348
],
[
347,
349
],
[
290,
350
],
[
350,
351
],
[
350,
352
],
[
352,
353
],
[
353,
354
],
[
353,
355
],
[
355,
356
],
[
356,
357
],
[
352,
358
],
[
358,
359
],
[
359,
360
],
[
360,
361
],
[
360,
362
],
[
359,
363
],
[
363,
364
],
[
363,
365
],
[
358,
366
],
[
352,
367
],
[
367,
368
],
[
367,
369
],
[
352,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
372,
374
],
[
290,
375
],
[
375,
376
],
[
376,
377
],
[
376,
378
],
[
375,
379
],
[
379,
380
],
[
380,
381
],
[
380,
382
],
[
290,
383
],
[
383,
384
],
[
383,
385
],
[
290,
386
],
[
386,
387
],
[
386,
388
],
[
388,
389
],
[
389,
390
],
[
290,
391
],
[
391,
392
],
[
392,
393
],
[
393,
394
],
[
393,
395
],
[
392,
396
],
[
396,
397
],
[
396,
398
],
[
391,
399
],
[
399,
400
],
[
400,
401
],
[
400,
402
],
[
399,
403
],
[
403,
404
],
[
403,
405
],
[
405,
406
],
[
405,
407
],
[
399,
408
],
[
408,
409
],
[
408,
410
],
[
399,
411
],
[
411,
412
],
[
411,
413
],
[
413,
414
],
[
414,
415
],
[
290,
416
],
[
416,
417
],
[
417,
418
],
[
418,
419
],
[
418,
420
],
[
417,
421
],
[
114,
422
],
[
422,
423
],
[
422,
424
],
[
424,
425
],
[
425,
426
],
[
426,
427
],
[
426,
428
],
[
428,
429
],
[
429,
430
],
[
430,
431
],
[
428,
432
],
[
432,
433
],
[
425,
434
],
[
434,
435
],
[
435,
436
],
[
435,
437
],
[
437,
438
],
[
438,
439
],
[
434,
440
],
[
440,
441
],
[
441,
442
],
[
442,
443
],
[
441,
444
],
[
440,
445
],
[
445,
446
],
[
446,
447
],
[
446,
448
],
[
448,
449
],
[
449,
450
],
[
434,
451
],
[
451,
452
],
[
114,
453
],
[
453,
454
],
[
453,
455
],
[
455,
456
],
[
456,
457
],
[
457,
458
],
[
457,
459
],
[
459,
460
],
[
460,
461
],
[
461,
462
],
[
459,
463
],
[
463,
464
],
[
456,
465
],
[
465,
466
],
[
466,
467
],
[
466,
468
],
[
465,
469
],
[
469,
470
],
[
469,
471
],
[
471,
472
],
[
472,
473
],
[
465,
474
],
[
474,
475
],
[
475,
476
],
[
476,
477
],
[
475,
478
],
[
474,
479
],
[
479,
480
],
[
480,
481
],
[
480,
482
],
[
482,
483
],
[
483,
484
],
[
465,
485
],
[
485,
486
],
[
486,
487
],
[
487,
488
],
[
487,
489
],
[
489,
490
],
[
486,
491
],
[
491,
492
],
[
492,
493
],
[
493,
494
],
[
492,
495
],
[
485,
496
],
[
496,
497
],
[
497,
498
],
[
498,
499
],
[
497,
500
],
[
496,
501
],
[
501,
502
],
[
501,
503
],
[
503,
504
],
[
504,
505
],
[
465,
506
],
[
506,
507
],
[
507,
508
],
[
508,
509
],
[
114,
510
],
[
510,
511
],
[
510,
512
],
[
512,
513
],
[
513,
514
],
[
514,
515
],
[
514,
516
],
[
516,
517
],
[
517,
518
],
[
518,
519
],
[
516,
520
],
[
520,
521
],
[
513,
522
],
[
522,
523
],
[
523,
524
],
[
523,
525
],
[
522,
526
],
[
526,
527
],
[
526,
528
],
[
528,
529
],
[
529,
530
],
[
522,
531
],
[
531,
532
],
[
532,
533
],
[
533,
534
],
[
533,
535
],
[
535,
536
],
[
532,
537
],
[
537,
538
],
[
537,
539
],
[
531,
540
],
[
540,
541
],
[
541,
542
],
[
542,
543
],
[
541,
544
],
[
540,
545
],
[
545,
546
],
[
545,
547
],
[
547,
548
],
[
548,
549
],
[
522,
550
],
[
550,
551
],
[
551,
552
],
[
552,
553
],
[
114,
554
],
[
554,
555
],
[
554,
556
],
[
556,
557
],
[
557,
558
],
[
557,
559
],
[
556,
561
],
[
561,
562
],
[
562,
563
],
[
563,
564
],
[
563,
565
],
[
561,
566
],
[
566,
567
],
[
566,
568
],
[
561,
569
],
[
569,
570
],
[
570,
571
],
[
561,
572
],
[
573,
573
],
[
573,
574
],
[
574,
575
],
[
575,
576
],
[
575,
577
],
[
574,
578
],
[
578,
579
],
[
556,
580
],
[
580,
581
],
[
554,
582
],
[
582,
583
],
[
114,
584
],
[
584,
585
],
[
584,
586
],
[
586,
587
],
[
587,
588
],
[
587,
589
],
[
586,
591
],
[
591,
592
],
[
592,
593
],
[
593,
594
],
[
593,
595
],
[
591,
596
],
[
596,
597
],
[
596,
598
],
[
591,
599
],
[
599,
600
],
[
600,
601
],
[
591,
602
],
[
603,
603
],
[
603,
604
],
[
604,
605
],
[
605,
606
],
[
605,
607
],
[
604,
608
],
[
608,
609
],
[
609,
610
],
[
608,
611
],
[
586,
612
],
[
612,
613
],
[
584,
614
],
[
614,
615
],
[
114,
616
],
[
616,
617
],
[
616,
618
],
[
618,
619
],
[
619,
620
],
[
619,
621
],
[
622,
623
],
[
622,
624
],
[
618,
625
],
[
625,
626
],
[
626,
627
],
[
627,
628
],
[
627,
629
],
[
625,
630
],
[
630,
631
],
[
630,
632
],
[
625,
633
],
[
633,
634
],
[
634,
635
],
[
625,
636
],
[
637,
637
],
[
637,
638
],
[
638,
639
],
[
639,
640
],
[
639,
641
],
[
641,
642
],
[
641,
643
],
[
638,
644
],
[
644,
645
],
[
618,
646
],
[
646,
647
],
[
616,
648
],
[
648,
649
],
[
114,
650
],
[
650,
651
],
[
650,
652
],
[
652,
653
],
[
653,
654
],
[
653,
655
],
[
652,
657
],
[
657,
658
],
[
658,
659
],
[
659,
660
],
[
659,
661
],
[
657,
662
],
[
662,
663
],
[
662,
664
],
[
657,
665
],
[
665,
666
],
[
666,
667
],
[
657,
668
],
[
669,
669
],
[
669,
670
],
[
670,
671
],
[
671,
672
],
[
671,
673
],
[
670,
674
],
[
674,
675
],
[
652,
676
],
[
676,
677
],
[
650,
678
],
[
678,
679
],
[
114,
680
],
[
680,
681
],
[
680,
682
],
[
682,
683
],
[
683,
684
],
[
683,
685
],
[
682,
687
],
[
687,
688
],
[
688,
689
],
[
689,
690
],
[
689,
691
],
[
687,
692
],
[
692,
693
],
[
692,
694
],
[
687,
695
],
[
695,
696
],
[
696,
697
],
[
687,
698
],
[
699,
699
],
[
699,
700
],
[
700,
701
],
[
701,
702
],
[
701,
703
],
[
700,
704
],
[
704,
705
],
[
705,
706
],
[
704,
707
],
[
682,
708
],
[
708,
709
],
[
680,
710
],
[
710,
711
],
[
114,
712
],
[
712,
713
],
[
712,
714
],
[
714,
715
],
[
715,
716
],
[
715,
717
],
[
718,
719
],
[
718,
720
],
[
714,
721
],
[
721,
722
],
[
722,
723
],
[
723,
724
],
[
723,
725
],
[
721,
726
],
[
726,
727
],
[
726,
728
],
[
721,
729
],
[
729,
730
],
[
730,
731
],
[
721,
732
],
[
733,
733
],
[
733,
734
],
[
734,
735
],
[
735,
736
],
[
735,
737
],
[
737,
738
],
[
737,
739
],
[
734,
740
],
[
740,
741
],
[
714,
742
],
[
742,
743
],
[
712,
744
],
[
744,
745
],
[
114,
746
],
[
746,
747
],
[
746,
748
],
[
748,
749
],
[
749,
750
],
[
749,
751
],
[
748,
753
],
[
753,
754
],
[
754,
755
],
[
755,
756
],
[
755,
757
],
[
753,
758
],
[
758,
759
],
[
758,
760
],
[
753,
761
],
[
761,
762
],
[
762,
763
],
[
753,
764
],
[
765,
765
],
[
765,
766
],
[
766,
767
],
[
767,
768
],
[
767,
769
],
[
766,
770
],
[
770,
771
],
[
748,
772
],
[
772,
773
],
[
746,
774
],
[
774,
775
],
[
0,
776
],
[
776,
777
],
[
776,
778
]
]
| [
"import java.io.*;\nimport java.util.*;\nimport java.math.BigDecimal;\n\n@SuppressWarnings(\"unused\")\npublic class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int N = in.nextInt();\n int[] A = in.nextIntArray1Index(N);\n long sum = 0;\n for(int i = 1; i <= N; i++){\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n out.println(sum);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.math.BigDecimal;",
"BigDecimal",
"java.math",
"public class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int N = in.nextInt();\n int[] A = in.nextIntArray1Index(N);\n long sum = 0;\n for(int i = 1; i <= N; i++){\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n out.println(sum);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"Main",
"FastScanner in;",
"in",
"PrintWriter out;",
"out",
"final static int MOD = (int)1e9+7;",
"MOD",
"(int)1e9+7",
"(int)1e9",
"7",
"void solve(){\n int N = in.nextInt();\n int[] A = in.nextIntArray1Index(N);\n long sum = 0;\n for(int i = 1; i <= N; i++){\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n out.println(sum);\n }",
"solve",
"{\n int N = in.nextInt();\n int[] A = in.nextIntArray1Index(N);\n long sum = 0;\n for(int i = 1; i <= N; i++){\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n out.println(sum);\n }",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"int[] A = in.nextIntArray1Index(N);",
"A",
"in.nextIntArray1Index(N)",
"in.nextIntArray1Index",
"in",
"N",
"long sum = 0;",
"sum",
"0",
"for(int i = 1; i <= N; i++){\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }",
"{\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }",
"if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }",
"A[i] < A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }",
"sum += A[i-1] - A[i]",
"sum",
"A[i-1] - A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"out.println(sum)",
"out.println",
"out",
"sum",
"public static void main(String[] args) {\n new Main().m();\n }",
"main",
"{\n new Main().m();\n }",
"new Main().m()",
"new Main().m",
"new Main()",
"String[] args",
"args",
"private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }",
"m",
"{\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }",
"in = new FastScanner(System.in)",
"in",
"new FastScanner(System.in)",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"solve()",
"solve",
"out.flush()",
"out.flush",
"out",
"in.close()",
"in.close",
"in",
"out.close()",
"out.close",
"out",
"static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }",
"FastScanner",
"private Reader input;",
"input",
"public FastScanner() {this(System.in);}",
"FastScanner",
"{this(System.in);}",
"this(System.in)",
"this",
"System.in",
"System",
"System.in",
"public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}",
"FastScanner",
"{this.input = new BufferedReader(new InputStreamReader(stream));}",
"this.input = new BufferedReader(new InputStreamReader(stream))",
"this.input",
"this",
"this.input",
"new BufferedReader(new InputStreamReader(stream))",
"InputStream stream",
"stream",
"public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"close",
"{\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n this.input.close();\n }",
"this.input.close()",
"this.input.close",
"this.input",
"this",
"this.input",
"public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"nextInt",
"{\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();",
"nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE",
"nl < Integer.MIN_VALUE",
"nl",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"nl > Integer.MAX_VALUE",
"nl",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }",
"nextLong",
"{\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }",
"try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }",
"catch (IOException e) {\n e.printStackTrace();\n return -1;\n }",
"IOException e",
"{\n e.printStackTrace();\n return -1;\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return -1;",
"-1",
"1",
"{\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n }",
"int sign = 1;",
"sign",
"1",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b)",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"b != '-'",
"b",
"'-'",
"b != '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }",
"b == '-'",
"b",
"'-'",
"{\n sign = -1;\n b = input.read();\n }",
"sign = -1",
"sign",
"-1",
"1",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '+') {\n b = input.read();\n }",
"b == '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"long ret = b - '0';",
"ret",
"b - '0'",
"b",
"'0'",
"while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }",
"true",
"{\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b < '0' || '9' < b) return ret * sign;",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"return ret * sign;",
"ret * sign",
"ret",
"sign",
"ret *= 10",
"ret",
"10",
"ret += b - '0'",
"ret",
"b - '0'",
"b",
"'0'",
"public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }",
"nextDouble",
"{\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }",
"try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }",
"catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }",
"IOException e",
"{\n e.printStackTrace();\n return Double.NaN;\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return Double.NaN;",
"Double.NaN",
"Double",
"Double.NaN",
"{\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n }",
"double sign = 1;",
"sign",
"1",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b) && b != '-' && b != '+'",
"(b < '0' || '9' < b)",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"b != '-'",
"b",
"'-'",
"b != '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }",
"b == '-'",
"b",
"'-'",
"{\n sign = -1;\n b = input.read();\n }",
"sign = -1",
"sign",
"-1",
"1",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b == '+') {\n b = input.read();\n }",
"b == '+'",
"b",
"'+'",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"double ret = b - '0';",
"ret",
"b - '0'",
"b",
"'0'",
"while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }",
"true",
"{\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"if (b < '0' || '9' < b) break;",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"break;",
"ret *= 10",
"ret",
"10",
"ret += b - '0'",
"ret",
"b - '0'",
"b",
"'0'",
"if (b != '.') return sign * ret;",
"b != '.'",
"b",
"'.'",
"return sign * ret;",
"sign * ret",
"sign",
"ret",
"double div = 1;",
"div",
"1",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }",
"ret *= 10",
"ret",
"10",
"ret += b - '0'",
"ret",
"b - '0'",
"b",
"'0'",
"div *= 10",
"div",
"10",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return sign * ret / div;",
"sign * ret / div",
"sign * ret",
"sign",
"ret",
"div",
"public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }",
"nextChar",
"{\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }",
"try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }",
"catch (IOException e) {\n e.printStackTrace();\n return 0;\n }",
"IOException e",
"{\n e.printStackTrace();\n return 0;\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return 0;",
"0",
"{\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n }",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while (Character.isWhitespace(b)) {\n b = input.read();\n }",
"Character.isWhitespace(b)",
"Character.isWhitespace",
"Character",
"b",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return (char) b;",
"(char) b",
"public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"nextStr",
"{\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"IOException e",
"{\n e.printStackTrace();\n return \"\";\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return \"\";",
"\"\"",
"{\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while (Character.isWhitespace(b)) {\n b = input.read();\n }",
"Character.isWhitespace(b)",
"Character.isWhitespace",
"Character",
"b",
"{\n b = input.read();\n }",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }",
"b != -1 && !Character.isWhitespace(b)",
"b != -1",
"b",
"-1",
"1",
"!Character.isWhitespace(b)",
"Character.isWhitespace(b)",
"Character.isWhitespace",
"Character",
"b",
"{\n sb.append((char) b);\n b = input.read();\n }",
"sb.append((char) b)",
"sb.append",
"sb",
"(char) b",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"nextLine",
"{\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }",
"try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }",
"IOException e",
"{\n e.printStackTrace();\n return \"\";\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"return \"\";",
"\"\"",
"{\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = input.read();",
"b",
"input.read()",
"input.read",
"input",
"while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }",
"b != -1 && b != '\\n'",
"b != -1",
"b",
"-1",
"1",
"b != '\\n'",
"b",
"'\\n'",
"{\n sb.append((char) b);\n b = input.read();\n }",
"sb.append((char) b)",
"sb.append",
"sb",
"(char) b",
"b = input.read()",
"b",
"input.read()",
"input.read",
"input",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }",
"nextIntArray",
"{\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }",
"int[] res = new int[n];",
"res",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextInt();\n }",
"{\n res[i] = nextInt();\n }",
"res[i] = nextInt()",
"res[i]",
"res",
"i",
"nextInt()",
"nextInt",
"return res;",
"res",
"int n",
"n",
"public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }",
"nextIntArrayDec",
"{\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }",
"int[] res = new int[n];",
"res",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextInt() - 1;\n }",
"{\n res[i] = nextInt() - 1;\n }",
"res[i] = nextInt() - 1",
"res[i]",
"res",
"i",
"nextInt() - 1",
"nextInt()",
"nextInt",
"1",
"return res;",
"res",
"int n",
"n",
"public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }",
"nextIntArray1Index",
"{\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }",
"int[] res = new int[n + 1];",
"res",
"new int[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i + 1] = nextInt();\n }",
"{\n res[i + 1] = nextInt();\n }",
"res[i + 1] = nextInt()",
"res[i + 1]",
"res",
"i + 1",
"i",
"1",
"nextInt()",
"nextInt",
"return res;",
"res",
"int n",
"n",
"public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }",
"nextLongArray",
"{\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }",
"long[] res = new long[n];",
"res",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextLong();\n }",
"{\n res[i] = nextLong();\n }",
"res[i] = nextLong()",
"res[i]",
"res",
"i",
"nextLong()",
"nextLong",
"return res;",
"res",
"int n",
"n",
"public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }",
"nextLongArrayDec",
"{\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }",
"long[] res = new long[n];",
"res",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextLong() - 1;\n }",
"{\n res[i] = nextLong() - 1;\n }",
"res[i] = nextLong() - 1",
"res[i]",
"res",
"i",
"nextLong() - 1",
"nextLong()",
"nextLong",
"1",
"return res;",
"res",
"int n",
"n",
"public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }",
"nextLongArray1Index",
"{\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }",
"long[] res = new long[n + 1];",
"res",
"new long[n + 1]",
"n + 1",
"n",
"1",
"for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i + 1] = nextLong();\n }",
"{\n res[i + 1] = nextLong();\n }",
"res[i + 1] = nextLong()",
"res[i + 1]",
"res",
"i + 1",
"i",
"1",
"nextLong()",
"nextLong",
"return res;",
"res",
"int n",
"n",
"public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }",
"nextDoubleArray",
"{\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }",
"double[] res = new double[n];",
"res",
"new double[n]",
"n",
"for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n res[i] = nextDouble();\n }",
"{\n res[i] = nextDouble();\n }",
"res[i] = nextDouble()",
"res[i]",
"res",
"i",
"nextDouble()",
"nextDouble",
"return res;",
"res",
"int n",
"n",
"public class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int N = in.nextInt();\n int[] A = in.nextIntArray1Index(N);\n long sum = 0;\n for(int i = 1; i <= N; i++){\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n out.println(sum);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"public class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int N = in.nextInt();\n int[] A = in.nextIntArray1Index(N);\n long sum = 0;\n for(int i = 1; i <= N; i++){\n if(A[i] < A[i-1]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n out.println(sum);\n }\n \n public static void main(String[] args) {\n new Main().m();\n }\n \n private void m() {\n in = new FastScanner(System.in);\n out = new PrintWriter(System.out);\n /*\n try {\n String path = \"input.txt\";\n out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));\n }catch (IOException e){\n e.printStackTrace();\n }\n */\n solve();\n out.flush();\n in.close();\n out.close();\n }\n \n static class FastScanner {\n private Reader input;\n \n public FastScanner() {this(System.in);}\n public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}\n public void close() {\n try {\n this.input.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n \n public int nextInt() {\n long nl = nextLong();\n if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();\n return (int) nl;\n }\n \n public long nextLong() {\n try {\n int sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n long ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) return ret * sign;\n ret *= 10;\n ret += b - '0';\n }\n } catch (IOException e) {\n e.printStackTrace();\n return -1;\n }\n }\n \n public double nextDouble() {\n try {\n double sign = 1;\n int b = input.read();\n while ((b < '0' || '9' < b) && b != '-' && b != '+') {\n b = input.read();\n }\n if (b == '-') {\n sign = -1;\n b = input.read();\n } else if (b == '+') {\n b = input.read();\n }\n double ret = b - '0';\n while (true) {\n b = input.read();\n if (b < '0' || '9' < b) break;\n ret *= 10;\n ret += b - '0';\n }\n if (b != '.') return sign * ret;\n double div = 1;\n b = input.read();\n while ('0' <= b && b <= '9') {\n ret *= 10;\n ret += b - '0';\n div *= 10;\n b = input.read();\n }\n return sign * ret / div;\n } catch (IOException e) {\n e.printStackTrace();\n return Double.NaN;\n }\n }\n \n public char nextChar() {\n try {\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n return (char) b;\n } catch (IOException e) {\n e.printStackTrace();\n return 0;\n }\n }\n \n public String nextStr() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (Character.isWhitespace(b)) {\n b = input.read();\n }\n while (b != -1 && !Character.isWhitespace(b)) {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public String nextLine() {\n try {\n StringBuilder sb = new StringBuilder();\n int b = input.read();\n while (b != -1 && b != '\\n') {\n sb.append((char) b);\n b = input.read();\n }\n return sb.toString();\n } catch (IOException e) {\n e.printStackTrace();\n return \"\";\n }\n }\n \n public int[] nextIntArray(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt();\n }\n return res;\n }\n \n public int[] nextIntArrayDec(int n) {\n int[] res = new int[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextInt() - 1;\n }\n return res;\n }\n \n public int[] nextIntArray1Index(int n) {\n int[] res = new int[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextInt();\n }\n return res;\n }\n \n public long[] nextLongArray(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong();\n }\n return res;\n }\n \n public long[] nextLongArrayDec(int n) {\n long[] res = new long[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextLong() - 1;\n }\n return res;\n }\n \n public long[] nextLongArray1Index(int n) {\n long[] res = new long[n + 1];\n for (int i = 0; i < n; i++) {\n res[i + 1] = nextLong();\n }\n return res;\n }\n \n public double[] nextDoubleArray(int n) {\n double[] res = new double[n];\n for (int i = 0; i < n; i++) {\n res[i] = nextDouble();\n }\n return res;\n }\n }\n}",
"Main"
]
| import java.io.*;
import java.util.*;
import java.math.BigDecimal;
@SuppressWarnings("unused")
public class Main {
FastScanner in;
PrintWriter out;
final static int MOD = (int)1e9+7;
void solve(){
int N = in.nextInt();
int[] A = in.nextIntArray1Index(N);
long sum = 0;
for(int i = 1; i <= N; i++){
if(A[i] < A[i-1]){
sum += A[i-1] - A[i];
A[i] = A[i-1];
}
}
out.println(sum);
}
public static void main(String[] args) {
new Main().m();
}
private void m() {
in = new FastScanner(System.in);
out = new PrintWriter(System.out);
/*
try {
String path = "input.txt";
out = new PrintWriter(new BufferedWriter(new FileWriter(new File(path))));
}catch (IOException e){
e.printStackTrace();
}
*/
solve();
out.flush();
in.close();
out.close();
}
static class FastScanner {
private Reader input;
public FastScanner() {this(System.in);}
public FastScanner(InputStream stream) {this.input = new BufferedReader(new InputStreamReader(stream));}
public void close() {
try {
this.input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
return (int) nl;
}
public long nextLong() {
try {
int sign = 1;
int b = input.read();
while ((b < '0' || '9' < b) && b != '-' && b != '+') {
b = input.read();
}
if (b == '-') {
sign = -1;
b = input.read();
} else if (b == '+') {
b = input.read();
}
long ret = b - '0';
while (true) {
b = input.read();
if (b < '0' || '9' < b) return ret * sign;
ret *= 10;
ret += b - '0';
}
} catch (IOException e) {
e.printStackTrace();
return -1;
}
}
public double nextDouble() {
try {
double sign = 1;
int b = input.read();
while ((b < '0' || '9' < b) && b != '-' && b != '+') {
b = input.read();
}
if (b == '-') {
sign = -1;
b = input.read();
} else if (b == '+') {
b = input.read();
}
double ret = b - '0';
while (true) {
b = input.read();
if (b < '0' || '9' < b) break;
ret *= 10;
ret += b - '0';
}
if (b != '.') return sign * ret;
double div = 1;
b = input.read();
while ('0' <= b && b <= '9') {
ret *= 10;
ret += b - '0';
div *= 10;
b = input.read();
}
return sign * ret / div;
} catch (IOException e) {
e.printStackTrace();
return Double.NaN;
}
}
public char nextChar() {
try {
int b = input.read();
while (Character.isWhitespace(b)) {
b = input.read();
}
return (char) b;
} catch (IOException e) {
e.printStackTrace();
return 0;
}
}
public String nextStr() {
try {
StringBuilder sb = new StringBuilder();
int b = input.read();
while (Character.isWhitespace(b)) {
b = input.read();
}
while (b != -1 && !Character.isWhitespace(b)) {
sb.append((char) b);
b = input.read();
}
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
return "";
}
}
public String nextLine() {
try {
StringBuilder sb = new StringBuilder();
int b = input.read();
while (b != -1 && b != '\n') {
sb.append((char) b);
b = input.read();
}
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
return "";
}
}
public int[] nextIntArray(int n) {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = nextInt();
}
return res;
}
public int[] nextIntArrayDec(int n) {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = nextInt() - 1;
}
return res;
}
public int[] nextIntArray1Index(int n) {
int[] res = new int[n + 1];
for (int i = 0; i < n; i++) {
res[i + 1] = nextInt();
}
return res;
}
public long[] nextLongArray(int n) {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nextLong();
}
return res;
}
public long[] nextLongArrayDec(int n) {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nextLong() - 1;
}
return res;
}
public long[] nextLongArray1Index(int n) {
long[] res = new long[n + 1];
for (int i = 0; i < n; i++) {
res[i + 1] = nextLong();
}
return res;
}
public double[] nextDoubleArray(int n) {
double[] res = new double[n];
for (int i = 0; i < n; i++) {
res[i] = nextDouble();
}
return res;
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
14,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
17,
29,
17,
29,
17,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
12,
13,
30,
29,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
34,
35
],
[
34,
36
],
[
0,
37
],
[
37,
38
],
[
37,
39
],
[
0,
40
],
[
261,
41
],
[
261,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
56,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
53,
55
],
[
56,
56
],
[
56,
57
],
[
56,
58
],
[
47,
59
],
[
59,
60
],
[
59,
61
],
[
46,
62
],
[
45,
63
],
[
63,
64
],
[
45,
65
],
[
65,
66
],
[
42,
67
],
[
67,
68
],
[
42,
69
],
[
69,
70
],
[
42,
71
],
[
71,
72
],
[
42,
73
],
[
73,
74
],
[
261,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
77,
86
],
[
86,
87
],
[
86,
88
],
[
77,
89
],
[
89,
90
],
[
89,
91
],
[
77,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
111,
112
],
[
77,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
113,
121
],
[
121,
122
],
[
122,
123
],
[
113,
124
],
[
125,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
127,
133
],
[
133,
134
],
[
133,
135
],
[
126,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
145,
147
],
[
136,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
77,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
75,
163
],
[
163,
164
],
[
261,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
165,
169
],
[
169,
170
],
[
165,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
165,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
181,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
180,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
190,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
179,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
165,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
209,
212
],
[
212,
213
],
[
165,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
218,
221
],
[
221,
222
],
[
165,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
227,
230
],
[
230,
231
],
[
165,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
234,
238
],
[
238,
239
],
[
239,
240
],
[
239,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
238,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
248,
249
],
[
249,
250
],
[
234,
251
],
[
251,
252
],
[
165,
253
],
[
253,
254
],
[
253,
255
],
[
255,
256
],
[
256,
257
],
[
253,
258
],
[
258,
259
],
[
0,
260
],
[
260,
261
],
[
260,
262
]
]
| [
"\n\nimport java.io.BufferedReader;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Scanner;\nimport java.util.Set;\nimport java.util.StringTokenizer;\n\n\npublic class Main {\n\t static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }\n\n\t\t\tpublic Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t} \n\t } \n\tpublic static boolean solve(long r, long g, long b, long w) {\n\t\t if((r%2+g%2+b%2+w%2)>1)return false;\n\t\t else return true;\n\t}\n\tpublic static void main(String[] args)throws IOException {\n\t\tFastReader s=new FastReader();\t\t\n\t\tint n = s.nextInt(); \n\t\tlong sum=0;\n long[] ar = new long[n];\n for (int i=0; i<n; i++) {\n \tar[i]=s.nextLong();\n \t\n }\n for (int i=1; i<n; i++) {\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }\n System.out.println(sum);\n \n \n\t}\n\t\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Collections;",
"Collections",
"java.util",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\t static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }\n\n\t\t\tpublic Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t} \n\t } \n\tpublic static boolean solve(long r, long g, long b, long w) {\n\t\t if((r%2+g%2+b%2+w%2)>1)return false;\n\t\t else return true;\n\t}\n\tpublic static void main(String[] args)throws IOException {\n\t\tFastReader s=new FastReader();\t\t\n\t\tint n = s.nextInt(); \n\t\tlong sum=0;\n long[] ar = new long[n];\n for (int i=0; i<n; i++) {\n \tar[i]=s.nextLong();\n \t\n }\n for (int i=1; i<n; i++) {\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }\n System.out.println(sum);\n \n \n\t}\n\t\n}",
"Main",
"public static boolean solve(long r, long g, long b, long w) {\n\t\t if((r%2+g%2+b%2+w%2)>1)return false;\n\t\t else return true;\n\t}",
"solve",
"{\n\t\t if((r%2+g%2+b%2+w%2)>1)return false;\n\t\t else return true;\n\t}",
"if((r%2+g%2+b%2+w%2)>1)return false;\n\t\t else return true;",
"(r%2+g%2+b%2+w%2)>1",
"(r%2+g%2+b%2+w%2)",
"b%2",
"r%2+g%2+b%2+w%2",
"r%2",
"r",
"2",
"g%2",
"g",
"2",
"b%2",
"b",
"2",
"w%2",
"w",
"2",
"1",
"return false;",
"false",
"return true;",
"true",
"long r",
"r",
"long g",
"g",
"long b",
"b",
"long w",
"w",
"public static void main(String[] args)throws IOException {\n\t\tFastReader s=new FastReader();\t\t\n\t\tint n = s.nextInt(); \n\t\tlong sum=0;\n long[] ar = new long[n];\n for (int i=0; i<n; i++) {\n \tar[i]=s.nextLong();\n \t\n }\n for (int i=1; i<n; i++) {\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }\n System.out.println(sum);\n \n \n\t}",
"main",
"{\n\t\tFastReader s=new FastReader();\t\t\n\t\tint n = s.nextInt(); \n\t\tlong sum=0;\n long[] ar = new long[n];\n for (int i=0; i<n; i++) {\n \tar[i]=s.nextLong();\n \t\n }\n for (int i=1; i<n; i++) {\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }\n System.out.println(sum);\n \n \n\t}",
"FastReader s=new FastReader();",
"s",
"new FastReader()",
"int n = s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"long sum=0;",
"sum",
"0",
"long[] ar = new long[n];",
"ar",
"new long[n]",
"n",
"for (int i=0; i<n; i++) {\n \tar[i]=s.nextLong();\n \t\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \tar[i]=s.nextLong();\n \t\n }",
"{\n \tar[i]=s.nextLong();\n \t\n }",
"ar[i]=s.nextLong()",
"ar[i]",
"ar",
"i",
"s.nextLong()",
"s.nextLong",
"s",
"for (int i=1; i<n; i++) {\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }",
"{\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }",
"if(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}",
"ar[i-1]>ar[i]",
"ar[i-1]",
"ar",
"i-1",
"i",
"1",
"ar[i]",
"ar",
"i",
"{\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}",
"sum+=ar[i-1]-ar[i]",
"sum",
"ar[i-1]-ar[i]",
"ar[i-1]",
"ar",
"i-1",
"i",
"1",
"ar[i]",
"ar",
"i",
"ar[i]=ar[i-1]",
"ar[i]",
"ar",
"i",
"ar[i-1]",
"ar",
"i-1",
"i",
"1",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }\n\n\t\t\tpublic Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t} \n\t }",
"FastReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t }",
"FastReader",
"{ \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t }",
"br = new BufferedReader(new\n\t InputStreamReader(System.in))",
"br",
"new BufferedReader(new\n\t InputStreamReader(System.in))",
"String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t }",
"next",
"{ \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t }",
"while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t }",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{ \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t }",
"try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"IOException e",
"{ \n\t e.printStackTrace(); \n\t }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n\t st = new StringTokenizer(br.readLine()); \n\t }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t }",
"nextInt",
"{ \n\t return Integer.parseInt(next()); \n\t }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t }",
"nextLong",
"{ \n\t return Long.parseLong(next()); \n\t }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t }",
"nextDouble",
"{ \n\t return Double.parseDouble(next()); \n\t }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }",
"nextLine",
"{ \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }",
"String str = \"\";",
"str",
"\"\"",
"try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t }",
"IOException e",
"{ \n\t e.printStackTrace(); \n\t }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n\t str = br.readLine(); \n\t }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t}",
"charAt",
"{\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t}",
"return null;",
"null",
"int i",
"i",
"public class Main {\n\t static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }\n\n\t\t\tpublic Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t} \n\t } \n\tpublic static boolean solve(long r, long g, long b, long w) {\n\t\t if((r%2+g%2+b%2+w%2)>1)return false;\n\t\t else return true;\n\t}\n\tpublic static void main(String[] args)throws IOException {\n\t\tFastReader s=new FastReader();\t\t\n\t\tint n = s.nextInt(); \n\t\tlong sum=0;\n long[] ar = new long[n];\n for (int i=0; i<n; i++) {\n \tar[i]=s.nextLong();\n \t\n }\n for (int i=1; i<n; i++) {\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }\n System.out.println(sum);\n \n \n\t}\n\t\n}",
"public class Main {\n\t static class FastReader \n\t { \n\t BufferedReader br; \n\t StringTokenizer st; \n\t \n\t \n\t public FastReader() \n\t { \n\t br = new BufferedReader(new\n\t InputStreamReader(System.in)); \n\t } \n\t \n\t String next() \n\t { \n\t while (st == null || !st.hasMoreTokens()) \n\t { \n\t try\n\t { \n\t st = new StringTokenizer(br.readLine()); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t } \n\t return st.nextToken();\n\t \n\t } \n\t \n\t int nextInt() \n\t { \n\t return Integer.parseInt(next()); \n\t } \n\t \n\t long nextLong() \n\t { \n\t return Long.parseLong(next()); \n\t } \n\t \n\t double nextDouble() \n\t { \n\t return Double.parseDouble(next()); \n\t } \n\t \n\t String nextLine() \n\t { \n\t String str = \"\"; \n\t try\n\t { \n\t str = br.readLine(); \n\t } \n\t catch (IOException e) \n\t { \n\t e.printStackTrace(); \n\t } \n\t return str; \n\t }\n\n\t\t\tpublic Character charAt(int i) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\treturn null;\n\t\t\t} \n\t } \n\tpublic static boolean solve(long r, long g, long b, long w) {\n\t\t if((r%2+g%2+b%2+w%2)>1)return false;\n\t\t else return true;\n\t}\n\tpublic static void main(String[] args)throws IOException {\n\t\tFastReader s=new FastReader();\t\t\n\t\tint n = s.nextInt(); \n\t\tlong sum=0;\n long[] ar = new long[n];\n for (int i=0; i<n; i++) {\n \tar[i]=s.nextLong();\n \t\n }\n for (int i=1; i<n; i++) {\n \tif(ar[i-1]>ar[i]) {\n \t\tsum+=ar[i-1]-ar[i];\n \t\tar[i]=ar[i-1];\n \t\t\n \t}\n }\n System.out.println(sum);\n \n \n\t}\n\t\n}",
"Main"
]
|
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;
public class Main {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreTokens())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
public Character charAt(int i) {
// TODO Auto-generated method stub
return null;
}
}
public static boolean solve(long r, long g, long b, long w) {
if((r%2+g%2+b%2+w%2)>1)return false;
else return true;
}
public static void main(String[] args)throws IOException {
FastReader s=new FastReader();
int n = s.nextInt();
long sum=0;
long[] ar = new long[n];
for (int i=0; i<n; i++) {
ar[i]=s.nextLong();
}
for (int i=1; i<n; i++) {
if(ar[i-1]>ar[i]) {
sum+=ar[i-1]-ar[i];
ar[i]=ar[i-1];
}
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
17,
17,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
12,
13,
30,
0,
13,
20,
2,
13,
17,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
13,
2,
13,
17,
1,
0,
13,
2,
13,
40,
13,
30,
30,
0,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
13,
2,
13,
18,
13,
13,
1,
0,
13,
2,
13,
40,
13,
30,
30,
0,
18,
13,
13,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
41,
13,
17,
12,
13,
30,
0,
13,
20,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
13,
0,
18,
13,
13,
17,
23,
13,
12,
13,
30,
14,
2,
18,
13,
13,
13,
29,
13,
29,
0,
18,
13,
13,
4,
13,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
13,
41,
13,
4,
13,
13,
14,
2,
13,
13,
29,
0,
18,
13,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
13,
41,
13,
4,
13,
13,
29,
2,
13,
13,
23,
13,
23,
13,
6,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
13,
29,
4,
13,
2,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
8,
2,
2,
13,
13,
17,
2,
13,
13,
2,
2,
13,
13,
17,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
17,
14,
2,
2,
13,
17,
17,
30,
41,
13,
2,
2,
13,
13,
13,
29,
4,
13,
13,
2,
13,
17,
30,
29,
2,
2,
13,
4,
13,
13,
2,
13,
17,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
29,
17,
30,
41,
13,
4,
18,
13,
14,
2,
13,
17,
30,
29,
17,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
6,
13,
12,
13,
23,
13,
23,
13,
23,
13,
6,
13,
12,
13,
30,
23,
13,
23,
13,
23,
13,
13,
6,
13,
12,
13,
30,
23,
13,
23,
13,
23,
13,
13,
6,
13,
12,
13,
30,
23,
13,
23,
13,
23,
13,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
13,
4,
18,
13,
17,
2,
13,
13,
0,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
4,
18,
13,
13,
2,
13,
17,
4,
18,
13,
8,
2,
2,
13,
17,
17,
17,
17,
23,
13,
23,
13,
23,
13,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
4,
18,
13,
2,
4,
18,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
638,
23
],
[
638,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
26,
28
],
[
638,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
34,
36
],
[
31,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
39,
41
],
[
31,
42
],
[
42,
43
],
[
42,
44
],
[
31,
45
],
[
45,
46
],
[
45,
47
],
[
31,
48
],
[
48,
49
],
[
48,
50
],
[
31,
51
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
51,
55
],
[
51,
56
],
[
31,
57
],
[
57,
58
],
[
58,
59
],
[
29,
60
],
[
60,
61
],
[
638,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
62,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
72,
73
],
[
72,
74
],
[
66,
75
],
[
75,
76
],
[
62,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
83,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
83,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
79,
105
],
[
105,
106
],
[
77,
107
],
[
107,
108
],
[
62,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
112,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
112,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
109,
136
],
[
136,
137
],
[
109,
138
],
[
138,
139
],
[
638,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
140,
144
],
[
144,
145
],
[
140,
146
],
[
146,
147
],
[
146,
148
],
[
140,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
151,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
165,
166
],
[
165,
167
],
[
160,
168
],
[
168,
169
],
[
169,
170
],
[
160,
171
],
[
172,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
173,
177
],
[
172,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
178,
182
],
[
149,
183
],
[
183,
184
],
[
140,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
189,
193
],
[
188,
194
],
[
194,
195
],
[
187,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
203,
205
],
[
185,
206
],
[
206,
207
],
[
140,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
213,
215
],
[
210,
216
],
[
216,
217
],
[
216,
218
],
[
218,
219
],
[
218,
220
],
[
210,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
221,
225
],
[
210,
226
],
[
226,
227
],
[
227,
228
],
[
227,
229
],
[
226,
230
],
[
210,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
231,
235
],
[
235,
236
],
[
235,
237
],
[
210,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
240,
243
],
[
240,
244
],
[
244,
245
],
[
244,
246
],
[
208,
247
],
[
247,
248
],
[
208,
249
],
[
249,
250
],
[
140,
251
],
[
251,
252
],
[
251,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
256,
258
],
[
253,
259
],
[
259,
260
],
[
259,
261
],
[
261,
262
],
[
261,
263
],
[
253,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
251,
268
],
[
268,
269
],
[
251,
270
],
[
270,
271
],
[
638,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
274,
276
],
[
276,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
277,
281
],
[
281,
282
],
[
282,
283
],
[
276,
284
],
[
284,
285
],
[
285,
286
],
[
285,
287
],
[
287,
288
],
[
287,
289
],
[
285,
290
],
[
274,
291
],
[
291,
292
],
[
274,
293
],
[
293,
294
],
[
272,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
300,
301
],
[
301,
302
],
[
301,
303
],
[
300,
304
],
[
299,
305
],
[
305,
306
],
[
305,
307
],
[
299,
308
],
[
308,
309
],
[
309,
310
],
[
309,
311
],
[
308,
312
],
[
295,
313
],
[
313,
314
],
[
295,
315
],
[
315,
316
],
[
272,
317
],
[
317,
318
],
[
317,
319
],
[
319,
320
],
[
320,
321
],
[
321,
322
],
[
321,
323
],
[
320,
324
],
[
324,
325
],
[
325,
326
],
[
319,
327
],
[
327,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
328,
332
],
[
327,
333
],
[
333,
334
],
[
334,
335
],
[
334,
336
],
[
336,
337
],
[
337,
338
],
[
337,
339
],
[
336,
340
],
[
333,
341
],
[
341,
342
],
[
342,
343
],
[
342,
344
],
[
342,
345
],
[
345,
346
],
[
345,
347
],
[
327,
348
],
[
348,
349
],
[
349,
350
],
[
350,
351
],
[
351,
352
],
[
351,
353
],
[
353,
354
],
[
353,
355
],
[
353,
356
],
[
356,
357
],
[
356,
358
],
[
350,
359
],
[
317,
360
],
[
360,
361
],
[
317,
362
],
[
362,
363
],
[
638,
364
],
[
364,
365
],
[
364,
366
],
[
366,
367
],
[
364,
368
],
[
368,
369
],
[
364,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
373,
374
],
[
373,
375
],
[
370,
376
],
[
376,
377
],
[
364,
378
],
[
378,
379
],
[
378,
380
],
[
380,
381
],
[
381,
382
],
[
382,
383
],
[
383,
384
],
[
383,
385
],
[
382,
386
],
[
386,
387
],
[
387,
388
],
[
388,
389
],
[
381,
390
],
[
390,
391
],
[
391,
392
],
[
392,
393
],
[
392,
394
],
[
394,
395
],
[
395,
396
],
[
391,
397
],
[
397,
398
],
[
398,
399
],
[
398,
400
],
[
400,
401
],
[
401,
402
],
[
397,
403
],
[
403,
404
],
[
404,
405
],
[
404,
406
],
[
403,
407
],
[
407,
408
],
[
408,
409
],
[
397,
410
],
[
410,
411
],
[
410,
412
],
[
380,
413
],
[
413,
414
],
[
414,
415
],
[
415,
416
],
[
364,
417
],
[
417,
418
],
[
417,
419
],
[
419,
420
],
[
420,
421
],
[
421,
422
],
[
422,
423
],
[
421,
424
],
[
424,
425
],
[
364,
426
],
[
426,
427
],
[
426,
428
],
[
428,
429
],
[
429,
430
],
[
430,
431
],
[
431,
432
],
[
430,
433
],
[
433,
434
],
[
638,
435
],
[
435,
436
],
[
435,
437
],
[
437,
438
],
[
437,
439
],
[
439,
440
],
[
437,
441
],
[
441,
442
],
[
437,
443
],
[
443,
444
],
[
638,
445
],
[
445,
446
],
[
445,
447
],
[
447,
448
],
[
447,
449
],
[
447,
450
],
[
450,
451
],
[
447,
452
],
[
452,
453
],
[
447,
454
],
[
454,
455
],
[
445,
456
],
[
638,
457
],
[
457,
458
],
[
457,
459
],
[
459,
460
],
[
459,
461
],
[
459,
462
],
[
462,
463
],
[
459,
464
],
[
464,
465
],
[
459,
466
],
[
466,
467
],
[
457,
468
],
[
638,
469
],
[
469,
470
],
[
469,
471
],
[
471,
472
],
[
471,
473
],
[
471,
474
],
[
474,
475
],
[
471,
476
],
[
476,
477
],
[
471,
478
],
[
478,
479
],
[
469,
480
],
[
638,
481
],
[
481,
482
],
[
481,
483
],
[
483,
484
],
[
483,
485
],
[
485,
486
],
[
486,
487
],
[
486,
488
],
[
488,
489
],
[
489,
490
],
[
485,
491
],
[
491,
492
],
[
491,
493
],
[
485,
494
],
[
494,
495
],
[
494,
496
],
[
485,
497
],
[
497,
498
],
[
498,
499
],
[
499,
500
],
[
499,
501
],
[
497,
502
],
[
502,
503
],
[
502,
504
],
[
497,
505
],
[
505,
506
],
[
506,
507
],
[
497,
508
],
[
509,
509
],
[
509,
510
],
[
510,
511
],
[
510,
512
],
[
512,
513
],
[
513,
514
],
[
509,
515
],
[
515,
516
],
[
515,
517
],
[
517,
518
],
[
518,
519
],
[
517,
520
],
[
517,
521
],
[
521,
522
],
[
521,
523
],
[
509,
524
],
[
524,
525
],
[
524,
526
],
[
526,
527
],
[
527,
528
],
[
526,
529
],
[
526,
530
],
[
485,
531
],
[
531,
532
],
[
532,
533
],
[
531,
534
],
[
483,
535
],
[
535,
536
],
[
483,
537
],
[
537,
538
],
[
483,
539
],
[
539,
540
],
[
481,
541
],
[
638,
542
],
[
542,
543
],
[
542,
544
],
[
544,
545
],
[
544,
546
],
[
546,
547
],
[
547,
548
],
[
547,
549
],
[
549,
550
],
[
550,
551
],
[
546,
552
],
[
552,
553
],
[
552,
554
],
[
546,
555
],
[
555,
556
],
[
556,
557
],
[
557,
558
],
[
557,
559
],
[
555,
560
],
[
560,
561
],
[
560,
562
],
[
562,
563
],
[
563,
564
],
[
555,
565
],
[
565,
566
],
[
566,
567
],
[
555,
568
],
[
569,
569
],
[
569,
570
],
[
570,
571
],
[
570,
572
],
[
572,
573
],
[
573,
574
],
[
572,
575
],
[
575,
576
],
[
576,
577
],
[
575,
578
],
[
575,
579
],
[
579,
580
],
[
579,
581
],
[
546,
582
],
[
582,
583
],
[
583,
584
],
[
582,
585
],
[
585,
586
],
[
586,
587
],
[
587,
588
],
[
587,
589
],
[
586,
590
],
[
585,
591
],
[
585,
592
],
[
544,
593
],
[
593,
594
],
[
544,
595
],
[
595,
596
],
[
544,
597
],
[
597,
598
],
[
542,
599
],
[
638,
600
],
[
600,
601
],
[
600,
602
],
[
602,
603
],
[
602,
604
],
[
604,
605
],
[
605,
606
],
[
605,
607
],
[
607,
608
],
[
608,
609
],
[
604,
610
],
[
610,
611
],
[
610,
612
],
[
612,
613
],
[
613,
614
],
[
604,
615
],
[
615,
616
],
[
615,
617
],
[
617,
618
],
[
618,
619
],
[
604,
620
],
[
620,
621
],
[
621,
622
],
[
620,
623
],
[
623,
624
],
[
624,
625
],
[
625,
626
],
[
624,
627
],
[
624,
628
],
[
623,
629
],
[
602,
630
],
[
630,
631
],
[
602,
632
],
[
632,
633
],
[
602,
634
],
[
634,
635
],
[
600,
636
],
[
0,
637
],
[
637,
638
],
[
637,
639
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.StringTokenizer;\n\npublic class Main\n{\n\tstatic int MOD = (int) 1e9 + 7;\n\t\n\tstatic class FenwickTree\n\t{\n\t\t// bit[1] ~ bit[n]\n\t\tlong[] bit; // = new long[n+1];\n\t\t\n\t\tpublic FenwickTree(int n)\n\t\t{\n\t\t\tbit = new long[n+1];\n\t\t}\n\t\t\n\t\t// bit[1] + ... + bit[r]\n\t\tlong sum(int r)\n\t\t{\n\t\t\tlong s = 0;\n\t\t\tfor( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\t\t\n\t\tvoid add(int idx, int x)\n\t\t{\n\t\t\tfor( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class UnionFind\n\t{\n\t\tint[] par;\n\t\tint[] n_nodes;\n\t\tint max = 1;\n\t\t\n\t\tpublic UnionFind(int n)\n\t\t{\n\t\t\tpar = new int[n];\n\t\t\tn_nodes = new int[n];\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint root(int x)\n\t\t{\n\t\t\tif( par[x] == x ) return x;\n\t\t\treturn par[x] = root(par[x]);\n\t\t}\n\t\t\n\t\tvoid unite(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\tif( rx == ry ) return;\n\t\t\tpar[rx] = ry;\n\t\t\tn_nodes[ry] += n_nodes[rx];\n\t\t\tmax = Math.max(max, n_nodes[ry]);\n\t\t}\n\t\t\n\t\tboolean same(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\treturn rx == ry;\n\t\t}\n\t}\n\t\n\tstatic class Calc\n\t{\n\t\tstatic int gcd(int a, int b)\n\t\t{\n\t\t\tif( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\treturn gcd(b%a, a);\n\t\t}\n\t\t\n\t\tstatic int ceilInt(int a, int b)\n\t\t{\n\t\t\treturn (a%b==0 ? a/b : a/b+1);\n\t\t}\n\n\t\tstatic long power(long x, long n)\n\t\t{\n\t\t\tif( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tstatic class MyScanner\n\t{\n\t\tprivate BufferedReader in;\n\t\tprivate StringTokenizer st;\n\t\t\n\t\tpublic MyScanner(InputStream stream)\n\t\t{\n\t\t\tin = new BufferedReader(new InputStreamReader(stream));\n\t\t}\n\t\t\n\t\tpublic String next()\n\t\t{\n\t\t\twhile( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\t\n\tstatic interface Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out);\n\t}\n\t\n\tstatic class F implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class E implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class D implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\t\n\tstatic class C implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tlong ans = 0;\n\t\t\tint max = 0;\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}\n\t}\n\t\n\tstatic class B implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tString n = in.next();\n\t\t\tint mod = 0;\n\t\t\tfor( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}\n\t\t\tout.println(mod%9==0? \"Yes\" : \"No\");\n\t\t}\n\t}\n\n\tstatic class A implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tint x = in.nextInt();\n\t\t\tint t = in.nextInt();\n\t\t\tout.println(Calc.ceilInt(n, x) * t);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args)\n\t{\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tMyScanner in = new MyScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolver solver = new C();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main\n{\n\tstatic int MOD = (int) 1e9 + 7;\n\t\n\tstatic class FenwickTree\n\t{\n\t\t// bit[1] ~ bit[n]\n\t\tlong[] bit; // = new long[n+1];\n\t\t\n\t\tpublic FenwickTree(int n)\n\t\t{\n\t\t\tbit = new long[n+1];\n\t\t}\n\t\t\n\t\t// bit[1] + ... + bit[r]\n\t\tlong sum(int r)\n\t\t{\n\t\t\tlong s = 0;\n\t\t\tfor( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\t\t\n\t\tvoid add(int idx, int x)\n\t\t{\n\t\t\tfor( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class UnionFind\n\t{\n\t\tint[] par;\n\t\tint[] n_nodes;\n\t\tint max = 1;\n\t\t\n\t\tpublic UnionFind(int n)\n\t\t{\n\t\t\tpar = new int[n];\n\t\t\tn_nodes = new int[n];\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint root(int x)\n\t\t{\n\t\t\tif( par[x] == x ) return x;\n\t\t\treturn par[x] = root(par[x]);\n\t\t}\n\t\t\n\t\tvoid unite(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\tif( rx == ry ) return;\n\t\t\tpar[rx] = ry;\n\t\t\tn_nodes[ry] += n_nodes[rx];\n\t\t\tmax = Math.max(max, n_nodes[ry]);\n\t\t}\n\t\t\n\t\tboolean same(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\treturn rx == ry;\n\t\t}\n\t}\n\t\n\tstatic class Calc\n\t{\n\t\tstatic int gcd(int a, int b)\n\t\t{\n\t\t\tif( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\treturn gcd(b%a, a);\n\t\t}\n\t\t\n\t\tstatic int ceilInt(int a, int b)\n\t\t{\n\t\t\treturn (a%b==0 ? a/b : a/b+1);\n\t\t}\n\n\t\tstatic long power(long x, long n)\n\t\t{\n\t\t\tif( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tstatic class MyScanner\n\t{\n\t\tprivate BufferedReader in;\n\t\tprivate StringTokenizer st;\n\t\t\n\t\tpublic MyScanner(InputStream stream)\n\t\t{\n\t\t\tin = new BufferedReader(new InputStreamReader(stream));\n\t\t}\n\t\t\n\t\tpublic String next()\n\t\t{\n\t\t\twhile( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\t\n\tstatic interface Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out);\n\t}\n\t\n\tstatic class F implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class E implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class D implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\t\n\tstatic class C implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tlong ans = 0;\n\t\t\tint max = 0;\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}\n\t}\n\t\n\tstatic class B implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tString n = in.next();\n\t\t\tint mod = 0;\n\t\t\tfor( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}\n\t\t\tout.println(mod%9==0? \"Yes\" : \"No\");\n\t\t}\n\t}\n\n\tstatic class A implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tint x = in.nextInt();\n\t\t\tint t = in.nextInt();\n\t\t\tout.println(Calc.ceilInt(n, x) * t);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args)\n\t{\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tMyScanner in = new MyScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolver solver = new C();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}",
"Main",
"static int MOD = (int) 1e9 + 7;",
"MOD",
"(int) 1e9 + 7",
"(int) 1e9",
"7",
"public static void main(String[] args)\n\t{\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tMyScanner in = new MyScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolver solver = new C();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}",
"main",
"{\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tMyScanner in = new MyScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolver solver = new C();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"MyScanner in = new MyScanner(inputStream);",
"in",
"new MyScanner(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"Solver solver = new C();",
"solver",
"new C()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class FenwickTree\n\t{\n\t\t// bit[1] ~ bit[n]\n\t\tlong[] bit; // = new long[n+1];\n\t\t\n\t\tpublic FenwickTree(int n)\n\t\t{\n\t\t\tbit = new long[n+1];\n\t\t}\n\t\t\n\t\t// bit[1] + ... + bit[r]\n\t\tlong sum(int r)\n\t\t{\n\t\t\tlong s = 0;\n\t\t\tfor( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\t\t\n\t\tvoid add(int idx, int x)\n\t\t{\n\t\t\tfor( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}\n\t\t}\n\t}",
"FenwickTree",
"// bit[1] ~ bit[n]\n\t\tlong[] bit; // = new long[n+1];",
"bit",
"public FenwickTree(int n)\n\t\t{\n\t\t\tbit = new long[n+1];\n\t\t}",
"FenwickTree",
"{\n\t\t\tbit = new long[n+1];\n\t\t}",
"bit = new long[n+1]",
"bit",
"new long[n+1]",
"n+1",
"n",
"1",
"int n",
"n",
"// bit[1] + ... + bit[r]\n\t\tlong sum(int r)\n\t\t{\n\t\t\tlong s = 0;\n\t\t\tfor( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}\n\t\t\treturn s;\n\t\t}",
"sum",
"{\n\t\t\tlong s = 0;\n\t\t\tfor( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}\n\t\t\treturn s;\n\t\t}",
"long s = 0;",
"s",
"0",
"for( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}",
"int i=r;",
"int i=r;",
"i",
"r",
"i>0",
"i",
"0",
"i-=(i & -i)",
"i-=(i & -i)",
"i",
"(i & -i)",
"i",
"-i",
"i",
"{\n\t\t\t\ts += bit[i];\n\t\t\t}",
"{\n\t\t\t\ts += bit[i];\n\t\t\t}",
"s += bit[i]",
"s",
"bit[i]",
"bit",
"i",
"return s;",
"s",
"int r",
"r",
"void add(int idx, int x)\n\t\t{\n\t\t\tfor( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}\n\t\t}",
"add",
"{\n\t\t\tfor( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}\n\t\t}",
"for( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}",
"int i=idx;",
"int i=idx;",
"i",
"idx",
"i<bit.length",
"i",
"bit.length",
"bit",
"bit.length",
"i+=(i & -i)",
"i+=(i & -i)",
"i",
"(i & -i)",
"i",
"-i",
"i",
"{\n\t\t\t\tbit[i] += x;\n\t\t\t}",
"{\n\t\t\t\tbit[i] += x;\n\t\t\t}",
"bit[i] += x",
"bit[i]",
"bit",
"i",
"x",
"int idx",
"idx",
"int x",
"x",
"static class UnionFind\n\t{\n\t\tint[] par;\n\t\tint[] n_nodes;\n\t\tint max = 1;\n\t\t\n\t\tpublic UnionFind(int n)\n\t\t{\n\t\t\tpar = new int[n];\n\t\t\tn_nodes = new int[n];\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint root(int x)\n\t\t{\n\t\t\tif( par[x] == x ) return x;\n\t\t\treturn par[x] = root(par[x]);\n\t\t}\n\t\t\n\t\tvoid unite(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\tif( rx == ry ) return;\n\t\t\tpar[rx] = ry;\n\t\t\tn_nodes[ry] += n_nodes[rx];\n\t\t\tmax = Math.max(max, n_nodes[ry]);\n\t\t}\n\t\t\n\t\tboolean same(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\treturn rx == ry;\n\t\t}\n\t}",
"UnionFind",
"int[] par;",
"par",
"int[] n_nodes;",
"n_nodes",
"int max = 1;",
"max",
"1",
"public UnionFind(int n)\n\t\t{\n\t\t\tpar = new int[n];\n\t\t\tn_nodes = new int[n];\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}\n\t\t}",
"UnionFind",
"{\n\t\t\tpar = new int[n];\n\t\t\tn_nodes = new int[n];\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}\n\t\t}",
"par = new int[n]",
"par",
"new int[n]",
"n",
"n_nodes = new int[n]",
"n_nodes",
"new int[n]",
"n",
"for( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}",
"{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}",
"par[i] = i",
"par[i]",
"par",
"i",
"i",
"n_nodes[i] = 1",
"n_nodes[i]",
"n_nodes",
"i",
"1",
"int n",
"n",
"int root(int x)\n\t\t{\n\t\t\tif( par[x] == x ) return x;\n\t\t\treturn par[x] = root(par[x]);\n\t\t}",
"root",
"{\n\t\t\tif( par[x] == x ) return x;\n\t\t\treturn par[x] = root(par[x]);\n\t\t}",
"if( par[x] == x ) return x;",
"par[x] == x",
"par[x]",
"par",
"x",
"x",
"return x;",
"x",
"return par[x] = root(par[x]);",
"par[x] = root(par[x])",
"par[x]",
"par",
"x",
"root(par[x])",
"root",
"par[x]",
"par",
"x",
"int x",
"x",
"void unite(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\tif( rx == ry ) return;\n\t\t\tpar[rx] = ry;\n\t\t\tn_nodes[ry] += n_nodes[rx];\n\t\t\tmax = Math.max(max, n_nodes[ry]);\n\t\t}",
"unite",
"{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\tif( rx == ry ) return;\n\t\t\tpar[rx] = ry;\n\t\t\tn_nodes[ry] += n_nodes[rx];\n\t\t\tmax = Math.max(max, n_nodes[ry]);\n\t\t}",
"int rx = root(x);",
"rx",
"root(x)",
"root",
"x",
"int ry = root(y);",
"ry",
"root(y)",
"root",
"y",
"if( rx == ry ) return;",
"rx == ry",
"rx",
"ry",
"return;",
"par[rx] = ry",
"par[rx]",
"par",
"rx",
"ry",
"n_nodes[ry] += n_nodes[rx]",
"n_nodes[ry]",
"n_nodes",
"ry",
"n_nodes[rx]",
"n_nodes",
"rx",
"max = Math.max(max, n_nodes[ry])",
"max",
"Math.max(max, n_nodes[ry])",
"Math.max",
"Math",
"max",
"n_nodes[ry]",
"n_nodes",
"ry",
"int x",
"x",
"int y",
"y",
"boolean same(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\treturn rx == ry;\n\t\t}",
"same",
"{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\treturn rx == ry;\n\t\t}",
"int rx = root(x);",
"rx",
"root(x)",
"root",
"x",
"int ry = root(y);",
"ry",
"root(y)",
"root",
"y",
"return rx == ry;",
"rx == ry",
"rx",
"ry",
"int x",
"x",
"int y",
"y",
"static class Calc\n\t{\n\t\tstatic int gcd(int a, int b)\n\t\t{\n\t\t\tif( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\treturn gcd(b%a, a);\n\t\t}\n\t\t\n\t\tstatic int ceilInt(int a, int b)\n\t\t{\n\t\t\treturn (a%b==0 ? a/b : a/b+1);\n\t\t}\n\n\t\tstatic long power(long x, long n)\n\t\t{\n\t\t\tif( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}\n\t\t}\n\t}",
"Calc",
"static int gcd(int a, int b)\n\t\t{\n\t\t\tif( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\treturn gcd(b%a, a);\n\t\t}",
"gcd",
"{\n\t\t\tif( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\treturn gcd(b%a, a);\n\t\t}",
"if( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}",
"a == 0",
"a",
"0",
"{\n\t\t\t\treturn b;\n\t\t\t}",
"return b;",
"b",
"return gcd(b%a, a);",
"gcd(b%a, a)",
"gcd",
"b%a",
"b",
"a",
"a",
"int a",
"a",
"int b",
"b",
"static int ceilInt(int a, int b)\n\t\t{\n\t\t\treturn (a%b==0 ? a/b : a/b+1);\n\t\t}",
"ceilInt",
"{\n\t\t\treturn (a%b==0 ? a/b : a/b+1);\n\t\t}",
"return (a%b==0 ? a/b : a/b+1);",
"(a%b==0 ? a/b : a/b+1)",
"a%b==0",
"a%b",
"a",
"b",
"0",
"a/b",
"a",
"b",
"a/b+1",
"a/b",
"a",
"b",
"1",
"int a",
"a",
"int b",
"b",
"static long power(long x, long n)\n\t\t{\n\t\t\tif( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}\n\t\t}",
"power",
"{\n\t\t\tif( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}\n\t\t}",
"if( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}",
"n == 0",
"n",
"0",
"{\n\t\t\t\treturn 1;\n\t\t\t}",
"return 1;",
"1",
"if( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}",
"n % 2 == 0",
"n % 2",
"n",
"2",
"0",
"{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}",
"long X = (x * x) % MOD;",
"X",
"(x * x) % MOD",
"(x * x)",
"x",
"x",
"MOD",
"return power(X, n/2);",
"power(X, n/2)",
"power",
"X",
"n/2",
"n",
"2",
"{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}",
"return (x * power(x, n-1)) % MOD;",
"(x * power(x, n-1)) % MOD",
"(x * power(x, n-1))",
"x",
"power(x, n-1)",
"power",
"x",
"n-1",
"n",
"1",
"MOD",
"long x",
"x",
"long n",
"n",
"static class MyScanner\n\t{\n\t\tprivate BufferedReader in;\n\t\tprivate StringTokenizer st;\n\t\t\n\t\tpublic MyScanner(InputStream stream)\n\t\t{\n\t\t\tin = new BufferedReader(new InputStreamReader(stream));\n\t\t}\n\t\t\n\t\tpublic String next()\n\t\t{\n\t\t\twhile( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}",
"MyScanner",
"private BufferedReader in;",
"in",
"private StringTokenizer st;",
"st",
"public MyScanner(InputStream stream)\n\t\t{\n\t\t\tin = new BufferedReader(new InputStreamReader(stream));\n\t\t}",
"MyScanner",
"{\n\t\t\tin = new BufferedReader(new InputStreamReader(stream));\n\t\t}",
"in = new BufferedReader(new InputStreamReader(stream))",
"in",
"new BufferedReader(new InputStreamReader(stream))",
"InputStream stream",
"stream",
"public String next()\n\t\t{\n\t\t\twhile( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}",
"next",
"{\n\t\t\twhile( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}",
"while( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}",
"try\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}",
"catch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\treturn null;\n\t\t\t\t}",
"return null;",
"null",
"{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}",
"String rl = in.readLine();",
"rl",
"in.readLine()",
"in.readLine",
"in",
"if( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}",
"rl == null",
"rl",
"null",
"{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}",
"return null;",
"null",
"st = new StringTokenizer(rl)",
"st",
"new StringTokenizer(rl)",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public int nextInt()\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"nextInt",
"{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"nextLong",
"{\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"static interface Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out);\n\t}",
"Solver",
"public void solve(int testNumber, MyScanner in, PrintWriter out);",
"solve",
"int testNumber",
"testNumber",
"MyScanner in",
"in",
"PrintWriter out",
"out",
"static class F implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}",
"F",
"public void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}",
"solve",
"{\n\t\t}",
"int testNumber",
"testNumber",
"MyScanner in",
"in",
"PrintWriter out",
"out",
"Solver",
"static class E implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}",
"E",
"public void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}",
"solve",
"{\n\t\t}",
"int testNumber",
"testNumber",
"MyScanner in",
"in",
"PrintWriter out",
"out",
"Solver",
"static class D implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}",
"D",
"public void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}",
"solve",
"{\n\t\t}",
"int testNumber",
"testNumber",
"MyScanner in",
"in",
"PrintWriter out",
"out",
"Solver",
"static class C implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tlong ans = 0;\n\t\t\tint max = 0;\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}\n\t}",
"C",
"public void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tlong ans = 0;\n\t\t\tint max = 0;\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}",
"solve",
"{\n\t\t\tint n = in.nextInt();\n\t\t\tlong ans = 0;\n\t\t\tint max = 0;\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"long ans = 0;",
"ans",
"0",
"int max = 0;",
"max",
"0",
"for( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}",
"{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}",
"int a = in.nextInt();",
"a",
"in.nextInt()",
"in.nextInt",
"in",
"ans += Math.max(0, max-a)",
"ans",
"Math.max(0, max-a)",
"Math.max",
"Math",
"0",
"max-a",
"max",
"a",
"max = Math.max(max, a)",
"max",
"Math.max(max, a)",
"Math.max",
"Math",
"max",
"a",
"out.println(ans)",
"out.println",
"out",
"ans",
"int testNumber",
"testNumber",
"MyScanner in",
"in",
"PrintWriter out",
"out",
"Solver",
"static class B implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tString n = in.next();\n\t\t\tint mod = 0;\n\t\t\tfor( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}\n\t\t\tout.println(mod%9==0? \"Yes\" : \"No\");\n\t\t}\n\t}",
"B",
"public void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tString n = in.next();\n\t\t\tint mod = 0;\n\t\t\tfor( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}\n\t\t\tout.println(mod%9==0? \"Yes\" : \"No\");\n\t\t}",
"solve",
"{\n\t\t\tString n = in.next();\n\t\t\tint mod = 0;\n\t\t\tfor( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}\n\t\t\tout.println(mod%9==0? \"Yes\" : \"No\");\n\t\t}",
"String n = in.next();",
"n",
"in.next()",
"in.next",
"in",
"int mod = 0;",
"mod",
"0",
"for( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n.length()",
"i",
"n.length()",
"n.length",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}",
"{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}",
"mod += Integer.parseInt(n.substring(i, i+1))",
"mod",
"Integer.parseInt(n.substring(i, i+1))",
"Integer.parseInt",
"Integer",
"n.substring(i, i+1)",
"n.substring",
"n",
"i",
"i+1",
"i",
"1",
"out.println(mod%9==0? \"Yes\" : \"No\")",
"out.println",
"out",
"mod%9==0? \"Yes\" : \"No\"",
"mod%9==0",
"mod%9",
"mod",
"9",
"0",
"\"Yes\"",
"\"No\"",
"int testNumber",
"testNumber",
"MyScanner in",
"in",
"PrintWriter out",
"out",
"Solver",
"static class A implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tint x = in.nextInt();\n\t\t\tint t = in.nextInt();\n\t\t\tout.println(Calc.ceilInt(n, x) * t);\n\t\t}\n\t}",
"A",
"public void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tint x = in.nextInt();\n\t\t\tint t = in.nextInt();\n\t\t\tout.println(Calc.ceilInt(n, x) * t);\n\t\t}",
"solve",
"{\n\t\t\tint n = in.nextInt();\n\t\t\tint x = in.nextInt();\n\t\t\tint t = in.nextInt();\n\t\t\tout.println(Calc.ceilInt(n, x) * t);\n\t\t}",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int x = in.nextInt();",
"x",
"in.nextInt()",
"in.nextInt",
"in",
"int t = in.nextInt();",
"t",
"in.nextInt()",
"in.nextInt",
"in",
"out.println(Calc.ceilInt(n, x) * t)",
"out.println",
"out",
"Calc.ceilInt(n, x) * t",
"Calc.ceilInt(n, x)",
"Calc.ceilInt",
"Calc",
"n",
"x",
"t",
"int testNumber",
"testNumber",
"MyScanner in",
"in",
"PrintWriter out",
"out",
"Solver",
"public class Main\n{\n\tstatic int MOD = (int) 1e9 + 7;\n\t\n\tstatic class FenwickTree\n\t{\n\t\t// bit[1] ~ bit[n]\n\t\tlong[] bit; // = new long[n+1];\n\t\t\n\t\tpublic FenwickTree(int n)\n\t\t{\n\t\t\tbit = new long[n+1];\n\t\t}\n\t\t\n\t\t// bit[1] + ... + bit[r]\n\t\tlong sum(int r)\n\t\t{\n\t\t\tlong s = 0;\n\t\t\tfor( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\t\t\n\t\tvoid add(int idx, int x)\n\t\t{\n\t\t\tfor( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class UnionFind\n\t{\n\t\tint[] par;\n\t\tint[] n_nodes;\n\t\tint max = 1;\n\t\t\n\t\tpublic UnionFind(int n)\n\t\t{\n\t\t\tpar = new int[n];\n\t\t\tn_nodes = new int[n];\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint root(int x)\n\t\t{\n\t\t\tif( par[x] == x ) return x;\n\t\t\treturn par[x] = root(par[x]);\n\t\t}\n\t\t\n\t\tvoid unite(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\tif( rx == ry ) return;\n\t\t\tpar[rx] = ry;\n\t\t\tn_nodes[ry] += n_nodes[rx];\n\t\t\tmax = Math.max(max, n_nodes[ry]);\n\t\t}\n\t\t\n\t\tboolean same(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\treturn rx == ry;\n\t\t}\n\t}\n\t\n\tstatic class Calc\n\t{\n\t\tstatic int gcd(int a, int b)\n\t\t{\n\t\t\tif( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\treturn gcd(b%a, a);\n\t\t}\n\t\t\n\t\tstatic int ceilInt(int a, int b)\n\t\t{\n\t\t\treturn (a%b==0 ? a/b : a/b+1);\n\t\t}\n\n\t\tstatic long power(long x, long n)\n\t\t{\n\t\t\tif( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tstatic class MyScanner\n\t{\n\t\tprivate BufferedReader in;\n\t\tprivate StringTokenizer st;\n\t\t\n\t\tpublic MyScanner(InputStream stream)\n\t\t{\n\t\t\tin = new BufferedReader(new InputStreamReader(stream));\n\t\t}\n\t\t\n\t\tpublic String next()\n\t\t{\n\t\t\twhile( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\t\n\tstatic interface Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out);\n\t}\n\t\n\tstatic class F implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class E implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class D implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\t\n\tstatic class C implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tlong ans = 0;\n\t\t\tint max = 0;\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}\n\t}\n\t\n\tstatic class B implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tString n = in.next();\n\t\t\tint mod = 0;\n\t\t\tfor( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}\n\t\t\tout.println(mod%9==0? \"Yes\" : \"No\");\n\t\t}\n\t}\n\n\tstatic class A implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tint x = in.nextInt();\n\t\t\tint t = in.nextInt();\n\t\t\tout.println(Calc.ceilInt(n, x) * t);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args)\n\t{\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tMyScanner in = new MyScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolver solver = new C();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}",
"public class Main\n{\n\tstatic int MOD = (int) 1e9 + 7;\n\t\n\tstatic class FenwickTree\n\t{\n\t\t// bit[1] ~ bit[n]\n\t\tlong[] bit; // = new long[n+1];\n\t\t\n\t\tpublic FenwickTree(int n)\n\t\t{\n\t\t\tbit = new long[n+1];\n\t\t}\n\t\t\n\t\t// bit[1] + ... + bit[r]\n\t\tlong sum(int r)\n\t\t{\n\t\t\tlong s = 0;\n\t\t\tfor( int i=r; i>0; i-=(i & -i) )\n\t\t\t{\n\t\t\t\ts += bit[i];\n\t\t\t}\n\t\t\treturn s;\n\t\t}\n\t\t\n\t\tvoid add(int idx, int x)\n\t\t{\n\t\t\tfor( int i=idx; i<bit.length; i+=(i & -i) )\n\t\t\t{\n\t\t\t\tbit[i] += x;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic class UnionFind\n\t{\n\t\tint[] par;\n\t\tint[] n_nodes;\n\t\tint max = 1;\n\t\t\n\t\tpublic UnionFind(int n)\n\t\t{\n\t\t\tpar = new int[n];\n\t\t\tn_nodes = new int[n];\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tpar[i] = i;\n\t\t\t\tn_nodes[i] = 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint root(int x)\n\t\t{\n\t\t\tif( par[x] == x ) return x;\n\t\t\treturn par[x] = root(par[x]);\n\t\t}\n\t\t\n\t\tvoid unite(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\tif( rx == ry ) return;\n\t\t\tpar[rx] = ry;\n\t\t\tn_nodes[ry] += n_nodes[rx];\n\t\t\tmax = Math.max(max, n_nodes[ry]);\n\t\t}\n\t\t\n\t\tboolean same(int x, int y)\n\t\t{\n\t\t\tint rx = root(x);\n\t\t\tint ry = root(y);\n\t\t\treturn rx == ry;\n\t\t}\n\t}\n\t\n\tstatic class Calc\n\t{\n\t\tstatic int gcd(int a, int b)\n\t\t{\n\t\t\tif( a == 0 )\n\t\t\t{\n\t\t\t\treturn b;\n\t\t\t}\n\t\t\treturn gcd(b%a, a);\n\t\t}\n\t\t\n\t\tstatic int ceilInt(int a, int b)\n\t\t{\n\t\t\treturn (a%b==0 ? a/b : a/b+1);\n\t\t}\n\n\t\tstatic long power(long x, long n)\n\t\t{\n\t\t\tif( n == 0 )\n\t\t\t{\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\tif( n % 2 == 0 )\n\t\t\t{\n\t\t\t\tlong X = (x * x) % MOD;\n\t\t\t\treturn power(X, n/2);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn (x * power(x, n-1)) % MOD;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tstatic class MyScanner\n\t{\n\t\tprivate BufferedReader in;\n\t\tprivate StringTokenizer st;\n\t\t\n\t\tpublic MyScanner(InputStream stream)\n\t\t{\n\t\t\tin = new BufferedReader(new InputStreamReader(stream));\n\t\t}\n\t\t\n\t\tpublic String next()\n\t\t{\n\t\t\twhile( st == null || !st.hasMoreTokens() )\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tString rl = in.readLine();\n\t\t\t\t\tif( rl == null )\n\t\t\t\t\t{\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tst = new StringTokenizer(rl);\n\t\t\t\t}\n\t\t\t\tcatch( IOException e )\n\t\t\t\t{\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\t\t\n\t\tpublic int nextInt()\n\t\t{\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\t\t\n\t\tpublic long nextLong()\n\t\t{\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\t}\n\t\n\tstatic interface Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out);\n\t}\n\t\n\tstatic class F implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class E implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\n\tstatic class D implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t}\n\t}\n\t\n\tstatic class C implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tlong ans = 0;\n\t\t\tint max = 0;\n\t\t\tfor( int i=0; i<n; i++ )\n\t\t\t{\n\t\t\t\tint a = in.nextInt();\n\t\t\t\tans += Math.max(0, max-a);\n\t\t\t\tmax = Math.max(max, a);\n\t\t\t}\n\t\t\tout.println(ans);\n\t\t}\n\t}\n\t\n\tstatic class B implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tString n = in.next();\n\t\t\tint mod = 0;\n\t\t\tfor( int i=0; i<n.length(); i++ )\n\t\t\t{\n\t\t\t\tmod += Integer.parseInt(n.substring(i, i+1));\n\t\t\t}\n\t\t\tout.println(mod%9==0? \"Yes\" : \"No\");\n\t\t}\n\t}\n\n\tstatic class A implements Solver\n\t{\n\t\tpublic void solve(int testNumber, MyScanner in, PrintWriter out)\n\t\t{\n\t\t\tint n = in.nextInt();\n\t\t\tint x = in.nextInt();\n\t\t\tint t = in.nextInt();\n\t\t\tout.println(Calc.ceilInt(n, x) * t);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args)\n\t{\n\t\tInputStream inputStream = System.in;\n\t\tOutputStream outputStream = System.out;\n\t\tMyScanner in = new MyScanner(inputStream);\n\t\tPrintWriter out = new PrintWriter(outputStream);\n\t\tSolver solver = new C();\n\t\tsolver.solve(1, in, out);\n\t\tout.close();\n\t}\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main
{
static int MOD = (int) 1e9 + 7;
static class FenwickTree
{
// bit[1] ~ bit[n]
long[] bit; // = new long[n+1];
public FenwickTree(int n)
{
bit = new long[n+1];
}
// bit[1] + ... + bit[r]
long sum(int r)
{
long s = 0;
for( int i=r; i>0; i-=(i & -i) )
{
s += bit[i];
}
return s;
}
void add(int idx, int x)
{
for( int i=idx; i<bit.length; i+=(i & -i) )
{
bit[i] += x;
}
}
}
static class UnionFind
{
int[] par;
int[] n_nodes;
int max = 1;
public UnionFind(int n)
{
par = new int[n];
n_nodes = new int[n];
for( int i=0; i<n; i++ )
{
par[i] = i;
n_nodes[i] = 1;
}
}
int root(int x)
{
if( par[x] == x ) return x;
return par[x] = root(par[x]);
}
void unite(int x, int y)
{
int rx = root(x);
int ry = root(y);
if( rx == ry ) return;
par[rx] = ry;
n_nodes[ry] += n_nodes[rx];
max = Math.max(max, n_nodes[ry]);
}
boolean same(int x, int y)
{
int rx = root(x);
int ry = root(y);
return rx == ry;
}
}
static class Calc
{
static int gcd(int a, int b)
{
if( a == 0 )
{
return b;
}
return gcd(b%a, a);
}
static int ceilInt(int a, int b)
{
return (a%b==0 ? a/b : a/b+1);
}
static long power(long x, long n)
{
if( n == 0 )
{
return 1;
}
if( n % 2 == 0 )
{
long X = (x * x) % MOD;
return power(X, n/2);
}
else
{
return (x * power(x, n-1)) % MOD;
}
}
}
static class MyScanner
{
private BufferedReader in;
private StringTokenizer st;
public MyScanner(InputStream stream)
{
in = new BufferedReader(new InputStreamReader(stream));
}
public String next()
{
while( st == null || !st.hasMoreTokens() )
{
try
{
String rl = in.readLine();
if( rl == null )
{
return null;
}
st = new StringTokenizer(rl);
}
catch( IOException e )
{
return null;
}
}
return st.nextToken();
}
public int nextInt()
{
return Integer.parseInt(next());
}
public long nextLong()
{
return Long.parseLong(next());
}
}
static interface Solver
{
public void solve(int testNumber, MyScanner in, PrintWriter out);
}
static class F implements Solver
{
public void solve(int testNumber, MyScanner in, PrintWriter out)
{
}
}
static class E implements Solver
{
public void solve(int testNumber, MyScanner in, PrintWriter out)
{
}
}
static class D implements Solver
{
public void solve(int testNumber, MyScanner in, PrintWriter out)
{
}
}
static class C implements Solver
{
public void solve(int testNumber, MyScanner in, PrintWriter out)
{
int n = in.nextInt();
long ans = 0;
int max = 0;
for( int i=0; i<n; i++ )
{
int a = in.nextInt();
ans += Math.max(0, max-a);
max = Math.max(max, a);
}
out.println(ans);
}
}
static class B implements Solver
{
public void solve(int testNumber, MyScanner in, PrintWriter out)
{
String n = in.next();
int mod = 0;
for( int i=0; i<n.length(); i++ )
{
mod += Integer.parseInt(n.substring(i, i+1));
}
out.println(mod%9==0? "Yes" : "No");
}
}
static class A implements Solver
{
public void solve(int testNumber, MyScanner in, PrintWriter out)
{
int n = in.nextInt();
int x = in.nextInt();
int t = in.nextInt();
out.println(Calc.ceilInt(n, x) * t);
}
}
public static void main(String[] args)
{
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
MyScanner in = new MyScanner(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solver solver = new C();
solver.solve(1, in, out);
out.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
4,
13,
23,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
34,
35
],
[
34,
36
],
[
0,
37
],
[
130,
38
],
[
130,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
39,
44
],
[
44,
45
],
[
130,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
50,
59
],
[
59,
60
],
[
59,
61
],
[
50,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
63,
71
],
[
71,
72
],
[
72,
73
],
[
63,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
80,
81
],
[
50,
82
],
[
82,
83
],
[
82,
84
],
[
50,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
50,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
98,
99
],
[
99,
100
],
[
90,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
103,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
50,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
0,
129
],
[
129,
130
],
[
129,
131
]
]
| [
"import java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Comparator;\nimport java.util.Deque;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Scanner;\nimport java.util.Set;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\texecute20_2();\n\t}\n\t\n\tprivate static void execute20_2() {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"import java.util.ArrayDeque;",
"ArrayDeque",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Comparator;",
"Comparator",
"java.util",
"import java.util.Deque;",
"Deque",
"java.util",
"import java.util.HashMap;",
"HashMap",
"java.util",
"import java.util.HashSet;",
"HashSet",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Map;",
"Map",
"java.util",
"import java.util.Queue;",
"Queue",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Set;",
"Set",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\texecute20_2();\n\t}\n\t\n\tprivate static void execute20_2() {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\texecute20_2();\n\t}",
"main",
"{\n\t\texecute20_2();\n\t}",
"execute20_2()",
"execute20_2",
"String[] args",
"args",
"private static void execute20_2() {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"execute20_2",
"{\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}",
"try (Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"{\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for(int i=0;i<n;i++) a[i] = sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = sc.nextInt();",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans=0;",
"ans",
"0",
"long max=a[0];",
"max",
"a[0]",
"a",
"0",
"for(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}",
"int j=1;",
"int j=1;",
"j",
"1",
"j<n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}",
"if(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}",
"max>a[j]",
"max",
"a[j]",
"a",
"j",
"{\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t}",
"ans+=max-a[j]",
"ans",
"max-a[j]",
"max",
"a[j]",
"a",
"j",
"{\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}",
"max=a[j]",
"max",
"a[j]",
"a",
"j",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\texecute20_2();\n\t}\n\t\n\tprivate static void execute20_2() {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\texecute20_2();\n\t}\n\t\n\tprivate static void execute20_2() {\n\t\ttry (Scanner sc = new Scanner(System.in)) {\n\t\t\tint n = sc.nextInt();\n\t\t\tlong[] a = new long[n];\n\t\t\tfor(int i=0;i<n;i++) a[i] = sc.nextInt();\n\t\t\t\n\t\t\tlong ans=0;\n\t\t\tlong max=a[0];\n\t\t\t\n\t\t\tfor(int j=1;j<n;j++) {\n\t\t\t\tif(max>a[j]) {\n\t\t\t\t\tans+=max-a[j];\n\t\t\t\t} else {\n\t\t\t\t\tmax=a[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\t}\n}",
"Main"
]
| import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
execute20_2();
}
private static void execute20_2() {
try (Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
long[] a = new long[n];
for(int i=0;i<n;i++) a[i] = sc.nextInt();
long ans=0;
long max=a[0];
for(int j=1;j<n;j++) {
if(max>a[j]) {
ans+=max-a[j];
} else {
max=a[j];
}
}
System.out.println(ans);
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
14,
46
],
[
46,
47
],
[
46,
48
],
[
14,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
62,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
75,
81
],
[
81,
82
],
[
81,
83
],
[
72,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
14,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
12,
99
],
[
99,
100
],
[
10,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
101,
105
],
[
105,
106
],
[
101,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
101,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
116,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
126,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
115,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
101,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
148,
149
],
[
101,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
157,
158
],
[
101,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
166,
167
],
[
101,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
174,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
170,
187
],
[
187,
188
]
]
| [
"/* package whatever; // don't place package name! */\n\nimport java.util.*;\nimport java.lang.*;\nimport java.io.*;\n\n/* Name of the class has to be \"Main\" only if the class is public. */\nclass Main\n{\n\t\n static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n } \n \n public static void main(String[] args) \n { \n FastReader sc=new FastReader(); \n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) a[i]=sc.nextInt();\n\t\tlong sum=0;\n\t\tfor(int i=1;i<n;i++){\n\t\t\tif(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\n \t\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main\n{\n\t\n static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n } \n \n public static void main(String[] args) \n { \n FastReader sc=new FastReader(); \n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) a[i]=sc.nextInt();\n\t\tlong sum=0;\n\t\tfor(int i=1;i<n;i++){\n\t\t\tif(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\n \t\n }\n}",
"Main",
"public static void main(String[] args) \n { \n FastReader sc=new FastReader(); \n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) a[i]=sc.nextInt();\n\t\tlong sum=0;\n\t\tfor(int i=1;i<n;i++){\n\t\t\tif(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\n \t\n }",
"main",
"{ \n FastReader sc=new FastReader(); \n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++) a[i]=sc.nextInt();\n\t\tlong sum=0;\n\t\tfor(int i=1;i<n;i++){\n\t\t\tif(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t\n \t\n }",
"FastReader sc=new FastReader();",
"sc",
"new FastReader()",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] a=new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0;i<n;i++) a[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=sc.nextInt();",
"a[i]=sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long sum=0;",
"sum",
"0",
"for(int i=1;i<n;i++){\n\t\t\tif(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}\n\t\t}",
"if(a[i]<a[i-1]){\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}",
"a[i]<a[i-1]",
"a[i]",
"a",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"{\n\t\t\t\tsum+=a[i-1]-a[i];\n\t\t\t\ta[i]=a[i-1];\n\t\t\t}",
"sum+=a[i-1]-a[i]",
"sum",
"a[i-1]-a[i]",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"a[i]=a[i-1]",
"a[i]",
"a",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"static class FastReader \n { \n BufferedReader br; \n StringTokenizer st; \n \n public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n } \n \n String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n } \n \n int nextInt() \n { \n return Integer.parseInt(next()); \n } \n \n long nextLong() \n { \n return Long.parseLong(next()); \n } \n \n double nextDouble() \n { \n return Double.parseDouble(next()); \n } \n \n String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n } \n }",
"FastReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastReader() \n { \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n }",
"FastReader",
"{ \n br = new BufferedReader(new\n InputStreamReader(System.in)); \n }",
"br = new BufferedReader(new\n InputStreamReader(System.in))",
"br",
"new BufferedReader(new\n InputStreamReader(System.in))",
"String next() \n { \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }",
"next",
"{ \n while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }",
"while (st == null || !st.hasMoreElements()) \n { \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{ \n try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n }",
"try\n { \n st = new StringTokenizer(br.readLine()); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n }",
"catch (IOException e) \n { \n e.printStackTrace(); \n }",
"IOException e",
"{ \n e.printStackTrace(); \n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n st = new StringTokenizer(br.readLine()); \n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int nextInt() \n { \n return Integer.parseInt(next()); \n }",
"nextInt",
"{ \n return Integer.parseInt(next()); \n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nextLong() \n { \n return Long.parseLong(next()); \n }",
"nextLong",
"{ \n return Long.parseLong(next()); \n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nextDouble() \n { \n return Double.parseDouble(next()); \n }",
"nextDouble",
"{ \n return Double.parseDouble(next()); \n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"String nextLine() \n { \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n }",
"nextLine",
"{ \n String str = \"\"; \n try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n } \n return str; \n }",
"String str = \"\";",
"str",
"\"\"",
"try\n { \n str = br.readLine(); \n } \n catch (IOException e) \n { \n e.printStackTrace(); \n }",
"catch (IOException e) \n { \n e.printStackTrace(); \n }",
"IOException e",
"{ \n e.printStackTrace(); \n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n str = br.readLine(); \n }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str"
]
| /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())
{
try
{
st = new StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
public static void main(String[] args)
{
FastReader sc=new FastReader();
int n=sc.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i++) a[i]=sc.nextInt();
long sum=0;
for(int i=1;i<n;i++){
if(a[i]<a[i-1]){
sum+=a[i-1]-a[i];
a[i]=a[i-1];
}
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
9,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
64,
5
],
[
64,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
35,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
45,
51
],
[
35,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
6,
61
],
[
61,
62
],
[
0,
63
],
[
63,
64
],
[
63,
65
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong p = 0;\n\t\tlong ss = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}\n\t\tSystem.out.println(ss);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong p = 0;\n\t\tlong ss = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}\n\t\tSystem.out.println(ss);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong p = 0;\n\t\tlong ss = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}\n\t\tSystem.out.println(ss);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong p = 0;\n\t\tlong ss = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}\n\t\tSystem.out.println(ss);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long p = 0;",
"p",
"0",
"long ss = 0;",
"ss",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}",
"{\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}",
"long c = sc.nextLong();",
"c",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}",
"c < p",
"c",
"p",
"{\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}",
"ss += p - c",
"ss",
"p - c",
"p",
"c",
"continue;",
"p = c",
"p",
"c",
"System.out.println(ss)",
"System.out.println",
"System.out",
"System",
"System.out",
"ss",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong p = 0;\n\t\tlong ss = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}\n\t\tSystem.out.println(ss);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong p = 0;\n\t\tlong ss = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlong c = sc.nextLong();\n\t\t\tif (c < p) {\n\t\t\t\tss += p - c;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tp = c;\n\t\t}\n\t\tSystem.out.println(ss);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long p = 0;
long ss = 0;
for (int i = 0; i < n; i++) {
long c = sc.nextLong();
if (c < p) {
ss += p - c;
continue;
}
p = c;
}
System.out.println(ss);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
18,
13,
13,
18,
13,
13,
2,
18,
13,
13,
18,
13,
13,
30,
9,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
2,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
128,
5
],
[
128,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
59,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
59,
71
],
[
71,
72
],
[
72,
73
],
[
59,
74
],
[
75,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
76,
92
],
[
92,
93
],
[
75,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
94,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
102,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
116,
118
],
[
8,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
6,
125
],
[
125,
126
],
[
0,
127
],
[
127,
128
],
[
127,
129
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int A[] = new int[N];\n long total = 0;\n for(int i = 0; i < N; i++){\n A[i] = sc.nextInt();\n }\n for(int i = 0; i < N-1; i++){\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }\n System.out.println(total);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int A[] = new int[N];\n long total = 0;\n for(int i = 0; i < N; i++){\n A[i] = sc.nextInt();\n }\n for(int i = 0; i < N-1; i++){\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }\n System.out.println(total);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int A[] = new int[N];\n long total = 0;\n for(int i = 0; i < N; i++){\n A[i] = sc.nextInt();\n }\n for(int i = 0; i < N-1; i++){\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }\n System.out.println(total);\n }",
"main",
"{\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int A[] = new int[N];\n long total = 0;\n for(int i = 0; i < N; i++){\n A[i] = sc.nextInt();\n }\n for(int i = 0; i < N-1; i++){\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }\n System.out.println(total);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int A[] = new int[N];",
"A",
"new int[N]",
"N",
"long total = 0;",
"total",
"0",
"for(int i = 0; i < N; i++){\n A[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextInt();\n }",
"{\n A[i] = sc.nextInt();\n }",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < N-1; i++){\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N-1",
"i",
"N-1",
"N",
"1",
"i++",
"i++",
"i",
"{\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }",
"{\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }",
"for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }",
"int j = i+1;",
"int j = i+1;",
"j",
"i+1",
"i",
"1",
"j < i+2",
"j",
"i+2",
"i",
"2",
"j++",
"j++",
"j",
"{\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }",
"{\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }",
"if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }",
"A[i] == A[j] || A[i] < A[j]",
"A[i] == A[j]",
"A[i]",
"A",
"i",
"A[j]",
"A",
"j",
"A[i] < A[j]",
"A[i]",
"A",
"i",
"A[j]",
"A",
"j",
"{\n continue;\n }",
"continue;",
"if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }",
"A[i] > A[j]",
"A[i]",
"A",
"i",
"A[j]",
"A",
"j",
"{\n total += A[i] - A[j];\n A[j] = A[i];\n }",
"total += A[i] - A[j]",
"total",
"A[i] - A[j]",
"A[i]",
"A",
"i",
"A[j]",
"A",
"j",
"A[j] = A[i]",
"A[j]",
"A",
"j",
"A[i]",
"A",
"i",
"System.out.println(total)",
"System.out.println",
"System.out",
"System",
"System.out",
"total",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int A[] = new int[N];\n long total = 0;\n for(int i = 0; i < N; i++){\n A[i] = sc.nextInt();\n }\n for(int i = 0; i < N-1; i++){\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }\n System.out.println(total);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n // Your code here!\n Scanner sc = new Scanner(System.in);\n int N = sc.nextInt();\n int A[] = new int[N];\n long total = 0;\n for(int i = 0; i < N; i++){\n A[i] = sc.nextInt();\n }\n for(int i = 0; i < N-1; i++){\n for(int j = i+1; j < i+2; j++){\n if(A[i] == A[j] || A[i] < A[j]){\n continue;\n }\n if(A[i] > A[j]){\n total += A[i] - A[j];\n A[j] = A[i];\n }\n }\n }\n System.out.println(total);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
// Your code here!
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int A[] = new int[N];
long total = 0;
for(int i = 0; i < N; i++){
A[i] = sc.nextInt();
}
for(int i = 0; i < N-1; i++){
for(int j = i+1; j < i+2; j++){
if(A[i] == A[j] || A[i] < A[j]){
continue;
}
if(A[i] > A[j]){
total += A[i] - A[j];
A[j] = A[i];
}
}
}
System.out.println(total);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
20,
13,
0,
18,
13,
17,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
14,
2,
2,
18,
13,
13,
18,
13,
2,
13,
17,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
18,
13,
13,
14,
2,
2,
18,
13,
13,
18,
13,
2,
13,
17,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
18,
13,
2,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
2,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
177,
5
],
[
177,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
61,
62
],
[
52,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
66,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
65,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
85,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
84,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
84,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
112,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
111,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
8,
140
],
[
140,
141
],
[
140,
142
],
[
8,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
148,
149
],
[
148,
150
],
[
143,
151
],
[
151,
152
],
[
152,
153
],
[
143,
154
],
[
155,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
158,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
165,
167
],
[
8,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
168,
173
],
[
6,
174
],
[
174,
175
],
[
0,
176
],
[
176,
177
],
[
176,
178
]
]
| [
"import java.util.*;\npublic class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n \n\n int n = sc.nextInt();\n int[] A = new int[n];\n for(int i =0; i < n; i++){\n A[i] = sc.nextInt();\n }\n \n\n int[] help = new int[n];\n help[0] = A[0];\n for(int i = 1; i < n; i++){\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }\n long minH = 0L;\n for(int j = 0; j < n; j++){\n minH += Math.abs(A[j] - help[j]);\n }\n System.out.println(minH);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n \n\n int n = sc.nextInt();\n int[] A = new int[n];\n for(int i =0; i < n; i++){\n A[i] = sc.nextInt();\n }\n \n\n int[] help = new int[n];\n help[0] = A[0];\n for(int i = 1; i < n; i++){\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }\n long minH = 0L;\n for(int j = 0; j < n; j++){\n minH += Math.abs(A[j] - help[j]);\n }\n System.out.println(minH);\n }\n}",
"Main",
"public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n \n\n int n = sc.nextInt();\n int[] A = new int[n];\n for(int i =0; i < n; i++){\n A[i] = sc.nextInt();\n }\n \n\n int[] help = new int[n];\n help[0] = A[0];\n for(int i = 1; i < n; i++){\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }\n long minH = 0L;\n for(int j = 0; j < n; j++){\n minH += Math.abs(A[j] - help[j]);\n }\n System.out.println(minH);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n\n int n = sc.nextInt();\n int[] A = new int[n];\n for(int i =0; i < n; i++){\n A[i] = sc.nextInt();\n }\n \n\n int[] help = new int[n];\n help[0] = A[0];\n for(int i = 1; i < n; i++){\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }\n long minH = 0L;\n for(int j = 0; j < n; j++){\n minH += Math.abs(A[j] - help[j]);\n }\n System.out.println(minH);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] A = new int[n];",
"A",
"new int[n]",
"n",
"for(int i =0; i < n; i++){\n A[i] = sc.nextInt();\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextInt();\n }",
"{\n A[i] = sc.nextInt();\n }",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] help = new int[n];",
"help",
"new int[n]",
"n",
"help[0] = A[0]",
"help[0]",
"help",
"0",
"A[0]",
"A",
"0",
"for(int i = 1; i < n; i++){\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }",
"{\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }",
"if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];",
"A[i-1] >= A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"help[i] = help[i-1]",
"help[i]",
"help",
"i",
"help[i-1]",
"help",
"i-1",
"i",
"1",
"if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];",
"A[i] > A[i-1] && A[i] > help[i-1]",
"A[i] > A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i] > help[i-1]",
"A[i]",
"A",
"i",
"help[i-1]",
"help",
"i-1",
"i",
"1",
"help[i] = A[i]",
"help[i]",
"help",
"i",
"A[i]",
"A",
"i",
"if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];",
"A[i] > A[i-1] && A[i] < help[i-1]",
"A[i] > A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i] < help[i-1]",
"A[i]",
"A",
"i",
"help[i-1]",
"help",
"i-1",
"i",
"1",
"help[i] = help[i-1]",
"help[i]",
"help",
"i",
"help[i-1]",
"help",
"i-1",
"i",
"1",
"long minH = 0L;",
"minH",
"0L",
"for(int j = 0; j < n; j++){\n minH += Math.abs(A[j] - help[j]);\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n minH += Math.abs(A[j] - help[j]);\n }",
"{\n minH += Math.abs(A[j] - help[j]);\n }",
"minH += Math.abs(A[j] - help[j])",
"minH",
"Math.abs(A[j] - help[j])",
"Math.abs",
"Math",
"A[j] - help[j]",
"A[j]",
"A",
"j",
"help[j]",
"help",
"j",
"System.out.println(minH)",
"System.out.println",
"System.out",
"System",
"System.out",
"minH",
"String args[]",
"args",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n \n\n int n = sc.nextInt();\n int[] A = new int[n];\n for(int i =0; i < n; i++){\n A[i] = sc.nextInt();\n }\n \n\n int[] help = new int[n];\n help[0] = A[0];\n for(int i = 1; i < n; i++){\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }\n long minH = 0L;\n for(int j = 0; j < n; j++){\n minH += Math.abs(A[j] - help[j]);\n }\n System.out.println(minH);\n }\n}",
"public class Main {\n public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n \n\n int n = sc.nextInt();\n int[] A = new int[n];\n for(int i =0; i < n; i++){\n A[i] = sc.nextInt();\n }\n \n\n int[] help = new int[n];\n help[0] = A[0];\n for(int i = 1; i < n; i++){\n if(A[i-1] >= A[i] )\n help[i] = help[i-1];\n\n else if(A[i] > A[i-1] && A[i] > help[i-1])\n help[i] = A[i];\n else if(A[i] > A[i-1] && A[i] < help[i-1])\n help[i] = help[i-1];\n }\n long minH = 0L;\n for(int j = 0; j < n; j++){\n minH += Math.abs(A[j] - help[j]);\n }\n System.out.println(minH);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] A = new int[n];
for(int i =0; i < n; i++){
A[i] = sc.nextInt();
}
int[] help = new int[n];
help[0] = A[0];
for(int i = 1; i < n; i++){
if(A[i-1] >= A[i] )
help[i] = help[i-1];
else if(A[i] > A[i-1] && A[i] > help[i-1])
help[i] = A[i];
else if(A[i] > A[i-1] && A[i] < help[i-1])
help[i] = help[i-1];
}
long minH = 0L;
for(int j = 0; j < n; j++){
minH += Math.abs(A[j] - help[j]);
}
System.out.println(minH);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
13,
0,
18,
13,
17,
4,
18,
13,
0,
18,
13,
17,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
2,
18,
13,
13,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
199,
11
],
[
199,
12
],
[
12,
13
],
[
12,
14
],
[
199,
15
],
[
15,
16
],
[
15,
17
],
[
199,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
20,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
20,
32
],
[
32,
33
],
[
32,
34
],
[
20,
36
],
[
36,
37
],
[
36,
38
],
[
20,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
20,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
20,
54
],
[
54,
55
],
[
54,
56
],
[
20,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
62,
63
],
[
62,
64
],
[
57,
65
],
[
65,
66
],
[
66,
67
],
[
57,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
75,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
69,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
20,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
20,
105
],
[
105,
106
],
[
106,
107
],
[
18,
108
],
[
108,
109
],
[
199,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
110,
114
],
[
114,
115
],
[
110,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
110,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
125,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
135,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
124,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
110,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
157,
158
],
[
110,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
166,
167
],
[
110,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
172,
175
],
[
175,
176
],
[
110,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
183,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
179,
196
],
[
196,
197
],
[
0,
198
],
[
198,
199
],
[
198,
200
]
]
| [
"import java.io.*;\nimport java.math.*;\nimport java.util.*;\n \npublic class Main {\n\tstatic final long MOD = 1000000007L;\n\tstatic final int INF = 50000000;\n\t\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint N = sc.ni();\n\t\tlong[] nums = new long[N];\n\t\tlong[] target = new long[N];\n\t\tnums[0] = sc.nl();\n\t\ttarget[0] = nums[0];\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}\n\t\tpw.println(ans);\n\t\tpw.close();\n\t}\n\n static class FastScanner { \n BufferedReader br; \n StringTokenizer st; \n \n public FastScanner() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n } \n \n String next() { \n while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }\n \n int ni() { \n return Integer.parseInt(next()); \n }\n \n long nl() { \n return Long.parseLong(next()); \n } \n \n double nd() { \n return Double.parseDouble(next()); \n } \n \n String nextLine() {\n String str = \"\"; \n try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n } \n return str;\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.math.*;",
"math.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tstatic final long MOD = 1000000007L;\n\tstatic final int INF = 50000000;\n\t\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint N = sc.ni();\n\t\tlong[] nums = new long[N];\n\t\tlong[] target = new long[N];\n\t\tnums[0] = sc.nl();\n\t\ttarget[0] = nums[0];\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}\n\t\tpw.println(ans);\n\t\tpw.close();\n\t}\n\n static class FastScanner { \n BufferedReader br; \n StringTokenizer st; \n \n public FastScanner() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n } \n \n String next() { \n while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }\n \n int ni() { \n return Integer.parseInt(next()); \n }\n \n long nl() { \n return Long.parseLong(next()); \n } \n \n double nd() { \n return Double.parseDouble(next()); \n } \n \n String nextLine() {\n String str = \"\"; \n try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n } \n return str;\n }\n }\n}",
"Main",
"static final long MOD = 1000000007L;",
"MOD",
"1000000007L",
"static final int INF = 50000000;",
"INF",
"50000000",
"public static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint N = sc.ni();\n\t\tlong[] nums = new long[N];\n\t\tlong[] target = new long[N];\n\t\tnums[0] = sc.nl();\n\t\ttarget[0] = nums[0];\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}\n\t\tpw.println(ans);\n\t\tpw.close();\n\t}",
"main",
"{\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint N = sc.ni();\n\t\tlong[] nums = new long[N];\n\t\tlong[] target = new long[N];\n\t\tnums[0] = sc.nl();\n\t\ttarget[0] = nums[0];\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}\n\t\tpw.println(ans);\n\t\tpw.close();\n\t}",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"PrintWriter pw = new PrintWriter(System.out);",
"pw",
"new PrintWriter(System.out)",
"int N = sc.ni();",
"N",
"sc.ni()",
"sc.ni",
"sc",
"long[] nums = new long[N];",
"nums",
"new long[N]",
"N",
"long[] target = new long[N];",
"target",
"new long[N]",
"N",
"nums[0] = sc.nl()",
"nums[0]",
"nums",
"0",
"sc.nl()",
"sc.nl",
"sc",
"target[0] = nums[0]",
"target[0]",
"target",
"0",
"nums[0]",
"nums",
"0",
"long ans = 0;",
"ans",
"0",
"for (int i = 1; i < N; i++) {\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}",
"{\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}",
"nums[i] = sc.nl()",
"nums[i]",
"nums",
"i",
"sc.nl()",
"sc.nl",
"sc",
"target[i] = Math.max(nums[i], target[i-1])",
"target[i]",
"target",
"i",
"Math.max(nums[i], target[i-1])",
"Math.max",
"Math",
"nums[i]",
"nums",
"i",
"target[i-1]",
"target",
"i-1",
"i",
"1",
"ans += (target[i]-nums[i])",
"ans",
"(target[i]-nums[i])",
"target[i]",
"target",
"i",
"nums[i]",
"nums",
"i",
"pw.println(ans)",
"pw.println",
"pw",
"ans",
"pw.close()",
"pw.close",
"pw",
"String[] args",
"args",
"static class FastScanner { \n BufferedReader br; \n StringTokenizer st; \n \n public FastScanner() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n } \n \n String next() { \n while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }\n \n int ni() { \n return Integer.parseInt(next()); \n }\n \n long nl() { \n return Long.parseLong(next()); \n } \n \n double nd() { \n return Double.parseDouble(next()); \n } \n \n String nextLine() {\n String str = \"\"; \n try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n } \n return str;\n }\n }",
"FastScanner",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastScanner() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n }",
"FastScanner",
"{ \n br = new BufferedReader(new InputStreamReader(System.in)); \n }",
"br = new BufferedReader(new InputStreamReader(System.in))",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String next() { \n while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }",
"next",
"{ \n while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }",
"while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{ \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n }",
"try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n }",
"catch (IOException e) { \n e.printStackTrace(); \n }",
"IOException e",
"{ \n e.printStackTrace(); \n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"int ni() { \n return Integer.parseInt(next()); \n }",
"ni",
"{ \n return Integer.parseInt(next()); \n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"long nl() { \n return Long.parseLong(next()); \n }",
"nl",
"{ \n return Long.parseLong(next()); \n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"double nd() { \n return Double.parseDouble(next()); \n }",
"nd",
"{ \n return Double.parseDouble(next()); \n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"String nextLine() {\n String str = \"\"; \n try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n } \n return str;\n }",
"nextLine",
"{\n String str = \"\"; \n try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n } \n return str;\n }",
"String str = \"\";",
"str",
"\"\"",
"try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n }",
"catch (IOException e) {\n e.printStackTrace(); \n }",
"IOException e",
"{\n e.printStackTrace(); \n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{ \n str = br.readLine(); \n }",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public class Main {\n\tstatic final long MOD = 1000000007L;\n\tstatic final int INF = 50000000;\n\t\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint N = sc.ni();\n\t\tlong[] nums = new long[N];\n\t\tlong[] target = new long[N];\n\t\tnums[0] = sc.nl();\n\t\ttarget[0] = nums[0];\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}\n\t\tpw.println(ans);\n\t\tpw.close();\n\t}\n\n static class FastScanner { \n BufferedReader br; \n StringTokenizer st; \n \n public FastScanner() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n } \n \n String next() { \n while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }\n \n int ni() { \n return Integer.parseInt(next()); \n }\n \n long nl() { \n return Long.parseLong(next()); \n } \n \n double nd() { \n return Double.parseDouble(next()); \n } \n \n String nextLine() {\n String str = \"\"; \n try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n } \n return str;\n }\n }\n}",
"public class Main {\n\tstatic final long MOD = 1000000007L;\n\tstatic final int INF = 50000000;\n\t\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\n\t\tPrintWriter pw = new PrintWriter(System.out);\n\t\t\n\t\tint N = sc.ni();\n\t\tlong[] nums = new long[N];\n\t\tlong[] target = new long[N];\n\t\tnums[0] = sc.nl();\n\t\ttarget[0] = nums[0];\n\t\tlong ans = 0;\n\t\tfor (int i = 1; i < N; i++) {\n\t\t\tnums[i] = sc.nl();\n\t\t\ttarget[i] = Math.max(nums[i], target[i-1]);\n\t\t\tans += (target[i]-nums[i]);\n\t\t}\n\t\tpw.println(ans);\n\t\tpw.close();\n\t}\n\n static class FastScanner { \n BufferedReader br; \n StringTokenizer st; \n \n public FastScanner() { \n br = new BufferedReader(new InputStreamReader(System.in)); \n } \n \n String next() { \n while (st == null || !st.hasMoreElements()) { \n try { \n st = new StringTokenizer(br.readLine());\n } catch (IOException e) { \n e.printStackTrace(); \n } \n } \n return st.nextToken(); \n }\n \n int ni() { \n return Integer.parseInt(next()); \n }\n \n long nl() { \n return Long.parseLong(next()); \n } \n \n double nd() { \n return Double.parseDouble(next()); \n } \n \n String nextLine() {\n String str = \"\"; \n try { \n str = br.readLine(); \n } catch (IOException e) {\n e.printStackTrace(); \n } \n return str;\n }\n }\n}",
"Main"
]
| import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
static final long MOD = 1000000007L;
static final int INF = 50000000;
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter pw = new PrintWriter(System.out);
int N = sc.ni();
long[] nums = new long[N];
long[] target = new long[N];
nums[0] = sc.nl();
target[0] = nums[0];
long ans = 0;
for (int i = 1; i < N; i++) {
nums[i] = sc.nl();
target[i] = Math.max(nums[i], target[i-1]);
ans += (target[i]-nums[i]);
}
pw.println(ans);
pw.close();
}
static class FastScanner {
BufferedReader br;
StringTokenizer st;
public FastScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int ni() {
return Integer.parseInt(next());
}
long nl() {
return Long.parseLong(next());
}
double nd() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
14,
2,
13,
17,
0,
13,
13,
30,
14,
2,
13,
13,
0,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
38,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
48,
50
],
[
44,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
6,
70
],
[
70,
71
]
]
| [
"import java.util.*;\nclass Main{\n\tpublic static void main(String[] args){\n\t Scanner scan = new Scanner(System.in);\n\t int N = scan.nextInt();\n int A = 0;\n long count = 0;\n int max = 0;\n for(int i = 0; i < N; i++){\n A = scan.nextInt();\n if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }\n }\n System.out.println(count);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\tpublic static void main(String[] args){\n\t Scanner scan = new Scanner(System.in);\n\t int N = scan.nextInt();\n int A = 0;\n long count = 0;\n int max = 0;\n for(int i = 0; i < N; i++){\n A = scan.nextInt();\n if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }\n }\n System.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t Scanner scan = new Scanner(System.in);\n\t int N = scan.nextInt();\n int A = 0;\n long count = 0;\n int max = 0;\n for(int i = 0; i < N; i++){\n A = scan.nextInt();\n if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }\n }\n System.out.println(count);\n\t}",
"main",
"{\n\t Scanner scan = new Scanner(System.in);\n\t int N = scan.nextInt();\n int A = 0;\n long count = 0;\n int max = 0;\n for(int i = 0; i < N; i++){\n A = scan.nextInt();\n if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }\n }\n System.out.println(count);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int A = 0;",
"A",
"0",
"long count = 0;",
"count",
"0",
"int max = 0;",
"max",
"0",
"for(int i = 0; i < N; i++){\n A = scan.nextInt();\n if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A = scan.nextInt();\n if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }\n }",
"{\n A = scan.nextInt();\n if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }\n }",
"A = scan.nextInt()",
"A",
"scan.nextInt()",
"scan.nextInt",
"scan",
"if(i == 0) max = A;\n else{\n if(max <= A) max = A;\n \t count += max - A;\n }",
"i == 0",
"i",
"0",
"max = A",
"max",
"A",
"{\n if(max <= A) max = A;\n \t count += max - A;\n }",
"if(max <= A) max = A;",
"max <= A",
"max",
"A",
"max = A",
"max",
"A",
"count += max - A",
"count",
"max - A",
"max",
"A",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
]
| import java.util.*;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int A = 0;
long count = 0;
int max = 0;
for(int i = 0; i < N; i++){
A = scan.nextInt();
if(i == 0) max = A;
else{
if(max <= A) max = A;
count += max - A;
}
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
38,
30,
4,
18,
13,
4,
18,
18,
13,
13,
13,
30,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
30,
0,
13,
13,
0,
13,
2,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
70,
5
],
[
70,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
16,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
15,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
26,
32
],
[
32,
33
],
[
32,
34
],
[
26,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
53,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
47,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
6,
67
],
[
67,
68
],
[
0,
69
],
[
69,
70
],
[
69,
71
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong answer = 0;\n\n\t\ttry {\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}finally {\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong answer = 0;\n\n\t\ttry {\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}finally {\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong answer = 0;\n\n\t\ttry {\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}finally {\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong answer = 0;\n\n\t\ttry {\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}finally {\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"long answer = 0;",
"answer",
"0",
"try {\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}finally {\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}",
"{\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}",
"sc.close()",
"sc.close",
"sc",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"{\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int max = 0;",
"max",
"0",
"for(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}",
"{\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}",
"int t = sc.nextInt();",
"t",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}",
"max >= t",
"max",
"t",
"{\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}",
"{\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}",
"max = t",
"max",
"t",
"answer += max - t",
"answer",
"max - t",
"max",
"t",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong answer = 0;\n\n\t\ttry {\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}finally {\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tlong answer = 0;\n\n\t\ttry {\n\n\t\t\tint N = sc.nextInt();\n\t\t\tint max = 0;\n\n\t\t\tfor(int i = 0; i < N; i++) {\n\t\t\t\tint t = sc.nextInt();\n\t\t\t\t//既出の最大値の方が大きいとき\n\t\t\t\tif(max >= t) {\n\t\t\t\t\t//最大値更新せず\n\t\t\t\t}else {\n\t\t\t\t\t//最大値更新\n\t\t\t\t\tmax = t ;\n\t\t\t\t}\n\t\t\t\t//最大値との差が必要な高さ\n\t\t\t\tanswer += max - t;\n\t\t\t}\n\n\t\t}finally {\n\t\t\tsc.close();\n\t\t\tSystem.out.println(answer);\n\t\t}\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
long answer = 0;
try {
int N = sc.nextInt();
int max = 0;
for(int i = 0; i < N; i++) {
int t = sc.nextInt();
//既出の最大値の方が大きいとき
if(max >= t) {
//最大値更新せず
}else {
//最大値更新
max = t ;
}
//最大値との差が必要な高さ
answer += max - t;
}
}finally {
sc.close();
System.out.println(answer);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
17,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
0,
13,
18,
13,
13,
14,
2,
18,
13,
13,
13,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
13,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
2,
4,
18,
13,
13,
4,
18,
13,
13,
29,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
13,
17,
29,
17,
14,
2,
2,
13,
17,
17,
29,
17,
14,
2,
13,
17,
29,
17,
14,
2,
2,
13,
17,
17,
29,
17,
41,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
0,
13,
17,
30,
30,
14,
2,
2,
13,
13,
17,
29,
17,
14,
2,
2,
13,
2,
13,
17,
17,
29,
17,
29,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
306,
5
],
[
306,
6
],
[
6,
7
],
[
6,
8
],
[
306,
9
],
[
9,
10
],
[
9,
11
],
[
306,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
14,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
14,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
14,
48
],
[
48,
49
],
[
48,
50
],
[
14,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
64,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
64,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
75,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
14,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
12,
94
],
[
94,
95
],
[
306,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
100,
104
],
[
96,
105
],
[
105,
106
],
[
96,
107
],
[
107,
108
],
[
306,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
116,
117
],
[
116,
118
],
[
116,
119
],
[
113,
120
],
[
109,
121
],
[
121,
122
],
[
109,
123
],
[
123,
124
],
[
109,
125
],
[
125,
126
],
[
306,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
134,
135
],
[
134,
136
],
[
134,
137
],
[
131,
138
],
[
138,
139
],
[
138,
140
],
[
138,
141
],
[
127,
142
],
[
142,
143
],
[
127,
144
],
[
144,
145
],
[
127,
146
],
[
146,
147
],
[
127,
148
],
[
148,
149
],
[
306,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
154,
158
],
[
150,
159
],
[
159,
160
],
[
150,
161
],
[
161,
162
],
[
306,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
167,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
171,
174
],
[
163,
175
],
[
175,
176
],
[
163,
177
],
[
177,
178
],
[
163,
179
],
[
179,
180
],
[
306,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
185,
188
],
[
188,
189
],
[
188,
190
],
[
188,
191
],
[
185,
192
],
[
192,
193
],
[
192,
194
],
[
192,
195
],
[
181,
196
],
[
196,
197
],
[
181,
198
],
[
198,
199
],
[
181,
200
],
[
200,
201
],
[
181,
202
],
[
202,
203
],
[
306,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
211,
212
],
[
210,
213
],
[
209,
214
],
[
214,
215
],
[
215,
216
],
[
214,
217
],
[
206,
218
],
[
218,
219
],
[
219,
220
],
[
219,
221
],
[
204,
222
],
[
222,
223
],
[
204,
224
],
[
224,
225
],
[
306,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
229,
233
],
[
233,
234
],
[
228,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
235,
239
],
[
239,
240
],
[
228,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
242,
246
],
[
241,
247
],
[
247,
248
],
[
228,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
253,
254
],
[
228,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
257,
259
],
[
256,
260
],
[
255,
261
],
[
261,
262
],
[
228,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
266,
267
],
[
265,
268
],
[
228,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
271,
273
],
[
269,
274
],
[
274,
275
],
[
274,
276
],
[
269,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
269,
281
],
[
282,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
285,
287
],
[
284,
288
],
[
283,
289
],
[
289,
290
],
[
282,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
293,
295
],
[
295,
296
],
[
295,
297
],
[
292,
298
],
[
291,
299
],
[
299,
300
],
[
228,
301
],
[
301,
302
],
[
226,
303
],
[
303,
304
],
[
0,
305
],
[
305,
306
],
[
305,
307
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n static Scanner sc = new Scanner(System.in);\n static final int mod = 1000000007;\n\n public static void main(String[] args) {\n\n int n =sc.nextInt();\n int[] a = new int[n];\n for(int i =0; i<n; i++)\n a[i] = sc.nextInt();\n int high = a[0];\n long ans = 0;\n for(int i =1; i<n; i++)\n {\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }\n \n System.out.println(ans);\n \n \n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int max(int a, int b)\n {\n return Math.max(a,b);\n }\n static int max(int a, int b, int c)\n {\n return Math.max(max(a,b), c);\n }\n static int max(int a, int b, int c, int d)\n {\n return Math.max(max(a,b), max(c,d));\n }\n\n static int min(int a, int b)\n {\n return Math.min(a, b);\n }\n\n static int min(int a, int b, int c )\n {\n return Math.min(a, min(b,c));\n }\n\n static int min(int a, int b, int c, int d )\n {\n return Math.min(min(a,d), min(b,c));\n }\n\n static boolean isPower(int a, int b)\n {\n double temp = Math.log(a)/Math.log(b);\n return temp == (int) temp;\n }\n static boolean isPrime(int n)\n {\n if(n==1) return false;\n if(n==2) return true;\n if(n%2==0) return false;\n\n if(n<9)return true;\n if(n%3==0) return false;\n\n int r = (int)Math.sqrt(n);\n\n for(int i = 5; i<=r; i +=6)\n {\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }\n return true;\n\n\n\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n static final int mod = 1000000007;\n\n public static void main(String[] args) {\n\n int n =sc.nextInt();\n int[] a = new int[n];\n for(int i =0; i<n; i++)\n a[i] = sc.nextInt();\n int high = a[0];\n long ans = 0;\n for(int i =1; i<n; i++)\n {\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }\n \n System.out.println(ans);\n \n \n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int max(int a, int b)\n {\n return Math.max(a,b);\n }\n static int max(int a, int b, int c)\n {\n return Math.max(max(a,b), c);\n }\n static int max(int a, int b, int c, int d)\n {\n return Math.max(max(a,b), max(c,d));\n }\n\n static int min(int a, int b)\n {\n return Math.min(a, b);\n }\n\n static int min(int a, int b, int c )\n {\n return Math.min(a, min(b,c));\n }\n\n static int min(int a, int b, int c, int d )\n {\n return Math.min(min(a,d), min(b,c));\n }\n\n static boolean isPower(int a, int b)\n {\n double temp = Math.log(a)/Math.log(b);\n return temp == (int) temp;\n }\n static boolean isPrime(int n)\n {\n if(n==1) return false;\n if(n==2) return true;\n if(n%2==0) return false;\n\n if(n<9)return true;\n if(n%3==0) return false;\n\n int r = (int)Math.sqrt(n);\n\n for(int i = 5; i<=r; i +=6)\n {\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }\n return true;\n\n\n\n }\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"static final int mod = 1000000007;",
"mod",
"1000000007",
"public static void main(String[] args) {\n\n int n =sc.nextInt();\n int[] a = new int[n];\n for(int i =0; i<n; i++)\n a[i] = sc.nextInt();\n int high = a[0];\n long ans = 0;\n for(int i =1; i<n; i++)\n {\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }\n \n System.out.println(ans);\n \n \n\n\n\n }",
"main",
"{\n\n int n =sc.nextInt();\n int[] a = new int[n];\n for(int i =0; i<n; i++)\n a[i] = sc.nextInt();\n int high = a[0];\n long ans = 0;\n for(int i =1; i<n; i++)\n {\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }\n \n System.out.println(ans);\n \n \n\n\n\n }",
"int n =sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for(int i =0; i<n; i++)\n a[i] = sc.nextInt();",
"int i =0;",
"int i =0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = sc.nextInt();",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int high = a[0];",
"high",
"a[0]",
"a",
"0",
"long ans = 0;",
"ans",
"0",
"for(int i =1; i<n; i++)\n {\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }",
"int i =1;",
"int i =1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }",
"{\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }",
"if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];",
"a[i]>high",
"a[i]",
"a",
"i",
"high",
"high = a[i]",
"high",
"a[i]",
"a",
"i",
"if(a[i]<high)\n ans+= high-a[i];",
"a[i]<high",
"a[i]",
"a",
"i",
"high",
"ans+= high-a[i]",
"ans",
"high-a[i]",
"high",
"a[i]",
"a",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static int max(int a, int b)\n {\n return Math.max(a,b);\n }",
"max",
"{\n return Math.max(a,b);\n }",
"return Math.max(a,b);",
"Math.max(a,b)",
"Math.max",
"Math",
"a",
"b",
"int a",
"a",
"int b",
"b",
"static int max(int a, int b, int c)\n {\n return Math.max(max(a,b), c);\n }",
"max",
"{\n return Math.max(max(a,b), c);\n }",
"return Math.max(max(a,b), c);",
"Math.max(max(a,b), c)",
"Math.max",
"Math",
"max(a,b)",
"max",
"a",
"b",
"c",
"int a",
"a",
"int b",
"b",
"int c",
"c",
"static int max(int a, int b, int c, int d)\n {\n return Math.max(max(a,b), max(c,d));\n }",
"max",
"{\n return Math.max(max(a,b), max(c,d));\n }",
"return Math.max(max(a,b), max(c,d));",
"Math.max(max(a,b), max(c,d))",
"Math.max",
"Math",
"max(a,b)",
"max",
"a",
"b",
"max(c,d)",
"max",
"c",
"d",
"int a",
"a",
"int b",
"b",
"int c",
"c",
"int d",
"d",
"static int min(int a, int b)\n {\n return Math.min(a, b);\n }",
"min",
"{\n return Math.min(a, b);\n }",
"return Math.min(a, b);",
"Math.min(a, b)",
"Math.min",
"Math",
"a",
"b",
"int a",
"a",
"int b",
"b",
"static int min(int a, int b, int c )\n {\n return Math.min(a, min(b,c));\n }",
"min",
"{\n return Math.min(a, min(b,c));\n }",
"return Math.min(a, min(b,c));",
"Math.min(a, min(b,c))",
"Math.min",
"Math",
"a",
"min(b,c)",
"min",
"b",
"c",
"int a",
"a",
"int b",
"b",
"int c",
"c",
"static int min(int a, int b, int c, int d )\n {\n return Math.min(min(a,d), min(b,c));\n }",
"min",
"{\n return Math.min(min(a,d), min(b,c));\n }",
"return Math.min(min(a,d), min(b,c));",
"Math.min(min(a,d), min(b,c))",
"Math.min",
"Math",
"min(a,d)",
"min",
"a",
"d",
"min(b,c)",
"min",
"b",
"c",
"int a",
"a",
"int b",
"b",
"int c",
"c",
"int d",
"d",
"static boolean isPower(int a, int b)\n {\n double temp = Math.log(a)/Math.log(b);\n return temp == (int) temp;\n }",
"isPower",
"{\n double temp = Math.log(a)/Math.log(b);\n return temp == (int) temp;\n }",
"double temp = Math.log(a)/Math.log(b);",
"temp",
"Math.log(a)/Math.log(b)",
"Math.log(a)",
"Math.log",
"Math",
"a",
"Math.log(b)",
"Math.log",
"Math",
"b",
"return temp == (int) temp;",
"temp == (int) temp",
"temp",
"(int) temp",
"int a",
"a",
"int b",
"b",
"static boolean isPrime(int n)\n {\n if(n==1) return false;\n if(n==2) return true;\n if(n%2==0) return false;\n\n if(n<9)return true;\n if(n%3==0) return false;\n\n int r = (int)Math.sqrt(n);\n\n for(int i = 5; i<=r; i +=6)\n {\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }\n return true;\n\n\n\n }",
"isPrime",
"{\n if(n==1) return false;\n if(n==2) return true;\n if(n%2==0) return false;\n\n if(n<9)return true;\n if(n%3==0) return false;\n\n int r = (int)Math.sqrt(n);\n\n for(int i = 5; i<=r; i +=6)\n {\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }\n return true;\n\n\n\n }",
"if(n==1) return false;",
"n==1",
"n",
"1",
"return false;",
"false",
"if(n==2) return true;",
"n==2",
"n",
"2",
"return true;",
"true",
"if(n%2==0) return false;",
"n%2==0",
"n%2",
"n",
"2",
"0",
"return false;",
"false",
"if(n<9)return true;",
"n<9",
"n",
"9",
"return true;",
"true",
"if(n%3==0) return false;",
"n%3==0",
"n%3",
"n",
"3",
"0",
"return false;",
"false",
"int r = (int)Math.sqrt(n);",
"r",
"(int)Math.sqrt(n)",
"Math.sqrt",
"Math",
"n",
"for(int i = 5; i<=r; i +=6)\n {\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }",
"int i = 5;",
"int i = 5;",
"i",
"5",
"i<=r",
"i",
"r",
"i +=6",
"i +=6",
"i",
"6",
"{\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }",
"{\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }",
"if(n%i==0) return false;",
"n%i==0",
"n%i",
"n",
"i",
"0",
"return false;",
"false",
"if(n%(i+2)==0) return false;",
"n%(i+2)==0",
"n%(i+2)",
"n",
"(i+2)",
"i",
"2",
"0",
"return false;",
"false",
"return true;",
"true",
"int n",
"n",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n static final int mod = 1000000007;\n\n public static void main(String[] args) {\n\n int n =sc.nextInt();\n int[] a = new int[n];\n for(int i =0; i<n; i++)\n a[i] = sc.nextInt();\n int high = a[0];\n long ans = 0;\n for(int i =1; i<n; i++)\n {\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }\n \n System.out.println(ans);\n \n \n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int max(int a, int b)\n {\n return Math.max(a,b);\n }\n static int max(int a, int b, int c)\n {\n return Math.max(max(a,b), c);\n }\n static int max(int a, int b, int c, int d)\n {\n return Math.max(max(a,b), max(c,d));\n }\n\n static int min(int a, int b)\n {\n return Math.min(a, b);\n }\n\n static int min(int a, int b, int c )\n {\n return Math.min(a, min(b,c));\n }\n\n static int min(int a, int b, int c, int d )\n {\n return Math.min(min(a,d), min(b,c));\n }\n\n static boolean isPower(int a, int b)\n {\n double temp = Math.log(a)/Math.log(b);\n return temp == (int) temp;\n }\n static boolean isPrime(int n)\n {\n if(n==1) return false;\n if(n==2) return true;\n if(n%2==0) return false;\n\n if(n<9)return true;\n if(n%3==0) return false;\n\n int r = (int)Math.sqrt(n);\n\n for(int i = 5; i<=r; i +=6)\n {\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }\n return true;\n\n\n\n }\n}",
"public class Main {\n static Scanner sc = new Scanner(System.in);\n static final int mod = 1000000007;\n\n public static void main(String[] args) {\n\n int n =sc.nextInt();\n int[] a = new int[n];\n for(int i =0; i<n; i++)\n a[i] = sc.nextInt();\n int high = a[0];\n long ans = 0;\n for(int i =1; i<n; i++)\n {\n if(a[i]>high)\n high = a[i];\n \n else if(a[i]<high)\n ans+= high-a[i];\n \n \n }\n \n System.out.println(ans);\n \n \n\n\n\n }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n static int max(int a, int b)\n {\n return Math.max(a,b);\n }\n static int max(int a, int b, int c)\n {\n return Math.max(max(a,b), c);\n }\n static int max(int a, int b, int c, int d)\n {\n return Math.max(max(a,b), max(c,d));\n }\n\n static int min(int a, int b)\n {\n return Math.min(a, b);\n }\n\n static int min(int a, int b, int c )\n {\n return Math.min(a, min(b,c));\n }\n\n static int min(int a, int b, int c, int d )\n {\n return Math.min(min(a,d), min(b,c));\n }\n\n static boolean isPower(int a, int b)\n {\n double temp = Math.log(a)/Math.log(b);\n return temp == (int) temp;\n }\n static boolean isPrime(int n)\n {\n if(n==1) return false;\n if(n==2) return true;\n if(n%2==0) return false;\n\n if(n<9)return true;\n if(n%3==0) return false;\n\n int r = (int)Math.sqrt(n);\n\n for(int i = 5; i<=r; i +=6)\n {\n if(n%i==0) return false;\n if(n%(i+2)==0) return false;\n }\n return true;\n\n\n\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
static final int mod = 1000000007;
public static void main(String[] args) {
int n =sc.nextInt();
int[] a = new int[n];
for(int i =0; i<n; i++)
a[i] = sc.nextInt();
int high = a[0];
long ans = 0;
for(int i =1; i<n; i++)
{
if(a[i]>high)
high = a[i];
else if(a[i]<high)
ans+= high-a[i];
}
System.out.println(ans);
}
static int max(int a, int b)
{
return Math.max(a,b);
}
static int max(int a, int b, int c)
{
return Math.max(max(a,b), c);
}
static int max(int a, int b, int c, int d)
{
return Math.max(max(a,b), max(c,d));
}
static int min(int a, int b)
{
return Math.min(a, b);
}
static int min(int a, int b, int c )
{
return Math.min(a, min(b,c));
}
static int min(int a, int b, int c, int d )
{
return Math.min(min(a,d), min(b,c));
}
static boolean isPower(int a, int b)
{
double temp = Math.log(a)/Math.log(b);
return temp == (int) temp;
}
static boolean isPrime(int n)
{
if(n==1) return false;
if(n==2) return true;
if(n%2==0) return false;
if(n<9)return true;
if(n%3==0) return false;
int r = (int)Math.sqrt(n);
for(int i = 5; i<=r; i +=6)
{
if(n%i==0) return false;
if(n%(i+2)==0) return false;
}
return true;
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
41,
13,
20,
12,
13,
30,
0,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
2,
13,
13,
4,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
0,
18,
36,
13,
20,
23,
13,
12,
13,
30,
14,
2,
13,
13,
30,
0,
13,
17,
0,
13,
4,
18,
13,
13,
14,
2,
13,
40,
17,
29,
13,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
17,
42,
4,
13,
13,
0,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
20,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
17,
42,
4,
13,
13,
0,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
2,
40,
4,
13,
13,
2,
13,
17,
30,
14,
2,
2,
13,
17,
2,
13,
17,
29,
2,
13,
4,
18,
13,
17,
4,
13,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
29,
2,
13,
4,
18,
13,
17,
4,
13,
0,
13,
17,
0,
13,
2,
2,
13,
17,
13,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
41,
13,
4,
13,
41,
13,
17,
42,
4,
13,
13,
0,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
0,
13,
2,
2,
13,
17,
2,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
29,
2,
13,
13,
12,
13,
30,
29,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
23,
13,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
40,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
18,
13,
13,
41,
13,
40,
17,
42,
2,
13,
13,
30,
0,
13,
2,
2,
13,
13,
17,
14,
2,
18,
13,
13,
13,
0,
13,
13,
0,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
29,
8,
2,
13,
17,
13,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
29,
2,
2,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
13,
17,
29,
13,
14,
2,
2,
13,
17,
17,
29,
2,
4,
13,
2,
2,
13,
13,
13,
2,
13,
17,
13,
13,
29,
2,
2,
13,
4,
13,
2,
2,
13,
13,
13,
2,
13,
17,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
29,
17,
14,
2,
13,
17,
29,
13,
14,
2,
2,
13,
17,
17,
29,
4,
13,
2,
13,
13,
2,
13,
17,
29,
2,
13,
4,
13,
2,
13,
13,
2,
13,
17,
23,
13,
23,
13,
12,
13,
30,
0,
13,
4,
18,
13,
13,
2,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
13,
2,
2,
13,
2,
13,
13,
2,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
13,
29,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
13,
2,
13,
2,
13,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
763,
8
],
[
763,
9
],
[
9,
10
],
[
763,
11
],
[
11,
12
],
[
763,
13
],
[
13,
14
],
[
13,
15
],
[
763,
16
],
[
16,
17
],
[
16,
18
],
[
763,
19
],
[
19,
20
],
[
19,
21
],
[
763,
22
],
[
22,
23
],
[
22,
24
],
[
763,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
27,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
45,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
53,
57
],
[
45,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
60,
62
],
[
27,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
27,
67
],
[
67,
68
],
[
68,
69
],
[
25,
70
],
[
70,
71
],
[
763,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
72,
80
],
[
80,
81
],
[
72,
82
],
[
82,
83
],
[
72,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
84,
92
],
[
92,
93
],
[
72,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
94,
102
],
[
102,
103
],
[
72,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
106,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
121,
126
],
[
126,
127
],
[
106,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
72,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
135,
140
],
[
140,
141
],
[
140,
142
],
[
135,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
135,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
155,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
135,
164
],
[
164,
165
],
[
164,
166
],
[
135,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
179,
180
],
[
179,
181
],
[
172,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
172,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
135,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
72,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
197,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
202,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
197,
210
],
[
210,
211
],
[
210,
212
],
[
197,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
219,
222
],
[
218,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
197,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
72,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
236,
237
],
[
233,
238
],
[
238,
239
],
[
238,
240
],
[
233,
241
],
[
241,
242
],
[
242,
243
],
[
242,
244
],
[
241,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
233,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
249,
253
],
[
253,
254
],
[
254,
255
],
[
254,
256
],
[
256,
257
],
[
253,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
233,
262
],
[
262,
263
],
[
262,
264
],
[
233,
265
],
[
265,
266
],
[
266,
267
],
[
267,
268
],
[
268,
269
],
[
268,
270
],
[
266,
271
],
[
271,
272
],
[
271,
273
],
[
265,
274
],
[
274,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
276,
280
],
[
280,
281
],
[
280,
282
],
[
275,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
286,
287
],
[
287,
288
],
[
286,
289
],
[
286,
290
],
[
290,
291
],
[
274,
292
],
[
292,
293
],
[
292,
294
],
[
274,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
297,
299
],
[
274,
300
],
[
300,
301
],
[
300,
302
],
[
302,
303
],
[
233,
304
],
[
304,
305
],
[
305,
306
],
[
305,
307
],
[
304,
308
],
[
308,
309
],
[
309,
310
],
[
309,
311
],
[
311,
312
],
[
308,
313
],
[
313,
314
],
[
313,
315
],
[
308,
316
],
[
316,
317
],
[
317,
318
],
[
318,
319
],
[
318,
320
],
[
316,
321
],
[
321,
322
],
[
322,
323
],
[
323,
324
],
[
324,
325
],
[
324,
326
],
[
323,
327
],
[
327,
328
],
[
327,
329
],
[
322,
330
],
[
330,
331
],
[
331,
332
],
[
331,
333
],
[
333,
334
],
[
334,
335
],
[
333,
336
],
[
333,
337
],
[
337,
338
],
[
321,
339
],
[
339,
340
],
[
339,
341
],
[
321,
342
],
[
342,
343
],
[
342,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
344,
348
],
[
321,
349
],
[
349,
350
],
[
349,
351
],
[
351,
352
],
[
233,
353
],
[
353,
354
],
[
354,
355
],
[
354,
356
],
[
72,
357
],
[
357,
358
],
[
357,
359
],
[
359,
360
],
[
360,
361
],
[
360,
362
],
[
362,
363
],
[
359,
364
],
[
364,
365
],
[
364,
366
],
[
359,
367
],
[
367,
368
],
[
368,
369
],
[
368,
370
],
[
367,
371
],
[
371,
372
],
[
371,
373
],
[
373,
374
],
[
359,
375
],
[
375,
376
],
[
376,
377
],
[
376,
378
],
[
375,
379
],
[
379,
380
],
[
380,
381
],
[
380,
382
],
[
382,
383
],
[
379,
384
],
[
384,
385
],
[
384,
386
],
[
386,
387
],
[
359,
388
],
[
388,
389
],
[
388,
390
],
[
359,
391
],
[
391,
392
],
[
392,
393
],
[
393,
394
],
[
393,
395
],
[
391,
396
],
[
396,
397
],
[
397,
398
],
[
397,
399
],
[
399,
400
],
[
400,
401
],
[
400,
402
],
[
399,
403
],
[
403,
404
],
[
403,
405
],
[
396,
406
],
[
406,
407
],
[
406,
408
],
[
408,
409
],
[
408,
410
],
[
396,
411
],
[
411,
412
],
[
411,
413
],
[
413,
414
],
[
359,
415
],
[
415,
416
],
[
416,
417
],
[
416,
418
],
[
72,
419
],
[
419,
420
],
[
419,
421
],
[
421,
422
],
[
422,
423
],
[
426,
424
],
[
436,
425
],
[
433,
426
],
[
426,
427
],
[
427,
428
],
[
427,
429
],
[
426,
430
],
[
430,
431
],
[
430,
432
],
[
433,
433
],
[
433,
434
],
[
433,
435
],
[
436,
436
],
[
436,
437
],
[
436,
438
],
[
426,
439
],
[
439,
440
],
[
439,
441
],
[
441,
442
],
[
419,
443
],
[
443,
444
],
[
763,
445
],
[
445,
446
],
[
445,
447
],
[
447,
448
],
[
447,
449
],
[
445,
450
],
[
450,
451
],
[
450,
452
],
[
452,
453
],
[
453,
454
],
[
453,
455
],
[
452,
456
],
[
456,
457
],
[
456,
458
],
[
458,
459
],
[
458,
460
],
[
452,
461
],
[
461,
462
],
[
461,
463
],
[
463,
464
],
[
452,
465
],
[
465,
466
],
[
466,
467
],
[
466,
468
],
[
465,
469
],
[
469,
470
],
[
470,
471
],
[
470,
472
],
[
472,
473
],
[
473,
474
],
[
473,
475
],
[
472,
476
],
[
469,
477
],
[
477,
478
],
[
478,
479
],
[
479,
480
],
[
479,
481
],
[
478,
482
],
[
477,
483
],
[
483,
484
],
[
483,
485
],
[
477,
486
],
[
486,
487
],
[
486,
488
],
[
488,
489
],
[
488,
490
],
[
452,
491
],
[
491,
492
],
[
450,
493
],
[
493,
494
],
[
450,
495
],
[
495,
496
],
[
445,
497
],
[
497,
498
],
[
497,
499
],
[
499,
500
],
[
500,
501
],
[
500,
502
],
[
499,
503
],
[
503,
504
],
[
503,
505
],
[
505,
506
],
[
505,
507
],
[
499,
508
],
[
508,
509
],
[
508,
510
],
[
510,
511
],
[
499,
512
],
[
512,
513
],
[
513,
514
],
[
513,
515
],
[
512,
516
],
[
516,
517
],
[
517,
518
],
[
517,
519
],
[
519,
520
],
[
520,
521
],
[
520,
522
],
[
519,
523
],
[
516,
524
],
[
524,
525
],
[
525,
526
],
[
526,
527
],
[
526,
528
],
[
525,
529
],
[
524,
530
],
[
530,
531
],
[
530,
532
],
[
524,
533
],
[
533,
534
],
[
533,
535
],
[
535,
536
],
[
535,
537
],
[
499,
538
],
[
538,
539
],
[
497,
540
],
[
540,
541
],
[
497,
542
],
[
542,
543
],
[
445,
544
],
[
544,
545
],
[
544,
546
],
[
546,
547
],
[
547,
548
],
[
548,
549
],
[
549,
550
],
[
549,
551
],
[
548,
552
],
[
548,
553
],
[
553,
554
],
[
553,
555
],
[
553,
556
],
[
556,
557
],
[
556,
558
],
[
544,
559
],
[
559,
560
],
[
544,
561
],
[
561,
562
],
[
445,
563
],
[
563,
564
],
[
563,
565
],
[
565,
566
],
[
566,
567
],
[
567,
568
],
[
568,
569
],
[
568,
570
],
[
567,
571
],
[
571,
572
],
[
571,
573
],
[
571,
574
],
[
563,
575
],
[
575,
576
],
[
563,
577
],
[
577,
578
],
[
445,
579
],
[
579,
580
],
[
579,
581
],
[
581,
582
],
[
582,
583
],
[
583,
584
],
[
583,
585
],
[
582,
586
],
[
586,
587
],
[
581,
588
],
[
588,
589
],
[
589,
590
],
[
589,
591
],
[
588,
592
],
[
592,
593
],
[
581,
594
],
[
594,
595
],
[
595,
596
],
[
596,
597
],
[
596,
598
],
[
595,
599
],
[
594,
600
],
[
600,
601
],
[
601,
602
],
[
602,
603
],
[
602,
604
],
[
604,
605
],
[
605,
606
],
[
605,
607
],
[
604,
608
],
[
602,
609
],
[
609,
610
],
[
609,
611
],
[
602,
612
],
[
601,
613
],
[
581,
614
],
[
614,
615
],
[
615,
616
],
[
616,
617
],
[
616,
618
],
[
618,
619
],
[
618,
620
],
[
620,
621
],
[
621,
622
],
[
621,
623
],
[
620,
624
],
[
618,
625
],
[
625,
626
],
[
625,
627
],
[
618,
628
],
[
615,
629
],
[
579,
630
],
[
630,
631
],
[
579,
632
],
[
632,
633
],
[
579,
634
],
[
634,
635
],
[
445,
636
],
[
636,
637
],
[
636,
638
],
[
638,
639
],
[
639,
640
],
[
640,
641
],
[
640,
642
],
[
639,
643
],
[
643,
644
],
[
638,
645
],
[
645,
646
],
[
646,
647
],
[
646,
648
],
[
645,
649
],
[
649,
650
],
[
638,
651
],
[
651,
652
],
[
652,
653
],
[
653,
654
],
[
653,
655
],
[
652,
656
],
[
651,
657
],
[
657,
658
],
[
658,
659
],
[
658,
660
],
[
660,
661
],
[
660,
662
],
[
658,
663
],
[
663,
664
],
[
663,
665
],
[
638,
666
],
[
666,
667
],
[
667,
668
],
[
667,
669
],
[
669,
670
],
[
669,
671
],
[
671,
672
],
[
671,
673
],
[
669,
674
],
[
674,
675
],
[
674,
676
],
[
636,
677
],
[
677,
678
],
[
636,
679
],
[
679,
680
],
[
445,
681
],
[
681,
682
],
[
681,
683
],
[
683,
684
],
[
684,
685
],
[
684,
686
],
[
686,
687
],
[
687,
688
],
[
686,
689
],
[
686,
690
],
[
690,
691
],
[
690,
692
],
[
683,
693
],
[
693,
694
],
[
693,
695
],
[
683,
696
],
[
696,
697
],
[
697,
698
],
[
698,
699
],
[
698,
700
],
[
696,
701
],
[
701,
702
],
[
701,
703
],
[
696,
704
],
[
704,
705
],
[
705,
706
],
[
696,
707
],
[
707,
708
],
[
708,
709
],
[
708,
710
],
[
710,
711
],
[
711,
712
],
[
711,
713
],
[
713,
714
],
[
713,
715
],
[
710,
716
],
[
716,
717
],
[
716,
718
],
[
683,
719
],
[
719,
720
],
[
681,
721
],
[
721,
722
],
[
681,
723
],
[
723,
724
],
[
445,
725
],
[
725,
726
],
[
725,
727
],
[
727,
728
],
[
728,
729
],
[
729,
730
],
[
729,
731
],
[
728,
732
],
[
732,
733
],
[
727,
734
],
[
734,
735
],
[
734,
736
],
[
727,
737
],
[
737,
738
],
[
738,
739
],
[
739,
740
],
[
739,
741
],
[
737,
742
],
[
742,
743
],
[
742,
744
],
[
737,
745
],
[
745,
746
],
[
746,
747
],
[
737,
748
],
[
748,
749
],
[
749,
750
],
[
749,
751
],
[
751,
752
],
[
751,
753
],
[
753,
754
],
[
753,
755
],
[
727,
756
],
[
756,
757
],
[
725,
758
],
[
758,
759
],
[
725,
760
],
[
760,
761
],
[
0,
762
],
[
762,
763
],
[
762,
764
]
]
| [
"// Utilities\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\tstatic int N;\n\tstatic int x;\n\tstatic long max = 0, curMax = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tN = in.iscan();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}\n\t\tout.println(max);\n\t\tout.close();\n\t} \n\t\n\tstatic INPUT in = new INPUT(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tprivate static class INPUT {\n\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar, numChars;\n\n\t\tpublic INPUT (InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tpublic INPUT (String file) throws IOException {\n\t\t\tthis.stream = new FileInputStream (file);\n\t\t}\n\n\t\tpublic int cscan () throws IOException {\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}\n\t\t\t\n\t\t\tif (numChars == -1)\n\t\t\t\treturn numChars;\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int iscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String sscan () throws IOException {\n\t\t\tint c = cscan ();\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tStringBuilder res = new StringBuilder ();\n\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res.toString ();\n\t\t}\n\n\t\tpublic double dscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tdouble res = 0;\n\n\t\t\twhile (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tif (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long lscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic boolean space (int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\t}\n\n\tpublic static class UTILITIES {\n\n\t\tstatic final double EPS = 10e-6;\n\n\t\tpublic static int lower_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int upper_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int gcd (int a, int b) {\n\t\t\treturn b == 0 ? a : gcd (b, a % b);\n\t\t}\n\n\t\tpublic static int lcm (int a, int b) {\n\t\t\treturn a * b / gcd (a, b);\n\t\t}\n\n\t\tpublic static long fast_pow_mod (long b, long x, int mod) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\n\t\t\treturn b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\t\t}\n\n\t\tpublic static int fast_pow (int b, int x) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow (b * b, x / 2);\n\n\t\t\treturn b * fast_pow (b * b, x / 2);\n\t\t}\n\n\t\tpublic static long choose (long n, long k) {\n\t\t\tk = Math.min (k, n - k);\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);\n\n\t\t\treturn val;\n\t\t}\n\n\t\tpublic static long permute (int n, int k) {\n\t\t\tif (n < k) return 0;\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));\n\n\t\t\treturn val;\n\t\t}\n\t}\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tstatic int N;\n\tstatic int x;\n\tstatic long max = 0, curMax = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tN = in.iscan();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}\n\t\tout.println(max);\n\t\tout.close();\n\t} \n\t\n\tstatic INPUT in = new INPUT(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tprivate static class INPUT {\n\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar, numChars;\n\n\t\tpublic INPUT (InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tpublic INPUT (String file) throws IOException {\n\t\t\tthis.stream = new FileInputStream (file);\n\t\t}\n\n\t\tpublic int cscan () throws IOException {\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}\n\t\t\t\n\t\t\tif (numChars == -1)\n\t\t\t\treturn numChars;\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int iscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String sscan () throws IOException {\n\t\t\tint c = cscan ();\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tStringBuilder res = new StringBuilder ();\n\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res.toString ();\n\t\t}\n\n\t\tpublic double dscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tdouble res = 0;\n\n\t\t\twhile (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tif (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long lscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic boolean space (int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\t}\n\n\tpublic static class UTILITIES {\n\n\t\tstatic final double EPS = 10e-6;\n\n\t\tpublic static int lower_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int upper_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int gcd (int a, int b) {\n\t\t\treturn b == 0 ? a : gcd (b, a % b);\n\t\t}\n\n\t\tpublic static int lcm (int a, int b) {\n\t\t\treturn a * b / gcd (a, b);\n\t\t}\n\n\t\tpublic static long fast_pow_mod (long b, long x, int mod) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\n\t\t\treturn b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\t\t}\n\n\t\tpublic static int fast_pow (int b, int x) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow (b * b, x / 2);\n\n\t\t\treturn b * fast_pow (b * b, x / 2);\n\t\t}\n\n\t\tpublic static long choose (long n, long k) {\n\t\t\tk = Math.min (k, n - k);\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);\n\n\t\t\treturn val;\n\t\t}\n\n\t\tpublic static long permute (int n, int k) {\n\t\t\tif (n < k) return 0;\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));\n\n\t\t\treturn val;\n\t\t}\n\t}\n}",
"Main",
"static int N;",
"N",
"static int x;",
"x",
"static long max = 0",
"max",
"0",
"curMax = 0;",
"curMax",
"0",
"static INPUT in = new INPUT(System.in);",
"in",
"new INPUT(System.in)",
"static PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"public static void main(String[] args) throws IOException {\n\t\tN = in.iscan();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}\n\t\tout.println(max);\n\t\tout.close();\n\t}",
"main",
"{\n\t\tN = in.iscan();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}\n\t\tout.println(max);\n\t\tout.close();\n\t}",
"N = in.iscan()",
"N",
"in.iscan()",
"in.iscan",
"in",
"for (int i = 0; i < N; i++) {\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}",
"{\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}",
"x = in.iscan()",
"x",
"in.iscan()",
"in.iscan",
"in",
"curMax = Math.max(curMax, x)",
"curMax",
"Math.max(curMax, x)",
"Math.max",
"Math",
"curMax",
"x",
"max += curMax - x",
"max",
"curMax - x",
"curMax",
"x",
"out.println(max)",
"out.println",
"out",
"max",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"private static class INPUT {\n\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar, numChars;\n\n\t\tpublic INPUT (InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tpublic INPUT (String file) throws IOException {\n\t\t\tthis.stream = new FileInputStream (file);\n\t\t}\n\n\t\tpublic int cscan () throws IOException {\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}\n\t\t\t\n\t\t\tif (numChars == -1)\n\t\t\t\treturn numChars;\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int iscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String sscan () throws IOException {\n\t\t\tint c = cscan ();\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tStringBuilder res = new StringBuilder ();\n\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res.toString ();\n\t\t}\n\n\t\tpublic double dscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tdouble res = 0;\n\n\t\t\twhile (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tif (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long lscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic boolean space (int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\t}",
"INPUT",
"private InputStream stream;",
"stream",
"private byte[] buf = new byte[1024];",
"buf",
"new byte[1024]",
"1024",
"private int curChar",
"curChar",
"numChars;",
"numChars",
"public INPUT (InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}",
"INPUT",
"{\n\t\t\tthis.stream = stream;\n\t\t}",
"this.stream = stream",
"this.stream",
"this",
"this.stream",
"stream",
"InputStream stream",
"stream",
"public INPUT (String file) throws IOException {\n\t\t\tthis.stream = new FileInputStream (file);\n\t\t}",
"INPUT",
"{\n\t\t\tthis.stream = new FileInputStream (file);\n\t\t}",
"this.stream = new FileInputStream (file)",
"this.stream",
"this",
"this.stream",
"new FileInputStream (file)",
"String file",
"file",
"public int cscan () throws IOException {\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}\n\t\t\t\n\t\t\tif (numChars == -1)\n\t\t\t\treturn numChars;\n\n\t\t\treturn buf[curChar++];\n\t\t}",
"cscan",
"{\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}\n\t\t\t\n\t\t\tif (numChars == -1)\n\t\t\t\treturn numChars;\n\n\t\t\treturn buf[curChar++];\n\t\t}",
"if (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}",
"curChar >= numChars",
"curChar",
"numChars",
"{\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}",
"curChar = 0",
"curChar",
"0",
"numChars = stream.read (buf)",
"numChars",
"stream.read (buf)",
"stream.read",
"stream",
"buf",
"if (numChars == -1)\n\t\t\t\treturn numChars;",
"numChars == -1",
"numChars",
"-1",
"1",
"return numChars;",
"numChars",
"return buf[curChar++];",
"buf[curChar++]",
"buf",
"curChar++",
"curChar",
"public int iscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}",
"iscan",
"{\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}",
"int c = cscan ()",
"c",
"cscan ()",
"cscan",
"sgn = 1;",
"sgn",
"1",
"while (space (c))\n\t\t\t\tc = cscan ();",
"space (c)",
"space",
"c",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"if (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}",
"sgn = -1",
"sgn",
"-1",
"1",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"int res = 0;",
"res",
"0",
"do {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));",
"!space (c)",
"space (c)",
"space",
"c",
"{\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}",
"res = (res << 1) + (res << 3)",
"res",
"(res << 1) + (res << 3)",
"(res << 1)",
"res",
"1",
"(res << 3)",
"res",
"3",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public String sscan () throws IOException {\n\t\t\tint c = cscan ();\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tStringBuilder res = new StringBuilder ();\n\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res.toString ();\n\t\t}",
"sscan",
"{\n\t\t\tint c = cscan ();\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tStringBuilder res = new StringBuilder ();\n\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res.toString ();\n\t\t}",
"int c = cscan ();",
"c",
"cscan ()",
"cscan",
"while (space (c))\n\t\t\t\tc = cscan ();",
"space (c)",
"space",
"c",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"StringBuilder res = new StringBuilder ();",
"res",
"new StringBuilder ()",
"do {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));",
"!space (c)",
"space (c)",
"space",
"c",
"{\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}",
"res.appendCodePoint (c)",
"res.appendCodePoint",
"res",
"c",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"return res.toString ();",
"res.toString ()",
"res.toString",
"res",
"public double dscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tdouble res = 0;\n\n\t\t\twhile (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tif (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res * sgn;\n\t\t}",
"dscan",
"{\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tdouble res = 0;\n\n\t\t\twhile (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tif (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res * sgn;\n\t\t}",
"int c = cscan ()",
"c",
"cscan ()",
"cscan",
"sgn = 1;",
"sgn",
"1",
"while (space (c))\n\t\t\t\tc = cscan ();",
"space (c)",
"space",
"c",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"if (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}",
"sgn = -1",
"sgn",
"-1",
"1",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"double res = 0;",
"res",
"0",
"while (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}",
"!space (c) && c != '.'",
"!space (c)",
"space (c)",
"space",
"c",
"c != '.'",
"c",
"'.'",
"{\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}",
"if (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());",
"c == 'e' || c == 'E'",
"c == 'e'",
"c",
"'e'",
"c == 'E'",
"c",
"'E'",
"return res * UTILITIES.fast_pow (10, iscan ());",
"res * UTILITIES.fast_pow (10, iscan ())",
"res",
"UTILITIES.fast_pow (10, iscan ())",
"UTILITIES.fast_pow",
"UTILITIES",
"10",
"iscan ()",
"iscan",
"res *= 10",
"res",
"10",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"if (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}",
"c == '.'",
"c",
"'.'",
"{\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"double m = 1;",
"m",
"1",
"while (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}",
"!space (c)",
"space (c)",
"space",
"c",
"{\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}",
"if (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());",
"c == 'e' || c == 'E'",
"c == 'e'",
"c",
"'e'",
"c == 'E'",
"c",
"'E'",
"return res * UTILITIES.fast_pow (10, iscan ());",
"res * UTILITIES.fast_pow (10, iscan ())",
"res",
"UTILITIES.fast_pow (10, iscan ())",
"UTILITIES.fast_pow",
"UTILITIES",
"10",
"iscan ()",
"iscan",
"m /= 10",
"m",
"10",
"res += (c - '0') * m",
"res",
"(c - '0') * m",
"(c - '0')",
"c",
"'0'",
"m",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public long lscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}",
"lscan",
"{\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}",
"int c = cscan ()",
"c",
"cscan ()",
"cscan",
"sgn = 1;",
"sgn",
"1",
"while (space (c))\n\t\t\t\tc = cscan ();",
"space (c)",
"space",
"c",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"if (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}",
"c == '-'",
"c",
"'-'",
"{\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}",
"sgn = -1",
"sgn",
"-1",
"1",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"long res = 0;",
"res",
"0",
"do {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));",
"!space (c)",
"space (c)",
"space",
"c",
"{\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}",
"res = (res << 1) + (res << 3)",
"res",
"(res << 1) + (res << 3)",
"(res << 1)",
"res",
"1",
"(res << 3)",
"res",
"3",
"res += c - '0'",
"res",
"c - '0'",
"c",
"'0'",
"c = cscan ()",
"c",
"cscan ()",
"cscan",
"return res * sgn;",
"res * sgn",
"res",
"sgn",
"public boolean space (int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}",
"space",
"{\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}",
"return c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == '\\t'",
"c == '\\r'",
"c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1",
"c == ' '",
"c",
"' '",
"c == '\\n'",
"c",
"'\\n'",
"c == '\\r'",
"c",
"'\\r'",
"c == '\\t'",
"c",
"'\\t'",
"c == -1",
"c",
"-1",
"1",
"int c",
"c",
"public static class UTILITIES {\n\n\t\tstatic final double EPS = 10e-6;\n\n\t\tpublic static int lower_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int upper_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int gcd (int a, int b) {\n\t\t\treturn b == 0 ? a : gcd (b, a % b);\n\t\t}\n\n\t\tpublic static int lcm (int a, int b) {\n\t\t\treturn a * b / gcd (a, b);\n\t\t}\n\n\t\tpublic static long fast_pow_mod (long b, long x, int mod) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\n\t\t\treturn b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\t\t}\n\n\t\tpublic static int fast_pow (int b, int x) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow (b * b, x / 2);\n\n\t\t\treturn b * fast_pow (b * b, x / 2);\n\t\t}\n\n\t\tpublic static long choose (long n, long k) {\n\t\t\tk = Math.min (k, n - k);\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);\n\n\t\t\treturn val;\n\t\t}\n\n\t\tpublic static long permute (int n, int k) {\n\t\t\tif (n < k) return 0;\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));\n\n\t\t\treturn val;\n\t\t}\n\t}",
"UTILITIES",
"static final double EPS = 10e-6;",
"EPS",
"10e-6",
"public static int lower_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}",
"lower_bound",
"{\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}",
"int low = 0",
"low",
"0",
"high = arr.length",
"high",
"arr.length",
"arr",
"arr.length",
"mid = -1;",
"mid",
"-1",
"1",
"while (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}",
"low < high",
"low",
"high",
"{\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}",
"mid = (low + high) / 2",
"mid",
"(low + high) / 2",
"(low + high)",
"low",
"high",
"2",
"if (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;",
"arr[mid] >= x",
"arr[mid]",
"arr",
"mid",
"x",
"high = mid",
"high",
"mid",
"low = mid + 1",
"low",
"mid + 1",
"mid",
"1",
"return low;",
"low",
"int[] arr",
"arr",
"int x",
"x",
"public static int upper_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}",
"upper_bound",
"{\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}",
"int low = 0",
"low",
"0",
"high = arr.length",
"high",
"arr.length",
"arr",
"arr.length",
"mid = -1;",
"mid",
"-1",
"1",
"while (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}",
"low < high",
"low",
"high",
"{\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}",
"mid = (low + high) / 2",
"mid",
"(low + high) / 2",
"(low + high)",
"low",
"high",
"2",
"if (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;",
"arr[mid] > x",
"arr[mid]",
"arr",
"mid",
"x",
"high = mid",
"high",
"mid",
"low = mid + 1",
"low",
"mid + 1",
"mid",
"1",
"return low;",
"low",
"int[] arr",
"arr",
"int x",
"x",
"public static int gcd (int a, int b) {\n\t\t\treturn b == 0 ? a : gcd (b, a % b);\n\t\t}",
"gcd",
"{\n\t\t\treturn b == 0 ? a : gcd (b, a % b);\n\t\t}",
"return b == 0 ? a : gcd (b, a % b);",
"b == 0 ? a : gcd (b, a % b)",
"b == 0",
"b",
"0",
"a",
"gcd (b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"int a",
"a",
"int b",
"b",
"public static int lcm (int a, int b) {\n\t\t\treturn a * b / gcd (a, b);\n\t\t}",
"lcm",
"{\n\t\t\treturn a * b / gcd (a, b);\n\t\t}",
"return a * b / gcd (a, b);",
"a * b / gcd (a, b)",
"a * b",
"a",
"b",
"gcd (a, b)",
"gcd",
"a",
"b",
"int a",
"a",
"int b",
"b",
"public static long fast_pow_mod (long b, long x, int mod) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\n\t\t\treturn b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\t\t}",
"fast_pow_mod",
"{\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\n\t\t\treturn b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\t\t}",
"if (x == 0) return 1;",
"x == 0",
"x",
"0",
"return 1;",
"1",
"if (x == 1) return b;",
"x == 1",
"x",
"1",
"return b;",
"b",
"if (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;",
"x % 2 == 0",
"x % 2",
"x",
"2",
"0",
"return fast_pow_mod (b * b % mod, x / 2, mod) % mod;",
"fast_pow_mod (b * b % mod, x / 2, mod) % mod",
"fast_pow_mod (b * b % mod, x / 2, mod)",
"fast_pow_mod",
"b * b % mod",
"b * b",
"b",
"b",
"mod",
"x / 2",
"x",
"2",
"mod",
"mod",
"return b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;",
"b * fast_pow_mod (b * b % mod, x / 2, mod) % mod",
"b * fast_pow_mod (b * b % mod, x / 2, mod)",
"b",
"fast_pow_mod (b * b % mod, x / 2, mod)",
"fast_pow_mod",
"b * b % mod",
"b * b",
"b",
"b",
"mod",
"x / 2",
"x",
"2",
"mod",
"mod",
"long b",
"b",
"long x",
"x",
"int mod",
"mod",
"public static int fast_pow (int b, int x) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow (b * b, x / 2);\n\n\t\t\treturn b * fast_pow (b * b, x / 2);\n\t\t}",
"fast_pow",
"{\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow (b * b, x / 2);\n\n\t\t\treturn b * fast_pow (b * b, x / 2);\n\t\t}",
"if (x == 0) return 1;",
"x == 0",
"x",
"0",
"return 1;",
"1",
"if (x == 1) return b;",
"x == 1",
"x",
"1",
"return b;",
"b",
"if (x % 2 == 0) return fast_pow (b * b, x / 2);",
"x % 2 == 0",
"x % 2",
"x",
"2",
"0",
"return fast_pow (b * b, x / 2);",
"fast_pow (b * b, x / 2)",
"fast_pow",
"b * b",
"b",
"b",
"x / 2",
"x",
"2",
"return b * fast_pow (b * b, x / 2);",
"b * fast_pow (b * b, x / 2)",
"b",
"fast_pow (b * b, x / 2)",
"fast_pow",
"b * b",
"b",
"b",
"x / 2",
"x",
"2",
"int b",
"b",
"int x",
"x",
"public static long choose (long n, long k) {\n\t\t\tk = Math.min (k, n - k);\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);\n\n\t\t\treturn val;\n\t\t}",
"choose",
"{\n\t\t\tk = Math.min (k, n - k);\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);\n\n\t\t\treturn val;\n\t\t}",
"k = Math.min (k, n - k)",
"k",
"Math.min (k, n - k)",
"Math.min",
"Math",
"k",
"n - k",
"n",
"k",
"long val = 1;",
"val",
"1",
"for (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < k",
"i",
"k",
"++i",
"++i",
"i",
"val = val * (n - i) / (i + 1);",
"val = val * (n - i) / (i + 1)",
"val",
"val * (n - i) / (i + 1)",
"val * (n - i)",
"val",
"(n - i)",
"n",
"i",
"(i + 1)",
"i",
"1",
"return val;",
"val",
"long n",
"n",
"long k",
"k",
"public static long permute (int n, int k) {\n\t\t\tif (n < k) return 0;\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));\n\n\t\t\treturn val;\n\t\t}",
"permute",
"{\n\t\t\tif (n < k) return 0;\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));\n\n\t\t\treturn val;\n\t\t}",
"if (n < k) return 0;",
"n < k",
"n",
"k",
"return 0;",
"0",
"long val = 1;",
"val",
"1",
"for (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < k",
"i",
"k",
"++i",
"++i",
"i",
"val = (val * (n - i));",
"val = (val * (n - i))",
"val",
"(val * (n - i))",
"val",
"(n - i)",
"n",
"i",
"return val;",
"val",
"int n",
"n",
"int k",
"k",
"public class Main {\n\tstatic int N;\n\tstatic int x;\n\tstatic long max = 0, curMax = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tN = in.iscan();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}\n\t\tout.println(max);\n\t\tout.close();\n\t} \n\t\n\tstatic INPUT in = new INPUT(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tprivate static class INPUT {\n\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar, numChars;\n\n\t\tpublic INPUT (InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tpublic INPUT (String file) throws IOException {\n\t\t\tthis.stream = new FileInputStream (file);\n\t\t}\n\n\t\tpublic int cscan () throws IOException {\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}\n\t\t\t\n\t\t\tif (numChars == -1)\n\t\t\t\treturn numChars;\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int iscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String sscan () throws IOException {\n\t\t\tint c = cscan ();\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tStringBuilder res = new StringBuilder ();\n\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res.toString ();\n\t\t}\n\n\t\tpublic double dscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tdouble res = 0;\n\n\t\t\twhile (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tif (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long lscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic boolean space (int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\t}\n\n\tpublic static class UTILITIES {\n\n\t\tstatic final double EPS = 10e-6;\n\n\t\tpublic static int lower_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int upper_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int gcd (int a, int b) {\n\t\t\treturn b == 0 ? a : gcd (b, a % b);\n\t\t}\n\n\t\tpublic static int lcm (int a, int b) {\n\t\t\treturn a * b / gcd (a, b);\n\t\t}\n\n\t\tpublic static long fast_pow_mod (long b, long x, int mod) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\n\t\t\treturn b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\t\t}\n\n\t\tpublic static int fast_pow (int b, int x) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow (b * b, x / 2);\n\n\t\t\treturn b * fast_pow (b * b, x / 2);\n\t\t}\n\n\t\tpublic static long choose (long n, long k) {\n\t\t\tk = Math.min (k, n - k);\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);\n\n\t\t\treturn val;\n\t\t}\n\n\t\tpublic static long permute (int n, int k) {\n\t\t\tif (n < k) return 0;\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));\n\n\t\t\treturn val;\n\t\t}\n\t}\n}",
"public class Main {\n\tstatic int N;\n\tstatic int x;\n\tstatic long max = 0, curMax = 0;\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tN = in.iscan();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tx = in.iscan();\n\t\t\tcurMax = Math.max(curMax, x);\n\t\t\tmax += curMax - x;\n\t\t}\n\t\tout.println(max);\n\t\tout.close();\n\t} \n\t\n\tstatic INPUT in = new INPUT(System.in);\n\tstatic PrintWriter out = new PrintWriter(System.out);\n\tprivate static class INPUT {\n\n\t\tprivate InputStream stream;\n\t\tprivate byte[] buf = new byte[1024];\n\t\tprivate int curChar, numChars;\n\n\t\tpublic INPUT (InputStream stream) {\n\t\t\tthis.stream = stream;\n\t\t}\n\n\t\tpublic INPUT (String file) throws IOException {\n\t\t\tthis.stream = new FileInputStream (file);\n\t\t}\n\n\t\tpublic int cscan () throws IOException {\n\t\t\tif (curChar >= numChars) {\n\t\t\t\tcurChar = 0;\n\t\t\t\tnumChars = stream.read (buf);\n\t\t\t}\n\t\t\t\n\t\t\tif (numChars == -1)\n\t\t\t\treturn numChars;\n\n\t\t\treturn buf[curChar++];\n\t\t}\n\n\t\tpublic int iscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tint res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic String sscan () throws IOException {\n\t\t\tint c = cscan ();\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tStringBuilder res = new StringBuilder ();\n\n\t\t\tdo {\n\t\t\t\tres.appendCodePoint (c);\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res.toString ();\n\t\t}\n\n\t\tpublic double dscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tdouble res = 0;\n\n\t\t\twhile (!space (c) && c != '.') {\n\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\t\t\t\t\n\t\t\t\tres *= 10;\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tif (c == '.') {\n\t\t\t\tc = cscan ();\n\t\t\t\tdouble m = 1;\n\n\t\t\t\twhile (!space (c)) {\n\t\t\t\t\tif (c == 'e' || c == 'E')\n\t\t\t\t\t\treturn res * UTILITIES.fast_pow (10, iscan ());\n\n\t\t\t\t\tm /= 10;\n\t\t\t\t\tres += (c - '0') * m;\n\t\t\t\t\tc = cscan ();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic long lscan () throws IOException {\n\t\t\tint c = cscan (), sgn = 1;\n\t\t\t\n\t\t\twhile (space (c))\n\t\t\t\tc = cscan ();\n\n\t\t\tif (c == '-') {\n\t\t\t\tsgn = -1;\n\t\t\t\tc = cscan ();\n\t\t\t}\n\n\t\t\tlong res = 0;\n\n\t\t\tdo {\n\t\t\t\tres = (res << 1) + (res << 3);\n\t\t\t\tres += c - '0';\n\t\t\t\tc = cscan ();\n\t\t\t}\n\t\t\twhile (!space (c));\n\n\t\t\treturn res * sgn;\n\t\t}\n\n\t\tpublic boolean space (int c) {\n\t\t\treturn c == ' ' || c == '\\n' || c == '\\r' || c == '\\t' || c == -1;\n\t\t}\n\t}\n\n\tpublic static class UTILITIES {\n\n\t\tstatic final double EPS = 10e-6;\n\n\t\tpublic static int lower_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] >= x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int upper_bound (int[] arr, int x) {\n\t\t\tint low = 0, high = arr.length, mid = -1;\n\n\t\t\twhile (low < high) {\n\t\t\t\tmid = (low + high) / 2;\n\n\t\t\t\tif (arr[mid] > x)\n\t\t\t\t\thigh = mid;\n\t\t\t\telse\n\t\t\t\t\tlow = mid + 1;\n\t\t\t}\n\n\t\t\treturn low;\n\t\t}\n\n\t\tpublic static int gcd (int a, int b) {\n\t\t\treturn b == 0 ? a : gcd (b, a % b);\n\t\t}\n\n\t\tpublic static int lcm (int a, int b) {\n\t\t\treturn a * b / gcd (a, b);\n\t\t}\n\n\t\tpublic static long fast_pow_mod (long b, long x, int mod) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\n\t\t\treturn b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;\n\t\t}\n\n\t\tpublic static int fast_pow (int b, int x) {\n\t\t\tif (x == 0) return 1;\n\t\t\tif (x == 1) return b;\n\t\t\tif (x % 2 == 0) return fast_pow (b * b, x / 2);\n\n\t\t\treturn b * fast_pow (b * b, x / 2);\n\t\t}\n\n\t\tpublic static long choose (long n, long k) {\n\t\t\tk = Math.min (k, n - k);\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = val * (n - i) / (i + 1);\n\n\t\t\treturn val;\n\t\t}\n\n\t\tpublic static long permute (int n, int k) {\n\t\t\tif (n < k) return 0;\n\t\t\tlong val = 1;\n\n\t\t\tfor (int i = 0; i < k; ++i)\n\t\t\t\tval = (val * (n - i));\n\n\t\t\treturn val;\n\t\t}\n\t}\n}",
"Main"
]
| // Utilities
import java.io.*;
import java.util.*;
public class Main {
static int N;
static int x;
static long max = 0, curMax = 0;
public static void main(String[] args) throws IOException {
N = in.iscan();
for (int i = 0; i < N; i++) {
x = in.iscan();
curMax = Math.max(curMax, x);
max += curMax - x;
}
out.println(max);
out.close();
}
static INPUT in = new INPUT(System.in);
static PrintWriter out = new PrintWriter(System.out);
private static class INPUT {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar, numChars;
public INPUT (InputStream stream) {
this.stream = stream;
}
public INPUT (String file) throws IOException {
this.stream = new FileInputStream (file);
}
public int cscan () throws IOException {
if (curChar >= numChars) {
curChar = 0;
numChars = stream.read (buf);
}
if (numChars == -1)
return numChars;
return buf[curChar++];
}
public int iscan () throws IOException {
int c = cscan (), sgn = 1;
while (space (c))
c = cscan ();
if (c == '-') {
sgn = -1;
c = cscan ();
}
int res = 0;
do {
res = (res << 1) + (res << 3);
res += c - '0';
c = cscan ();
}
while (!space (c));
return res * sgn;
}
public String sscan () throws IOException {
int c = cscan ();
while (space (c))
c = cscan ();
StringBuilder res = new StringBuilder ();
do {
res.appendCodePoint (c);
c = cscan ();
}
while (!space (c));
return res.toString ();
}
public double dscan () throws IOException {
int c = cscan (), sgn = 1;
while (space (c))
c = cscan ();
if (c == '-') {
sgn = -1;
c = cscan ();
}
double res = 0;
while (!space (c) && c != '.') {
if (c == 'e' || c == 'E')
return res * UTILITIES.fast_pow (10, iscan ());
res *= 10;
res += c - '0';
c = cscan ();
}
if (c == '.') {
c = cscan ();
double m = 1;
while (!space (c)) {
if (c == 'e' || c == 'E')
return res * UTILITIES.fast_pow (10, iscan ());
m /= 10;
res += (c - '0') * m;
c = cscan ();
}
}
return res * sgn;
}
public long lscan () throws IOException {
int c = cscan (), sgn = 1;
while (space (c))
c = cscan ();
if (c == '-') {
sgn = -1;
c = cscan ();
}
long res = 0;
do {
res = (res << 1) + (res << 3);
res += c - '0';
c = cscan ();
}
while (!space (c));
return res * sgn;
}
public boolean space (int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
}
public static class UTILITIES {
static final double EPS = 10e-6;
public static int lower_bound (int[] arr, int x) {
int low = 0, high = arr.length, mid = -1;
while (low < high) {
mid = (low + high) / 2;
if (arr[mid] >= x)
high = mid;
else
low = mid + 1;
}
return low;
}
public static int upper_bound (int[] arr, int x) {
int low = 0, high = arr.length, mid = -1;
while (low < high) {
mid = (low + high) / 2;
if (arr[mid] > x)
high = mid;
else
low = mid + 1;
}
return low;
}
public static int gcd (int a, int b) {
return b == 0 ? a : gcd (b, a % b);
}
public static int lcm (int a, int b) {
return a * b / gcd (a, b);
}
public static long fast_pow_mod (long b, long x, int mod) {
if (x == 0) return 1;
if (x == 1) return b;
if (x % 2 == 0) return fast_pow_mod (b * b % mod, x / 2, mod) % mod;
return b * fast_pow_mod (b * b % mod, x / 2, mod) % mod;
}
public static int fast_pow (int b, int x) {
if (x == 0) return 1;
if (x == 1) return b;
if (x % 2 == 0) return fast_pow (b * b, x / 2);
return b * fast_pow (b * b, x / 2);
}
public static long choose (long n, long k) {
k = Math.min (k, n - k);
long val = 1;
for (int i = 0; i < k; ++i)
val = val * (n - i) / (i + 1);
return val;
}
public static long permute (int n, int k) {
if (n < k) return 0;
long val = 1;
for (int i = 0; i < k; ++i)
val = (val * (n - i));
return val;
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
40,
2,
13,
17,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
0,
13,
4,
18,
13,
4,
18,
13,
13,
0,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
116,
8
],
[
116,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
11,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
69,
75
],
[
75,
76
],
[
75,
77
],
[
63,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
87,
89
],
[
78,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
78,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
101,
102
],
[
100,
103
],
[
78,
104
],
[
104,
105
],
[
104,
106
],
[
11,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
9,
113
],
[
113,
114
],
[
0,
115
],
[
115,
116
],
[
115,
117
]
]
| [
"import java.math.BigInteger;\nimport java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint N = in.nextInt();\n\t\tint[] A = new int[N];\n\t\tBigInteger a = new BigInteger(\"0\");\n\t\tint b = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tA[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(a);\n\t}\n}",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint N = in.nextInt();\n\t\tint[] A = new int[N];\n\t\tBigInteger a = new BigInteger(\"0\");\n\t\tint b = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tA[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(a);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint N = in.nextInt();\n\t\tint[] A = new int[N];\n\t\tBigInteger a = new BigInteger(\"0\");\n\t\tint b = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tA[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(a);\n\t}",
"main",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tint N = in.nextInt();\n\t\tint[] A = new int[N];\n\t\tBigInteger a = new BigInteger(\"0\");\n\t\tint b = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tA[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(a);\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"int[] A = new int[N];",
"A",
"new int[N]",
"N",
"BigInteger a = new BigInteger(\"0\");",
"a",
"new BigInteger(\"0\")",
"int b = 0;",
"b",
"0",
"for(int i=0; i<N; i++) {\n\t\t\tA[i] = in.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = in.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = in.nextInt();\n\t\t}",
"A[i] = in.nextInt()",
"A[i]",
"A",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"for(int i=0; i<N; i++) {\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}",
"if(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}",
"!(i == 0) && A[i-1] > A[i]",
"!(i == 0)",
"(i == 0)",
"i",
"0",
"A[i-1] > A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"{\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}",
"b = A[i-1] - A[i]",
"b",
"A[i-1] - A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i] += b",
"A[i]",
"A",
"i",
"b",
"a = a.add(BigInteger.valueOf(b))",
"a",
"a.add(BigInteger.valueOf(b))",
"a.add",
"a",
"BigInteger.valueOf(b)",
"BigInteger.valueOf",
"BigInteger",
"b",
"b = 0",
"b",
"0",
"System.out.println(a)",
"System.out.println",
"System.out",
"System",
"System.out",
"a",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint N = in.nextInt();\n\t\tint[] A = new int[N];\n\t\tBigInteger a = new BigInteger(\"0\");\n\t\tint b = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tA[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(a);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint N = in.nextInt();\n\t\tint[] A = new int[N];\n\t\tBigInteger a = new BigInteger(\"0\");\n\t\tint b = 0;\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tA[i] = in.nextInt();\n\t\t}\n\t\t\n\t\tfor(int i=0; i<N; i++) {\n\t\t\tif(!(i == 0) && A[i-1] > A[i]){\n\t\t\t\tb = A[i-1] - A[i];\n\t\t\t\tA[i] += b;\n\t\t\t\ta = a.add(BigInteger.valueOf(b));\n\t\t\t\tb = 0;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(a);\n\t}\n}",
"Main"
]
| import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[] A = new int[N];
BigInteger a = new BigInteger("0");
int b = 0;
for(int i=0; i<N; i++) {
A[i] = in.nextInt();
}
for(int i=0; i<N; i++) {
if(!(i == 0) && A[i-1] > A[i]){
b = A[i-1] - A[i];
A[i] += b;
a = a.add(BigInteger.valueOf(b));
b = 0;
}
}
System.out.println(a);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
0,
18,
13,
17,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
18,
13,
13,
17,
30,
0,
18,
13,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
133,
5
],
[
133,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
67,
73
],
[
73,
74
],
[
73,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
66,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
93,
95
],
[
65,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
8,
103
],
[
103,
104
],
[
103,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
106,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
8,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
6,
130
],
[
130,
131
],
[
0,
132
],
[
132,
133
],
[
132,
134
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n long b[] = new long[n];\n b[0] = 0;\n for (int i = 1; i < n; i++) {\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }\n\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += b[i];\n }\n System.out.println(sum);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n long b[] = new long[n];\n b[0] = 0;\n for (int i = 1; i < n; i++) {\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }\n\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += b[i];\n }\n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n long b[] = new long[n];\n b[0] = 0;\n for (int i = 1; i < n; i++) {\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }\n\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += b[i];\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n long b[] = new long[n];\n b[0] = 0;\n for (int i = 1; i < n; i++) {\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }\n\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += b[i];\n }\n System.out.println(sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long a[] = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = sc.nextInt();\n }",
"{\n a[i] = sc.nextInt();\n }",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.close()",
"sc.close",
"sc",
"long b[] = new long[n];",
"b",
"new long[n]",
"n",
"b[0] = 0",
"b[0]",
"b",
"0",
"0",
"for (int i = 1; i < n; i++) {\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }",
"{\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }",
"if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }",
"a[i - 1] <= a[i]",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"{\n b[i] = 0;\n }",
"b[i] = 0",
"b[i]",
"b",
"i",
"0",
"{\n b[i] = a[i - 1] - a[i];\n }",
"b[i] = a[i - 1] - a[i]",
"b[i]",
"b",
"i",
"a[i - 1] - a[i]",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"a[i] += b[i]",
"a[i]",
"a",
"i",
"b[i]",
"b",
"i",
"long sum = 0;",
"sum",
"0",
"for (int i = 0; i < n; i++) {\n sum += b[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n sum += b[i];\n }",
"{\n sum += b[i];\n }",
"sum += b[i]",
"sum",
"b[i]",
"b",
"i",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n long b[] = new long[n];\n b[0] = 0;\n for (int i = 1; i < n; i++) {\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }\n\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += b[i];\n }\n System.out.println(sum);\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long a[] = new long[n];\n for (int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n sc.close();\n\n long b[] = new long[n];\n b[0] = 0;\n for (int i = 1; i < n; i++) {\n if (a[i - 1] <= a[i]) {\n b[i] = 0;\n } else {\n b[i] = a[i - 1] - a[i];\n }\n a[i] += b[i];\n }\n\n long sum = 0;\n for (int i = 0; i < n; i++) {\n sum += b[i];\n }\n System.out.println(sum);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long a[] = new long[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
sc.close();
long b[] = new long[n];
b[0] = 0;
for (int i = 1; i < n; i++) {
if (a[i - 1] <= a[i]) {
b[i] = 0;
} else {
b[i] = a[i - 1] - a[i];
}
a[i] += b[i];
}
long sum = 0;
for (int i = 0; i < n; i++) {
sum += b[i];
}
System.out.println(sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
13,
18,
13,
13,
14,
2,
13,
17,
0,
13,
17,
0,
13,
13,
0,
13,
2,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
96,
5
],
[
96,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
8,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
50,
58
],
[
58,
59
],
[
59,
60
],
[
50,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
62,
77
],
[
77,
78
],
[
77,
79
],
[
62,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
6,
93
],
[
93,
94
],
[
0,
95
],
[
95,
96
],
[
95,
97
]
]
| [
"\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint ar[]=new int[n];\n\t\tfor(int i=0;i<n;i++) ar[i]=sc.nextInt();\n\t\t\n\t\tlong preh=ar[0],table,ans=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint ar[]=new int[n];\n\t\tfor(int i=0;i<n;i++) ar[i]=sc.nextInt();\n\t\t\n\t\tlong preh=ar[0],table,ans=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"Main",
"public static void main(String args[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint ar[]=new int[n];\n\t\tfor(int i=0;i<n;i++) ar[i]=sc.nextInt();\n\t\t\n\t\tlong preh=ar[0],table,ans=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint ar[]=new int[n];\n\t\tfor(int i=0;i<n;i++) ar[i]=sc.nextInt();\n\t\t\n\t\tlong preh=ar[0],table,ans=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ar[]=new int[n];",
"ar",
"new int[n]",
"n",
"for(int i=0;i<n;i++) ar[i]=sc.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"ar[i]=sc.nextInt();",
"ar[i]=sc.nextInt()",
"ar[i]",
"ar",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long preh=ar[0]",
"preh",
"ar[0]",
"ar",
"0",
"table",
"table",
"ans=0;",
"ans",
"0",
"for(int i=0;i<n;i++)\n\t\t{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}",
"{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}",
"table=preh-ar[i]",
"table",
"preh-ar[i]",
"preh",
"ar[i]",
"ar",
"i",
"if(table<0) table=0;",
"table<0",
"table",
"0",
"table=0",
"table",
"0",
"ans+=table",
"ans",
"table",
"preh=table+ar[i]",
"preh",
"table+ar[i]",
"table",
"ar[i]",
"ar",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String args[]",
"args",
"public class Main {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint ar[]=new int[n];\n\t\tfor(int i=0;i<n;i++) ar[i]=sc.nextInt();\n\t\t\n\t\tlong preh=ar[0],table,ans=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"public class Main {\n\n\tpublic static void main(String args[])\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint ar[]=new int[n];\n\t\tfor(int i=0;i<n;i++) ar[i]=sc.nextInt();\n\t\t\n\t\tlong preh=ar[0],table,ans=0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\ttable=preh-ar[i];\n\t\t\tif(table<0) table=0;\n\t\t\tans+=table;\n\t\t\tpreh=table+ar[i];\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\t\n}",
"Main"
]
|
import java.util.*;
public class Main {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int ar[]=new int[n];
for(int i=0;i<n;i++) ar[i]=sc.nextInt();
long preh=ar[0],table,ans=0;
for(int i=0;i<n;i++)
{
table=preh-ar[i];
if(table<0) table=0;
ans+=table;
preh=table+ar[i];
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
0,
13,
20,
0,
13,
17,
23,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
37,
20,
30,
0,
13,
4,
18,
13,
29,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
37,
20,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
18,
13,
13,
18,
13,
2,
13,
17,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
18,
13,
13,
18,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
251,
8
],
[
251,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
19,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
31,
35
],
[
11,
36
],
[
36,
37
],
[
37,
38
],
[
9,
39
],
[
39,
40
],
[
251,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
41,
45
],
[
45,
46
],
[
41,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
53,
55
],
[
47,
56
],
[
56,
57
],
[
41,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
58,
67
],
[
67,
68
],
[
41,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
75,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
71,
87
],
[
87,
88
],
[
41,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
92,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
91,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
41,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
123,
124
],
[
41,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
132,
133
],
[
41,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
141,
142
],
[
251,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
147,
153
],
[
153,
154
],
[
153,
155
],
[
147,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
162,
163
],
[
162,
164
],
[
157,
165
],
[
165,
166
],
[
166,
167
],
[
157,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
173,
174
],
[
174,
175
],
[
147,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
147,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
181,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
188,
190
],
[
181,
191
],
[
191,
192
],
[
192,
193
],
[
181,
194
],
[
195,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
204,
206
],
[
197,
207
],
[
196,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
211,
213
],
[
208,
214
],
[
214,
215
],
[
214,
216
],
[
147,
217
],
[
217,
218
],
[
217,
219
],
[
147,
220
],
[
220,
221
],
[
221,
222
],
[
222,
223
],
[
222,
224
],
[
220,
225
],
[
225,
226
],
[
225,
227
],
[
220,
228
],
[
228,
229
],
[
229,
230
],
[
220,
231
],
[
232,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
235,
239
],
[
239,
240
],
[
239,
241
],
[
147,
242
],
[
242,
243
],
[
243,
244
],
[
242,
245
],
[
145,
246
],
[
246,
247
],
[
145,
248
],
[
248,
249
],
[
0,
250
],
[
250,
251
],
[
250,
252
]
]
| [
"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tok;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n tok = null;\n }\n\n public InputReader(String inputFile) throws FileNotFoundException {\n reader = new BufferedReader(new FileReader(inputFile));\n tok = null;\n }\n\n public String nextLine() {\n String c = \"\";\n try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n\n return c;\n }\n\n public String next() {\n while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n return tok.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n\n public static void main(String args[]) {\n InputStream inputstream = System.in;\n OutputStream outputstream = System.out;\n InputReader in = new InputReader(inputstream);\n PrintWriter out = new PrintWriter(outputstream);\n Task solver = new Task();\n solver.solve(in, out);\n out.flush();\n }\n\n static class Task {\n public void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n int b[] = a.clone(); \n for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }\n long stools=0;\n for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }\n out.println(stools);\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tok;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n tok = null;\n }\n\n public InputReader(String inputFile) throws FileNotFoundException {\n reader = new BufferedReader(new FileReader(inputFile));\n tok = null;\n }\n\n public String nextLine() {\n String c = \"\";\n try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n\n return c;\n }\n\n public String next() {\n while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n return tok.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n\n public static void main(String args[]) {\n InputStream inputstream = System.in;\n OutputStream outputstream = System.out;\n InputReader in = new InputReader(inputstream);\n PrintWriter out = new PrintWriter(outputstream);\n Task solver = new Task();\n solver.solve(in, out);\n out.flush();\n }\n\n static class Task {\n public void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n int b[] = a.clone(); \n for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }\n long stools=0;\n for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }\n out.println(stools);\n }\n }\n}",
"Main",
"public static void main(String args[]) {\n InputStream inputstream = System.in;\n OutputStream outputstream = System.out;\n InputReader in = new InputReader(inputstream);\n PrintWriter out = new PrintWriter(outputstream);\n Task solver = new Task();\n solver.solve(in, out);\n out.flush();\n }",
"main",
"{\n InputStream inputstream = System.in;\n OutputStream outputstream = System.out;\n InputReader in = new InputReader(inputstream);\n PrintWriter out = new PrintWriter(outputstream);\n Task solver = new Task();\n solver.solve(in, out);\n out.flush();\n }",
"InputStream inputstream = System.in;",
"inputstream",
"System.in",
"System",
"System.in",
"OutputStream outputstream = System.out;",
"outputstream",
"System.out",
"System",
"System.out",
"InputReader in = new InputReader(inputstream);",
"in",
"new InputReader(inputstream)",
"PrintWriter out = new PrintWriter(outputstream);",
"out",
"new PrintWriter(outputstream)",
"Task solver = new Task();",
"solver",
"new Task()",
"solver.solve(in, out)",
"solver.solve",
"solver",
"in",
"out",
"out.flush()",
"out.flush",
"out",
"String args[]",
"args",
"static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tok;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n tok = null;\n }\n\n public InputReader(String inputFile) throws FileNotFoundException {\n reader = new BufferedReader(new FileReader(inputFile));\n tok = null;\n }\n\n public String nextLine() {\n String c = \"\";\n try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n\n return c;\n }\n\n public String next() {\n while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n return tok.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }",
"InputReader",
"public BufferedReader reader;",
"reader",
"public StringTokenizer tok;",
"tok",
"public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n tok = null;\n }",
"InputReader",
"{\n reader = new BufferedReader(new InputStreamReader(inputStream));\n tok = null;\n }",
"reader = new BufferedReader(new InputStreamReader(inputStream))",
"reader",
"new BufferedReader(new InputStreamReader(inputStream))",
"tok = null",
"tok",
"null",
"InputStream inputStream",
"inputStream",
"public InputReader(String inputFile) throws FileNotFoundException {\n reader = new BufferedReader(new FileReader(inputFile));\n tok = null;\n }",
"InputReader",
"{\n reader = new BufferedReader(new FileReader(inputFile));\n tok = null;\n }",
"reader = new BufferedReader(new FileReader(inputFile))",
"reader",
"new BufferedReader(new FileReader(inputFile))",
"tok = null",
"tok",
"null",
"String inputFile",
"inputFile",
"public String nextLine() {\n String c = \"\";\n try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n\n return c;\n }",
"nextLine",
"{\n String c = \"\";\n try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n\n return c;\n }",
"String c = \"\";",
"c",
"\"\"",
"try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }",
"catch (IOException e) {\n throw new RuntimeException(e);\n }",
"IOException e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n c = reader.readLine();\n }",
"c = reader.readLine()",
"c",
"reader.readLine()",
"reader.readLine",
"reader",
"return c;",
"c",
"public String next() {\n while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n return tok.nextToken();\n }",
"next",
"{\n while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n return tok.nextToken();\n }",
"while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }",
"tok == null || !tok.hasMoreTokens()",
"tok == null",
"tok",
"null",
"!tok.hasMoreTokens()",
"tok.hasMoreTokens()",
"tok.hasMoreTokens",
"tok",
"{\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }",
"try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }",
"catch (Exception e) {\n throw new RuntimeException(e);\n }",
"Exception e",
"{\n throw new RuntimeException(e);\n }",
"throw new RuntimeException(e);",
"new RuntimeException(e)",
"{\n tok = new StringTokenizer(nextLine());\n }",
"tok = new StringTokenizer(nextLine())",
"tok",
"new StringTokenizer(nextLine())",
"return tok.nextToken();",
"tok.nextToken()",
"tok.nextToken",
"tok",
"public int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public double nextDouble() {\n return Double.parseDouble(next());\n }",
"nextDouble",
"{\n return Double.parseDouble(next());\n }",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"static class Task {\n public void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n int b[] = a.clone(); \n for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }\n long stools=0;\n for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }\n out.println(stools);\n }\n }",
"Task",
"public void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n int b[] = a.clone(); \n for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }\n long stools=0;\n for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }\n out.println(stools);\n }",
"solve",
"{\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n int b[] = a.clone(); \n for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }\n long stools=0;\n for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }\n out.println(stools);\n }",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n a[i] = in.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = in.nextInt();",
"a[i] = in.nextInt()",
"a[i]",
"a",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int b[] = a.clone();",
"b",
"a.clone()",
"a.clone",
"a",
"for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n - 1",
"i",
"n - 1",
"n",
"1",
"i++",
"i++",
"i",
"{\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }",
"{\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }",
"if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];",
"a[i] - a[i + 1] > 0",
"a[i] - a[i + 1]",
"a[i]",
"a",
"i",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"0",
"a[i + 1] = a[i]",
"a[i + 1]",
"a",
"i + 1",
"i",
"1",
"a[i]",
"a",
"i",
"long stools=0;",
"stools",
"0",
"for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n stools+=a[i]-b[i];\n }",
"{\n stools+=a[i]-b[i];\n }",
"stools+=a[i]-b[i]",
"stools",
"a[i]-b[i]",
"a[i]",
"a",
"i",
"b[i]",
"b",
"i",
"out.println(stools)",
"out.println",
"out",
"stools",
"InputReader in",
"in",
"PrintWriter out",
"out",
"public class Main {\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tok;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n tok = null;\n }\n\n public InputReader(String inputFile) throws FileNotFoundException {\n reader = new BufferedReader(new FileReader(inputFile));\n tok = null;\n }\n\n public String nextLine() {\n String c = \"\";\n try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n\n return c;\n }\n\n public String next() {\n while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n return tok.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n\n public static void main(String args[]) {\n InputStream inputstream = System.in;\n OutputStream outputstream = System.out;\n InputReader in = new InputReader(inputstream);\n PrintWriter out = new PrintWriter(outputstream);\n Task solver = new Task();\n solver.solve(in, out);\n out.flush();\n }\n\n static class Task {\n public void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n int b[] = a.clone(); \n for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }\n long stools=0;\n for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }\n out.println(stools);\n }\n }\n}",
"public class Main {\n\n static class InputReader {\n public BufferedReader reader;\n public StringTokenizer tok;\n\n public InputReader(InputStream inputStream) {\n reader = new BufferedReader(new InputStreamReader(inputStream));\n tok = null;\n }\n\n public InputReader(String inputFile) throws FileNotFoundException {\n reader = new BufferedReader(new FileReader(inputFile));\n tok = null;\n }\n\n public String nextLine() {\n String c = \"\";\n try {\n c = reader.readLine();\n } catch (IOException e) {\n throw new RuntimeException(e);\n }\n\n return c;\n }\n\n public String next() {\n while (tok == null || !tok.hasMoreTokens()) {\n try {\n tok = new StringTokenizer(nextLine());\n } catch (Exception e) {\n throw new RuntimeException(e);\n }\n }\n\n return tok.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n public double nextDouble() {\n return Double.parseDouble(next());\n }\n }\n\n public static void main(String args[]) {\n InputStream inputstream = System.in;\n OutputStream outputstream = System.out;\n InputReader in = new InputReader(inputstream);\n PrintWriter out = new PrintWriter(outputstream);\n Task solver = new Task();\n solver.solve(in, out);\n out.flush();\n }\n\n static class Task {\n public void solve(InputReader in, PrintWriter out) {\n int n = in.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++)\n a[i] = in.nextInt();\n int b[] = a.clone(); \n for (int i = 0; i < n - 1; i++) {\n if (a[i] - a[i + 1] > 0)\n a[i + 1] = a[i];\n }\n long stools=0;\n for(int i=0;i<n;i++){\n stools+=a[i]-b[i];\n }\n out.println(stools);\n }\n }\n}",
"Main"
]
| import java.io.*;
import java.util.*;
public class Main {
static class InputReader {
public BufferedReader reader;
public StringTokenizer tok;
public InputReader(InputStream inputStream) {
reader = new BufferedReader(new InputStreamReader(inputStream));
tok = null;
}
public InputReader(String inputFile) throws FileNotFoundException {
reader = new BufferedReader(new FileReader(inputFile));
tok = null;
}
public String nextLine() {
String c = "";
try {
c = reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
return c;
}
public String next() {
while (tok == null || !tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(nextLine());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return tok.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
public static void main(String args[]) {
InputStream inputstream = System.in;
OutputStream outputstream = System.out;
InputReader in = new InputReader(inputstream);
PrintWriter out = new PrintWriter(outputstream);
Task solver = new Task();
solver.solve(in, out);
out.flush();
}
static class Task {
public void solve(InputReader in, PrintWriter out) {
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = in.nextInt();
int b[] = a.clone();
for (int i = 0; i < n - 1; i++) {
if (a[i] - a[i + 1] > 0)
a[i + 1] = a[i];
}
long stools=0;
for(int i=0;i<n;i++){
stools+=a[i]-b[i];
}
out.println(stools);
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
0,
13,
20,
4,
18,
13,
41,
13,
17,
41,
13,
41,
13,
17,
42,
4,
18,
13,
30,
0,
13,
4,
18,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
74,
8
],
[
74,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
11,
14
],
[
14,
15
],
[
14,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
22,
23
],
[
23,
24
],
[
11,
25
],
[
25,
26
],
[
25,
27
],
[
11,
28
],
[
28,
29
],
[
29,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
34
],
[
34,
35
],
[
11,
36
],
[
36,
37
],
[
36,
38
],
[
11,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
49,
50
],
[
50,
51
],
[
43,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
52,
62
],
[
62,
63
],
[
62,
64
],
[
11,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
9,
71
],
[
71,
72
],
[
0,
73
],
[
73,
74
],
[
73,
75
]
]
| [
"import java.io.*;\nimport java.util.*;\n\n/**\n * Created by Ayushi on 22 Aug 2020.\n * Problem:\n * Round:\n */\n\npublic class Main {\n public static void main(String[] args) throws IOException {\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine(), \" \");\n br.close();\n int p = 0;\n int a;\n long ans = 0;\n while (st.hasMoreTokens()) {\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }\n System.out.println(ans);\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws IOException {\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine(), \" \");\n br.close();\n int p = 0;\n int a;\n long ans = 0;\n while (st.hasMoreTokens()) {\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine(), \" \");\n br.close();\n int p = 0;\n int a;\n long ans = 0;\n while (st.hasMoreTokens()) {\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }\n System.out.println(ans);\n }",
"main",
"{\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine(), \" \");\n br.close();\n int p = 0;\n int a;\n long ans = 0;\n while (st.hasMoreTokens()) {\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }\n System.out.println(ans);\n }",
"StringTokenizer st;",
"st",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"st = new StringTokenizer(br.readLine(), \" \")",
"st",
"new StringTokenizer(br.readLine(), \" \")",
"br.close()",
"br.close",
"br",
"int p = 0;",
"p",
"0",
"int a;",
"a",
"long ans = 0;",
"ans",
"0",
"while (st.hasMoreTokens()) {\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }",
"a = Integer.parseInt(st.nextToken())",
"a",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"if (a < p) {\n ans += p-a;\n }\n else p = a;",
"a < p",
"a",
"p",
"{\n ans += p-a;\n }",
"ans += p-a",
"ans",
"p-a",
"p",
"a",
"p = a",
"p",
"a",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws IOException {\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine(), \" \");\n br.close();\n int p = 0;\n int a;\n long ans = 0;\n while (st.hasMoreTokens()) {\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) throws IOException {\n StringTokenizer st;\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n st = new StringTokenizer(br.readLine(), \" \");\n br.close();\n int p = 0;\n int a;\n long ans = 0;\n while (st.hasMoreTokens()) {\n a = Integer.parseInt(st.nextToken());\n if (a < p) {\n ans += p-a;\n }\n else p = a;\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.io.*;
import java.util.*;
/**
* Created by Ayushi on 22 Aug 2020.
* Problem:
* Round:
*/
public class Main {
public static void main(String[] args) throws IOException {
StringTokenizer st;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
st = new StringTokenizer(br.readLine(), " ");
br.close();
int p = 0;
int a;
long ans = 0;
while (st.hasMoreTokens()) {
a = Integer.parseInt(st.nextToken());
if (a < p) {
ans += p-a;
}
else p = a;
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
79,
5
],
[
79,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
48,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
6,
76
],
[
76,
77
],
[
0,
78
],
[
78,
79
],
[
78,
80
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] arr = new int[n];\n for(int i=0; i<n; i++)\n arr[i] = in.nextInt();\n int maxSoFar = arr[0];\n long ans = 0;\n for(int i : arr) {\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] arr = new int[n];\n for(int i=0; i<n; i++)\n arr[i] = in.nextInt();\n int maxSoFar = arr[0];\n long ans = 0;\n for(int i : arr) {\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] arr = new int[n];\n for(int i=0; i<n; i++)\n arr[i] = in.nextInt();\n int maxSoFar = arr[0];\n long ans = 0;\n for(int i : arr) {\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }\n System.out.println(ans);\n in.close();\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] arr = new int[n];\n for(int i=0; i<n; i++)\n arr[i] = in.nextInt();\n int maxSoFar = arr[0];\n long ans = 0;\n for(int i : arr) {\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }\n System.out.println(ans);\n in.close();\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"for(int i=0; i<n; i++)\n arr[i] = in.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"arr[i] = in.nextInt();",
"arr[i] = in.nextInt()",
"arr[i]",
"arr",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int maxSoFar = arr[0];",
"maxSoFar",
"arr[0]",
"arr",
"0",
"long ans = 0;",
"ans",
"0",
"for(int i : arr) {\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }",
"int i",
"arr",
"{\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }",
"{\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }",
"if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }",
"i > maxSoFar",
"i",
"maxSoFar",
"{\n maxSoFar = i;\n }",
"maxSoFar = i",
"maxSoFar",
"i",
"{\n ans += (long) (maxSoFar - i);\n }",
"ans += (long) (maxSoFar - i)",
"ans",
"(long) (maxSoFar - i)",
"maxSoFar",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"in.close()",
"in.close",
"in",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] arr = new int[n];\n for(int i=0; i<n; i++)\n arr[i] = in.nextInt();\n int maxSoFar = arr[0];\n long ans = 0;\n for(int i : arr) {\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int[] arr = new int[n];\n for(int i=0; i<n; i++)\n arr[i] = in.nextInt();\n int maxSoFar = arr[0];\n long ans = 0;\n for(int i : arr) {\n if(i > maxSoFar) {\n maxSoFar = i;\n } else {\n ans += (long) (maxSoFar - i);\n }\n }\n System.out.println(ans);\n in.close();\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] arr = new int[n];
for(int i=0; i<n; i++)
arr[i] = in.nextInt();
int maxSoFar = arr[0];
long ans = 0;
for(int i : arr) {
if(i > maxSoFar) {
maxSoFar = i;
} else {
ans += (long) (maxSoFar - i);
}
}
System.out.println(ans);
in.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
42,
2,
40,
13,
17,
30,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
76,
8
],
[
76,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
18,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
23,
29
],
[
29,
30
],
[
29,
31
],
[
23,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
34,
36
],
[
23,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
49,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
57,
60
],
[
57,
61
],
[
49,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
64,
66
],
[
23,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
9,
73
],
[
73,
74
],
[
0,
75
],
[
75,
76
],
[
75,
77
]
]
| [
"import java.io.*;\nimport java.util.Scanner;\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint t=1;//sc.nextInt();\n\t\twhile(t-->0) {\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}\n\n}\n/*class Reader{\n\tBufferedReader reader;\n\tReader(){\n\t\treader=new BufferedReader(new InputStreamReader(System.in));\n\t}\n\tint nextInt() throws IOException{\n\t\tString in=reader.readLine().trim();\n\t\treturn Integer.parseInt(in);\n\t}\n\tlong nextLong() throws IOException{\n\t\tString in=reader.readLine().trim();\n\t\treturn Long.parseLong(in);\n\t}\n\tString next() throws IOException{\n\t\treturn reader.readLine().trim();\n\t}\n\tString[] stringArray() throws IOException{\n\t\treturn reader.readLine().trim().split(\"\\\\s+\");\n\t}\n\tint[] intArray() throws IOException{\n\t\tString[] inp=this.stringArray();\n\t\tint[] arr=new int[inp.length];\n\t\tint i=0;\n\t\tfor(String s:inp) {\n\t\t\tarr[i++]=Integer.parseInt(s);\n\t\t}\n\t\treturn arr;\n\t}\n}*/\n\n",
"import java.io.*;",
"io.*",
"java",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint t=1;//sc.nextInt();\n\t\twhile(t-->0) {\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint t=1;//sc.nextInt();\n\t\twhile(t-->0) {\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}",
"main",
"{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint t=1;//sc.nextInt();\n\t\twhile(t-->0) {\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int t=1;",
"t",
"1",
"while(t-->0) {\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"t-->0",
"t--",
"t",
"0",
"{\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans=0;",
"ans",
"0",
"int max=Integer.MIN_VALUE;",
"max",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"for(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}",
"{\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}",
"int val=sc.nextInt();",
"val",
"sc.nextInt()",
"sc.nextInt",
"sc",
"max=Math.max(val, max)",
"max",
"Math.max(val, max)",
"Math.max",
"Math",
"val",
"max",
"ans+=max-val",
"ans",
"max-val",
"max",
"val",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint t=1;//sc.nextInt();\n\t\twhile(t-->0) {\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\n\t\tint t=1;//sc.nextInt();\n\t\twhile(t-->0) {\n\t\t\tint n=sc.nextInt();\n\t\t\tlong ans=0;\n\t\t\tint max=Integer.MIN_VALUE;\n\t\t\tfor(int i=0;i<n;i++) {\n\t\t\t\tint val=sc.nextInt();\n\t\t\t\tmax=Math.max(val, max);\n\t\t\t\tans+=max-val;\n\t\t\t}\n\t\t\tSystem.out.println(ans);\n\t\t}\n\n\t}\n\n}",
"Main"
]
| import java.io.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=1;//sc.nextInt();
while(t-->0) {
int n=sc.nextInt();
long ans=0;
int max=Integer.MIN_VALUE;
for(int i=0;i<n;i++) {
int val=sc.nextInt();
max=Math.max(val, max);
ans+=max-val;
}
System.out.println(ans);
}
}
}
/*class Reader{
BufferedReader reader;
Reader(){
reader=new BufferedReader(new InputStreamReader(System.in));
}
int nextInt() throws IOException{
String in=reader.readLine().trim();
return Integer.parseInt(in);
}
long nextLong() throws IOException{
String in=reader.readLine().trim();
return Long.parseLong(in);
}
String next() throws IOException{
return reader.readLine().trim();
}
String[] stringArray() throws IOException{
return reader.readLine().trim().split("\\s+");
}
int[] intArray() throws IOException{
String[] inp=this.stringArray();
int[] arr=new int[inp.length];
int i=0;
for(String s:inp) {
arr[i++]=Integer.parseInt(s);
}
return arr;
}
}*/
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
0,
13,
13,
0,
13,
2,
13,
13,
4,
18,
18,
13,
13,
2,
13,
17,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
79,
5
],
[
79,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
41,
42
],
[
42,
43
],
[
35,
44
],
[
44,
45
],
[
44,
46
],
[
35,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
51,
57
],
[
57,
58
],
[
57,
59
],
[
35,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
6,
76
],
[
76,
77
],
[
0,
78
],
[
78,
79
],
[
78,
80
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long fA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }\n System.out.println(ans + \"\");\n sc.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long fA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }\n System.out.println(ans + \"\");\n sc.close();\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long fA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }\n System.out.println(ans + \"\");\n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long fA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }\n System.out.println(ans + \"\");\n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long fA = 0;",
"fA",
"0",
"long ans = 0;",
"ans",
"0",
"for (int cnt = 0; cnt < n; cnt++) {\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }",
"int cnt = 0;",
"int cnt = 0;",
"cnt",
"0",
"cnt < n",
"cnt",
"n",
"cnt++",
"cnt++",
"cnt",
"{\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }",
"{\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }",
"long a = Long.parseLong(sc.next());",
"a",
"Long.parseLong(sc.next())",
"Long.parseLong",
"Long",
"sc.next()",
"sc.next",
"sc",
"long dai = 0;",
"dai",
"0",
"if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }",
"fA > a",
"fA",
"a",
"{\n dai = (fA - a);\n ans += dai;\n }",
"dai = (fA - a)",
"dai",
"(fA - a)",
"fA",
"a",
"ans += dai",
"ans",
"dai",
"fA = a + dai",
"fA",
"a + dai",
"a",
"dai",
"System.out.println(ans + \"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"ans + \"\"",
"ans",
"\"\"",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long fA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }\n System.out.println(ans + \"\");\n sc.close();\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n long fA = 0;\n long ans = 0;\n for (int cnt = 0; cnt < n; cnt++) {\n long a = Long.parseLong(sc.next());\n long dai = 0;\n if (fA > a) {\n dai = (fA - a);\n ans += dai;\n }\n fA = a + dai;\n }\n System.out.println(ans + \"\");\n sc.close();\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long fA = 0;
long ans = 0;
for (int cnt = 0; cnt < n; cnt++) {
long a = Long.parseLong(sc.next());
long dai = 0;
if (fA > a) {
dai = (fA - a);
ans += dai;
}
fA = a + dai;
}
System.out.println(ans + "");
sc.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
114,
14
],
[
114,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
23,
26
],
[
26,
27
],
[
27,
28
],
[
17,
29
],
[
29,
30
],
[
29,
31
],
[
17,
33
],
[
33,
34
],
[
33,
35
],
[
17,
36
],
[
36,
37
],
[
36,
38
],
[
17,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
44,
45
],
[
44,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
39,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
59,
60
],
[
17,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
75,
81
],
[
81,
82
],
[
81,
83
],
[
74,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
93,
95
],
[
84,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
17,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
15,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint N = Integer.parseInt(br.readLine());\n\t\t\n\t\tlong[] A = new long[N];\n\t\tlong ans = 0;\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<N; i++)\n\t\t\tA[i] = Long.parseLong(st.nextToken());\n\t\t\n\t\tfor(int i=1; i<N; i++) {\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint N = Integer.parseInt(br.readLine());\n\t\t\n\t\tlong[] A = new long[N];\n\t\tlong ans = 0;\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<N; i++)\n\t\t\tA[i] = Long.parseLong(st.nextToken());\n\t\t\n\t\tfor(int i=1; i<N; i++) {\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint N = Integer.parseInt(br.readLine());\n\t\t\n\t\tlong[] A = new long[N];\n\t\tlong ans = 0;\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<N; i++)\n\t\t\tA[i] = Long.parseLong(st.nextToken());\n\t\t\n\t\tfor(int i=1; i<N; i++) {\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint N = Integer.parseInt(br.readLine());\n\t\t\n\t\tlong[] A = new long[N];\n\t\tlong ans = 0;\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<N; i++)\n\t\t\tA[i] = Long.parseLong(st.nextToken());\n\t\t\n\t\tfor(int i=1; i<N; i++) {\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int N = Integer.parseInt(br.readLine());",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"long ans = 0;",
"ans",
"0",
"StringTokenizer st = new StringTokenizer(br.readLine());",
"st",
"new StringTokenizer(br.readLine())",
"for(int i=0; i<N; i++)\n\t\t\tA[i] = Long.parseLong(st.nextToken());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"A[i] = Long.parseLong(st.nextToken());",
"A[i] = Long.parseLong(st.nextToken())",
"A[i]",
"A",
"i",
"Long.parseLong(st.nextToken())",
"Long.parseLong",
"Long",
"st.nextToken()",
"st.nextToken",
"st",
"for(int i=1; i<N; i++) {\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}",
"if(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}",
"A[i-1] > A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"{\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}",
"ans += A[i-1] - A[i]",
"ans",
"A[i-1] - A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint N = Integer.parseInt(br.readLine());\n\t\t\n\t\tlong[] A = new long[N];\n\t\tlong ans = 0;\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<N; i++)\n\t\t\tA[i] = Long.parseLong(st.nextToken());\n\t\t\n\t\tfor(int i=1; i<N; i++) {\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\tint N = Integer.parseInt(br.readLine());\n\t\t\n\t\tlong[] A = new long[N];\n\t\tlong ans = 0;\n\t\tStringTokenizer st = new StringTokenizer(br.readLine());\n\t\tfor(int i=0; i<N; i++)\n\t\t\tA[i] = Long.parseLong(st.nextToken());\n\t\t\n\t\tfor(int i=1; i<N; i++) {\n\t\t\tif(A[i-1] > A[i]) {\n\t\t\t\tans += A[i-1] - A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
long[] A = new long[N];
long ans = 0;
StringTokenizer st = new StringTokenizer(br.readLine());
for(int i=0; i<N; i++)
A[i] = Long.parseLong(st.nextToken());
for(int i=1; i<N; i++) {
if(A[i-1] > A[i]) {
ans += A[i-1] - A[i];
A[i] = A[i-1];
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
2,
17,
17,
12,
13,
30,
41,
13,
17,
42,
2,
13,
17,
30,
14,
2,
2,
13,
17,
17,
30,
0,
13,
2,
2,
13,
13,
13,
40,
13,
30,
0,
13,
2,
2,
13,
13,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
13,
13,
2,
13,
17,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
14,
2,
13,
17,
30,
29,
13,
29,
4,
13,
13,
2,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
13,
13,
4,
18,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
20,
2,
17,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
18,
13,
13,
12,
13,
30,
14,
2,
13,
17,
37,
20,
14,
2,
13,
13,
30,
0,
13,
17,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
29,
40,
17,
29,
18,
13,
40,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
37,
20,
29,
2,
13,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
37,
20,
29,
2,
13,
13,
12,
13,
30,
41,
13,
17,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
41,
13,
17,
14,
2,
13,
17,
30,
0,
13,
40,
17,
0,
13,
4,
13,
42,
2,
40,
4,
13,
13,
2,
13,
17,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
0,
13,
4,
13,
37,
20,
14,
2,
13,
17,
30,
0,
13,
4,
13,
41,
13,
17,
42,
40,
4,
13,
13,
30,
14,
2,
2,
13,
17,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
2,
13,
17,
13,
0,
13,
4,
13,
37,
20,
29,
2,
13,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
0,
13,
4,
13,
42,
40,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
36,
29,
13,
23,
13,
12,
13,
30,
14,
2,
2,
2,
2,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
17,
2,
13,
40,
17,
29,
17,
29,
17,
23,
13,
6,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
4,
18,
13,
2,
13,
17,
23,
13,
12,
13,
30,
4,
13,
13,
4,
18,
13,
17,
23,
13,
12,
13,
30,
4,
18,
13,
12,
13,
30,
4,
18,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
866,
11
],
[
866,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
14,
16
],
[
866,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
28,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
34,
42
],
[
42,
43
],
[
28,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
44,
52
],
[
52,
53
],
[
52,
54
],
[
19,
55
],
[
55,
56
],
[
17,
57
],
[
57,
58
],
[
17,
59
],
[
59,
60
],
[
866,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
65,
68
],
[
68,
69
],
[
68,
70
],
[
61,
71
],
[
71,
72
],
[
866,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
75,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
84,
87
],
[
87,
88
],
[
87,
89
],
[
73,
90
],
[
90,
91
],
[
73,
92
],
[
92,
93
],
[
866,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
102,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
105,
108
],
[
108,
109
],
[
108,
110
],
[
94,
111
],
[
111,
112
],
[
94,
113
],
[
113,
114
],
[
866,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
117,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
125,
128
],
[
117,
129
],
[
129,
130
],
[
129,
131
],
[
117,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
137,
138
],
[
137,
139
],
[
132,
140
],
[
140,
141
],
[
141,
142
],
[
132,
143
],
[
144,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
145,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
164,
165
],
[
164,
166
],
[
155,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
173,
174
],
[
173,
175
],
[
117,
176
],
[
176,
177
],
[
177,
178
],
[
176,
179
],
[
115,
180
],
[
180,
181
],
[
115,
182
],
[
182,
183
],
[
866,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
190,
192
],
[
186,
193
],
[
193,
194
],
[
193,
195
],
[
186,
196
],
[
196,
197
],
[
197,
198
],
[
196,
199
],
[
196,
200
],
[
186,
201
],
[
201,
202
],
[
202,
203
],
[
186,
204
],
[
204,
205
],
[
205,
206
],
[
184,
207
],
[
207,
208
],
[
866,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
211,
213
],
[
214,
215
],
[
214,
216
],
[
209,
217
],
[
217,
218
],
[
209,
219
],
[
219,
220
],
[
209,
221
],
[
221,
222
],
[
209,
223
],
[
223,
224
],
[
223,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
228,
229
],
[
228,
230
],
[
209,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
234,
238
],
[
238,
239
],
[
233,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
244,
248
],
[
248,
249
],
[
248,
250
],
[
250,
251
],
[
251,
252
],
[
250,
253
],
[
244,
254
],
[
254,
255
],
[
255,
256
],
[
255,
257
],
[
254,
258
],
[
258,
259
],
[
259,
260
],
[
233,
261
],
[
261,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
209,
266
],
[
266,
267
],
[
266,
268
],
[
268,
269
],
[
269,
270
],
[
269,
271
],
[
268,
272
],
[
272,
273
],
[
272,
274
],
[
274,
275
],
[
268,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
276,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
268,
284
],
[
284,
285
],
[
284,
286
],
[
268,
287
],
[
287,
288
],
[
288,
289
],
[
288,
290
],
[
287,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
294,
295
],
[
291,
296
],
[
296,
297
],
[
296,
298
],
[
298,
299
],
[
268,
300
],
[
300,
301
],
[
301,
302
],
[
302,
303
],
[
302,
304
],
[
300,
305
],
[
305,
306
],
[
306,
307
],
[
307,
308
],
[
308,
309
],
[
308,
310
],
[
307,
311
],
[
311,
312
],
[
311,
313
],
[
306,
314
],
[
314,
315
],
[
315,
316
],
[
315,
317
],
[
314,
318
],
[
318,
319
],
[
318,
320
],
[
320,
321
],
[
320,
322
],
[
314,
323
],
[
323,
324
],
[
323,
325
],
[
325,
326
],
[
306,
327
],
[
327,
328
],
[
268,
329
],
[
329,
330
],
[
330,
331
],
[
330,
332
],
[
209,
333
],
[
333,
334
],
[
333,
335
],
[
335,
336
],
[
336,
337
],
[
336,
338
],
[
335,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
335,
343
],
[
343,
344
],
[
344,
345
],
[
344,
346
],
[
343,
347
],
[
347,
348
],
[
347,
349
],
[
349,
350
],
[
335,
351
],
[
351,
352
],
[
351,
353
],
[
335,
354
],
[
354,
355
],
[
355,
356
],
[
355,
357
],
[
354,
358
],
[
358,
359
],
[
359,
360
],
[
359,
361
],
[
361,
362
],
[
358,
363
],
[
363,
364
],
[
363,
365
],
[
365,
366
],
[
335,
367
],
[
367,
368
],
[
368,
369
],
[
369,
370
],
[
369,
371
],
[
367,
372
],
[
372,
373
],
[
373,
374
],
[
374,
375
],
[
375,
376
],
[
375,
377
],
[
374,
378
],
[
378,
379
],
[
378,
380
],
[
373,
381
],
[
381,
382
],
[
382,
383
],
[
382,
384
],
[
381,
385
],
[
385,
386
],
[
385,
387
],
[
387,
388
],
[
387,
389
],
[
381,
390
],
[
390,
391
],
[
390,
392
],
[
392,
393
],
[
373,
394
],
[
394,
395
],
[
335,
396
],
[
396,
397
],
[
397,
398
],
[
397,
399
],
[
209,
400
],
[
400,
401
],
[
400,
402
],
[
402,
403
],
[
403,
404
],
[
403,
405
],
[
402,
406
],
[
406,
407
],
[
406,
408
],
[
408,
409
],
[
402,
410
],
[
410,
411
],
[
411,
412
],
[
411,
413
],
[
410,
414
],
[
414,
415
],
[
414,
416
],
[
416,
417
],
[
402,
418
],
[
418,
419
],
[
418,
420
],
[
402,
421
],
[
421,
422
],
[
422,
423
],
[
422,
424
],
[
421,
425
],
[
425,
426
],
[
426,
427
],
[
426,
428
],
[
428,
429
],
[
425,
430
],
[
430,
431
],
[
430,
432
],
[
432,
433
],
[
402,
434
],
[
434,
435
],
[
435,
436
],
[
436,
437
],
[
437,
438
],
[
437,
439
],
[
435,
440
],
[
440,
441
],
[
440,
442
],
[
434,
443
],
[
443,
444
],
[
444,
445
],
[
445,
446
],
[
446,
447
],
[
446,
448
],
[
445,
449
],
[
449,
450
],
[
449,
451
],
[
444,
452
],
[
452,
453
],
[
453,
454
],
[
453,
455
],
[
452,
456
],
[
456,
457
],
[
456,
458
],
[
458,
459
],
[
458,
460
],
[
452,
461
],
[
461,
462
],
[
461,
463
],
[
463,
464
],
[
444,
465
],
[
465,
466
],
[
402,
467
],
[
467,
468
],
[
468,
469
],
[
468,
470
],
[
467,
471
],
[
471,
472
],
[
472,
473
],
[
472,
474
],
[
474,
475
],
[
471,
476
],
[
476,
477
],
[
476,
478
],
[
471,
479
],
[
479,
480
],
[
480,
481
],
[
481,
482
],
[
481,
483
],
[
479,
484
],
[
484,
485
],
[
485,
486
],
[
486,
487
],
[
487,
488
],
[
487,
489
],
[
486,
490
],
[
490,
491
],
[
490,
492
],
[
485,
493
],
[
493,
494
],
[
494,
495
],
[
494,
496
],
[
493,
497
],
[
497,
498
],
[
497,
499
],
[
499,
500
],
[
500,
501
],
[
500,
502
],
[
499,
503
],
[
493,
504
],
[
504,
505
],
[
504,
506
],
[
506,
507
],
[
485,
508
],
[
508,
509
],
[
402,
510
],
[
510,
511
],
[
511,
512
],
[
511,
513
],
[
209,
514
],
[
514,
515
],
[
514,
516
],
[
516,
517
],
[
517,
518
],
[
517,
519
],
[
516,
520
],
[
520,
521
],
[
520,
522
],
[
522,
523
],
[
516,
524
],
[
524,
525
],
[
525,
526
],
[
525,
527
],
[
524,
528
],
[
528,
529
],
[
528,
530
],
[
530,
531
],
[
516,
532
],
[
532,
533
],
[
533,
534
],
[
534,
535
],
[
534,
536
],
[
532,
537
],
[
537,
538
],
[
538,
539
],
[
539,
540
],
[
538,
541
],
[
537,
542
],
[
542,
543
],
[
542,
544
],
[
544,
545
],
[
516,
546
],
[
546,
547
],
[
547,
548
],
[
548,
549
],
[
209,
550
],
[
550,
551
],
[
550,
552
],
[
552,
553
],
[
553,
554
],
[
553,
555
],
[
552,
556
],
[
556,
557
],
[
557,
558
],
[
558,
559
],
[
558,
560
],
[
556,
561
],
[
561,
562
],
[
561,
563
],
[
556,
564
],
[
564,
565
],
[
565,
566
],
[
556,
567
],
[
568,
568
],
[
568,
569
],
[
569,
570
],
[
570,
571
],
[
569,
572
],
[
572,
573
],
[
573,
574
],
[
552,
575
],
[
575,
576
],
[
550,
577
],
[
577,
578
],
[
209,
579
],
[
579,
580
],
[
579,
581
],
[
581,
582
],
[
582,
583
],
[
582,
584
],
[
581,
586
],
[
586,
587
],
[
587,
588
],
[
588,
589
],
[
588,
590
],
[
586,
591
],
[
591,
592
],
[
591,
593
],
[
586,
594
],
[
594,
595
],
[
595,
596
],
[
586,
597
],
[
598,
598
],
[
598,
599
],
[
599,
600
],
[
600,
601
],
[
600,
602
],
[
599,
603
],
[
603,
604
],
[
604,
605
],
[
581,
606
],
[
606,
607
],
[
579,
608
],
[
608,
609
],
[
209,
610
],
[
610,
611
],
[
610,
612
],
[
612,
613
],
[
613,
614
],
[
613,
615
],
[
612,
616
],
[
616,
617
],
[
617,
618
],
[
618,
619
],
[
618,
620
],
[
616,
621
],
[
621,
622
],
[
621,
623
],
[
616,
624
],
[
624,
625
],
[
625,
626
],
[
616,
627
],
[
628,
628
],
[
628,
629
],
[
629,
630
],
[
630,
631
],
[
629,
632
],
[
632,
633
],
[
633,
634
],
[
612,
635
],
[
635,
636
],
[
610,
637
],
[
637,
638
],
[
209,
639
],
[
639,
640
],
[
639,
641
],
[
641,
642
],
[
642,
643
],
[
642,
644
],
[
641,
646
],
[
646,
647
],
[
647,
648
],
[
648,
649
],
[
648,
650
],
[
646,
651
],
[
651,
652
],
[
651,
653
],
[
646,
654
],
[
654,
655
],
[
655,
656
],
[
646,
657
],
[
658,
658
],
[
658,
659
],
[
659,
660
],
[
660,
661
],
[
660,
662
],
[
659,
663
],
[
663,
664
],
[
664,
665
],
[
641,
666
],
[
666,
667
],
[
639,
668
],
[
668,
669
],
[
209,
670
],
[
670,
671
],
[
670,
672
],
[
672,
673
],
[
673,
674
],
[
673,
675
],
[
672,
676
],
[
676,
677
],
[
677,
678
],
[
678,
679
],
[
678,
680
],
[
676,
681
],
[
681,
682
],
[
681,
683
],
[
676,
684
],
[
684,
685
],
[
685,
686
],
[
676,
687
],
[
688,
688
],
[
688,
689
],
[
689,
690
],
[
690,
691
],
[
689,
692
],
[
692,
693
],
[
693,
694
],
[
672,
695
],
[
695,
696
],
[
670,
697
],
[
697,
698
],
[
209,
699
],
[
699,
700
],
[
699,
701
],
[
701,
702
],
[
702,
703
],
[
702,
704
],
[
701,
705
],
[
705,
706
],
[
706,
707
],
[
707,
708
],
[
707,
709
],
[
705,
710
],
[
710,
711
],
[
710,
712
],
[
705,
713
],
[
713,
714
],
[
714,
715
],
[
705,
716
],
[
717,
717
],
[
717,
718
],
[
718,
719
],
[
719,
720
],
[
718,
721
],
[
721,
722
],
[
722,
723
],
[
701,
724
],
[
724,
725
],
[
699,
726
],
[
726,
727
],
[
209,
728
],
[
728,
729
],
[
728,
730
],
[
730,
731
],
[
731,
732
],
[
731,
733
],
[
730,
735
],
[
735,
736
],
[
736,
737
],
[
737,
738
],
[
737,
739
],
[
735,
740
],
[
740,
741
],
[
740,
742
],
[
735,
743
],
[
743,
744
],
[
744,
745
],
[
735,
746
],
[
747,
747
],
[
747,
748
],
[
748,
749
],
[
749,
750
],
[
749,
751
],
[
748,
752
],
[
752,
753
],
[
753,
754
],
[
730,
755
],
[
755,
756
],
[
728,
757
],
[
757,
758
],
[
209,
759
],
[
759,
760
],
[
759,
761
],
[
761,
762
],
[
762,
763
],
[
762,
764
],
[
761,
766
],
[
766,
767
],
[
767,
768
],
[
768,
769
],
[
768,
770
],
[
766,
771
],
[
771,
772
],
[
771,
773
],
[
766,
774
],
[
774,
775
],
[
775,
776
],
[
766,
777
],
[
778,
778
],
[
778,
779
],
[
779,
780
],
[
780,
781
],
[
780,
782
],
[
779,
783
],
[
783,
784
],
[
784,
785
],
[
761,
786
],
[
786,
787
],
[
759,
788
],
[
788,
789
],
[
209,
790
],
[
790,
791
],
[
790,
792
],
[
792,
793
],
[
793,
794
],
[
797,
795
],
[
807,
796
],
[
804,
797
],
[
797,
798
],
[
798,
799
],
[
798,
800
],
[
797,
801
],
[
801,
802
],
[
801,
803
],
[
804,
804
],
[
804,
805
],
[
804,
806
],
[
807,
807
],
[
807,
808
],
[
807,
809
],
[
797,
810
],
[
810,
811
],
[
810,
812
],
[
812,
813
],
[
793,
814
],
[
814,
815
],
[
792,
816
],
[
816,
817
],
[
790,
818
],
[
818,
819
],
[
866,
820
],
[
820,
821
],
[
820,
822
],
[
822,
823
],
[
820,
824
],
[
824,
825
],
[
824,
826
],
[
826,
827
],
[
827,
828
],
[
827,
829
],
[
820,
830
],
[
830,
831
],
[
830,
832
],
[
832,
833
],
[
833,
834
],
[
834,
835
],
[
833,
836
],
[
836,
837
],
[
836,
838
],
[
830,
839
],
[
839,
840
],
[
820,
841
],
[
841,
842
],
[
841,
843
],
[
843,
844
],
[
844,
845
],
[
844,
846
],
[
843,
847
],
[
847,
848
],
[
848,
849
],
[
847,
850
],
[
841,
851
],
[
851,
852
],
[
820,
853
],
[
853,
854
],
[
853,
855
],
[
855,
856
],
[
856,
857
],
[
857,
858
],
[
820,
859
],
[
859,
860
],
[
859,
861
],
[
861,
862
],
[
862,
863
],
[
863,
864
],
[
0,
865
],
[
865,
866
],
[
865,
867
]
]
| [
"\n\n/************************************************************************\n AUTH : krishna-3249 \n DATE : 8/22/20\n TIME : 6:41 PM\n\n Everyone’s a whore, Grace. We just sell different parts of ourselves.\n ************************************************************************/\n\nimport java.lang.*;\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n private static final long MOD = (long) (1e9 + 7);\n\n private long power(long base, long exponent) {\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }\n\n private long inverseMod(long number) {\n return power(number, MOD - 2);\n }\n\n private int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public void solve(Read input, Write output) throws Exception {\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n long mincost = 0;\n for (int i=1;i<N;i++) {\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n output.printLine(mincost);\n }\n\n public static void main(String[] args) throws Exception {\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }\n\n // java fast io reader and writer\n // taken from various sources and customized\n\n static class Read {\n\n private byte[] buffer = new byte[10 * 1024];\n private int index;\n private InputStream input_stream;\n private int total;\n\n public Read() {\n input_stream = System.in;\n }\n\n public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }\n\n public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }\n\n public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }\n\n public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }\n\n public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }\n\n public List<Double> readDoubleList(int size) throws IOException {\n List<Double> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }\n\n public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }\n\n public List<String> readStringList(int size) throws IOException {\n List<String> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }\n\n public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }\n\n public List<Integer> readIntList(int size) throws IOException {\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }\n\n public List<Long> readLongList(int size) throws IOException {\n List<Long> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }\n\n public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }\n\n public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }\n }\n\n static class Write {\n\n private final BufferedWriter bw;\n\n public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }\n\n public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }\n\n public void close() throws IOException {\n bw.close();\n }\n\n public void flush() throws IOException {\n bw.flush();\n }\n }\n}",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n private static final long MOD = (long) (1e9 + 7);\n\n private long power(long base, long exponent) {\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }\n\n private long inverseMod(long number) {\n return power(number, MOD - 2);\n }\n\n private int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public void solve(Read input, Write output) throws Exception {\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n long mincost = 0;\n for (int i=1;i<N;i++) {\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n output.printLine(mincost);\n }\n\n public static void main(String[] args) throws Exception {\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }\n\n // java fast io reader and writer\n // taken from various sources and customized\n\n static class Read {\n\n private byte[] buffer = new byte[10 * 1024];\n private int index;\n private InputStream input_stream;\n private int total;\n\n public Read() {\n input_stream = System.in;\n }\n\n public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }\n\n public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }\n\n public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }\n\n public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }\n\n public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }\n\n public List<Double> readDoubleList(int size) throws IOException {\n List<Double> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }\n\n public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }\n\n public List<String> readStringList(int size) throws IOException {\n List<String> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }\n\n public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }\n\n public List<Integer> readIntList(int size) throws IOException {\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }\n\n public List<Long> readLongList(int size) throws IOException {\n List<Long> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }\n\n public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }\n\n public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }\n }\n\n static class Write {\n\n private final BufferedWriter bw;\n\n public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }\n\n public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }\n\n public void close() throws IOException {\n bw.close();\n }\n\n public void flush() throws IOException {\n bw.flush();\n }\n }\n}",
"Main",
"private static final long MOD = (long) (1e9 + 7);",
"MOD",
"(long) (1e9 + 7)",
"1e9",
"7",
"private long power(long base, long exponent) {\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }",
"power",
"{\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }",
"long res = 1;",
"res",
"1",
"while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }",
"exponent > 0",
"exponent",
"0",
"{\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }",
"if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }",
"(base & 1) == 1",
"(base & 1)",
"base",
"1",
"1",
"{\n res = (res * base) % MOD;\n exponent--;\n }",
"res = (res * base) % MOD",
"res",
"(res * base) % MOD",
"(res * base)",
"res",
"base",
"MOD",
"exponent--",
"exponent",
"{\n res = (res * res) % MOD;\n exponent >>= 1;\n }",
"res = (res * res) % MOD",
"res",
"(res * res) % MOD",
"(res * res)",
"res",
"res",
"MOD",
"exponent >>= 1",
"exponent",
"1",
"return res;",
"res",
"long base",
"base",
"long exponent",
"exponent",
"private long inverseMod(long number) {\n return power(number, MOD - 2);\n }",
"inverseMod",
"{\n return power(number, MOD - 2);\n }",
"return power(number, MOD - 2);",
"power(number, MOD - 2)",
"power",
"number",
"MOD - 2",
"MOD",
"2",
"long number",
"number",
"private int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }",
"gcd",
"{\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }",
"if (b == 0) {\n return a;\n }",
"b == 0",
"b",
"0",
"{\n return a;\n }",
"return a;",
"a",
"return gcd(b, a % b);",
"gcd(b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"int a",
"a",
"int b",
"b",
"private long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }",
"gcd",
"{\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }",
"if (b == 0) {\n return a;\n }",
"b == 0",
"b",
"0",
"{\n return a;\n }",
"return a;",
"a",
"return gcd(b, a % b);",
"gcd(b, a % b)",
"gcd",
"b",
"a % b",
"a",
"b",
"long a",
"a",
"long b",
"b",
"public void solve(Read input, Write output) throws Exception {\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n long mincost = 0;\n for (int i=1;i<N;i++) {\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n output.printLine(mincost);\n }",
"solve",
"{\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n long mincost = 0;\n for (int i=1;i<N;i++) {\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n output.printLine(mincost);\n }",
"int N = input.readInt();",
"N",
"input.readInt()",
"input.readInt",
"input",
"int[] arr = input.readIntArray(N);",
"arr",
"input.readIntArray(N)",
"input.readIntArray",
"input",
"N",
"long mincost = 0;",
"mincost",
"0",
"for (int i=1;i<N;i++) {\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }",
"{\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }",
"if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }",
"arr[i]<arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"{\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }",
"mincost += (arr[i-1]-arr[i])",
"mincost",
"(arr[i-1]-arr[i])",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"arr[i]",
"arr",
"i",
"arr[i] = arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"output.printLine(mincost)",
"output.printLine",
"output",
"mincost",
"Read input",
"input",
"Write output",
"output",
"public static void main(String[] args) throws Exception {\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }",
"main",
"{\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }",
"Read input = new Read();",
"input",
"new Read()",
"Write output = new Write();",
"output",
"new Write()",
"Main D = new Main();",
"D",
"new Main()",
"D.solve(input, output)",
"D.solve",
"D",
"input",
"output",
"output.flush()",
"output.flush",
"output",
"output.close()",
"output.close",
"output",
"String[] args",
"args",
"static class Read {\n\n private byte[] buffer = new byte[10 * 1024];\n private int index;\n private InputStream input_stream;\n private int total;\n\n public Read() {\n input_stream = System.in;\n }\n\n public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }\n\n public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }\n\n public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }\n\n public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }\n\n public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }\n\n public List<Double> readDoubleList(int size) throws IOException {\n List<Double> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }\n\n public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }\n\n public List<String> readStringList(int size) throws IOException {\n List<String> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }\n\n public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }\n\n public List<Integer> readIntList(int size) throws IOException {\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }\n\n public List<Long> readLongList(int size) throws IOException {\n List<Long> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }\n\n public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }\n\n public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }\n }",
"Read",
"private byte[] buffer = new byte[10 * 1024];",
"buffer",
"new byte[10 * 1024]",
"10 * 1024",
"10",
"1024",
"private int index;",
"index",
"private InputStream input_stream;",
"input_stream",
"private int total;",
"total",
"public Read() {\n input_stream = System.in;\n }",
"Read",
"{\n input_stream = System.in;\n }",
"input_stream = System.in",
"input_stream",
"System.in",
"System",
"System.in",
"public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }",
"read",
"{\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }",
"if (total < 0)\n throw new InputMismatchException();",
"total < 0",
"total",
"0",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }",
"index >= total",
"index",
"total",
"{\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }",
"index = 0",
"index",
"0",
"total = input_stream.read(buffer)",
"total",
"input_stream.read(buffer)",
"input_stream.read",
"input_stream",
"buffer",
"if (total <= 0)\n return -1;",
"total <= 0",
"total",
"0",
"return -1;",
"-1",
"1",
"return buffer[index++];",
"buffer[index++]",
"buffer",
"index++",
"index",
"public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }",
"readLong",
"{\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }",
"long number = 0;",
"number",
"0",
"int n = read();",
"n",
"read()",
"read",
"while (isWhiteSpace(n))\n n = read();",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"n = read()",
"n",
"read()",
"read",
"long neg = 1l;",
"neg",
"1l",
"if (n == '-') {\n neg = -1l;\n n = read();\n }",
"n == '-'",
"n",
"'-'",
"{\n neg = -1l;\n n = read();\n }",
"neg = -1l",
"neg",
"-1l",
"1l",
"n = read()",
"n",
"read()",
"read",
"while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }",
"!isWhiteSpace(n)",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"{\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }",
"if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();",
"n >= '0' && n <= '9'",
"n >= '0'",
"n",
"'0'",
"n <= '9'",
"n",
"'9'",
"{\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n }",
"number *= 10l",
"number",
"10l",
"number += (long) (n - '0')",
"number",
"(long) (n - '0')",
"n",
"'0'",
"n = read()",
"n",
"read()",
"read",
"throw new InputMismatchException();",
"new InputMismatchException()",
"return neg * number;",
"neg * number",
"neg",
"number",
"public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }",
"readInt",
"{\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }",
"int integer = 0;",
"integer",
"0",
"int n = read();",
"n",
"read()",
"read",
"while (isWhiteSpace(n))\n n = read();",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"n = read()",
"n",
"read()",
"read",
"int neg = 1;",
"neg",
"1",
"if (n == '-') {\n neg = -1;\n n = read();\n }",
"n == '-'",
"n",
"'-'",
"{\n neg = -1;\n n = read();\n }",
"neg = -1",
"neg",
"-1",
"1",
"n = read()",
"n",
"read()",
"read",
"while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }",
"!isWhiteSpace(n)",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"{\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }",
"if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();",
"n >= '0' && n <= '9'",
"n >= '0'",
"n",
"'0'",
"n <= '9'",
"n",
"'9'",
"{\n integer *= 10;\n integer += n - '0';\n n = read();\n }",
"integer *= 10",
"integer",
"10",
"integer += n - '0'",
"integer",
"n - '0'",
"n",
"'0'",
"n = read()",
"n",
"read()",
"read",
"throw new InputMismatchException();",
"new InputMismatchException()",
"return neg * integer;",
"neg * integer",
"neg",
"integer",
"public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }",
"readDouble",
"{\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }",
"double doub = 0;",
"doub",
"0",
"int n = read();",
"n",
"read()",
"read",
"while (isWhiteSpace(n))\n n = read();",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"n = read()",
"n",
"read()",
"read",
"int neg = 1;",
"neg",
"1",
"if (n == '-') {\n neg = -1;\n n = read();\n }",
"n == '-'",
"n",
"'-'",
"{\n neg = -1;\n n = read();\n }",
"neg = -1",
"neg",
"-1",
"1",
"n = read()",
"n",
"read()",
"read",
"while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }",
"!isWhiteSpace(n) && n != '.'",
"!isWhiteSpace(n)",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"n != '.'",
"n",
"'.'",
"{\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }",
"if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();",
"n >= '0' && n <= '9'",
"n >= '0'",
"n",
"'0'",
"n <= '9'",
"n",
"'9'",
"{\n doub *= 10;\n doub += n - '0';\n n = read();\n }",
"doub *= 10",
"doub",
"10",
"doub += n - '0'",
"doub",
"n - '0'",
"n",
"'0'",
"n = read()",
"n",
"read()",
"read",
"throw new InputMismatchException();",
"new InputMismatchException()",
"if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }",
"n == '.'",
"n",
"'.'",
"{\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }",
"n = read()",
"n",
"read()",
"read",
"double temp = 1;",
"temp",
"1",
"while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }",
"!isWhiteSpace(n)",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"{\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }",
"if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();",
"n >= '0' && n <= '9'",
"n >= '0'",
"n",
"'0'",
"n <= '9'",
"n",
"'9'",
"{\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n }",
"temp /= 10",
"temp",
"10",
"doub += (n - '0') * temp",
"doub",
"(n - '0') * temp",
"(n - '0')",
"n",
"'0'",
"temp",
"n = read()",
"n",
"read()",
"read",
"throw new InputMismatchException();",
"new InputMismatchException()",
"return doub * neg;",
"doub * neg",
"doub",
"neg",
"public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }",
"readString",
"{\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int n = read();",
"n",
"read()",
"read",
"while (isWhiteSpace(n))\n n = read();",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"n = read()",
"n",
"read()",
"read",
"while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }",
"!isWhiteSpace(n)",
"isWhiteSpace(n)",
"isWhiteSpace",
"n",
"{\n sb.append((char) n);\n n = read();\n }",
"sb.append((char) n)",
"sb.append",
"sb",
"(char) n",
"n = read()",
"n",
"read()",
"read",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public List<Double> readDoubleList(int size) throws IOException {\n List<Double> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }",
"readDoubleList",
"{\n List<Double> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }",
"List<Double> res = new ArrayList<>();",
"res",
"new ArrayList<>()",
"for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res.add(this.readDouble());\n }",
"{\n res.add(this.readDouble());\n }",
"res.add(this.readDouble())",
"res.add",
"res",
"this.readDouble()",
"this.readDouble",
"this",
"return res;",
"res",
"int size",
"size",
"public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }",
"readDoubleArray",
"{\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }",
"double[] res = new double[size];",
"res",
"new double[size]",
"size",
"for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res[i] = this.readDouble();\n }",
"{\n res[i] = this.readDouble();\n }",
"res[i] = this.readDouble()",
"res[i]",
"res",
"i",
"this.readDouble()",
"this.readDouble",
"this",
"return res;",
"res",
"int size",
"size",
"public List<String> readStringList(int size) throws IOException {\n List<String> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }",
"readStringList",
"{\n List<String> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }",
"List<String> res = new ArrayList<>();",
"res",
"new ArrayList<>()",
"for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res.add(this.readString());\n }",
"{\n res.add(this.readString());\n }",
"res.add(this.readString())",
"res.add",
"res",
"this.readString()",
"this.readString",
"this",
"return res;",
"res",
"int size",
"size",
"public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }",
"readStringArray",
"{\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }",
"String[] res = new String[size];",
"res",
"new String[size]",
"size",
"for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res[i] = this.readString();\n }",
"{\n res[i] = this.readString();\n }",
"res[i] = this.readString()",
"res[i]",
"res",
"i",
"this.readString()",
"this.readString",
"this",
"return res;",
"res",
"int size",
"size",
"public List<Integer> readIntList(int size) throws IOException {\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }",
"readIntList",
"{\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }",
"List<Integer> res = new ArrayList<>();",
"res",
"new ArrayList<>()",
"for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res.add(this.readInt());\n }",
"{\n res.add(this.readInt());\n }",
"res.add(this.readInt())",
"res.add",
"res",
"this.readInt()",
"this.readInt",
"this",
"return res;",
"res",
"int size",
"size",
"public List<Long> readLongList(int size) throws IOException {\n List<Long> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }",
"readLongList",
"{\n List<Long> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }",
"List<Long> res = new ArrayList<>();",
"res",
"new ArrayList<>()",
"for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res.add(this.readLong());\n }",
"{\n res.add(this.readLong());\n }",
"res.add(this.readLong())",
"res.add",
"res",
"this.readLong()",
"this.readLong",
"this",
"return res;",
"res",
"int size",
"size",
"public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }",
"readIntArray",
"{\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }",
"int[] res = new int[size];",
"res",
"new int[size]",
"size",
"for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res[i] = this.readInt();\n }",
"{\n res[i] = this.readInt();\n }",
"res[i] = this.readInt()",
"res[i]",
"res",
"i",
"this.readInt()",
"this.readInt",
"this",
"return res;",
"res",
"int size",
"size",
"public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }",
"readLongArray",
"{\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }",
"long[] res = new long[size];",
"res",
"new long[size]",
"size",
"for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n res[i] = this.readLong();\n }",
"{\n res[i] = this.readLong();\n }",
"res[i] = this.readLong()",
"res[i]",
"res",
"i",
"this.readLong()",
"this.readLong",
"this",
"return res;",
"res",
"int size",
"size",
"private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }",
"isWhiteSpace",
"{\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }",
"if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;",
"n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1",
"n == '\\t'",
"n == '\\r'",
"n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1",
"n == ' '",
"n",
"' '",
"n == '\\n'",
"n",
"'\\n'",
"n == '\\r'",
"n",
"'\\r'",
"n == '\\t'",
"n",
"'\\t'",
"n == -1",
"n",
"-1",
"1",
"return true;",
"true",
"return false;",
"false",
"int n",
"n",
"static class Write {\n\n private final BufferedWriter bw;\n\n public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }\n\n public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }\n\n public void close() throws IOException {\n bw.close();\n }\n\n public void flush() throws IOException {\n bw.flush();\n }\n }",
"Write",
"private final BufferedWriter bw;",
"bw",
"public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }",
"Write",
"{\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }",
"bw = new BufferedWriter(new OutputStreamWriter(System.out))",
"bw",
"new BufferedWriter(new OutputStreamWriter(System.out))",
"public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }",
"print",
"{\n bw.append(str + \"\");\n }",
"bw.append(str + \"\")",
"bw.append",
"bw",
"str + \"\"",
"str",
"\"\"",
"Object str",
"str",
"public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }",
"printLine",
"{\n print(str);\n bw.append(\"\\n\");\n }",
"print(str)",
"print",
"str",
"bw.append(\"\\n\")",
"bw.append",
"bw",
"\"\\n\"",
"Object str",
"str",
"public void close() throws IOException {\n bw.close();\n }",
"close",
"{\n bw.close();\n }",
"bw.close()",
"bw.close",
"bw",
"public void flush() throws IOException {\n bw.flush();\n }",
"flush",
"{\n bw.flush();\n }",
"bw.flush()",
"bw.flush",
"bw",
"public class Main {\n\n private static final long MOD = (long) (1e9 + 7);\n\n private long power(long base, long exponent) {\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }\n\n private long inverseMod(long number) {\n return power(number, MOD - 2);\n }\n\n private int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public void solve(Read input, Write output) throws Exception {\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n long mincost = 0;\n for (int i=1;i<N;i++) {\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n output.printLine(mincost);\n }\n\n public static void main(String[] args) throws Exception {\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }\n\n // java fast io reader and writer\n // taken from various sources and customized\n\n static class Read {\n\n private byte[] buffer = new byte[10 * 1024];\n private int index;\n private InputStream input_stream;\n private int total;\n\n public Read() {\n input_stream = System.in;\n }\n\n public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }\n\n public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }\n\n public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }\n\n public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }\n\n public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }\n\n public List<Double> readDoubleList(int size) throws IOException {\n List<Double> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }\n\n public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }\n\n public List<String> readStringList(int size) throws IOException {\n List<String> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }\n\n public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }\n\n public List<Integer> readIntList(int size) throws IOException {\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }\n\n public List<Long> readLongList(int size) throws IOException {\n List<Long> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }\n\n public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }\n\n public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }\n }\n\n static class Write {\n\n private final BufferedWriter bw;\n\n public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }\n\n public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }\n\n public void close() throws IOException {\n bw.close();\n }\n\n public void flush() throws IOException {\n bw.flush();\n }\n }\n}",
"public class Main {\n\n private static final long MOD = (long) (1e9 + 7);\n\n private long power(long base, long exponent) {\n long res = 1;\n while (exponent > 0) {\n if ((base & 1) == 1) {\n res = (res * base) % MOD;\n exponent--;\n } else {\n res = (res * res) % MOD;\n exponent >>= 1;\n }\n }\n return res;\n }\n\n private long inverseMod(long number) {\n return power(number, MOD - 2);\n }\n\n private int gcd(int a, int b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n private long gcd(long a, long b) {\n if (b == 0) {\n return a;\n }\n return gcd(b, a % b);\n }\n\n public void solve(Read input, Write output) throws Exception {\n int N = input.readInt();\n int[] arr = input.readIntArray(N);\n long mincost = 0;\n for (int i=1;i<N;i++) {\n if (arr[i]<arr[i-1]) {\n mincost += (arr[i-1]-arr[i]);\n arr[i] = arr[i-1];\n }\n }\n output.printLine(mincost);\n }\n\n public static void main(String[] args) throws Exception {\n Read input = new Read();\n Write output = new Write();\n Main D = new Main();\n D.solve(input, output);\n output.flush();\n output.close();\n }\n\n // java fast io reader and writer\n // taken from various sources and customized\n\n static class Read {\n\n private byte[] buffer = new byte[10 * 1024];\n private int index;\n private InputStream input_stream;\n private int total;\n\n public Read() {\n input_stream = System.in;\n }\n\n public int read() throws IOException {\n if (total < 0)\n throw new InputMismatchException();\n if (index >= total) {\n index = 0;\n total = input_stream.read(buffer);\n if (total <= 0)\n return -1;\n }\n return buffer[index++];\n }\n\n public long readLong() throws IOException {\n long number = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n long neg = 1l;\n if (n == '-') {\n neg = -1l;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n number *= 10l;\n number += (long) (n - '0');\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * number;\n }\n\n public int readInt() throws IOException {\n int integer = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n integer *= 10;\n integer += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n return neg * integer;\n }\n\n public double readDouble() throws IOException {\n double doub = 0;\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n int neg = 1;\n if (n == '-') {\n neg = -1;\n n = read();\n }\n while (!isWhiteSpace(n) && n != '.') {\n if (n >= '0' && n <= '9') {\n doub *= 10;\n doub += n - '0';\n n = read();\n } else throw new InputMismatchException();\n }\n\n if (n == '.') {\n n = read();\n double temp = 1;\n while (!isWhiteSpace(n)) {\n if (n >= '0' && n <= '9') {\n temp /= 10;\n doub += (n - '0') * temp;\n n = read();\n } else throw new InputMismatchException();\n }\n }\n return doub * neg;\n }\n\n public String readString() throws IOException {\n StringBuilder sb = new StringBuilder();\n int n = read();\n while (isWhiteSpace(n))\n n = read();\n while (!isWhiteSpace(n)) {\n sb.append((char) n);\n n = read();\n }\n return sb.toString();\n }\n\n public List<Double> readDoubleList(int size) throws IOException {\n List<Double> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readDouble());\n }\n return res;\n }\n\n public double[] readDoubleArray(int size) throws IOException {\n double[] res = new double[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readDouble();\n }\n return res;\n }\n\n public List<String> readStringList(int size) throws IOException {\n List<String> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readString());\n }\n return res;\n }\n\n public String[] readStringArray(int size) throws IOException {\n String[] res = new String[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readString();\n }\n return res;\n }\n\n public List<Integer> readIntList(int size) throws IOException {\n List<Integer> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readInt());\n }\n return res;\n }\n\n public List<Long> readLongList(int size) throws IOException {\n List<Long> res = new ArrayList<>();\n for (int i = 0; i < size; i++) {\n res.add(this.readLong());\n }\n return res;\n }\n\n public int[] readIntArray(int size) throws IOException {\n int[] res = new int[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readInt();\n }\n return res;\n }\n\n public long[] readLongArray(int size) throws IOException {\n long[] res = new long[size];\n for (int i = 0; i < size; i++) {\n res[i] = this.readLong();\n }\n return res;\n }\n\n private boolean isWhiteSpace(int n) {\n if (n == ' ' || n == '\\n' || n == '\\r' || n == '\\t' || n == -1)\n return true;\n return false;\n }\n }\n\n static class Write {\n\n private final BufferedWriter bw;\n\n public Write() {\n bw = new BufferedWriter(new OutputStreamWriter(System.out));\n }\n\n public void print(Object str) throws IOException {\n bw.append(str + \"\");\n }\n\n public void printLine(Object str) throws IOException {\n print(str);\n bw.append(\"\\n\");\n }\n\n public void close() throws IOException {\n bw.close();\n }\n\n public void flush() throws IOException {\n bw.flush();\n }\n }\n}",
"Main"
]
|
/************************************************************************
AUTH : krishna-3249
DATE : 8/22/20
TIME : 6:41 PM
Everyone’s a whore, Grace. We just sell different parts of ourselves.
************************************************************************/
import java.lang.*;
import java.io.*;
import java.util.*;
public class Main {
private static final long MOD = (long) (1e9 + 7);
private long power(long base, long exponent) {
long res = 1;
while (exponent > 0) {
if ((base & 1) == 1) {
res = (res * base) % MOD;
exponent--;
} else {
res = (res * res) % MOD;
exponent >>= 1;
}
}
return res;
}
private long inverseMod(long number) {
return power(number, MOD - 2);
}
private int gcd(int a, int b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
private long gcd(long a, long b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
public void solve(Read input, Write output) throws Exception {
int N = input.readInt();
int[] arr = input.readIntArray(N);
long mincost = 0;
for (int i=1;i<N;i++) {
if (arr[i]<arr[i-1]) {
mincost += (arr[i-1]-arr[i]);
arr[i] = arr[i-1];
}
}
output.printLine(mincost);
}
public static void main(String[] args) throws Exception {
Read input = new Read();
Write output = new Write();
Main D = new Main();
D.solve(input, output);
output.flush();
output.close();
}
// java fast io reader and writer
// taken from various sources and customized
static class Read {
private byte[] buffer = new byte[10 * 1024];
private int index;
private InputStream input_stream;
private int total;
public Read() {
input_stream = System.in;
}
public int read() throws IOException {
if (total < 0)
throw new InputMismatchException();
if (index >= total) {
index = 0;
total = input_stream.read(buffer);
if (total <= 0)
return -1;
}
return buffer[index++];
}
public long readLong() throws IOException {
long number = 0;
int n = read();
while (isWhiteSpace(n))
n = read();
long neg = 1l;
if (n == '-') {
neg = -1l;
n = read();
}
while (!isWhiteSpace(n)) {
if (n >= '0' && n <= '9') {
number *= 10l;
number += (long) (n - '0');
n = read();
} else throw new InputMismatchException();
}
return neg * number;
}
public int readInt() throws IOException {
int integer = 0;
int n = read();
while (isWhiteSpace(n))
n = read();
int neg = 1;
if (n == '-') {
neg = -1;
n = read();
}
while (!isWhiteSpace(n)) {
if (n >= '0' && n <= '9') {
integer *= 10;
integer += n - '0';
n = read();
} else throw new InputMismatchException();
}
return neg * integer;
}
public double readDouble() throws IOException {
double doub = 0;
int n = read();
while (isWhiteSpace(n))
n = read();
int neg = 1;
if (n == '-') {
neg = -1;
n = read();
}
while (!isWhiteSpace(n) && n != '.') {
if (n >= '0' && n <= '9') {
doub *= 10;
doub += n - '0';
n = read();
} else throw new InputMismatchException();
}
if (n == '.') {
n = read();
double temp = 1;
while (!isWhiteSpace(n)) {
if (n >= '0' && n <= '9') {
temp /= 10;
doub += (n - '0') * temp;
n = read();
} else throw new InputMismatchException();
}
}
return doub * neg;
}
public String readString() throws IOException {
StringBuilder sb = new StringBuilder();
int n = read();
while (isWhiteSpace(n))
n = read();
while (!isWhiteSpace(n)) {
sb.append((char) n);
n = read();
}
return sb.toString();
}
public List<Double> readDoubleList(int size) throws IOException {
List<Double> res = new ArrayList<>();
for (int i = 0; i < size; i++) {
res.add(this.readDouble());
}
return res;
}
public double[] readDoubleArray(int size) throws IOException {
double[] res = new double[size];
for (int i = 0; i < size; i++) {
res[i] = this.readDouble();
}
return res;
}
public List<String> readStringList(int size) throws IOException {
List<String> res = new ArrayList<>();
for (int i = 0; i < size; i++) {
res.add(this.readString());
}
return res;
}
public String[] readStringArray(int size) throws IOException {
String[] res = new String[size];
for (int i = 0; i < size; i++) {
res[i] = this.readString();
}
return res;
}
public List<Integer> readIntList(int size) throws IOException {
List<Integer> res = new ArrayList<>();
for (int i = 0; i < size; i++) {
res.add(this.readInt());
}
return res;
}
public List<Long> readLongList(int size) throws IOException {
List<Long> res = new ArrayList<>();
for (int i = 0; i < size; i++) {
res.add(this.readLong());
}
return res;
}
public int[] readIntArray(int size) throws IOException {
int[] res = new int[size];
for (int i = 0; i < size; i++) {
res[i] = this.readInt();
}
return res;
}
public long[] readLongArray(int size) throws IOException {
long[] res = new long[size];
for (int i = 0; i < size; i++) {
res[i] = this.readLong();
}
return res;
}
private boolean isWhiteSpace(int n) {
if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
return true;
return false;
}
}
static class Write {
private final BufferedWriter bw;
public Write() {
bw = new BufferedWriter(new OutputStreamWriter(System.out));
}
public void print(Object str) throws IOException {
bw.append(str + "");
}
public void printLine(Object str) throws IOException {
print(str);
bw.append("\n");
}
public void close() throws IOException {
bw.close();
}
public void flush() throws IOException {
bw.flush();
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
14,
2,
13,
17,
9,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
89,
5
],
[
89,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
36,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
36,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
50,
56
],
[
56,
57
],
[
56,
58
],
[
49,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
62,
68
],
[
68,
69
],
[
68,
70
],
[
59,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
8,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
6,
86
],
[
86,
87
],
[
0,
88
],
[
88,
89
],
[
88,
90
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Long[] A = new Long[n];\n Long sum = 0L;\n for(int i=0;i<n;i++){\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(sum);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Long[] A = new Long[n];\n Long sum = 0L;\n for(int i=0;i<n;i++){\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(sum);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Long[] A = new Long[n];\n Long sum = 0L;\n for(int i=0;i<n;i++){\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Long[] A = new Long[n];\n Long sum = 0L;\n for(int i=0;i<n;i++){\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Long[] A = new Long[n];",
"A",
"new Long[n]",
"n",
"Long sum = 0L;",
"sum",
"0L",
"for(int i=0;i<n;i++){\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }",
"{\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }",
"A[i] = sc.nextLong()",
"A[i]",
"A",
"i",
"sc.nextLong()",
"sc.nextLong",
"sc",
"if(i==0)continue;",
"i==0",
"i",
"0",
"continue;",
"if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }",
"A[i-1]>A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"{\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }",
"sum += A[i-1] - A[i]",
"sum",
"A[i-1] - A[i]",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Long[] A = new Long[n];\n Long sum = 0L;\n for(int i=0;i<n;i++){\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(sum);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n Long[] A = new Long[n];\n Long sum = 0L;\n for(int i=0;i<n;i++){\n A[i] = sc.nextLong();\n if(i==0)continue;\n if(A[i-1]>A[i]){\n sum += A[i-1] - A[i];\n A[i] = A[i-1];\n }\n }\n System.out.println(sum);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Long[] A = new Long[n];
Long sum = 0L;
for(int i=0;i<n;i++){
A[i] = sc.nextLong();
if(i==0)continue;
if(A[i-1]>A[i]){
sum += A[i-1] - A[i];
A[i] = A[i-1];
}
}
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
68,
5
],
[
68,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
25,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
25,
35
],
[
35,
36
],
[
36,
37
],
[
25,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
39,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
45,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
6,
65
],
[
65,
66
],
[
0,
67
],
[
67,
68
],
[
67,
69
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 0;\n\t\tint san = sc.nextInt();\n\t\tfor(int i=0;i<n-1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 0;\n\t\tint san = sc.nextInt();\n\t\tfor(int i=0;i<n-1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 0;\n\t\tint san = sc.nextInt();\n\t\tfor(int i=0;i<n-1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 0;\n\t\tint san = sc.nextInt();\n\t\tfor(int i=0;i<n-1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans = 0;",
"ans",
"0",
"int san = sc.nextInt();",
"san",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<n-1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}",
"int a = sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}",
"san>=a",
"san",
"a",
"{\n\t\t\t\tans += san-a;\n\t\t\t}",
"ans += san-a",
"ans",
"san-a",
"san",
"a",
"{\n\t\t\t\tsan = a;\n\t\t\t}",
"san = a",
"san",
"a",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 0;\n\t\tint san = sc.nextInt();\n\t\tfor(int i=0;i<n-1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tlong ans = 0;\n\t\tint san = sc.nextInt();\n\t\tfor(int i=0;i<n-1;i++) {\n\t\t\tint a = sc.nextInt();\n\t\t\tif(san>=a) {\n\t\t\t\tans += san-a;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsan = a;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long ans = 0;
int san = sc.nextInt();
for(int i=0;i<n-1;i++) {
int a = sc.nextInt();
if(san>=a) {
ans += san-a;
}
else {
san = a;
}
}
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
91,
5
],
[
91,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
62,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
62,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
8,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
6,
88
],
[
88,
89
],
[
0,
90
],
[
90,
91
],
[
90,
92
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = input.nextLong();\n }\n\n long maxHeight = A[0];\n long ans = 0;\n\n for (int i = 1; i < N; i++) {\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }\n\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = input.nextLong();\n }\n\n long maxHeight = A[0];\n long ans = 0;\n\n for (int i = 1; i < N; i++) {\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = input.nextLong();\n }\n\n long maxHeight = A[0];\n long ans = 0;\n\n for (int i = 1; i < N; i++) {\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }\n\n System.out.println(ans);\n }",
"main",
"{\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = input.nextLong();\n }\n\n long maxHeight = A[0];\n long ans = 0;\n\n for (int i = 1; i < N; i++) {\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }\n\n System.out.println(ans);\n }",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int N = input.nextInt();",
"N",
"input.nextInt()",
"input.nextInt",
"input",
"long[] A = new long[N];",
"A",
"new long[N]",
"N",
"for (int i = 0; i < N; i++) {\n A[i] = input.nextLong();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = input.nextLong();\n }",
"{\n A[i] = input.nextLong();\n }",
"A[i] = input.nextLong()",
"A[i]",
"A",
"i",
"input.nextLong()",
"input.nextLong",
"input",
"long maxHeight = A[0];",
"maxHeight",
"A[0]",
"A",
"0",
"long ans = 0;",
"ans",
"0",
"for (int i = 1; i < N; i++) {\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }",
"{\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }",
"if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }",
"maxHeight > A[i]",
"maxHeight",
"A[i]",
"A",
"i",
"{\n ans += maxHeight - A[i];\n }",
"ans += maxHeight - A[i]",
"ans",
"maxHeight - A[i]",
"maxHeight",
"A[i]",
"A",
"i",
"{\n maxHeight = A[i];\n }",
"maxHeight = A[i]",
"maxHeight",
"A[i]",
"A",
"i",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = input.nextLong();\n }\n\n long maxHeight = A[0];\n long ans = 0;\n\n for (int i = 1; i < N; i++) {\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }\n\n System.out.println(ans);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner input = new Scanner(System.in);\n int N = input.nextInt();\n long[] A = new long[N];\n for (int i = 0; i < N; i++) {\n A[i] = input.nextLong();\n }\n\n long maxHeight = A[0];\n long ans = 0;\n\n for (int i = 1; i < N; i++) {\n if (maxHeight > A[i]) {\n ans += maxHeight - A[i];\n } else {\n maxHeight = A[i];\n }\n }\n\n System.out.println(ans);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int N = input.nextInt();
long[] A = new long[N];
for (int i = 0; i < N; i++) {
A[i] = input.nextLong();
}
long maxHeight = A[0];
long ans = 0;
for (int i = 1; i < N; i++) {
if (maxHeight > A[i]) {
ans += maxHeight - A[i];
} else {
maxHeight = A[i];
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
40,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
65,
5
],
[
65,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
36,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
49,
51
],
[
42,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
6,
62
],
[
62,
63
],
[
0,
64
],
[
64,
65
],
[
64,
66
]
]
| [
"//package com.company;\n\n\nimport java.util.Scanner;\n\npublic class Main{\n\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int prev=-1;\n long ans=0;//1000000*1000000*1000000;\n for(int i=0;i<N;++i){\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }\n System.out.println(ans);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int prev=-1;\n long ans=0;//1000000*1000000*1000000;\n for(int i=0;i<N;++i){\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }\n System.out.println(ans);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int prev=-1;\n long ans=0;//1000000*1000000*1000000;\n for(int i=0;i<N;++i){\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }\n System.out.println(ans);\n }",
"main",
"{\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int prev=-1;\n long ans=0;//1000000*1000000*1000000;\n for(int i=0;i<N;++i){\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }\n System.out.println(ans);\n }",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N=sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int prev=-1;",
"prev",
"-1",
"1",
"long ans=0;",
"ans",
"0",
"for(int i=0;i<N;++i){\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"++i",
"++i",
"i",
"{\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }",
"{\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }",
"int a=sc.nextInt();",
"a",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }",
"prev>a",
"prev",
"a",
"{\n ans+=prev-a;\n }",
"ans+=prev-a",
"ans",
"prev-a",
"prev",
"a",
"{\n prev=a;\n }",
"prev=a",
"prev",
"a",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int prev=-1;\n long ans=0;//1000000*1000000*1000000;\n for(int i=0;i<N;++i){\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }\n System.out.println(ans);\n }\n}",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc=new Scanner(System.in);\n int N=sc.nextInt();\n int prev=-1;\n long ans=0;//1000000*1000000*1000000;\n for(int i=0;i<N;++i){\n int a=sc.nextInt();\n if(prev>a){\n ans+=prev-a;\n }else{\n prev=a;\n }\n }\n System.out.println(ans);\n }\n}",
"Main"
]
| //package com.company;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int prev=-1;
long ans=0;//1000000*1000000*1000000;
for(int i=0;i<N;++i){
int a=sc.nextInt();
if(prev>a){
ans+=prev-a;
}else{
prev=a;
}
}
System.out.println(ans);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
2,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
2,
18,
13,
2,
13,
17,
2,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
113,
5
],
[
113,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
69,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
83,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
6,
110
],
[
110,
111
],
[
0,
112
],
[
112,
113
],
[
112,
114
]
]
| [
"import java.util.Scanner;\npublic class Main\n{\n public static void main(String[] args)\n {\n long sl=0;\n Scanner sc=new Scanner(System.in);\n int n= sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=sc.nextInt();\n }\n for(int j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }\n \n System.out.println(sl);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n public static void main(String[] args)\n {\n long sl=0;\n Scanner sc=new Scanner(System.in);\n int n= sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=sc.nextInt();\n }\n for(int j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }\n \n System.out.println(sl);\n }\n}",
"Main",
"public static void main(String[] args)\n {\n long sl=0;\n Scanner sc=new Scanner(System.in);\n int n= sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=sc.nextInt();\n }\n for(int j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }\n \n System.out.println(sl);\n }",
"main",
"{\n long sl=0;\n Scanner sc=new Scanner(System.in);\n int n= sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=sc.nextInt();\n }\n for(int j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }\n \n System.out.println(sl);\n }",
"long sl=0;",
"sl",
"0",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n= sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int a[]=new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0;i<n;i++)\n {\n a[i]=sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]=sc.nextInt();\n }",
"{\n a[i]=sc.nextInt();\n }",
"a[i]=sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n-1",
"j",
"n-1",
"n",
"1",
"j++",
"j++",
"j",
"{\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }",
"{\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }",
"if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }",
"a[j]>=a[j+1]",
"a[j]",
"a",
"j",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"{\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }",
"sl=sl+(a[j]-a[j+1])",
"sl",
"sl+(a[j]-a[j+1])",
"sl",
"(a[j]-a[j+1])",
"a[j]",
"a",
"j",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"a[j+1]=a[j+1]+(a[j]-a[j+1])",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"a[j+1]+(a[j]-a[j+1])",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"(a[j]-a[j+1])",
"a[j]",
"a",
"j",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"System.out.println(sl)",
"System.out.println",
"System.out",
"System",
"System.out",
"sl",
"String[] args",
"args",
"public class Main\n{\n public static void main(String[] args)\n {\n long sl=0;\n Scanner sc=new Scanner(System.in);\n int n= sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=sc.nextInt();\n }\n for(int j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }\n \n System.out.println(sl);\n }\n}",
"public class Main\n{\n public static void main(String[] args)\n {\n long sl=0;\n Scanner sc=new Scanner(System.in);\n int n= sc.nextInt();\n int a[]=new int[n];\n for(int i=0;i<n;i++)\n {\n a[i]=sc.nextInt();\n }\n for(int j=0;j<n-1;j++)\n {\n if(a[j]>=a[j+1])\n {\n sl=sl+(a[j]-a[j+1]);\n a[j+1]=a[j+1]+(a[j]-a[j+1]);\n }\n \n }\n \n System.out.println(sl);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
long sl=0;
Scanner sc=new Scanner(System.in);
int n= sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
{
a[i]=sc.nextInt();
}
for(int j=0;j<n-1;j++)
{
if(a[j]>=a[j+1])
{
sl=sl+(a[j]-a[j+1]);
a[j+1]=a[j+1]+(a[j]-a[j+1]);
}
}
System.out.println(sl);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
13,
30,
0,
13,
2,
13,
18,
13,
13,
0,
13,
4,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
118,
11
],
[
118,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
20,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
30,
35
],
[
14,
36
],
[
36,
37
],
[
36,
38
],
[
14,
40
],
[
40,
41
],
[
40,
42
],
[
14,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
43,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
14,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
14,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
73,
81
],
[
81,
82
],
[
82,
83
],
[
73,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
85,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
14,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
12,
115
],
[
115,
116
],
[
0,
117
],
[
117,
118
],
[
117,
119
]
]
| [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\n public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine().trim());\n String[] s=br.readLine().split(\" \");\n long[] a=new long[n];\n long res=0;\n for(int i=0;i<n;i++){\n a[i]=Long.parseLong(s[i].trim());\n }\n\n long last=a[0];\n for(int i=1;i<n;i++){\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }\n System.out.println(res);\n\n\n\n\n\n }\n\n\n\n\n\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\n public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine().trim());\n String[] s=br.readLine().split(\" \");\n long[] a=new long[n];\n long res=0;\n for(int i=0;i<n;i++){\n a[i]=Long.parseLong(s[i].trim());\n }\n\n long last=a[0];\n for(int i=1;i<n;i++){\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }\n System.out.println(res);\n\n\n\n\n\n }\n\n\n\n\n\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine().trim());\n String[] s=br.readLine().split(\" \");\n long[] a=new long[n];\n long res=0;\n for(int i=0;i<n;i++){\n a[i]=Long.parseLong(s[i].trim());\n }\n\n long last=a[0];\n for(int i=1;i<n;i++){\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }\n System.out.println(res);\n\n\n\n\n\n }",
"main",
"{\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine().trim());\n String[] s=br.readLine().split(\" \");\n long[] a=new long[n];\n long res=0;\n for(int i=0;i<n;i++){\n a[i]=Long.parseLong(s[i].trim());\n }\n\n long last=a[0];\n for(int i=1;i<n;i++){\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }\n System.out.println(res);\n\n\n\n\n\n }",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n=Integer.parseInt(br.readLine().trim());",
"n",
"Integer.parseInt(br.readLine().trim())",
"Integer.parseInt",
"Integer",
"br.readLine().trim()",
"br.readLine().trim",
"br.readLine()",
"br.readLine",
"br",
"String[] s=br.readLine().split(\" \");",
"s",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"long[] a=new long[n];",
"a",
"new long[n]",
"n",
"long res=0;",
"res",
"0",
"for(int i=0;i<n;i++){\n a[i]=Long.parseLong(s[i].trim());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i]=Long.parseLong(s[i].trim());\n }",
"{\n a[i]=Long.parseLong(s[i].trim());\n }",
"a[i]=Long.parseLong(s[i].trim())",
"a[i]",
"a",
"i",
"Long.parseLong(s[i].trim())",
"Long.parseLong",
"Long",
"s[i].trim()",
"s[i].trim",
"s[i]",
"s",
"i",
"long last=a[0];",
"last",
"a[0]",
"a",
"0",
"for(int i=1;i<n;i++){\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }",
"{\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }",
"if(a[i]<last){\n res+=(last-a[i]);\n }",
"a[i]<last",
"a[i]",
"a",
"i",
"last",
"{\n res+=(last-a[i]);\n }",
"res+=(last-a[i])",
"res",
"(last-a[i])",
"last",
"a[i]",
"a",
"i",
"last=Math.max(last,a[i])",
"last",
"Math.max(last,a[i])",
"Math.max",
"Math",
"last",
"a[i]",
"a",
"i",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n\n\n public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine().trim());\n String[] s=br.readLine().split(\" \");\n long[] a=new long[n];\n long res=0;\n for(int i=0;i<n;i++){\n a[i]=Long.parseLong(s[i].trim());\n }\n\n long last=a[0];\n for(int i=1;i<n;i++){\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }\n System.out.println(res);\n\n\n\n\n\n }\n\n\n\n\n\n\n}",
"public class Main {\n\n\n public static void main(String[] args) throws IOException {\n BufferedReader br=new BufferedReader(new InputStreamReader(System.in));\n int n=Integer.parseInt(br.readLine().trim());\n String[] s=br.readLine().split(\" \");\n long[] a=new long[n];\n long res=0;\n for(int i=0;i<n;i++){\n a[i]=Long.parseLong(s[i].trim());\n }\n\n long last=a[0];\n for(int i=1;i<n;i++){\n if(a[i]<last){\n res+=(last-a[i]);\n }\n last=Math.max(last,a[i]);\n }\n System.out.println(res);\n\n\n\n\n\n }\n\n\n\n\n\n\n}",
"Main"
]
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine().trim());
String[] s=br.readLine().split(" ");
long[] a=new long[n];
long res=0;
for(int i=0;i<n;i++){
a[i]=Long.parseLong(s[i].trim());
}
long last=a[0];
for(int i=1;i<n;i++){
if(a[i]<last){
res+=(last-a[i]);
}
last=Math.max(last,a[i]);
}
System.out.println(res);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
40,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
40,
17,
30,
0,
13,
4,
18,
13,
30,
41,
13,
4,
18,
13,
14,
2,
13,
13,
30,
0,
13,
2,
13,
13,
0,
13,
4,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
82,
5
],
[
82,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
10,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
10,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
39,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
39,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
50,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
50,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
68,
72
],
[
10,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
6,
79
],
[
79,
80
],
[
0,
81
],
[
81,
82
],
[
81,
83
]
]
| [
"//package atcoder.beginnercontest.r176;\n\nimport java.util.Scanner;\n\n/**\n * @author pribic (Priyank Doshi)\n * @since 29/08/20\n */\npublic class Main {\n\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }\n }",
"main",
"{\n try (Scanner sc = new Scanner(System.in)) {\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }",
"{\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"long ans = 0;",
"ans",
"0",
"int lastVal = -1;",
"lastVal",
"-1",
"1",
"for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }",
"{\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }",
"if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }",
"lastVal == -1",
"lastVal",
"-1",
"1",
"{\n lastVal = sc.nextInt();\n }",
"lastVal = sc.nextInt()",
"lastVal",
"sc.nextInt()",
"sc.nextInt",
"sc",
"{\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }",
"int curVal = sc.nextInt();",
"curVal",
"sc.nextInt()",
"sc.nextInt",
"sc",
"if(curVal < lastVal) {\n ans += lastVal - curVal;\n }",
"curVal < lastVal",
"curVal",
"lastVal",
"{\n ans += lastVal - curVal;\n }",
"ans += lastVal - curVal",
"ans",
"lastVal - curVal",
"lastVal",
"curVal",
"lastVal = Math.max(lastVal, curVal)",
"lastVal",
"Math.max(lastVal, curVal)",
"Math.max",
"Math",
"lastVal",
"curVal",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n try (Scanner sc = new Scanner(System.in)) {\n int n = sc.nextInt();\n long ans = 0;\n int lastVal = -1;\n for(int i = 0; i < n; i++) {\n if(lastVal == -1) {\n lastVal = sc.nextInt();\n } else {\n int curVal = sc.nextInt();\n if(curVal < lastVal) {\n ans += lastVal - curVal;\n }\n lastVal = Math.max(lastVal, curVal);\n }\n }\n \n System.out.println(ans);\n }\n }\n}",
"Main"
]
| //package atcoder.beginnercontest.r176;
import java.util.Scanner;
/**
* @author pribic (Priyank Doshi)
* @since 29/08/20
*/
public class Main {
public static void main(String[] args) {
try (Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
long ans = 0;
int lastVal = -1;
for(int i = 0; i < n; i++) {
if(lastVal == -1) {
lastVal = sc.nextInt();
} else {
int curVal = sc.nextInt();
if(curVal < lastVal) {
ans += lastVal - curVal;
}
lastVal = Math.max(lastVal, curVal);
}
}
System.out.println(ans);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
2,
18,
13,
2,
13,
17,
18,
13,
13,
0,
13,
13,
0,
18,
13,
13,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
114,
5
],
[
114,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
12,
17
],
[
17,
18
],
[
17,
19
],
[
12,
20
],
[
20,
21
],
[
21,
22
],
[
12,
23
],
[
24,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
26,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
25,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
41,
43
],
[
38,
44
],
[
44,
45
],
[
44,
46
],
[
35,
47
],
[
47,
48
],
[
47,
49
],
[
35,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
8,
55
],
[
55,
56
],
[
6,
57
],
[
57,
58
],
[
6,
59
],
[
59,
60
],
[
114,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
63,
72
],
[
72,
73
],
[
72,
74
],
[
63,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
63,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
98,
101
],
[
63,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
102,
107
],
[
63,
108
],
[
108,
109
],
[
109,
110
],
[
61,
111
],
[
111,
112
],
[
0,
113
],
[
113,
114
],
[
113,
115
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tstatic long solve(int n, int[] a) {\n\t\tlong sum = 0;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}\n\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}\n\t\tlong result = solve(n, a);\n\t\tSystem.out.println(result);\n\n\t\tstdIn.close();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tstatic long solve(int n, int[] a) {\n\t\tlong sum = 0;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}\n\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}\n\t\tlong result = solve(n, a);\n\t\tSystem.out.println(result);\n\n\t\tstdIn.close();\n\t}\n}",
"Main",
"static long solve(int n, int[] a) {\n\t\tlong sum = 0;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}\n\n\t\treturn sum;\n\t}",
"solve",
"{\n\t\tlong sum = 0;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}\n\n\t\treturn sum;\n\t}",
"long sum = 0;",
"sum",
"0",
"for (int i = 1; i < n; i++) {\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}",
"if (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}",
"a[i] < a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"{\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}",
"int num = a[i - 1] - a[i];",
"num",
"a[i - 1] - a[i]",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"sum += num",
"sum",
"num",
"a[i] += num",
"a[i]",
"a",
"i",
"num",
"return sum;",
"sum",
"int n",
"n",
"int[] a",
"a",
"public static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}\n\t\tlong result = solve(n, a);\n\t\tSystem.out.println(result);\n\n\t\tstdIn.close();\n\t}",
"main",
"{\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}\n\t\tlong result = solve(n, a);\n\t\tSystem.out.println(result);\n\n\t\tstdIn.close();\n\t}",
"Scanner stdIn = new Scanner(System.in);",
"stdIn",
"new Scanner(System.in)",
"int n = stdIn.nextInt();",
"n",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}",
"a[i] = stdIn.nextInt()",
"a[i]",
"a",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"long result = solve(n, a);",
"result",
"solve(n, a)",
"solve",
"n",
"a",
"System.out.println(result)",
"System.out.println",
"System.out",
"System",
"System.out",
"result",
"stdIn.close()",
"stdIn.close",
"stdIn",
"String[] args",
"args",
"public class Main {\n\n\tstatic long solve(int n, int[] a) {\n\t\tlong sum = 0;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}\n\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}\n\t\tlong result = solve(n, a);\n\t\tSystem.out.println(result);\n\n\t\tstdIn.close();\n\t}\n}",
"public class Main {\n\n\tstatic long solve(int n, int[] a) {\n\t\tlong sum = 0;\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\tint num = a[i - 1] - a[i];\n\t\t\t\tsum += num;\n\t\t\t\ta[i] += num;\n\t\t\t}\n\t\t}\n\n\t\treturn sum;\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint n = stdIn.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = stdIn.nextInt();\n\t\t}\n\t\tlong result = solve(n, a);\n\t\tSystem.out.println(result);\n\n\t\tstdIn.close();\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
static long solve(int n, int[] a) {
long sum = 0;
for (int i = 1; i < n; i++) {
if (a[i] < a[i - 1]) {
int num = a[i - 1] - a[i];
sum += num;
a[i] += num;
}
}
return sum;
}
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = stdIn.nextInt();
}
long result = solve(n, a);
System.out.println(result);
stdIn.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
0,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
17,
0,
18,
13,
13,
17,
0,
18,
13,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
17,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
4,
18,
13,
18,
13,
17,
4,
18,
13,
18,
13,
17,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
20,
41,
13,
20,
12,
13,
30,
42,
40,
4,
18,
13,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
253,
11
],
[
253,
12
],
[
12,
13
],
[
12,
14
],
[
253,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
17,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
17,
25
],
[
25,
26
],
[
25,
27
],
[
17,
28
],
[
28,
29
],
[
28,
30
],
[
17,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
44,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
46,
51
],
[
45,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
45,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
17,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
69
],
[
62,
70
],
[
70,
71
],
[
71,
72
],
[
62,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
75,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
17,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
104,
106
],
[
17,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
15,
113
],
[
113,
114
],
[
253,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
115,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
126,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
131,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
125,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
115,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
152,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
148,
165
],
[
165,
166
],
[
115,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
171,
174
],
[
174,
175
],
[
115,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
178,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
183,
188
],
[
188,
189
],
[
188,
190
],
[
183,
191
],
[
191,
192
],
[
192,
193
],
[
183,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
195,
199
],
[
199,
200
],
[
178,
201
],
[
201,
202
],
[
176,
203
],
[
203,
204
],
[
115,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
209,
212
],
[
212,
213
],
[
115,
214
],
[
214,
215
],
[
214,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
216,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
221,
226
],
[
226,
227
],
[
226,
228
],
[
221,
229
],
[
229,
230
],
[
230,
231
],
[
221,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
216,
239
],
[
239,
240
],
[
214,
241
],
[
241,
242
],
[
115,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
248,
249
],
[
247,
250
],
[
250,
251
],
[
0,
252
],
[
252,
253
],
[
252,
254
]
]
| [
"import java.io.*;\nimport java.util.*;\nimport java.math.*;\n\n/*\n\tAuthor:\tKoushik Sahu\n\tDate: 28-Aug-2020 10:17:59 pm\n*/\n\npublic class Main {\n\n\tstatic FastScanner fs = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tString s;\n\t\ts = fs.next();\n\t\tint ans = 0;\n\t\tint[] arr = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}\n\t\tfor(int i=1; i<3; i++) {\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}\n\t\tans = Math.max(arr[0], Math.max(arr[1], arr[2]));\n\t\tSystem.out.println(ans);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tpublic String next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic int[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic long[] readLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main {\n\n\tstatic FastScanner fs = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tString s;\n\t\ts = fs.next();\n\t\tint ans = 0;\n\t\tint[] arr = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}\n\t\tfor(int i=1; i<3; i++) {\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}\n\t\tans = Math.max(arr[0], Math.max(arr[1], arr[2]));\n\t\tSystem.out.println(ans);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tpublic String next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic int[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic long[] readLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n\n}",
"Main",
"static FastScanner fs = new FastScanner();",
"fs",
"new FastScanner()",
"public static void main(String[] args) {\n\t\tString s;\n\t\ts = fs.next();\n\t\tint ans = 0;\n\t\tint[] arr = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}\n\t\tfor(int i=1; i<3; i++) {\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}\n\t\tans = Math.max(arr[0], Math.max(arr[1], arr[2]));\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tString s;\n\t\ts = fs.next();\n\t\tint ans = 0;\n\t\tint[] arr = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}\n\t\tfor(int i=1; i<3; i++) {\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}\n\t\tans = Math.max(arr[0], Math.max(arr[1], arr[2]));\n\t\tSystem.out.println(ans);\n\t}",
"String s;",
"s",
"s = fs.next()",
"s",
"fs.next()",
"fs.next",
"fs",
"int ans = 0;",
"ans",
"0",
"int[] arr = new int[3];",
"arr",
"new int[3]",
"3",
"for(int i=0; i<3; i++) {\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<3",
"i",
"3",
"i++",
"i++",
"i",
"{\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}",
"{\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}",
"if(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;",
"s.charAt(i)=='R'",
"s.charAt(i)",
"s.charAt",
"s",
"i",
"'R'",
"arr[i] = 1",
"arr[i]",
"arr",
"i",
"1",
"arr[i] = 0",
"arr[i]",
"arr",
"i",
"0",
"for(int i=1; i<3; i++) {\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<3",
"i",
"3",
"i++",
"i++",
"i",
"{\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}",
"{\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}",
"if(arr[i]==1) arr[i] += arr[i-1];",
"arr[i]==1",
"arr[i]",
"arr",
"i",
"1",
"arr[i] += arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"ans = Math.max(arr[0], Math.max(arr[1], arr[2]))",
"ans",
"Math.max(arr[0], Math.max(arr[1], arr[2]))",
"Math.max",
"Math",
"arr[0]",
"arr",
"0",
"Math.max(arr[1], arr[2])",
"Math.max",
"Math",
"arr[1]",
"arr",
"1",
"arr[2]",
"arr",
"2",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tpublic String next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic int[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic long[] readLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}",
"FastScanner",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringTokenizer st = new StringTokenizer(\"\");",
"st",
"new StringTokenizer(\"\")",
"public String next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}",
"next",
"{\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}",
"while (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"try {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"IOException e",
"{\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t}",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public String nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}",
"nextLine",
"{\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}",
"String str = \"\";",
"str",
"\"\"",
"try {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"IOException e",
"{\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\tstr = br.readLine();\n\t\t\t}",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"return str;",
"str",
"public int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"nextInt",
"{\n\t\t\treturn Integer.parseInt(next());\n\t\t}",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public int[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"readArray",
"{\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextInt();",
"a[i] = nextInt()",
"a[i]",
"a",
"i",
"nextInt()",
"nextInt",
"return a;",
"a",
"int n",
"n",
"public long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"nextLong",
"{\n\t\t\treturn Long.parseLong(next());\n\t\t}",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public long[] readLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"readLongArray",
"{\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}",
"long[] a = new long[n];",
"a",
"new long[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = nextLong();",
"a[i] = nextLong()",
"a[i]",
"a",
"i",
"nextLong()",
"nextLong",
"return a;",
"a",
"int n",
"n",
"double nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"nextDouble",
"{\n\t\t\treturn Double.parseDouble(next());\n\t\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\n\tstatic FastScanner fs = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tString s;\n\t\ts = fs.next();\n\t\tint ans = 0;\n\t\tint[] arr = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}\n\t\tfor(int i=1; i<3; i++) {\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}\n\t\tans = Math.max(arr[0], Math.max(arr[1], arr[2]));\n\t\tSystem.out.println(ans);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tpublic String next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic int[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic long[] readLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n\n}",
"public class Main {\n\n\tstatic FastScanner fs = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tString s;\n\t\ts = fs.next();\n\t\tint ans = 0;\n\t\tint[] arr = new int[3];\n\t\tfor(int i=0; i<3; i++) {\n\t\t\tif(s.charAt(i)=='R') arr[i] = 1;\n\t\t\telse arr[i] = 0;\n\t\t}\n\t\tfor(int i=1; i<3; i++) {\n\t\t\tif(arr[i]==1) arr[i] += arr[i-1];\n\t\t}\n\t\tans = Math.max(arr[0], Math.max(arr[1], arr[2]));\n\t\tSystem.out.println(ans);\n\t}\n\n\tstatic class FastScanner {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tStringTokenizer st = new StringTokenizer(\"\");\n\n\t\tpublic String next() {\n\t\t\twhile (!st.hasMoreTokens())\n\t\t\t\ttry {\n\t\t\t\t\tst = new StringTokenizer(br.readLine());\n\t\t\t\t} catch (IOException e) {\n\t\t\t\t\te.printStackTrace();\n\t\t\t\t}\n\t\t\treturn st.nextToken();\n\t\t}\n\n\t\tpublic String nextLine() {\n\t\t\tString str = \"\";\n\t\t\ttry {\n\t\t\t\tstr = br.readLine();\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\treturn str;\n\t\t}\n\n\t\tpublic int nextInt() {\n\t\t\treturn Integer.parseInt(next());\n\t\t}\n\n\t\tpublic int[] readArray(int n) {\n\t\t\tint[] a = new int[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextInt();\n\t\t\treturn a;\n\t\t}\n\n\t\tpublic long nextLong() {\n\t\t\treturn Long.parseLong(next());\n\t\t}\n\n\t\tpublic long[] readLongArray(int n) {\n\t\t\tlong[] a = new long[n];\n\t\t\tfor (int i = 0; i < n; i++)\n\t\t\t\ta[i] = nextLong();\n\t\t\treturn a;\n\t\t}\n\n\t\tdouble nextDouble() {\n\t\t\treturn Double.parseDouble(next());\n\t\t}\n\t}\n\n}",
"Main"
]
| import java.io.*;
import java.util.*;
import java.math.*;
/*
Author: Koushik Sahu
Date: 28-Aug-2020 10:17:59 pm
*/
public class Main {
static FastScanner fs = new FastScanner();
public static void main(String[] args) {
String s;
s = fs.next();
int ans = 0;
int[] arr = new int[3];
for(int i=0; i<3; i++) {
if(s.charAt(i)=='R') arr[i] = 1;
else arr[i] = 0;
}
for(int i=1; i<3; i++) {
if(arr[i]==1) arr[i] += arr[i-1];
}
ans = Math.max(arr[0], Math.max(arr[1], arr[2]));
System.out.println(ans);
}
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
public String next() {
while (!st.hasMoreTokens())
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return st.nextToken();
}
public String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
public int nextInt() {
return Integer.parseInt(next());
}
public int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
public long nextLong() {
return Long.parseLong(next());
}
public long[] readLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
double nextDouble() {
return Double.parseDouble(next());
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
4,
18,
13,
17,
30,
40,
13,
30,
14,
2,
13,
13,
30,
0,
13,
13,
0,
13,
17,
14,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
68,
5
],
[
68,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
14,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
26,
29
],
[
30,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
31,
36
],
[
36,
37
],
[
37,
38
],
[
31,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
39,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
6,
65
],
[
65,
66
],
[
0,
67
],
[
67,
68
],
[
67,
69
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] arr = sc.nextLine().split(\"\");\n\n\t\tint count = 0;\n\t\tint max = 0;\n\t\tfor(String str : arr){\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}\n\n\n\t\tif(count > max){\n\t\t\tmax = count;\n\t\t}\n\n\t\tSystem.out.println(max);\n\n\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] arr = sc.nextLine().split(\"\");\n\n\t\tint count = 0;\n\t\tint max = 0;\n\t\tfor(String str : arr){\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}\n\n\n\t\tif(count > max){\n\t\t\tmax = count;\n\t\t}\n\n\t\tSystem.out.println(max);\n\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] arr = sc.nextLine().split(\"\");\n\n\t\tint count = 0;\n\t\tint max = 0;\n\t\tfor(String str : arr){\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}\n\n\n\t\tif(count > max){\n\t\t\tmax = count;\n\t\t}\n\n\t\tSystem.out.println(max);\n\n\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] arr = sc.nextLine().split(\"\");\n\n\t\tint count = 0;\n\t\tint max = 0;\n\t\tfor(String str : arr){\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}\n\n\n\t\tif(count > max){\n\t\t\tmax = count;\n\t\t}\n\n\t\tSystem.out.println(max);\n\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String[] arr = sc.nextLine().split(\"\");",
"arr",
"sc.nextLine().split(\"\")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\"\"",
"int count = 0;",
"count",
"0",
"int max = 0;",
"max",
"0",
"for(String str : arr){\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}",
"String str",
"arr",
"{\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}",
"{\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}",
"if(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}",
"str.equals(\"R\")",
"str.equals",
"str",
"\"R\"",
"{\n\t\t\t\tcount++;\n\t\t\t}",
"count++",
"count",
"{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}",
"if(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}",
"count > max",
"count",
"max",
"{\n\t\t\t\t\tmax = count;\n\t\t\t\t}",
"max = count",
"max",
"count",
"count=0",
"count",
"0",
"if(count > max){\n\t\t\tmax = count;\n\t\t}",
"count > max",
"count",
"max",
"{\n\t\t\tmax = count;\n\t\t}",
"max = count",
"max",
"count",
"System.out.println(max)",
"System.out.println",
"System.out",
"System",
"System.out",
"max",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] arr = sc.nextLine().split(\"\");\n\n\t\tint count = 0;\n\t\tint max = 0;\n\t\tfor(String str : arr){\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}\n\n\n\t\tif(count > max){\n\t\t\tmax = count;\n\t\t}\n\n\t\tSystem.out.println(max);\n\n\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString[] arr = sc.nextLine().split(\"\");\n\n\t\tint count = 0;\n\t\tint max = 0;\n\t\tfor(String str : arr){\n\n\t\t\tif(str.equals(\"R\")){\n\t\t\t\tcount++;\n\t\t\t}else{\n\t\t\t\tif(count > max){\n\t\t\t\t\tmax = count;\n\t\t\t\t}\n\t\t\t\tcount=0;\n\t\t\t}\n\t\t}\n\n\n\t\tif(count > max){\n\t\t\tmax = count;\n\t\t}\n\n\t\tSystem.out.println(max);\n\n\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] arr = sc.nextLine().split("");
int count = 0;
int max = 0;
for(String str : arr){
if(str.equals("R")){
count++;
}else{
if(count > max){
max = count;
}
count=0;
}
}
if(count > max){
max = count;
}
System.out.println(max);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
3,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
59,
5
],
[
59,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
20,
30
],
[
30,
31
],
[
31,
32
],
[
20,
33
],
[
34,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
36,
41
],
[
35,
42
],
[
42,
43
],
[
42,
44
],
[
35,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
6,
56
],
[
56,
57
],
[
0,
58
],
[
58,
59
],
[
58,
60
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t Scanner s = new Scanner(System.in);\n\t String st = s.nextLine();\n\t \n\t int cnt = 0;\n\t \n\t for(int i = 0; i < st.length(); i++){\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t } \n\t \n\t System.out.println(cnt);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t Scanner s = new Scanner(System.in);\n\t String st = s.nextLine();\n\t \n\t int cnt = 0;\n\t \n\t for(int i = 0; i < st.length(); i++){\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t } \n\t \n\t System.out.println(cnt);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t Scanner s = new Scanner(System.in);\n\t String st = s.nextLine();\n\t \n\t int cnt = 0;\n\t \n\t for(int i = 0; i < st.length(); i++){\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t } \n\t \n\t System.out.println(cnt);\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\t\n\t Scanner s = new Scanner(System.in);\n\t String st = s.nextLine();\n\t \n\t int cnt = 0;\n\t \n\t for(int i = 0; i < st.length(); i++){\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t } \n\t \n\t System.out.println(cnt);\n\t}",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"String st = s.nextLine();",
"st",
"s.nextLine()",
"s.nextLine",
"s",
"int cnt = 0;",
"cnt",
"0",
"for(int i = 0; i < st.length(); i++){\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < st.length()",
"i",
"st.length()",
"st.length",
"st",
"i++",
"i++",
"i",
"{\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t }",
"{\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t }",
"if(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;",
"st.charAt(i) == 'R'",
"st.charAt(i)",
"st.charAt",
"st",
"i",
"'R'",
"cnt += 1",
"cnt",
"1",
"if(cnt != 0)\n\t break;",
"cnt != 0",
"cnt",
"0",
"break;",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t Scanner s = new Scanner(System.in);\n\t String st = s.nextLine();\n\t \n\t int cnt = 0;\n\t \n\t for(int i = 0; i < st.length(); i++){\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t } \n\t \n\t System.out.println(cnt);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t Scanner s = new Scanner(System.in);\n\t String st = s.nextLine();\n\t \n\t int cnt = 0;\n\t \n\t for(int i = 0; i < st.length(); i++){\n\t \t\n\t \tif(st.charAt(i) == 'R')\n\t cnt += 1;\n\t \telse\n\t if(cnt != 0)\n\t break;\n\t \n\t } \n\t \n\t System.out.println(cnt);\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
String st = s.nextLine();
int cnt = 0;
for(int i = 0; i < st.length(); i++){
if(st.charAt(i) == 'R')
cnt += 1;
else
if(cnt != 0)
break;
}
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
17,
2,
4,
18,
13,
13,
13,
30,
0,
13,
17,
14,
2,
4,
18,
13,
13,
13,
30,
14,
2,
2,
13,
17,
2,
4,
18,
13,
2,
13,
17,
13,
30,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
86,
5
],
[
86,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
23,
33
],
[
33,
34
],
[
34,
35
],
[
23,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
43,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
37,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
54,
59
],
[
53,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
61,
74
],
[
74,
75
],
[
75,
76
],
[
8,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
6,
83
],
[
83,
84
],
[
0,
85
],
[
85,
86
],
[
85,
87
]
]
| [
"import java.util.*;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\t// 文字列の入力\n\t\tScanner sc = new Scanner(System.in);\n String someString = sc.next();\n\t\tchar rChar = 'R';\n int rCount = 0;\n \n\t\tfor (int i = 0; i < someString.length(); i++) {\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }\n \n System.out.println(rCount);\n \n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t// 文字列の入力\n\t\tScanner sc = new Scanner(System.in);\n String someString = sc.next();\n\t\tchar rChar = 'R';\n int rCount = 0;\n \n\t\tfor (int i = 0; i < someString.length(); i++) {\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }\n \n System.out.println(rCount);\n \n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\t// 文字列の入力\n\t\tScanner sc = new Scanner(System.in);\n String someString = sc.next();\n\t\tchar rChar = 'R';\n int rCount = 0;\n \n\t\tfor (int i = 0; i < someString.length(); i++) {\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }\n \n System.out.println(rCount);\n \n\t}",
"main",
"{\n\t\t// 文字列の入力\n\t\tScanner sc = new Scanner(System.in);\n String someString = sc.next();\n\t\tchar rChar = 'R';\n int rCount = 0;\n \n\t\tfor (int i = 0; i < someString.length(); i++) {\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }\n \n System.out.println(rCount);\n \n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String someString = sc.next();",
"someString",
"sc.next()",
"sc.next",
"sc",
"char rChar = 'R';",
"rChar",
"'R'",
"int rCount = 0;",
"rCount",
"0",
"for (int i = 0; i < someString.length(); i++) {\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < someString.length()",
"i",
"someString.length()",
"someString.length",
"someString",
"i++",
"i++",
"i",
"{\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }",
"{\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }",
"if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }",
"rCount==0 && someString.charAt(i) == rChar",
"rCount==0",
"rCount",
"0",
"someString.charAt(i) == rChar",
"someString.charAt(i)",
"someString.charAt",
"someString",
"i",
"rChar",
"{\n rCount = 1;\n }",
"rCount = 1",
"rCount",
"1",
"if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n }",
"someString.charAt(i) == rChar",
"someString.charAt(i)",
"someString.charAt",
"someString",
"i",
"rChar",
"{\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n }",
"if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }",
"i>0 && someString.charAt(i-1) == rChar",
"i>0",
"i",
"0",
"someString.charAt(i-1) == rChar",
"someString.charAt(i-1)",
"someString.charAt",
"someString",
"i-1",
"i",
"1",
"rChar",
"{\n rCount++;\n }",
"rCount++",
"rCount",
"System.out.println(rCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"rCount",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t// 文字列の入力\n\t\tScanner sc = new Scanner(System.in);\n String someString = sc.next();\n\t\tchar rChar = 'R';\n int rCount = 0;\n \n\t\tfor (int i = 0; i < someString.length(); i++) {\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }\n \n System.out.println(rCount);\n \n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\t// 文字列の入力\n\t\tScanner sc = new Scanner(System.in);\n String someString = sc.next();\n\t\tchar rChar = 'R';\n int rCount = 0;\n \n\t\tfor (int i = 0; i < someString.length(); i++) {\n if(rCount==0 && someString.charAt(i) == rChar){\n rCount = 1;\n }\n if (someString.charAt(i) == rChar) {\n if(i>0 && someString.charAt(i-1) == rChar){\n rCount++;\n }\n } \n }\n \n System.out.println(rCount);\n \n\t}\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args){
// 文字列の入力
Scanner sc = new Scanner(System.in);
String someString = sc.next();
char rChar = 'R';
int rCount = 0;
for (int i = 0; i < someString.length(); i++) {
if(rCount==0 && someString.charAt(i) == rChar){
rCount = 1;
}
if (someString.charAt(i) == rChar) {
if(i>0 && someString.charAt(i-1) == rChar){
rCount++;
}
}
}
System.out.println(rCount);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
17,
30,
0,
13,
17,
30,
40,
13,
14,
2,
13,
13,
30,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
69,
5
],
[
69,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
23,
33
],
[
33,
34
],
[
34,
35
],
[
23,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
39,
44
],
[
38,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
8,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
6,
66
],
[
66,
67
],
[
0,
68
],
[
68,
69
],
[
68,
70
]
]
| [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int longestStreak = 0;\n int currentStreak = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }\n System.out.println(longestStreak);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int longestStreak = 0;\n int currentStreak = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }\n System.out.println(longestStreak);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int longestStreak = 0;\n int currentStreak = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }\n System.out.println(longestStreak);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int longestStreak = 0;\n int currentStreak = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }\n System.out.println(longestStreak);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String s = sc.next();",
"s",
"sc.next()",
"sc.next",
"sc",
"int longestStreak = 0;",
"longestStreak",
"0",
"int currentStreak = 0;",
"currentStreak",
"0",
"for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < s.length()",
"i",
"s.length()",
"s.length",
"s",
"i++",
"i++",
"i",
"{\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }",
"{\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }",
"if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }",
"s.charAt(i) == 'S'",
"s.charAt(i)",
"s.charAt",
"s",
"i",
"'S'",
"{\n currentStreak = 0;\n }",
"currentStreak = 0",
"currentStreak",
"0",
"{\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }",
"currentStreak++",
"currentStreak",
"if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }",
"currentStreak > longestStreak",
"currentStreak",
"longestStreak",
"{ \n longestStreak = currentStreak;\n }",
"longestStreak = currentStreak",
"longestStreak",
"currentStreak",
"System.out.println(longestStreak)",
"System.out.println",
"System.out",
"System",
"System.out",
"longestStreak",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int longestStreak = 0;\n int currentStreak = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }\n System.out.println(longestStreak);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int longestStreak = 0;\n int currentStreak = 0;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'S') {\n currentStreak = 0;\n } else {\n currentStreak++;\n if (currentStreak > longestStreak) { \n longestStreak = currentStreak;\n }\n }\n }\n System.out.println(longestStreak);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int longestStreak = 0;
int currentStreak = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == 'S') {
currentStreak = 0;
} else {
currentStreak++;
if (currentStreak > longestStreak) {
longestStreak = currentStreak;
}
}
}
System.out.println(longestStreak);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
17,
40,
13,
0,
13,
17,
14,
2,
13,
13,
0,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
74,
11
],
[
74,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
28,
30
],
[
14,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
31,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
31,
41
],
[
41,
42
],
[
42,
43
],
[
31,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
47,
52
],
[
46,
53
],
[
53,
54
],
[
46,
55
],
[
55,
56
],
[
55,
57
],
[
45,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
62,
64
],
[
14,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
12,
71
],
[
71,
72
],
[
0,
73
],
[
73,
74
],
[
73,
75
]
]
| [
"import java.security.SecureRandom;\nimport java.sql.Array;\nimport java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int count = 0;\n// if (s.charAt(0)=='R')count++;\n// else count=0;\n// if (s.charAt(1)=='R')count++;\n// else count=0;\n// if (s.charAt(2)=='R')count++;\n// else count=0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }\n\n System.out.println(max);\n\n }\n }",
"import java.security.SecureRandom;",
"SecureRandom",
"java.security",
"import java.sql.Array;",
"Array",
"java.sql",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int count = 0;\n// if (s.charAt(0)=='R')count++;\n// else count=0;\n// if (s.charAt(1)=='R')count++;\n// else count=0;\n// if (s.charAt(2)=='R')count++;\n// else count=0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }\n\n System.out.println(max);\n\n }\n }",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int count = 0;\n// if (s.charAt(0)=='R')count++;\n// else count=0;\n// if (s.charAt(1)=='R')count++;\n// else count=0;\n// if (s.charAt(2)=='R')count++;\n// else count=0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }\n\n System.out.println(max);\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int count = 0;\n// if (s.charAt(0)=='R')count++;\n// else count=0;\n// if (s.charAt(1)=='R')count++;\n// else count=0;\n// if (s.charAt(2)=='R')count++;\n// else count=0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }\n\n System.out.println(max);\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String s = sc.next();",
"s",
"sc.next()",
"sc.next",
"sc",
"int count = 0;",
"count",
"0",
"int max = Integer.MIN_VALUE;",
"max",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < s.length()",
"i",
"s.length()",
"s.length",
"s",
"i++",
"i++",
"i",
"{\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }",
"{\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }",
"if (s.charAt(i) == 'R') count++;\n else count = 0;",
"s.charAt(i) == 'R'",
"s.charAt(i)",
"s.charAt",
"s",
"i",
"'R'",
"count++",
"count",
"count = 0",
"count",
"0",
"if (count > max) max = count;",
"count > max",
"count",
"max",
"max = count",
"max",
"count",
"System.out.println(max)",
"System.out.println",
"System.out",
"System",
"System.out",
"max",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int count = 0;\n// if (s.charAt(0)=='R')count++;\n// else count=0;\n// if (s.charAt(1)=='R')count++;\n// else count=0;\n// if (s.charAt(2)=='R')count++;\n// else count=0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }\n\n System.out.println(max);\n\n }\n }",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n\n int count = 0;\n// if (s.charAt(0)=='R')count++;\n// else count=0;\n// if (s.charAt(1)=='R')count++;\n// else count=0;\n// if (s.charAt(2)=='R')count++;\n// else count=0;\n int max = Integer.MIN_VALUE;\n for (int i = 0; i < s.length(); i++) {\n if (s.charAt(i) == 'R') count++;\n else count = 0;\n if (count > max) max = count;\n }\n\n System.out.println(max);\n\n }\n }",
"Main"
]
| import java.security.SecureRandom;
import java.sql.Array;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int count = 0;
// if (s.charAt(0)=='R')count++;
// else count=0;
// if (s.charAt(1)=='R')count++;
// else count=0;
// if (s.charAt(2)=='R')count++;
// else count=0;
int max = Integer.MIN_VALUE;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == 'R') count++;
else count = 0;
if (count > max) max = count;
}
System.out.println(max);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
14,
2,
2,
2,
4,
18,
13,
17,
17,
2,
4,
18,
13,
17,
17,
2,
4,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
14,
2,
2,
2,
4,
18,
13,
17,
17,
2,
4,
18,
13,
17,
17,
2,
2,
4,
18,
13,
17,
17,
2,
4,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
14,
2,
2,
2,
4,
18,
13,
17,
17,
2,
4,
18,
13,
17,
17,
2,
4,
18,
13,
17,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
121,
5
],
[
121,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
24,
27
],
[
23,
28
],
[
22,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
29,
34
],
[
21,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
35,
40
],
[
20,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
20,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
51,
56
],
[
50,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
57,
62
],
[
49,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
65,
68
],
[
64,
69
],
[
63,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
70,
75
],
[
48,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
48,
83
],
[
83,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
86,
91
],
[
85,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
92,
97
],
[
85,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
98,
103
],
[
83,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
83,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
6,
118
],
[
118,
119
],
[
0,
120
],
[
120,
121
],
[
120,
122
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tint count =0;\n\n\t\tif((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tint count =0;\n\n\t\tif((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tint count =0;\n\n\t\tif((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tint count =0;\n\n\t\tif((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String s = sc.next();",
"s",
"sc.next()",
"sc.next",
"sc",
"int count =0;",
"count",
"0",
"if((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}",
"(s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')",
"s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R'",
"s.charAt(0)=='R'",
"s.charAt(0)",
"s.charAt",
"s",
"0",
"'R'",
"s.charAt(1)=='R'",
"s.charAt(1)",
"s.charAt",
"s",
"1",
"'R'",
"s.charAt(2)=='R'",
"s.charAt(2)",
"s.charAt",
"s",
"2",
"'R'",
"{\n\t\t\tSystem.out.println(3);\n\t\t}",
"System.out.println(3)",
"System.out.println",
"System.out",
"System",
"System.out",
"3",
"if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}",
"(s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')",
"(s.charAt(0)=='R' && s.charAt(1)=='R')",
"s.charAt(0)=='R'",
"s.charAt(0)",
"s.charAt",
"s",
"0",
"'R'",
"s.charAt(1)=='R'",
"s.charAt(1)",
"s.charAt",
"s",
"1",
"'R'",
"(s.charAt(1)=='R' && s.charAt(2)=='R')",
"s.charAt(1)=='R'",
"s.charAt(1)",
"s.charAt",
"s",
"1",
"'R'",
"s.charAt(2)=='R'",
"s.charAt(2)",
"s.charAt",
"s",
"2",
"'R'",
"{\n\t\t\tSystem.out.println(2);\n\t\t}",
"System.out.println(2)",
"System.out.println",
"System.out",
"System",
"System.out",
"2",
"if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}",
"(s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')",
"(s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')",
"(s.charAt(0)=='R')",
"s.charAt(0)",
"s.charAt",
"s",
"0",
"'R'",
"(s.charAt(1)=='R')",
"s.charAt(1)",
"s.charAt",
"s",
"1",
"'R'",
"(s.charAt(2)=='R')",
"s.charAt(2)",
"s.charAt",
"s",
"2",
"'R'",
"{\n\t\t\tSystem.out.println(1);\n\t\t}",
"System.out.println(1)",
"System.out.println",
"System.out",
"System",
"System.out",
"1",
"{\n\t\t\tSystem.out.println(0);\n\t\t}",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tint count =0;\n\n\t\tif((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}\n\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString s = sc.next();\n\t\tint count =0;\n\n\t\tif((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){\n\t\t\tSystem.out.println(3);\n\t\t}\n\t\telse if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {\n\t\t\tSystem.out.println(2);\n\t\t}\n\n\t\telse if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){\n\t\t\tSystem.out.println(1);\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(0);\n\t\t}\n\n\t}\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int count =0;
if((s.charAt(0)=='R' && s.charAt(1)=='R'&& s.charAt(2)=='R')){
System.out.println(3);
}
else if((s.charAt(0)=='R' && s.charAt(1)=='R') || (s.charAt(1)=='R' && s.charAt(2)=='R')) {
System.out.println(2);
}
else if((s.charAt(0)=='R') || (s.charAt(1)=='R') || (s.charAt(2)=='R')){
System.out.println(1);
}
else{
System.out.println(0);
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
17,
30,
40,
13,
30,
14,
2,
13,
13,
30,
0,
13,
13,
30,
0,
13,
17,
14,
2,
13,
13,
30,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
80,
5
],
[
80,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
38,
41
],
[
37,
42
],
[
36,
43
],
[
43,
44
],
[
44,
45
],
[
36,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
47,
55
],
[
46,
56
],
[
56,
57
],
[
56,
58
],
[
8,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
59,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
6,
77
],
[
77,
78
],
[
0,
79
],
[
79,
80
],
[
79,
81
]
]
| [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String args[]){\n Scanner scanner = new Scanner(System.in);\n String esu = scanner.next();\n int raincnt = 0;\n int rainrec = 0;\n for(int i=0;i<3;i++){\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }\n\n if(raincnt>rainrec){\n System.out.println(raincnt);\n }else{\n System.out.println(rainrec);\n }\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String args[]){\n Scanner scanner = new Scanner(System.in);\n String esu = scanner.next();\n int raincnt = 0;\n int rainrec = 0;\n for(int i=0;i<3;i++){\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }\n\n if(raincnt>rainrec){\n System.out.println(raincnt);\n }else{\n System.out.println(rainrec);\n }\n }\n}",
"Main",
"public static void main(String args[]){\n Scanner scanner = new Scanner(System.in);\n String esu = scanner.next();\n int raincnt = 0;\n int rainrec = 0;\n for(int i=0;i<3;i++){\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }\n\n if(raincnt>rainrec){\n System.out.println(raincnt);\n }else{\n System.out.println(rainrec);\n }\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n String esu = scanner.next();\n int raincnt = 0;\n int rainrec = 0;\n for(int i=0;i<3;i++){\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }\n\n if(raincnt>rainrec){\n System.out.println(raincnt);\n }else{\n System.out.println(rainrec);\n }\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"String esu = scanner.next();",
"esu",
"scanner.next()",
"scanner.next",
"scanner",
"int raincnt = 0;",
"raincnt",
"0",
"int rainrec = 0;",
"rainrec",
"0",
"for(int i=0;i<3;i++){\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<3",
"i",
"3",
"i++",
"i++",
"i",
"{\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }",
"{\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }",
"if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }",
"esu.charAt(i)=='R'",
"esu.charAt(i)",
"esu.charAt",
"esu",
"i",
"'R'",
"{ \n raincnt++;\n }",
"raincnt++",
"raincnt",
"{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }",
"if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }",
"raincnt>rainrec",
"raincnt",
"rainrec",
"{\n rainrec = raincnt;\n }",
"rainrec = raincnt",
"rainrec",
"raincnt",
"{\n }",
"raincnt = 0",
"raincnt",
"0",
"if(raincnt>rainrec){\n System.out.println(raincnt);\n }else{\n System.out.println(rainrec);\n }",
"raincnt>rainrec",
"raincnt",
"rainrec",
"{\n System.out.println(raincnt);\n }",
"System.out.println(raincnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"raincnt",
"{\n System.out.println(rainrec);\n }",
"System.out.println(rainrec)",
"System.out.println",
"System.out",
"System",
"System.out",
"rainrec",
"String args[]",
"args",
"public class Main{\n public static void main(String args[]){\n Scanner scanner = new Scanner(System.in);\n String esu = scanner.next();\n int raincnt = 0;\n int rainrec = 0;\n for(int i=0;i<3;i++){\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }\n\n if(raincnt>rainrec){\n System.out.println(raincnt);\n }else{\n System.out.println(rainrec);\n }\n }\n}",
"public class Main{\n public static void main(String args[]){\n Scanner scanner = new Scanner(System.in);\n String esu = scanner.next();\n int raincnt = 0;\n int rainrec = 0;\n for(int i=0;i<3;i++){\n if(esu.charAt(i)=='R'){ \n raincnt++;\n }else{\n if(raincnt>rainrec){\n rainrec = raincnt;\n }else{\n }\n raincnt = 0;\n \n }\n }\n\n if(raincnt>rainrec){\n System.out.println(raincnt);\n }else{\n System.out.println(rainrec);\n }\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main{
public static void main(String args[]){
Scanner scanner = new Scanner(System.in);
String esu = scanner.next();
int raincnt = 0;
int rainrec = 0;
for(int i=0;i<3;i++){
if(esu.charAt(i)=='R'){
raincnt++;
}else{
if(raincnt>rainrec){
rainrec = raincnt;
}else{
}
raincnt = 0;
}
}
if(raincnt>rainrec){
System.out.println(raincnt);
}else{
System.out.println(rainrec);
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
17,
2,
17,
4,
18,
13,
13,
40,
13,
14,
2,
2,
2,
13,
17,
2,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
2,
17,
4,
18,
13,
13,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
82,
5
],
[
82,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
20,
30
],
[
30,
31
],
[
31,
32
],
[
20,
33
],
[
34,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
35,
46
],
[
46,
47
],
[
34,
48
],
[
48,
49
],
[
50,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
54,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
50,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
48,
71
],
[
71,
72
],
[
8,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
6,
79
],
[
79,
80
],
[
0,
81
],
[
81,
82
],
[
81,
83
]
]
| [
"import java.util.Scanner;\n\npublic class Main{\n\n public static void main(String[] args) {\n Scanner std = new Scanner(System.in);\n String str = std.next();\n int count = 0;\n for(int i = 0; i < str.length(); i++) {\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }\n\n System.out.println(count);\n }\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\n public static void main(String[] args) {\n Scanner std = new Scanner(System.in);\n String str = std.next();\n int count = 0;\n for(int i = 0; i < str.length(); i++) {\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }\n\n System.out.println(count);\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner std = new Scanner(System.in);\n String str = std.next();\n int count = 0;\n for(int i = 0; i < str.length(); i++) {\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }\n\n System.out.println(count);\n }",
"main",
"{\n Scanner std = new Scanner(System.in);\n String str = std.next();\n int count = 0;\n for(int i = 0; i < str.length(); i++) {\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }\n\n System.out.println(count);\n }",
"Scanner std = new Scanner(System.in);",
"std",
"new Scanner(System.in)",
"String str = std.next();",
"str",
"std.next()",
"std.next",
"std",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < str.length(); i++) {\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < str.length()",
"i",
"str.length()",
"str.length",
"str",
"i++",
"i++",
"i",
"{\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }",
"{\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }",
"if(count == 0 && 'R' == (char)str.charAt(i))\n count++;",
"count == 0 && 'R' == (char)str.charAt(i)",
"count == 0",
"count",
"0",
"'R' == (char)str.charAt(i)",
"'R'",
"(char)str.charAt(i)",
"str.charAt",
"str",
"i",
"count++",
"count",
"if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;",
"i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i)",
"i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i)",
"i > 0",
"i",
"0",
"str.charAt(i - 1) == str.charAt(i)",
"str.charAt(i - 1)",
"str.charAt",
"str",
"i - 1",
"i",
"1",
"str.charAt(i)",
"str.charAt",
"str",
"i",
"'R' == (char)str.charAt(i)",
"'R'",
"(char)str.charAt(i)",
"str.charAt",
"str",
"i",
"count++",
"count",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n\n public static void main(String[] args) {\n Scanner std = new Scanner(System.in);\n String str = std.next();\n int count = 0;\n for(int i = 0; i < str.length(); i++) {\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }\n\n System.out.println(count);\n }\n\n}",
"public class Main{\n\n public static void main(String[] args) {\n Scanner std = new Scanner(System.in);\n String str = std.next();\n int count = 0;\n for(int i = 0; i < str.length(); i++) {\n if(count == 0 && 'R' == (char)str.charAt(i))\n count++;\n if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))\n count++;\n }\n\n System.out.println(count);\n }\n\n}",
"Main"
]
| import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner std = new Scanner(System.in);
String str = std.next();
int count = 0;
for(int i = 0; i < str.length(); i++) {
if(count == 0 && 'R' == (char)str.charAt(i))
count++;
if(i > 0 && str.charAt(i - 1) == str.charAt(i) && 'R' == (char)str.charAt(i))
count++;
}
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
17,
30,
14,
2,
2,
13,
17,
2,
4,
18,
13,
17,
17,
30,
0,
13,
17,
40,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
67,
5
],
[
67,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
35,
38
],
[
34,
39
],
[
33,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
46,
51
],
[
41,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
40,
56
],
[
56,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
6,
64
],
[
64,
65
],
[
0,
66
],
[
66,
67
],
[
66,
68
]
]
| [
"import java.util.Scanner;\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tint cnt = 0;\n\t\tfor(int i=0; i < 3; i++) {\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tint cnt = 0;\n\t\tfor(int i=0; i < 3; i++) {\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tint cnt = 0;\n\t\tfor(int i=0; i < 3; i++) {\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tint cnt = 0;\n\t\tfor(int i=0; i < 3; i++) {\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String S = sc.next();",
"S",
"sc.next()",
"sc.next",
"sc",
"int cnt = 0;",
"cnt",
"0",
"for(int i=0; i < 3; i++) {\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < 3",
"i",
"3",
"i++",
"i++",
"i",
"{\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}",
"if(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}",
"S.charAt(i)=='R'",
"S.charAt(i)",
"S.charAt",
"S",
"i",
"'R'",
"{\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}",
"if(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }",
"i==2&&S.charAt(1)=='S'",
"i==2",
"i",
"2",
"S.charAt(1)=='S'",
"S.charAt(1)",
"S.charAt",
"S",
"1",
"'S'",
"{\n cnt=0;\n }",
"cnt=0",
"cnt",
"0",
"cnt++",
"cnt",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tint cnt = 0;\n\t\tfor(int i=0; i < 3; i++) {\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tString S = sc.next();\n\t\tint cnt = 0;\n\t\tfor(int i=0; i < 3; i++) {\n\t\t\tif(S.charAt(i)=='R') {\n\t\t\t\tif(i==2&&S.charAt(1)=='S'){\n cnt=0;\n }\n\t\t\t\t cnt++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(cnt);\n\t}\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
int cnt = 0;
for(int i=0; i < 3; i++) {
if(S.charAt(i)=='R') {
if(i==2&&S.charAt(1)=='S'){
cnt=0;
}
cnt++;
}
}
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
41,
13,
20,
41,
13,
20,
41,
13,
20,
4,
18,
13,
17,
13,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
17,
14,
4,
18,
13,
17,
0,
13,
17,
14,
4,
18,
13,
17,
0,
13,
17,
14,
4,
18,
13,
17,
0,
13,
17,
4,
18,
13,
13,
23,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
153,
11
],
[
153,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
22,
24
],
[
14,
25
],
[
25,
26
],
[
25,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
31
],
[
31,
32
],
[
31,
33
],
[
14,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
34,
38
],
[
34,
39
],
[
14,
40
],
[
40,
41
],
[
41,
42
],
[
12,
43
],
[
43,
44
],
[
153,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
49,
55
],
[
55,
56
],
[
55,
57
],
[
49,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
59,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
66,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
49,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
47,
86
],
[
86,
87
],
[
47,
88
],
[
88,
89
],
[
47,
90
],
[
90,
91
],
[
153,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
92,
96
],
[
96,
97
],
[
92,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
92,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
109,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
119,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
108,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
92,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
141,
142
],
[
92,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
]
| [
"\nimport java.util.*;\nimport java.io.*;\nimport java.math.BigInteger;\n\n/**\n * Built using CHelper plug-in\n * Actual solution is at the top\n *\n * @author prem_cse\n */\npublic class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solution solver = new Solution();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Solution{\n \n \t\n public void solve(int testNumber, FastReader sc, PrintWriter out) {\n \n \tString s = sc.next();\n \tint ans = 0;\n \tif(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;\n \tout.print(ans);\n }\n\n\t\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader(InputStream stream) {\n br = new BufferedReader(new\n InputStreamReader(stream), 32768);\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solution solver = new Solution();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Solution{\n \n \t\n public void solve(int testNumber, FastReader sc, PrintWriter out) {\n \n \tString s = sc.next();\n \tint ans = 0;\n \tif(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;\n \tout.print(ans);\n }\n\n\t\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader(InputStream stream) {\n br = new BufferedReader(new\n InputStreamReader(stream), 32768);\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}",
"Main",
"public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solution solver = new Solution();\n solver.solve(1, in, out);\n out.close();\n }",
"main",
"{\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solution solver = new Solution();\n solver.solve(1, in, out);\n out.close();\n }",
"InputStream inputStream = System.in;",
"inputStream",
"System.in",
"System",
"System.in",
"OutputStream outputStream = System.out;",
"outputStream",
"System.out",
"System",
"System.out",
"FastReader in = new FastReader(inputStream);",
"in",
"new FastReader(inputStream)",
"PrintWriter out = new PrintWriter(outputStream);",
"out",
"new PrintWriter(outputStream)",
"Solution solver = new Solution();",
"solver",
"new Solution()",
"solver.solve(1, in, out)",
"solver.solve",
"solver",
"1",
"in",
"out",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class Solution{\n \n \t\n public void solve(int testNumber, FastReader sc, PrintWriter out) {\n \n \tString s = sc.next();\n \tint ans = 0;\n \tif(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;\n \tout.print(ans);\n }\n\n\t\n }",
"Solution",
"public void solve(int testNumber, FastReader sc, PrintWriter out) {\n \n \tString s = sc.next();\n \tint ans = 0;\n \tif(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;\n \tout.print(ans);\n }",
"solve",
"{\n \n \tString s = sc.next();\n \tint ans = 0;\n \tif(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;\n \tout.print(ans);\n }",
"String s = sc.next();",
"s",
"sc.next()",
"sc.next",
"sc",
"int ans = 0;",
"ans",
"0",
"if(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;",
"s.contains(\"RRR\")",
"s.contains",
"s",
"\"RRR\"",
"ans = 3",
"ans",
"3",
"if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;",
"s.contains(\"RR\")",
"s.contains",
"s",
"\"RR\"",
"ans = 2",
"ans",
"2",
"if(s.contains(\"R\")) ans = 1;",
"s.contains(\"R\")",
"s.contains",
"s",
"\"R\"",
"ans = 1",
"ans",
"1",
"out.print(ans)",
"out.print",
"out",
"ans",
"int testNumber",
"testNumber",
"FastReader sc",
"sc",
"PrintWriter out",
"out",
"static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader(InputStream stream) {\n br = new BufferedReader(new\n InputStreamReader(stream), 32768);\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n }",
"FastReader",
"BufferedReader br;",
"br",
"StringTokenizer st;",
"st",
"public FastReader(InputStream stream) {\n br = new BufferedReader(new\n InputStreamReader(stream), 32768);\n }",
"FastReader",
"{\n br = new BufferedReader(new\n InputStreamReader(stream), 32768);\n }",
"br = new BufferedReader(new\n InputStreamReader(stream), 32768)",
"br",
"new BufferedReader(new\n InputStreamReader(stream), 32768)",
"InputStream stream",
"stream",
"public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }",
"next",
"{\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }",
"while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"st == null || !st.hasMoreElements()",
"st == null",
"st",
"null",
"!st.hasMoreElements()",
"st.hasMoreElements()",
"st.hasMoreElements",
"st",
"{\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }",
"catch (IOException e) {\n e.printStackTrace();\n }",
"IOException e",
"{\n e.printStackTrace();\n }",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public int nextInt() {\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public long nextLong() {\n return Long.parseLong(next());\n }",
"nextLong",
"{\n return Long.parseLong(next());\n }",
"return Long.parseLong(next());",
"Long.parseLong(next())",
"Long.parseLong",
"Long",
"next()",
"next",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solution solver = new Solution();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Solution{\n \n \t\n public void solve(int testNumber, FastReader sc, PrintWriter out) {\n \n \tString s = sc.next();\n \tint ans = 0;\n \tif(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;\n \tout.print(ans);\n }\n\n\t\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader(InputStream stream) {\n br = new BufferedReader(new\n InputStreamReader(stream), 32768);\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n InputStream inputStream = System.in;\n OutputStream outputStream = System.out;\n FastReader in = new FastReader(inputStream);\n PrintWriter out = new PrintWriter(outputStream);\n Solution solver = new Solution();\n solver.solve(1, in, out);\n out.close();\n }\n\n static class Solution{\n \n \t\n public void solve(int testNumber, FastReader sc, PrintWriter out) {\n \n \tString s = sc.next();\n \tint ans = 0;\n \tif(s.contains(\"RRR\")) ans = 3;\n \telse if(s.contains(\"RR\")) ans = 2;\n \telse if(s.contains(\"R\")) ans = 1;\n \tout.print(ans);\n }\n\n\t\n }\n\n static class FastReader {\n BufferedReader br;\n StringTokenizer st;\n\n public FastReader(InputStream stream) {\n br = new BufferedReader(new\n InputStreamReader(stream), 32768);\n }\n\n public String next() {\n while (st == null || !st.hasMoreElements()) {\n try {\n st = new StringTokenizer(br.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n return st.nextToken();\n }\n\n public int nextInt() {\n return Integer.parseInt(next());\n }\n\n public long nextLong() {\n return Long.parseLong(next());\n }\n\n }\n}",
"Main"
]
|
import java.util.*;
import java.io.*;
import java.math.BigInteger;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author prem_cse
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
FastReader in = new FastReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Solution solver = new Solution();
solver.solve(1, in, out);
out.close();
}
static class Solution{
public void solve(int testNumber, FastReader sc, PrintWriter out) {
String s = sc.next();
int ans = 0;
if(s.contains("RRR")) ans = 3;
else if(s.contains("RR")) ans = 2;
else if(s.contains("R")) ans = 1;
out.print(ans);
}
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader(InputStream stream) {
br = new BufferedReader(new
InputStreamReader(stream), 32768);
}
public String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
40,
13,
0,
13,
4,
18,
13,
13,
13,
30,
0,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
71,
5
],
[
71,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
23,
33
],
[
33,
34
],
[
34,
35
],
[
23,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
37,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
53,
57
],
[
44,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
8,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
6,
68
],
[
68,
69
],
[
0,
70
],
[
70,
71
],
[
70,
72
]
]
| [
"import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int sum = 0;\n int max = 0;\n for (int i = 0; i < s.length(); i++) {\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }\n System.out.println(max);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int sum = 0;\n int max = 0;\n for (int i = 0; i < s.length(); i++) {\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }\n System.out.println(max);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int sum = 0;\n int max = 0;\n for (int i = 0; i < s.length(); i++) {\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }\n System.out.println(max);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int sum = 0;\n int max = 0;\n for (int i = 0; i < s.length(); i++) {\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }\n System.out.println(max);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String s = sc.next();",
"s",
"sc.next()",
"sc.next",
"sc",
"int sum = 0;",
"sum",
"0",
"int max = 0;",
"max",
"0",
"for (int i = 0; i < s.length(); i++) {\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < s.length()",
"i",
"s.length()",
"s.length",
"s",
"i++",
"i++",
"i",
"{\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }",
"{\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }",
"char ch = s.charAt(i);",
"ch",
"s.charAt(i)",
"s.charAt",
"s",
"i",
"if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }",
"ch == 'R'",
"ch",
"'R'",
"{\n sum++;\n max = Math.max(max, sum);\n }",
"sum++",
"sum",
"max = Math.max(max, sum)",
"max",
"Math.max(max, sum)",
"Math.max",
"Math",
"max",
"sum",
"{\n sum = 0;\n }",
"sum = 0",
"sum",
"0",
"System.out.println(max)",
"System.out.println",
"System.out",
"System",
"System.out",
"max",
"String[] args",
"args",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int sum = 0;\n int max = 0;\n for (int i = 0; i < s.length(); i++) {\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }\n System.out.println(max);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n int sum = 0;\n int max = 0;\n for (int i = 0; i < s.length(); i++) {\n char ch = s.charAt(i);\n if (ch == 'R') {\n sum++;\n max = Math.max(max, sum);\n } else {\n sum = 0;\n }\n }\n System.out.println(max);\n }\n}",
"Main"
]
| import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int sum = 0;
int max = 0;
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if (ch == 'R') {
sum++;
max = Math.max(max, sum);
} else {
sum = 0;
}
}
System.out.println(max);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
14,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
14,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
14,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
66,
5
],
[
66,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
21,
24
],
[
20,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
20,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
32,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
32,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
44,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
44,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
57,
62
],
[
6,
63
],
[
63,
64
],
[
0,
65
],
[
65,
66
],
[
65,
67
]
]
| [
"import java.util.*;\n\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n// int k = sc.nextInt();\n// int a = sc.nextInt();\n// int b = sc.nextInt();\n sc.close();\n// System.out.println(s);\n if(s.contains(\"RRR\")){\n System.out.println(3);\n }else if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }\n// String s = sc.nextLine();\n// String t = sc.next();\n// String[] arr = s.split(\" \");\n// sc.close();\n// System.out.println(\"input: \"+ s);\n// System.out.println(\"k:\" + k);\n// System.out.println(\"a:\" + a);\n// System.out.println(\"b:\" + b);\n// String ans = \"NG\";\n// for(int x = a; x<=b; x++){\n// if(x%k == 0){\n// ans = \"OK\";\n// }\n// }\n// System.out.println(ans);\n// \\\n// System.out.println(\"arr[1]:\" + arr[1]);\n//\n// if(s.equals(\"ABC\")){\n// System.out.println(\"ARC\");\n// }else{\n// System.out.println(\"ABC\");\n// }\n// String[] arr1 = s.split(\"\");\n// String[] arr2 = t.split(\"\");\n//// List<String> list1 = Arrays.asList(s.split(\"\"));\n// List list1 = new LinkedList(Arrays.asList(s.split(\"\")));\n//// List<String> list2 = Arrays.asList(t.split(\"\"));\n// List list2 = new LinkedList(Arrays.asList(t.split(\"\")));\n//// int num = Integer.parseInt(arr[arr.length - 1]);\n// list2.remove(arr2.length - 1);\n//// System.out.println(list1);\n//// System.out.println(list2);\n// if(list1.toString().contentEquals(list2.toString())){\n// System.out.println(\"Yes\");\n// }else{\n// System.out.println(\"No\");\n// }\n// switch(num){\n// case 3:\n// System.out.println(\"bon\");\n// break;\n// case 0:\n// case 1:\n// case 6:\n// case 8:\n// System.out.println(\"pon\");\n// break;\n// default:\n// System.out.println(\"hon\");\n// break;\n// }\n// String[] array = str.split(\" \");\n// int sum = 0;\n// for(int i=0; i<array.length; i++) {\n// int num = Integer.parseInt(array[i]);\n// sum += num;\n// }\n// System.out.println(15-sum);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n// int k = sc.nextInt();\n// int a = sc.nextInt();\n// int b = sc.nextInt();\n sc.close();\n// System.out.println(s);\n if(s.contains(\"RRR\")){\n System.out.println(3);\n }else if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }\n// String s = sc.nextLine();\n// String t = sc.next();\n// String[] arr = s.split(\" \");\n// sc.close();\n// System.out.println(\"input: \"+ s);\n// System.out.println(\"k:\" + k);\n// System.out.println(\"a:\" + a);\n// System.out.println(\"b:\" + b);\n// String ans = \"NG\";\n// for(int x = a; x<=b; x++){\n// if(x%k == 0){\n// ans = \"OK\";\n// }\n// }\n// System.out.println(ans);\n// \\\n// System.out.println(\"arr[1]:\" + arr[1]);\n//\n// if(s.equals(\"ABC\")){\n// System.out.println(\"ARC\");\n// }else{\n// System.out.println(\"ABC\");\n// }\n// String[] arr1 = s.split(\"\");\n// String[] arr2 = t.split(\"\");\n//// List<String> list1 = Arrays.asList(s.split(\"\"));\n// List list1 = new LinkedList(Arrays.asList(s.split(\"\")));\n//// List<String> list2 = Arrays.asList(t.split(\"\"));\n// List list2 = new LinkedList(Arrays.asList(t.split(\"\")));\n//// int num = Integer.parseInt(arr[arr.length - 1]);\n// list2.remove(arr2.length - 1);\n//// System.out.println(list1);\n//// System.out.println(list2);\n// if(list1.toString().contentEquals(list2.toString())){\n// System.out.println(\"Yes\");\n// }else{\n// System.out.println(\"No\");\n// }\n// switch(num){\n// case 3:\n// System.out.println(\"bon\");\n// break;\n// case 0:\n// case 1:\n// case 6:\n// case 8:\n// System.out.println(\"pon\");\n// break;\n// default:\n// System.out.println(\"hon\");\n// break;\n// }\n// String[] array = str.split(\" \");\n// int sum = 0;\n// for(int i=0; i<array.length; i++) {\n// int num = Integer.parseInt(array[i]);\n// sum += num;\n// }\n// System.out.println(15-sum);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n// int k = sc.nextInt();\n// int a = sc.nextInt();\n// int b = sc.nextInt();\n sc.close();\n// System.out.println(s);\n if(s.contains(\"RRR\")){\n System.out.println(3);\n }else if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }\n// String s = sc.nextLine();\n// String t = sc.next();\n// String[] arr = s.split(\" \");\n// sc.close();\n// System.out.println(\"input: \"+ s);\n// System.out.println(\"k:\" + k);\n// System.out.println(\"a:\" + a);\n// System.out.println(\"b:\" + b);\n// String ans = \"NG\";\n// for(int x = a; x<=b; x++){\n// if(x%k == 0){\n// ans = \"OK\";\n// }\n// }\n// System.out.println(ans);\n// \\\n// System.out.println(\"arr[1]:\" + arr[1]);\n//\n// if(s.equals(\"ABC\")){\n// System.out.println(\"ARC\");\n// }else{\n// System.out.println(\"ABC\");\n// }\n// String[] arr1 = s.split(\"\");\n// String[] arr2 = t.split(\"\");\n//// List<String> list1 = Arrays.asList(s.split(\"\"));\n// List list1 = new LinkedList(Arrays.asList(s.split(\"\")));\n//// List<String> list2 = Arrays.asList(t.split(\"\"));\n// List list2 = new LinkedList(Arrays.asList(t.split(\"\")));\n//// int num = Integer.parseInt(arr[arr.length - 1]);\n// list2.remove(arr2.length - 1);\n//// System.out.println(list1);\n//// System.out.println(list2);\n// if(list1.toString().contentEquals(list2.toString())){\n// System.out.println(\"Yes\");\n// }else{\n// System.out.println(\"No\");\n// }\n// switch(num){\n// case 3:\n// System.out.println(\"bon\");\n// break;\n// case 0:\n// case 1:\n// case 6:\n// case 8:\n// System.out.println(\"pon\");\n// break;\n// default:\n// System.out.println(\"hon\");\n// break;\n// }\n// String[] array = str.split(\" \");\n// int sum = 0;\n// for(int i=0; i<array.length; i++) {\n// int num = Integer.parseInt(array[i]);\n// sum += num;\n// }\n// System.out.println(15-sum);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n// int k = sc.nextInt();\n// int a = sc.nextInt();\n// int b = sc.nextInt();\n sc.close();\n// System.out.println(s);\n if(s.contains(\"RRR\")){\n System.out.println(3);\n }else if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }\n// String s = sc.nextLine();\n// String t = sc.next();\n// String[] arr = s.split(\" \");\n// sc.close();\n// System.out.println(\"input: \"+ s);\n// System.out.println(\"k:\" + k);\n// System.out.println(\"a:\" + a);\n// System.out.println(\"b:\" + b);\n// String ans = \"NG\";\n// for(int x = a; x<=b; x++){\n// if(x%k == 0){\n// ans = \"OK\";\n// }\n// }\n// System.out.println(ans);\n// \\\n// System.out.println(\"arr[1]:\" + arr[1]);\n//\n// if(s.equals(\"ABC\")){\n// System.out.println(\"ARC\");\n// }else{\n// System.out.println(\"ABC\");\n// }\n// String[] arr1 = s.split(\"\");\n// String[] arr2 = t.split(\"\");\n//// List<String> list1 = Arrays.asList(s.split(\"\"));\n// List list1 = new LinkedList(Arrays.asList(s.split(\"\")));\n//// List<String> list2 = Arrays.asList(t.split(\"\"));\n// List list2 = new LinkedList(Arrays.asList(t.split(\"\")));\n//// int num = Integer.parseInt(arr[arr.length - 1]);\n// list2.remove(arr2.length - 1);\n//// System.out.println(list1);\n//// System.out.println(list2);\n// if(list1.toString().contentEquals(list2.toString())){\n// System.out.println(\"Yes\");\n// }else{\n// System.out.println(\"No\");\n// }\n// switch(num){\n// case 3:\n// System.out.println(\"bon\");\n// break;\n// case 0:\n// case 1:\n// case 6:\n// case 8:\n// System.out.println(\"pon\");\n// break;\n// default:\n// System.out.println(\"hon\");\n// break;\n// }\n// String[] array = str.split(\" \");\n// int sum = 0;\n// for(int i=0; i<array.length; i++) {\n// int num = Integer.parseInt(array[i]);\n// sum += num;\n// }\n// System.out.println(15-sum);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String s = sc.nextLine();",
"s",
"sc.nextLine()",
"sc.nextLine",
"sc",
"sc.close()",
"sc.close",
"sc",
"if(s.contains(\"RRR\")){\n System.out.println(3);\n }else if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }",
"s.contains(\"RRR\")",
"s.contains",
"s",
"\"RRR\"",
"{\n System.out.println(3);\n }",
"System.out.println(3)",
"System.out.println",
"System.out",
"System",
"System.out",
"3",
"if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }",
"s.contains(\"RR\")",
"s.contains",
"s",
"\"RR\"",
"{\n System.out.println(2); \n }",
"System.out.println(2)",
"System.out.println",
"System.out",
"System",
"System.out",
"2",
"if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }",
"s.contains(\"R\")",
"s.contains",
"s",
"\"R\"",
"{\n System.out.println(1);\n }",
"System.out.println(1)",
"System.out.println",
"System.out",
"System",
"System.out",
"1",
"{\n System.out.println(0);\n }",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n// int k = sc.nextInt();\n// int a = sc.nextInt();\n// int b = sc.nextInt();\n sc.close();\n// System.out.println(s);\n if(s.contains(\"RRR\")){\n System.out.println(3);\n }else if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }\n// String s = sc.nextLine();\n// String t = sc.next();\n// String[] arr = s.split(\" \");\n// sc.close();\n// System.out.println(\"input: \"+ s);\n// System.out.println(\"k:\" + k);\n// System.out.println(\"a:\" + a);\n// System.out.println(\"b:\" + b);\n// String ans = \"NG\";\n// for(int x = a; x<=b; x++){\n// if(x%k == 0){\n// ans = \"OK\";\n// }\n// }\n// System.out.println(ans);\n// \\\n// System.out.println(\"arr[1]:\" + arr[1]);\n//\n// if(s.equals(\"ABC\")){\n// System.out.println(\"ARC\");\n// }else{\n// System.out.println(\"ABC\");\n// }\n// String[] arr1 = s.split(\"\");\n// String[] arr2 = t.split(\"\");\n//// List<String> list1 = Arrays.asList(s.split(\"\"));\n// List list1 = new LinkedList(Arrays.asList(s.split(\"\")));\n//// List<String> list2 = Arrays.asList(t.split(\"\"));\n// List list2 = new LinkedList(Arrays.asList(t.split(\"\")));\n//// int num = Integer.parseInt(arr[arr.length - 1]);\n// list2.remove(arr2.length - 1);\n//// System.out.println(list1);\n//// System.out.println(list2);\n// if(list1.toString().contentEquals(list2.toString())){\n// System.out.println(\"Yes\");\n// }else{\n// System.out.println(\"No\");\n// }\n// switch(num){\n// case 3:\n// System.out.println(\"bon\");\n// break;\n// case 0:\n// case 1:\n// case 6:\n// case 8:\n// System.out.println(\"pon\");\n// break;\n// default:\n// System.out.println(\"hon\");\n// break;\n// }\n// String[] array = str.split(\" \");\n// int sum = 0;\n// for(int i=0; i<array.length; i++) {\n// int num = Integer.parseInt(array[i]);\n// sum += num;\n// }\n// System.out.println(15-sum);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.nextLine();\n// int k = sc.nextInt();\n// int a = sc.nextInt();\n// int b = sc.nextInt();\n sc.close();\n// System.out.println(s);\n if(s.contains(\"RRR\")){\n System.out.println(3);\n }else if(s.contains(\"RR\")){\n System.out.println(2); \n }else if(s.contains(\"R\")){\n System.out.println(1);\n }else{\n System.out.println(0);\n }\n// String s = sc.nextLine();\n// String t = sc.next();\n// String[] arr = s.split(\" \");\n// sc.close();\n// System.out.println(\"input: \"+ s);\n// System.out.println(\"k:\" + k);\n// System.out.println(\"a:\" + a);\n// System.out.println(\"b:\" + b);\n// String ans = \"NG\";\n// for(int x = a; x<=b; x++){\n// if(x%k == 0){\n// ans = \"OK\";\n// }\n// }\n// System.out.println(ans);\n// \\\n// System.out.println(\"arr[1]:\" + arr[1]);\n//\n// if(s.equals(\"ABC\")){\n// System.out.println(\"ARC\");\n// }else{\n// System.out.println(\"ABC\");\n// }\n// String[] arr1 = s.split(\"\");\n// String[] arr2 = t.split(\"\");\n//// List<String> list1 = Arrays.asList(s.split(\"\"));\n// List list1 = new LinkedList(Arrays.asList(s.split(\"\")));\n//// List<String> list2 = Arrays.asList(t.split(\"\"));\n// List list2 = new LinkedList(Arrays.asList(t.split(\"\")));\n//// int num = Integer.parseInt(arr[arr.length - 1]);\n// list2.remove(arr2.length - 1);\n//// System.out.println(list1);\n//// System.out.println(list2);\n// if(list1.toString().contentEquals(list2.toString())){\n// System.out.println(\"Yes\");\n// }else{\n// System.out.println(\"No\");\n// }\n// switch(num){\n// case 3:\n// System.out.println(\"bon\");\n// break;\n// case 0:\n// case 1:\n// case 6:\n// case 8:\n// System.out.println(\"pon\");\n// break;\n// default:\n// System.out.println(\"hon\");\n// break;\n// }\n// String[] array = str.split(\" \");\n// int sum = 0;\n// for(int i=0; i<array.length; i++) {\n// int num = Integer.parseInt(array[i]);\n// sum += num;\n// }\n// System.out.println(15-sum);\n }\n}",
"Main"
]
| import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
// int k = sc.nextInt();
// int a = sc.nextInt();
// int b = sc.nextInt();
sc.close();
// System.out.println(s);
if(s.contains("RRR")){
System.out.println(3);
}else if(s.contains("RR")){
System.out.println(2);
}else if(s.contains("R")){
System.out.println(1);
}else{
System.out.println(0);
}
// String s = sc.nextLine();
// String t = sc.next();
// String[] arr = s.split(" ");
// sc.close();
// System.out.println("input: "+ s);
// System.out.println("k:" + k);
// System.out.println("a:" + a);
// System.out.println("b:" + b);
// String ans = "NG";
// for(int x = a; x<=b; x++){
// if(x%k == 0){
// ans = "OK";
// }
// }
// System.out.println(ans);
// \
// System.out.println("arr[1]:" + arr[1]);
//
// if(s.equals("ABC")){
// System.out.println("ARC");
// }else{
// System.out.println("ABC");
// }
// String[] arr1 = s.split("");
// String[] arr2 = t.split("");
//// List<String> list1 = Arrays.asList(s.split(""));
// List list1 = new LinkedList(Arrays.asList(s.split("")));
//// List<String> list2 = Arrays.asList(t.split(""));
// List list2 = new LinkedList(Arrays.asList(t.split("")));
//// int num = Integer.parseInt(arr[arr.length - 1]);
// list2.remove(arr2.length - 1);
//// System.out.println(list1);
//// System.out.println(list2);
// if(list1.toString().contentEquals(list2.toString())){
// System.out.println("Yes");
// }else{
// System.out.println("No");
// }
// switch(num){
// case 3:
// System.out.println("bon");
// break;
// case 0:
// case 1:
// case 6:
// case 8:
// System.out.println("pon");
// break;
// default:
// System.out.println("hon");
// break;
// }
// String[] array = str.split(" ");
// int sum = 0;
// for(int i=0; i<array.length; i++) {
// int num = Integer.parseInt(array[i]);
// sum += num;
// }
// System.out.println(15-sum);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
14,
2,
2,
18,
13,
13,
17,
2,
18,
13,
2,
13,
17,
17,
40,
13,
14,
2,
2,
2,
2,
2,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
2,
13,
17,
2,
2,
2,
18,
13,
17,
17,
2,
18,
13,
17,
17,
2,
13,
17,
2,
2,
18,
13,
17,
17,
2,
13,
17,
2,
2,
18,
13,
17,
17,
2,
13,
17,
0,
13,
17,
14,
2,
2,
18,
13,
13,
17,
2,
13,
17,
0,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
142,
5
],
[
142,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
8,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
8,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
39,
41
],
[
32,
42
],
[
42,
43
],
[
43,
44
],
[
32,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
53,
59
],
[
46,
60
],
[
60,
61
],
[
46,
62
],
[
62,
63
],
[
65,
64
],
[
96,
65
],
[
65,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
67,
78
],
[
78,
79
],
[
78,
80
],
[
65,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
82,
93
],
[
93,
94
],
[
93,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
96,
102
],
[
102,
103
],
[
102,
104
],
[
65,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
105,
111
],
[
111,
112
],
[
111,
113
],
[
62,
114
],
[
114,
115
],
[
114,
116
],
[
62,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
118,
124
],
[
124,
125
],
[
124,
126
],
[
117,
127
],
[
127,
128
],
[
127,
129
],
[
8,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
8,
136
],
[
136,
137
],
[
137,
138
],
[
6,
139
],
[
139,
140
],
[
0,
141
],
[
141,
142
],
[
141,
143
]
]
| [
"import java.util.*;\npublic class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner si=new Scanner(System.in);\n\t\tString str;\n\t\t\n\t\tstr=si.next();\n\t\t\n\t\tchar ch[]=str.toCharArray();\n\t\t\n\t\tint n=str.length(),count=1;\n\t\t\n\t\tfor(int i=0;i<n-1;i++)\n\t\t if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;\n\t\t\n\t\tSystem.out.println(count);\n\t\tsi.close();\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner si=new Scanner(System.in);\n\t\tString str;\n\t\t\n\t\tstr=si.next();\n\t\t\n\t\tchar ch[]=str.toCharArray();\n\t\t\n\t\tint n=str.length(),count=1;\n\t\t\n\t\tfor(int i=0;i<n-1;i++)\n\t\t if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;\n\t\t\n\t\tSystem.out.println(count);\n\t\tsi.close();\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner si=new Scanner(System.in);\n\t\tString str;\n\t\t\n\t\tstr=si.next();\n\t\t\n\t\tchar ch[]=str.toCharArray();\n\t\t\n\t\tint n=str.length(),count=1;\n\t\t\n\t\tfor(int i=0;i<n-1;i++)\n\t\t if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;\n\t\t\n\t\tSystem.out.println(count);\n\t\tsi.close();\n\t}",
"main",
"{\n\t\tScanner si=new Scanner(System.in);\n\t\tString str;\n\t\t\n\t\tstr=si.next();\n\t\t\n\t\tchar ch[]=str.toCharArray();\n\t\t\n\t\tint n=str.length(),count=1;\n\t\t\n\t\tfor(int i=0;i<n-1;i++)\n\t\t if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;\n\t\t\n\t\tSystem.out.println(count);\n\t\tsi.close();\n\t}",
"Scanner si=new Scanner(System.in);",
"si",
"new Scanner(System.in)",
"String str;",
"str",
"str=si.next()",
"str",
"si.next()",
"si.next",
"si",
"char ch[]=str.toCharArray();",
"ch",
"str.toCharArray()",
"str.toCharArray",
"str",
"int n=str.length()",
"n",
"str.length()",
"str.length",
"str",
"count=1;",
"count",
"1",
"for(int i=0;i<n-1;i++)\n\t\t if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;",
"if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;",
"ch[i]=='R' && ch[i+1]=='R'",
"ch[i]=='R'",
"ch[i]",
"ch",
"i",
"'R'",
"ch[i+1]=='R'",
"ch[i+1]",
"ch",
"i+1",
"i",
"1",
"'R'",
"count++",
"count",
"if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;",
"ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1",
"ch[0]=='R'&& count==1",
"ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1",
"ch[0]=='R' && ch[2]=='R' && count==1",
"ch[0]=='R' && ch[2]=='R' && count==1",
"ch[0]=='R'",
"ch[0]",
"ch",
"0",
"'R'",
"ch[2]=='R'",
"ch[2]",
"ch",
"2",
"'R'",
"count==1",
"count",
"1",
"ch[1]=='R' && ch[2]=='S' && count==1",
"ch[1]=='R' && ch[2]=='S' && count==1",
"ch[1]=='R'",
"ch[1]",
"ch",
"1",
"'R'",
"ch[2]=='S'",
"ch[2]",
"ch",
"2",
"'S'",
"count==1",
"count",
"1",
"ch[0]=='R'&& count==1",
"ch[0]=='R'",
"ch[0]",
"ch",
"0",
"'R'",
"count==1",
"count",
"1",
"ch[2]=='R'&& count==1",
"ch[2]=='R'",
"ch[2]",
"ch",
"2",
"'R'",
"count==1",
"count",
"1",
"count=1",
"count",
"1",
"if(ch[i]!='R' && count==1)\n\t\t count=0;",
"ch[i]!='R' && count==1",
"ch[i]!='R'",
"ch[i]",
"ch",
"i",
"'R'",
"count==1",
"count",
"1",
"count=0",
"count",
"0",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"si.close()",
"si.close",
"si",
"String[] args",
"args",
"public class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner si=new Scanner(System.in);\n\t\tString str;\n\t\t\n\t\tstr=si.next();\n\t\t\n\t\tchar ch[]=str.toCharArray();\n\t\t\n\t\tint n=str.length(),count=1;\n\t\t\n\t\tfor(int i=0;i<n-1;i++)\n\t\t if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;\n\t\t\n\t\tSystem.out.println(count);\n\t\tsi.close();\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String[] args) {\n\t\tScanner si=new Scanner(System.in);\n\t\tString str;\n\t\t\n\t\tstr=si.next();\n\t\t\n\t\tchar ch[]=str.toCharArray();\n\t\t\n\t\tint n=str.length(),count=1;\n\t\t\n\t\tfor(int i=0;i<n-1;i++)\n\t\t if(ch[i]=='R' && ch[i+1]=='R')\n\t\t count++;\n\t\t else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)\n\t\t count=1;\n\t\t else if(ch[i]!='R' && count==1)\n\t\t count=0;\n\t\t\n\t\tSystem.out.println(count);\n\t\tsi.close();\n\t}\n}",
"Main"
]
| import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner si=new Scanner(System.in);
String str;
str=si.next();
char ch[]=str.toCharArray();
int n=str.length(),count=1;
for(int i=0;i<n-1;i++)
if(ch[i]=='R' && ch[i+1]=='R')
count++;
else if(ch[0]=='R' && ch[2]=='R' && count==1||ch[1]=='R' && ch[2]=='S' && count==1|| ch[0]=='R'&& count==1 || ch[2]=='R'&& count==1)
count=1;
else if(ch[i]!='R' && count==1)
count=0;
System.out.println(count);
si.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
4,
18,
13,
41,
13,
17,
41,
13,
17,
28,
13,
13,
30,
30,
14,
2,
13,
17,
30,
0,
13,
4,
18,
13,
13,
13,
0,
13,
17,
14,
2,
13,
17,
30,
40,
13,
0,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
]
| [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
81,
14
],
[
81,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
17,
31
],
[
31,
32
],
[
31,
33
],
[
17,
34
],
[
34,
35
],
[
34,
36
],
[
17,
37
],
[
37,
38
],
[
37,
39
],
[
37,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
49,
53
],
[
46,
54
],
[
54,
55
],
[
54,
56
],
[
42,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
17,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
66,
69
],
[
66,
70
],
[
17,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
17,
75
],
[
75,
76
],
[
76,
77
],
[
15,
78
],
[
78,
79
],
[
0,
80
],
[
80,
81
],
[
80,
82
]
]
| [
"//package com.company;\nimport java.util.*;\nimport java.io.*;\nimport java.lang.*;\nimport java.math.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n char[] days = br.readLine().toCharArray();\n int max = 0;\n int curr = 0;\n for (char c : days) {\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }\n max = Math.max(curr, max);\n pw.println(max);\n pw.close();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.math.*;",
"math.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n char[] days = br.readLine().toCharArray();\n int max = 0;\n int curr = 0;\n for (char c : days) {\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }\n max = Math.max(curr, max);\n pw.println(max);\n pw.close();\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n char[] days = br.readLine().toCharArray();\n int max = 0;\n int curr = 0;\n for (char c : days) {\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }\n max = Math.max(curr, max);\n pw.println(max);\n pw.close();\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n char[] days = br.readLine().toCharArray();\n int max = 0;\n int curr = 0;\n for (char c : days) {\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }\n max = Math.max(curr, max);\n pw.println(max);\n pw.close();\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));",
"pw",
"new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)))",
"char[] days = br.readLine().toCharArray();",
"days",
"br.readLine().toCharArray()",
"br.readLine().toCharArray",
"br.readLine()",
"br.readLine",
"br",
"int max = 0;",
"max",
"0",
"int curr = 0;",
"curr",
"0",
"for (char c : days) {\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }",
"char c",
"days",
"{\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }",
"{\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }",
"if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }",
"c == 'S'",
"c",
"'S'",
"{\n max = Math.max(max, curr);\n curr = 0;\n }",
"max = Math.max(max, curr)",
"max",
"Math.max(max, curr)",
"Math.max",
"Math",
"max",
"curr",
"curr = 0",
"curr",
"0",
"if (c == 'R') {\n ++curr;\n }",
"c == 'R'",
"c",
"'R'",
"{\n ++curr;\n }",
"++curr",
"curr",
"max = Math.max(curr, max)",
"max",
"Math.max(curr, max)",
"Math.max",
"Math",
"curr",
"max",
"pw.println(max)",
"pw.println",
"pw",
"max",
"pw.close()",
"pw.close",
"pw",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n char[] days = br.readLine().toCharArray();\n int max = 0;\n int curr = 0;\n for (char c : days) {\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }\n max = Math.max(curr, max);\n pw.println(max);\n pw.close();\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n char[] days = br.readLine().toCharArray();\n int max = 0;\n int curr = 0;\n for (char c : days) {\n if (c == 'S') {\n max = Math.max(max, curr);\n curr = 0;\n } else if (c == 'R') {\n ++curr;\n }\n }\n max = Math.max(curr, max);\n pw.println(max);\n pw.close();\n }\n}",
"Main"
]
| //package com.company;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
char[] days = br.readLine().toCharArray();
int max = 0;
int curr = 0;
for (char c : days) {
if (c == 'S') {
max = Math.max(max, curr);
curr = 0;
} else if (c == 'R') {
++curr;
}
}
max = Math.max(curr, max);
pw.println(max);
pw.close();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.