node_ids
sequencelengths 4
1.4k
| edge_index
sequencelengths 1
2.22k
| text
sequencelengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
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,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
13,
2,
13,
17,
40,
13,
0,
13,
17,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
183,
5
],
[
183,
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
],
[
41,
44
],
[
6,
45
],
[
45,
46
],
[
183,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
53,
55
],
[
49,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
62,
72
],
[
72,
73
],
[
73,
74
],
[
62,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
87,
97
],
[
97,
98
],
[
97,
99
],
[
49,
100
],
[
100,
101
],
[
100,
102
],
[
100,
103
],
[
49,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
47,
110
],
[
110,
111
],
[
47,
112
],
[
112,
113
],
[
183,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
117,
127
],
[
127,
128
],
[
128,
129
],
[
117,
130
],
[
131,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
116,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
114,
152
],
[
152,
153
],
[
114,
154
],
[
154,
155
],
[
183,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
168,
169
],
[
168,
170
],
[
158,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
156,
176
],
[
176,
177
],
[
156,
178
],
[
178,
179
],
[
156,
180
],
[
180,
181
],
[
0,
182
],
[
182,
183
],
[
182,
184
]
] | [
"\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\tint n = sc.nextInt();\n\t\tint array[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(array, n);\n\n\t}\n\n\tpublic static void bubbleSort(int array[], int n) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(array, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void printArray(int array[], int n) {\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\t\tSystem.out.println(array[n - 1]);\n\t}\n\n\tpublic static void swap(int array[], int a, int b) {\n\t\tint tmp = array[a];\n\t\tarray[a] = array[b];\n\t\tarray[b] = tmp;\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\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint array[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(array, n);\n\n\t}\n\n\tpublic static void bubbleSort(int array[], int n) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(array, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void printArray(int array[], int n) {\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\t\tSystem.out.println(array[n - 1]);\n\t}\n\n\tpublic static void swap(int array[], int a, int b) {\n\t\tint tmp = array[a];\n\t\tarray[a] = array[b];\n\t\tarray[b] = tmp;\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\tint array[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(array, n);\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint array[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(array, n);\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int array[] = new int[n];",
"array",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarray[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tarray[i] = sc.nextInt();\n\t\t}",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"bubbleSort(array, n)",
"bubbleSort",
"array",
"n",
"String[] args",
"args",
"public static void bubbleSort(int array[], int n) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(array, n);\n\t\tSystem.out.println(count);\n\t}",
"bubbleSort",
"{\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(array, n);\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"while (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"array[j] < array[j - 1]",
"array[j]",
"array",
"j",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"swap(array, j, j - 1)",
"swap",
"array",
"j",
"j - 1",
"j",
"1",
"count++",
"count",
"flag = true",
"flag",
"true",
"printArray(array, n)",
"printArray",
"array",
"n",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int array[]",
"array",
"int n",
"n",
"public static void printArray(int array[], int n) {\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\t\tSystem.out.println(array[n - 1]);\n\t}",
"printArray",
"{\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\t\tSystem.out.println(array[n - 1]);\n\t}",
"for (int i = 0; i < n - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\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\tSystem.out.print(array[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}",
"System.out.print(array[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i] + \" \"",
"array[i]",
"array",
"i",
"\" \"",
"System.out.println(array[n - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[n - 1]",
"array",
"n - 1",
"n",
"1",
"int array[]",
"array",
"int n",
"n",
"public static void swap(int array[], int a, int b) {\n\t\tint tmp = array[a];\n\t\tarray[a] = array[b];\n\t\tarray[b] = tmp;\n\t}",
"swap",
"{\n\t\tint tmp = array[a];\n\t\tarray[a] = array[b];\n\t\tarray[b] = tmp;\n\t}",
"int tmp = array[a];",
"tmp",
"array[a]",
"array",
"a",
"array[a] = array[b]",
"array[a]",
"array",
"a",
"array[b]",
"array",
"b",
"array[b] = tmp",
"array[b]",
"array",
"b",
"tmp",
"int array[]",
"array",
"int a",
"a",
"int b",
"b",
"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\tint array[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(array, n);\n\n\t}\n\n\tpublic static void bubbleSort(int array[], int n) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(array, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void printArray(int array[], int n) {\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\t\tSystem.out.println(array[n - 1]);\n\t}\n\n\tpublic static void swap(int array[], int a, int b) {\n\t\tint tmp = array[a];\n\t\tarray[a] = array[b];\n\t\tarray[b] = tmp;\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 n = sc.nextInt();\n\t\tint array[] = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(array, n);\n\n\t}\n\n\tpublic static void bubbleSort(int array[], int n) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j > 0; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tswap(array, j, j - 1);\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(array, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void printArray(int array[], int n) {\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\t\tSystem.out.println(array[n - 1]);\n\t}\n\n\tpublic static void swap(int array[], int a, int b) {\n\t\tint tmp = array[a];\n\t\tarray[a] = array[b];\n\t\tarray[b] = tmp;\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();
int array[] = new int[n];
for (int i = 0; i < n; i++) {
array[i] = sc.nextInt();
}
bubbleSort(array, n);
}
public static void bubbleSort(int array[], int n) {
int count = 0;
boolean flag = true;
while (flag) {
flag = false;
for (int j = n - 1; j > 0; j--) {
if (array[j] < array[j - 1]) {
swap(array, j, j - 1);
count++;
flag = true;
}
}
}
printArray(array, n);
System.out.println(count);
}
public static void printArray(int array[], int n) {
for (int i = 0; i < n - 1; i++) {
System.out.print(array[i] + " ");
}
System.out.println(array[n - 1]);
}
public static void swap(int array[], int a, int b) {
int tmp = array[a];
array[a] = array[b];
array[b] = tmp;
}
}
|
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
41,
13,
2,
13,
17,
42,
2,
2,
13,
17,
2,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
30,
41,
13,
4,
18,
13,
2,
13,
17,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
4,
18,
13,
13,
13,
40,
13,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
4,
18,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
2,
4,
18,
13,
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
],
[
182,
11
],
[
182,
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
],
[
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
],
[
14,
45
],
[
45,
46
],
[
45,
47
],
[
12,
48
],
[
48,
49
],
[
182,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
56,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
85,
86
],
[
85,
87
],
[
81,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
76,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
92,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
92,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
111,
115
],
[
92,
116
],
[
116,
117
],
[
92,
118
],
[
118,
119
],
[
52,
120
],
[
120,
121
],
[
120,
122
],
[
52,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
50,
129
],
[
129,
130
],
[
182,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
141,
145
],
[
134,
146
],
[
146,
147
],
[
147,
148
],
[
134,
149
],
[
150,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
150,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
133,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
171,
172
],
[
172,
173
],
[
171,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
174,
178
],
[
131,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\tbubbleSort(list);\n\t}\n\n\tpublic static void bubbleSort(List<Integer> list) {\n\t\tint count = 0;\n\t\tfor (int i = 1; i < list.size(); i++) {\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tshowList(list);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void showList(List<Integer> list) {\n\t\tfor (int i = 0; i < list.size() - 1; i++) {\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(list.get(list.size() - 1));\n\t}\n}\n",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\tbubbleSort(list);\n\t}\n\n\tpublic static void bubbleSort(List<Integer> list) {\n\t\tint count = 0;\n\t\tfor (int i = 1; i < list.size(); i++) {\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tshowList(list);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void showList(List<Integer> list) {\n\t\tfor (int i = 0; i < list.size() - 1; i++) {\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(list.get(list.size() - 1));\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\tbubbleSort(list);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\tbubbleSort(list);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"List<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"for (int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tlist.add(scan.nextInt());\n\t\t}",
"{\n\t\t\tlist.add(scan.nextInt());\n\t\t}",
"list.add(scan.nextInt())",
"list.add",
"list",
"scan.nextInt()",
"scan.nextInt",
"scan",
"bubbleSort(list)",
"bubbleSort",
"list",
"String[] args",
"args",
"public static void bubbleSort(List<Integer> list) {\n\t\tint count = 0;\n\t\tfor (int i = 1; i < list.size(); i++) {\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tshowList(list);\n\t\tSystem.out.println(count);\n\t}",
"bubbleSort",
"{\n\t\tint count = 0;\n\t\tfor (int i = 1; i < list.size(); i++) {\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tshowList(list);\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"for (int i = 1; i < list.size(); i++) {\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < list.size()",
"i",
"list.size()",
"list.size",
"list",
"i++",
"i++",
"i",
"{\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int j = i - 1;",
"j",
"i - 1",
"i",
"1",
"while (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}",
"j >= 0 && list.get(j + 1) < list.get(j)",
"j >= 0",
"j",
"0",
"list.get(j + 1) < list.get(j)",
"list.get(j + 1)",
"list.get",
"list",
"j + 1",
"j",
"1",
"list.get(j)",
"list.get",
"list",
"j",
"{\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}",
"int tmp = list.get(j + 1);",
"tmp",
"list.get(j + 1)",
"list.get",
"list",
"j + 1",
"j",
"1",
"list.set(j + 1, list.get(j))",
"list.set",
"list",
"j + 1",
"j",
"1",
"list.get(j)",
"list.get",
"list",
"j",
"list.set(j, tmp)",
"list.set",
"list",
"j",
"tmp",
"j--",
"j",
"count++",
"count",
"showList(list)",
"showList",
"list",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"List<Integer> list",
"list",
"public static void showList(List<Integer> list) {\n\t\tfor (int i = 0; i < list.size() - 1; i++) {\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(list.get(list.size() - 1));\n\t}",
"showList",
"{\n\t\tfor (int i = 0; i < list.size() - 1; i++) {\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(list.get(list.size() - 1));\n\t}",
"for (int i = 0; i < list.size() - 1; i++) {\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < list.size() - 1",
"i",
"list.size() - 1",
"list.size()",
"list.size",
"list",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}",
"System.out.print(list.get(i))",
"System.out.print",
"System.out",
"System",
"System.out",
"list.get(i)",
"list.get",
"list",
"i",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(list.get(list.size() - 1))",
"System.out.println",
"System.out",
"System",
"System.out",
"list.get(list.size() - 1)",
"list.get",
"list",
"list.size() - 1",
"list.size()",
"list.size",
"list",
"1",
"List<Integer> list",
"list",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\tbubbleSort(list);\n\t}\n\n\tpublic static void bubbleSort(List<Integer> list) {\n\t\tint count = 0;\n\t\tfor (int i = 1; i < list.size(); i++) {\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tshowList(list);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void showList(List<Integer> list) {\n\t\tfor (int i = 0; i < list.size() - 1; i++) {\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(list.get(list.size() - 1));\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tlist.add(scan.nextInt());\n\t\t}\n\t\tbubbleSort(list);\n\t}\n\n\tpublic static void bubbleSort(List<Integer> list) {\n\t\tint count = 0;\n\t\tfor (int i = 1; i < list.size(); i++) {\n\t\t\tint j = i - 1;\n\t\t\twhile (j >= 0 && list.get(j + 1) < list.get(j)) {\n\t\t\t\tint tmp = list.get(j + 1);\n\t\t\t\tlist.set(j + 1, list.get(j));\n\t\t\t\tlist.set(j, tmp);\n\t\t\t\tj--;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tshowList(list);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void showList(List<Integer> list) {\n\t\tfor (int i = 0; i < list.size() - 1; i++) {\n\t\t\tSystem.out.print(list.get(i));\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(list.get(list.size() - 1));\n\t}\n}",
"Main"
] | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
List<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < N; i++) {
list.add(scan.nextInt());
}
bubbleSort(list);
}
public static void bubbleSort(List<Integer> list) {
int count = 0;
for (int i = 1; i < list.size(); i++) {
int j = i - 1;
while (j >= 0 && list.get(j + 1) < list.get(j)) {
int tmp = list.get(j + 1);
list.set(j + 1, list.get(j));
list.set(j, tmp);
j--;
count++;
}
}
showList(list);
System.out.println(count);
}
public static void showList(List<Integer> list) {
for (int i = 0; i < list.size() - 1; i++) {
System.out.print(list.get(i));
System.out.print(" ");
}
System.out.println(list.get(list.size() - 1));
}
}
|
[
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,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
17,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
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
],
[
190,
11
],
[
190,
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
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
32,
37
],
[
14,
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
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
61,
64
],
[
12,
65
],
[
65,
66
],
[
190,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
69,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
82,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
82,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
107,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
122,
128
],
[
107,
129
],
[
129,
130
],
[
129,
131
],
[
107,
132
],
[
132,
133
],
[
69,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
134,
144
],
[
144,
145
],
[
145,
146
],
[
134,
147
],
[
148,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
149,
155
],
[
155,
156
],
[
155,
157
],
[
148,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
158,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
69,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
69,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
179,
184
],
[
67,
185
],
[
185,
186
],
[
67,
187
],
[
187,
188
],
[
0,
189
],
[
189,
190
],
[
189,
191
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n\npublic class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????°\n\t\tint num = Integer.parseInt(bf.readLine());\n\t\t\n\t\t//??????????´?\n\t\tint[] array = new int[num];\n\t\t\n\t\t//?????????\n\t\tString[] arrayString = bf.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<num;i++){\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}\t\t\n\t\tbubbleSort(array,num);\n\t}\n\t\n\tprivate static void bubbleSort(int[] array, int num) {\n\t\tboolean flag=true;\n\t\tint count=0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<array.length;i++){\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\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\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????°\n\t\tint num = Integer.parseInt(bf.readLine());\n\t\t\n\t\t//??????????´?\n\t\tint[] array = new int[num];\n\t\t\n\t\t//?????????\n\t\tString[] arrayString = bf.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<num;i++){\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}\t\t\n\t\tbubbleSort(array,num);\n\t}\n\t\n\tprivate static void bubbleSort(int[] array, int num) {\n\t\tboolean flag=true;\n\t\tint count=0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<array.length;i++){\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????°\n\t\tint num = Integer.parseInt(bf.readLine());\n\t\t\n\t\t//??????????´?\n\t\tint[] array = new int[num];\n\t\t\n\t\t//?????????\n\t\tString[] arrayString = bf.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<num;i++){\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}\t\t\n\t\tbubbleSort(array,num);\n\t}",
"main",
"{\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????°\n\t\tint num = Integer.parseInt(bf.readLine());\n\t\t\n\t\t//??????????´?\n\t\tint[] array = new int[num];\n\t\t\n\t\t//?????????\n\t\tString[] arrayString = bf.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<num;i++){\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}\t\t\n\t\tbubbleSort(array,num);\n\t}",
"BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));",
"bf",
"new BufferedReader(new InputStreamReader(System.in))",
"int num = Integer.parseInt(bf.readLine());",
"num",
"Integer.parseInt(bf.readLine())",
"Integer.parseInt",
"Integer",
"bf.readLine()",
"bf.readLine",
"bf",
"int[] array = new int[num];",
"array",
"new int[num]",
"num",
"String[] arrayString = bf.readLine().split(\" \");",
"arrayString",
"bf.readLine().split(\" \")",
"bf.readLine().split",
"bf.readLine()",
"bf.readLine",
"bf",
"\" \"",
"for(int i=0;i<num;i++){\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}",
"{\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}",
"array[i]=Integer.parseInt(arrayString[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(arrayString[i])",
"Integer.parseInt",
"Integer",
"arrayString[i]",
"arrayString",
"i",
"bubbleSort(array,num)",
"bubbleSort",
"array",
"num",
"String[] args",
"args",
"private static void bubbleSort(int[] array, int num) {\n\t\tboolean flag=true;\n\t\tint count=0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<array.length;i++){\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"bubbleSort",
"{\n\t\tboolean flag=true;\n\t\tint count=0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<array.length;i++){\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"boolean flag=true;",
"flag",
"true",
"int count=0;",
"count",
"0",
"while(flag){\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag=false",
"flag",
"false",
"for(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int i=num-1;",
"int i=num-1;",
"i",
"num-1",
"num",
"1",
"i>=1",
"i",
"1",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"array[i]<array[i-1]",
"array[i]",
"array",
"i",
"array[i-1]",
"array",
"i-1",
"i",
"1",
"{\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp=array[i];",
"tmp",
"array[i]",
"array",
"i",
"array[i]=array[i-1]",
"array[i]",
"array",
"i",
"array[i-1]",
"array",
"i-1",
"i",
"1",
"array[i-1]=tmp",
"array[i-1]",
"array",
"i-1",
"i",
"1",
"tmp",
"flag=true",
"flag",
"true",
"count++",
"count",
"for(int i=0;i<array.length;i++){\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}",
"System.out.printf(\"%d\",array[i])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\"",
"array[i]",
"array",
"i",
"if(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}",
"i!=array.length-1",
"i",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"{\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}",
"System.out.printf(\" \")",
"System.out.printf",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int[] array",
"array",
"int num",
"num",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????°\n\t\tint num = Integer.parseInt(bf.readLine());\n\t\t\n\t\t//??????????´?\n\t\tint[] array = new int[num];\n\t\t\n\t\t//?????????\n\t\tString[] arrayString = bf.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<num;i++){\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}\t\t\n\t\tbubbleSort(array,num);\n\t}\n\t\n\tprivate static void bubbleSort(int[] array, int num) {\n\t\tboolean flag=true;\n\t\tint count=0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<array.length;i++){\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t//????????????????????????\n\t\tBufferedReader bf = new BufferedReader(new InputStreamReader(System.in));\n\t\t\n\t\t//?????°\n\t\tint num = Integer.parseInt(bf.readLine());\n\t\t\n\t\t//??????????´?\n\t\tint[] array = new int[num];\n\t\t\n\t\t//?????????\n\t\tString[] arrayString = bf.readLine().split(\" \");\n\t\t\n\t\tfor(int i=0;i<num;i++){\n\t\t\tarray[i]=Integer.parseInt(arrayString[i]);\n\t\t}\t\t\n\t\tbubbleSort(array,num);\n\t}\n\t\n\tprivate static void bubbleSort(int[] array, int num) {\n\t\tboolean flag=true;\n\t\tint count=0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag=false;\n\t\t\tfor(int i=num-1;i>=1;i--){\n\t\t\t\tif(array[i]<array[i-1]){\n\t\t\t\t\tint tmp=array[i];\n\t\t\t\t\tarray[i]=array[i-1];\n\t\t\t\t\tarray[i-1]=tmp;\n\t\t\t\t\tflag=true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i=0;i<array.length;i++){\n\t\t\tSystem.out.printf(\"%d\",array[i]);\n\t\t\tif(i!=array.length-1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
//????????????????????????
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
//?????°
int num = Integer.parseInt(bf.readLine());
//??????????´?
int[] array = new int[num];
//?????????
String[] arrayString = bf.readLine().split(" ");
for(int i=0;i<num;i++){
array[i]=Integer.parseInt(arrayString[i]);
}
bubbleSort(array,num);
}
private static void bubbleSort(int[] array, int num) {
boolean flag=true;
int count=0;
while(flag){
flag=false;
for(int i=num-1;i>=1;i--){
if(array[i]<array[i-1]){
int tmp=array[i];
array[i]=array[i-1];
array[i-1]=tmp;
flag=true;
count++;
}
}
}
for(int i=0;i<array.length;i++){
System.out.printf("%d",array[i]);
if(i!=array.length-1){
System.out.printf(" ");
}
}
System.out.println("");
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
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,
13,
13,
13,
4,
13,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
0,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
186,
8
],
[
186,
9
],
[
9,
10
],
[
186,
11
],
[
11,
12
],
[
11,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
13,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
13,
22
],
[
22,
23
],
[
22,
24
],
[
13,
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
],
[
13,
46
],
[
46,
47
],
[
46,
48
],
[
46,
49
],
[
13,
50
],
[
50,
51
],
[
50,
52
],
[
50,
53
],
[
50,
54
],
[
13,
55
],
[
55,
56
],
[
56,
57
],
[
11,
58
],
[
58,
59
],
[
186,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
75,
82
],
[
82,
83
],
[
82,
84
],
[
75,
85
],
[
85,
86
],
[
86,
87
],
[
75,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
90,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
100,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
100,
122
],
[
122,
123
],
[
122,
124
],
[
100,
125
],
[
125,
126
],
[
60,
127
],
[
127,
128
],
[
60,
129
],
[
129,
130
],
[
186,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
139,
141
],
[
134,
142
],
[
142,
143
],
[
143,
144
],
[
134,
145
],
[
146,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
146,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
158,
160
],
[
155,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
133,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
133,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
131,
179
],
[
179,
180
],
[
131,
181
],
[
181,
182
],
[
131,
183
],
[
183,
184
],
[
0,
185
],
[
185,
186
],
[
185,
187
]
] | [
"import java.io.IOException;\nimport java.util.Scanner;\npublic class Main {\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint[] a = new int[x];\n\n\t\tfor(int i=0;i<x;i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\n\t\tbubbleSort(a, x);\n\t\tshow(a, x, count);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] a, int x) {\n\t\tboolean flag = true;\n\t\tcount = 0;\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void show(int[] a, int x, int count2) {\n\t\tfor(int i=0;i<x;i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint[] a = new int[x];\n\n\t\tfor(int i=0;i<x;i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\n\t\tbubbleSort(a, x);\n\t\tshow(a, x, count);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] a, int x) {\n\t\tboolean flag = true;\n\t\tcount = 0;\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void show(int[] a, int x, int count2) {\n\t\tfor(int i=0;i<x;i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"static int count;",
"count",
"public static void main(String[] args) throws IOException{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint[] a = new int[x];\n\n\t\tfor(int i=0;i<x;i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\n\t\tbubbleSort(a, x);\n\t\tshow(a, x, count);\n\t\tsc.close();\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint[] a = new int[x];\n\n\t\tfor(int i=0;i<x;i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\n\t\tbubbleSort(a, x);\n\t\tshow(a, x, count);\n\t\tsc.close();\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int x = sc.nextInt();",
"x",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] a = new int[x];",
"a",
"new int[x]",
"x",
"for(int i=0;i<x;i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<x",
"i",
"x",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = sc.nextInt();\n\t\t}",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"bubbleSort(a, x)",
"bubbleSort",
"a",
"x",
"show(a, x, count)",
"show",
"a",
"x",
"count",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public static void bubbleSort(int[] a, int x) {\n\t\tboolean flag = true;\n\t\tcount = 0;\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"bubbleSort",
"{\n\t\tboolean flag = true;\n\t\tcount = 0;\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"boolean flag = true;",
"flag",
"true",
"count = 0",
"count",
"0",
"while(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int i=x-1;",
"int i=x-1;",
"i",
"x-1",
"x",
"1",
"i>0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"a[i]<a[i-1]",
"a[i]",
"a",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"{\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp = a[i];",
"tmp",
"a[i]",
"a",
"i",
"a[i] = a[i-1]",
"a[i]",
"a",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i-1] = tmp",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"tmp",
"flag = true",
"flag",
"true",
"count++",
"count",
"int[] a",
"a",
"int x",
"x",
"public static void show(int[] a, int x, int count2) {\n\t\tfor(int i=0;i<x;i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}",
"show",
"{\n\t\tfor(int i=0;i<x;i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}",
"for(int i=0;i<x;i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<x",
"i",
"x",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"System.out.print(a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"if(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i!=x-1",
"i",
"x-1",
"x",
"1",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int[] a",
"a",
"int x",
"x",
"int count2",
"count2",
"public class Main {\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint[] a = new int[x];\n\n\t\tfor(int i=0;i<x;i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\n\t\tbubbleSort(a, x);\n\t\tshow(a, x, count);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] a, int x) {\n\t\tboolean flag = true;\n\t\tcount = 0;\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void show(int[] a, int x, int count2) {\n\t\tfor(int i=0;i<x;i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint x = sc.nextInt();\n\t\tint[] a = new int[x];\n\n\t\tfor(int i=0;i<x;i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\n\t\tbubbleSort(a, x);\n\t\tshow(a, x, count);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] a, int x) {\n\t\tboolean flag = true;\n\t\tcount = 0;\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int i=x-1;i>0;i--) {\n\t\t\t\tif(a[i]<a[i-1]) {\n\t\t\t\t\tint tmp = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static void show(int[] a, int x, int count2) {\n\t\tfor(int i=0;i<x;i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=x-1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.util.Scanner;
public class Main {
static int count;
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int[] a = new int[x];
for(int i=0;i<x;i++) {
a[i] = sc.nextInt();
}
bubbleSort(a, x);
show(a, x, count);
sc.close();
}
public static void bubbleSort(int[] a, int x) {
boolean flag = true;
count = 0;
while(flag) {
flag = false;
for(int i=x-1;i>0;i--) {
if(a[i]<a[i-1]) {
int tmp = a[i];
a[i] = a[i-1];
a[i-1] = tmp;
flag = true;
count++;
}
}
}
}
public static void show(int[] a, int x, int count2) {
for(int i=0;i<x;i++) {
System.out.print(a[i]);
if(i!=x-1) {
System.out.print(" ");
}
}
System.out.println();
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
20,
23,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
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,
42,
13,
30,
0,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
4,
18,
36,
4,
18,
18,
13,
13,
13,
12,
13,
30,
4,
18,
18,
13,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
162,
5
],
[
162,
6
],
[
6,
7
],
[
162,
8
],
[
8,
9
],
[
162,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
10,
14
],
[
14,
15
],
[
162,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
18,
27
],
[
27,
28
],
[
27,
29
],
[
18,
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
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
18,
51
],
[
51,
52
],
[
51,
53
],
[
18,
54
],
[
54,
55
],
[
54,
56
],
[
18,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
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
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
76,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
86,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
86,
108
],
[
108,
109
],
[
86,
110
],
[
110,
111
],
[
110,
112
],
[
18,
113
],
[
113,
114
],
[
114,
115
],
[
18,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
162,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
130,
132
],
[
124,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
133,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
124,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] | [
"import java.util.Scanner;\npublic class Main {\n\tint n;\n\tint list[];\n\tpublic static void main(String args[]) {\n\t\tnew Main();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tlist = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist[i] = scan.nextInt();\n\t\t}\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.writeArray();\n\t\tSystem.out.println(cnt);\n\t}\n\tpublic void writeArray() {\n\t\tSystem.out.print(list[0]);\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tint n;\n\tint list[];\n\tpublic static void main(String args[]) {\n\t\tnew Main();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tlist = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist[i] = scan.nextInt();\n\t\t}\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.writeArray();\n\t\tSystem.out.println(cnt);\n\t}\n\tpublic void writeArray() {\n\t\tSystem.out.print(list[0]);\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}",
"Main",
"int n;",
"n",
"int list[];",
"list",
"public static void main(String args[]) {\n\t\tnew Main();\n\t}",
"main",
"{\n\t\tnew Main();\n\t}",
"new Main()",
"String args[]",
"args",
"Main() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tlist = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist[i] = scan.nextInt();\n\t\t}\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.writeArray();\n\t\tSystem.out.println(cnt);\n\t}",
"Main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tlist = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist[i] = scan.nextInt();\n\t\t}\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.writeArray();\n\t\tSystem.out.println(cnt);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"n = scan.nextInt()",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"list = new int[n]",
"list",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tlist[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tlist[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tlist[i] = scan.nextInt();\n\t\t}",
"list[i] = scan.nextInt()",
"list[i]",
"list",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"boolean flag = true;",
"flag",
"true",
"int cnt = 0;",
"cnt",
"0",
"while (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"list[i] < list[i-1]",
"list[i]",
"list",
"i",
"list[i-1]",
"list",
"i-1",
"i",
"1",
"{\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"int tmp = list[i];",
"tmp",
"list[i]",
"list",
"i",
"list[i] = list[i-1]",
"list[i]",
"list",
"i",
"list[i-1]",
"list",
"i-1",
"i",
"1",
"list[i-1] = tmp",
"list[i-1]",
"list",
"i-1",
"i",
"1",
"tmp",
"cnt++",
"cnt",
"flag = true",
"flag",
"true",
"this.writeArray()",
"this.writeArray",
"this",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"public void writeArray() {\n\t\tSystem.out.print(list[0]);\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}",
"writeArray",
"{\n\t\tSystem.out.print(list[0]);\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}",
"System.out.print(list[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"list[0]",
"list",
"0",
"for (int i = 1; i < n; i++) {\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}",
"{\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}",
"System.out.print(\" \" + list[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \" + list[i]",
"\" \"",
"list[i]",
"list",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"public class Main {\n\tint n;\n\tint list[];\n\tpublic static void main(String args[]) {\n\t\tnew Main();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tlist = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist[i] = scan.nextInt();\n\t\t}\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.writeArray();\n\t\tSystem.out.println(cnt);\n\t}\n\tpublic void writeArray() {\n\t\tSystem.out.print(list[0]);\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}",
"public class Main {\n\tint n;\n\tint list[];\n\tpublic static void main(String args[]) {\n\t\tnew Main();\n\t}\n\tMain() {\n\t\tScanner scan = new Scanner(System.in);\n\t\tn = scan.nextInt();\n\t\tlist = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tlist[i] = scan.nextInt();\n\t\t}\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = 1; i < n; i++) {\n\t\t\t\tif (list[i] < list[i-1]) {\n\t\t\t\t\tint tmp = list[i];\n\t\t\t\t\tlist[i] = list[i-1];\n\t\t\t\t\tlist[i-1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.writeArray();\n\t\tSystem.out.println(cnt);\n\t}\n\tpublic void writeArray() {\n\t\tSystem.out.print(list[0]);\n\t\tfor (int i = 1; i < n; i++) {\n\t\t\tSystem.out.print(\" \" + list[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
int n;
int list[];
public static void main(String args[]) {
new Main();
}
Main() {
Scanner scan = new Scanner(System.in);
n = scan.nextInt();
list = new int[n];
for (int i = 0; i < n; i++) {
list[i] = scan.nextInt();
}
boolean flag = true;
int cnt = 0;
while (flag) {
flag = false;
for (int i = 1; i < n; i++) {
if (list[i] < list[i-1]) {
int tmp = list[i];
list[i] = list[i-1];
list[i-1] = tmp;
cnt++;
flag = true;
}
}
}
this.writeArray();
System.out.println(cnt);
}
public void writeArray() {
System.out.print(list[0]);
for (int i = 1; i < n; i++) {
System.out.print(" " + list[i]);
}
System.out.println();
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
41,
13,
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,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
4,
18,
13,
17,
4,
18,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
179,
5
],
[
179,
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
],
[
30,
31
],
[
31,
32
],
[
30,
33
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
8,
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
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
64,
74
],
[
74,
75
],
[
75,
76
],
[
64,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
79,
86
],
[
86,
87
],
[
86,
88
],
[
79,
89
],
[
89,
90
],
[
90,
91
],
[
79,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
101,
103
],
[
94,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
104,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
104,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
119,
125
],
[
104,
126
],
[
126,
127
],
[
8,
128
],
[
128,
129
],
[
128,
130
],
[
8,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
142,
143
],
[
131,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
149,
150
],
[
149,
151
],
[
145,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
8,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
8,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
8,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
6,
176
],
[
176,
177
],
[
0,
178
],
[
178,
179
],
[
178,
180
]
] | [
"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\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari = line2.split(\" \");\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}\n\n\t\tint answer = 0;\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder str = new StringBuilder();\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}\n\t\tstr.append(num[n - 1]);\n\n\t\tSystem.out.println(str);\n\t\tSystem.out.println(answer);\n\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\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari = line2.split(\" \");\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}\n\n\t\tint answer = 0;\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder str = new StringBuilder();\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}\n\t\tstr.append(num[n - 1]);\n\n\t\tSystem.out.println(str);\n\t\tSystem.out.println(answer);\n\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\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari = line2.split(\" \");\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}\n\n\t\tint answer = 0;\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder str = new StringBuilder();\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}\n\t\tstr.append(num[n - 1]);\n\n\t\tSystem.out.println(str);\n\t\tSystem.out.println(answer);\n\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari = line2.split(\" \");\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}\n\n\t\tint answer = 0;\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder str = new StringBuilder();\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}\n\t\tstr.append(num[n - 1]);\n\n\t\tSystem.out.println(str);\n\t\tSystem.out.println(answer);\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String line1 = sc.nextLine();",
"line1",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int n = Integer.parseInt(line1);",
"n",
"Integer.parseInt(line1)",
"Integer.parseInt",
"Integer",
"line1",
"String line2 = sc.nextLine();",
"line2",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] kari = line2.split(\" \");",
"kari",
"line2.split(\" \")",
"line2.split",
"line2",
"\" \"",
"int[] num = new int[n];",
"num",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}",
"{\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}",
"num[i] = Integer.parseInt(kari[i])",
"num[i]",
"num",
"i",
"Integer.parseInt(kari[i])",
"Integer.parseInt",
"Integer",
"kari[i]",
"kari",
"i",
"int answer = 0;",
"answer",
"0",
"for (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\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\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}",
"if (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}",
"num[j - 1] > num[j]",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"num[j]",
"num",
"j",
"{\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}",
"int v = num[j];",
"v",
"num[j]",
"num",
"j",
"num[j] = num[j - 1]",
"num[j]",
"num",
"j",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"num[j - 1] = v",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"v",
"answer++",
"answer",
"StringBuilder str = new StringBuilder();",
"str",
"new StringBuilder()",
"for (int i = 0; i < n - 1; i++) {\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\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\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}",
"{\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}",
"str.append(num[i])",
"str.append",
"str",
"num[i]",
"num",
"i",
"str.append(\" \")",
"str.append",
"str",
"\" \"",
"str.append(num[n - 1])",
"str.append",
"str",
"num[n - 1]",
"num",
"n - 1",
"n",
"1",
"System.out.println(str)",
"System.out.println",
"System.out",
"System",
"System.out",
"str",
"System.out.println(answer)",
"System.out.println",
"System.out",
"System",
"System.out",
"answer",
"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\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari = line2.split(\" \");\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}\n\n\t\tint answer = 0;\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder str = new StringBuilder();\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}\n\t\tstr.append(num[n - 1]);\n\n\t\tSystem.out.println(str);\n\t\tSystem.out.println(answer);\n\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\tString line1 = sc.nextLine();\n\t\tint n = Integer.parseInt(line1);\n\n\t\tString line2 = sc.nextLine();\n\t\tString[] kari = line2.split(\" \");\n\t\tint[] num = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = Integer.parseInt(kari[i]);\n\t\t}\n\n\t\tint answer = 0;\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tfor (int j = n - 1; j > i; j--) {\n\t\t\t\tif (num[j - 1] > num[j]) {\n\t\t\t\t\tint v = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = v;\n\t\t\t\t\tanswer++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder str = new StringBuilder();\n\n\t\tfor (int i = 0; i < n - 1; i++) {\n\t\t\tstr.append(num[i]);\n\t\t\tstr.append(\" \");\n\t\t}\n\t\tstr.append(num[n - 1]);\n\n\t\tSystem.out.println(str);\n\t\tSystem.out.println(answer);\n\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);
String line1 = sc.nextLine();
int n = Integer.parseInt(line1);
String line2 = sc.nextLine();
String[] kari = line2.split(" ");
int[] num = new int[n];
for (int i = 0; i < n; i++) {
num[i] = Integer.parseInt(kari[i]);
}
int answer = 0;
for (int i = 0; i < n - 1; i++) {
for (int j = n - 1; j > i; j--) {
if (num[j - 1] > num[j]) {
int v = num[j];
num[j] = num[j - 1];
num[j - 1] = v;
answer++;
}
}
}
StringBuilder str = new StringBuilder();
for (int i = 0; i < n - 1; i++) {
str.append(num[i]);
str.append(" ");
}
str.append(num[n - 1]);
System.out.println(str);
System.out.println(answer);
}
} |
[
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,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
40,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
4,
18,
13,
17,
4,
18,
13,
2,
4,
18,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
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
],
[
191,
11
],
[
191,
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,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
38,
46
],
[
46,
47
],
[
47,
48
],
[
38,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
57,
59
],
[
14,
60
],
[
60,
61
],
[
60,
62
],
[
60,
63
],
[
12,
64
],
[
64,
65
],
[
191,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
72,
74
],
[
68,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
84,
91
],
[
91,
92
],
[
91,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
84,
97
],
[
98,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
109,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
124,
130
],
[
109,
131
],
[
131,
132
],
[
131,
133
],
[
109,
134
],
[
134,
135
],
[
80,
136
],
[
136,
137
],
[
68,
138
],
[
138,
139
],
[
138,
140
],
[
68,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
146,
148
],
[
141,
149
],
[
149,
150
],
[
150,
151
],
[
141,
152
],
[
153,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
157,
158
],
[
157,
159
],
[
153,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
68,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
167,
171
],
[
68,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
172,
177
],
[
177,
178
],
[
178,
179
],
[
68,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
180,
185
],
[
66,
186
],
[
186,
187
],
[
66,
188
],
[
188,
189
],
[
0,
190
],
[
190,
191
],
[
190,
192
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString AStr[] = br.readLine().split(\" \");\n\t\tint A[] = new int[n];\n\n\t\tfor(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);\n\n\t\tbubbleSort(n,A);\n\n\t}\n\n\tpublic static void bubbleSort(int n, int[] A){\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint y = 1;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = 0 ; i < n; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tSystem.out.println(sb.toString());\n\t\tSystem.out.println(count);\n\n\t}\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\tpublic static void main(String[] args) throws NumberFormatException, IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString AStr[] = br.readLine().split(\" \");\n\t\tint A[] = new int[n];\n\n\t\tfor(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);\n\n\t\tbubbleSort(n,A);\n\n\t}\n\n\tpublic static void bubbleSort(int n, int[] A){\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint y = 1;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = 0 ; i < n; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tSystem.out.println(sb.toString());\n\t\tSystem.out.println(count);\n\n\t}\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString AStr[] = br.readLine().split(\" \");\n\t\tint A[] = new int[n];\n\n\t\tfor(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);\n\n\t\tbubbleSort(n,A);\n\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString AStr[] = br.readLine().split(\" \");\n\t\tint A[] = new int[n];\n\n\t\tfor(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);\n\n\t\tbubbleSort(n,A);\n\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 AStr[] = br.readLine().split(\" \");",
"AStr",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int A[] = new int[n];",
"A",
"new int[n]",
"n",
"for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"A[i] = Integer.parseInt(AStr[i]);",
"A[i] = Integer.parseInt(AStr[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(AStr[i])",
"Integer.parseInt",
"Integer",
"AStr[i]",
"AStr",
"i",
"bubbleSort(n,A)",
"bubbleSort",
"n",
"A",
"String[] args",
"args",
"public static void bubbleSort(int n, int[] A){\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint y = 1;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = 0 ; i < n; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tSystem.out.println(sb.toString());\n\t\tSystem.out.println(count);\n\n\t}",
"bubbleSort",
"{\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint y = 1;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = 0 ; i < n; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tSystem.out.println(sb.toString());\n\t\tSystem.out.println(count);\n\n\t}",
"boolean flag = true;",
"flag",
"true",
"int count = 0;",
"count",
"0",
"int y = 1;",
"y",
"1",
"while(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}",
"flag = false",
"flag",
"false",
"for(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int i = n - 1 ;",
"int i = n - 1 ;",
"i",
"n - 1",
"n",
"1",
"y <= i",
"y",
"i",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"A[i] < A[i - 1]",
"A[i]",
"A",
"i",
"A[i - 1]",
"A",
"i - 1",
"i",
"1",
"{\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp = A[i];",
"tmp",
"A[i]",
"A",
"i",
"A[i] = A[i - 1]",
"A[i]",
"A",
"i",
"A[i - 1]",
"A",
"i - 1",
"i",
"1",
"A[i - 1] = tmp",
"A[i - 1]",
"A",
"i - 1",
"i",
"1",
"tmp",
"flag = true",
"flag",
"true",
"count++",
"count",
"y++",
"y",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for(int i = 0 ; i < n; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}",
"{\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}",
"sb.append(A[i])",
"sb.append",
"sb",
"A[i]",
"A",
"i",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"sb.deleteCharAt(sb.length() - 1)",
"sb.deleteCharAt",
"sb",
"sb.length() - 1",
"sb.length()",
"sb.length",
"sb",
"1",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int n",
"n",
"int[] A",
"A",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString AStr[] = br.readLine().split(\" \");\n\t\tint A[] = new int[n];\n\n\t\tfor(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);\n\n\t\tbubbleSort(n,A);\n\n\t}\n\n\tpublic static void bubbleSort(int n, int[] A){\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint y = 1;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = 0 ; i < n; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tSystem.out.println(sb.toString());\n\t\tSystem.out.println(count);\n\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString AStr[] = br.readLine().split(\" \");\n\t\tint A[] = new int[n];\n\n\t\tfor(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);\n\n\t\tbubbleSort(n,A);\n\n\t}\n\n\tpublic static void bubbleSort(int n, int[] A){\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint y = 1;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n - 1 ; y <= i ; i-- ){\n\t\t\t\tif(A[i] < A[i - 1]){\n\t\t\t\t\tint tmp = A[i];\n\t\t\t\t\tA[i] = A[i - 1];\n\t\t\t\t\tA[i - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ty++;\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i = 0 ; i < n; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tSystem.out.println(sb.toString());\n\t\tSystem.out.println(count);\n\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String AStr[] = br.readLine().split(" ");
int A[] = new int[n];
for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);
bubbleSort(n,A);
}
public static void bubbleSort(int n, int[] A){
boolean flag = true;
int count = 0;
int y = 1;
while(flag){
flag = false;
for(int i = n - 1 ; y <= i ; i-- ){
if(A[i] < A[i - 1]){
int tmp = A[i];
A[i] = A[i - 1];
A[i - 1] = tmp;
flag = true;
count++;
}
}
y++;
}
StringBuilder sb = new StringBuilder();
for(int i = 0 ; i < n; i++){
sb.append(A[i]);
sb.append(" ");
}
sb.deleteCharAt(sb.length() - 1);
System.out.println(sb.toString());
System.out.println(count);
}
} |
[
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,
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,
4,
13,
13,
13,
0,
13,
18,
13,
17,
4,
18,
13,
2,
17,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
2,
17,
18,
13,
13,
4,
18,
13,
4,
18,
13,
2,
18,
13,
17,
17,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
17,
41,
13,
17,
42,
17,
30,
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,
17,
4,
13,
13,
13,
2,
13,
17,
40,
13,
14,
40,
13,
30,
3,
0,
18,
13,
17,
13,
0,
18,
13,
17,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
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
],
[
228,
17
],
[
228,
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
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
20,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
20,
43
],
[
43,
44
],
[
43,
45
],
[
20,
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
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
67,
69
],
[
20,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
72,
75
],
[
20,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
20,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
20,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
89,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
20,
110
],
[
110,
111
],
[
111,
112
],
[
20,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
20,
121
],
[
121,
122
],
[
122,
123
],
[
18,
124
],
[
124,
125
],
[
228,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
142,
152
],
[
152,
153
],
[
153,
154
],
[
142,
155
],
[
156,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
157,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
171,
174
],
[
171,
175
],
[
175,
176
],
[
175,
177
],
[
167,
178
],
[
178,
179
],
[
138,
180
],
[
180,
181
],
[
181,
182
],
[
180,
183
],
[
183,
184
],
[
128,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
185,
189
],
[
128,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
128,
195
],
[
195,
196
],
[
126,
197
],
[
197,
198
],
[
126,
199
],
[
199,
200
],
[
228,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
206,
208
],
[
203,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
209,
213
],
[
213,
214
],
[
213,
215
],
[
203,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
216,
220
],
[
201,
221
],
[
221,
222
],
[
201,
223
],
[
223,
224
],
[
201,
225
],
[
225,
226
],
[
0,
227
],
[
227,
228
],
[
227,
229
]
] | [
"import java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStreamReader;\nimport java.io.OutputStreamWriter;\nimport java.io.IOException;\n\npublic class Main {\n\n public static void main(String args[]) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n int n = Integer.parseInt(br.readLine());\n String[] st = br.readLine().split(\" \");\n int[] data = new int[n];\n for (int i = 0; i < n; i++) {\n data[i] = Integer.parseInt(st[i]);\n }\n Object[] obj = bubbleSort(data, n);\n data = (int[]) obj[0];\n bw.append(\"\" + data[0]);\n for (int i = 1; i < n; i++) {\n bw.append(\" \" + data[i]);\n }\n bw.newLine();\n bw.append((int) obj[1] + \"\\n\");\n\n bw.flush();\n }\n\n static Object[] bubbleSort(int[] data, int n) {\n Object[] obj = new Object[2];\n int counting = 0;\n while (true) {\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }\n obj[0] = data;\n obj[1] = counting;\n return obj;\n }\n\n static void swap(int[] arr, int a, int b) {\n int tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n }\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.BufferedWriter;",
"BufferedWriter",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.OutputStreamWriter;",
"OutputStreamWriter",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"public class Main {\n\n public static void main(String args[]) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n int n = Integer.parseInt(br.readLine());\n String[] st = br.readLine().split(\" \");\n int[] data = new int[n];\n for (int i = 0; i < n; i++) {\n data[i] = Integer.parseInt(st[i]);\n }\n Object[] obj = bubbleSort(data, n);\n data = (int[]) obj[0];\n bw.append(\"\" + data[0]);\n for (int i = 1; i < n; i++) {\n bw.append(\" \" + data[i]);\n }\n bw.newLine();\n bw.append((int) obj[1] + \"\\n\");\n\n bw.flush();\n }\n\n static Object[] bubbleSort(int[] data, int n) {\n Object[] obj = new Object[2];\n int counting = 0;\n while (true) {\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }\n obj[0] = data;\n obj[1] = counting;\n return obj;\n }\n\n static void swap(int[] arr, int a, int b) {\n int tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n }\n\n}",
"Main",
"public static void main(String args[]) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n int n = Integer.parseInt(br.readLine());\n String[] st = br.readLine().split(\" \");\n int[] data = new int[n];\n for (int i = 0; i < n; i++) {\n data[i] = Integer.parseInt(st[i]);\n }\n Object[] obj = bubbleSort(data, n);\n data = (int[]) obj[0];\n bw.append(\"\" + data[0]);\n for (int i = 1; i < n; i++) {\n bw.append(\" \" + data[i]);\n }\n bw.newLine();\n bw.append((int) obj[1] + \"\\n\");\n\n bw.flush();\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n int n = Integer.parseInt(br.readLine());\n String[] st = br.readLine().split(\" \");\n int[] data = new int[n];\n for (int i = 0; i < n; i++) {\n data[i] = Integer.parseInt(st[i]);\n }\n Object[] obj = bubbleSort(data, n);\n data = (int[]) obj[0];\n bw.append(\"\" + data[0]);\n for (int i = 1; i < n; i++) {\n bw.append(\" \" + data[i]);\n }\n bw.newLine();\n bw.append((int) obj[1] + \"\\n\");\n\n bw.flush();\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));",
"bw",
"new BufferedWriter(new OutputStreamWriter(System.out))",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] st = br.readLine().split(\" \");",
"st",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] data = new int[n];",
"data",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n data[i] = Integer.parseInt(st[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n data[i] = Integer.parseInt(st[i]);\n }",
"{\n data[i] = Integer.parseInt(st[i]);\n }",
"data[i] = Integer.parseInt(st[i])",
"data[i]",
"data",
"i",
"Integer.parseInt(st[i])",
"Integer.parseInt",
"Integer",
"st[i]",
"st",
"i",
"Object[] obj = bubbleSort(data, n);",
"obj",
"bubbleSort(data, n)",
"bubbleSort",
"data",
"n",
"data = (int[]) obj[0]",
"data",
"(int[]) obj[0]",
"obj",
"0",
"bw.append(\"\" + data[0])",
"bw.append",
"bw",
"\"\" + data[0]",
"\"\"",
"data[0]",
"data",
"0",
"for (int i = 1; i < n; i++) {\n bw.append(\" \" + data[i]);\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n bw.append(\" \" + data[i]);\n }",
"{\n bw.append(\" \" + data[i]);\n }",
"bw.append(\" \" + data[i])",
"bw.append",
"bw",
"\" \" + data[i]",
"\" \"",
"data[i]",
"data",
"i",
"bw.newLine()",
"bw.newLine",
"bw",
"bw.append((int) obj[1] + \"\\n\")",
"bw.append",
"bw",
"(int) obj[1] + \"\\n\"",
"(int) obj[1]",
"obj",
"1",
"\"\\n\"",
"bw.flush()",
"bw.flush",
"bw",
"String args[]",
"args",
"static Object[] bubbleSort(int[] data, int n) {\n Object[] obj = new Object[2];\n int counting = 0;\n while (true) {\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }\n obj[0] = data;\n obj[1] = counting;\n return obj;\n }",
"bubbleSort",
"{\n Object[] obj = new Object[2];\n int counting = 0;\n while (true) {\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }\n obj[0] = data;\n obj[1] = counting;\n return obj;\n }",
"Object[] obj = new Object[2];",
"obj",
"new Object[2]",
"2",
"int counting = 0;",
"counting",
"0",
"while (true) {\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }",
"true",
"{\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }",
"boolean found = false;",
"found",
"false",
"for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n - 1",
"i",
"n - 1",
"n",
"1",
"i++",
"i++",
"i",
"{\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }",
"{\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }",
"if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }",
"data[i] > data[i + 1]",
"data[i]",
"data",
"i",
"data[i + 1]",
"data",
"i + 1",
"i",
"1",
"{\n found = true;\n swap(data, i, i + 1);\n counting++;\n }",
"found = true",
"found",
"true",
"swap(data, i, i + 1)",
"swap",
"data",
"i",
"i + 1",
"i",
"1",
"counting++",
"counting",
"if (!found) {\n break;\n }",
"!found",
"found",
"{\n break;\n }",
"break;",
"obj[0] = data",
"obj[0]",
"obj",
"0",
"data",
"obj[1] = counting",
"obj[1]",
"obj",
"1",
"counting",
"return obj;",
"obj",
"int[] data",
"data",
"int n",
"n",
"static void swap(int[] arr, int a, int b) {\n int tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n }",
"swap",
"{\n int tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n }",
"int tmp = arr[a];",
"tmp",
"arr[a]",
"arr",
"a",
"arr[a] = arr[b]",
"arr[a]",
"arr",
"a",
"arr[b]",
"arr",
"b",
"arr[b] = tmp",
"arr[b]",
"arr",
"b",
"tmp",
"int[] arr",
"arr",
"int a",
"a",
"int b",
"b",
"public class Main {\n\n public static void main(String args[]) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n int n = Integer.parseInt(br.readLine());\n String[] st = br.readLine().split(\" \");\n int[] data = new int[n];\n for (int i = 0; i < n; i++) {\n data[i] = Integer.parseInt(st[i]);\n }\n Object[] obj = bubbleSort(data, n);\n data = (int[]) obj[0];\n bw.append(\"\" + data[0]);\n for (int i = 1; i < n; i++) {\n bw.append(\" \" + data[i]);\n }\n bw.newLine();\n bw.append((int) obj[1] + \"\\n\");\n\n bw.flush();\n }\n\n static Object[] bubbleSort(int[] data, int n) {\n Object[] obj = new Object[2];\n int counting = 0;\n while (true) {\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }\n obj[0] = data;\n obj[1] = counting;\n return obj;\n }\n\n static void swap(int[] arr, int a, int b) {\n int tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n }\n\n}",
"public class Main {\n\n public static void main(String args[]) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));\n int n = Integer.parseInt(br.readLine());\n String[] st = br.readLine().split(\" \");\n int[] data = new int[n];\n for (int i = 0; i < n; i++) {\n data[i] = Integer.parseInt(st[i]);\n }\n Object[] obj = bubbleSort(data, n);\n data = (int[]) obj[0];\n bw.append(\"\" + data[0]);\n for (int i = 1; i < n; i++) {\n bw.append(\" \" + data[i]);\n }\n bw.newLine();\n bw.append((int) obj[1] + \"\\n\");\n\n bw.flush();\n }\n\n static Object[] bubbleSort(int[] data, int n) {\n Object[] obj = new Object[2];\n int counting = 0;\n while (true) {\n boolean found = false;\n for (int i = 0; i < n - 1; i++) {\n if (data[i] > data[i + 1]) {\n found = true;\n swap(data, i, i + 1);\n counting++;\n }\n }\n if (!found) {\n break;\n }\n }\n obj[0] = data;\n obj[1] = counting;\n return obj;\n }\n\n static void swap(int[] arr, int a, int b) {\n int tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n }\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.IOException;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(br.readLine());
String[] st = br.readLine().split(" ");
int[] data = new int[n];
for (int i = 0; i < n; i++) {
data[i] = Integer.parseInt(st[i]);
}
Object[] obj = bubbleSort(data, n);
data = (int[]) obj[0];
bw.append("" + data[0]);
for (int i = 1; i < n; i++) {
bw.append(" " + data[i]);
}
bw.newLine();
bw.append((int) obj[1] + "\n");
bw.flush();
}
static Object[] bubbleSort(int[] data, int n) {
Object[] obj = new Object[2];
int counting = 0;
while (true) {
boolean found = false;
for (int i = 0; i < n - 1; i++) {
if (data[i] > data[i + 1]) {
found = true;
swap(data, i, i + 1);
counting++;
}
}
if (!found) {
break;
}
}
obj[0] = data;
obj[1] = counting;
return obj;
}
static void swap(int[] arr, int a, int b) {
int tmp = arr[a];
arr[a] = arr[b];
arr[b] = tmp;
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
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,
11,
1,
41,
13,
17,
2,
13,
2,
2,
13,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
30,
4,
18,
13,
13,
13,
2,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
8,
2,
13,
17,
17,
17,
4,
18,
13,
13,
4,
18,
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
],
[
4,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
20,
28
],
[
28,
29
],
[
29,
30
],
[
20,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
35,
36
],
[
36,
37
],
[
11,
38
],
[
38,
39
],
[
38,
40
],
[
11,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
48,
50
],
[
41,
51
],
[
51,
52
],
[
52,
53
],
[
41,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
64,
64
],
[
64,
65
],
[
64,
66
],
[
64,
67
],
[
56,
68
],
[
68,
69
],
[
69,
70
],
[
56,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
75,
78
],
[
74,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
82,
83
],
[
82,
84
],
[
73,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
86,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
85,
94
],
[
94,
95
],
[
11,
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
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
115,
120
],
[
114,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
11,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
11,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
9,
136
],
[
136,
137
]
] | [
"import java.util.*;\n\nclass Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String args[]) {\n\t\t\n\t\tint n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor (int i=0; i<n; i++) list.add(sc.nextInt());\n\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor (int i=0; i<n-1; i++) {\n\t\t\t\n\t\t\tfor (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tSystem.out.print((i==0?\"\":\" \")+list.get(i));\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\t\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String args[]) {\n\t\t\n\t\tint n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor (int i=0; i<n; i++) list.add(sc.nextInt());\n\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor (int i=0; i<n-1; i++) {\n\t\t\t\n\t\t\tfor (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tSystem.out.print((i==0?\"\":\" \")+list.get(i));\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\t\n\t}\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String args[]) {\n\t\t\n\t\tint n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor (int i=0; i<n; i++) list.add(sc.nextInt());\n\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor (int i=0; i<n-1; i++) {\n\t\t\t\n\t\t\tfor (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tSystem.out.print((i==0?\"\":\" \")+list.get(i));\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\t\n\t}",
"main",
"{\n\t\t\n\t\tint n = sc.nextInt();\n\t\tArrayList<Integer> list = new ArrayList<>();\n\t\tfor (int i=0; i<n; i++) list.add(sc.nextInt());\n\t\t\n\t\t\n\t\tint count = 0;\n\t\tfor (int i=0; i<n-1; i++) {\n\t\t\t\n\t\t\tfor (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tSystem.out.print((i==0?\"\":\" \")+list.get(i));\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\t\n\t}",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ArrayList<Integer> list = new ArrayList<>();",
"list",
"new ArrayList<>()",
"for (int i=0; i<n; i++) list.add(sc.nextInt());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"list.add(sc.nextInt());",
"list.add(sc.nextInt())",
"list.add",
"list",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for (int i=0; i<n-1; i++) {\n\t\t\t\n\t\t\tfor (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\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\t\n\t\t\tfor (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}",
"{\n\t\t\t\n\t\t\tfor (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t}",
"for (int j=0; j<n-i-1; j++) {\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<n-i-1",
"j",
"n-i-1",
"n-i-1",
"n",
"i",
"1",
"j++",
"j++",
"j",
"{\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (list.get(j) > list.get(j+1)) {\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"list.get(j) > list.get(j+1)",
"list.get(j)",
"list.get",
"list",
"j",
"list.get(j+1)",
"list.get",
"list",
"j+1",
"j",
"1",
"{\n\t\t\t\t\tCollections.swap(list, j, j+1);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"Collections.swap(list, j, j+1)",
"Collections.swap",
"Collections",
"list",
"j",
"j+1",
"j",
"1",
"count++",
"count",
"for (int i=0; i<n; i++) {\n\t\t\tSystem.out.print((i==0?\"\":\" \")+list.get(i));\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print((i==0?\"\":\" \")+list.get(i));\n\t\t}",
"{\n\t\t\tSystem.out.print((i==0?\"\":\" \")+list.get(i));\n\t\t}",
"System.out.print((i==0?\"\":\" \")+list.get(i))",
"System.out.print",
"System.out",
"System",
"System.out",
"(i==0?\"\":\" \")+list.get(i)",
"(i==0?\"\":\" \")",
"i==0",
"i",
"0",
"\"\"",
"\" \"",
"list.get(i)",
"list.get",
"list",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String args[]",
"args"
] | import java.util.*;
class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String args[]) {
int n = sc.nextInt();
ArrayList<Integer> list = new ArrayList<>();
for (int i=0; i<n; i++) list.add(sc.nextInt());
int count = 0;
for (int i=0; i<n-1; i++) {
for (int j=0; j<n-i-1; j++) {
if (list.get(j) > list.get(j+1)) {
Collections.swap(list, j, j+1);
count++;
}
}
}
for (int i=0; i<n; i++) {
System.out.print((i==0?"":" ")+list.get(i));
}
System.out.println();
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
0,
13,
2,
13,
17,
2,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
18,
13,
13,
30,
4,
18,
18,
13,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
17,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
165,
5
],
[
165,
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
],
[
8,
19
],
[
19,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
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
],
[
54,
55
],
[
54,
56
],
[
50,
57
],
[
57,
58
],
[
57,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
50,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
65,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
65,
77
],
[
77,
78
],
[
78,
79
],
[
65,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
92,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
92,
114
],
[
114,
115
],
[
8,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
116,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
136,
142
],
[
142,
143
],
[
142,
144
],
[
129,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
146,
152
],
[
152,
153
],
[
152,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
155,
161
],
[
6,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] | [
"import java.util.Scanner;\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 int i ,j ,count = 0 ,a;\n int array[] = new int[N];\n\n for(i = 0;i < N;i++){\n array[i] = sc.nextInt();\n }\n\n for(i = N - 1;i > 0;i--){\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }\n\n for(i = 0;i < N;i++){\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }\n\n System.out.printf(\"%d\\n\",count);\n\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\n int N = sc.nextInt();\n int i ,j ,count = 0 ,a;\n int array[] = new int[N];\n\n for(i = 0;i < N;i++){\n array[i] = sc.nextInt();\n }\n\n for(i = N - 1;i > 0;i--){\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }\n\n for(i = 0;i < N;i++){\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }\n\n System.out.printf(\"%d\\n\",count);\n\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int i ,j ,count = 0 ,a;\n int array[] = new int[N];\n\n for(i = 0;i < N;i++){\n array[i] = sc.nextInt();\n }\n\n for(i = N - 1;i > 0;i--){\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }\n\n for(i = 0;i < N;i++){\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }\n\n System.out.printf(\"%d\\n\",count);\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n int i ,j ,count = 0 ,a;\n int array[] = new int[N];\n\n for(i = 0;i < N;i++){\n array[i] = sc.nextInt();\n }\n\n for(i = N - 1;i > 0;i--){\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }\n\n for(i = 0;i < N;i++){\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }\n\n System.out.printf(\"%d\\n\",count);\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int i",
"i",
"j",
"j",
"count = 0",
"count",
"0",
"a;",
"a",
"int array[] = new int[N];",
"array",
"new int[N]",
"N",
"for(i = 0;i < N;i++){\n array[i] = sc.nextInt();\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < N",
"i",
"N",
"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",
"for(i = N - 1;i > 0;i--){\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }",
"i = N - 1;",
"i = N - 1",
"i",
"N - 1",
"N",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }",
"{\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }",
"for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }",
"j = N - 1;",
"j = N - 1",
"j",
"N - 1",
"N",
"1",
"j >= N - i",
"j",
"N - i",
"N",
"i",
"j--",
"j--",
"j",
"{\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }",
"{\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }",
"if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }",
"array[j] < array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"{\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }",
"a = array[j]",
"a",
"array[j]",
"array",
"j",
"array[j] = array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j-1] = a",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"a",
"count++",
"count",
"for(i = 0;i < N;i++){\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }",
"{\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }",
"if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }",
"i <= N-2",
"i",
"N-2",
"N",
"2",
"{\n System.out.printf(\"%d \",array[i]);\n }",
"System.out.printf(\"%d \",array[i])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d \"",
"array[i]",
"array",
"i",
"{\n System.out.printf(\"%d\\n\",array[i]);\n }",
"System.out.printf(\"%d\\n\",array[i])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\\n\"",
"array[i]",
"array",
"i",
"System.out.printf(\"%d\\n\",count)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\\n\"",
"count",
"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 int i ,j ,count = 0 ,a;\n int array[] = new int[N];\n\n for(i = 0;i < N;i++){\n array[i] = sc.nextInt();\n }\n\n for(i = N - 1;i > 0;i--){\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }\n\n for(i = 0;i < N;i++){\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }\n\n System.out.printf(\"%d\\n\",count);\n\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 int i ,j ,count = 0 ,a;\n int array[] = new int[N];\n\n for(i = 0;i < N;i++){\n array[i] = sc.nextInt();\n }\n\n for(i = N - 1;i > 0;i--){\n for(j = N - 1;j >= N - i;j--){\n if(array[j] < array[j-1]){\n a = array[j];\n array[j] = array[j-1];\n array[j-1] = a;\n count++;\n }\n }\n }\n\n for(i = 0;i < N;i++){\n if(i <= N-2){\n System.out.printf(\"%d \",array[i]);\n }else{\n System.out.printf(\"%d\\n\",array[i]);\n }\n }\n\n System.out.printf(\"%d\\n\",count);\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 i ,j ,count = 0 ,a;
int array[] = new int[N];
for(i = 0;i < N;i++){
array[i] = sc.nextInt();
}
for(i = N - 1;i > 0;i--){
for(j = N - 1;j >= N - i;j--){
if(array[j] < array[j-1]){
a = array[j];
array[j] = array[j-1];
array[j-1] = a;
count++;
}
}
}
for(i = 0;i < N;i++){
if(i <= N-2){
System.out.printf("%d ",array[i]);
}else{
System.out.printf("%d\n",array[i]);
}
}
System.out.printf("%d\n",count);
}
}
|
[
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,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
18,
13,
13,
0,
18,
13,
13,
13,
41,
13,
4,
13,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
18,
13,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
4,
18,
13,
17,
4,
18,
13,
18,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
13,
2,
13,
17,
0,
13,
17,
29,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
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
],
[
267,
11
],
[
267,
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,
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
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
53,
56
],
[
56,
57
],
[
56,
58
],
[
50,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
14,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
14,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
12,
78
],
[
78,
79
],
[
267,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
83,
95
],
[
95,
96
],
[
96,
97
],
[
83,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
82,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
80,
122
],
[
122,
123
],
[
267,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
130,
142
],
[
142,
143
],
[
143,
144
],
[
130,
145
],
[
146,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
150,
151
],
[
150,
152
],
[
146,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
126,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
126,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
173,
174
],
[
124,
175
],
[
175,
176
],
[
267,
177
],
[
177,
178
],
[
177,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
183,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
190,
192
],
[
183,
193
],
[
193,
194
],
[
194,
195
],
[
183,
196
],
[
197,
197
],
[
197,
198
],
[
198,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
202,
206
],
[
198,
207
],
[
207,
208
],
[
207,
209
],
[
198,
210
],
[
210,
211
],
[
211,
212
],
[
198,
213
],
[
214,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
216,
220
],
[
220,
221
],
[
220,
222
],
[
222,
223
],
[
222,
224
],
[
215,
225
],
[
225,
226
],
[
226,
227
],
[
226,
228
],
[
226,
229
],
[
226,
230
],
[
230,
231
],
[
230,
232
],
[
225,
233
],
[
233,
234
],
[
233,
235
],
[
179,
236
],
[
236,
237
],
[
177,
238
],
[
238,
239
],
[
267,
240
],
[
240,
241
],
[
240,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
245,
247
],
[
242,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
248,
252
],
[
252,
253
],
[
252,
254
],
[
242,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
255,
259
],
[
240,
260
],
[
260,
261
],
[
240,
262
],
[
262,
263
],
[
240,
264
],
[
264,
265
],
[
0,
266
],
[
266,
267
],
[
266,
268
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class Main {\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());\n \n //set array\n String[] st = br.readLine().split(\" \");\n int[] array = new int[n];\n for (int i = 0; i < n; i++){\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }\n \n int count = bubbleSort(array);\n printArray(array);\n System.out.println(count);\n \n }\n static void printArray(int[] arr){\n for (int i = 0; i < arr.length - 1; i++){\n System.out.print(arr[i] + \" \");\n }\n System.out.println(arr[arr.length-1]);\n }\n static void printArray2(int[] arr){\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < arr.length - 1; i++){\n sb.append(arr[i]);\n sb.append(\" \");\n }\n sb.append(arr[arr.length - 1]);\n System.out.println(sb.toString());\n }\n static int bubbleSort(int[] arr){\n //bubble sort and count swaps\n int swapcnt = 0;\n for (int i = 0; i < arr.length; i++){\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }\n return swapcnt;\n }\n static void swap(int[] arr, int i, int j){\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"public class Main {\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());\n \n //set array\n String[] st = br.readLine().split(\" \");\n int[] array = new int[n];\n for (int i = 0; i < n; i++){\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }\n \n int count = bubbleSort(array);\n printArray(array);\n System.out.println(count);\n \n }\n static void printArray(int[] arr){\n for (int i = 0; i < arr.length - 1; i++){\n System.out.print(arr[i] + \" \");\n }\n System.out.println(arr[arr.length-1]);\n }\n static void printArray2(int[] arr){\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < arr.length - 1; i++){\n sb.append(arr[i]);\n sb.append(\" \");\n }\n sb.append(arr[arr.length - 1]);\n System.out.println(sb.toString());\n }\n static int bubbleSort(int[] arr){\n //bubble sort and count swaps\n int swapcnt = 0;\n for (int i = 0; i < arr.length; i++){\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }\n return swapcnt;\n }\n static void swap(int[] arr, int i, int j){\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\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());\n \n //set array\n String[] st = br.readLine().split(\" \");\n int[] array = new int[n];\n for (int i = 0; i < n; i++){\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }\n \n int count = bubbleSort(array);\n printArray(array);\n System.out.println(count);\n \n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n \n //set array\n String[] st = br.readLine().split(\" \");\n int[] array = new int[n];\n for (int i = 0; i < n; i++){\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }\n \n int count = bubbleSort(array);\n printArray(array);\n System.out.println(count);\n \n }",
"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[] st = br.readLine().split(\" \");",
"st",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"for (int i = 0; i < n; i++){\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }",
"{\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }",
"int a = Integer.parseInt(st[i]);",
"a",
"Integer.parseInt(st[i])",
"Integer.parseInt",
"Integer",
"st[i]",
"st",
"i",
"array[i] = a",
"array[i]",
"array",
"i",
"a",
"int count = bubbleSort(array);",
"count",
"bubbleSort(array)",
"bubbleSort",
"array",
"printArray(array)",
"printArray",
"array",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static void printArray(int[] arr){\n for (int i = 0; i < arr.length - 1; i++){\n System.out.print(arr[i] + \" \");\n }\n System.out.println(arr[arr.length-1]);\n }",
"printArray",
"{\n for (int i = 0; i < arr.length - 1; i++){\n System.out.print(arr[i] + \" \");\n }\n System.out.println(arr[arr.length-1]);\n }",
"for (int i = 0; i < arr.length - 1; i++){\n System.out.print(arr[i] + \" \");\n }",
"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 System.out.print(arr[i] + \" \");\n }",
"{\n System.out.print(arr[i] + \" \");\n }",
"System.out.print(arr[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"arr[i] + \" \"",
"arr[i]",
"arr",
"i",
"\" \"",
"System.out.println(arr[arr.length-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"arr[arr.length-1]",
"arr",
"arr.length-1",
"arr.length",
"arr",
"arr.length",
"1",
"int[] arr",
"arr",
"static void printArray2(int[] arr){\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < arr.length - 1; i++){\n sb.append(arr[i]);\n sb.append(\" \");\n }\n sb.append(arr[arr.length - 1]);\n System.out.println(sb.toString());\n }",
"printArray2",
"{\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < arr.length - 1; i++){\n sb.append(arr[i]);\n sb.append(\" \");\n }\n sb.append(arr[arr.length - 1]);\n System.out.println(sb.toString());\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (int i = 0; i < arr.length - 1; i++){\n sb.append(arr[i]);\n sb.append(\" \");\n }",
"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 sb.append(arr[i]);\n sb.append(\" \");\n }",
"{\n sb.append(arr[i]);\n sb.append(\" \");\n }",
"sb.append(arr[i])",
"sb.append",
"sb",
"arr[i]",
"arr",
"i",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"sb.append(arr[arr.length - 1])",
"sb.append",
"sb",
"arr[arr.length - 1]",
"arr",
"arr.length - 1",
"arr.length",
"arr",
"arr.length",
"1",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"int[] arr",
"arr",
"static int bubbleSort(int[] arr){\n //bubble sort and count swaps\n int swapcnt = 0;\n for (int i = 0; i < arr.length; i++){\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }\n return swapcnt;\n }",
"bubbleSort",
"{\n //bubble sort and count swaps\n int swapcnt = 0;\n for (int i = 0; i < arr.length; i++){\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }\n return swapcnt;\n }",
"int swapcnt = 0;",
"swapcnt",
"0",
"for (int i = 0; i < arr.length; i++){\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }",
"{\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }",
"for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }",
"int j = arr.length - 1;",
"int j = arr.length - 1;",
"j",
"arr.length - 1",
"arr.length",
"arr",
"arr.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }",
"{\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }",
"if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }",
"arr[j] < arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"{\n swap(arr, j, j - 1);\n swapcnt += 1;\n }",
"swap(arr, j, j - 1)",
"swap",
"arr",
"j",
"j - 1",
"j",
"1",
"swapcnt += 1",
"swapcnt",
"1",
"return swapcnt;",
"swapcnt",
"int[] arr",
"arr",
"static void swap(int[] arr, int i, int j){\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }",
"swap",
"{\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }",
"int tmp = arr[i];",
"tmp",
"arr[i]",
"arr",
"i",
"arr[i] = arr[j]",
"arr[i]",
"arr",
"i",
"arr[j]",
"arr",
"j",
"arr[j] = tmp",
"arr[j]",
"arr",
"j",
"tmp",
"int[] arr",
"arr",
"int i",
"i",
"int j",
"j",
"public class Main {\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());\n \n //set array\n String[] st = br.readLine().split(\" \");\n int[] array = new int[n];\n for (int i = 0; i < n; i++){\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }\n \n int count = bubbleSort(array);\n printArray(array);\n System.out.println(count);\n \n }\n static void printArray(int[] arr){\n for (int i = 0; i < arr.length - 1; i++){\n System.out.print(arr[i] + \" \");\n }\n System.out.println(arr[arr.length-1]);\n }\n static void printArray2(int[] arr){\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < arr.length - 1; i++){\n sb.append(arr[i]);\n sb.append(\" \");\n }\n sb.append(arr[arr.length - 1]);\n System.out.println(sb.toString());\n }\n static int bubbleSort(int[] arr){\n //bubble sort and count swaps\n int swapcnt = 0;\n for (int i = 0; i < arr.length; i++){\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }\n return swapcnt;\n }\n static void swap(int[] arr, int i, int j){\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n}",
"public class Main {\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());\n \n //set array\n String[] st = br.readLine().split(\" \");\n int[] array = new int[n];\n for (int i = 0; i < n; i++){\n int a = Integer.parseInt(st[i]);\n array[i] = a;\n }\n \n int count = bubbleSort(array);\n printArray(array);\n System.out.println(count);\n \n }\n static void printArray(int[] arr){\n for (int i = 0; i < arr.length - 1; i++){\n System.out.print(arr[i] + \" \");\n }\n System.out.println(arr[arr.length-1]);\n }\n static void printArray2(int[] arr){\n StringBuilder sb = new StringBuilder();\n for (int i = 0; i < arr.length - 1; i++){\n sb.append(arr[i]);\n sb.append(\" \");\n }\n sb.append(arr[arr.length - 1]);\n System.out.println(sb.toString());\n }\n static int bubbleSort(int[] arr){\n //bubble sort and count swaps\n int swapcnt = 0;\n for (int i = 0; i < arr.length; i++){\n for (int j = arr.length - 1; j > i; j--){\n if ( arr[j] < arr[j-1]){\n swap(arr, j, j - 1);\n swapcnt += 1;\n }\n }\n }\n return swapcnt;\n }\n static void swap(int[] arr, int i, int j){\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
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());
//set array
String[] st = br.readLine().split(" ");
int[] array = new int[n];
for (int i = 0; i < n; i++){
int a = Integer.parseInt(st[i]);
array[i] = a;
}
int count = bubbleSort(array);
printArray(array);
System.out.println(count);
}
static void printArray(int[] arr){
for (int i = 0; i < arr.length - 1; i++){
System.out.print(arr[i] + " ");
}
System.out.println(arr[arr.length-1]);
}
static void printArray2(int[] arr){
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.length - 1; i++){
sb.append(arr[i]);
sb.append(" ");
}
sb.append(arr[arr.length - 1]);
System.out.println(sb.toString());
}
static int bubbleSort(int[] arr){
//bubble sort and count swaps
int swapcnt = 0;
for (int i = 0; i < arr.length; i++){
for (int j = arr.length - 1; j > i; j--){
if ( arr[j] < arr[j-1]){
swap(arr, j, j - 1);
swapcnt += 1;
}
}
}
return swapcnt;
}
static void swap(int[] arr, int i, int j){
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
0,
18,
13,
13,
13,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
0,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
11,
1,
0,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
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
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
8,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
33,
43
],
[
43,
44
],
[
44,
45
],
[
33,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
73,
74
],
[
73,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
66,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
81,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
91,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
91,
113
],
[
113,
114
],
[
91,
115
],
[
115,
116
],
[
115,
117
],
[
8,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
118,
130
],
[
130,
131
],
[
131,
132
],
[
118,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
8,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
150,
151
],
[
150,
152
],
[
8,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
6,
159
],
[
159,
160
]
] | [
"import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n\tint i;\n\tint j;\n\tint v;\n\tint flag = 1;\n\tint count = 0;\n\t\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tint A[] = new int[n];\n\n\t//Initialize data\n\tfor(i=0 ; i<A.length ; i++){\n\t int num = scan.nextInt();\n\t A[i] = num;\n\t}\n\t\n\twhile( flag==1 ){\n\t flag = 0;\n\t for(j=n-1 ; j>0 ; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }\n\t}\n\t\n\tfor(i=0 ; i<A.length-1 ; i++){\n\t System.out.print(A[i]+\" \");\n\t }\n\tSystem.out.println(A[i]);\n\tSystem.out.println(count);\n }\n \n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n public static void main(String[] args){\n\tint i;\n\tint j;\n\tint v;\n\tint flag = 1;\n\tint count = 0;\n\t\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tint A[] = new int[n];\n\n\t//Initialize data\n\tfor(i=0 ; i<A.length ; i++){\n\t int num = scan.nextInt();\n\t A[i] = num;\n\t}\n\t\n\twhile( flag==1 ){\n\t flag = 0;\n\t for(j=n-1 ; j>0 ; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }\n\t}\n\t\n\tfor(i=0 ; i<A.length-1 ; i++){\n\t System.out.print(A[i]+\" \");\n\t }\n\tSystem.out.println(A[i]);\n\tSystem.out.println(count);\n }\n \n}",
"Main",
"public static void main(String[] args){\n\tint i;\n\tint j;\n\tint v;\n\tint flag = 1;\n\tint count = 0;\n\t\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tint A[] = new int[n];\n\n\t//Initialize data\n\tfor(i=0 ; i<A.length ; i++){\n\t int num = scan.nextInt();\n\t A[i] = num;\n\t}\n\t\n\twhile( flag==1 ){\n\t flag = 0;\n\t for(j=n-1 ; j>0 ; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }\n\t}\n\t\n\tfor(i=0 ; i<A.length-1 ; i++){\n\t System.out.print(A[i]+\" \");\n\t }\n\tSystem.out.println(A[i]);\n\tSystem.out.println(count);\n }",
"main",
"{\n\tint i;\n\tint j;\n\tint v;\n\tint flag = 1;\n\tint count = 0;\n\t\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tint A[] = new int[n];\n\n\t//Initialize data\n\tfor(i=0 ; i<A.length ; i++){\n\t int num = scan.nextInt();\n\t A[i] = num;\n\t}\n\t\n\twhile( flag==1 ){\n\t flag = 0;\n\t for(j=n-1 ; j>0 ; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }\n\t}\n\t\n\tfor(i=0 ; i<A.length-1 ; i++){\n\t System.out.print(A[i]+\" \");\n\t }\n\tSystem.out.println(A[i]);\n\tSystem.out.println(count);\n }",
"int i;",
"i",
"int j;",
"j",
"int v;",
"v",
"int flag = 1;",
"flag",
"1",
"int count = 0;",
"count",
"0",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int A[] = new int[n];",
"A",
"new int[n]",
"n",
"for(i=0 ; i<A.length ; i++){\n\t int num = scan.nextInt();\n\t A[i] = num;\n\t}",
"i=0 ;",
"i=0",
"i",
"0",
"i<A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n\t int num = scan.nextInt();\n\t A[i] = num;\n\t}",
"{\n\t int num = scan.nextInt();\n\t A[i] = num;\n\t}",
"int num = scan.nextInt();",
"num",
"scan.nextInt()",
"scan.nextInt",
"scan",
"A[i] = num",
"A[i]",
"A",
"i",
"num",
"while( flag==1 ){\n\t flag = 0;\n\t for(j=n-1 ; j>0 ; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }\n\t}",
"flag==1",
"flag",
"1",
"{\n\t flag = 0;\n\t for(j=n-1 ; j>0 ; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }\n\t}",
"flag = 0",
"flag",
"0",
"for(j=n-1 ; j>0 ; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }",
"j=n-1 ;",
"j=n-1",
"j",
"n-1",
"n",
"1",
"j>0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }",
"{\n\t\tif(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}\n\t }",
"if(A[j] < A[j-1]){\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t v = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = v;\n\t\t count++;\n\t\t flag = 1;\n\t\t}",
"v = A[j]",
"v",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = v",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"v",
"count++",
"count",
"flag = 1",
"flag",
"1",
"for(i=0 ; i<A.length-1 ; i++){\n\t System.out.print(A[i]+\" \");\n\t }",
"i=0 ;",
"i=0",
"i",
"0",
"i<A.length-1",
"i",
"A.length-1",
"A.length",
"A",
"A.length",
"1",
"i++",
"i++",
"i",
"{\n\t System.out.print(A[i]+\" \");\n\t }",
"{\n\t System.out.print(A[i]+\" \");\n\t }",
"System.out.print(A[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]+\" \"",
"A[i]",
"A",
"i",
"\" \"",
"System.out.println(A[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static void main(String[] args){
int i;
int j;
int v;
int flag = 1;
int count = 0;
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int A[] = new int[n];
//Initialize data
for(i=0 ; i<A.length ; i++){
int num = scan.nextInt();
A[i] = num;
}
while( flag==1 ){
flag = 0;
for(j=n-1 ; j>0 ; j--){
if(A[j] < A[j-1]){
v = A[j];
A[j] = A[j-1];
A[j-1] = v;
count++;
flag = 1;
}
}
}
for(i=0 ; i<A.length-1 ; i++){
System.out.print(A[i]+" ");
}
System.out.println(A[i]);
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
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,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
13,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
4,
18,
18,
13,
13,
2,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
18,
13,
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
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
18,
20
],
[
11,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
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
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
50,
62
],
[
62,
63
],
[
63,
64
],
[
50,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
67,
76
],
[
76,
77
],
[
76,
78
],
[
67,
79
],
[
79,
80
],
[
80,
81
],
[
67,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
94,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
94,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
112,
118
],
[
94,
119
],
[
119,
120
],
[
11,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
121,
133
],
[
133,
134
],
[
134,
135
],
[
121,
136
],
[
137,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
137,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
148,
149
],
[
148,
150
],
[
11,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
11,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
9,
169
],
[
169,
170
]
] | [
"import java.io.*;\nimport java.util.*;\n \nclass Main{\n public static void main(String[] args) {\n int narabi =0;\n int count =0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] array = new int[n];\n for(int i=0; i<n; i++){\n array[i] = sc.nextInt();\n }\n \n for(int i=0; i<array.length-1; i++){\n for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }\n }\n for(int k =0; k<array.length-1; k++){\n int number = array[k];\n System.out.print(number + \" \");\n }\n System.out.println(array[array.length-1]);\n System.out.println(count);\n }\n\n }",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args) {\n int narabi =0;\n int count =0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] array = new int[n];\n for(int i=0; i<n; i++){\n array[i] = sc.nextInt();\n }\n \n for(int i=0; i<array.length-1; i++){\n for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }\n }\n for(int k =0; k<array.length-1; k++){\n int number = array[k];\n System.out.print(number + \" \");\n }\n System.out.println(array[array.length-1]);\n System.out.println(count);\n }\n\n }",
"Main",
"public static void main(String[] args) {\n int narabi =0;\n int count =0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] array = new int[n];\n for(int i=0; i<n; i++){\n array[i] = sc.nextInt();\n }\n \n for(int i=0; i<array.length-1; i++){\n for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }\n }\n for(int k =0; k<array.length-1; k++){\n int number = array[k];\n System.out.print(number + \" \");\n }\n System.out.println(array[array.length-1]);\n System.out.println(count);\n }",
"main",
"{\n int narabi =0;\n int count =0;\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int [] array = new int[n];\n for(int i=0; i<n; i++){\n array[i] = sc.nextInt();\n }\n \n for(int i=0; i<array.length-1; i++){\n for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }\n }\n for(int k =0; k<array.length-1; k++){\n int number = array[k];\n System.out.print(number + \" \");\n }\n System.out.println(array[array.length-1]);\n System.out.println(count);\n }",
"int narabi =0;",
"narabi",
"0",
"int count =0;",
"count",
"0",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int [] array = new int[n];",
"array",
"new int[n]",
"n",
"for(int i=0; i<n; i++){\n array[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"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",
"for(int i=0; i<array.length-1; i++){\n for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length-1",
"i",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"i++",
"i++",
"i",
"{\n for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }\n }",
"{\n for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }\n }",
"for(int j=array.length-1; j>0; j--){\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }",
"int j=array.length-1;",
"int j=array.length-1;",
"j",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"j>0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }",
"{\n if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }\n }",
"if(array[j] < array[j-1]){\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }",
"array[j] < array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"{\n int a = array[j];\n int b = array[j-1];\n array[j] = b;\n array[j-1]= a;\n count++;\n }",
"int a = array[j];",
"a",
"array[j]",
"array",
"j",
"int b = array[j-1];",
"b",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j] = b",
"array[j]",
"array",
"j",
"b",
"array[j-1]= a",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"a",
"count++",
"count",
"for(int k =0; k<array.length-1; k++){\n int number = array[k];\n System.out.print(number + \" \");\n }",
"int k =0;",
"int k =0;",
"k",
"0",
"k<array.length-1",
"k",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"k++",
"k++",
"k",
"{\n int number = array[k];\n System.out.print(number + \" \");\n }",
"{\n int number = array[k];\n System.out.print(number + \" \");\n }",
"int number = array[k];",
"number",
"array[k]",
"array",
"k",
"System.out.print(number + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"number + \" \"",
"number",
"\" \"",
"System.out.println(array[array.length-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[array.length-1]",
"array",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.io.*;
import java.util.*;
class Main{
public static void main(String[] args) {
int narabi =0;
int count =0;
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] array = new int[n];
for(int i=0; i<n; i++){
array[i] = sc.nextInt();
}
for(int i=0; i<array.length-1; i++){
for(int j=array.length-1; j>0; j--){
if(array[j] < array[j-1]){
int a = array[j];
int b = array[j-1];
array[j] = b;
array[j-1]= a;
count++;
}
}
}
for(int k =0; k<array.length-1; k++){
int number = array[k];
System.out.print(number + " ");
}
System.out.println(array[array.length-1]);
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
41,
13,
41,
13,
17,
41,
13,
17,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
0,
13,
20,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
20,
17,
42,
4,
18,
13,
30,
0,
18,
13,
13,
4,
18,
13,
40,
13,
0,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
40,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
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
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
23,
25
],
[
11,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
33,
36
],
[
11,
37
],
[
37,
38
],
[
11,
39
],
[
39,
40
],
[
39,
41
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
46,
47
],
[
11,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
51,
52
],
[
50,
53
],
[
11,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
58,
66
],
[
66,
67
],
[
11,
68
],
[
68,
69
],
[
68,
70
],
[
11,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
77,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
77,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
92,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
102,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
102,
124
],
[
124,
125
],
[
124,
126
],
[
102,
127
],
[
127,
128
],
[
73,
129
],
[
129,
130
],
[
11,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
131,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
143,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
152,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
11,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
11,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
11,
176
],
[
176,
177
],
[
177,
178
],
[
9,
179
],
[
179,
180
]
] | [
"import java.io.*;\nimport java.util.*;\n\nclass Main{\n public static void main(String[] args) throws Exception{\n\tint i = 0;\n\tint tmp;\n\tint Count_Sort = 0;\n\tboolean flag = true;\n\t\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString N_str = br.readLine();\n\tint N = Integer.parseInt(N_str);\n\n\tint[] A;\n\tA = new int[N];\n\t\n\tString A_str = br.readLine();\n\tScanner sc = new Scanner(A_str).useDelimiter(\"\\\\s* \\\\s*\");\n\t\n\twhile(sc.hasNext()){\n\t A[i] = sc.nextInt();\n\t i++;\n\t}\n\n\ti = 0;\n\t\n\twhile(flag){\n\t flag = false;\n\t for(int j=N-1;i<j;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }\n\t i++;\n\t}\n\t\n\tfor(i=0;i<N;i++){\n\t System.out.print(A[i]);\n\t if(i!=N-1) System.out.print(\" \");\n\t}\n\t\n\tSystem.out.println(\"\");\n\tSystem.out.println(Count_Sort);\n\tsc.close();\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args) throws Exception{\n\tint i = 0;\n\tint tmp;\n\tint Count_Sort = 0;\n\tboolean flag = true;\n\t\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString N_str = br.readLine();\n\tint N = Integer.parseInt(N_str);\n\n\tint[] A;\n\tA = new int[N];\n\t\n\tString A_str = br.readLine();\n\tScanner sc = new Scanner(A_str).useDelimiter(\"\\\\s* \\\\s*\");\n\t\n\twhile(sc.hasNext()){\n\t A[i] = sc.nextInt();\n\t i++;\n\t}\n\n\ti = 0;\n\t\n\twhile(flag){\n\t flag = false;\n\t for(int j=N-1;i<j;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }\n\t i++;\n\t}\n\t\n\tfor(i=0;i<N;i++){\n\t System.out.print(A[i]);\n\t if(i!=N-1) System.out.print(\" \");\n\t}\n\t\n\tSystem.out.println(\"\");\n\tSystem.out.println(Count_Sort);\n\tsc.close();\n }\n}",
"Main",
"public static void main(String[] args) throws Exception{\n\tint i = 0;\n\tint tmp;\n\tint Count_Sort = 0;\n\tboolean flag = true;\n\t\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString N_str = br.readLine();\n\tint N = Integer.parseInt(N_str);\n\n\tint[] A;\n\tA = new int[N];\n\t\n\tString A_str = br.readLine();\n\tScanner sc = new Scanner(A_str).useDelimiter(\"\\\\s* \\\\s*\");\n\t\n\twhile(sc.hasNext()){\n\t A[i] = sc.nextInt();\n\t i++;\n\t}\n\n\ti = 0;\n\t\n\twhile(flag){\n\t flag = false;\n\t for(int j=N-1;i<j;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }\n\t i++;\n\t}\n\t\n\tfor(i=0;i<N;i++){\n\t System.out.print(A[i]);\n\t if(i!=N-1) System.out.print(\" \");\n\t}\n\t\n\tSystem.out.println(\"\");\n\tSystem.out.println(Count_Sort);\n\tsc.close();\n }",
"main",
"{\n\tint i = 0;\n\tint tmp;\n\tint Count_Sort = 0;\n\tboolean flag = true;\n\t\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tString N_str = br.readLine();\n\tint N = Integer.parseInt(N_str);\n\n\tint[] A;\n\tA = new int[N];\n\t\n\tString A_str = br.readLine();\n\tScanner sc = new Scanner(A_str).useDelimiter(\"\\\\s* \\\\s*\");\n\t\n\twhile(sc.hasNext()){\n\t A[i] = sc.nextInt();\n\t i++;\n\t}\n\n\ti = 0;\n\t\n\twhile(flag){\n\t flag = false;\n\t for(int j=N-1;i<j;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }\n\t i++;\n\t}\n\t\n\tfor(i=0;i<N;i++){\n\t System.out.print(A[i]);\n\t if(i!=N-1) System.out.print(\" \");\n\t}\n\t\n\tSystem.out.println(\"\");\n\tSystem.out.println(Count_Sort);\n\tsc.close();\n }",
"int i = 0;",
"i",
"0",
"int tmp;",
"tmp",
"int Count_Sort = 0;",
"Count_Sort",
"0",
"boolean flag = true;",
"flag",
"true",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String N_str = br.readLine();",
"N_str",
"br.readLine()",
"br.readLine",
"br",
"int N = Integer.parseInt(N_str);",
"N",
"Integer.parseInt(N_str)",
"Integer.parseInt",
"Integer",
"N_str",
"int[] A;",
"A",
"A = new int[N]",
"A",
"new int[N]",
"N",
"String A_str = br.readLine();",
"A_str",
"br.readLine()",
"br.readLine",
"br",
"Scanner sc = new Scanner(A_str).useDelimiter(\"\\\\s* \\\\s*\");",
"sc",
"new Scanner(A_str).useDelimiter(\"\\\\s* \\\\s*\")",
"new Scanner(A_str).useDelimiter",
"new Scanner(A_str)",
"\"\\\\s* \\\\s*\"",
"while(sc.hasNext()){\n\t A[i] = sc.nextInt();\n\t i++;\n\t}",
"sc.hasNext()",
"sc.hasNext",
"sc",
"{\n\t A[i] = sc.nextInt();\n\t i++;\n\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"i++",
"i",
"i = 0",
"i",
"0",
"while(flag){\n\t flag = false;\n\t for(int j=N-1;i<j;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }\n\t i++;\n\t}",
"flag",
"{\n\t flag = false;\n\t for(int j=N-1;i<j;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }\n\t i++;\n\t}",
"flag = false",
"flag",
"false",
"for(int j=N-1;i<j;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }",
"int j=N-1;",
"int j=N-1;",
"j",
"N-1",
"N",
"1",
"i<j",
"i",
"j",
"j--",
"j--",
"j",
"{\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }",
"{\n\t\tif(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}\n\t }",
"if(A[j]<A[j-1]){\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}",
"A[j]<A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t tmp = A[j];\n\t\t A[j] = A[j-1];\n\t\t A[j-1] = tmp;\n\t\t flag = true;\n\t\t Count_Sort++;\n\t\t}",
"tmp = A[j]",
"tmp",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = tmp",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"tmp",
"flag = true",
"flag",
"true",
"Count_Sort++",
"Count_Sort",
"i++",
"i",
"for(i=0;i<N;i++){\n\t System.out.print(A[i]);\n\t if(i!=N-1) System.out.print(\" \");\n\t}",
"i=0;",
"i=0",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t System.out.print(A[i]);\n\t if(i!=N-1) System.out.print(\" \");\n\t}",
"{\n\t System.out.print(A[i]);\n\t if(i!=N-1) System.out.print(\" \");\n\t}",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"if(i!=N-1) System.out.print(\" \");",
"i!=N-1",
"i",
"N-1",
"N",
"1",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(Count_Sort)",
"System.out.println",
"System.out",
"System",
"System.out",
"Count_Sort",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args"
] | import java.io.*;
import java.util.*;
class Main{
public static void main(String[] args) throws Exception{
int i = 0;
int tmp;
int Count_Sort = 0;
boolean flag = true;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String N_str = br.readLine();
int N = Integer.parseInt(N_str);
int[] A;
A = new int[N];
String A_str = br.readLine();
Scanner sc = new Scanner(A_str).useDelimiter("\\s* \\s*");
while(sc.hasNext()){
A[i] = sc.nextInt();
i++;
}
i = 0;
while(flag){
flag = false;
for(int j=N-1;i<j;j--){
if(A[j]<A[j-1]){
tmp = A[j];
A[j] = A[j-1];
A[j-1] = tmp;
flag = true;
Count_Sort++;
}
}
i++;
}
for(i=0;i<N;i++){
System.out.print(A[i]);
if(i!=N-1) System.out.print(" ");
}
System.out.println("");
System.out.println(Count_Sort);
sc.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
12,
13,
30,
0,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
12,
13,
30,
4,
18,
18,
13,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
2,
17,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
178,
5
],
[
178,
6
],
[
6,
7
],
[
6,
8
],
[
178,
9
],
[
9,
10
],
[
178,
11
],
[
11,
12
],
[
178,
13
],
[
13,
14
],
[
13,
15
],
[
178,
16
],
[
16,
17
],
[
178,
18
],
[
18,
19
],
[
178,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
22,
28
],
[
28,
29
],
[
28,
30
],
[
22,
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
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
178,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
73,
74
],
[
73,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
66,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
81,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
91,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
91,
113
],
[
113,
114
],
[
113,
115
],
[
91,
116
],
[
116,
117
],
[
178,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
126,
127
],
[
126,
128
],
[
120,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
129,
137
],
[
137,
138
],
[
138,
139
],
[
129,
140
],
[
141,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
120,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
157,
158
],
[
157,
159
],
[
178,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
166,
167
],
[
167,
168
],
[
162,
169
],
[
169,
170
],
[
170,
171
],
[
162,
172
],
[
172,
173
],
[
173,
174
],
[
160,
175
],
[
175,
176
],
[
0,
177
],
[
177,
178
],
[
177,
179
]
] | [
"import java.util.*;\npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tint N;\n\tint[] A;\n\tint count=0;\n\tint flag;\n\tint key;\n\t\n\tpublic void input(){\n\t\tN=sc.nextInt();\n\t\tA = new int[N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t}\n\t\n\tpublic void bubblesort(){\n\t\tflag=1;\n\t\twhile(flag==1){\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic void output(){\n\t\tSystem.out.print(A[0]);\n\t\tfor(int i=1; i<N; i++){\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\"+count);\n\t}\n\t\n\tpublic static void main(String[] args){\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.bubblesort();\n\t\tobj.output();\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tint N;\n\tint[] A;\n\tint count=0;\n\tint flag;\n\tint key;\n\t\n\tpublic void input(){\n\t\tN=sc.nextInt();\n\t\tA = new int[N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t}\n\t\n\tpublic void bubblesort(){\n\t\tflag=1;\n\t\twhile(flag==1){\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic void output(){\n\t\tSystem.out.print(A[0]);\n\t\tfor(int i=1; i<N; i++){\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\"+count);\n\t}\n\t\n\tpublic static void main(String[] args){\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.bubblesort();\n\t\tobj.output();\n\t}\n}",
"Main",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N;",
"N",
"int[] A;",
"A",
"int count=0;",
"count",
"0",
"int flag;",
"flag",
"int key;",
"key",
"public void input(){\n\t\tN=sc.nextInt();\n\t\tA = new int[N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t}",
"input",
"{\n\t\tN=sc.nextInt();\n\t\tA = new int[N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t}",
"N=sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"A = new int[N]",
"A",
"new int[N]",
"N",
"for(int i=0; i<N; i++){\n\t\t\tA[i]=sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i]=sc.nextInt();\n\t\t}",
"A[i]=sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"public void bubblesort(){\n\t\tflag=1;\n\t\twhile(flag==1){\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"bubblesort",
"{\n\t\tflag=1;\n\t\twhile(flag==1){\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"flag=1",
"flag",
"1",
"while(flag==1){\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag==1",
"flag",
"1",
"{\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag=0",
"flag",
"0",
"for(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j=N-1;",
"int j=N-1;",
"j",
"N-1",
"N",
"1",
"j>=1",
"j",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"key = A[j]",
"key",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = key",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"key",
"flag=1",
"flag",
"1",
"count++",
"count",
"public void output(){\n\t\tSystem.out.print(A[0]);\n\t\tfor(int i=1; i<N; i++){\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\"+count);\n\t}",
"output",
"{\n\t\tSystem.out.print(A[0]);\n\t\tfor(int i=1; i<N; i++){\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\"+count);\n\t}",
"System.out.print(A[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[0]",
"A",
"0",
"for(int i=1; i<N; i++){\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}",
"{\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}",
"System.out.print(\" \"+A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"+A[i]",
"\" \"",
"A[i]",
"A",
"i",
"System.out.println(\"\\n\"+count)",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\\n\"+count",
"\"\\n\"",
"count",
"public static void main(String[] args){\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.bubblesort();\n\t\tobj.output();\n\t}",
"main",
"{\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.bubblesort();\n\t\tobj.output();\n\t}",
"Main obj = new Main();",
"obj",
"new Main()",
"obj.input()",
"obj.input",
"obj",
"obj.bubblesort()",
"obj.bubblesort",
"obj",
"obj.output()",
"obj.output",
"obj",
"String[] args",
"args",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tint N;\n\tint[] A;\n\tint count=0;\n\tint flag;\n\tint key;\n\t\n\tpublic void input(){\n\t\tN=sc.nextInt();\n\t\tA = new int[N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t}\n\t\n\tpublic void bubblesort(){\n\t\tflag=1;\n\t\twhile(flag==1){\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic void output(){\n\t\tSystem.out.print(A[0]);\n\t\tfor(int i=1; i<N; i++){\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\"+count);\n\t}\n\t\n\tpublic static void main(String[] args){\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.bubblesort();\n\t\tobj.output();\n\t}\n}",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tint N;\n\tint[] A;\n\tint count=0;\n\tint flag;\n\tint key;\n\t\n\tpublic void input(){\n\t\tN=sc.nextInt();\n\t\tA = new int[N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t}\n\t\n\tpublic void bubblesort(){\n\t\tflag=1;\n\t\twhile(flag==1){\n\t\t\tflag=0;\n\t\t\tfor(int j=N-1; j>=1; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tkey = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = key;\n\t\t\t\t\tflag=1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tpublic void output(){\n\t\tSystem.out.print(A[0]);\n\t\tfor(int i=1; i<N; i++){\n\t\t\tSystem.out.print(\" \"+A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\"+count);\n\t}\n\t\n\tpublic static void main(String[] args){\n\t\tMain obj = new Main();\n\t\tobj.input();\n\t\tobj.bubblesort();\n\t\tobj.output();\n\t}\n}",
"Main"
] | import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
int N;
int[] A;
int count=0;
int flag;
int key;
public void input(){
N=sc.nextInt();
A = new int[N];
for(int i=0; i<N; i++){
A[i]=sc.nextInt();
}
}
public void bubblesort(){
flag=1;
while(flag==1){
flag=0;
for(int j=N-1; j>=1; j--){
if(A[j] < A[j-1]){
key = A[j];
A[j] = A[j-1];
A[j-1] = key;
flag=1;
count++;
}
}
}
}
public void output(){
System.out.print(A[0]);
for(int i=1; i<N; i++){
System.out.print(" "+A[i]);
}
System.out.println("\n"+count);
}
public static void main(String[] args){
Main obj = new Main();
obj.input();
obj.bubblesort();
obj.output();
}
}
|
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
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
],
[
161,
8
],
[
161,
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
],
[
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
],
[
60,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
60,
72
],
[
72,
73
],
[
73,
74
],
[
60,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
87,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
87,
109
],
[
109,
110
],
[
11,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
111,
122
],
[
123,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
129,
131
],
[
123,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
132,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
11,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
11,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
11,
155
],
[
155,
156
],
[
156,
157
],
[
9,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint num[] = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint num[] = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint num[] = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint num[] = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int num[] = new int[n];",
"num",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tnum[i] = scan.nextInt();\n\t\t}",
"num[i] = scan.nextInt()",
"num[i]",
"num",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\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\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j >= i + 1",
"j",
"i + 1",
"i",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"num[j] < num[j - 1]",
"num[j]",
"num",
"j",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp = num[j];",
"tmp",
"num[j]",
"num",
"j",
"num[j] = num[j - 1]",
"num[j]",
"num",
"j",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"num[j - 1] = tmp",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"tmp",
"count++",
"count",
"for (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}",
"System.out.print(num[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"num[i]",
"num",
"i",
"if (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");",
"i != n - 1",
"i",
"n - 1",
"n",
"1",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint num[] = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint n = scan.nextInt();\n\t\tint num[] = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (num[j] < num[j - 1]) {\n\t\t\t\t\tint tmp = num[j];\n\t\t\t\t\tnum[j] = num[j - 1];\n\t\t\t\t\tnum[j - 1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif (i != n - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t}\n\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int num[] = new int[n];
for (int i = 0; i < n; i++) {
num[i] = scan.nextInt();
}
int count = 0;
for (int i = 0; i < n; i++) {
for (int j = n - 1; j >= i + 1; j--) {
if (num[j] < num[j - 1]) {
int tmp = num[j];
num[j] = num[j - 1];
num[j - 1] = tmp;
count++;
}
}
}
for (int i = 0; i < n; i++) {
System.out.print(num[i]);
if (i != n - 1)
System.out.print(" ");
}
System.out.println();
System.out.println(count);
scan.close();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
0,
13,
4,
18,
13,
41,
13,
0,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
0,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
30,
9,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
2,
2,
18,
13,
2,
13,
17,
17,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
164,
5
],
[
164,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
8,
14
],
[
14,
15
],
[
8,
16
],
[
16,
17
],
[
8,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
8,
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
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
56,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
71,
78
],
[
78,
79
],
[
78,
80
],
[
71,
81
],
[
81,
82
],
[
82,
83
],
[
71,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
86,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
96,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
96,
118
],
[
118,
119
],
[
86,
120
],
[
120,
121
],
[
8,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
8,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
153,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
153,
159
],
[
153,
160
],
[
6,
161
],
[
161,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
] | [
"import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int i,c,j,count=0,N;\n N=sc.nextInt();\n int[] array;\n array= new int[N];\n for(i=0;i<=N-1;i++){\n array[i]=sc.nextInt();\n }\n for(j=1;j<=N-1;j++){\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }\n for(i=0;i<N-1;i++){\n System.out.print(array[i]+\" \");\n }\n System.out.println(array[N-1]+\"\\n\"+count);\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 i,c,j,count=0,N;\n N=sc.nextInt();\n int[] array;\n array= new int[N];\n for(i=0;i<=N-1;i++){\n array[i]=sc.nextInt();\n }\n for(j=1;j<=N-1;j++){\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }\n for(i=0;i<N-1;i++){\n System.out.print(array[i]+\" \");\n }\n System.out.println(array[N-1]+\"\\n\"+count);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int i,c,j,count=0,N;\n N=sc.nextInt();\n int[] array;\n array= new int[N];\n for(i=0;i<=N-1;i++){\n array[i]=sc.nextInt();\n }\n for(j=1;j<=N-1;j++){\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }\n for(i=0;i<N-1;i++){\n System.out.print(array[i]+\" \");\n }\n System.out.println(array[N-1]+\"\\n\"+count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int i,c,j,count=0,N;\n N=sc.nextInt();\n int[] array;\n array= new int[N];\n for(i=0;i<=N-1;i++){\n array[i]=sc.nextInt();\n }\n for(j=1;j<=N-1;j++){\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }\n for(i=0;i<N-1;i++){\n System.out.print(array[i]+\" \");\n }\n System.out.println(array[N-1]+\"\\n\"+count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int i",
"i",
"c",
"c",
"j",
"j",
"count=0",
"count",
"0",
"N;",
"N",
"N=sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] array;",
"array",
"array= new int[N]",
"array",
"new int[N]",
"N",
"for(i=0;i<=N-1;i++){\n array[i]=sc.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<=N-1",
"i",
"N-1",
"N",
"1",
"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",
"for(j=1;j<=N-1;j++){\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }",
"j=1;",
"j=1",
"j",
"1",
"j<=N-1",
"j",
"N-1",
"N",
"1",
"j++",
"j++",
"j",
"{\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }",
"{\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }",
"for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }",
"i=N-1;",
"i=N-1",
"i",
"N-1",
"N",
"1",
"i>=j",
"i",
"j",
"i--",
"i--",
"i",
"{\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }",
"{\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }",
"if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }",
"array[i]<array[i-1]",
"array[i]",
"array",
"i",
"array[i-1]",
"array",
"i-1",
"i",
"1",
"{\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }",
"c=array[i]",
"c",
"array[i]",
"array",
"i",
"array[i]=array[i-1]",
"array[i]",
"array",
"i",
"array[i-1]",
"array",
"i-1",
"i",
"1",
"array[i-1]=c",
"array[i-1]",
"array",
"i-1",
"i",
"1",
"c",
"count++",
"count",
"{\n continue;\n }",
"continue;",
"for(i=0;i<N-1;i++){\n System.out.print(array[i]+\" \");\n }",
"i=0;",
"i=0",
"i",
"0",
"i<N-1",
"i",
"N-1",
"N",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(array[i]+\" \");\n }",
"{\n System.out.print(array[i]+\" \");\n }",
"System.out.print(array[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i]+\" \"",
"array[i]",
"array",
"i",
"\" \"",
"System.out.println(array[N-1]+\"\\n\"+count)",
"System.out.println",
"System.out",
"System",
"System.out",
"array[N-1]+\"\\n\"+count",
"array[N-1]+\"\\n\"+count",
"array[N-1]",
"array",
"N-1",
"N",
"1",
"\"\\n\"",
"count",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int i,c,j,count=0,N;\n N=sc.nextInt();\n int[] array;\n array= new int[N];\n for(i=0;i<=N-1;i++){\n array[i]=sc.nextInt();\n }\n for(j=1;j<=N-1;j++){\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }\n for(i=0;i<N-1;i++){\n System.out.print(array[i]+\" \");\n }\n System.out.println(array[N-1]+\"\\n\"+count);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int i,c,j,count=0,N;\n N=sc.nextInt();\n int[] array;\n array= new int[N];\n for(i=0;i<=N-1;i++){\n array[i]=sc.nextInt();\n }\n for(j=1;j<=N-1;j++){\n for(i=N-1;i>=j;i--){\n if(array[i]<array[i-1]){\n c=array[i];\n array[i]=array[i-1];\n array[i-1]=c;\n count++;\n }else{\n continue;\n }\n }\n }\n for(i=0;i<N-1;i++){\n System.out.print(array[i]+\" \");\n }\n System.out.println(array[N-1]+\"\\n\"+count);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int i,c,j,count=0,N;
N=sc.nextInt();
int[] array;
array= new int[N];
for(i=0;i<=N-1;i++){
array[i]=sc.nextInt();
}
for(j=1;j<=N-1;j++){
for(i=N-1;i>=j;i--){
if(array[i]<array[i-1]){
c=array[i];
array[i]=array[i-1];
array[i-1]=c;
count++;
}else{
continue;
}
}
}
for(i=0;i<N-1;i++){
System.out.print(array[i]+" ");
}
System.out.println(array[N-1]+"\n"+count);
}
}
|
[
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,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
30,
41,
13,
4,
18,
13,
2,
13,
17,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
4,
18,
13,
13,
13,
40,
13,
41,
13,
20,
28,
13,
13,
30,
30,
4,
18,
13,
13,
4,
18,
13,
17,
4,
18,
13,
2,
4,
18,
13,
17,
4,
18,
13,
17,
4,
18,
13,
13,
4,
18,
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
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
176,
17
],
[
176,
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
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
20,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
20,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
43,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
20,
64
],
[
64,
65
],
[
64,
66
],
[
20,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
80,
87
],
[
87,
88
],
[
87,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
80,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
96,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
95,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
110,
113
],
[
113,
114
],
[
113,
115
],
[
107,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
119,
121
],
[
116,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
107,
126
],
[
126,
127
],
[
127,
128
],
[
126,
129
],
[
126,
130
],
[
107,
131
],
[
131,
132
],
[
20,
133
],
[
133,
134
],
[
133,
135
],
[
20,
136
],
[
136,
137
],
[
136,
138
],
[
136,
139
],
[
140,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
140,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
20,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
152,
156
],
[
20,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
20,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
20,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
170,
171
],
[
171,
172
],
[
18,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in1.txt\"));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in2.txt\"));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] s_in = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; i++)\n\t\t\tlist.add(Integer.parseInt(s_in[i]));\n\t\t\n\t\tint cnt_swap = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int n : list) {\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tsb.append('\\n');\n\t\tsb.append(cnt_swap);\n\t\tSystem.out.println(sb.toString());\n\t}\n\t\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.FileReader;",
"FileReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in1.txt\"));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in2.txt\"));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] s_in = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; i++)\n\t\t\tlist.add(Integer.parseInt(s_in[i]));\n\t\t\n\t\tint cnt_swap = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int n : list) {\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tsb.append('\\n');\n\t\tsb.append(cnt_swap);\n\t\tSystem.out.println(sb.toString());\n\t}\n\t\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in1.txt\"));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in2.txt\"));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] s_in = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; i++)\n\t\t\tlist.add(Integer.parseInt(s_in[i]));\n\t\t\n\t\tint cnt_swap = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int n : list) {\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tsb.append('\\n');\n\t\tsb.append(cnt_swap);\n\t\tSystem.out.println(sb.toString());\n\t}",
"main",
"{\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in1.txt\"));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in2.txt\"));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] s_in = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; i++)\n\t\t\tlist.add(Integer.parseInt(s_in[i]));\n\t\t\n\t\tint cnt_swap = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int n : list) {\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tsb.append('\\n');\n\t\tsb.append(cnt_swap);\n\t\tSystem.out.println(sb.toString());\n\t}",
"List<Integer> list = new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"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[] s_in = br.readLine().split(\" \");",
"s_in",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < N; i++)\n\t\t\tlist.add(Integer.parseInt(s_in[i]));",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"list.add(Integer.parseInt(s_in[i]));",
"list.add(Integer.parseInt(s_in[i]))",
"list.add",
"list",
"Integer.parseInt(s_in[i])",
"Integer.parseInt",
"Integer",
"s_in[i]",
"s_in",
"i",
"int cnt_swap = 0;",
"cnt_swap",
"0",
"for (int i = 0; i < N; i++) {\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\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\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}",
"if (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}",
"list.get(j) < list.get(j - 1)",
"list.get(j)",
"list.get",
"list",
"j",
"list.get(j - 1)",
"list.get",
"list",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}",
"int tmp = list.get(j - 1);",
"tmp",
"list.get(j - 1)",
"list.get",
"list",
"j - 1",
"j",
"1",
"list.set(j - 1, list.get(j))",
"list.set",
"list",
"j - 1",
"j",
"1",
"list.get(j)",
"list.get",
"list",
"j",
"list.set(j, tmp)",
"list.set",
"list",
"j",
"tmp",
"cnt_swap++",
"cnt_swap",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (int n : list) {\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}",
"int n",
"list",
"{\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}",
"{\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}",
"sb.append(n)",
"sb.append",
"sb",
"n",
"sb.append(' ')",
"sb.append",
"sb",
"' '",
"sb.deleteCharAt(sb.length() - 1)",
"sb.deleteCharAt",
"sb",
"sb.length() - 1",
"sb.length()",
"sb.length",
"sb",
"1",
"sb.append('\\n')",
"sb.append",
"sb",
"'\\n'",
"sb.append(cnt_swap)",
"sb.append",
"sb",
"cnt_swap",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in1.txt\"));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in2.txt\"));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] s_in = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; i++)\n\t\t\tlist.add(Integer.parseInt(s_in[i]));\n\t\t\n\t\tint cnt_swap = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int n : list) {\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tsb.append('\\n');\n\t\tsb.append(cnt_swap);\n\t\tSystem.out.println(sb.toString());\n\t}\n\t\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tList<Integer> list = new ArrayList<Integer>();\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in1.txt\"));\n\t\t// BufferedReader br = new BufferedReader(new FileReader(\"in2.txt\"));\n\t\tint N = Integer.parseInt(br.readLine());\n\t\tString[] s_in = br.readLine().split(\" \");\n\t\tfor (int i = 0; i < N; i++)\n\t\t\tlist.add(Integer.parseInt(s_in[i]));\n\t\t\n\t\tint cnt_swap = 0;\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\t// list[0..i-1]??????????????????\n\t\t\tfor (int j = N - 1; j > 0; j--) {\n\t\t\t\tif (list.get(j) < list.get(j - 1)) {\n\t\t\t\t\tint tmp = list.get(j - 1);\n\t\t\t\t\tlist.set(j - 1, list.get(j));\n\t\t\t\t\tlist.set(j, tmp);\n\t\t\t\t\tcnt_swap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int n : list) {\n\t\t\tsb.append(n);\n\t\t\tsb.append(' ');\n\t\t}\n\t\tsb.deleteCharAt(sb.length() - 1);\n\t\tsb.append('\\n');\n\t\tsb.append(cnt_swap);\n\t\tSystem.out.println(sb.toString());\n\t}\n\t\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) throws Exception {
List<Integer> list = new ArrayList<Integer>();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// BufferedReader br = new BufferedReader(new FileReader("in1.txt"));
// BufferedReader br = new BufferedReader(new FileReader("in2.txt"));
int N = Integer.parseInt(br.readLine());
String[] s_in = br.readLine().split(" ");
for (int i = 0; i < N; i++)
list.add(Integer.parseInt(s_in[i]));
int cnt_swap = 0;
for (int i = 0; i < N; i++) {
// list[0..i-1]??????????????????
for (int j = N - 1; j > 0; j--) {
if (list.get(j) < list.get(j - 1)) {
int tmp = list.get(j - 1);
list.set(j - 1, list.get(j));
list.set(j, tmp);
cnt_swap++;
}
}
}
StringBuilder sb = new StringBuilder();
for (int n : list) {
sb.append(n);
sb.append(' ');
}
sb.deleteCharAt(sb.length() - 1);
sb.append('\n');
sb.append(cnt_swap);
System.out.println(sb.toString());
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
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,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
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
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
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
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
53,
60
],
[
60,
61
],
[
60,
62
],
[
53,
63
],
[
63,
64
],
[
64,
65
],
[
53,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
83,
100
],
[
100,
101
],
[
100,
102
],
[
83,
103
],
[
103,
104
],
[
8,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
105,
113
],
[
113,
114
],
[
114,
115
],
[
105,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
117,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
126,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
126,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
8,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
6,
151
],
[
151,
152
]
] | [
"import java.util.*;\nclass Main {\n\tpublic static void main(String...args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint aryLen = scan.nextInt();\n\t\tint[] ary = new int[aryLen];\n\t\tboolean flag = true;\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int n = aryLen-1; n > 0; n--) {\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\tpublic static void main(String...args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint aryLen = scan.nextInt();\n\t\tint[] ary = new int[aryLen];\n\t\tboolean flag = true;\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int n = aryLen-1; n > 0; n--) {\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String...args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint aryLen = scan.nextInt();\n\t\tint[] ary = new int[aryLen];\n\t\tboolean flag = true;\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int n = aryLen-1; n > 0; n--) {\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint count = 0;\n\t\tint aryLen = scan.nextInt();\n\t\tint[] ary = new int[aryLen];\n\t\tboolean flag = true;\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int n = aryLen-1; n > 0; n--) {\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0 ; i < aryLen; i++) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int count = 0;",
"count",
"0",
"int aryLen = scan.nextInt();",
"aryLen",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] ary = new int[aryLen];",
"ary",
"new int[aryLen]",
"aryLen",
"boolean flag = true;",
"flag",
"true",
"for(int i = 0 ; i < aryLen; i++) {\n\t\t\tary[i] = scan.nextInt();\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < aryLen",
"i",
"aryLen",
"i++",
"i++",
"i",
"{\n\t\t\tary[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tary[i] = scan.nextInt();\n\t\t}",
"ary[i] = scan.nextInt()",
"ary[i]",
"ary",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"while(flag) {\n\t\t\tflag = false;\n\t\t\tfor(int n = aryLen-1; n > 0; n--) {\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor(int n = aryLen-1; n > 0; n--) {\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for(int n = aryLen-1; n > 0; n--) {\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int n = aryLen-1;",
"int n = aryLen-1;",
"n",
"aryLen-1",
"aryLen",
"1",
"n > 0",
"n",
"0",
"n--",
"n--",
"n",
"{\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\tint tmp = ary[n];\n\t\t\t\tif(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int tmp = ary[n];",
"tmp",
"ary[n]",
"ary",
"n",
"if(ary[n] < ary[n-1]) {\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"ary[n] < ary[n-1]",
"ary[n]",
"ary",
"n",
"ary[n-1]",
"ary",
"n-1",
"n",
"1",
"{\n\t\t\t\t\tary[n] = ary[n-1];\n\t\t\t\t\tary[n-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"ary[n] = ary[n-1]",
"ary[n]",
"ary",
"n",
"ary[n-1]",
"ary",
"n-1",
"n",
"1",
"ary[n-1] = tmp",
"ary[n-1]",
"ary",
"n-1",
"n",
"1",
"tmp",
"flag = true",
"flag",
"true",
"count++",
"count",
"for(int i = 0 ; i < aryLen; i++) {\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < aryLen",
"i",
"aryLen",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }\n\t\t}",
"{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }\n\t\t}",
"System.out.print(ary[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"ary[i]",
"ary",
"i",
"if(i != aryLen-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t} else {\n\t\t\t\tSystem.out.println();\n\t\t }",
"i != aryLen-1",
"i",
"aryLen-1",
"aryLen",
"1",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"{\n\t\t\t\tSystem.out.println();\n\t\t }",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"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 count = 0;
int aryLen = scan.nextInt();
int[] ary = new int[aryLen];
boolean flag = true;
for(int i = 0 ; i < aryLen; i++) {
ary[i] = scan.nextInt();
}
while(flag) {
flag = false;
for(int n = aryLen-1; n > 0; n--) {
int tmp = ary[n];
if(ary[n] < ary[n-1]) {
ary[n] = ary[n-1];
ary[n-1] = tmp;
flag = true;
count++;
}
}
}
for(int i = 0 ; i < aryLen; i++) {
System.out.print(ary[i]);
if(i != aryLen-1){
System.out.print(" ");
} else {
System.out.println();
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
0,
13,
20,
13,
41,
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,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
168,
5
],
[
168,
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
],
[
8,
19
],
[
19,
20
],
[
19,
21
],
[
8,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
28,
36
],
[
36,
37
],
[
37,
38
],
[
28,
39
],
[
40,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
48,
55
],
[
55,
56
],
[
55,
57
],
[
48,
58
],
[
58,
59
],
[
59,
60
],
[
48,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
63,
70
],
[
70,
71
],
[
70,
72
],
[
63,
73
],
[
73,
74
],
[
74,
75
],
[
63,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
78,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
88,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
88,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
88,
110
],
[
110,
111
],
[
8,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
112,
120
],
[
120,
121
],
[
121,
122
],
[
112,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
130,
132
],
[
124,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
133,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
124,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
8,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
6,
165
],
[
165,
166
],
[
0,
167
],
[
167,
168
],
[
167,
169
]
] | [
"import java.util.Scanner;\npublic class Main{\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n\n\n int[] test;\n test = new int[N];\n\n int tmp;\n int cnt = 0;\n\n for (int i = 0; i < N; i++) {\n test[i] = sc.nextInt();\n }\n\n for (int s = N-1; s>0; s--) {\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }\n for (int j = 0; j < N; j++) {\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }\n System.out.println(cnt);\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\n int N = sc.nextInt();\n\n\n int[] test;\n test = new int[N];\n\n int tmp;\n int cnt = 0;\n\n for (int i = 0; i < N; i++) {\n test[i] = sc.nextInt();\n }\n\n for (int s = N-1; s>0; s--) {\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }\n for (int j = 0; j < N; j++) {\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }\n System.out.println(cnt);\n\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n\n\n int[] test;\n test = new int[N];\n\n int tmp;\n int cnt = 0;\n\n for (int i = 0; i < N; i++) {\n test[i] = sc.nextInt();\n }\n\n for (int s = N-1; s>0; s--) {\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }\n for (int j = 0; j < N; j++) {\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }\n System.out.println(cnt);\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n\n\n int[] test;\n test = new int[N];\n\n int tmp;\n int cnt = 0;\n\n for (int i = 0; i < N; i++) {\n test[i] = sc.nextInt();\n }\n\n for (int s = N-1; s>0; s--) {\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }\n for (int j = 0; j < N; j++) {\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }\n System.out.println(cnt);\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] test;",
"test",
"test = new int[N]",
"test",
"new int[N]",
"N",
"int tmp;",
"tmp",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < N; i++) {\n test[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n test[i] = sc.nextInt();\n }",
"{\n test[i] = sc.nextInt();\n }",
"test[i] = sc.nextInt()",
"test[i]",
"test",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int s = N-1; s>0; s--) {\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }",
"int s = N-1;",
"int s = N-1;",
"s",
"N-1",
"N",
"1",
"s>0",
"s",
"0",
"s--",
"s--",
"s",
"{\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }",
"{\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }",
"for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }",
"int j = N-1;",
"int j = N-1;",
"j",
"N-1",
"N",
"1",
"j >0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }",
"{\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }",
"if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }",
"test[j] < test[j-1]",
"test[j]",
"test",
"j",
"test[j-1]",
"test",
"j-1",
"j",
"1",
"{\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }",
"tmp = test[j]",
"tmp",
"test[j]",
"test",
"j",
"test[j] = test[j-1]",
"test[j]",
"test",
"j",
"test[j-1]",
"test",
"j-1",
"j",
"1",
"test[j-1] = tmp",
"test[j-1]",
"test",
"j-1",
"j",
"1",
"tmp",
"cnt++",
"cnt",
"for (int j = 0; j < N; j++) {\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < N",
"j",
"N",
"j++",
"j++",
"j",
"{\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }",
"{\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }",
"System.out.print(test[j])",
"System.out.print",
"System.out",
"System",
"System.out",
"test[j]",
"test",
"j",
"if(j<N-1){\n System.out.print(\" \");\n }",
"j<N-1",
"j",
"N-1",
"N",
"1",
"{\n System.out.print(\" \");\n }",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"if(j==N-1){\n System.out.println(\"\");\n }",
"j==N-1",
"j",
"N-1",
"N",
"1",
"{\n System.out.println(\"\");\n }",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n\n\n int[] test;\n test = new int[N];\n\n int tmp;\n int cnt = 0;\n\n for (int i = 0; i < N; i++) {\n test[i] = sc.nextInt();\n }\n\n for (int s = N-1; s>0; s--) {\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }\n for (int j = 0; j < N; j++) {\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }\n System.out.println(cnt);\n\n }\n}",
"public class Main{\n\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int N = sc.nextInt();\n\n\n int[] test;\n test = new int[N];\n\n int tmp;\n int cnt = 0;\n\n for (int i = 0; i < N; i++) {\n test[i] = sc.nextInt();\n }\n\n for (int s = N-1; s>0; s--) {\n for (int j = N-1; j >0; j--) {\n if (test[j] < test[j-1]) {\n tmp = test[j];\n test[j] = test[j-1];\n test[j-1] = tmp;\n cnt++;\n }\n }\n }\n for (int j = 0; j < N; j++) {\n System.out.print(test[j]);\n if(j<N-1){\n System.out.print(\" \");\n }\n if(j==N-1){\n System.out.println(\"\");\n }\n }\n System.out.println(cnt);\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[] test;
test = new int[N];
int tmp;
int cnt = 0;
for (int i = 0; i < N; i++) {
test[i] = sc.nextInt();
}
for (int s = N-1; s>0; s--) {
for (int j = N-1; j >0; j--) {
if (test[j] < test[j-1]) {
tmp = test[j];
test[j] = test[j-1];
test[j-1] = tmp;
cnt++;
}
}
}
for (int j = 0; j < N; j++) {
System.out.print(test[j]);
if(j<N-1){
System.out.print(" ");
}
if(j==N-1){
System.out.println("");
}
}
System.out.println(cnt);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
185,
5
],
[
185,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
16
],
[
16,
17
],
[
8,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
8,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
8,
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
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
49,
52
],
[
6,
53
],
[
53,
54
],
[
185,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
57,
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
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
76,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
76,
88
],
[
88,
89
],
[
89,
90
],
[
76,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
103,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
118,
124
],
[
103,
125
],
[
125,
126
],
[
57,
127
],
[
127,
128
],
[
127,
129
],
[
127,
130
],
[
57,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
55,
137
],
[
137,
138
],
[
55,
139
],
[
139,
140
],
[
185,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
144,
155
],
[
156,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
156,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
172,
174
],
[
143,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
141,
180
],
[
180,
181
],
[
141,
182
],
[
182,
183
],
[
0,
184
],
[
184,
185
],
[
184,
186
]
] | [
"import java.util.Scanner;\n\npublic class Main\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner input = new Scanner(System.in);\n\t\tint[] A = new int[101];\n\t\tint n, i, j, key;\n\t\tn = input.nextInt();\n\t\tfor(i = 0; i <n; i++)\n\t\t{\n\t\t\tA[i]=input.nextInt();\n\t\t}\n\t\tbubble(A, n);\n\t}\n\n\tpublic static void bubble(int A[], int n)\n\t{\n\t\tint count = 0, t;\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttrace(A, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void trace(int A[], int n)\n\t{\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner input = new Scanner(System.in);\n\t\tint[] A = new int[101];\n\t\tint n, i, j, key;\n\t\tn = input.nextInt();\n\t\tfor(i = 0; i <n; i++)\n\t\t{\n\t\t\tA[i]=input.nextInt();\n\t\t}\n\t\tbubble(A, n);\n\t}\n\n\tpublic static void bubble(int A[], int n)\n\t{\n\t\tint count = 0, t;\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttrace(A, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void trace(int A[], int n)\n\t{\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}",
"Main",
"public static void main(String args[])\n\t{\n\t\tScanner input = new Scanner(System.in);\n\t\tint[] A = new int[101];\n\t\tint n, i, j, key;\n\t\tn = input.nextInt();\n\t\tfor(i = 0; i <n; i++)\n\t\t{\n\t\t\tA[i]=input.nextInt();\n\t\t}\n\t\tbubble(A, n);\n\t}",
"main",
"{\n\t\tScanner input = new Scanner(System.in);\n\t\tint[] A = new int[101];\n\t\tint n, i, j, key;\n\t\tn = input.nextInt();\n\t\tfor(i = 0; i <n; i++)\n\t\t{\n\t\t\tA[i]=input.nextInt();\n\t\t}\n\t\tbubble(A, n);\n\t}",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int[] A = new int[101];",
"A",
"new int[101]",
"101",
"int n",
"n",
"i",
"i",
"j",
"j",
"key;",
"key",
"n = input.nextInt()",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"for(i = 0; i <n; i++)\n\t\t{\n\t\t\tA[i]=input.nextInt();\n\t\t}",
"i = 0;",
"i = 0",
"i",
"0",
"i <n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tA[i]=input.nextInt();\n\t\t}",
"{\n\t\t\tA[i]=input.nextInt();\n\t\t}",
"A[i]=input.nextInt()",
"A[i]",
"A",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"bubble(A, n)",
"bubble",
"A",
"n",
"String args[]",
"args",
"public static void bubble(int A[], int n)\n\t{\n\t\tint count = 0, t;\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttrace(A, n);\n\t\tSystem.out.println(count);\n\t}",
"bubble",
"{\n\t\tint count = 0, t;\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttrace(A, n);\n\t\tSystem.out.println(count);\n\t}",
"int count = 0",
"count",
"0",
"t;",
"t",
"for(int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\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\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j>=i+1",
"j",
"i+1",
"i",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"t = A[j]",
"t",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = t",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"t",
"count++",
"count",
"trace(A, n)",
"trace",
"A",
"n",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int A[]",
"A",
"int n",
"n",
"public static void trace(int A[], int n)\n\t{\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}",
"trace",
"{\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}",
"for(int i = 0; i < n; i++)\n\t\t{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}",
"{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}",
"if(i > 0)System.out.print(\" \");",
"i > 0",
"i",
"0",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int A[]",
"A",
"int n",
"n",
"public class Main\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner input = new Scanner(System.in);\n\t\tint[] A = new int[101];\n\t\tint n, i, j, key;\n\t\tn = input.nextInt();\n\t\tfor(i = 0; i <n; i++)\n\t\t{\n\t\t\tA[i]=input.nextInt();\n\t\t}\n\t\tbubble(A, n);\n\t}\n\n\tpublic static void bubble(int A[], int n)\n\t{\n\t\tint count = 0, t;\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttrace(A, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void trace(int A[], int n)\n\t{\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String args[])\n\t{\n\t\tScanner input = new Scanner(System.in);\n\t\tint[] A = new int[101];\n\t\tint n, i, j, key;\n\t\tn = input.nextInt();\n\t\tfor(i = 0; i <n; i++)\n\t\t{\n\t\t\tA[i]=input.nextInt();\n\t\t}\n\t\tbubble(A, n);\n\t}\n\n\tpublic static void bubble(int A[], int n)\n\t{\n\t\tint count = 0, t;\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tfor(int j = n-1; j>=i+1; j--)\n\t\t\t{\n\t\t\t\tif(A[j] < A[j-1])\n\t\t\t\t{\n\t\t\t\t\tt = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = t;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttrace(A, n);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void trace(int A[], int n)\n\t{\n\t\tfor(int i = 0; i < n; i++)\n\t\t{\n\t\t\tif(i > 0)System.out.print(\" \");\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
int[] A = new int[101];
int n, i, j, key;
n = input.nextInt();
for(i = 0; i <n; i++)
{
A[i]=input.nextInt();
}
bubble(A, n);
}
public static void bubble(int A[], int n)
{
int count = 0, t;
for(int i = 0; i < n; i++)
{
for(int j = n-1; j>=i+1; j--)
{
if(A[j] < A[j-1])
{
t = A[j];
A[j] = A[j-1];
A[j-1] = t;
count++;
}
}
}
trace(A, n);
System.out.println(count);
}
public static void trace(int A[], int n)
{
for(int i = 0; i < n; i++)
{
if(i > 0)System.out.print(" ");
System.out.print(A[i]);
}
System.out.println();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
0,
13,
4,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
40,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
29,
13,
23,
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
],
[
12,
13
],
[
12,
14
],
[
10,
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
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
35,
40
],
[
17,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
17,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
66,
69
],
[
17,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
88,
89
],
[
88,
90
],
[
82,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
91,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
17,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
15,
117
],
[
117,
118
],
[
10,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
137,
144
],
[
144,
145
],
[
144,
146
],
[
137,
147
],
[
147,
148
],
[
148,
149
],
[
137,
150
],
[
151,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
152,
162
],
[
162,
163
],
[
163,
164
],
[
162,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
167,
169
],
[
162,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
176,
178
],
[
162,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
182,
184
],
[
179,
185
],
[
121,
186
],
[
186,
187
],
[
119,
188
],
[
188,
189
],
[
119,
190
],
[
190,
191
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\nclass Main{\n\n\tstatic int COUNT = 0;\n\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] input = br.readLine().split(\" \");\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = Integer.parseInt(input[i]);\n\t\t}\n\n\t\ta = bubbleSort(a, n);\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\t\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(COUNT);\n\n\t}\n\n\tstatic int[] bubbleSort(int[] a, int n){\n\n\t\tfor(int j = 0; j < (n - 1); j++){\n\t\t\tfor(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\treturn a;\n\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"class Main{\n\n\tstatic int COUNT = 0;\n\n\tpublic static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] input = br.readLine().split(\" \");\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = Integer.parseInt(input[i]);\n\t\t}\n\n\t\ta = bubbleSort(a, n);\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\t\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(COUNT);\n\n\t}\n\n\tstatic int[] bubbleSort(int[] a, int n){\n\n\t\tfor(int j = 0; j < (n - 1); j++){\n\t\t\tfor(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\treturn a;\n\n\t}\n\n}",
"Main",
"static int COUNT = 0;",
"COUNT",
"0",
"public static void main(String[] args) throws IOException{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] input = br.readLine().split(\" \");\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = Integer.parseInt(input[i]);\n\t\t}\n\n\t\ta = bubbleSort(a, n);\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\t\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(COUNT);\n\n\t}",
"main",
"{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] input = br.readLine().split(\" \");\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = Integer.parseInt(input[i]);\n\t\t}\n\n\t\ta = bubbleSort(a, n);\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\t\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}\n\n\t\t}\n\n\t\tSystem.out.println(COUNT);\n\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",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"String[] input = br.readLine().split(\" \");",
"input",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < n; i++){\n\t\t\ta[i] = Integer.parseInt(input[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = Integer.parseInt(input[i]);\n\t\t}",
"{\n\t\t\ta[i] = Integer.parseInt(input[i]);\n\t\t}",
"a[i] = Integer.parseInt(input[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"a = bubbleSort(a, n)",
"a",
"bubbleSort(a, n)",
"bubbleSort",
"a",
"n",
"for(int i = 0; i < n; i++){\n\t\t\t\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}\n\n\t\t}",
"{\n\t\t\t\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}\n\n\t\t}",
"System.out.print(a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"if(i != (n - 1)){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}",
"i != (n - 1)",
"i",
"(n - 1)",
"n",
"1",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"{\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}",
"System.out.print(\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"",
"System.out.println(COUNT)",
"System.out.println",
"System.out",
"System",
"System.out",
"COUNT",
"String[] args",
"args",
"static int[] bubbleSort(int[] a, int n){\n\n\t\tfor(int j = 0; j < (n - 1); j++){\n\t\t\tfor(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\treturn a;\n\n\t}",
"bubbleSort",
"{\n\n\t\tfor(int j = 0; j < (n - 1); j++){\n\t\t\tfor(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\treturn a;\n\n\t}",
"for(int j = 0; j < (n - 1); j++){\n\t\t\tfor(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\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\tfor(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"for(int i = (n - 1); i > 0; i--){\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"int i = (n - 1);",
"int i = (n - 1);",
"i",
"(n - 1)",
"n",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"{\n\n\t\t\t\tif(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"if(a[i] < a[i - 1]){\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}",
"a[i] < a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"{\n\t\t\t\t\tCOUNT++;\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\t\t\n\t\t\t\t}",
"COUNT++",
"COUNT",
"int temp = a[i];",
"temp",
"a[i]",
"a",
"i",
"a[i] = a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i - 1] = temp",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"temp",
"return a;",
"a",
"int[] a",
"a",
"int n",
"n"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main{
static int COUNT = 0;
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] a = new int[n];
String[] input = br.readLine().split(" ");
for(int i = 0; i < n; i++){
a[i] = Integer.parseInt(input[i]);
}
a = bubbleSort(a, n);
for(int i = 0; i < n; i++){
System.out.print(a[i]);
if(i != (n - 1)){
System.out.print(" ");
}else{
System.out.print("\n");
}
}
System.out.println(COUNT);
}
static int[] bubbleSort(int[] a, int n){
for(int j = 0; j < (n - 1); j++){
for(int i = (n - 1); i > 0; i--){
if(a[i] < a[i - 1]){
COUNT++;
int temp = a[i];
a[i] = a[i - 1];
a[i - 1] = temp;
}
}
}
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,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
13,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
184,
5
],
[
184,
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
],
[
43,
46
],
[
6,
47
],
[
47,
48
],
[
184,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
55,
57
],
[
51,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
73,
74
],
[
73,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
66,
79
],
[
80,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
81,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
91,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
91,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
91,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
91,
116
],
[
116,
117
],
[
116,
118
],
[
91,
119
],
[
119,
120
],
[
51,
121
],
[
121,
122
],
[
121,
123
],
[
121,
124
],
[
51,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
49,
131
],
[
131,
132
],
[
49,
133
],
[
133,
134
],
[
184,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
138,
148
],
[
148,
149
],
[
149,
150
],
[
138,
151
],
[
152,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
152,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
161,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
168,
173
],
[
137,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
135,
179
],
[
179,
180
],
[
135,
181
],
[
181,
182
],
[
0,
183
],
[
183,
184
],
[
183,
185
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n\n\t//配列の要素数\n\tScanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n\n\t//配列の要素\n\tint A[] = new int[n];\t\n\tfor(int i=0;i<A.length;i++){\n\t A[i]= scanner.nextInt();\n\t}\n\tbubbleSort(A,n);\n }\n //並べ替え\n private static void bubbleSort(int A[],int N){\n\tint flag = 1;\n\tint count = 0;\n\n\twhile(flag != 0){\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}\n\tPrint(A,N);\n\tSystem.out.println(count);\n }\n //表示\n private static void Print(int A[], int n){\n\tfor(int k=0;k<A.length;k++){\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}\n\tSystem.out.println();\n }\n}\n\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String[] args){\n\n\t//配列の要素数\n\tScanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n\n\t//配列の要素\n\tint A[] = new int[n];\t\n\tfor(int i=0;i<A.length;i++){\n\t A[i]= scanner.nextInt();\n\t}\n\tbubbleSort(A,n);\n }\n //並べ替え\n private static void bubbleSort(int A[],int N){\n\tint flag = 1;\n\tint count = 0;\n\n\twhile(flag != 0){\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}\n\tPrint(A,N);\n\tSystem.out.println(count);\n }\n //表示\n private static void Print(int A[], int n){\n\tfor(int k=0;k<A.length;k++){\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}\n\tSystem.out.println();\n }\n}",
"Main",
"public static void main(String[] args){\n\n\t//配列の要素数\n\tScanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n\n\t//配列の要素\n\tint A[] = new int[n];\t\n\tfor(int i=0;i<A.length;i++){\n\t A[i]= scanner.nextInt();\n\t}\n\tbubbleSort(A,n);\n }",
"main",
"{\n\n\t//配列の要素数\n\tScanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n\n\t//配列の要素\n\tint A[] = new int[n];\t\n\tfor(int i=0;i<A.length;i++){\n\t A[i]= scanner.nextInt();\n\t}\n\tbubbleSort(A,n);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int A[] = new int[n];",
"A",
"new int[n]",
"n",
"for(int i=0;i<A.length;i++){\n\t A[i]= scanner.nextInt();\n\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n\t A[i]= scanner.nextInt();\n\t}",
"{\n\t A[i]= scanner.nextInt();\n\t}",
"A[i]= scanner.nextInt()",
"A[i]",
"A",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"bubbleSort(A,n)",
"bubbleSort",
"A",
"n",
"String[] args",
"args",
"//並べ替え\n private static void bubbleSort(int A[],int N){\n\tint flag = 1;\n\tint count = 0;\n\n\twhile(flag != 0){\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}\n\tPrint(A,N);\n\tSystem.out.println(count);\n }",
"bubbleSort",
"{\n\tint flag = 1;\n\tint count = 0;\n\n\twhile(flag != 0){\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}\n\tPrint(A,N);\n\tSystem.out.println(count);\n }",
"int flag = 1;",
"flag",
"1",
"int count = 0;",
"count",
"0",
"while(flag != 0){\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}",
"flag != 0",
"flag",
"0",
"{\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}",
"flag = 0",
"flag",
"0",
"for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }",
"int j=N-1;",
"int j=N-1;",
"j",
"N-1",
"N",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }",
"{\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }",
"if(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}",
"int v = A[j];",
"v",
"A[j]",
"A",
"j",
"int w = A[j-1];",
"w",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j] = w",
"A[j]",
"A",
"j",
"w",
"A[j-1] = v",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"v",
"flag = 1",
"flag",
"1",
"count++",
"count",
"Print(A,N)",
"Print",
"A",
"N",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int A[]",
"A",
"int N",
"N",
"//表示\n private static void Print(int A[], int n){\n\tfor(int k=0;k<A.length;k++){\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}\n\tSystem.out.println();\n }",
"Print",
"{\n\tfor(int k=0;k<A.length;k++){\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}\n\tSystem.out.println();\n }",
"for(int k=0;k<A.length;k++){\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}",
"int k=0;",
"int k=0;",
"k",
"0",
"k<A.length",
"k",
"A.length",
"A",
"A.length",
"k++",
"k++",
"k",
"{\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}",
"{\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}",
"System.out.print(A[k])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[k]",
"A",
"k",
"if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }",
"k < (n-1)",
"k",
"(n-1)",
"n",
"1",
"{\n\t\tSystem.out.print(\" \");\n\t }",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int A[]",
"A",
"int n",
"n",
"public class Main{\n public static void main(String[] args){\n\n\t//配列の要素数\n\tScanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n\n\t//配列の要素\n\tint A[] = new int[n];\t\n\tfor(int i=0;i<A.length;i++){\n\t A[i]= scanner.nextInt();\n\t}\n\tbubbleSort(A,n);\n }\n //並べ替え\n private static void bubbleSort(int A[],int N){\n\tint flag = 1;\n\tint count = 0;\n\n\twhile(flag != 0){\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}\n\tPrint(A,N);\n\tSystem.out.println(count);\n }\n //表示\n private static void Print(int A[], int n){\n\tfor(int k=0;k<A.length;k++){\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}\n\tSystem.out.println();\n }\n}",
"public class Main{\n public static void main(String[] args){\n\n\t//配列の要素数\n\tScanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n\n\t//配列の要素\n\tint A[] = new int[n];\t\n\tfor(int i=0;i<A.length;i++){\n\t A[i]= scanner.nextInt();\n\t}\n\tbubbleSort(A,n);\n }\n //並べ替え\n private static void bubbleSort(int A[],int N){\n\tint flag = 1;\n\tint count = 0;\n\n\twhile(flag != 0){\n\t flag = 0;\n\t for(int j=N-1; j > 0; j--){\n\t\tif(A[j] < A[j-1]){\n\t\t int v = A[j];\n\t\t int w = A[j-1];\n\t\t A[j] = w;\n\t\t A[j-1] = v;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\t\n\t }\n\t}\n\tPrint(A,N);\n\tSystem.out.println(count);\n }\n //表示\n private static void Print(int A[], int n){\n\tfor(int k=0;k<A.length;k++){\n\t System.out.print(A[k]);\n\t if(k < (n-1)){\n\t\tSystem.out.print(\" \");\n\t }\n\t}\n\tSystem.out.println();\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
//配列の要素数
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
//配列の要素
int A[] = new int[n];
for(int i=0;i<A.length;i++){
A[i]= scanner.nextInt();
}
bubbleSort(A,n);
}
//並べ替え
private static void bubbleSort(int A[],int N){
int flag = 1;
int count = 0;
while(flag != 0){
flag = 0;
for(int j=N-1; j > 0; j--){
if(A[j] < A[j-1]){
int v = A[j];
int w = A[j-1];
A[j] = w;
A[j-1] = v;
flag = 1;
count++;
}
}
}
Print(A,N);
System.out.println(count);
}
//表示
private static void Print(int A[], int n){
for(int k=0;k<A.length;k++){
System.out.print(A[k]);
if(k < (n-1)){
System.out.print(" ");
}
}
System.out.println();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
0,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
40,
13,
4,
13,
13,
13,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
188,
8
],
[
188,
9
],
[
9,
10
],
[
9,
11
],
[
188,
12
],
[
12,
13
],
[
188,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
188,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
27,
30
],
[
30,
31
],
[
31,
32
],
[
24,
33
],
[
33,
34
],
[
33,
35
],
[
24,
37
],
[
37,
38
],
[
37,
39
],
[
24,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
45,
46
],
[
45,
47
],
[
40,
48
],
[
48,
49
],
[
49,
50
],
[
40,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
60,
61
],
[
24,
62
],
[
62,
63
],
[
62,
64
],
[
24,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
65,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
79,
88
],
[
88,
89
],
[
88,
90
],
[
79,
91
],
[
91,
92
],
[
92,
93
],
[
79,
94
],
[
95,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
96,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
109,
110
],
[
109,
111
],
[
109,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
24,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
116,
126
],
[
126,
127
],
[
127,
128
],
[
116,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
130,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
146,
148
],
[
24,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
24,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
188,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
163,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
173,
174
],
[
173,
175
],
[
163,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
161,
181
],
[
181,
182
],
[
161,
183
],
[
183,
184
],
[
161,
185
],
[
185,
186
],
[
0,
187
],
[
187,
188
],
[
187,
189
]
] | [
"\nimport java.io.*;\nimport java.util.*;\n\npublic class Main {\n\n private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n private static StringTokenizer st;\n\n public static void main ( String [] args ) throws IOException\n {\n\tnew Main().cal();\n }\n\n \n private void cal() throws IOException \n {\n\tint N = Integer.parseInt(br.readLine());\n\tint [] nums = new int[N];\n\n\tst = new StringTokenizer(br.readLine());\n\tfor(int i = 0; i < N; i++)\n\t nums[i] = Integer.parseInt(st.nextToken());\n\n\tint count = 0;\n\tfor(int i = 0; i < nums.length; i++)\n\t for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }\n\t\n\tfor(int i = 0; i < nums.length; i++){\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}\n\tSystem.out.println(\"\");\n\t \n\tSystem.out.println(count);\n }\n\n private void swap(int [] nums, final int i, final int j) {\n\tint temp = nums[j];\n\tnums[j] = nums[i];\n\tnums[i] = temp;\n }\n\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n private static StringTokenizer st;\n\n public static void main ( String [] args ) throws IOException\n {\n\tnew Main().cal();\n }\n\n \n private void cal() throws IOException \n {\n\tint N = Integer.parseInt(br.readLine());\n\tint [] nums = new int[N];\n\n\tst = new StringTokenizer(br.readLine());\n\tfor(int i = 0; i < N; i++)\n\t nums[i] = Integer.parseInt(st.nextToken());\n\n\tint count = 0;\n\tfor(int i = 0; i < nums.length; i++)\n\t for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }\n\t\n\tfor(int i = 0; i < nums.length; i++){\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}\n\tSystem.out.println(\"\");\n\t \n\tSystem.out.println(count);\n }\n\n private void swap(int [] nums, final int i, final int j) {\n\tint temp = nums[j];\n\tnums[j] = nums[i];\n\tnums[i] = temp;\n }\n\n}",
"Main",
"private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"private static StringTokenizer st;",
"st",
"public static void main ( String [] args ) throws IOException\n {\n\tnew Main().cal();\n }",
"main",
"{\n\tnew Main().cal();\n }",
"new Main().cal()",
"new Main().cal",
"new Main()",
"String [] args",
"args",
"private void cal() throws IOException \n {\n\tint N = Integer.parseInt(br.readLine());\n\tint [] nums = new int[N];\n\n\tst = new StringTokenizer(br.readLine());\n\tfor(int i = 0; i < N; i++)\n\t nums[i] = Integer.parseInt(st.nextToken());\n\n\tint count = 0;\n\tfor(int i = 0; i < nums.length; i++)\n\t for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }\n\t\n\tfor(int i = 0; i < nums.length; i++){\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}\n\tSystem.out.println(\"\");\n\t \n\tSystem.out.println(count);\n }",
"cal",
"{\n\tint N = Integer.parseInt(br.readLine());\n\tint [] nums = new int[N];\n\n\tst = new StringTokenizer(br.readLine());\n\tfor(int i = 0; i < N; i++)\n\t nums[i] = Integer.parseInt(st.nextToken());\n\n\tint count = 0;\n\tfor(int i = 0; i < nums.length; i++)\n\t for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }\n\t\n\tfor(int i = 0; i < nums.length; i++){\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}\n\tSystem.out.println(\"\");\n\t \n\tSystem.out.println(count);\n }",
"int N = Integer.parseInt(br.readLine());",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int [] nums = new int[N];",
"nums",
"new int[N]",
"N",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"for(int i = 0; i < N; i++)\n\t nums[i] = Integer.parseInt(st.nextToken());",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"nums[i] = Integer.parseInt(st.nextToken());",
"nums[i] = Integer.parseInt(st.nextToken())",
"nums[i]",
"nums",
"i",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < nums.length; i++)\n\t for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < nums.length",
"i",
"nums.length",
"nums",
"nums.length",
"i++",
"i++",
"i",
"for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }",
"for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }",
"int j = nums.length-1;",
"int j = nums.length-1;",
"j",
"nums.length-1",
"nums.length",
"nums",
"nums.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }",
"{\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }",
"if ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}",
"nums[j] < nums[j-1]",
"nums[j]",
"nums",
"j",
"nums[j-1]",
"nums",
"j-1",
"j",
"1",
"{\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}",
"count++",
"count",
"swap(nums, j, j-1)",
"swap",
"nums",
"j",
"j-1",
"j",
"1",
"for(int i = 0; i < nums.length; i++){\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < nums.length",
"i",
"nums.length",
"nums",
"nums.length",
"i++",
"i++",
"i",
"{\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}",
"{\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}",
"if ( i > 0 ) System.out.print(\" \");",
"i > 0",
"i",
"0",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(nums[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"nums[i]",
"nums",
"i",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"private void swap(int [] nums, final int i, final int j) {\n\tint temp = nums[j];\n\tnums[j] = nums[i];\n\tnums[i] = temp;\n }",
"swap",
"{\n\tint temp = nums[j];\n\tnums[j] = nums[i];\n\tnums[i] = temp;\n }",
"int temp = nums[j];",
"temp",
"nums[j]",
"nums",
"j",
"nums[j] = nums[i]",
"nums[j]",
"nums",
"j",
"nums[i]",
"nums",
"i",
"nums[i] = temp",
"nums[i]",
"nums",
"i",
"temp",
"int [] nums",
"nums",
"final int i",
"i",
"final int j",
"j",
"public class Main {\n\n private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n private static StringTokenizer st;\n\n public static void main ( String [] args ) throws IOException\n {\n\tnew Main().cal();\n }\n\n \n private void cal() throws IOException \n {\n\tint N = Integer.parseInt(br.readLine());\n\tint [] nums = new int[N];\n\n\tst = new StringTokenizer(br.readLine());\n\tfor(int i = 0; i < N; i++)\n\t nums[i] = Integer.parseInt(st.nextToken());\n\n\tint count = 0;\n\tfor(int i = 0; i < nums.length; i++)\n\t for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }\n\t\n\tfor(int i = 0; i < nums.length; i++){\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}\n\tSystem.out.println(\"\");\n\t \n\tSystem.out.println(count);\n }\n\n private void swap(int [] nums, final int i, final int j) {\n\tint temp = nums[j];\n\tnums[j] = nums[i];\n\tnums[i] = temp;\n }\n\n}",
"public class Main {\n\n private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); \n private static StringTokenizer st;\n\n public static void main ( String [] args ) throws IOException\n {\n\tnew Main().cal();\n }\n\n \n private void cal() throws IOException \n {\n\tint N = Integer.parseInt(br.readLine());\n\tint [] nums = new int[N];\n\n\tst = new StringTokenizer(br.readLine());\n\tfor(int i = 0; i < N; i++)\n\t nums[i] = Integer.parseInt(st.nextToken());\n\n\tint count = 0;\n\tfor(int i = 0; i < nums.length; i++)\n\t for( int j = nums.length-1; j > i; j--) {\n\t\tif ( nums[j] < nums[j-1] ) {\n\t\t count++;\n\t\t swap(nums, j, j-1);\n\t\t}\n\n\t }\n\t\n\tfor(int i = 0; i < nums.length; i++){\n\t if ( i > 0 ) System.out.print(\" \");\n\t System.out.print(nums[i]);\n\t}\n\tSystem.out.println(\"\");\n\t \n\tSystem.out.println(count);\n }\n\n private void swap(int [] nums, final int i, final int j) {\n\tint temp = nums[j];\n\tnums[j] = nums[i];\n\tnums[i] = temp;\n }\n\n}",
"Main"
] |
import java.io.*;
import java.util.*;
public class Main {
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer st;
public static void main ( String [] args ) throws IOException
{
new Main().cal();
}
private void cal() throws IOException
{
int N = Integer.parseInt(br.readLine());
int [] nums = new int[N];
st = new StringTokenizer(br.readLine());
for(int i = 0; i < N; i++)
nums[i] = Integer.parseInt(st.nextToken());
int count = 0;
for(int i = 0; i < nums.length; i++)
for( int j = nums.length-1; j > i; j--) {
if ( nums[j] < nums[j-1] ) {
count++;
swap(nums, j, j-1);
}
}
for(int i = 0; i < nums.length; i++){
if ( i > 0 ) System.out.print(" ");
System.out.print(nums[i]);
}
System.out.println("");
System.out.println(count);
}
private void swap(int [] nums, final int i, final int j) {
int temp = nums[j];
nums[j] = nums[i];
nums[i] = temp;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
42,
4,
18,
13,
30,
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,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
13,
2,
13,
17,
40,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
8,
2,
13,
2,
13,
17,
17,
17,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
173,
5
],
[
173,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
12,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
16,
22
],
[
22,
23
],
[
22,
24
],
[
16,
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
],
[
16,
46
],
[
46,
47
],
[
46,
48
],
[
16,
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
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
62,
72
],
[
72,
73
],
[
73,
74
],
[
62,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
16,
97
],
[
97,
98
],
[
97,
99
],
[
97,
100
],
[
16,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
6,
107
],
[
107,
108
],
[
173,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
121,
123
],
[
111,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
109,
129
],
[
129,
130
],
[
109,
131
],
[
131,
132
],
[
109,
133
],
[
133,
134
],
[
173,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
138,
149
],
[
150,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
160,
166
],
[
160,
167
],
[
135,
168
],
[
168,
169
],
[
135,
170
],
[
170,
171
],
[
0,
172
],
[
172,
173
],
[
172,
174
]
] | [
"import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()){\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }\n }\n \n public static void swap(int[] a,int i,int j){\n int t = a[j];a[j] = a[i];a[i] = t;\n }\n \n public static void PrintOut(int[] a,int n){\n for(int i = 0;i < n;i++){\n System.out.print(a[i] + ((i == n-1)?\"\\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 while(scan.hasNext()){\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }\n }\n \n public static void swap(int[] a,int i,int j){\n int t = a[j];a[j] = a[i];a[i] = t;\n }\n \n public static void PrintOut(int[] a,int n){\n for(int i = 0;i < n;i++){\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()){\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()){\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"while(scan.hasNext()){\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }",
"scan.hasNext()",
"scan.hasNext",
"scan",
"{\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] bSort = new int[n];",
"bSort",
"new int[n]",
"n",
"for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n bSort[i] = scan.nextInt();\n }",
"{\n bSort[i] = scan.nextInt();\n }",
"bSort[i] = scan.nextInt()",
"bSort[i]",
"bSort",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count = 0;",
"count",
"0",
"for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }",
"{\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }",
"for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }",
"{\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }",
"if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }",
"bSort[j] < bSort[j-1]",
"bSort[j]",
"bSort",
"j",
"bSort[j-1]",
"bSort",
"j-1",
"j",
"1",
"{\n swap(bSort,j,j-1);\n count++;\n }",
"swap(bSort,j,j-1)",
"swap",
"bSort",
"j",
"j-1",
"j",
"1",
"count++",
"count",
"PrintOut(bSort,n)",
"PrintOut",
"bSort",
"n",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static void swap(int[] a,int i,int j){\n int t = a[j];a[j] = a[i];a[i] = t;\n }",
"swap",
"{\n int t = a[j];a[j] = a[i];a[i] = t;\n }",
"int t = a[j];",
"t",
"a[j]",
"a",
"j",
"a[j] = a[i]",
"a[j]",
"a",
"j",
"a[i]",
"a",
"i",
"a[i] = t",
"a[i]",
"a",
"i",
"t",
"int[] a",
"a",
"int i",
"i",
"int j",
"j",
"public static void PrintOut(int[] a,int n){\n for(int i = 0;i < n;i++){\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }\n }",
"PrintOut",
"{\n for(int i = 0;i < n;i++){\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }\n }",
"for(int i = 0;i < n;i++){\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }",
"{\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }",
"System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"))",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i] + ((i == n-1)?\"\\n\":\" \")",
"a[i]",
"a",
"i",
"((i == n-1)?\"\\n\":\" \")",
"(i == n-1)",
"i",
"n-1",
"n",
"1",
"\"\\n\"",
"\" \"",
"int[] a",
"a",
"int n",
"n",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()){\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }\n }\n \n public static void swap(int[] a,int i,int j){\n int t = a[j];a[j] = a[i];a[i] = t;\n }\n \n public static void PrintOut(int[] a,int n){\n for(int i = 0;i < n;i++){\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()){\n int n = scan.nextInt();\n int[] bSort = new int[n];\n for(int i = 0;i < n;i++){\n bSort[i] = scan.nextInt();\n }\n int count = 0;\n for(int i = 0;i < n;i++){\n for(int j = n-1;j > i;j--){\n if(bSort[j] < bSort[j-1]){\n swap(bSort,j,j-1);\n count++;\n }\n }\n }\n PrintOut(bSort,n);\n System.out.println(count);\n }\n }\n \n public static void swap(int[] a,int i,int j){\n int t = a[j];a[j] = a[i];a[i] = t;\n }\n \n public static void PrintOut(int[] a,int n){\n for(int i = 0;i < n;i++){\n System.out.print(a[i] + ((i == n-1)?\"\\n\":\" \"));\n }\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()){
int n = scan.nextInt();
int[] bSort = new int[n];
for(int i = 0;i < n;i++){
bSort[i] = scan.nextInt();
}
int count = 0;
for(int i = 0;i < n;i++){
for(int j = n-1;j > i;j--){
if(bSort[j] < bSort[j-1]){
swap(bSort,j,j-1);
count++;
}
}
}
PrintOut(bSort,n);
System.out.println(count);
}
}
public static void swap(int[] a,int i,int j){
int t = a[j];a[j] = a[i];a[i] = t;
}
public static void PrintOut(int[] a,int n){
for(int i = 0;i < n;i++){
System.out.print(a[i] + ((i == n-1)?"\n":" "));
}
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
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,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
4,
18,
18,
13,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
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
],
[
159,
11
],
[
159,
12
],
[
12,
13
],
[
12,
14
],
[
159,
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
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
17,
49
],
[
49,
50
],
[
49,
51
],
[
17,
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
],
[
65,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
65,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
90,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
105,
111
],
[
90,
112
],
[
112,
113
],
[
17,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
17,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
122,
130
],
[
130,
131
],
[
131,
132
],
[
122,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
17,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
17,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
15,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
] | [
"import java.util.*;\nimport java.io.*;\nimport java.lang.*;\n\npublic class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) a[i] = input.nextInt();\n int swaps = 0;\n for (int i = 0; i < n; ++i) {\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }\n System.out.print(a[0]);\n for (int i = 1; i < n; ++i) System.out.print(\" \" + a[i]);\n System.out.println(\"\"); \n System.out.println(swaps);\n } \n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"public class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) a[i] = input.nextInt();\n int swaps = 0;\n for (int i = 0; i < n; ++i) {\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }\n System.out.print(a[0]);\n for (int i = 1; i < n; ++i) System.out.print(\" \" + a[i]);\n System.out.println(\"\"); \n System.out.println(swaps);\n } \n}",
"Main",
"static final int INF = 1000000000;",
"INF",
"1000000000",
"public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) a[i] = input.nextInt();\n int swaps = 0;\n for (int i = 0; i < n; ++i) {\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }\n System.out.print(a[0]);\n for (int i = 1; i < n; ++i) System.out.print(\" \" + a[i]);\n System.out.println(\"\"); \n System.out.println(swaps);\n }",
"main",
"{ \n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) a[i] = input.nextInt();\n int swaps = 0;\n for (int i = 0; i < n; ++i) {\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }\n System.out.print(a[0]);\n for (int i = 1; i < n; ++i) System.out.print(\" \" + a[i]);\n System.out.println(\"\"); \n System.out.println(swaps);\n }",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int n = input.nextInt();",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; ++i) a[i] = input.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"a[i] = input.nextInt();",
"a[i] = input.nextInt()",
"a[i]",
"a",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"int swaps = 0;",
"swaps",
"0",
"for (int i = 0; i < n; ++i) {\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"{\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }",
"{\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }",
"for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }",
"int k = n - 1;",
"int k = n - 1;",
"k",
"n - 1",
"n",
"1",
"k > i",
"k",
"i",
"--k",
"--k",
"k",
"{\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }",
"{\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }",
"if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }",
"a[k] < a[k - 1]",
"a[k]",
"a",
"k",
"a[k - 1]",
"a",
"k - 1",
"k",
"1",
"{\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }",
"int temp = a[k];",
"temp",
"a[k]",
"a",
"k",
"a[k] = a[k - 1]",
"a[k]",
"a",
"k",
"a[k - 1]",
"a",
"k - 1",
"k",
"1",
"a[k - 1] = temp",
"a[k - 1]",
"a",
"k - 1",
"k",
"1",
"temp",
"++swaps",
"swaps",
"System.out.print(a[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[0]",
"a",
"0",
"for (int i = 1; i < n; ++i) System.out.print(\" \" + a[i]);",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"System.out.print(\" \" + a[i]);",
"System.out.print(\" \" + a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \" + a[i]",
"\" \"",
"a[i]",
"a",
"i",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(swaps)",
"System.out.println",
"System.out",
"System",
"System.out",
"swaps",
"String[] args",
"args",
"public class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) a[i] = input.nextInt();\n int swaps = 0;\n for (int i = 0; i < n; ++i) {\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }\n System.out.print(a[0]);\n for (int i = 1; i < n; ++i) System.out.print(\" \" + a[i]);\n System.out.println(\"\"); \n System.out.println(swaps);\n } \n}",
"public class Main {\n static final int INF = 1000000000; \n \n public static void main(String[] args) throws Exception { \n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; ++i) a[i] = input.nextInt();\n int swaps = 0;\n for (int i = 0; i < n; ++i) {\n for (int k = n - 1; k > i; --k) {\n if (a[k] < a[k - 1]) {\n int temp = a[k];\n a[k] = a[k - 1];\n a[k - 1] = temp;\n ++swaps;\n }\n }\n }\n System.out.print(a[0]);\n for (int i = 1; i < n; ++i) System.out.print(\" \" + a[i]);\n System.out.println(\"\"); \n System.out.println(swaps);\n } \n}",
"Main"
] | import java.util.*;
import java.io.*;
import java.lang.*;
public class Main {
static final int INF = 1000000000;
public static void main(String[] args) throws Exception {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; ++i) a[i] = input.nextInt();
int swaps = 0;
for (int i = 0; i < n; ++i) {
for (int k = n - 1; k > i; --k) {
if (a[k] < a[k - 1]) {
int temp = a[k];
a[k] = a[k - 1];
a[k - 1] = temp;
++swaps;
}
}
}
System.out.print(a[0]);
for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
System.out.println("");
System.out.println(swaps);
}
} |
[
7,
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,
4,
18,
4,
18,
13,
17,
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,
17,
41,
13,
17,
42,
40,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
2,
17,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
165,
5
],
[
165,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
26,
31
],
[
8,
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
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
58,
60
],
[
8,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
68,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
68,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
90,
91
],
[
90,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
93,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
108,
114
],
[
93,
115
],
[
115,
116
],
[
115,
117
],
[
93,
118
],
[
118,
119
],
[
8,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
120,
128
],
[
128,
129
],
[
129,
130
],
[
120,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
138,
140
],
[
132,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
141,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
8,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
159,
160
],
[
159,
161
],
[
6,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] | [
"import java.util.*;\n\npublic class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n int[] arr = new int[n];\n String[] input = sc.nextLine().split(\" \");\n for(int i = 0; i < n; i ++) {\n arr[i] = Integer.parseInt(input[i]);\n }\n \n int counter = 0;\n boolean comp = false;\n while(!comp) {\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }\n \n for(int i = 0; i < n; i ++) {\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }\n System.out.println(\"\\n\" + counter);\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 = Integer.parseInt(sc.nextLine());\n int[] arr = new int[n];\n String[] input = sc.nextLine().split(\" \");\n for(int i = 0; i < n; i ++) {\n arr[i] = Integer.parseInt(input[i]);\n }\n \n int counter = 0;\n boolean comp = false;\n while(!comp) {\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }\n \n for(int i = 0; i < n; i ++) {\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }\n System.out.println(\"\\n\" + counter);\n }\n}",
"Main",
"public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n int[] arr = new int[n];\n String[] input = sc.nextLine().split(\" \");\n for(int i = 0; i < n; i ++) {\n arr[i] = Integer.parseInt(input[i]);\n }\n \n int counter = 0;\n boolean comp = false;\n while(!comp) {\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }\n \n for(int i = 0; i < n; i ++) {\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }\n System.out.println(\"\\n\" + counter);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n int[] arr = new int[n];\n String[] input = sc.nextLine().split(\" \");\n for(int i = 0; i < n; i ++) {\n arr[i] = Integer.parseInt(input[i]);\n }\n \n int counter = 0;\n boolean comp = false;\n while(!comp) {\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }\n \n for(int i = 0; i < n; i ++) {\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }\n System.out.println(\"\\n\" + counter);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.nextLine());",
"n",
"Integer.parseInt(sc.nextLine())",
"Integer.parseInt",
"Integer",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"String[] input = sc.nextLine().split(\" \");",
"input",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"for(int i = 0; i < n; i ++) {\n arr[i] = Integer.parseInt(input[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i ++",
"i ++",
"i",
"{\n arr[i] = Integer.parseInt(input[i]);\n }",
"{\n arr[i] = Integer.parseInt(input[i]);\n }",
"arr[i] = Integer.parseInt(input[i])",
"arr[i]",
"arr",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"int counter = 0;",
"counter",
"0",
"boolean comp = false;",
"comp",
"false",
"while(!comp) {\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }",
"!comp",
"comp",
"{\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }",
"comp = true",
"comp",
"true",
"for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }",
"int i = n-1;",
"int i = n-1;",
"i",
"n-1",
"n",
"1",
"i >= 1",
"i",
"1",
"i --",
"i --",
"i",
"{\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }",
"{\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }",
"if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }",
"arr[i-1] > arr[i]",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"arr[i]",
"arr",
"i",
"{\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }",
"int temp = arr[i];",
"temp",
"arr[i]",
"arr",
"i",
"arr[i] = arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"arr[i-1] = temp",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"temp",
"comp = false",
"comp",
"false",
"counter ++",
"counter",
"for(int i = 0; i < n; i ++) {\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i ++",
"i ++",
"i",
"{\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }",
"{\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }",
"System.out.print(arr[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"arr[i]",
"arr",
"i",
"if(i != n-1) {\n System.out.print(\" \");\n }",
"i != n-1",
"i",
"n-1",
"n",
"1",
"{\n System.out.print(\" \");\n }",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(\"\\n\" + counter)",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\\n\" + counter",
"\"\\n\"",
"counter",
"String [] args",
"args",
"public class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n int[] arr = new int[n];\n String[] input = sc.nextLine().split(\" \");\n for(int i = 0; i < n; i ++) {\n arr[i] = Integer.parseInt(input[i]);\n }\n \n int counter = 0;\n boolean comp = false;\n while(!comp) {\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }\n \n for(int i = 0; i < n; i ++) {\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }\n System.out.println(\"\\n\" + counter);\n }\n}",
"public class Main {\n public static void main(String [] args) {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n int[] arr = new int[n];\n String[] input = sc.nextLine().split(\" \");\n for(int i = 0; i < n; i ++) {\n arr[i] = Integer.parseInt(input[i]);\n }\n \n int counter = 0;\n boolean comp = false;\n while(!comp) {\n comp = true;\n for(int i = n-1; i >= 1; i --) {\n if(arr[i-1] > arr[i]) {\n int temp = arr[i];\n arr[i] = arr[i-1];\n arr[i-1] = temp;\n comp = false;\n counter ++;\n }\n }\n }\n \n for(int i = 0; i < n; i ++) {\n System.out.print(arr[i]);\n if(i != n-1) {\n System.out.print(\" \");\n }\n }\n System.out.println(\"\\n\" + counter);\n }\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
int[] arr = new int[n];
String[] input = sc.nextLine().split(" ");
for(int i = 0; i < n; i ++) {
arr[i] = Integer.parseInt(input[i]);
}
int counter = 0;
boolean comp = false;
while(!comp) {
comp = true;
for(int i = n-1; i >= 1; i --) {
if(arr[i-1] > arr[i]) {
int temp = arr[i];
arr[i] = arr[i-1];
arr[i-1] = temp;
comp = false;
counter ++;
}
}
}
for(int i = 0; i < n; i ++) {
System.out.print(arr[i]);
if(i != n-1) {
System.out.print(" ");
}
}
System.out.println("\n" + counter);
}
}
|
[
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,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
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,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
8,
2,
13,
2,
13,
17,
17,
17,
18,
13,
13,
4,
18,
18,
13,
13,
17,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
153,
5
],
[
153,
6
],
[
6,
7
],
[
6,
8
],
[
153,
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
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
11,
41
],
[
41,
42
],
[
41,
43
],
[
11,
44
],
[
44,
45
],
[
44,
46
],
[
11,
47
],
[
47,
48
],
[
47,
49
],
[
11,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
62,
64
],
[
58,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
58,
70
],
[
70,
71
],
[
71,
72
],
[
58,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
75,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
99,
101
],
[
85,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
85,
107
],
[
107,
108
],
[
85,
109
],
[
109,
110
],
[
109,
111
],
[
54,
112
],
[
112,
113
],
[
11,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
114,
122
],
[
122,
123
],
[
123,
124
],
[
114,
125
],
[
126,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
132,
138
],
[
132,
139
],
[
127,
140
],
[
140,
141
],
[
140,
142
],
[
11,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
143,
149
],
[
9,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] | [
"import java.util.*;\n\npublic class Main{\n\tprivate static final Scanner scan = new Scanner(System.in);\n\n\tpublic static void main(String[] args){\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\tint i = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++){\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", count);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tprivate static final Scanner scan = new Scanner(System.in);\n\n\tpublic static void main(String[] args){\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\tint i = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++){\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", count);\n\t}\n}",
"Main",
"private static final Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"public static void main(String[] args){\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\tint i = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++){\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", count);\n\t}",
"main",
"{\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\tint i = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++){\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", count);\n\t}",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t\tarr[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarr[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tarr[i] = scan.nextInt();\n\t\t}",
"arr[i] = scan.nextInt()",
"arr[i]",
"arr",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count = 0;",
"count",
"0",
"int flag = 1;",
"flag",
"1",
"int i = 0;",
"i",
"0",
"while(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"flag = 0",
"flag",
"0",
"for(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j >= i+1",
"j",
"i+1",
"i",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}",
"if(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}",
"arr[j] < arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}",
"int big = arr[j-1];",
"big",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"arr[j-1] = arr[j]",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"arr[j]",
"arr",
"j",
"arr[j] = big",
"arr[j]",
"arr",
"j",
"big",
"count++",
"count",
"flag = 1",
"flag",
"1",
"i++",
"i",
"for(int j = 0; j < n; j++){\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}",
"{\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}",
"System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j])",
"System.out.printf",
"System.out",
"System",
"System.out",
"j != n-1? \"%d \" : \"%d\\n\"",
"j != n-1",
"j",
"n-1",
"n",
"1",
"\"%d \"",
"\"%d\\n\"",
"arr[j]",
"arr",
"j",
"System.out.printf(\"%d\\n\", count)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\\n\"",
"count",
"String[] args",
"args",
"public class Main{\n\tprivate static final Scanner scan = new Scanner(System.in);\n\n\tpublic static void main(String[] args){\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\tint i = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++){\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", count);\n\t}\n}",
"public class Main{\n\tprivate static final Scanner scan = new Scanner(System.in);\n\n\tpublic static void main(String[] args){\n\t\tint n = scan.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarr[i] = scan.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\tint i = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(arr[j] < arr[j-1]){\n\t\t\t\t\tint big = arr[j-1];\n\t\t\t\t\tarr[j-1] = arr[j];\n\t\t\t\t\tarr[j] = big;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++){\n\t\t\t System.out.printf(j != n-1? \"%d \" : \"%d\\n\", arr[j]);\n\t\t}\n\t\tSystem.out.printf(\"%d\\n\", count);\n\t}\n}",
"Main"
] | import java.util.*;
public class Main{
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args){
int n = scan.nextInt();
int[] arr = new int[n];
for(int i = 0; i < n; i++){
arr[i] = scan.nextInt();
}
int count = 0;
int flag = 1;
int i = 0;
while(flag == 1){
flag = 0;
for(int j = n-1; j >= i+1; j--){
if(arr[j] < arr[j-1]){
int big = arr[j-1];
arr[j-1] = arr[j];
arr[j] = big;
count++;
flag = 1;
}
}
i++;
}
for(int j = 0; j < n; j++){
System.out.printf(j != n-1? "%d " : "%d\n", arr[j]);
}
System.out.printf("%d\n", count);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
0,
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,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
17,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
154,
5
],
[
154,
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
],
[
8,
19
],
[
19,
20
],
[
19,
21
],
[
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
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
57,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
57,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
82,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
82,
104
],
[
104,
105
],
[
104,
106
],
[
82,
107
],
[
107,
108
],
[
8,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
114,
115
],
[
114,
116
],
[
109,
117
],
[
117,
118
],
[
118,
119
],
[
109,
120
],
[
121,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
122,
128
],
[
128,
129
],
[
128,
130
],
[
121,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
8,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
144,
150
],
[
6,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\n\t\tint N = sc.nextInt();\n\t\tint[] A;\n\t\tA = new int[N];\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t \tA[i]= sc.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < N; k++){\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\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);\t\n\t\tint N = sc.nextInt();\n\t\tint[] A;\n\t\tA = new int[N];\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t \tA[i]= sc.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < N; k++){\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\n\t\tint N = sc.nextInt();\n\t\tint[] A;\n\t\tA = new int[N];\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t \tA[i]= sc.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < N; k++){\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\t\n\t\tint N = sc.nextInt();\n\t\tint[] A;\n\t\tA = new int[N];\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t \tA[i]= sc.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < N; k++){\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\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;",
"A",
"A = new int[N]",
"A",
"new int[N]",
"N",
"for(int i = 0; i < N; i++){\n\t\t \tA[i]= sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t \tA[i]= sc.nextInt();\n\t\t}",
"{\n\t\t \tA[i]= sc.nextInt();\n\t\t}",
"A[i]= sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"int flag = 1;",
"flag",
"1",
"while(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = 0",
"flag",
"0",
"for(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}",
"if(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}",
"int temp = A[j];",
"temp",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = temp",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"temp",
"flag = 1",
"flag",
"1",
"count ++",
"count",
"for(int k = 0; k < N; k++){\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}",
"int k = 0;",
"int k = 0;",
"k",
"0",
"k < N",
"k",
"N",
"k++",
"k++",
"k",
"{\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}",
"{\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}",
"System.out.printf(\"%d\",A[k])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\"",
"A[k]",
"A",
"k",
"if(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}",
"k != N - 1",
"k",
"N - 1",
"N",
"1",
"{\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}",
"System.out.printf(\" \")",
"System.out.printf",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.printf(\"\\n%d\\n\",count)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"\\n%d\\n\"",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\n\t\tint N = sc.nextInt();\n\t\tint[] A;\n\t\tA = new int[N];\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t \tA[i]= sc.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < N; k++){\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\t\n\t\tint N = sc.nextInt();\n\t\tint[] A;\n\t\tA = new int[N];\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t \tA[i]= sc.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tint flag = 1;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N - 1; j > 0; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tflag = 1; \n\t\t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int k = 0; k < N; k++){\n\t\t\tSystem.out.printf(\"%d\",A[k]);\n\t\t\tif(k != N - 1){\n\t\t\t\tSystem.out.printf(\" \");\n\t\t\t}\t\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\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[] A;
A = new int[N];
for(int i = 0; i < N; i++){
A[i]= sc.nextInt();
}
int count = 0;
int flag = 1;
while(flag == 1){
flag = 0;
for(int j = N - 1; j > 0; j--){
if(A[j] < A[j-1]){
int temp = A[j];
A[j] = A[j-1];
A[j-1] = temp;
flag = 1;
count ++;
}
}
}
for(int k = 0; k < N; k++){
System.out.printf("%d",A[k]);
if(k != N - 1){
System.out.printf(" ");
}
}
System.out.printf("\n%d\n",count);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
17,
0,
13,
20,
41,
13,
17,
0,
13,
4,
18,
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,
11,
1,
41,
13,
2,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
2,
13,
17,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
14,
2,
13,
2,
13,
17,
30,
4,
18,
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
],
[
171,
5
],
[
171,
6
],
[
6,
7
],
[
171,
8
],
[
8,
9
],
[
8,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
10,
18
],
[
18,
19
],
[
18,
20
],
[
10,
21
],
[
21,
22
],
[
21,
23
],
[
10,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
10,
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
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
10,
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
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
62,
74
],
[
74,
75
],
[
75,
76
],
[
62,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
79,
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
],
[
89,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
104,
110
],
[
89,
111
],
[
111,
112
],
[
10,
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
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
126,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
126,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
147,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
159,
160
],
[
159,
161
],
[
10,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
8,
168
],
[
168,
169
],
[
0,
170
],
[
170,
171
],
[
170,
172
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static Scanner sc;\n\t\n\tpublic static void main(String[] args) {\n\t\t//宣言\n\t\tint N=0;\n\t\tint A[]= new int[300];\n\t\tsc = new Scanner(System.in);\n\t\tint count=0;\n\t\t//入力\n\t\tN= sc.nextInt();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t\t//出力\n\t\tfor(int j=0;j<N;j++) {\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static Scanner sc;\n\t\n\tpublic static void main(String[] args) {\n\t\t//宣言\n\t\tint N=0;\n\t\tint A[]= new int[300];\n\t\tsc = new Scanner(System.in);\n\t\tint count=0;\n\t\t//入力\n\t\tN= sc.nextInt();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t\t//出力\n\t\tfor(int j=0;j<N;j++) {\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static Scanner sc;",
"sc",
"public static void main(String[] args) {\n\t\t//宣言\n\t\tint N=0;\n\t\tint A[]= new int[300];\n\t\tsc = new Scanner(System.in);\n\t\tint count=0;\n\t\t//入力\n\t\tN= sc.nextInt();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t\t//出力\n\t\tfor(int j=0;j<N;j++) {\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\t//宣言\n\t\tint N=0;\n\t\tint A[]= new int[300];\n\t\tsc = new Scanner(System.in);\n\t\tint count=0;\n\t\t//入力\n\t\tN= sc.nextInt();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t\t//出力\n\t\tfor(int j=0;j<N;j++) {\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"int N=0;",
"N",
"0",
"int A[]= new int[300];",
"A",
"new int[300]",
"300",
"sc = new Scanner(System.in)",
"sc",
"new Scanner(System.in)",
"int count=0;",
"count",
"0",
"N= sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<N;i++) {\n\t\t\tA[i]=sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i]=sc.nextInt();\n\t\t}",
"A[i]=sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int j=0;j<N;j++) {\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<N",
"j",
"N",
"j++",
"j++",
"j",
"{\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}",
"{\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}",
"for(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int i=N-1;",
"int i=N-1;",
"i",
"N-1",
"N",
"1",
"i>=j+1",
"i",
"j+1",
"j",
"1",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"A[i]<A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int w = A[i];",
"w",
"A[i]",
"A",
"i",
"A[i]=A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i-1]=w",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"w",
"count++",
"count",
"for(int i=0;i<N;i++) {\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(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(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}",
"if(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}",
"i>=0 &&i<N-1",
"i>=0",
"i",
"0",
"i<N-1",
"i",
"N-1",
"N",
"1",
"{\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}",
"System.out.print(A[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]+\" \"",
"A[i]",
"A",
"i",
"\" \"",
"if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}",
"i==N-1",
"i",
"N-1",
"N",
"1",
"{\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}",
"System.out.println(A[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static Scanner sc;\n\t\n\tpublic static void main(String[] args) {\n\t\t//宣言\n\t\tint N=0;\n\t\tint A[]= new int[300];\n\t\tsc = new Scanner(System.in);\n\t\tint count=0;\n\t\t//入力\n\t\tN= sc.nextInt();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t\t//出力\n\t\tfor(int j=0;j<N;j++) {\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static Scanner sc;\n\t\n\tpublic static void main(String[] args) {\n\t\t//宣言\n\t\tint N=0;\n\t\tint A[]= new int[300];\n\t\tsc = new Scanner(System.in);\n\t\tint count=0;\n\t\t//入力\n\t\tN= sc.nextInt();\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tA[i]=sc.nextInt();\n\t\t}\n\t\t//出力\n\t\tfor(int j=0;j<N;j++) {\n\t\t\tfor(int i=N-1;i>=j+1;i--) {\n\t\t\t\tif(A[i]<A[i-1]) {\n\t\t\t\t\tint w = A[i];\n\t\t\t\t\tA[i]=A[i-1];\n\t\t\t\t\tA[i-1]=w;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\t\n\t\t}\n\t\tfor(int i=0;i<N;i++) {\n\t\t\tif(i>=0 &&i<N-1) {\n\t\t\t\tSystem.out.print(A[i]+\" \");\n\t\t\t}else if(i==N-1) {\n\t\t\t\tSystem.out.println(A[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static Scanner sc;
public static void main(String[] args) {
//宣言
int N=0;
int A[]= new int[300];
sc = new Scanner(System.in);
int count=0;
//入力
N= sc.nextInt();
for(int i=0;i<N;i++) {
A[i]=sc.nextInt();
}
//出力
for(int j=0;j<N;j++) {
for(int i=N-1;i>=j+1;i--) {
if(A[i]<A[i-1]) {
int w = A[i];
A[i]=A[i-1];
A[i-1]=w;
count++;
}
}
}
for(int i=0;i<N;i++) {
if(i>=0 &&i<N-1) {
System.out.print(A[i]+" ");
}else if(i==N-1) {
System.out.println(A[i]);
}
}
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,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
4,
18,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
4,
18,
13,
18,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
168,
5
],
[
168,
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
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
46,
58
],
[
58,
59
],
[
59,
60
],
[
46,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
63,
72
],
[
72,
73
],
[
72,
74
],
[
63,
75
],
[
75,
76
],
[
76,
77
],
[
63,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
87,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
90,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
105,
111
],
[
90,
112
],
[
112,
113
],
[
8,
114
],
[
114,
115
],
[
114,
116
],
[
8,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
117,
129
],
[
129,
130
],
[
130,
131
],
[
117,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
134,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
8,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
8,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
6,
165
],
[
165,
166
],
[
0,
167
],
[
167,
168
],
[
167,
169
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tnum[i]=scn.nextInt();\n\t\t}\n\t\tint tmp;\n\t\tint count=0;\n\t\tfor(int i=0; i<num.length-1; i++) {\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int a=0;a<num.length-1;a++ ) {\n\t\t\tsb.append(num[a]+\" \");\n\t\t}\n\t\tSystem.out.println(sb.append(num[num.length-1]).toString());\n\t\tSystem.out.println(count);\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 scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tnum[i]=scn.nextInt();\n\t\t}\n\t\tint tmp;\n\t\tint count=0;\n\t\tfor(int i=0; i<num.length-1; i++) {\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int a=0;a<num.length-1;a++ ) {\n\t\t\tsb.append(num[a]+\" \");\n\t\t}\n\t\tSystem.out.println(sb.append(num[num.length-1]).toString());\n\t\tSystem.out.println(count);\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tnum[i]=scn.nextInt();\n\t\t}\n\t\tint tmp;\n\t\tint count=0;\n\t\tfor(int i=0; i<num.length-1; i++) {\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int a=0;a<num.length-1;a++ ) {\n\t\t\tsb.append(num[a]+\" \");\n\t\t}\n\t\tSystem.out.println(sb.append(num[num.length-1]).toString());\n\t\tSystem.out.println(count);\n\n\t}",
"main",
"{\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tnum[i]=scn.nextInt();\n\t\t}\n\t\tint tmp;\n\t\tint count=0;\n\t\tfor(int i=0; i<num.length-1; i++) {\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int a=0;a<num.length-1;a++ ) {\n\t\t\tsb.append(num[a]+\" \");\n\t\t}\n\t\tSystem.out.println(sb.append(num[num.length-1]).toString());\n\t\tSystem.out.println(count);\n\n\t}",
"Scanner scn = new Scanner(System.in);",
"scn",
"new Scanner(System.in)",
"int n = scn.nextInt();",
"n",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int[] num = new int[n];",
"num",
"new int[n]",
"n",
"for (int i=0; i<n; i++) {\n\t\t\tnum[i]=scn.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i]=scn.nextInt();\n\t\t}",
"{\n\t\t\tnum[i]=scn.nextInt();\n\t\t}",
"num[i]=scn.nextInt()",
"num[i]",
"num",
"i",
"scn.nextInt()",
"scn.nextInt",
"scn",
"int tmp;",
"tmp",
"int count=0;",
"count",
"0",
"for(int i=0; i<num.length-1; i++) {\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num.length-1",
"i",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = num.length-1;",
"int j = num.length-1;",
"j",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"num[j-1]>num[j]",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"num[j]",
"num",
"j",
"{\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"tmp=num[j]",
"tmp",
"num[j]",
"num",
"j",
"num[j]=num[j-1]",
"num[j]",
"num",
"j",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"num[j-1]=tmp",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"tmp",
"count++",
"count",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for(int a=0;a<num.length-1;a++ ) {\n\t\t\tsb.append(num[a]+\" \");\n\t\t}",
"int a=0;",
"int a=0;",
"a",
"0",
"a<num.length-1",
"a",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"a++",
"a++",
"a",
"{\n\t\t\tsb.append(num[a]+\" \");\n\t\t}",
"{\n\t\t\tsb.append(num[a]+\" \");\n\t\t}",
"sb.append(num[a]+\" \")",
"sb.append",
"sb",
"num[a]+\" \"",
"num[a]",
"num",
"a",
"\" \"",
"System.out.println(sb.append(num[num.length-1]).toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.append(num[num.length-1]).toString()",
"sb.append(num[num.length-1]).toString",
"sb.append(num[num.length-1])",
"sb.append",
"sb",
"num[num.length-1]",
"num",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tnum[i]=scn.nextInt();\n\t\t}\n\t\tint tmp;\n\t\tint count=0;\n\t\tfor(int i=0; i<num.length-1; i++) {\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int a=0;a<num.length-1;a++ ) {\n\t\t\tsb.append(num[a]+\" \");\n\t\t}\n\t\tSystem.out.println(sb.append(num[num.length-1]).toString());\n\t\tSystem.out.println(count);\n\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scn = new Scanner(System.in);\n\t\tint n = scn.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tnum[i]=scn.nextInt();\n\t\t}\n\t\tint tmp;\n\t\tint count=0;\n\t\tfor(int i=0; i<num.length-1; i++) {\n\t\t\tfor(int j = num.length-1;j>i;j--) {\n\t\t\t\tif(num[j-1]>num[j]) {\n\t\t\t\t\ttmp=num[j];\n\t\t\t\t\tnum[j]=num[j-1];\n\t\t\t\t\tnum[j-1]=tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int a=0;a<num.length-1;a++ ) {\n\t\t\tsb.append(num[a]+\" \");\n\t\t}\n\t\tSystem.out.println(sb.append(num[num.length-1]).toString());\n\t\tSystem.out.println(count);\n\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int[] num = new int[n];
for (int i=0; i<n; i++) {
num[i]=scn.nextInt();
}
int tmp;
int count=0;
for(int i=0; i<num.length-1; i++) {
for(int j = num.length-1;j>i;j--) {
if(num[j-1]>num[j]) {
tmp=num[j];
num[j]=num[j-1];
num[j-1]=tmp;
count++;
}
}
}
StringBuilder sb = new StringBuilder();
for(int a=0;a<num.length-1;a++ ) {
sb.append(num[a]+" ");
}
System.out.println(sb.append(num[num.length-1]).toString());
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,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
160,
5
],
[
160,
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
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
53,
60
],
[
60,
61
],
[
60,
62
],
[
53,
63
],
[
63,
64
],
[
64,
65
],
[
53,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
78,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
78,
100
],
[
100,
101
],
[
100,
102
],
[
78,
103
],
[
103,
104
],
[
8,
105
],
[
105,
106
],
[
105,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
6,
114
],
[
114,
115
],
[
160,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
127,
140
],
[
141,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
118,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
116,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] | [
"import java.util.*;\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 int[] a = new int[n];\n for (int i = 0; i<n;i++){\n a[i] = sc.nextInt();\n }\n\n // sort begin\n boolean flag = true;\n int cnt = 0;\n while (flag){\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }\n //sort end\n print(a);\n System.out.println(cnt);\n }\n\n public static void print(int[] a){\n System.out.print(a[0]);\n for (int i=1;i<a.length;i++){\n System.out.print(\" \"+a[i]);\n }\n System.out.println();\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 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 // sort begin\n boolean flag = true;\n int cnt = 0;\n while (flag){\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }\n //sort end\n print(a);\n System.out.println(cnt);\n }\n\n public static void print(int[] a){\n System.out.print(a[0]);\n for (int i=1;i<a.length;i++){\n System.out.print(\" \"+a[i]);\n }\n System.out.println();\n }\n}",
"Main",
"public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\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 // sort begin\n boolean flag = true;\n int cnt = 0;\n while (flag){\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }\n //sort end\n print(a);\n System.out.println(cnt);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\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 // sort begin\n boolean flag = true;\n int cnt = 0;\n while (flag){\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }\n //sort end\n print(a);\n System.out.println(cnt);\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",
"boolean flag = true;",
"flag",
"true",
"int cnt = 0;",
"cnt",
"0",
"while (flag){\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j>0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }",
"{\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }",
"if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }",
"a[j]<a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"{\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }",
"int temp = a[j];",
"temp",
"a[j]",
"a",
"j",
"a[j] = a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1] = temp",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"temp",
"flag = true",
"flag",
"true",
"cnt++",
"cnt",
"print(a)",
"print",
"a",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String args[]",
"args",
"public static void print(int[] a){\n System.out.print(a[0]);\n for (int i=1;i<a.length;i++){\n System.out.print(\" \"+a[i]);\n }\n System.out.println();\n }",
"print",
"{\n System.out.print(a[0]);\n for (int i=1;i<a.length;i++){\n System.out.print(\" \"+a[i]);\n }\n System.out.println();\n }",
"System.out.print(a[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[0]",
"a",
"0",
"for (int i=1;i<a.length;i++){\n System.out.print(\" \"+a[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n System.out.print(\" \"+a[i]);\n }",
"{\n System.out.print(\" \"+a[i]);\n }",
"System.out.print(\" \"+a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"+a[i]",
"\" \"",
"a[i]",
"a",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int[] a",
"a",
"public class Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\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 // sort begin\n boolean flag = true;\n int cnt = 0;\n while (flag){\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }\n //sort end\n print(a);\n System.out.println(cnt);\n }\n\n public static void print(int[] a){\n System.out.print(a[0]);\n for (int i=1;i<a.length;i++){\n System.out.print(\" \"+a[i]);\n }\n System.out.println();\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 int[] a = new int[n];\n for (int i = 0; i<n;i++){\n a[i] = sc.nextInt();\n }\n\n // sort begin\n boolean flag = true;\n int cnt = 0;\n while (flag){\n flag = false;\n for (int j = n-1; j>0; j--){\n if (a[j]<a[j-1]){\n int temp = a[j];\n a[j] = a[j-1];\n a[j-1] = temp;\n flag = true;\n cnt++;\n }\n }\n }\n //sort end\n print(a);\n System.out.println(cnt);\n }\n\n public static void print(int[] a){\n System.out.print(a[0]);\n for (int i=1;i<a.length;i++){\n System.out.print(\" \"+a[i]);\n }\n System.out.println();\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();
}
// sort begin
boolean flag = true;
int cnt = 0;
while (flag){
flag = false;
for (int j = n-1; j>0; j--){
if (a[j]<a[j-1]){
int temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
flag = true;
cnt++;
}
}
}
//sort end
print(a);
System.out.println(cnt);
}
public static void print(int[] a){
System.out.print(a[0]);
for (int i=1;i<a.length;i++){
System.out.print(" "+a[i]);
}
System.out.println();
}
} |
[
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,
4,
18,
13,
4,
18,
13,
4,
18,
18,
13,
13,
18,
13,
13,
23,
13,
6,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
0,
18,
36,
13,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
18,
36,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
18,
36,
13,
13,
18,
18,
36,
13,
2,
13,
17,
30,
0,
13,
18,
18,
36,
13,
13,
0,
18,
18,
36,
13,
13,
18,
18,
36,
13,
2,
13,
17,
0,
18,
18,
36,
13,
2,
13,
17,
13,
0,
13,
17,
40,
18,
36,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
36,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
18,
36,
13,
13,
14,
2,
13,
2,
18,
36,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
226,
5
],
[
226,
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,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
8,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
6,
61
],
[
61,
62
],
[
0,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
63,
67
],
[
67,
68
],
[
63,
69
],
[
69,
70
],
[
63,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
73,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
73,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
71,
89
],
[
89,
90
],
[
71,
91
],
[
91,
92
],
[
63,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
95,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
108,
117
],
[
117,
118
],
[
117,
119
],
[
108,
120
],
[
120,
121
],
[
121,
122
],
[
108,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
126,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
136,
138
],
[
125,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
139,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
147,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
157,
159
],
[
139,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
165,
167
],
[
160,
168
],
[
139,
169
],
[
169,
170
],
[
169,
171
],
[
139,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
63,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
179,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
179,
189
],
[
189,
190
],
[
190,
191
],
[
179,
192
],
[
193,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
194,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
199,
203
],
[
193,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
207,
211
],
[
204,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
178,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
219,
224
],
[
0,
225
],
[
225,
226
],
[
225,
227
]
] | [
"import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner( System.in );\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 sc.close();\n Sort s = new Sort( n, a );\n s.bubblesort();\n s.printA();\n System.out.println( s.count );\n }\n}\n\nclass Sort {\n public int N;\n public int[] A;\n public int count;\n\n Sort( int N, int[] A ){\n this.N = N;\n this.A = A;\n this.count = 0;\n }\n\n public void bubblesort(){\n int tmp = 0;\n boolean flag = true;\n while( flag ){\n flag = false;\n for( int j = this.N-1; j > 0 ; j-- ){\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }\n }\n }\n\n public void printA(){\n for( int i = 0; i < this.N; i++ ){\n System.out.print( this.A[i] );\n if( i != this.N - 1 ){\n System.out.print( \" \" );\n }\n }\n System.out.println(\"\");\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\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 sc.close();\n Sort s = new Sort( n, a );\n s.bubblesort();\n s.printA();\n System.out.println( s.count );\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner( System.in );\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 sc.close();\n Sort s = new Sort( n, a );\n s.bubblesort();\n s.printA();\n System.out.println( s.count );\n }",
"main",
"{\n Scanner sc = new Scanner( System.in );\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 sc.close();\n Sort s = new Sort( n, a );\n s.bubblesort();\n s.printA();\n System.out.println( s.count );\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",
"sc.close()",
"sc.close",
"sc",
"Sort s = new Sort( n, a );",
"s",
"new Sort( n, a )",
"s.bubblesort()",
"s.bubblesort",
"s",
"s.printA()",
"s.printA",
"s",
"System.out.println( s.count )",
"System.out.println",
"System.out",
"System",
"System.out",
"s.count",
"s",
"s.count",
"String[] args",
"args",
"class Sort {\n public int N;\n public int[] A;\n public int count;\n\n Sort( int N, int[] A ){\n this.N = N;\n this.A = A;\n this.count = 0;\n }\n\n public void bubblesort(){\n int tmp = 0;\n boolean flag = true;\n while( flag ){\n flag = false;\n for( int j = this.N-1; j > 0 ; j-- ){\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }\n }\n }\n\n public void printA(){\n for( int i = 0; i < this.N; i++ ){\n System.out.print( this.A[i] );\n if( i != this.N - 1 ){\n System.out.print( \" \" );\n }\n }\n System.out.println(\"\");\n }\n}",
"Sort",
"public int N;",
"N",
"public int[] A;",
"A",
"public int count;",
"count",
"Sort( int N, int[] A ){\n this.N = N;\n this.A = A;\n this.count = 0;\n }",
"Sort",
"{\n this.N = N;\n this.A = A;\n this.count = 0;\n }",
"this.N = N",
"this.N",
"this",
"this.N",
"N",
"this.A = A",
"this.A",
"this",
"this.A",
"A",
"this.count = 0",
"this.count",
"this",
"this.count",
"0",
"int N",
"N",
"int[] A",
"A",
"public void bubblesort(){\n int tmp = 0;\n boolean flag = true;\n while( flag ){\n flag = false;\n for( int j = this.N-1; j > 0 ; j-- ){\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }\n }\n }",
"bubblesort",
"{\n int tmp = 0;\n boolean flag = true;\n while( flag ){\n flag = false;\n for( int j = this.N-1; j > 0 ; j-- ){\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }\n }\n }",
"int tmp = 0;",
"tmp",
"0",
"boolean flag = true;",
"flag",
"true",
"while( flag ){\n flag = false;\n for( int j = this.N-1; j > 0 ; j-- ){\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }\n }",
"flag",
"{\n flag = false;\n for( int j = this.N-1; j > 0 ; j-- ){\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for( int j = this.N-1; j > 0 ; j-- ){\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }",
"int j = this.N-1;",
"int j = this.N-1;",
"j",
"this.N-1",
"this.N",
"this",
"this.N",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }",
"{\n if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }\n }",
"if( this.A[j] < this.A[j - 1] ){\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }",
"this.A[j] < this.A[j - 1]",
"this.A[j]",
"this.A",
"this",
"this.A",
"j",
"this.A[j - 1]",
"this.A",
"this",
"this.A",
"j - 1",
"j",
"1",
"{\n tmp = this.A[j];\n this.A[j] = this.A[j - 1];\n this.A[j -1] = tmp;\n flag = true;\n this.count++;\n }",
"tmp = this.A[j]",
"tmp",
"this.A[j]",
"this.A",
"this",
"this.A",
"j",
"this.A[j] = this.A[j - 1]",
"this.A[j]",
"this.A",
"this",
"this.A",
"j",
"this.A[j - 1]",
"this.A",
"this",
"this.A",
"j - 1",
"j",
"1",
"this.A[j -1] = tmp",
"this.A[j -1]",
"this.A",
"this",
"this.A",
"j -1",
"j",
"1",
"tmp",
"flag = true",
"flag",
"true",
"this.count++",
"this.count",
"this",
"this.count",
"public void printA(){\n for( int i = 0; i < this.N; i++ ){\n System.out.print( this.A[i] );\n if( i != this.N - 1 ){\n System.out.print( \" \" );\n }\n }\n System.out.println(\"\");\n }",
"printA",
"{\n for( int i = 0; i < this.N; i++ ){\n System.out.print( this.A[i] );\n if( i != this.N - 1 ){\n System.out.print( \" \" );\n }\n }\n System.out.println(\"\");\n }",
"for( int i = 0; i < this.N; i++ ){\n System.out.print( this.A[i] );\n if( i != this.N - 1 ){\n System.out.print( \" \" );\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < this.N",
"i",
"this.N",
"this",
"this.N",
"i++",
"i++",
"i",
"{\n System.out.print( this.A[i] );\n if( i != this.N - 1 ){\n System.out.print( \" \" );\n }\n }",
"{\n System.out.print( this.A[i] );\n if( i != this.N - 1 ){\n System.out.print( \" \" );\n }\n }",
"System.out.print( this.A[i] )",
"System.out.print",
"System.out",
"System",
"System.out",
"this.A[i]",
"this.A",
"this",
"this.A",
"i",
"if( i != this.N - 1 ){\n System.out.print( \" \" );\n }",
"i != this.N - 1",
"i",
"this.N - 1",
"this.N",
"this",
"this.N",
"1",
"{\n System.out.print( \" \" );\n }",
"System.out.print( \" \" )",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner( System.in );\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 sc.close();\n Sort s = new Sort( n, a );\n s.bubblesort();\n s.printA();\n System.out.println( s.count );\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 int[] a = new int[n];\n for( int i = 0 ; i < n ; i++ ){\n a[i] = sc.nextInt();\n }\n sc.close();\n Sort s = new Sort( n, a );\n s.bubblesort();\n s.printA();\n System.out.println( s.count );\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();
}
sc.close();
Sort s = new Sort( n, a );
s.bubblesort();
s.printA();
System.out.println( s.count );
}
}
class Sort {
public int N;
public int[] A;
public int count;
Sort( int N, int[] A ){
this.N = N;
this.A = A;
this.count = 0;
}
public void bubblesort(){
int tmp = 0;
boolean flag = true;
while( flag ){
flag = false;
for( int j = this.N-1; j > 0 ; j-- ){
if( this.A[j] < this.A[j - 1] ){
tmp = this.A[j];
this.A[j] = this.A[j - 1];
this.A[j -1] = tmp;
flag = true;
this.count++;
}
}
}
}
public void printA(){
for( int i = 0; i < this.N; i++ ){
System.out.print( this.A[i] );
if( i != this.N - 1 ){
System.out.print( " " );
}
}
System.out.println("");
}
}
|
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
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
],
[
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
],
[
8,
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
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
59,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
59,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
74,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
84,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
98,
100
],
[
84,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
84,
106
],
[
106,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
108,
118
],
[
118,
119
],
[
119,
120
],
[
108,
121
],
[
122,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
8,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
8,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
6,
149
],
[
149,
150
]
] | [
"import java.util.Scanner;\n\nclass Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = sc.nextInt();\n }\n\n int count = 0;\n int tmp;\n for (int i = 0; i < size; i++) {\n for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }\n }\n\n for (int i = 0; i < size - 1; i++) {\n System.out.print(array[i] + \" \");\n }\n System.out.println(array[size - 1]);\n System.out.println(count);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = sc.nextInt();\n }\n\n int count = 0;\n int tmp;\n for (int i = 0; i < size; i++) {\n for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }\n }\n\n for (int i = 0; i < size - 1; i++) {\n System.out.print(array[i] + \" \");\n }\n System.out.println(array[size - 1]);\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String... args) {\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = sc.nextInt();\n }\n\n int count = 0;\n int tmp;\n for (int i = 0; i < size; i++) {\n for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }\n }\n\n for (int i = 0; i < size - 1; i++) {\n System.out.print(array[i] + \" \");\n }\n System.out.println(array[size - 1]);\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int size = sc.nextInt();\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = sc.nextInt();\n }\n\n int count = 0;\n int tmp;\n for (int i = 0; i < size; i++) {\n for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }\n }\n\n for (int i = 0; i < size - 1; i++) {\n System.out.print(array[i] + \" \");\n }\n System.out.println(array[size - 1]);\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int size = sc.nextInt();",
"size",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] array = new int[size];",
"array",
"new int[size]",
"size",
"for (int i = 0; i < size; i++) {\n array[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"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",
"int count = 0;",
"count",
"0",
"int tmp;",
"tmp",
"for (int i = 0; i < size; i++) {\n for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }\n }",
"{\n for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }\n }",
"for (int j = size - 1; j > i; j--) {\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }",
"int j = size - 1;",
"int j = size - 1;",
"j",
"size - 1",
"size",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }",
"{\n if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }\n }",
"if (array[j] < array[j-1]) {\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }",
"array[j] < array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"{\n tmp = array[j-1];\n array[j-1] = array[j];\n array[j] = tmp;\n count++;\n }",
"tmp = array[j-1]",
"tmp",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j-1] = array[j]",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j]",
"array",
"j",
"array[j] = tmp",
"array[j]",
"array",
"j",
"tmp",
"count++",
"count",
"for (int i = 0; i < size - 1; i++) {\n System.out.print(array[i] + \" \");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size - 1",
"i",
"size - 1",
"size",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(array[i] + \" \");\n }",
"{\n System.out.print(array[i] + \" \");\n }",
"System.out.print(array[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i] + \" \"",
"array[i]",
"array",
"i",
"\" \"",
"System.out.println(array[size - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[size - 1]",
"array",
"size - 1",
"size",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String... args",
"args"
] | import java.util.Scanner;
class Main {
public static void main(String... args) {
Scanner sc = new Scanner(System.in);
int size = sc.nextInt();
int[] array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = sc.nextInt();
}
int count = 0;
int tmp;
for (int i = 0; i < size; i++) {
for (int j = size - 1; j > i; j--) {
if (array[j] < array[j-1]) {
tmp = array[j-1];
array[j-1] = array[j];
array[j] = tmp;
count++;
}
}
}
for (int i = 0; i < size - 1; i++) {
System.out.print(array[i] + " ");
}
System.out.println(array[size - 1]);
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,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
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
],
[
149,
5
],
[
149,
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
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
53,
60
],
[
60,
61
],
[
60,
62
],
[
53,
63
],
[
63,
64
],
[
64,
65
],
[
53,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
92,
93
],
[
92,
94
],
[
78,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
78,
100
],
[
100,
101
],
[
78,
102
],
[
102,
103
],
[
102,
104
],
[
8,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
105,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
105,
115
],
[
115,
116
],
[
116,
117
],
[
105,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
125,
129
],
[
8,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
8,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
6,
146
],
[
146,
147
],
[
0,
148
],
[
148,
149
],
[
148,
150
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\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\n\t\tint count = 0;\n\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(A[i] + \" \");\n\t\t}\n\t\tSystem.out.println(A[N - 1]);\n\t\tSystem.out.println(count);\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\n\t\tint N = sc.nextInt();\n\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\n\t\tint count = 0;\n\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(A[i] + \" \");\n\t\t}\n\t\tSystem.out.println(A[N - 1]);\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\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\n\t\tint count = 0;\n\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(A[i] + \" \");\n\t\t}\n\t\tSystem.out.println(A[N - 1]);\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\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\n\t\tint count = 0;\n\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(A[i] + \" \");\n\t\t}\n\t\tSystem.out.println(A[N - 1]);\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",
"int A[] = new int[N];",
"A",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"while (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"int i = N - 1;",
"int i = N - 1;",
"i",
"N - 1",
"N",
"1",
"i >= 1",
"i",
"1",
"i--",
"i--",
"i",
"{\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"A[i] < A[i - 1]",
"A[i]",
"A",
"i",
"A[i - 1]",
"A",
"i - 1",
"i",
"1",
"{\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"int x = A[i - 1];",
"x",
"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",
"A[i] = x",
"A[i]",
"A",
"i",
"x",
"count++",
"count",
"flag = true",
"flag",
"true",
"for (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(A[i] + \" \");\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\tSystem.out.print(A[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(A[i] + \" \");\n\t\t}",
"System.out.print(A[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i] + \" \"",
"A[i]",
"A",
"i",
"\" \"",
"System.out.println(A[N - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[N - 1]",
"A",
"N - 1",
"N",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\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\n\t\tint count = 0;\n\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(A[i] + \" \");\n\t\t}\n\t\tSystem.out.println(A[N - 1]);\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\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\n\t\tint count = 0;\n\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = N - 1; i >= 1; i--) {\n\t\t\t\tif (A[i] < A[i - 1]) {\n\t\t\t\t\tint x = A[i - 1];\n\t\t\t\t\tA[i - 1] = A[i];\n\t\t\t\t\tA[i] = x;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(A[i] + \" \");\n\t\t}\n\t\tSystem.out.println(A[N - 1]);\n\t\tSystem.out.println(count);\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 A[] = new int[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
int count = 0;
boolean flag = true;
while (flag) {
flag = false;
for (int i = N - 1; i >= 1; i--) {
if (A[i] < A[i - 1]) {
int x = A[i - 1];
A[i - 1] = A[i];
A[i] = x;
count++;
flag = true;
}
}
}
for (int i = 0; i < N - 1; i++) {
System.out.print(A[i] + " ");
}
System.out.println(A[N - 1]);
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,
4,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
13,
1,
40,
13,
30,
30,
0,
13,
17,
11,
1,
41,
13,
2,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
176,
5
],
[
176,
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
],
[
41,
44
],
[
8,
45
],
[
45,
46
],
[
46,
47
],
[
6,
48
],
[
48,
49
],
[
176,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
56,
58
],
[
52,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
59,
65
],
[
65,
66
],
[
66,
67
],
[
59,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
73,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
73,
85
],
[
85,
86
],
[
86,
87
],
[
73,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
90,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
100,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
100,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
100,
122
],
[
122,
123
],
[
122,
124
],
[
100,
125
],
[
125,
126
],
[
52,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
127,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
139,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
52,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
52,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
50,
171
],
[
171,
172
],
[
50,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"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\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\tbubbleSort(A, N);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tfor (int i = 0; flag; i++) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.printf(\"\\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\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\tbubbleSort(A, N);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tfor (int i = 0; flag; i++) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\n\t\tSystem.out.println(count);\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\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\tbubbleSort(A, N);\n\t\tsc.close();\n\t}",
"main",
"{\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\tbubbleSort(A, N);\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",
"int[] A = new int[N];",
"A",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"bubbleSort(A, N)",
"bubbleSort",
"A",
"N",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"public static void bubbleSort(int[] A, int N) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tfor (int i = 0; flag; i++) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\n\t\tSystem.out.println(count);\n\t}",
"bubbleSort",
"{\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tfor (int i = 0; flag; i++) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"for (int i = 0; flag; i++) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"flag",
"i++",
"i++",
"i",
"{\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j >= i + 1",
"j",
"i + 1",
"i",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"A[j] < A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp = A[j];",
"tmp",
"A[j]",
"A",
"j",
"A[j] = A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j - 1] = tmp",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"tmp",
"flag = true",
"flag",
"true",
"count++",
"count",
"for (int i = 0; i < N; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}",
"{\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}",
"if (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i > 0",
"i",
"0",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"System.out.printf(\"\\n\")",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"\\n\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int[] A",
"A",
"int N",
"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\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\tbubbleSort(A, N);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tfor (int i = 0; flag; i++) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\n\t\tSystem.out.println(count);\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\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\tbubbleSort(A, N);\n\t\tsc.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tfor (int i = 0; flag; i++) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= i + 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(A[i]);\n\t\t}\n\t\tSystem.out.printf(\"\\n\");\n\t\tSystem.out.println(count);\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[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
bubbleSort(A, N);
sc.close();
}
public static void bubbleSort(int[] A, int N) {
int count = 0;
boolean flag = true;
for (int i = 0; flag; i++) {
flag = false;
for (int j = N - 1; j >= i + 1; j--) {
if (A[j] < A[j - 1]) {
int tmp = A[j];
A[j] = A[j - 1];
A[j - 1] = tmp;
flag = true;
count++;
}
}
}
for (int i = 0; i < N; i++) {
if (i > 0) {
System.out.print(" ");
}
System.out.print(A[i]);
}
System.out.printf("\n");
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,
4,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
4,
13,
13,
13,
13,
23,
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,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
13,
17,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
179,
5
],
[
179,
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
],
[
41,
44
],
[
8,
45
],
[
45,
46
],
[
46,
47
],
[
6,
48
],
[
48,
49
],
[
179,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
56,
58
],
[
52,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
65,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
65,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
90,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
105,
111
],
[
90,
112
],
[
112,
113
],
[
90,
114
],
[
114,
115
],
[
114,
116
],
[
52,
117
],
[
117,
118
],
[
117,
119
],
[
117,
120
],
[
117,
121
],
[
50,
122
],
[
122,
123
],
[
50,
124
],
[
124,
125
],
[
179,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
138,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
133,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
153,
154
],
[
153,
155
],
[
128,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
161,
165
],
[
128,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
126,
172
],
[
172,
173
],
[
126,
174
],
[
174,
175
],
[
126,
176
],
[
176,
177
],
[
0,
178
],
[
178,
179
],
[
178,
180
]
] | [
"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 bubbleSort(a, n);\n sc.close();\n }\n\n private static void bubbleSort(int[] a, int n) {\n int exchange = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }\n print(a, n, exchange);\n }\n\n private static void print(int[] a, int n, int exchange) {\n String[] aStr = new String[n];\n for (int i = 0; i < n; i++) {\n aStr[i] = String.valueOf(a[i]);\n }\n System.out.println(String.join(\" \", aStr));\n System.out.println(exchange);\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 bubbleSort(a, n);\n sc.close();\n }\n\n private static void bubbleSort(int[] a, int n) {\n int exchange = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }\n print(a, n, exchange);\n }\n\n private static void print(int[] a, int n, int exchange) {\n String[] aStr = new String[n];\n for (int i = 0; i < n; i++) {\n aStr[i] = String.valueOf(a[i]);\n }\n System.out.println(String.join(\" \", aStr));\n System.out.println(exchange);\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 bubbleSort(a, n);\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 }\n bubbleSort(a, 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",
"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",
"bubbleSort(a, n)",
"bubbleSort",
"a",
"n",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args",
"private static void bubbleSort(int[] a, int n) {\n int exchange = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }\n print(a, n, exchange);\n }",
"bubbleSort",
"{\n int exchange = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }\n print(a, n, exchange);\n }",
"int exchange = 0;",
"exchange",
"0",
"boolean flag = true;",
"flag",
"true",
"while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }",
"int i = n - 1;",
"int i = n - 1;",
"i",
"n - 1",
"n",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }",
"{\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }",
"if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }",
"a[i] < a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"{\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }",
"int ai = a[i];",
"ai",
"a[i]",
"a",
"i",
"a[i] = a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i - 1] = ai",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"ai",
"exchange++",
"exchange",
"flag = true",
"flag",
"true",
"print(a, n, exchange)",
"print",
"a",
"n",
"exchange",
"int[] a",
"a",
"int n",
"n",
"private static void print(int[] a, int n, int exchange) {\n String[] aStr = new String[n];\n for (int i = 0; i < n; i++) {\n aStr[i] = String.valueOf(a[i]);\n }\n System.out.println(String.join(\" \", aStr));\n System.out.println(exchange);\n }",
"print",
"{\n String[] aStr = new String[n];\n for (int i = 0; i < n; i++) {\n aStr[i] = String.valueOf(a[i]);\n }\n System.out.println(String.join(\" \", aStr));\n System.out.println(exchange);\n }",
"String[] aStr = new String[n];",
"aStr",
"new String[n]",
"n",
"for (int i = 0; i < n; i++) {\n aStr[i] = String.valueOf(a[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n aStr[i] = String.valueOf(a[i]);\n }",
"{\n aStr[i] = String.valueOf(a[i]);\n }",
"aStr[i] = String.valueOf(a[i])",
"aStr[i]",
"aStr",
"i",
"String.valueOf(a[i])",
"String.valueOf",
"String",
"a[i]",
"a",
"i",
"System.out.println(String.join(\" \", aStr))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.join(\" \", aStr)",
"String.join",
"String",
"\" \"",
"aStr",
"System.out.println(exchange)",
"System.out.println",
"System.out",
"System",
"System.out",
"exchange",
"int[] a",
"a",
"int n",
"n",
"int exchange",
"exchange",
"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 bubbleSort(a, n);\n sc.close();\n }\n\n private static void bubbleSort(int[] a, int n) {\n int exchange = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }\n print(a, n, exchange);\n }\n\n private static void print(int[] a, int n, int exchange) {\n String[] aStr = new String[n];\n for (int i = 0; i < n; i++) {\n aStr[i] = String.valueOf(a[i]);\n }\n System.out.println(String.join(\" \", aStr));\n System.out.println(exchange);\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 bubbleSort(a, n);\n sc.close();\n }\n\n private static void bubbleSort(int[] a, int n) {\n int exchange = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (a[i] < a[i - 1]) {\n int ai = a[i];\n a[i] = a[i - 1];\n a[i - 1] = ai;\n exchange++;\n flag = true;\n }\n }\n }\n print(a, n, exchange);\n }\n\n private static void print(int[] a, int n, int exchange) {\n String[] aStr = new String[n];\n for (int i = 0; i < n; i++) {\n aStr[i] = String.valueOf(a[i]);\n }\n System.out.println(String.join(\" \", aStr));\n System.out.println(exchange);\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();
}
bubbleSort(a, n);
sc.close();
}
private static void bubbleSort(int[] a, int n) {
int exchange = 0;
boolean flag = true;
while (flag) {
flag = false;
for (int i = n - 1; i > 0; i--) {
if (a[i] < a[i - 1]) {
int ai = a[i];
a[i] = a[i - 1];
a[i - 1] = ai;
exchange++;
flag = true;
}
}
}
print(a, n, exchange);
}
private static void print(int[] a, int n, int exchange) {
String[] aStr = new String[n];
for (int i = 0; i < n; i++) {
aStr[i] = String.valueOf(a[i]);
}
System.out.println(String.join(" ", aStr));
System.out.println(exchange);
}
}
|
[
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,
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,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
4,
18,
18,
13,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
30,
4,
18,
13,
4,
18,
13,
13,
29,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
167,
8
],
[
167,
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
],
[
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
],
[
44,
47
],
[
47,
48
],
[
48,
49
],
[
11,
50
],
[
50,
51
],
[
50,
52
],
[
11,
53
],
[
53,
54
],
[
53,
55
],
[
11,
56
],
[
56,
57
],
[
56,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
58,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
62,
72
],
[
72,
73
],
[
73,
74
],
[
62,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
88,
91
],
[
91,
92
],
[
91,
93
],
[
88,
94
],
[
87,
95
],
[
95,
96
],
[
87,
97
],
[
97,
98
],
[
97,
99
],
[
11,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
11,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
9,
114
],
[
114,
115
],
[
167,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
122,
124
],
[
122,
125
],
[
126,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
127,
130
],
[
130,
131
],
[
131,
132
],
[
130,
133
],
[
118,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
116,
138
],
[
138,
139
],
[
167,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
142,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
152,
154
],
[
142,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
155,
159
],
[
140,
160
],
[
160,
161
],
[
140,
162
],
[
162,
163
],
[
140,
164
],
[
164,
165
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
] | [
"import java.util.Scanner;\nimport java.util.StringJoiner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int size = Integer.parseInt(scanner.next());\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = Integer.parseInt(scanner.next());\n }\n\n boolean flag = true;\n int swapCount = 0;\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(concat(array));\n System.out.println(swapCount);\n }\n\n private static String concat(int[] array) {\n StringJoiner joiner = new StringJoiner(\" \");\n for (int value : array) {\n joiner.add(String.valueOf(value));\n }\n return joiner.toString();\n }\n\n private static void swap(int i, int j, int[] array) {\n int temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.StringJoiner;",
"StringJoiner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int size = Integer.parseInt(scanner.next());\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = Integer.parseInt(scanner.next());\n }\n\n boolean flag = true;\n int swapCount = 0;\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(concat(array));\n System.out.println(swapCount);\n }\n\n private static String concat(int[] array) {\n StringJoiner joiner = new StringJoiner(\" \");\n for (int value : array) {\n joiner.add(String.valueOf(value));\n }\n return joiner.toString();\n }\n\n private static void swap(int i, int j, int[] array) {\n int temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int size = Integer.parseInt(scanner.next());\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = Integer.parseInt(scanner.next());\n }\n\n boolean flag = true;\n int swapCount = 0;\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(concat(array));\n System.out.println(swapCount);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int size = Integer.parseInt(scanner.next());\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = Integer.parseInt(scanner.next());\n }\n\n boolean flag = true;\n int swapCount = 0;\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(concat(array));\n System.out.println(swapCount);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int size = Integer.parseInt(scanner.next());",
"size",
"Integer.parseInt(scanner.next())",
"Integer.parseInt",
"Integer",
"scanner.next()",
"scanner.next",
"scanner",
"int[] array = new int[size];",
"array",
"new int[size]",
"size",
"for (int i = 0; i < size; i++) {\n array[i] = Integer.parseInt(scanner.next());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"i++",
"i++",
"i",
"{\n array[i] = Integer.parseInt(scanner.next());\n }",
"{\n array[i] = Integer.parseInt(scanner.next());\n }",
"array[i] = Integer.parseInt(scanner.next())",
"array[i]",
"array",
"i",
"Integer.parseInt(scanner.next())",
"Integer.parseInt",
"Integer",
"scanner.next()",
"scanner.next",
"scanner",
"boolean flag = true;",
"flag",
"true",
"int swapCount = 0;",
"swapCount",
"0",
"while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }",
"int j = size - 1;",
"int j = size - 1;",
"j",
"size - 1",
"size",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }",
"{\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }",
"if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }",
"array[j] < array[j - 1]",
"array[j]",
"array",
"j",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"{\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }",
"swap(j, j - 1, array)",
"swap",
"j",
"j - 1",
"j",
"1",
"array",
"swapCount++",
"swapCount",
"flag = true",
"flag",
"true",
"System.out.println(concat(array))",
"System.out.println",
"System.out",
"System",
"System.out",
"concat(array)",
"concat",
"array",
"System.out.println(swapCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapCount",
"String[] args",
"args",
"private static String concat(int[] array) {\n StringJoiner joiner = new StringJoiner(\" \");\n for (int value : array) {\n joiner.add(String.valueOf(value));\n }\n return joiner.toString();\n }",
"concat",
"{\n StringJoiner joiner = new StringJoiner(\" \");\n for (int value : array) {\n joiner.add(String.valueOf(value));\n }\n return joiner.toString();\n }",
"StringJoiner joiner = new StringJoiner(\" \");",
"joiner",
"new StringJoiner(\" \")",
"for (int value : array) {\n joiner.add(String.valueOf(value));\n }",
"int value",
"array",
"{\n joiner.add(String.valueOf(value));\n }",
"{\n joiner.add(String.valueOf(value));\n }",
"joiner.add(String.valueOf(value))",
"joiner.add",
"joiner",
"String.valueOf(value)",
"String.valueOf",
"String",
"value",
"return joiner.toString();",
"joiner.toString()",
"joiner.toString",
"joiner",
"int[] array",
"array",
"private static void swap(int i, int j, int[] array) {\n int temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }",
"swap",
"{\n int temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }",
"int temp = array[i];",
"temp",
"array[i]",
"array",
"i",
"array[i] = array[j]",
"array[i]",
"array",
"i",
"array[j]",
"array",
"j",
"array[j] = temp",
"array[j]",
"array",
"j",
"temp",
"int i",
"i",
"int j",
"j",
"int[] array",
"array",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int size = Integer.parseInt(scanner.next());\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = Integer.parseInt(scanner.next());\n }\n\n boolean flag = true;\n int swapCount = 0;\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(concat(array));\n System.out.println(swapCount);\n }\n\n private static String concat(int[] array) {\n StringJoiner joiner = new StringJoiner(\" \");\n for (int value : array) {\n joiner.add(String.valueOf(value));\n }\n return joiner.toString();\n }\n\n private static void swap(int i, int j, int[] array) {\n int temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int size = Integer.parseInt(scanner.next());\n int[] array = new int[size];\n for (int i = 0; i < size; i++) {\n array[i] = Integer.parseInt(scanner.next());\n }\n\n boolean flag = true;\n int swapCount = 0;\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (array[j] < array[j - 1]) {\n swap(j, j - 1, array);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(concat(array));\n System.out.println(swapCount);\n }\n\n private static String concat(int[] array) {\n StringJoiner joiner = new StringJoiner(\" \");\n for (int value : array) {\n joiner.add(String.valueOf(value));\n }\n return joiner.toString();\n }\n\n private static void swap(int i, int j, int[] array) {\n int temp = array[i];\n array[i] = array[j];\n array[j] = temp;\n }\n}",
"Main"
] | import java.util.Scanner;
import java.util.StringJoiner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int size = Integer.parseInt(scanner.next());
int[] array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = Integer.parseInt(scanner.next());
}
boolean flag = true;
int swapCount = 0;
while (flag) {
flag = false;
for (int j = size - 1; j > 0; j--) {
if (array[j] < array[j - 1]) {
swap(j, j - 1, array);
swapCount++;
flag = true;
}
}
}
System.out.println(concat(array));
System.out.println(swapCount);
}
private static String concat(int[] array) {
StringJoiner joiner = new StringJoiner(" ");
for (int value : array) {
joiner.add(String.valueOf(value));
}
return joiner.toString();
}
private static void swap(int i, int j, int[] array) {
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
} |
[
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,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
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
],
[
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
],
[
11,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
34,
36
],
[
27,
37
],
[
37,
38
],
[
38,
39
],
[
27,
40
],
[
41,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
49,
50
],
[
50,
51
],
[
11,
52
],
[
52,
53
],
[
52,
54
],
[
11,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
55,
67
],
[
67,
68
],
[
68,
69
],
[
55,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
72,
81
],
[
81,
82
],
[
81,
83
],
[
72,
84
],
[
84,
85
],
[
85,
86
],
[
72,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
99,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
113,
114
],
[
113,
115
],
[
99,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
99,
121
],
[
121,
122
],
[
11,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
123,
133
],
[
133,
134
],
[
134,
135
],
[
123,
136
],
[
137,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
146,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
138,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
167,
168
],
[
167,
169
],
[
11,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
9,
176
],
[
176,
177
]
] | [
"import java.io.*;\nimport java.util.*;\n\nclass Main{\n public static void main(String[] args) throws IOException{\n Scanner scan=new Scanner(System.in);\n int n=Integer.parseInt(scan.next());\n int[] array=new int[n];\n for(int i=0;i<array.length;i++){\n array[i]=Integer.parseInt(scan.next());\n }\n\n int count=0;\n for(int i=0;i<array.length-1;i++){\n for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }\n }\n\n for(int i=0;i<array.length;i++){\n if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }\n }\n System.out.println(count);\n }\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main{\n public static void main(String[] args) throws IOException{\n Scanner scan=new Scanner(System.in);\n int n=Integer.parseInt(scan.next());\n int[] array=new int[n];\n for(int i=0;i<array.length;i++){\n array[i]=Integer.parseInt(scan.next());\n }\n\n int count=0;\n for(int i=0;i<array.length-1;i++){\n for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }\n }\n\n for(int i=0;i<array.length;i++){\n if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }\n }\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException{\n Scanner scan=new Scanner(System.in);\n int n=Integer.parseInt(scan.next());\n int[] array=new int[n];\n for(int i=0;i<array.length;i++){\n array[i]=Integer.parseInt(scan.next());\n }\n\n int count=0;\n for(int i=0;i<array.length-1;i++){\n for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }\n }\n\n for(int i=0;i<array.length;i++){\n if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner scan=new Scanner(System.in);\n int n=Integer.parseInt(scan.next());\n int[] array=new int[n];\n for(int i=0;i<array.length;i++){\n array[i]=Integer.parseInt(scan.next());\n }\n\n int count=0;\n for(int i=0;i<array.length-1;i++){\n for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }\n }\n\n for(int i=0;i<array.length;i++){\n if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }\n }\n System.out.println(count);\n }",
"Scanner scan=new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n=Integer.parseInt(scan.next());",
"n",
"Integer.parseInt(scan.next())",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int[] array=new int[n];",
"array",
"new int[n]",
"n",
"for(int i=0;i<array.length;i++){\n array[i]=Integer.parseInt(scan.next());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n array[i]=Integer.parseInt(scan.next());\n }",
"{\n array[i]=Integer.parseInt(scan.next());\n }",
"array[i]=Integer.parseInt(scan.next())",
"array[i]",
"array",
"i",
"Integer.parseInt(scan.next())",
"Integer.parseInt",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int count=0;",
"count",
"0",
"for(int i=0;i<array.length-1;i++){\n for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length-1",
"i",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"i++",
"i++",
"i",
"{\n for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }\n }",
"{\n for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }\n }",
"for(int j=array.length-1;j>i;j--){\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }",
"int j=array.length-1;",
"int j=array.length-1;",
"j",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }",
"{\n if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }\n }",
"if(array[j]<array[j-1]){\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }",
"array[j]<array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"{\n int tmp=array[j-1];\n array[j-1]=array[j];\n array[j]=tmp;\n count++;\n }",
"int tmp=array[j-1];",
"tmp",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j-1]=array[j]",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j]",
"array",
"j",
"array[j]=tmp",
"array[j]",
"array",
"j",
"tmp",
"count++",
"count",
"for(int i=0;i<array.length;i++){\n if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }\n }",
"{\n if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }\n }",
"if(i<array.length-1){\n System.out.print(array[i]);\n System.out.print(\" \");\n }else{\n System.out.println(array[i]);\n }",
"i<array.length-1",
"i",
"array.length-1",
"array.length",
"array",
"array.length",
"1",
"{\n System.out.print(array[i]);\n System.out.print(\" \");\n }",
"System.out.print(array[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i]",
"array",
"i",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"{\n System.out.println(array[i]);\n }",
"System.out.println(array[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[i]",
"array",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.io.*;
import java.util.*;
class Main{
public static void main(String[] args) throws IOException{
Scanner scan=new Scanner(System.in);
int n=Integer.parseInt(scan.next());
int[] array=new int[n];
for(int i=0;i<array.length;i++){
array[i]=Integer.parseInt(scan.next());
}
int count=0;
for(int i=0;i<array.length-1;i++){
for(int j=array.length-1;j>i;j--){
if(array[j]<array[j-1]){
int tmp=array[j-1];
array[j-1]=array[j];
array[j]=tmp;
count++;
}
}
}
for(int i=0;i<array.length;i++){
if(i<array.length-1){
System.out.print(array[i]);
System.out.print(" ");
}else{
System.out.println(array[i]);
}
}
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
12,
13,
30,
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,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
8,
2,
13,
17,
17,
17,
18,
13,
13,
4,
18,
18,
13,
13,
2,
17,
13,
12,
13,
30,
4,
18,
20,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
157,
5
],
[
157,
6
],
[
6,
7
],
[
6,
8
],
[
157,
9
],
[
9,
10
],
[
157,
11
],
[
11,
12
],
[
11,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
13,
19
],
[
19,
20
],
[
19,
21
],
[
13,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
30,
32
],
[
23,
33
],
[
33,
34
],
[
34,
35
],
[
23,
36
],
[
37,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
13,
45
],
[
45,
46
],
[
45,
47
],
[
13,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
52,
54
],
[
48,
55
],
[
55,
56
],
[
55,
57
],
[
48,
58
],
[
58,
59
],
[
59,
60
],
[
48,
61
],
[
62,
62
],
[
62,
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
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
76,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
86,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
86,
108
],
[
108,
109
],
[
13,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
110,
120
],
[
120,
121
],
[
121,
122
],
[
110,
123
],
[
124,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
131,
136
],
[
130,
137
],
[
137,
138
],
[
137,
139
],
[
13,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
145,
147
],
[
157,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
148,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tScanner sc = new Scanner(System.in);\n\tStringBuilder out;\n\n\tvoid run() {\n\t\tint N = sc.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\tfor (int i = N - 1; i >= 0; i--) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\" + cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tStringBuilder out;\n\n\tvoid run() {\n\t\tint N = sc.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\tfor (int i = N - 1; i >= 0; i--) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\" + cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"StringBuilder out;",
"out",
"void run() {\n\t\tint N = sc.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\tfor (int i = N - 1; i >= 0; i--) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\" + cnt);\n\t}",
"run",
"{\n\t\tint N = sc.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\tfor (int i = N - 1; i >= 0; i--) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\" + cnt);\n\t}",
"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 < A.length; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int cnt = 0;",
"cnt",
"0",
"for (int i = N - 1; i >= 0; i--) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = N - 1;",
"int i = N - 1;",
"i",
"N - 1",
"N",
"1",
"i >= 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < i",
"j",
"i",
"j++",
"j++",
"j",
"{\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"if (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"A[j] > A[j + 1]",
"A[j]",
"A",
"j",
"A[j + 1]",
"A",
"j + 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"int tmp = A[j];",
"tmp",
"A[j]",
"A",
"j",
"A[j] = A[j + 1]",
"A[j]",
"A",
"j",
"A[j + 1]",
"A",
"j + 1",
"j",
"1",
"A[j + 1] = tmp",
"A[j + 1]",
"A",
"j + 1",
"j",
"1",
"tmp",
"cnt++",
"cnt",
"for (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}",
"{\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}",
"System.out.print((i == 0 ? \"\" : \" \") + A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"(i == 0 ? \"\" : \" \") + A[i]",
"(i == 0 ? \"\" : \" \")",
"i == 0",
"i",
"0",
"\"\"",
"\" \"",
"A[i]",
"A",
"i",
"System.out.println(\"\\n\" + cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\\n\" + cnt",
"\"\\n\"",
"cnt",
"public static void main(String[] args) {\n\t\tnew Main().run();\n\t}",
"main",
"{\n\t\tnew Main().run();\n\t}",
"new Main().run()",
"new Main().run",
"new Main()",
"String[] args",
"args",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tStringBuilder out;\n\n\tvoid run() {\n\t\tint N = sc.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\tfor (int i = N - 1; i >= 0; i--) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\" + cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"public class Main {\n\tScanner sc = new Scanner(System.in);\n\tStringBuilder out;\n\n\tvoid run() {\n\t\tint N = sc.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\tfor (int i = N - 1; i >= 0; i--) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (A[j] > A[j + 1]) {\n\t\t\t\t\tint tmp = A[j];\n\t\t\t\t\tA[j] = A[j + 1];\n\t\t\t\t\tA[j + 1] = tmp;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i = 0; i < A.length; i++) {\n\t\t\tSystem.out.print((i == 0 ? \"\" : \" \") + A[i]);\n\t\t}\n\t\tSystem.out.println(\"\\n\" + cnt);\n\t}\n\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
Scanner sc = new Scanner(System.in);
StringBuilder out;
void run() {
int N = sc.nextInt();
int[] A = new int[N];
for (int i = 0; i < A.length; i++) {
A[i] = sc.nextInt();
}
int cnt = 0;
for (int i = N - 1; i >= 0; i--) {
for (int j = 0; j < i; j++) {
if (A[j] > A[j + 1]) {
int tmp = A[j];
A[j] = A[j + 1];
A[j + 1] = tmp;
cnt++;
}
}
}
for (int i = 0; i < A.length; i++) {
System.out.print((i == 0 ? "" : " ") + A[i]);
}
System.out.println("\n" + cnt);
}
public static void main(String[] args) {
new Main().run();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
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,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
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,
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
],
[
253,
14
],
[
253,
15
],
[
15,
16
],
[
15,
17
],
[
253,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
20,
26
],
[
26,
27
],
[
26,
28
],
[
20,
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
],
[
20,
50
],
[
50,
51
],
[
20,
52
],
[
52,
53
],
[
52,
54
],
[
20,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
55,
63
],
[
63,
64
],
[
64,
65
],
[
55,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
68,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
68,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
93,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
108,
114
],
[
93,
115
],
[
115,
116
],
[
20,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
117,
128
],
[
129,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
135,
137
],
[
129,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
138,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
20,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
20,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
18,
162
],
[
162,
163
],
[
253,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
164,
168
],
[
168,
169
],
[
164,
170
],
[
170,
171
],
[
170,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
164,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
179,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
189,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
178,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
164,
204
],
[
204,
205
],
[
204,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
208,
211
],
[
211,
212
],
[
164,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
218,
219
],
[
217,
220
],
[
220,
221
],
[
164,
222
],
[
222,
223
],
[
222,
224
],
[
224,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
226,
229
],
[
229,
230
],
[
164,
231
],
[
231,
232
],
[
231,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
242,
243
],
[
237,
244
],
[
244,
245
],
[
245,
246
],
[
245,
247
],
[
247,
248
],
[
248,
249
],
[
233,
250
],
[
250,
251
],
[
0,
252
],
[
252,
253
],
[
252,
254
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint N = sc.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] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint swap = 0;\n\t\tfor(int i=1; i<N; i++){\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i<N; i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(swap);\n\t}\n\t\n\tstatic 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 nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\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\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\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint N = sc.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] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint swap = 0;\n\t\tfor(int i=1; i<N; i++){\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i<N; i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(swap);\n\t}\n\t\n\tstatic 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 nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\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\n}",
"Main",
"private static FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"public static void main(String[] args) {\n\t\tint N = sc.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] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint swap = 0;\n\t\tfor(int i=1; i<N; i++){\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i<N; i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(swap);\n\t}",
"main",
"{\n\t\tint N = sc.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] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint swap = 0;\n\t\tfor(int i=1; i<N; i++){\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i<N; i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(swap);\n\t}",
"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();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int temp;",
"temp",
"int swap = 0;",
"swap",
"0",
"for(int i=1; i<N; i++){\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\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\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}",
"int j=N-1;",
"int j=N-1;",
"j",
"N-1",
"N",
"1",
"j>=i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}",
"if(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}",
"temp = A[j]",
"temp",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = temp",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"temp",
"swap++",
"swap",
"for(int i=0; i<N; i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\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\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"if(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i != N-1",
"i",
"N-1",
"N",
"1",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(swap)",
"System.out.println",
"System.out",
"System",
"System.out",
"swap",
"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 nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\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 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",
"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",
"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",
"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\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint N = sc.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] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint swap = 0;\n\t\tfor(int i=1; i<N; i++){\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i<N; i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(swap);\n\t}\n\t\n\tstatic 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 nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\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\n}",
"public class Main {\n\tprivate static FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tint N = sc.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] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint swap = 0;\n\t\tfor(int i=1; i<N; i++){\n\t\t\tfor(int j=N-1; j>=i; j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\ttemp = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = temp;\n\t\t\t\t\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i<N; i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i != N-1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(swap);\n\t}\n\t\n\tstatic 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 nextInt() {\n return Integer.parseInt(next());\n }\n\n long nextLong() {\n return Long.parseLong(next());\n }\n\n double nextDouble() {\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\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
private static FastScanner sc = new FastScanner();
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 temp;
int swap = 0;
for(int i=1; i<N; i++){
for(int j=N-1; j>=i; j--){
if(A[j] < A[j-1]){
temp = A[j];
A[j] = A[j-1];
A[j-1] = temp;
swap++;
}
}
}
for(int i=0; i<N; i++){
System.out.print(A[i]);
if(i != N-1){
System.out.print(" ");
}
}
System.out.println();
System.out.println(swap);
}
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 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;
}
}
} |
[
7,
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,
4,
18,
4,
18,
13,
17,
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,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
2,
13,
17,
4,
18,
18,
13,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
176,
5
],
[
176,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
26,
31
],
[
8,
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
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
58,
70
],
[
70,
71
],
[
71,
72
],
[
58,
73
],
[
74,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
75,
84
],
[
84,
85
],
[
84,
86
],
[
75,
87
],
[
87,
88
],
[
88,
89
],
[
75,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
99,
101
],
[
92,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
102,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
102,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
8,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
8,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
137,
147
],
[
147,
148
],
[
148,
149
],
[
137,
150
],
[
151,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
8,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
8,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
6,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.io.*;\npublic class Main {\n public static void main(String[] args) throws IOException{\n BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));\n int num=Integer.parseInt(buf.readLine());\n int[] h=new int[num];\n String[] str=buf.readLine().split(\" \");\n \n for(int i=0;i<num;i++){\n h[i]=Integer.parseInt(str[i]);\n }\n \n int cnt=0;\n for(int i=0;i<h.length-1;i++){\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }\n System.out.print(h[0]);\n for(int i=1;i<h.length;i++){\n System.out.print(\" \"+h[i]);\n }\n System.out.println();\n System.out.println(cnt);\n }\n}",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n public static void main(String[] args) throws IOException{\n BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));\n int num=Integer.parseInt(buf.readLine());\n int[] h=new int[num];\n String[] str=buf.readLine().split(\" \");\n \n for(int i=0;i<num;i++){\n h[i]=Integer.parseInt(str[i]);\n }\n \n int cnt=0;\n for(int i=0;i<h.length-1;i++){\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }\n System.out.print(h[0]);\n for(int i=1;i<h.length;i++){\n System.out.print(\" \"+h[i]);\n }\n System.out.println();\n System.out.println(cnt);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException{\n BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));\n int num=Integer.parseInt(buf.readLine());\n int[] h=new int[num];\n String[] str=buf.readLine().split(\" \");\n \n for(int i=0;i<num;i++){\n h[i]=Integer.parseInt(str[i]);\n }\n \n int cnt=0;\n for(int i=0;i<h.length-1;i++){\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }\n System.out.print(h[0]);\n for(int i=1;i<h.length;i++){\n System.out.print(\" \"+h[i]);\n }\n System.out.println();\n System.out.println(cnt);\n }",
"main",
"{\n BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));\n int num=Integer.parseInt(buf.readLine());\n int[] h=new int[num];\n String[] str=buf.readLine().split(\" \");\n \n for(int i=0;i<num;i++){\n h[i]=Integer.parseInt(str[i]);\n }\n \n int cnt=0;\n for(int i=0;i<h.length-1;i++){\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }\n System.out.print(h[0]);\n for(int i=1;i<h.length;i++){\n System.out.print(\" \"+h[i]);\n }\n System.out.println();\n System.out.println(cnt);\n }",
"BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));",
"buf",
"new BufferedReader(new InputStreamReader(System.in))",
"int num=Integer.parseInt(buf.readLine());",
"num",
"Integer.parseInt(buf.readLine())",
"Integer.parseInt",
"Integer",
"buf.readLine()",
"buf.readLine",
"buf",
"int[] h=new int[num];",
"h",
"new int[num]",
"num",
"String[] str=buf.readLine().split(\" \");",
"str",
"buf.readLine().split(\" \")",
"buf.readLine().split",
"buf.readLine()",
"buf.readLine",
"buf",
"\" \"",
"for(int i=0;i<num;i++){\n h[i]=Integer.parseInt(str[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num",
"i",
"num",
"i++",
"i++",
"i",
"{\n h[i]=Integer.parseInt(str[i]);\n }",
"{\n h[i]=Integer.parseInt(str[i]);\n }",
"h[i]=Integer.parseInt(str[i])",
"h[i]",
"h",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"int cnt=0;",
"cnt",
"0",
"for(int i=0;i<h.length-1;i++){\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<h.length-1",
"i",
"h.length-1",
"h.length",
"h",
"h.length",
"1",
"i++",
"i++",
"i",
"{\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }",
"{\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }",
"for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }",
"int j=h.length-1;",
"int j=h.length-1;",
"j",
"h.length-1",
"h.length",
"h",
"h.length",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }",
"{\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }",
"if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }",
"h[j-1]>h[j]",
"h[j-1]",
"h",
"j-1",
"j",
"1",
"h[j]",
"h",
"j",
"{\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }",
"int tmp=h[j];",
"tmp",
"h[j]",
"h",
"j",
"h[j]=h[j-1]",
"h[j]",
"h",
"j",
"h[j-1]",
"h",
"j-1",
"j",
"1",
"h[j-1]=tmp",
"h[j-1]",
"h",
"j-1",
"j",
"1",
"tmp",
"cnt=cnt+1",
"cnt",
"cnt+1",
"cnt",
"1",
"System.out.print(h[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"h[0]",
"h",
"0",
"for(int i=1;i<h.length;i++){\n System.out.print(\" \"+h[i]);\n }",
"int i=1;",
"int i=1;",
"i",
"1",
"i<h.length",
"i",
"h.length",
"h",
"h.length",
"i++",
"i++",
"i",
"{\n System.out.print(\" \"+h[i]);\n }",
"{\n System.out.print(\" \"+h[i]);\n }",
"System.out.print(\" \"+h[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"+h[i]",
"\" \"",
"h[i]",
"h",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) throws IOException{\n BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));\n int num=Integer.parseInt(buf.readLine());\n int[] h=new int[num];\n String[] str=buf.readLine().split(\" \");\n \n for(int i=0;i<num;i++){\n h[i]=Integer.parseInt(str[i]);\n }\n \n int cnt=0;\n for(int i=0;i<h.length-1;i++){\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }\n System.out.print(h[0]);\n for(int i=1;i<h.length;i++){\n System.out.print(\" \"+h[i]);\n }\n System.out.println();\n System.out.println(cnt);\n }\n}",
"public class Main {\n public static void main(String[] args) throws IOException{\n BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));\n int num=Integer.parseInt(buf.readLine());\n int[] h=new int[num];\n String[] str=buf.readLine().split(\" \");\n \n for(int i=0;i<num;i++){\n h[i]=Integer.parseInt(str[i]);\n }\n \n int cnt=0;\n for(int i=0;i<h.length-1;i++){\n for(int j=h.length-1;j>i;j--){\n if(h[j-1]>h[j]){\n int tmp=h[j];\n h[j]=h[j-1];\n h[j-1]=tmp;\n cnt=cnt+1;\n }\n }\n }\n System.out.print(h[0]);\n for(int i=1;i<h.length;i++){\n System.out.print(\" \"+h[i]);\n }\n System.out.println();\n System.out.println(cnt);\n }\n}",
"Main"
] | import java.io.*;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(buf.readLine());
int[] h=new int[num];
String[] str=buf.readLine().split(" ");
for(int i=0;i<num;i++){
h[i]=Integer.parseInt(str[i]);
}
int cnt=0;
for(int i=0;i<h.length-1;i++){
for(int j=h.length-1;j>i;j--){
if(h[j-1]>h[j]){
int tmp=h[j];
h[j]=h[j-1];
h[j-1]=tmp;
cnt=cnt+1;
}
}
}
System.out.print(h[0]);
for(int i=1;i<h.length;i++){
System.out.print(" "+h[i]);
}
System.out.println();
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
20,
17,
41,
13,
41,
13,
17,
38,
5,
13,
30,
4,
18,
18,
13,
13,
17,
30,
41,
13,
20,
41,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
4,
18,
13,
0,
18,
13,
13,
4,
18,
13,
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,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
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
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
11,
14
],
[
14,
15
],
[
14,
16
],
[
11,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
23,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
33,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
44,
47
],
[
33,
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
],
[
64,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
70,
73
],
[
33,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
74,
84
],
[
84,
85
],
[
85,
86
],
[
74,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
96,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
89,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
104,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
114,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
122,
128
],
[
128,
129
],
[
128,
130
],
[
114,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
114,
136
],
[
136,
137
],
[
33,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
138,
149
],
[
150,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
151,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
163,
164
],
[
163,
165
],
[
151,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
33,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
177,
182
],
[
9,
183
],
[
183,
184
]
] | [
"import java.util.*;\nimport java.io.*;\n\nclass Main{\n public static void main(String[] args){\n int count;\n int[] array = new int[100];\n int key;\n int counter = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n for(int i = 0; i < count; i++){\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }\n\n //Sort Part\n for(int i = 0; i < count - 1; i++){\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }\n\n for(int i = 0; i < count; i++){\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }\n\n System.out.println(counter);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }\n}\n",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main{\n public static void main(String[] args){\n int count;\n int[] array = new int[100];\n int key;\n int counter = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n for(int i = 0; i < count; i++){\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }\n\n //Sort Part\n for(int i = 0; i < count - 1; i++){\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }\n\n for(int i = 0; i < count; i++){\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }\n\n System.out.println(counter);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }\n}",
"Main",
"public static void main(String[] args){\n int count;\n int[] array = new int[100];\n int key;\n int counter = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n for(int i = 0; i < count; i++){\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }\n\n //Sort Part\n for(int i = 0; i < count - 1; i++){\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }\n\n for(int i = 0; i < count; i++){\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }\n\n System.out.println(counter);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }",
"main",
"{\n int count;\n int[] array = new int[100];\n int key;\n int counter = 0;\n\n try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n for(int i = 0; i < count; i++){\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }\n\n //Sort Part\n for(int i = 0; i < count - 1; i++){\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }\n\n for(int i = 0; i < count; i++){\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }\n\n System.out.println(counter);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }\n\n }",
"int count;",
"count",
"int[] array = new int[100];",
"array",
"new int[100]",
"100",
"int key;",
"key",
"int counter = 0;",
"counter",
"0",
"try{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n for(int i = 0; i < count; i++){\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }\n\n //Sort Part\n for(int i = 0; i < count - 1; i++){\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }\n\n for(int i = 0; i < count; i++){\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }\n\n System.out.println(counter);\n\n }catch(Exception e){\n System.out.println(\"ERROR\");\n }",
"catch(Exception e){\n System.out.println(\"ERROR\");\n }",
"Exception e",
"{\n System.out.println(\"ERROR\");\n }",
"System.out.println(\"ERROR\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"ERROR\"",
"{\n Scanner scan = new Scanner(System.in);\n String str = scan.next();\n\n count = Integer.parseInt(str);\n\n for(int i = 0; i < count; i++){\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }\n\n //Sort Part\n for(int i = 0; i < count - 1; i++){\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }\n\n for(int i = 0; i < count; i++){\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }\n\n System.out.println(counter);\n\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"String str = scan.next();",
"str",
"scan.next()",
"scan.next",
"scan",
"count = Integer.parseInt(str)",
"count",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"for(int i = 0; i < count; i++){\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }",
"{\n str = scan.next();\n array[i] = Integer.parseInt(str);\n }",
"str = scan.next()",
"str",
"scan.next()",
"scan.next",
"scan",
"array[i] = Integer.parseInt(str)",
"array[i]",
"array",
"i",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"for(int i = 0; i < count - 1; i++){\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count - 1",
"i",
"count - 1",
"count",
"1",
"i++",
"i++",
"i",
"{\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }",
"{\n for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }\n //System.out.println(\"OK\");\n }",
"for(int j = count - 1; j > i; j--){\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }",
"int j = count - 1;",
"int j = count - 1;",
"j",
"count - 1",
"count",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }",
"{\n //System.out.println(\"---OK\");\n if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }\n }",
"if(array[j] < array[j-1]){\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }",
"array[j] < array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"{\n key = array[j-1];\n array[j-1] = array[j];\n array[j] = key;\n counter++;\n }",
"key = array[j-1]",
"key",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j-1] = array[j]",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j]",
"array",
"j",
"array[j] = key",
"array[j]",
"array",
"j",
"key",
"counter++",
"counter",
"for(int i = 0; i < count; i++){\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }",
"{\n if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }\n }",
"if(i == count - 1){\n System.out.println(array[i]);\n }else{\n System.out.print(array[i] + \" \");\n }",
"i == count - 1",
"i",
"count - 1",
"count",
"1",
"{\n System.out.println(array[i]);\n }",
"System.out.println(array[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[i]",
"array",
"i",
"{\n System.out.print(array[i] + \" \");\n }",
"System.out.print(array[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i] + \" \"",
"array[i]",
"array",
"i",
"\" \"",
"System.out.println(counter)",
"System.out.println",
"System.out",
"System",
"System.out",
"counter",
"String[] args",
"args"
] | import java.util.*;
import java.io.*;
class Main{
public static void main(String[] args){
int count;
int[] array = new int[100];
int key;
int counter = 0;
try{
Scanner scan = new Scanner(System.in);
String str = scan.next();
count = Integer.parseInt(str);
for(int i = 0; i < count; i++){
str = scan.next();
array[i] = Integer.parseInt(str);
}
//Sort Part
for(int i = 0; i < count - 1; i++){
for(int j = count - 1; j > i; j--){
//System.out.println("---OK");
if(array[j] < array[j-1]){
key = array[j-1];
array[j-1] = array[j];
array[j] = key;
counter++;
}
}
//System.out.println("OK");
}
for(int i = 0; i < count; i++){
if(i == count - 1){
System.out.println(array[i]);
}else{
System.out.print(array[i] + " ");
}
}
System.out.println(counter);
}catch(Exception e){
System.out.println("ERROR");
}
}
}
|
[
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,
41,
13,
17,
42,
40,
13,
30,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
154,
5
],
[
154,
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
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
54,
64
],
[
64,
65
],
[
65,
66
],
[
54,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
70,
76
],
[
76,
77
],
[
76,
78
],
[
69,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
79,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
79,
101
],
[
101,
102
],
[
79,
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
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
118,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
127,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
8,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
8,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
6,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] | [
"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 num = sc.nextInt();\n\t\tint[] arr = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tboolean sorted = false;\n\t\twhile (!sorted) {\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\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 num = sc.nextInt();\n\t\tint[] arr = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tboolean sorted = false;\n\t\twhile (!sorted) {\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint num = sc.nextInt();\n\t\tint[] arr = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tboolean sorted = false;\n\t\twhile (!sorted) {\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint num = sc.nextInt();\n\t\tint[] arr = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tboolean sorted = false;\n\t\twhile (!sorted) {\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] arr = new int[num];",
"arr",
"new int[num]",
"num",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < num; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tarr[i] = sc.nextInt();\n\t\t}",
"arr[i] = sc.nextInt()",
"arr[i]",
"arr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean sorted = false;",
"sorted",
"false",
"while (!sorted) {\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"!sorted",
"sorted",
"{\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"sorted = true",
"sorted",
"true",
"for (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num - 1",
"i",
"num - 1",
"num",
"1",
"i++",
"i++",
"i",
"{\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}",
"if (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}",
"arr[i + 1] < arr[i]",
"arr[i + 1]",
"arr",
"i + 1",
"i",
"1",
"arr[i]",
"arr",
"i",
"{\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}",
"int temp = arr[i];",
"temp",
"arr[i]",
"arr",
"i",
"arr[i] = arr[i + 1]",
"arr[i]",
"arr",
"i",
"arr[i + 1]",
"arr",
"i + 1",
"i",
"1",
"arr[i + 1] = temp",
"arr[i + 1]",
"arr",
"i + 1",
"i",
"1",
"temp",
"count++",
"count",
"sorted = false",
"sorted",
"false",
"for (int i = 0; i < num; i++) {\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}",
"System.out.print(arr[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"arr[i]",
"arr",
"i",
"if (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");",
"i != num - 1",
"i",
"num - 1",
"num",
"1",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint num = sc.nextInt();\n\t\tint[] arr = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tboolean sorted = false;\n\t\twhile (!sorted) {\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint num = sc.nextInt();\n\t\tint[] arr = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tboolean sorted = false;\n\t\twhile (!sorted) {\n\t\t\tsorted = true;\n\t\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tif (arr[i + 1] < arr[i]) {\n\t\t\t\t\tint temp = arr[i];\n\t\t\t\t\tarr[i] = arr[i + 1];\n\t\t\t\t\tarr[i + 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t\tsorted = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tSystem.out.print(arr[i]);\n\t\t\tif (i != num - 1)\n\t\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
int[] arr = new int[num];
int count = 0;
for (int i = 0; i < num; i++) {
arr[i] = sc.nextInt();
}
boolean sorted = false;
while (!sorted) {
sorted = true;
for (int i = 0; i < num - 1; i++) {
if (arr[i + 1] < arr[i]) {
int temp = arr[i];
arr[i] = arr[i + 1];
arr[i + 1] = temp;
count++;
sorted = false;
}
}
}
for (int i = 0; i < num; i++) {
System.out.print(arr[i]);
if (i != num - 1)
System.out.print(" ");
}
System.out.println("");
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
20,
0,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
0,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
30,
4,
18,
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
],
[
164,
5
],
[
164,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
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
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
52,
62
],
[
62,
63
],
[
63,
64
],
[
52,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
67,
74
],
[
74,
75
],
[
74,
76
],
[
67,
77
],
[
77,
78
],
[
78,
79
],
[
67,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
92,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
92,
114
],
[
114,
115
],
[
8,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
116,
124
],
[
124,
125
],
[
125,
126
],
[
116,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
129,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
6,
161
],
[
161,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
] | [
"import java.util.Scanner;\npublic class Main{\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tint kazu,i,j,cnt=0,hz;\n\t\tScanner sca = new Scanner(System.in);\n\t\tkazu=sca.nextInt();\n\t\tint hai[]=new int[kazu];\n\t\tfor(i=0;i<kazu;i++){\n\t\t\thai[i]=sca.nextInt();\n\t\t}\n for(i=0;i<kazu-1;i++){\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}\n for(i=0;i<kazu;i++){\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }\n System.out.println(cnt);\n\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\tint kazu,i,j,cnt=0,hz;\n\t\tScanner sca = new Scanner(System.in);\n\t\tkazu=sca.nextInt();\n\t\tint hai[]=new int[kazu];\n\t\tfor(i=0;i<kazu;i++){\n\t\t\thai[i]=sca.nextInt();\n\t\t}\n for(i=0;i<kazu-1;i++){\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}\n for(i=0;i<kazu;i++){\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }\n System.out.println(cnt);\n\n}\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tint kazu,i,j,cnt=0,hz;\n\t\tScanner sca = new Scanner(System.in);\n\t\tkazu=sca.nextInt();\n\t\tint hai[]=new int[kazu];\n\t\tfor(i=0;i<kazu;i++){\n\t\t\thai[i]=sca.nextInt();\n\t\t}\n for(i=0;i<kazu-1;i++){\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}\n for(i=0;i<kazu;i++){\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }\n System.out.println(cnt);\n\n}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tint kazu,i,j,cnt=0,hz;\n\t\tScanner sca = new Scanner(System.in);\n\t\tkazu=sca.nextInt();\n\t\tint hai[]=new int[kazu];\n\t\tfor(i=0;i<kazu;i++){\n\t\t\thai[i]=sca.nextInt();\n\t\t}\n for(i=0;i<kazu-1;i++){\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}\n for(i=0;i<kazu;i++){\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }\n System.out.println(cnt);\n\n}",
"int kazu",
"kazu",
"i",
"i",
"j",
"j",
"cnt=0",
"cnt",
"0",
"hz;",
"hz",
"Scanner sca = new Scanner(System.in);",
"sca",
"new Scanner(System.in)",
"kazu=sca.nextInt()",
"kazu",
"sca.nextInt()",
"sca.nextInt",
"sca",
"int hai[]=new int[kazu];",
"hai",
"new int[kazu]",
"kazu",
"for(i=0;i<kazu;i++){\n\t\t\thai[i]=sca.nextInt();\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<kazu",
"i",
"kazu",
"i++",
"i++",
"i",
"{\n\t\t\thai[i]=sca.nextInt();\n\t\t}",
"{\n\t\t\thai[i]=sca.nextInt();\n\t\t}",
"hai[i]=sca.nextInt()",
"hai[i]",
"hai",
"i",
"sca.nextInt()",
"sca.nextInt",
"sca",
"for(i=0;i<kazu-1;i++){\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}",
"i=0;",
"i=0",
"i",
"0",
"i<kazu-1",
"i",
"kazu-1",
"kazu",
"1",
"i++",
"i++",
"i",
"{\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}",
"{\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}",
"for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }",
"j=kazu-1;",
"j=kazu-1",
"j",
"kazu-1",
"kazu",
"1",
"j>0",
"j",
"0",
"j--",
"j--",
"j",
"{\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }",
"{\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }",
"if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }",
"hai[j]<hai[j-1]",
"hai[j]",
"hai",
"j",
"hai[j-1]",
"hai",
"j-1",
"j",
"1",
"{\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }",
"hz=hai[j]",
"hz",
"hai[j]",
"hai",
"j",
"hai[j]=hai[j-1]",
"hai[j]",
"hai",
"j",
"hai[j-1]",
"hai",
"j-1",
"j",
"1",
"hai[j-1]=hz",
"hai[j-1]",
"hai",
"j-1",
"j",
"1",
"hz",
"cnt++",
"cnt",
"for(i=0;i<kazu;i++){\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }",
"i=0;",
"i=0",
"i",
"0",
"i<kazu",
"i",
"kazu",
"i++",
"i++",
"i",
"{\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }",
"{\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }",
"if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }",
"i!=kazu-1",
"i",
"kazu-1",
"kazu",
"1",
"{\t \n System.out.print(hai[i]+\" \");\n }",
"System.out.print(hai[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"hai[i]+\" \"",
"hai[i]",
"hai",
"i",
"\" \"",
"{\n \t System.out.println(hai[i]);\n }",
"System.out.println(hai[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"hai[i]",
"hai",
"i",
"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\tint kazu,i,j,cnt=0,hz;\n\t\tScanner sca = new Scanner(System.in);\n\t\tkazu=sca.nextInt();\n\t\tint hai[]=new int[kazu];\n\t\tfor(i=0;i<kazu;i++){\n\t\t\thai[i]=sca.nextInt();\n\t\t}\n for(i=0;i<kazu-1;i++){\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}\n for(i=0;i<kazu;i++){\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }\n System.out.println(cnt);\n\n}\n}",
"public class Main{\n\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tint kazu,i,j,cnt=0,hz;\n\t\tScanner sca = new Scanner(System.in);\n\t\tkazu=sca.nextInt();\n\t\tint hai[]=new int[kazu];\n\t\tfor(i=0;i<kazu;i++){\n\t\t\thai[i]=sca.nextInt();\n\t\t}\n for(i=0;i<kazu-1;i++){\n \t for(j=kazu-1;j>0;j--){\n \t\t if(hai[j]<hai[j-1]){\n \t\t\t hz=hai[j];\n \t\t\t hai[j]=hai[j-1];\n \t\t\t hai[j-1]=hz;\n \t\t\t cnt++;\n \t\t }\n \t }\n\t}\n for(i=0;i<kazu;i++){\n if(i!=kazu-1){\t \n System.out.print(hai[i]+\" \");\n }else{\n \t System.out.println(hai[i]);\n }\n }\n System.out.println(cnt);\n\n}\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
// TODO Auto-generated method stub
int kazu,i,j,cnt=0,hz;
Scanner sca = new Scanner(System.in);
kazu=sca.nextInt();
int hai[]=new int[kazu];
for(i=0;i<kazu;i++){
hai[i]=sca.nextInt();
}
for(i=0;i<kazu-1;i++){
for(j=kazu-1;j>0;j--){
if(hai[j]<hai[j-1]){
hz=hai[j];
hai[j]=hai[j-1];
hai[j-1]=hz;
cnt++;
}
}
}
for(i=0;i<kazu;i++){
if(i!=kazu-1){
System.out.print(hai[i]+" ");
}else{
System.out.println(hai[i]);
}
}
System.out.println(cnt);
}
}
|
[
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,
41,
13,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
2,
2,
18,
13,
13,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
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
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
24,
31
],
[
31,
32
],
[
31,
33
],
[
24,
34
],
[
34,
35
],
[
35,
36
],
[
24,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
46,
58
],
[
58,
59
],
[
59,
60
],
[
46,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
71,
76
],
[
63,
77
],
[
77,
78
],
[
78,
79
],
[
63,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
92,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
92,
114
],
[
114,
115
],
[
8,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
116,
128
],
[
128,
129
],
[
129,
130
],
[
116,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
8,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
8,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
8,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
6,
164
],
[
164,
165
]
] | [
"import java.util.*;\nclass Main{\npublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n \n int N = sc.nextInt();\n int[] num = new int[N];\n int suanchang=0;\n \n for (int i = 0,j; i < N; i++) {\n num[i] = sc.nextInt();\n }\n \n for(int i=0;i<num.length-1;i++){\n \n for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }\n }\n\n \n for(int i=0;i<num.length-1;i++){\n System.out.print(num[i] + \" \");\n }\n System.out.print(num[N-1]);\n System.out.println();\n System.out.println(suanchang);\n }\n \n }",
"import java.util.*;",
"util.*",
"java",
"class Main{\npublic static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n \n \n int N = sc.nextInt();\n int[] num = new int[N];\n int suanchang=0;\n \n for (int i = 0,j; i < N; i++) {\n num[i] = sc.nextInt();\n }\n \n for(int i=0;i<num.length-1;i++){\n \n for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }\n }\n\n \n for(int i=0;i<num.length-1;i++){\n System.out.print(num[i] + \" \");\n }\n System.out.print(num[N-1]);\n System.out.println();\n System.out.println(suanchang);\n }\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[] num = new int[N];\n int suanchang=0;\n \n for (int i = 0,j; i < N; i++) {\n num[i] = sc.nextInt();\n }\n \n for(int i=0;i<num.length-1;i++){\n \n for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }\n }\n\n \n for(int i=0;i<num.length-1;i++){\n System.out.print(num[i] + \" \");\n }\n System.out.print(num[N-1]);\n System.out.println();\n System.out.println(suanchang);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n \n \n int N = sc.nextInt();\n int[] num = new int[N];\n int suanchang=0;\n \n for (int i = 0,j; i < N; i++) {\n num[i] = sc.nextInt();\n }\n \n for(int i=0;i<num.length-1;i++){\n \n for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }\n }\n\n \n for(int i=0;i<num.length-1;i++){\n System.out.print(num[i] + \" \");\n }\n System.out.print(num[N-1]);\n System.out.println();\n System.out.println(suanchang);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] num = new int[N];",
"num",
"new int[N]",
"N",
"int suanchang=0;",
"suanchang",
"0",
"for (int i = 0,j; i < N; i++) {\n num[i] = sc.nextInt();\n }",
"int i = 0,j;",
"int i = 0",
"i",
"0",
"j;",
"j",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n num[i] = sc.nextInt();\n }",
"{\n num[i] = sc.nextInt();\n }",
"num[i] = sc.nextInt()",
"num[i]",
"num",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0;i<num.length-1;i++){\n \n for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num.length-1",
"i",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"i++",
"i++",
"i",
"{\n \n for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }\n }",
"{\n \n for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }\n }",
"for(int j=0;j<num.length-i-1;j++){\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<num.length-i-1",
"j",
"num.length-i-1",
"num.length-i-1",
"num.length",
"num",
"num.length",
"i",
"1",
"j++",
"j++",
"j",
"{\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }",
"{\n \n if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }\n\n }",
"if(num[j]>num[j+1]){\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }",
"num[j]>num[j+1]",
"num[j]",
"num",
"j",
"num[j+1]",
"num",
"j+1",
"j",
"1",
"{\n int temp = num[j];\n num[j]=num[j+1];\n num[j+1]=temp;\n suanchang++;\n }",
"int temp = num[j];",
"temp",
"num[j]",
"num",
"j",
"num[j]=num[j+1]",
"num[j]",
"num",
"j",
"num[j+1]",
"num",
"j+1",
"j",
"1",
"num[j+1]=temp",
"num[j+1]",
"num",
"j+1",
"j",
"1",
"temp",
"suanchang++",
"suanchang",
"for(int i=0;i<num.length-1;i++){\n System.out.print(num[i] + \" \");\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num.length-1",
"i",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(num[i] + \" \");\n }",
"{\n System.out.print(num[i] + \" \");\n }",
"System.out.print(num[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"num[i] + \" \"",
"num[i]",
"num",
"i",
"\" \"",
"System.out.print(num[N-1])",
"System.out.print",
"System.out",
"System",
"System.out",
"num[N-1]",
"num",
"N-1",
"N",
"1",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(suanchang)",
"System.out.println",
"System.out",
"System",
"System.out",
"suanchang",
"String[] args",
"args"
] | import java.util.*;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] num = new int[N];
int suanchang=0;
for (int i = 0,j; i < N; i++) {
num[i] = sc.nextInt();
}
for(int i=0;i<num.length-1;i++){
for(int j=0;j<num.length-i-1;j++){
if(num[j]>num[j+1]){
int temp = num[j];
num[j]=num[j+1];
num[j+1]=temp;
suanchang++;
}
}
}
for(int i=0;i<num.length-1;i++){
System.out.print(num[i] + " ");
}
System.out.print(num[N-1]);
System.out.println();
System.out.println(suanchang);
}
}
|
[
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,
4,
18,
13,
41,
13,
4,
13,
4,
13,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
4,
18,
18,
13,
13,
4,
18,
4,
18,
13,
13,
17,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
17,
23,
13,
12,
13,
30,
41,
13,
20,
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,
18,
13,
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
],
[
182,
14
],
[
182,
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
],
[
31,
32
],
[
32,
33
],
[
17,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
17,
41
],
[
41,
42
],
[
41,
43
],
[
17,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
44,
56
],
[
56,
57
],
[
57,
58
],
[
44,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
61,
70
],
[
70,
71
],
[
70,
72
],
[
61,
73
],
[
73,
74
],
[
74,
75
],
[
61,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
85,
86
],
[
85,
87
],
[
78,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
88,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
102,
104
],
[
88,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
88,
110
],
[
110,
111
],
[
17,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
117,
123
],
[
117,
124
],
[
17,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
15,
131
],
[
131,
132
],
[
182,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
133,
141
],
[
141,
142
],
[
182,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
149,
150
],
[
149,
151
],
[
145,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
152,
162
],
[
162,
163
],
[
163,
164
],
[
152,
165
],
[
166,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
172,
173
],
[
171,
174
],
[
174,
175
],
[
174,
176
],
[
145,
177
],
[
177,
178
],
[
143,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\npublic class Main {\n\tpublic static void main(String args[]) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint elementNum = Integer.parseInt(br.readLine());\n\t\tString line = br.readLine();\n\t\tint[] numArray = parseInt(getSplitLine(line));\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < numArray.length - 1; i++) {\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\"));\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static String[] getSplitLine(String line) {\n\t\treturn line.split(\"\\\\s\");\n\t}\n\n\tprivate static int[] parseInt(String[] line) {\n\t\tint[] numArray = new int[line.length];\n\t\tfor (int i = 0; i < line.length; i++) {\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\treturn numArray;\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",
"public class Main {\n\tpublic static void main(String args[]) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint elementNum = Integer.parseInt(br.readLine());\n\t\tString line = br.readLine();\n\t\tint[] numArray = parseInt(getSplitLine(line));\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < numArray.length - 1; i++) {\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\"));\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static String[] getSplitLine(String line) {\n\t\treturn line.split(\"\\\\s\");\n\t}\n\n\tprivate static int[] parseInt(String[] line) {\n\t\tint[] numArray = new int[line.length];\n\t\tfor (int i = 0; i < line.length; i++) {\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\treturn numArray;\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\tint elementNum = Integer.parseInt(br.readLine());\n\t\tString line = br.readLine();\n\t\tint[] numArray = parseInt(getSplitLine(line));\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < numArray.length - 1; i++) {\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\"));\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint elementNum = Integer.parseInt(br.readLine());\n\t\tString line = br.readLine();\n\t\tint[] numArray = parseInt(getSplitLine(line));\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < numArray.length - 1; i++) {\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\"));\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int elementNum = Integer.parseInt(br.readLine());",
"elementNum",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String line = br.readLine();",
"line",
"br.readLine()",
"br.readLine",
"br",
"int[] numArray = parseInt(getSplitLine(line));",
"numArray",
"parseInt(getSplitLine(line))",
"parseInt",
"getSplitLine(line)",
"getSplitLine",
"line",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < numArray.length - 1; i++) {\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < numArray.length - 1",
"i",
"numArray.length - 1",
"numArray.length",
"numArray",
"numArray.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = numArray.length - 1;",
"int j = numArray.length - 1;",
"j",
"numArray.length - 1",
"numArray.length",
"numArray",
"numArray.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"numArray[j - 1] > numArray[j]",
"numArray[j - 1]",
"numArray",
"j - 1",
"j",
"1",
"numArray[j]",
"numArray",
"j",
"{\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmpNum = numArray[j - 1];",
"tmpNum",
"numArray[j - 1]",
"numArray",
"j - 1",
"j",
"1",
"numArray[j - 1] = numArray[j]",
"numArray[j - 1]",
"numArray",
"j - 1",
"j",
"1",
"numArray[j]",
"numArray",
"j",
"numArray[j] = tmpNum",
"numArray[j]",
"numArray",
"j",
"tmpNum",
"count++",
"count",
"System.out.println(Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\"))",
"System.out.println",
"System.out",
"System",
"System.out",
"Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\")",
"Arrays.toString(numArray)\n\t\t\t\t.replaceAll",
"Arrays.toString(numArray)",
"Arrays.toString",
"Arrays",
"numArray",
"\"[\\\\[\\\\],]\"",
"\"\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String args[]",
"args",
"private static String[] getSplitLine(String line) {\n\t\treturn line.split(\"\\\\s\");\n\t}",
"getSplitLine",
"{\n\t\treturn line.split(\"\\\\s\");\n\t}",
"return line.split(\"\\\\s\");",
"line.split(\"\\\\s\")",
"line.split",
"line",
"\"\\\\s\"",
"String line",
"line",
"private static int[] parseInt(String[] line) {\n\t\tint[] numArray = new int[line.length];\n\t\tfor (int i = 0; i < line.length; i++) {\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\treturn numArray;\n\t}",
"parseInt",
"{\n\t\tint[] numArray = new int[line.length];\n\t\tfor (int i = 0; i < line.length; i++) {\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\treturn numArray;\n\t}",
"int[] numArray = new int[line.length];",
"numArray",
"new int[line.length]",
"line.length",
"line",
"line.length",
"for (int i = 0; i < line.length; i++) {\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < line.length",
"i",
"line.length",
"line",
"line.length",
"i++",
"i++",
"i",
"{\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}",
"{\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}",
"numArray[i] = Integer.parseInt(line[i])",
"numArray[i]",
"numArray",
"i",
"Integer.parseInt(line[i])",
"Integer.parseInt",
"Integer",
"line[i]",
"line",
"i",
"return numArray;",
"numArray",
"String[] line",
"line",
"public class Main {\n\tpublic static void main(String args[]) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint elementNum = Integer.parseInt(br.readLine());\n\t\tString line = br.readLine();\n\t\tint[] numArray = parseInt(getSplitLine(line));\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < numArray.length - 1; i++) {\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\"));\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static String[] getSplitLine(String line) {\n\t\treturn line.split(\"\\\\s\");\n\t}\n\n\tprivate static int[] parseInt(String[] line) {\n\t\tint[] numArray = new int[line.length];\n\t\tfor (int i = 0; i < line.length; i++) {\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\treturn numArray;\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String args[]) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint elementNum = Integer.parseInt(br.readLine());\n\t\tString line = br.readLine();\n\t\tint[] numArray = parseInt(getSplitLine(line));\n\n\t\tint count = 0;\n\t\tfor (int i = 0; i < numArray.length - 1; i++) {\n\t\t\tfor (int j = numArray.length - 1; j > i; j--) {\n\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\tint tmpNum = numArray[j - 1];\n\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\tnumArray[j] = tmpNum;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(Arrays.toString(numArray)\n\t\t\t\t.replaceAll(\"[\\\\[\\\\],]\", \"\"));\n\t\tSystem.out.println(count);\n\t}\n\n\tprivate static String[] getSplitLine(String line) {\n\t\treturn line.split(\"\\\\s\");\n\t}\n\n\tprivate static int[] parseInt(String[] line) {\n\t\tint[] numArray = new int[line.length];\n\t\tfor (int i = 0; i < line.length; i++) {\n\t\t\tnumArray[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\treturn numArray;\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int elementNum = Integer.parseInt(br.readLine());
String line = br.readLine();
int[] numArray = parseInt(getSplitLine(line));
int count = 0;
for (int i = 0; i < numArray.length - 1; i++) {
for (int j = numArray.length - 1; j > i; j--) {
if (numArray[j - 1] > numArray[j]) {
int tmpNum = numArray[j - 1];
numArray[j - 1] = numArray[j];
numArray[j] = tmpNum;
count++;
}
}
}
System.out.println(Arrays.toString(numArray)
.replaceAll("[\\[\\],]", ""));
System.out.println(count);
}
private static String[] getSplitLine(String line) {
return line.split("\\s");
}
private static int[] parseInt(String[] line) {
int[] numArray = new int[line.length];
for (int i = 0; i < line.length; i++) {
numArray[i] = Integer.parseInt(line[i]);
}
return numArray;
}
} |
[
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
2,
13,
17,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
30,
0,
13,
4,
18,
13,
2,
13,
17,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
4,
18,
13,
13,
13,
40,
13,
14,
2,
13,
17,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
4,
18,
18,
13,
13,
2,
4,
18,
13,
13,
17,
4,
18,
18,
13,
13,
2,
2,
4,
18,
13,
2,
13,
17,
17,
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
],
[
170,
11
],
[
170,
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
],
[
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
],
[
14,
45
],
[
45,
46
],
[
14,
47
],
[
47,
48
],
[
47,
49
],
[
14,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
50,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
65,
77
],
[
77,
78
],
[
78,
79
],
[
65,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
84,
87
],
[
83,
88
],
[
88,
89
],
[
89,
90
],
[
88,
91
],
[
91,
92
],
[
91,
93
],
[
82,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
94,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
94,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
113,
117
],
[
94,
118
],
[
118,
119
],
[
14,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
14,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
127,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
146,
151
],
[
14,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
158,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
162,
163
],
[
162,
164
],
[
158,
165
],
[
158,
166
],
[
12,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"import java.util.Scanner;\nimport java.util.List;\nimport java.util.ArrayList;\n\npublic class Main {\n public static void main (String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n List<Integer> numbers = new ArrayList<Integer>();\n for (int i = 0; i < N; ++i) {\n numbers.add(scanner.nextInt());\n }\n\n int temp, count = 0;\n for (int i = 0; i + 1 < N; ++i) {\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }\n\n if (N == 0) count = 1;\n\n for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + \" \");\n System.out.println(numbers.get(N - 1) + \"\\n\" + count);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.ArrayList;",
"ArrayList",
"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 List<Integer> numbers = new ArrayList<Integer>();\n for (int i = 0; i < N; ++i) {\n numbers.add(scanner.nextInt());\n }\n\n int temp, count = 0;\n for (int i = 0; i + 1 < N; ++i) {\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }\n\n if (N == 0) count = 1;\n\n for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + \" \");\n System.out.println(numbers.get(N - 1) + \"\\n\" + count);\n }\n}",
"Main",
"public static void main (String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n List<Integer> numbers = new ArrayList<Integer>();\n for (int i = 0; i < N; ++i) {\n numbers.add(scanner.nextInt());\n }\n\n int temp, count = 0;\n for (int i = 0; i + 1 < N; ++i) {\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }\n\n if (N == 0) count = 1;\n\n for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + \" \");\n System.out.println(numbers.get(N - 1) + \"\\n\" + count);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n List<Integer> numbers = new ArrayList<Integer>();\n for (int i = 0; i < N; ++i) {\n numbers.add(scanner.nextInt());\n }\n\n int temp, count = 0;\n for (int i = 0; i + 1 < N; ++i) {\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }\n\n if (N == 0) count = 1;\n\n for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + \" \");\n System.out.println(numbers.get(N - 1) + \"\\n\" + count);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"List<Integer> numbers = new ArrayList<Integer>();",
"numbers",
"new ArrayList<Integer>()",
"for (int i = 0; i < N; ++i) {\n numbers.add(scanner.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"++i",
"++i",
"i",
"{\n numbers.add(scanner.nextInt());\n }",
"{\n numbers.add(scanner.nextInt());\n }",
"numbers.add(scanner.nextInt())",
"numbers.add",
"numbers",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int temp",
"temp",
"count = 0;",
"count",
"0",
"for (int i = 0; i + 1 < N; ++i) {\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i + 1 < N",
"i + 1",
"i",
"1",
"N",
"++i",
"++i",
"i",
"{\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }",
"{\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }",
"for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j + 1 < N - i",
"j + 1",
"j",
"1",
"N - i",
"N",
"i",
"++j",
"++j",
"j",
"{\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }",
"{\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }",
"if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }",
"numbers.get(j) > numbers.get(j + 1)",
"numbers.get(j)",
"numbers.get",
"numbers",
"j",
"numbers.get(j + 1)",
"numbers.get",
"numbers",
"j + 1",
"j",
"1",
"{\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }",
"temp = numbers.get(j + 1)",
"temp",
"numbers.get(j + 1)",
"numbers.get",
"numbers",
"j + 1",
"j",
"1",
"numbers.set(j + 1, numbers.get(j))",
"numbers.set",
"numbers",
"j + 1",
"j",
"1",
"numbers.get(j)",
"numbers.get",
"numbers",
"j",
"numbers.set(j, temp)",
"numbers.set",
"numbers",
"j",
"temp",
"++count",
"count",
"if (N == 0) count = 1;",
"N == 0",
"N",
"0",
"count = 1",
"count",
"1",
"for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + \" \");",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N - 1",
"i",
"N - 1",
"N",
"1",
"++i",
"++i",
"i",
"System.out.print(numbers.get(i) + \" \");",
"System.out.print(numbers.get(i) + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"numbers.get(i) + \" \"",
"numbers.get(i)",
"numbers.get",
"numbers",
"i",
"\" \"",
"System.out.println(numbers.get(N - 1) + \"\\n\" + count)",
"System.out.println",
"System.out",
"System",
"System.out",
"numbers.get(N - 1) + \"\\n\" + count",
"numbers.get(N - 1) + \"\\n\" + count",
"numbers.get(N - 1)",
"numbers.get",
"numbers",
"N - 1",
"N",
"1",
"\"\\n\"",
"count",
"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 List<Integer> numbers = new ArrayList<Integer>();\n for (int i = 0; i < N; ++i) {\n numbers.add(scanner.nextInt());\n }\n\n int temp, count = 0;\n for (int i = 0; i + 1 < N; ++i) {\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }\n\n if (N == 0) count = 1;\n\n for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + \" \");\n System.out.println(numbers.get(N - 1) + \"\\n\" + count);\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 List<Integer> numbers = new ArrayList<Integer>();\n for (int i = 0; i < N; ++i) {\n numbers.add(scanner.nextInt());\n }\n\n int temp, count = 0;\n for (int i = 0; i + 1 < N; ++i) {\n for (int j = 0; j + 1 < N - i; ++j) {\n if (numbers.get(j) > numbers.get(j + 1)) {\n temp = numbers.get(j + 1);\n numbers.set(j + 1, numbers.get(j));\n numbers.set(j, temp);\n ++count;\n }\n }\n }\n\n if (N == 0) count = 1;\n\n for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + \" \");\n System.out.println(numbers.get(N - 1) + \"\\n\" + count);\n }\n}",
"Main"
] | import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
public class Main {
public static void main (String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
List<Integer> numbers = new ArrayList<Integer>();
for (int i = 0; i < N; ++i) {
numbers.add(scanner.nextInt());
}
int temp, count = 0;
for (int i = 0; i + 1 < N; ++i) {
for (int j = 0; j + 1 < N - i; ++j) {
if (numbers.get(j) > numbers.get(j + 1)) {
temp = numbers.get(j + 1);
numbers.set(j + 1, numbers.get(j));
numbers.set(j, temp);
++count;
}
}
}
if (N == 0) count = 1;
for (int i = 0; i < N - 1; ++i) System.out.print(numbers.get(i) + " ");
System.out.println(numbers.get(N - 1) + "\n" + 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,
0,
18,
13,
13,
4,
18,
13,
4,
13,
13,
4,
18,
13,
4,
18,
13,
17,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
172,
5
],
[
172,
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
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
6,
50
],
[
50,
51
],
[
172,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
58,
68
],
[
68,
69
],
[
69,
70
],
[
58,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
72,
81
],
[
81,
82
],
[
81,
83
],
[
72,
84
],
[
84,
85
],
[
85,
86
],
[
72,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
88,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
98,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
98,
120
],
[
120,
121
],
[
54,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
145,
147
],
[
136,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
54,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
54,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
52,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = scan.nextInt();\n\n\t\trun(a);\n\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n\n\tprivate static void run(int[] a) {\n\t\tint op = 0;\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tfor (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tif (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\tSystem.out.println();\n\t\tSystem.out.println(op);\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = scan.nextInt();\n\n\t\trun(a);\n\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n\n\tprivate static void run(int[] a) {\n\t\tint op = 0;\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tfor (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tif (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\tSystem.out.println();\n\t\tSystem.out.println(op);\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = scan.nextInt();\n\n\t\trun(a);\n\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = scan.nextInt();\n\n\t\trun(a);\n\n\t\tscan.close();\n\t\tSystem.exit(0);\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 = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++)\n\t\t\ta[i] = scan.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = scan.nextInt();",
"a[i] = scan.nextInt()",
"a[i]",
"a",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"run(a)",
"run",
"a",
"scan.close()",
"scan.close",
"scan",
"System.exit(0)",
"System.exit",
"System",
"0",
"String[] args",
"args",
"private static void run(int[] a) {\n\t\tint op = 0;\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tfor (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tif (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\tSystem.out.println();\n\t\tSystem.out.println(op);\n\n\t}",
"run",
"{\n\t\tint op = 0;\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tfor (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tif (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\tSystem.out.println();\n\t\tSystem.out.println(op);\n\n\t}",
"int op = 0;",
"op",
"0",
"for (int i = 0; i < a.length; i++)\n\t\t\tfor (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"for (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}",
"for (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}",
"int j = a.length - 1;",
"int j = a.length - 1;",
"j",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"if (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}",
"if (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}",
"a[j] < a[j - 1]",
"a[j]",
"a",
"j",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}",
"int tmp = a[j];",
"tmp",
"a[j]",
"a",
"j",
"a[j] = a[j - 1]",
"a[j]",
"a",
"j",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"a[j - 1] = tmp",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"tmp",
"op++",
"op",
"for (int i = 0; i < a.length; i++)\n\t\t\tif (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"if (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);",
"if (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);",
"i == 0",
"i",
"0",
"System.out.print(a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"System.out.print(\" \" + a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \" + a[i]",
"\" \"",
"a[i]",
"a",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(op)",
"System.out.println",
"System.out",
"System",
"System.out",
"op",
"int[] a",
"a",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = scan.nextInt();\n\n\t\trun(a);\n\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n\n\tprivate static void run(int[] a) {\n\t\tint op = 0;\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tfor (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tif (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\tSystem.out.println();\n\t\tSystem.out.println(op);\n\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++)\n\t\t\ta[i] = scan.nextInt();\n\n\t\trun(a);\n\n\t\tscan.close();\n\t\tSystem.exit(0);\n\t}\n\n\tprivate static void run(int[] a) {\n\t\tint op = 0;\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tfor (int j = a.length - 1; j > i; j--)\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tint tmp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\top++;\n\t\t\t\t}\n\t\tfor (int i = 0; i < a.length; i++)\n\t\t\tif (i == 0)\n\t\t\t\tSystem.out.print(a[i]);\n\t\t\telse\n\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\tSystem.out.println();\n\t\tSystem.out.println(op);\n\n\t}\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();
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = scan.nextInt();
run(a);
scan.close();
System.exit(0);
}
private static void run(int[] a) {
int op = 0;
for (int i = 0; i < a.length; i++)
for (int j = a.length - 1; j > i; j--)
if (a[j] < a[j - 1]) {
int tmp = a[j];
a[j] = a[j - 1];
a[j - 1] = tmp;
op++;
}
for (int i = 0; i < a.length; i++)
if (i == 0)
System.out.print(a[i]);
else
System.out.print(" " + a[i]);
System.out.println();
System.out.println(op);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
17,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
4,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
40,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
184,
5
],
[
184,
6
],
[
6,
7
],
[
6,
8
],
[
184,
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
],
[
46,
47
],
[
46,
48
],
[
46,
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
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
63,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
63,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
11,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
11,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
95,
100
],
[
11,
101
],
[
101,
102
],
[
102,
103
],
[
9,
104
],
[
104,
105
],
[
184,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
125,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
118,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
133,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
143,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
143,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
160,
166
],
[
143,
167
],
[
167,
168
],
[
167,
169
],
[
143,
170
],
[
170,
171
],
[
108,
172
],
[
172,
173
],
[
106,
174
],
[
174,
175
],
[
106,
176
],
[
176,
177
],
[
184,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
181,
182
],
[
0,
183
],
[
183,
184
],
[
183,
185
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tprivate static int count = 0;\n\n\t/**\n\t * バブルソートをするプログラム\n\t * \n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num = scan.nextInt();\n\t\tint[] value = new int[num];\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}\n\n\t\tint[] sort = bubbleSort(value, num);\n\t\tfor (int j = 0; j < num; j++) {\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count); // ソート回数\n\n\t\tscan.close();\n\t}\n\n\t/**\n\t * バブルソート\n\t * \n\t * @param A\n\t * ソートする配列\n\t * @param N\n\t * ソートする個数\n\t * @return 昇順にソートされた配列\n\t */\n\tpublic static int[] bubbleSort(int[] A, int N) {\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}\n\n\tpublic static void counter() {\n\n\t\tcount++;\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tprivate static int count = 0;\n\n\t/**\n\t * バブルソートをするプログラム\n\t * \n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num = scan.nextInt();\n\t\tint[] value = new int[num];\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}\n\n\t\tint[] sort = bubbleSort(value, num);\n\t\tfor (int j = 0; j < num; j++) {\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count); // ソート回数\n\n\t\tscan.close();\n\t}\n\n\t/**\n\t * バブルソート\n\t * \n\t * @param A\n\t * ソートする配列\n\t * @param N\n\t * ソートする個数\n\t * @return 昇順にソートされた配列\n\t */\n\tpublic static int[] bubbleSort(int[] A, int N) {\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}\n\n\tpublic static void counter() {\n\n\t\tcount++;\n\t}\n}",
"Main",
"private static int count = 0;",
"count",
"0",
"/**\n\t * バブルソートをするプログラム\n\t * \n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num = scan.nextInt();\n\t\tint[] value = new int[num];\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}\n\n\t\tint[] sort = bubbleSort(value, num);\n\t\tfor (int j = 0; j < num; j++) {\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count); // ソート回数\n\n\t\tscan.close();\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num = scan.nextInt();\n\t\tint[] value = new int[num];\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}\n\n\t\tint[] sort = bubbleSort(value, num);\n\t\tfor (int j = 0; j < num; j++) {\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count); // ソート回数\n\n\t\tscan.close();\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int num = scan.nextInt();",
"num",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] value = new int[num];",
"value",
"new int[num]",
"num",
"for (int i = 0; i < num; i++) {\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}",
"value[i] = scan.nextInt()",
"value[i]",
"value",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] sort = bubbleSort(value, num);",
"sort",
"bubbleSort(value, num)",
"bubbleSort",
"value",
"num",
"for (int j = 0; j < num; j++) {\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < num",
"j",
"num",
"j++",
"j++",
"j",
"{\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}",
"if (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}",
"j == num - 1",
"j",
"num - 1",
"num",
"1",
"{\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t}",
"System.out.print(sort[j])",
"System.out.print",
"System.out",
"System",
"System.out",
"sort[j]",
"sort",
"j",
"{\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}",
"System.out.print(sort[j] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"sort[j] + \" \"",
"sort[j]",
"sort",
"j",
"\" \"",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"/**\n\t * バブルソート\n\t * \n\t * @param A\n\t * ソートする配列\n\t * @param N\n\t * ソートする個数\n\t * @return 昇順にソートされた配列\n\t */\n\tpublic static int[] bubbleSort(int[] A, int N) {\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}",
"bubbleSort",
"{\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}",
"boolean flag = true;",
"flag",
"true",
"while (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j >= 1",
"j",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}",
"if (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}",
"A[j] < A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}",
"int tmp;",
"tmp",
"tmp = A[j]",
"tmp",
"A[j]",
"A",
"j",
"A[j] = A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j - 1] = tmp",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"tmp",
"flag = true",
"flag",
"true",
"counter()",
"counter",
"return A;",
"A",
"int[] A",
"A",
"int N",
"N",
"public static void counter() {\n\n\t\tcount++;\n\t}",
"counter",
"{\n\n\t\tcount++;\n\t}",
"count++",
"count",
"public class Main {\n\tprivate static int count = 0;\n\n\t/**\n\t * バブルソートをするプログラム\n\t * \n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num = scan.nextInt();\n\t\tint[] value = new int[num];\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}\n\n\t\tint[] sort = bubbleSort(value, num);\n\t\tfor (int j = 0; j < num; j++) {\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count); // ソート回数\n\n\t\tscan.close();\n\t}\n\n\t/**\n\t * バブルソート\n\t * \n\t * @param A\n\t * ソートする配列\n\t * @param N\n\t * ソートする個数\n\t * @return 昇順にソートされた配列\n\t */\n\tpublic static int[] bubbleSort(int[] A, int N) {\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}\n\n\tpublic static void counter() {\n\n\t\tcount++;\n\t}\n}",
"public class Main {\n\tprivate static int count = 0;\n\n\t/**\n\t * バブルソートをするプログラム\n\t * \n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint num = scan.nextInt();\n\t\tint[] value = new int[num];\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tvalue[i] = scan.nextInt();\n\t\t}\n\n\t\tint[] sort = bubbleSort(value, num);\n\t\tfor (int j = 0; j < num; j++) {\n\t\t\tif (j == num - 1) {\n\t\t\t\tSystem.out.print(sort[j]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(sort[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count); // ソート回数\n\n\t\tscan.close();\n\t}\n\n\t/**\n\t * バブルソート\n\t * \n\t * @param A\n\t * ソートする配列\n\t * @param N\n\t * ソートする個数\n\t * @return 昇順にソートされた配列\n\t */\n\tpublic static int[] bubbleSort(int[] A, int N) {\n\t\tboolean flag = true;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j >= 1; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint tmp;\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcounter();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn A;\n\t}\n\n\tpublic static void counter() {\n\n\t\tcount++;\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
private static int count = 0;
/**
* バブルソートをするプログラム
*
* @param args
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
int[] value = new int[num];
for (int i = 0; i < num; i++) {
value[i] = scan.nextInt();
}
int[] sort = bubbleSort(value, num);
for (int j = 0; j < num; j++) {
if (j == num - 1) {
System.out.print(sort[j]);
} else {
System.out.print(sort[j] + " ");
}
}
System.out.println("");
System.out.println(count); // ソート回数
scan.close();
}
/**
* バブルソート
*
* @param A
* ソートする配列
* @param N
* ソートする個数
* @return 昇順にソートされた配列
*/
public static int[] bubbleSort(int[] A, int N) {
boolean flag = true;
while (flag) {
flag = false;
for (int j = N - 1; j >= 1; j--) {
if (A[j] < A[j - 1]) {
int tmp;
tmp = A[j];
A[j] = A[j - 1];
A[j - 1] = tmp;
flag = true;
counter();
}
}
}
return A;
}
public static void counter() {
count++;
}
}
|
[
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,
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,
18,
13,
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,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
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
],
[
182,
11
],
[
182,
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,
38
],
[
38,
39
],
[
38,
40
],
[
14,
41
],
[
41,
42
],
[
41,
43
],
[
14,
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
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
64,
66
],
[
14,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
67,
77
],
[
77,
78
],
[
78,
79
],
[
67,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
82,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
82,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
121,
122
],
[
121,
123
],
[
107,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
107,
129
],
[
129,
130
],
[
14,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
131,
139
],
[
139,
140
],
[
140,
141
],
[
131,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
144,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
154,
156
],
[
144,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
14,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
14,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
12,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static void main(String[] args) throws NumberFormatException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] input = br.readLine().split(\" \");\n\n int[] A = new int[n];\n int chageBox = 0;\n int count = 0;\n\n// n????????´??°?????????A???????´?\n for (int i = 0; i < n; i++){\n A[i] = Integer.parseInt(input[i]);\n }\n\n for(int i = 0; i < n - 1; i++){\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++){\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }\n System.out.println();\n System.out.println(count);\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 public static void main(String[] args) throws NumberFormatException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] input = br.readLine().split(\" \");\n\n int[] A = new int[n];\n int chageBox = 0;\n int count = 0;\n\n// n????????´??°?????????A???????´?\n for (int i = 0; i < n; i++){\n A[i] = Integer.parseInt(input[i]);\n }\n\n for(int i = 0; i < n - 1; i++){\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++){\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] input = br.readLine().split(\" \");\n\n int[] A = new int[n];\n int chageBox = 0;\n int count = 0;\n\n// n????????´??°?????????A???????´?\n for (int i = 0; i < n; i++){\n A[i] = Integer.parseInt(input[i]);\n }\n\n for(int i = 0; i < n - 1; i++){\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++){\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }\n System.out.println();\n System.out.println(count);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] input = br.readLine().split(\" \");\n\n int[] A = new int[n];\n int chageBox = 0;\n int count = 0;\n\n// n????????´??°?????????A???????´?\n for (int i = 0; i < n; i++){\n A[i] = Integer.parseInt(input[i]);\n }\n\n for(int i = 0; i < n - 1; i++){\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++){\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }\n System.out.println();\n System.out.println(count);\n }",
"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[] input = br.readLine().split(\" \");",
"input",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] A = new int[n];",
"A",
"new int[n]",
"n",
"int chageBox = 0;",
"chageBox",
"0",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < n; i++){\n A[i] = Integer.parseInt(input[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = Integer.parseInt(input[i]);\n }",
"{\n A[i] = Integer.parseInt(input[i]);\n }",
"A[i] = Integer.parseInt(input[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"for(int i = 0; i < n - 1; i++){\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\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 = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }",
"{\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }",
"for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }",
"{\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }",
"if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }",
"chageBox = A[j-1]",
"chageBox",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = A[j]",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j]",
"A",
"j",
"A[j] = chageBox",
"A[j]",
"A",
"j",
"chageBox",
"count++",
"count",
"for(int i = 0; i < n; i++){\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }",
"{\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }",
"if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }",
"i == 0",
"i",
"0",
"{\n System.out.print(A[i]);\n }",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"{\n System.out.print(\" \" + A[i]);\n }",
"System.out.print(\" \" + A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \" + A[i]",
"\" \"",
"A[i]",
"A",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"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 NumberFormatException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] input = br.readLine().split(\" \");\n\n int[] A = new int[n];\n int chageBox = 0;\n int count = 0;\n\n// n????????´??°?????????A???????´?\n for (int i = 0; i < n; i++){\n A[i] = Integer.parseInt(input[i]);\n }\n\n for(int i = 0; i < n - 1; i++){\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++){\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"public class Main {\n public static void main(String[] args) throws NumberFormatException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] input = br.readLine().split(\" \");\n\n int[] A = new int[n];\n int chageBox = 0;\n int count = 0;\n\n// n????????´??°?????????A???????´?\n for (int i = 0; i < n; i++){\n A[i] = Integer.parseInt(input[i]);\n }\n\n for(int i = 0; i < n - 1; i++){\n for(int j = n - 1; j > i; j--){\n if(A[j] < A[j-1]){\n chageBox = A[j-1];\n A[j-1] = A[j];\n A[j] = chageBox;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++){\n if(i == 0){\n System.out.print(A[i]);\n }else{\n System.out.print(\" \" + A[i]);\n }\n }\n System.out.println();\n System.out.println(count);\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 NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] input = br.readLine().split(" ");
int[] A = new int[n];
int chageBox = 0;
int count = 0;
// n????????´??°?????????A???????´?
for (int i = 0; i < n; i++){
A[i] = Integer.parseInt(input[i]);
}
for(int i = 0; i < n - 1; i++){
for(int j = n - 1; j > i; j--){
if(A[j] < A[j-1]){
chageBox = A[j-1];
A[j-1] = A[j];
A[j] = chageBox;
count++;
}
}
}
for(int i = 0; i < n; i++){
if(i == 0){
System.out.print(A[i]);
}else{
System.out.print(" " + A[i]);
}
}
System.out.println();
System.out.println(count);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
0,
13,
18,
13,
13,
0,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
9,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
187,
11
],
[
187,
12
],
[
12,
13
],
[
187,
14
],
[
14,
15
],
[
187,
16
],
[
16,
17
],
[
187,
18
],
[
18,
19
],
[
187,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
31,
32
],
[
32,
33
],
[
22,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
36,
41
],
[
22,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
44,
46
],
[
22,
47
],
[
47,
48
],
[
47,
49
],
[
22,
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
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
68,
71
],
[
71,
72
],
[
71,
73
],
[
22,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
74,
79
],
[
79,
80
],
[
79,
81
],
[
74,
82
],
[
82,
83
],
[
83,
84
],
[
74,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
22,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
89,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
22,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
22,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
20,
130
],
[
130,
131
],
[
187,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
135,
142
],
[
142,
143
],
[
142,
144
],
[
135,
145
],
[
145,
146
],
[
146,
147
],
[
135,
148
],
[
149,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
150,
160
],
[
160,
161
],
[
150,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
162,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
174,
176
],
[
162,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
180,
182
],
[
177,
183
],
[
162,
184
],
[
184,
185
],
[
0,
186
],
[
186,
187
],
[
186,
188
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main{\n\tstatic int N;\n\tstatic int [] A;\n\tstatic int max;\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString [] temp = br.readLine().split(\" \");\n\t\tmax = temp.length;\n\t\tA = new int[max];\n\t\tfor(int i=0;i < max;i++){\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tfor(int i=0;i < max;i++){\n\t\t\tsort();\n\t\t}\n\n\t\tfor(int i=0;i < max-1;i++){\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}\n\t\tSystem.out.println(A[max-1]);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void sort(){\n\t\tfor(int i=max-1;i>0;i--){\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\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",
"public class Main{\n\tstatic int N;\n\tstatic int [] A;\n\tstatic int max;\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString [] temp = br.readLine().split(\" \");\n\t\tmax = temp.length;\n\t\tA = new int[max];\n\t\tfor(int i=0;i < max;i++){\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tfor(int i=0;i < max;i++){\n\t\t\tsort();\n\t\t}\n\n\t\tfor(int i=0;i < max-1;i++){\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}\n\t\tSystem.out.println(A[max-1]);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void sort(){\n\t\tfor(int i=max-1;i>0;i--){\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}\n\t}\n\n}",
"Main",
"static int N;",
"N",
"static int [] A;",
"A",
"static int max;",
"max",
"static int count;",
"count",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString [] temp = br.readLine().split(\" \");\n\t\tmax = temp.length;\n\t\tA = new int[max];\n\t\tfor(int i=0;i < max;i++){\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tfor(int i=0;i < max;i++){\n\t\t\tsort();\n\t\t}\n\n\t\tfor(int i=0;i < max-1;i++){\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}\n\t\tSystem.out.println(A[max-1]);\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString [] temp = br.readLine().split(\" \");\n\t\tmax = temp.length;\n\t\tA = new int[max];\n\t\tfor(int i=0;i < max;i++){\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tfor(int i=0;i < max;i++){\n\t\t\tsort();\n\t\t}\n\n\t\tfor(int i=0;i < max-1;i++){\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}\n\t\tSystem.out.println(A[max-1]);\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"N = Integer.parseInt(br.readLine())",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String [] temp = br.readLine().split(\" \");",
"temp",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"max = temp.length",
"max",
"temp.length",
"temp",
"temp.length",
"A = new int[max]",
"A",
"new int[max]",
"max",
"for(int i=0;i < max;i++){\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < max",
"i",
"max",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}",
"{\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}",
"A[i] = Integer.parseInt(temp[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(temp[i])",
"Integer.parseInt",
"Integer",
"temp[i]",
"temp",
"i",
"for(int i=0;i < max;i++){\n\t\t\tsort();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < max",
"i",
"max",
"i++",
"i++",
"i",
"{\n\t\t\tsort();\n\t\t}",
"{\n\t\t\tsort();\n\t\t}",
"sort()",
"sort",
"for(int i=0;i < max-1;i++){\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < max-1",
"i",
"max-1",
"max",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}",
"System.out.print(A[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]+\" \"",
"A[i]",
"A",
"i",
"\" \"",
"System.out.println(A[max-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[max-1]",
"A",
"max-1",
"max",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static void sort(){\n\t\tfor(int i=max-1;i>0;i--){\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}\n\t}",
"sort",
"{\n\t\tfor(int i=max-1;i>0;i--){\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}\n\t}",
"for(int i=max-1;i>0;i--){\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}",
"int i=max-1;",
"int i=max-1;",
"i",
"max-1",
"max",
"1",
"i>0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}",
"{\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}",
"if(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\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\tcontinue;\n\t\t\t}",
"continue;",
"{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}",
"int num = A[i];",
"num",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i-1] = num",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"num",
"count++",
"count",
"public class Main{\n\tstatic int N;\n\tstatic int [] A;\n\tstatic int max;\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString [] temp = br.readLine().split(\" \");\n\t\tmax = temp.length;\n\t\tA = new int[max];\n\t\tfor(int i=0;i < max;i++){\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tfor(int i=0;i < max;i++){\n\t\t\tsort();\n\t\t}\n\n\t\tfor(int i=0;i < max-1;i++){\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}\n\t\tSystem.out.println(A[max-1]);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void sort(){\n\t\tfor(int i=max-1;i>0;i--){\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}\n\t}\n\n}",
"public class Main{\n\tstatic int N;\n\tstatic int [] A;\n\tstatic int max;\n\tstatic int count;\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tN = Integer.parseInt(br.readLine());\n\t\tString [] temp = br.readLine().split(\" \");\n\t\tmax = temp.length;\n\t\tA = new int[max];\n\t\tfor(int i=0;i < max;i++){\n\t\t\tA[i] = Integer.parseInt(temp[i]);\n\t\t}\n\n\t\tfor(int i=0;i < max;i++){\n\t\t\tsort();\n\t\t}\n\n\t\tfor(int i=0;i < max-1;i++){\n\t\t\tSystem.out.print(A[i]+\" \");\n\t\t}\n\t\tSystem.out.println(A[max-1]);\n\t\tSystem.out.println(count);\n\t}\n\n\tpublic static void sort(){\n\t\tfor(int i=max-1;i>0;i--){\n\t\t\tif(A[i] >= A[i-1]){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tint num = A[i];\n\t\t\t\tA[i] = A[i-1];\n\t\t\t\tA[i-1] = num;\n\t\t\t\tcount++;\n\t\t\t}\n\n\n\t\t}\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
static int N;
static int [] A;
static int max;
static int count;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(br.readLine());
String [] temp = br.readLine().split(" ");
max = temp.length;
A = new int[max];
for(int i=0;i < max;i++){
A[i] = Integer.parseInt(temp[i]);
}
for(int i=0;i < max;i++){
sort();
}
for(int i=0;i < max-1;i++){
System.out.print(A[i]+" ");
}
System.out.println(A[max-1]);
System.out.println(count);
}
public static void sort(){
for(int i=max-1;i>0;i--){
if(A[i] >= A[i-1]){
continue;
}
else{
int num = A[i];
A[i] = A[i-1];
A[i-1] = num;
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,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
4,
18,
18,
13,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
159,
5
],
[
159,
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
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
46,
56
],
[
56,
57
],
[
57,
58
],
[
46,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
61,
70
],
[
70,
71
],
[
70,
72
],
[
61,
73
],
[
73,
74
],
[
74,
75
],
[
61,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
78,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
88,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
88,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
88,
110
],
[
110,
111
],
[
8,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
117,
118
],
[
117,
119
],
[
8,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
120,
130
],
[
130,
131
],
[
131,
132
],
[
120,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
8,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
8,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
6,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
] | [
"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\t\tint[] num = new int[n];\n\t\tfor(int i=0; i < n; i++){\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint count = 0;\n\t\tfor(int i=0; i < num.length; i++){\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(num[0]);\n\t\tfor(int i=1; i < num.length; i++){\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\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\tint[] num = new int[n];\n\t\tfor(int i=0; i < n; i++){\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint count = 0;\n\t\tfor(int i=0; i < num.length; i++){\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(num[0]);\n\t\tfor(int i=1; i < num.length; i++){\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\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\tint[] num = new int[n];\n\t\tfor(int i=0; i < n; i++){\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint count = 0;\n\t\tfor(int i=0; i < num.length; i++){\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(num[0]);\n\t\tfor(int i=1; i < num.length; i++){\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] num = new int[n];\n\t\tfor(int i=0; i < n; i++){\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint count = 0;\n\t\tfor(int i=0; i < num.length; i++){\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(num[0]);\n\t\tfor(int i=1; i < num.length; i++){\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}\n\t\tSystem.out.println();\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",
"int[] num = new int[n];",
"num",
"new int[n]",
"n",
"for(int i=0; i < n; i++){\n\t\t\tnum[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tnum[i] = sc.nextInt();\n\t\t}",
"num[i] = sc.nextInt()",
"num[i]",
"num",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int temp;",
"temp",
"int count = 0;",
"count",
"0",
"for(int i=0; i < num.length; i++){\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < num.length",
"i",
"num.length",
"num",
"num.length",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j=num.length-1;",
"int j=num.length-1;",
"j",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"num[j] < num[j-1]",
"num[j]",
"num",
"j",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"{\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"temp = num[j]",
"temp",
"num[j]",
"num",
"j",
"num[j] = num[j-1]",
"num[j]",
"num",
"j",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"num[j-1] = temp",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"temp",
"count++",
"count",
"System.out.print(num[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"num[0]",
"num",
"0",
"for(int i=1; i < num.length; i++){\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i < num.length",
"i",
"num.length",
"num",
"num.length",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}",
"{\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}",
"System.out.print(\" \" + num[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \" + num[i]",
"\" \"",
"num[i]",
"num",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"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\tint[] num = new int[n];\n\t\tfor(int i=0; i < n; i++){\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint count = 0;\n\t\tfor(int i=0; i < num.length; i++){\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(num[0]);\n\t\tfor(int i=1; i < num.length; i++){\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\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\tint[] num = new int[n];\n\t\tfor(int i=0; i < n; i++){\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint temp;\n\t\tint count = 0;\n\t\tfor(int i=0; i < num.length; i++){\n\t\t\tfor(int j=num.length-1; j > i; j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttemp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.print(num[0]);\n\t\tfor(int i=1; i < num.length; i++){\n\t\t\tSystem.out.print(\" \" + num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\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[] num = new int[n];
for(int i=0; i < n; i++){
num[i] = sc.nextInt();
}
int temp;
int count = 0;
for(int i=0; i < num.length; i++){
for(int j=num.length-1; j > i; j--){
if(num[j] < num[j-1]){
temp = num[j];
num[j] = num[j-1];
num[j-1] = temp;
count++;
}
}
}
System.out.print(num[0]);
for(int i=1; i < num.length; i++){
System.out.print(" " + num[i]);
}
System.out.println();
System.out.println(count);
}
} |
[
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,
20,
13,
41,
13,
17,
41,
13,
4,
18,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
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
],
[
174,
11
],
[
174,
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
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
14,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
35,
40
],
[
14,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
43,
45
],
[
41,
46
],
[
46,
47
],
[
46,
48
],
[
41,
49
],
[
49,
50
],
[
50,
51
],
[
41,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
14,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
77,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
77,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
92,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
102,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
102,
124
],
[
124,
125
],
[
14,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
131,
132
],
[
131,
133
],
[
126,
134
],
[
134,
135
],
[
135,
136
],
[
126,
137
],
[
138,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
139,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
14,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
12,
171
],
[
171,
172
],
[
0,
173
],
[
173,
174
],
[
173,
175
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tpublic static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tbyte arrayLength = Byte.parseByte(in.readLine());\n\t\tbyte[] array = new byte[arrayLength];\n\t\tshort count = 0;\n\t\tString[] strData = in.readLine().split(\" \");\n\t\tfor (byte i = 0; i < arrayLength; i++) {\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}\n\t\tfor (int x = 0; x < arrayLength; x++) {\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int z = 0; z < arrayLength; z++) {\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\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\tpublic static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tbyte arrayLength = Byte.parseByte(in.readLine());\n\t\tbyte[] array = new byte[arrayLength];\n\t\tshort count = 0;\n\t\tString[] strData = in.readLine().split(\" \");\n\t\tfor (byte i = 0; i < arrayLength; i++) {\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}\n\t\tfor (int x = 0; x < arrayLength; x++) {\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int z = 0; z < arrayLength; z++) {\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tbyte arrayLength = Byte.parseByte(in.readLine());\n\t\tbyte[] array = new byte[arrayLength];\n\t\tshort count = 0;\n\t\tString[] strData = in.readLine().split(\" \");\n\t\tfor (byte i = 0; i < arrayLength; i++) {\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}\n\t\tfor (int x = 0; x < arrayLength; x++) {\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int z = 0; z < arrayLength; z++) {\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tbyte arrayLength = Byte.parseByte(in.readLine());\n\t\tbyte[] array = new byte[arrayLength];\n\t\tshort count = 0;\n\t\tString[] strData = in.readLine().split(\" \");\n\t\tfor (byte i = 0; i < arrayLength; i++) {\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}\n\t\tfor (int x = 0; x < arrayLength; x++) {\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int z = 0; z < arrayLength; z++) {\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"BufferedReader in = new BufferedReader(new InputStreamReader(System.in));",
"in",
"new BufferedReader(new InputStreamReader(System.in))",
"byte arrayLength = Byte.parseByte(in.readLine());",
"arrayLength",
"Byte.parseByte(in.readLine())",
"Byte.parseByte",
"Byte",
"in.readLine()",
"in.readLine",
"in",
"byte[] array = new byte[arrayLength];",
"array",
"new byte[arrayLength]",
"arrayLength",
"short count = 0;",
"count",
"0",
"String[] strData = in.readLine().split(\" \");",
"strData",
"in.readLine().split(\" \")",
"in.readLine().split",
"in.readLine()",
"in.readLine",
"in",
"\" \"",
"for (byte i = 0; i < arrayLength; i++) {\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}",
"byte i = 0;",
"byte i = 0;",
"i",
"0",
"i < arrayLength",
"i",
"arrayLength",
"i++",
"i++",
"i",
"{\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}",
"{\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}",
"array[i] = Byte.parseByte(strData[i])",
"array[i]",
"array",
"i",
"Byte.parseByte(strData[i])",
"Byte.parseByte",
"Byte",
"strData[i]",
"strData",
"i",
"for (int x = 0; x < arrayLength; x++) {\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int x = 0;",
"int x = 0;",
"x",
"0",
"x < arrayLength",
"x",
"arrayLength",
"x++",
"x++",
"x",
"{\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"byte y = (byte) (arrayLength - 1);",
"byte y = (byte) (arrayLength - 1);",
"y",
"(byte) (arrayLength - 1)",
"arrayLength",
"1",
"y > x",
"y",
"x",
"y--",
"y--",
"y",
"{\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"array[y] < array[y - 1]",
"array[y]",
"array",
"y",
"array[y - 1]",
"array",
"y - 1",
"y",
"1",
"{\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"byte temp = array[y];",
"temp",
"array[y]",
"array",
"y",
"array[y] = array[y - 1]",
"array[y]",
"array",
"y",
"array[y - 1]",
"array",
"y - 1",
"y",
"1",
"array[y - 1] = temp",
"array[y - 1]",
"array",
"y - 1",
"y",
"1",
"temp",
"count++",
"count",
"for (int z = 0; z < arrayLength; z++) {\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}",
"int z = 0;",
"int z = 0;",
"z",
"0",
"z < arrayLength",
"z",
"arrayLength",
"z++",
"z++",
"z",
"{\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}",
"if (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}",
"z == arrayLength - 1",
"z",
"arrayLength - 1",
"arrayLength",
"1",
"{\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t}",
"System.out.println(array[z])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[z]",
"array",
"z",
"{\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}",
"System.out.print(array[z] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[z] + \" \"",
"array[z]",
"array",
"z",
"\" \"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tbyte arrayLength = Byte.parseByte(in.readLine());\n\t\tbyte[] array = new byte[arrayLength];\n\t\tshort count = 0;\n\t\tString[] strData = in.readLine().split(\" \");\n\t\tfor (byte i = 0; i < arrayLength; i++) {\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}\n\t\tfor (int x = 0; x < arrayLength; x++) {\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int z = 0; z < arrayLength; z++) {\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n\t\tbyte arrayLength = Byte.parseByte(in.readLine());\n\t\tbyte[] array = new byte[arrayLength];\n\t\tshort count = 0;\n\t\tString[] strData = in.readLine().split(\" \");\n\t\tfor (byte i = 0; i < arrayLength; i++) {\n\t\t\tarray[i] = Byte.parseByte(strData[i]);\n\t\t}\n\t\tfor (int x = 0; x < arrayLength; x++) {\n\t\t\tfor (byte y = (byte) (arrayLength - 1); y > x; y--) {\n\t\t\t\tif (array[y] < array[y - 1]) {\n\t\t\t\t\tbyte temp = array[y];\n\t\t\t\t\tarray[y] = array[y - 1];\n\t\t\t\t\tarray[y - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int z = 0; z < arrayLength; z++) {\n\t\t\tif (z == arrayLength - 1) {\n\t\t\t\tSystem.out.println(array[z]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(array[z] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException,
IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
byte arrayLength = Byte.parseByte(in.readLine());
byte[] array = new byte[arrayLength];
short count = 0;
String[] strData = in.readLine().split(" ");
for (byte i = 0; i < arrayLength; i++) {
array[i] = Byte.parseByte(strData[i]);
}
for (int x = 0; x < arrayLength; x++) {
for (byte y = (byte) (arrayLength - 1); y > x; y--) {
if (array[y] < array[y - 1]) {
byte temp = array[y];
array[y] = array[y - 1];
array[y - 1] = temp;
count++;
}
}
}
for (int z = 0; z < arrayLength; z++) {
if (z == arrayLength - 1) {
System.out.println(array[z]);
} else {
System.out.print(array[z] + " ");
}
}
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,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
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
],
[
156,
5
],
[
156,
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
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
60,
62
],
[
56,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
56,
68
],
[
68,
69
],
[
69,
70
],
[
56,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
83,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
83,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
83,
105
],
[
105,
106
],
[
105,
107
],
[
83,
108
],
[
108,
109
],
[
52,
110
],
[
110,
111
],
[
8,
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
],
[
112,
125
],
[
126,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
8,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
8,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
6,
153
],
[
153,
154
],
[
0,
155
],
[
155,
156
],
[
155,
157
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\t\n\t\tint a[] = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint j = 0;\n\t\t\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n - 1]);\n\t\t\n\t\tSystem.out.println(count);\n\t}\n} \n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\t\n\t\tint a[] = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint j = 0;\n\t\t\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n - 1]);\n\t\t\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\t\n\t\tint a[] = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint j = 0;\n\t\t\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n - 1]);\n\t\t\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\t\n\t\tint a[] = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint j = 0;\n\t\t\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n - 1]);\n\t\t\n\t\tSystem.out.println(count);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int a[] = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = scanner.nextInt();\n\t\t}",
"a[i] = scanner.nextInt()",
"a[i]",
"a",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"boolean flag = true;",
"flag",
"true",
"int count = 0;",
"count",
"0",
"int j = 0;",
"j",
"0",
"while(flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}",
"flag = false",
"flag",
"false",
"for (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int i = n - 1;",
"int i = n - 1;",
"i",
"n - 1",
"n",
"1",
"i >= j + 1",
"i",
"j + 1",
"j",
"1",
"i--",
"i--",
"i",
"{\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"a[i] < a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"{\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int temp = a[i];",
"temp",
"a[i]",
"a",
"i",
"a[i] = a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i - 1] = temp",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"temp",
"flag = true",
"flag",
"true",
"count++",
"count",
"j++",
"j",
"for (int i = 0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\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\tSystem.out.print(a[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}",
"System.out.print(a[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i] + \" \"",
"a[i]",
"a",
"i",
"\" \"",
"System.out.println(a[n - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[n - 1]",
"a",
"n - 1",
"n",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\t\n\t\tint a[] = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint j = 0;\n\t\t\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n - 1]);\n\t\t\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = scanner.nextInt();\n\t\t\n\t\tint a[] = new int[n];\n\t\t\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\tint j = 0;\n\t\t\n\t\twhile(flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 1; i >= j + 1; i--) {\n\t\t\t\tif (a[i] < a[i - 1]) {\n\t\t\t\t\tint temp = a[i];\n\t\t\t\t\ta[i] = a[i - 1];\n\t\t\t\t\ta[i - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\t\n\t\tfor (int i = 0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n - 1]);\n\t\t\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = scanner.nextInt();
}
boolean flag = true;
int count = 0;
int j = 0;
while(flag) {
flag = false;
for (int i = n - 1; i >= j + 1; i--) {
if (a[i] < a[i - 1]) {
int temp = a[i];
a[i] = a[i - 1];
a[i - 1] = temp;
flag = true;
count++;
}
}
j++;
}
for (int i = 0; i < n-1; i++) {
System.out.print(a[i] + " ");
}
System.out.println(a[n - 1]);
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,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
0,
13,
17,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
29,
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,
4,
18,
13,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
17,
30,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
179,
5
],
[
179,
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
],
[
41,
44
],
[
6,
45
],
[
45,
46
],
[
179,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
53,
55
],
[
49,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
64,
71
],
[
71,
72
],
[
71,
73
],
[
64,
74
],
[
74,
75
],
[
75,
76
],
[
64,
77
],
[
78,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
79,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
89,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
103,
104
],
[
103,
105
],
[
89,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
89,
111
],
[
111,
112
],
[
111,
113
],
[
89,
114
],
[
114,
115
],
[
49,
116
],
[
116,
117
],
[
116,
118
],
[
49,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
49,
125
],
[
47,
126
],
[
126,
127
],
[
47,
128
],
[
128,
129
],
[
179,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
136,
146
],
[
146,
147
],
[
147,
148
],
[
136,
149
],
[
150,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
151,
154
],
[
154,
155
],
[
154,
156
],
[
150,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
157,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
166,
169
],
[
132,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
130,
176
],
[
176,
177
],
[
0,
178
],
[
178,
179
],
[
178,
180
]
] | [
"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\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\tbubbleSort(A,N);\n\t}\n\n\tpublic static void bubbleSort(int [] A,int N){\n\t\tint flag =1;\n\t\tint cnt =0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(A);\n\t\tSystem.out.println(cnt);\n\t\treturn ;\n\t}\n\tpublic static void show(int[] A){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0 ; i < A.length; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb); \n\t}\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\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\tbubbleSort(A,N);\n\t}\n\n\tpublic static void bubbleSort(int [] A,int N){\n\t\tint flag =1;\n\t\tint cnt =0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(A);\n\t\tSystem.out.println(cnt);\n\t\treturn ;\n\t}\n\tpublic static void show(int[] A){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0 ; i < A.length; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb); \n\t}\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\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\tbubbleSort(A,N);\n\t}",
"main",
"{\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\tbubbleSort(A,N);\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();\n\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"bubbleSort(A,N)",
"bubbleSort",
"A",
"N",
"String[] args",
"args",
"public static void bubbleSort(int [] A,int N){\n\t\tint flag =1;\n\t\tint cnt =0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(A);\n\t\tSystem.out.println(cnt);\n\t\treturn ;\n\t}",
"bubbleSort",
"{\n\t\tint flag =1;\n\t\tint cnt =0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(A);\n\t\tSystem.out.println(cnt);\n\t\treturn ;\n\t}",
"int flag =1;",
"flag",
"1",
"int cnt =0;",
"cnt",
"0",
"while(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = 0",
"flag",
"0",
"for(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"int j = N-1;",
"int j = N-1;",
"j",
"N-1",
"N",
"1",
"j >= 1",
"j",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"if(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"int tmp = A[j-1];",
"tmp",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = A[j]",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j]",
"A",
"j",
"A[j] = tmp",
"A[j]",
"A",
"j",
"tmp",
"flag =1",
"flag",
"1",
"cnt++",
"cnt",
"show(A)",
"show",
"A",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"return ;",
"int [] A",
"A",
"int N",
"N",
"public static void show(int[] A){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0 ; i < A.length; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb); \n\t}",
"show",
"{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0 ; i < A.length; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb); \n\t}",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (int i = 0 ; i < A.length; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}",
"sb.append(A[i])",
"sb.append",
"sb",
"A[i]",
"A",
"i",
"if(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}",
"i != A.length -1",
"i",
"A.length -1",
"A.length",
"A",
"A.length",
"1",
"{\n\t\t\t\tsb.append(\" \");\n\t\t\t}",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"System.out.println(sb)",
"System.out.println",
"System.out",
"System",
"System.out",
"sb",
"int[] A",
"A",
"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\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\tbubbleSort(A,N);\n\t}\n\n\tpublic static void bubbleSort(int [] A,int N){\n\t\tint flag =1;\n\t\tint cnt =0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(A);\n\t\tSystem.out.println(cnt);\n\t\treturn ;\n\t}\n\tpublic static void show(int[] A){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0 ; i < A.length; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb); \n\t}\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\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\tbubbleSort(A,N);\n\t}\n\n\tpublic static void bubbleSort(int [] A,int N){\n\t\tint flag =1;\n\t\tint cnt =0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = N-1; j >= 1;j--){\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\tint tmp = A[j-1];\n\t\t\t\t\tA[j-1] = A[j];\n\t\t\t\t\tA[j] = tmp;\n\t\t\t\t\tflag =1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(A);\n\t\tSystem.out.println(cnt);\n\t\treturn ;\n\t}\n\tpublic static void show(int[] A){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0 ; i < A.length; i++){\n\t\t\tsb.append(A[i]);\n\t\t\tif(i != A.length -1){\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb); \n\t}\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[] A = new int[N];
for(int i=0 ; i < N; i++ ){
A[i] = sc.nextInt();
}
bubbleSort(A,N);
}
public static void bubbleSort(int [] A,int N){
int flag =1;
int cnt =0;
while(flag == 1){
flag = 0;
for(int j = N-1; j >= 1;j--){
if(A[j] < A[j-1]){
int tmp = A[j-1];
A[j-1] = A[j];
A[j] = tmp;
flag =1;
cnt++;
}
}
}
show(A);
System.out.println(cnt);
return ;
}
public static void show(int[] A){
StringBuilder sb = new StringBuilder();
for (int i = 0 ; i < A.length; i++){
sb.append(A[i]);
if(i != A.length -1){
sb.append(" ");
}
}
System.out.println(sb);
}
} |
[
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,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
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
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
55,
62
],
[
62,
63
],
[
62,
64
],
[
55,
65
],
[
65,
66
],
[
66,
67
],
[
55,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
70,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
80,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
80,
102
],
[
102,
103
],
[
80,
104
],
[
104,
105
],
[
104,
106
],
[
8,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
119,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
128,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
8,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
8,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
6,
151
],
[
151,
152
]
] | [
"import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] a = new int[n];\n\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\n\t\tboolean flag = true;\n\t\tint swap;\n\t\tint count = 0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n-1; i >= 1; i--){\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != n-1) System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\tpublic static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] a = new int[n];\n\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\n\t\tboolean flag = true;\n\t\tint swap;\n\t\tint count = 0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n-1; i >= 1; i--){\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != n-1) System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String args[]){\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] a = new int[n];\n\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\n\t\tboolean flag = true;\n\t\tint swap;\n\t\tint count = 0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n-1; i >= 1; i--){\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != n-1) System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\t\n\t\tint n = scan.nextInt();\n\t\tint[] a = new int[n];\n\t\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = scan.nextInt();\n\t\t}\n\t\n\t\tboolean flag = true;\n\t\tint swap;\n\t\tint count = 0;\n\t\t\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n-1; i >= 1; i--){\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != n-1) System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.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 = new int[n];",
"a",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t\ta[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = scan.nextInt();\n\t\t}",
"a[i] = scan.nextInt()",
"a[i]",
"a",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"boolean flag = true;",
"flag",
"true",
"int swap;",
"swap",
"int count = 0;",
"count",
"0",
"while(flag){\n\t\t\tflag = false;\n\t\t\tfor(int i = n-1; i >= 1; i--){\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor(int i = n-1; i >= 1; i--){\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for(int i = n-1; i >= 1; i--){\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"int i = n-1;",
"int i = n-1;",
"i",
"n-1",
"n",
"1",
"i >= 1",
"i",
"1",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if(a[i] < a[i-1]){\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"a[i] < a[i-1]",
"a[i]",
"a",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"{\n\t\t\t\t\tswap = a[i];\n\t\t\t\t\ta[i] = a[i-1];\n\t\t\t\t\ta[i-1] = swap;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"swap = a[i]",
"swap",
"a[i]",
"a",
"i",
"a[i] = a[i-1]",
"a[i]",
"a",
"i",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i-1] = swap",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"swap",
"count++",
"count",
"flag = true",
"flag",
"true",
"for(int i = 0; i < n; i++) {\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != n-1) System.out.print(\" \");\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != n-1) System.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(a[i]);\n\n\t\t\tif(i != n-1) System.out.print(\" \");\n\t\t}",
"System.out.print(a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"if(i != n-1) System.out.print(\" \");",
"i != n-1",
"i",
"n-1",
"n",
"1",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String args[]",
"args"
] | import java.util.Scanner;
class Main {
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++){
a[i] = scan.nextInt();
}
boolean flag = true;
int swap;
int count = 0;
while(flag){
flag = false;
for(int i = n-1; i >= 1; i--){
if(a[i] < a[i-1]){
swap = a[i];
a[i] = a[i-1];
a[i-1] = swap;
count++;
flag = true;
}
}
}
for(int i = 0; i < n; i++) {
System.out.print(a[i]);
if(i != n-1) System.out.print(" ");
}
System.out.println();
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,
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,
4,
18,
13,
4,
18,
13,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
18,
36,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
18,
36,
13,
13,
14,
2,
13,
2,
18,
18,
36,
13,
13,
17,
30,
3,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
12,
13,
30,
41,
13,
18,
18,
36,
13,
13,
0,
18,
18,
36,
13,
13,
18,
18,
36,
13,
13,
0,
18,
18,
36,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
2,
18,
18,
36,
13,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
18,
36,
13,
13,
18,
18,
36,
13,
2,
13,
17,
30,
4,
13,
13,
2,
13,
17,
40,
18,
36,
13,
12,
13,
30,
29,
18,
36,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
236,
5
],
[
236,
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,
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
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
8,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
60,
61
],
[
6,
62
],
[
62,
63
],
[
0,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
64,
68
],
[
68,
69
],
[
64,
70
],
[
70,
71
],
[
70,
72
],
[
64,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
73,
81
],
[
81,
82
],
[
64,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
86,
98
],
[
98,
99
],
[
99,
100
],
[
86,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
102,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
116,
122
],
[
113,
123
],
[
123,
124
],
[
102,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
85,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
64,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
138,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
157,
163
],
[
136,
164
],
[
164,
165
],
[
136,
166
],
[
166,
167
],
[
64,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
175,
181
],
[
171,
182
],
[
182,
183
],
[
182,
184
],
[
171,
185
],
[
185,
186
],
[
186,
187
],
[
171,
188
],
[
189,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
192,
194
],
[
190,
195
],
[
195,
196
],
[
195,
197
],
[
190,
198
],
[
198,
199
],
[
199,
200
],
[
190,
201
],
[
202,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
205,
209
],
[
204,
210
],
[
210,
211
],
[
211,
212
],
[
211,
213
],
[
210,
214
],
[
214,
215
],
[
214,
216
],
[
203,
217
],
[
217,
218
],
[
218,
219
],
[
218,
220
],
[
218,
221
],
[
221,
222
],
[
221,
223
],
[
217,
224
],
[
224,
225
],
[
225,
226
],
[
225,
227
],
[
64,
228
],
[
228,
229
],
[
228,
230
],
[
230,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
0,
235
],
[
235,
236
],
[
235,
237
]
] | [
"import java.util.Arrays;\n\npublic class Main {\n // field\n\n // method\n public static void main(String[] args) {\n\t//System.out.print(\"> \");\n\tjava.util.Scanner scan = new java.util.Scanner(System.in);\n\tint arraySize = scan.nextInt();\n\tString[] input = new String[arraySize];\n\tint[] array = new int[arraySize];\n\t//System.out.print(\"> \");\n\tfor (int i = 0; i < arraySize; i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\tBubbleSort bs = new BubbleSort(array.clone()); // バブルソート\n\tbs.bubbleSort(); // ソート\n\tbs.display(); // 表示\n\tSystem.out.println(bs.getCount());\n }\n}\nclass BubbleSort {\n // -- field\n private int[] sort_array;\n protected int Count;\n \n \n // -- Constructor\n private BubbleSort() {}\n public BubbleSort(int[] sort_array) {\n\tthis.sort_array = sort_array;\n }\n \n // -- Method\n public void display() {\n\tfor (int i = 0; i < this.sort_array.length; i++) {\n\t System.out.print(this.sort_array[i]);\n\t if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }\n\t System.out.print(\" \");\n\t}\n\tSystem.out.println();\n }\n\n public void swap(int x, int y) {\n\tint temp = this.sort_array[x];\n\tthis.sort_array[x] = this.sort_array[y];\n\tthis.sort_array[y] = temp;\n }\n\n public void bubbleSort() {\n\tfor (int i = this.sort_array.length - 1; i > 0; i--) {\n\t for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }\n\t}\n }\n\n public int getCount() {\n return this.Count;\n }\n}\n",
"import java.util.Arrays;",
"Arrays",
"java.util",
"public class Main {\n // field\n\n // method\n public static void main(String[] args) {\n\t//System.out.print(\"> \");\n\tjava.util.Scanner scan = new java.util.Scanner(System.in);\n\tint arraySize = scan.nextInt();\n\tString[] input = new String[arraySize];\n\tint[] array = new int[arraySize];\n\t//System.out.print(\"> \");\n\tfor (int i = 0; i < arraySize; i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\tBubbleSort bs = new BubbleSort(array.clone()); // バブルソート\n\tbs.bubbleSort(); // ソート\n\tbs.display(); // 表示\n\tSystem.out.println(bs.getCount());\n }\n}",
"Main",
"// method\n public static void main(String[] args) {\n\t//System.out.print(\"> \");\n\tjava.util.Scanner scan = new java.util.Scanner(System.in);\n\tint arraySize = scan.nextInt();\n\tString[] input = new String[arraySize];\n\tint[] array = new int[arraySize];\n\t//System.out.print(\"> \");\n\tfor (int i = 0; i < arraySize; i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\tBubbleSort bs = new BubbleSort(array.clone()); // バブルソート\n\tbs.bubbleSort(); // ソート\n\tbs.display(); // 表示\n\tSystem.out.println(bs.getCount());\n }",
"main",
"{\n\t//System.out.print(\"> \");\n\tjava.util.Scanner scan = new java.util.Scanner(System.in);\n\tint arraySize = scan.nextInt();\n\tString[] input = new String[arraySize];\n\tint[] array = new int[arraySize];\n\t//System.out.print(\"> \");\n\tfor (int i = 0; i < arraySize; i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\tBubbleSort bs = new BubbleSort(array.clone()); // バブルソート\n\tbs.bubbleSort(); // ソート\n\tbs.display(); // 表示\n\tSystem.out.println(bs.getCount());\n }",
"java.util.Scanner scan = new java.util.Scanner(System.in);",
"scan",
"new java.util.Scanner(System.in)",
"int arraySize = scan.nextInt();",
"arraySize",
"scan.nextInt()",
"scan.nextInt",
"scan",
"String[] input = new String[arraySize];",
"input",
"new String[arraySize]",
"arraySize",
"int[] array = new int[arraySize];",
"array",
"new int[arraySize]",
"arraySize",
"for (int i = 0; i < arraySize; i++){\n\t array[i] = scan.nextInt();\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < arraySize",
"i",
"arraySize",
"i++",
"i++",
"i",
"{\n\t array[i] = scan.nextInt();\n\t}",
"{\n\t array[i] = scan.nextInt();\n\t}",
"array[i] = scan.nextInt()",
"array[i]",
"array",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"BubbleSort bs = new BubbleSort(array.clone());",
"bs",
"new BubbleSort(array.clone())",
"bs.bubbleSort()",
"bs.bubbleSort",
"bs",
"bs.display()",
"bs.display",
"bs",
"System.out.println(bs.getCount())",
"System.out.println",
"System.out",
"System",
"System.out",
"bs.getCount()",
"bs.getCount",
"bs",
"String[] args",
"args",
"class BubbleSort {\n // -- field\n private int[] sort_array;\n protected int Count;\n \n \n // -- Constructor\n private BubbleSort() {}\n public BubbleSort(int[] sort_array) {\n\tthis.sort_array = sort_array;\n }\n \n // -- Method\n public void display() {\n\tfor (int i = 0; i < this.sort_array.length; i++) {\n\t System.out.print(this.sort_array[i]);\n\t if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }\n\t System.out.print(\" \");\n\t}\n\tSystem.out.println();\n }\n\n public void swap(int x, int y) {\n\tint temp = this.sort_array[x];\n\tthis.sort_array[x] = this.sort_array[y];\n\tthis.sort_array[y] = temp;\n }\n\n public void bubbleSort() {\n\tfor (int i = this.sort_array.length - 1; i > 0; i--) {\n\t for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }\n\t}\n }\n\n public int getCount() {\n return this.Count;\n }\n}",
"BubbleSort",
"// -- field\n private int[] sort_array;",
"sort_array",
"protected int Count;",
"Count",
"// -- Constructor\n private BubbleSort() {}",
"BubbleSort",
"{}",
"public BubbleSort(int[] sort_array) {\n\tthis.sort_array = sort_array;\n }",
"BubbleSort",
"{\n\tthis.sort_array = sort_array;\n }",
"this.sort_array = sort_array",
"this.sort_array",
"this",
"this.sort_array",
"sort_array",
"int[] sort_array",
"sort_array",
"// -- Method\n public void display() {\n\tfor (int i = 0; i < this.sort_array.length; i++) {\n\t System.out.print(this.sort_array[i]);\n\t if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }\n\t System.out.print(\" \");\n\t}\n\tSystem.out.println();\n }",
"display",
"{\n\tfor (int i = 0; i < this.sort_array.length; i++) {\n\t System.out.print(this.sort_array[i]);\n\t if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }\n\t System.out.print(\" \");\n\t}\n\tSystem.out.println();\n }",
"for (int i = 0; i < this.sort_array.length; i++) {\n\t System.out.print(this.sort_array[i]);\n\t if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }\n\t System.out.print(\" \");\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < this.sort_array.length",
"i",
"this.sort_array.length",
"this.sort_array",
"this",
"this.sort_array",
"this.sort_array.length",
"i++",
"i++",
"i",
"{\n\t System.out.print(this.sort_array[i]);\n\t if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }\n\t System.out.print(\" \");\n\t}",
"{\n\t System.out.print(this.sort_array[i]);\n\t if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }\n\t System.out.print(\" \");\n\t}",
"System.out.print(this.sort_array[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"this.sort_array[i]",
"this.sort_array",
"this",
"this.sort_array",
"i",
"if(i == this.sort_array.length-1) {\n\t\tbreak;\n\t }",
"i == this.sort_array.length-1",
"i",
"this.sort_array.length-1",
"this.sort_array.length",
"this.sort_array",
"this",
"this.sort_array",
"this.sort_array.length",
"1",
"{\n\t\tbreak;\n\t }",
"break;",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"public void swap(int x, int y) {\n\tint temp = this.sort_array[x];\n\tthis.sort_array[x] = this.sort_array[y];\n\tthis.sort_array[y] = temp;\n }",
"swap",
"{\n\tint temp = this.sort_array[x];\n\tthis.sort_array[x] = this.sort_array[y];\n\tthis.sort_array[y] = temp;\n }",
"int temp = this.sort_array[x];",
"temp",
"this.sort_array[x]",
"this.sort_array",
"this",
"this.sort_array",
"x",
"this.sort_array[x] = this.sort_array[y]",
"this.sort_array[x]",
"this.sort_array",
"this",
"this.sort_array",
"x",
"this.sort_array[y]",
"this.sort_array",
"this",
"this.sort_array",
"y",
"this.sort_array[y] = temp",
"this.sort_array[y]",
"this.sort_array",
"this",
"this.sort_array",
"y",
"temp",
"int x",
"x",
"int y",
"y",
"public void bubbleSort() {\n\tfor (int i = this.sort_array.length - 1; i > 0; i--) {\n\t for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }\n\t}\n }",
"bubbleSort",
"{\n\tfor (int i = this.sort_array.length - 1; i > 0; i--) {\n\t for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }\n\t}\n }",
"for (int i = this.sort_array.length - 1; i > 0; i--) {\n\t for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }\n\t}",
"int i = this.sort_array.length - 1;",
"int i = this.sort_array.length - 1;",
"i",
"this.sort_array.length - 1",
"this.sort_array.length",
"this.sort_array",
"this",
"this.sort_array",
"this.sort_array.length",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }\n\t}",
"{\n\t for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }\n\t}",
"for (int j = 0; j < i; j++) {\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < i",
"j",
"i",
"j++",
"j++",
"j",
"{\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }",
"{\n\t\tif (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}\n\t }",
"if (this.sort_array[j] > this.sort_array[j + 1]) {\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}",
"this.sort_array[j] > this.sort_array[j + 1]",
"this.sort_array[j]",
"this.sort_array",
"this",
"this.sort_array",
"j",
"this.sort_array[j + 1]",
"this.sort_array",
"this",
"this.sort_array",
"j + 1",
"j",
"1",
"{\n\t\t swap(j, j + 1);\n\t\t this.Count++;\n\t\t}",
"swap(j, j + 1)",
"swap",
"j",
"j + 1",
"j",
"1",
"this.Count++",
"this.Count",
"this",
"this.Count",
"public int getCount() {\n return this.Count;\n }",
"getCount",
"{\n return this.Count;\n }",
"return this.Count;",
"this.Count",
"this",
"this.Count",
"public class Main {\n // field\n\n // method\n public static void main(String[] args) {\n\t//System.out.print(\"> \");\n\tjava.util.Scanner scan = new java.util.Scanner(System.in);\n\tint arraySize = scan.nextInt();\n\tString[] input = new String[arraySize];\n\tint[] array = new int[arraySize];\n\t//System.out.print(\"> \");\n\tfor (int i = 0; i < arraySize; i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\tBubbleSort bs = new BubbleSort(array.clone()); // バブルソート\n\tbs.bubbleSort(); // ソート\n\tbs.display(); // 表示\n\tSystem.out.println(bs.getCount());\n }\n}",
"public class Main {\n // field\n\n // method\n public static void main(String[] args) {\n\t//System.out.print(\"> \");\n\tjava.util.Scanner scan = new java.util.Scanner(System.in);\n\tint arraySize = scan.nextInt();\n\tString[] input = new String[arraySize];\n\tint[] array = new int[arraySize];\n\t//System.out.print(\"> \");\n\tfor (int i = 0; i < arraySize; i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\tBubbleSort bs = new BubbleSort(array.clone()); // バブルソート\n\tbs.bubbleSort(); // ソート\n\tbs.display(); // 表示\n\tSystem.out.println(bs.getCount());\n }\n}",
"Main"
] | import java.util.Arrays;
public class Main {
// field
// method
public static void main(String[] args) {
//System.out.print("> ");
java.util.Scanner scan = new java.util.Scanner(System.in);
int arraySize = scan.nextInt();
String[] input = new String[arraySize];
int[] array = new int[arraySize];
//System.out.print("> ");
for (int i = 0; i < arraySize; i++){
array[i] = scan.nextInt();
}
BubbleSort bs = new BubbleSort(array.clone()); // バブルソート
bs.bubbleSort(); // ソート
bs.display(); // 表示
System.out.println(bs.getCount());
}
}
class BubbleSort {
// -- field
private int[] sort_array;
protected int Count;
// -- Constructor
private BubbleSort() {}
public BubbleSort(int[] sort_array) {
this.sort_array = sort_array;
}
// -- Method
public void display() {
for (int i = 0; i < this.sort_array.length; i++) {
System.out.print(this.sort_array[i]);
if(i == this.sort_array.length-1) {
break;
}
System.out.print(" ");
}
System.out.println();
}
public void swap(int x, int y) {
int temp = this.sort_array[x];
this.sort_array[x] = this.sort_array[y];
this.sort_array[y] = temp;
}
public void bubbleSort() {
for (int i = this.sort_array.length - 1; i > 0; i--) {
for (int j = 0; j < i; j++) {
if (this.sort_array[j] > this.sort_array[j + 1]) {
swap(j, j + 1);
this.Count++;
}
}
}
}
public int getCount() {
return this.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,
4,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
170,
5
],
[
170,
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
],
[
43,
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
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
60,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
8,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
6,
92
],
[
92,
93
],
[
170,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
96,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
111,
118
],
[
118,
119
],
[
118,
120
],
[
111,
121
],
[
121,
122
],
[
122,
123
],
[
111,
124
],
[
125,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
126,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
136,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
151,
157
],
[
136,
158
],
[
158,
159
],
[
136,
160
],
[
160,
161
],
[
160,
162
],
[
96,
163
],
[
163,
164
],
[
94,
165
],
[
165,
166
],
[
94,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"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 int[] a = new int[n];\n for(int i = 0; i<n; i++) {\n a[i] =sc.nextInt();\n }\n int count = bubbleSort(a, n);\n for(int i = 0; i<n; i++) {\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }\n System.out.println(count);\n }\n\n public static int bubbleSort(int[] a,int n) {\n boolean flag = true;\n int count = 0;\n while(flag == true) {\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }\n return count;\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 int[] a = new int[n];\n for(int i = 0; i<n; i++) {\n a[i] =sc.nextInt();\n }\n int count = bubbleSort(a, n);\n for(int i = 0; i<n; i++) {\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }\n System.out.println(count);\n }\n\n public static int bubbleSort(int[] a,int n) {\n boolean flag = true;\n int count = 0;\n while(flag == true) {\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }\n return count;\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 int count = bubbleSort(a, n);\n for(int i = 0; i<n; i++) {\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }\n System.out.println(count);\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 int count = bubbleSort(a, n);\n for(int i = 0; i<n; i++) {\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\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",
"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 count = bubbleSort(a, n);",
"count",
"bubbleSort(a, n)",
"bubbleSort",
"a",
"n",
"for(int i = 0; i<n; i++) {\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }",
"{\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }",
"if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }",
"i<n-1",
"i",
"n-1",
"n",
"1",
"{\n System.out.print(a[i] + \" \");\n }",
"System.out.print(a[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i] + \" \"",
"a[i]",
"a",
"i",
"\" \"",
"{\n System.out.println(a[i]);\n }",
"System.out.println(a[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int bubbleSort(int[] a,int n) {\n boolean flag = true;\n int count = 0;\n while(flag == true) {\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }\n return count;\n }",
"bubbleSort",
"{\n boolean flag = true;\n int count = 0;\n while(flag == true) {\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }\n return count;\n }",
"boolean flag = true;",
"flag",
"true",
"int count = 0;",
"count",
"0",
"while(flag == true) {\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }",
"flag == true",
"flag",
"true",
"{\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j>0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }",
"{\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }",
"if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }",
"a[j]<a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"{\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }",
"int free = a[j];",
"free",
"a[j]",
"a",
"j",
"a[j] = a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1] = free",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"free",
"count++",
"count",
"flag = true",
"flag",
"true",
"return count;",
"count",
"int[] a",
"a",
"int 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 int count = bubbleSort(a, n);\n for(int i = 0; i<n; i++) {\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }\n System.out.println(count);\n }\n\n public static int bubbleSort(int[] a,int n) {\n boolean flag = true;\n int count = 0;\n while(flag == true) {\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }\n return count;\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 int count = bubbleSort(a, n);\n for(int i = 0; i<n; i++) {\n if(i<n-1){\n System.out.print(a[i] + \" \");\n }else {\n System.out.println(a[i]);\n }\n }\n System.out.println(count);\n }\n\n public static int bubbleSort(int[] a,int n) {\n boolean flag = true;\n int count = 0;\n while(flag == true) {\n flag = false;\n for(int j = n-1;j>0; j--) {\n if(a[j]<a[j-1]) {\n int free = a[j];\n a[j] = a[j-1];\n a[j-1] = free;\n count++;\n flag = true;\n }\n }\n }\n return count;\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();
}
int count = bubbleSort(a, n);
for(int i = 0; i<n; i++) {
if(i<n-1){
System.out.print(a[i] + " ");
}else {
System.out.println(a[i]);
}
}
System.out.println(count);
}
public static int bubbleSort(int[] a,int n) {
boolean flag = true;
int count = 0;
while(flag == true) {
flag = false;
for(int j = n-1;j>0; j--) {
if(a[j]<a[j-1]) {
int free = a[j];
a[j] = a[j-1];
a[j-1] = free;
count++;
flag = true;
}
}
}
return count;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
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,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
13,
17,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
41,
13,
20,
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,
18,
13,
13,
4,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
205,
8
],
[
205,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
15,
16
],
[
15,
17
],
[
11,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
18,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
18,
28
],
[
28,
29
],
[
29,
30
],
[
18,
31
],
[
32,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
37,
40
],
[
40,
41
],
[
40,
42
],
[
11,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
48,
52
],
[
9,
53
],
[
53,
54
],
[
205,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
61,
73
],
[
73,
74
],
[
74,
75
],
[
61,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
78,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
78,
92
],
[
92,
93
],
[
93,
94
],
[
78,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
107,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
122,
128
],
[
107,
129
],
[
129,
130
],
[
57,
131
],
[
131,
132
],
[
131,
133
],
[
57,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
55,
140
],
[
140,
141
],
[
205,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
146,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
146,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
160,
161
],
[
146,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
165,
166
],
[
164,
167
],
[
146,
168
],
[
168,
169
],
[
168,
170
],
[
171,
172
],
[
171,
173
],
[
146,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
174,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
181,
183
],
[
174,
184
],
[
184,
185
],
[
185,
186
],
[
174,
187
],
[
188,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
189,
193
],
[
193,
194
],
[
194,
195
],
[
193,
196
],
[
196,
197
],
[
196,
198
],
[
146,
199
],
[
199,
200
],
[
199,
201
],
[
142,
202
],
[
202,
203
],
[
0,
204
],
[
204,
205
],
[
204,
206
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tprivate static void print(int[] A){\n\t\tString[] V=new String[A.length];\n\t\tfor(int i=0;i<A.length;i++){\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}\n\t\tSystem.out.println(String.join(\" \",V));\n\t}\n\t\n\tprivate static void BubbleSort(int[] A){\n\t int store=0;\n\t for(int i = 0;i<=A.length-1;i++){\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }\n\t print(A);\n\t System.out.println(store);\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n \n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\tprivate static void print(int[] A){\n\t\tString[] V=new String[A.length];\n\t\tfor(int i=0;i<A.length;i++){\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}\n\t\tSystem.out.println(String.join(\" \",V));\n\t}\n\t\n\tprivate static void BubbleSort(int[] A){\n\t int store=0;\n\t for(int i = 0;i<=A.length-1;i++){\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }\n\t print(A);\n\t System.out.println(store);\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n \n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }\n\t}\n}",
"Main",
"private static void print(int[] A){\n\t\tString[] V=new String[A.length];\n\t\tfor(int i=0;i<A.length;i++){\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}\n\t\tSystem.out.println(String.join(\" \",V));\n\t}",
"print",
"{\n\t\tString[] V=new String[A.length];\n\t\tfor(int i=0;i<A.length;i++){\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}\n\t\tSystem.out.println(String.join(\" \",V));\n\t}",
"String[] V=new String[A.length];",
"V",
"new String[A.length]",
"A.length",
"A",
"A.length",
"for(int i=0;i<A.length;i++){\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}",
"{\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}",
"V[i]=String.valueOf(A[i])",
"V[i]",
"V",
"i",
"String.valueOf(A[i])",
"String.valueOf",
"String",
"A[i]",
"A",
"i",
"System.out.println(String.join(\" \",V))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.join(\" \",V)",
"String.join",
"String",
"\" \"",
"V",
"int[] A",
"A",
"private static void BubbleSort(int[] A){\n\t int store=0;\n\t for(int i = 0;i<=A.length-1;i++){\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }\n\t print(A);\n\t System.out.println(store);\n\t}",
"BubbleSort",
"{\n\t int store=0;\n\t for(int i = 0;i<=A.length-1;i++){\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }\n\t print(A);\n\t System.out.println(store);\n\t}",
"int store=0;",
"store",
"0",
"for(int i = 0;i<=A.length-1;i++){\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<=A.length-1",
"i",
"A.length-1",
"A.length",
"A",
"A.length",
"1",
"i++",
"i++",
"i",
"{\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }",
"{\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }",
"for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }",
"int j = A.length-1;",
"int j = A.length-1;",
"j",
"A.length-1",
"A.length",
"A",
"A.length",
"1",
"j>=i+1",
"j",
"i+1",
"i",
"1",
"j--",
"j--",
"j",
"{\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }",
"{\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }",
"if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }",
"int w=A[j];",
"w",
"A[j]",
"A",
"j",
"A[j]=A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1]=w",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"w",
"store++",
"store",
"print(A)",
"print",
"A",
"System.out.println(store)",
"System.out.println",
"System.out",
"System",
"System.out",
"store",
"int[] A",
"A",
"public static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n \n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }\n\t}",
"main",
"{\n // TODO ?????????????????????????????????????????????\n \n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }\n\t}",
"try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }",
"{\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in))",
"new BufferedReader(new InputStreamReader(System.in))",
"String line;",
"line",
"line=br.readLine()",
"line",
"br.readLine()",
"br.readLine",
"br",
"line=br.readLine()",
"line",
"br.readLine()",
"br.readLine",
"br",
"String[] str=line.split(\" \");",
"str",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"int[] A=new int[str.length];",
"A",
"new int[str.length]",
"str.length",
"str",
"str.length",
"for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n \tA[i]=Integer.parseInt(str[i]);\n }",
"{\n \tA[i]=Integer.parseInt(str[i]);\n }",
"A[i]=Integer.parseInt(str[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"BubbleSort(A)",
"BubbleSort",
"A",
"String[] args",
"args",
"public class Main {\n\tprivate static void print(int[] A){\n\t\tString[] V=new String[A.length];\n\t\tfor(int i=0;i<A.length;i++){\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}\n\t\tSystem.out.println(String.join(\" \",V));\n\t}\n\t\n\tprivate static void BubbleSort(int[] A){\n\t int store=0;\n\t for(int i = 0;i<=A.length-1;i++){\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }\n\t print(A);\n\t System.out.println(store);\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n \n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }\n\t}\n}",
"public class Main {\n\tprivate static void print(int[] A){\n\t\tString[] V=new String[A.length];\n\t\tfor(int i=0;i<A.length;i++){\n\t\t\tV[i]=String.valueOf(A[i]);\n\t\t}\n\t\tSystem.out.println(String.join(\" \",V));\n\t}\n\t\n\tprivate static void BubbleSort(int[] A){\n\t int store=0;\n\t for(int i = 0;i<=A.length-1;i++){\n\t for(int j = A.length-1;j>=i+1;j--){\n\t if(A[j] < A[j-1]){\n\t int w=A[j];\n\t A[j]=A[j-1];\n\t A[j-1]=w;\n\t store++;\n\t }\n\t }\n\t }\n\t print(A);\n\t System.out.println(store);\n\t}\n\t\n\tpublic static void main(String[] args) throws Exception {\n // TODO ?????????????????????????????????????????????\n \n try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {\n String line;\n line=br.readLine();\n line=br.readLine();\n String[] str=line.split(\" \");\n int[] A=new int[str.length];\n for(int i=0;i<A.length;i++){\n \tA[i]=Integer.parseInt(str[i]);\n }\n BubbleSort(A);\n }\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
private static void print(int[] A){
String[] V=new String[A.length];
for(int i=0;i<A.length;i++){
V[i]=String.valueOf(A[i]);
}
System.out.println(String.join(" ",V));
}
private static void BubbleSort(int[] A){
int store=0;
for(int i = 0;i<=A.length-1;i++){
for(int j = A.length-1;j>=i+1;j--){
if(A[j] < A[j-1]){
int w=A[j];
A[j]=A[j-1];
A[j-1]=w;
store++;
}
}
}
print(A);
System.out.println(store);
}
public static void main(String[] args) throws Exception {
// TODO ?????????????????????????????????????????????
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
String line;
line=br.readLine();
line=br.readLine();
String[] str=line.split(" ");
int[] A=new int[str.length];
for(int i=0;i<A.length;i++){
A[i]=Integer.parseInt(str[i]);
}
BubbleSort(A);
}
}
} |
[
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,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
18,
13,
13,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
162,
5
],
[
162,
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
],
[
57,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
57,
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
],
[
85,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
82,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
82,
104
],
[
104,
105
],
[
8,
106
],
[
106,
107
],
[
106,
108
],
[
8,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
6,
115
],
[
115,
116
],
[
162,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
120,
132
],
[
132,
133
],
[
133,
134
],
[
120,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
119,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
117,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint count = 0;\n\n\t\tfor(int i = 0; i < n; i++) {\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}\n\n\t\tfor(int i = 1; i < n; i++) {\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\n\t}\n\n\tstatic void printArray(int[] array) {\n\n\t\tfor(int i = 0; i < array.length - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\n\t\tSystem.out.println(array[array.length - 1]);\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint count = 0;\n\n\t\tfor(int i = 0; i < n; i++) {\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}\n\n\t\tfor(int i = 1; i < n; i++) {\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\n\t}\n\n\tstatic void printArray(int[] array) {\n\n\t\tfor(int i = 0; i < array.length - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\n\t\tSystem.out.println(array[array.length - 1]);\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint count = 0;\n\n\t\tfor(int i = 0; i < n; i++) {\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}\n\n\t\tfor(int i = 1; i < n; i++) {\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint count = 0;\n\n\t\tfor(int i = 0; i < n; i++) {\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}\n\n\t\tfor(int i = 1; i < n; i++) {\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < n; i++) {\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}",
"{\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 1; i < n; i++) {\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}",
"{\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}",
"for(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j >= i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}",
"{\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}",
"if(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"array[j - 1] > array[j]",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"array[j]",
"array",
"j",
"{\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int temp = array[j];",
"temp",
"array[j]",
"array",
"j",
"array[j] = array[j - 1]",
"array[j]",
"array",
"j",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"array[j - 1] = temp",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"temp",
"count++",
"count",
"printArray(array)",
"printArray",
"array",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static void printArray(int[] array) {\n\n\t\tfor(int i = 0; i < array.length - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\n\t\tSystem.out.println(array[array.length - 1]);\n\t}",
"printArray",
"{\n\n\t\tfor(int i = 0; i < array.length - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\n\t\tSystem.out.println(array[array.length - 1]);\n\t}",
"for(int i = 0; i < array.length - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.length - 1",
"i",
"array.length - 1",
"array.length",
"array",
"array.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}",
"System.out.print(array[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i] + \" \"",
"array[i]",
"array",
"i",
"\" \"",
"System.out.println(array[array.length - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[array.length - 1]",
"array",
"array.length - 1",
"array.length",
"array",
"array.length",
"1",
"int[] array",
"array",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint count = 0;\n\n\t\tfor(int i = 0; i < n; i++) {\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}\n\n\t\tfor(int i = 1; i < n; i++) {\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\n\t}\n\n\tstatic void printArray(int[] array) {\n\n\t\tfor(int i = 0; i < array.length - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\n\t\tSystem.out.println(array[array.length - 1]);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws Exception {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tint count = 0;\n\n\t\tfor(int i = 0; i < n; i++) {\n\n\t\t\tarray[i] = sc.nextInt();\n\n\t\t}\n\n\t\tfor(int i = 1; i < n; i++) {\n\n\t\t\tfor(int j = n - 1; j >= i; j--) {\n\n\t\t\t\tif(array[j - 1] > array[j]) {\n\n\t\t\t\t\tint temp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\n\t}\n\n\tstatic void printArray(int[] array) {\n\n\t\tfor(int i = 0; i < array.length - 1; i++) {\n\t\t\tSystem.out.print(array[i] + \" \");\n\t\t}\n\n\t\tSystem.out.println(array[array.length - 1]);\n\t}\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();
int[] array = new int[n];
int count = 0;
for(int i = 0; i < n; i++) {
array[i] = sc.nextInt();
}
for(int i = 1; i < n; i++) {
for(int j = n - 1; j >= i; j--) {
if(array[j - 1] > array[j]) {
int temp = array[j];
array[j] = array[j - 1];
array[j - 1] = temp;
count++;
}
}
}
printArray(array);
System.out.println(count);
}
static void printArray(int[] array) {
for(int i = 0; i < array.length - 1; i++) {
System.out.print(array[i] + " ");
}
System.out.println(array[array.length - 1]);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
38,
5,
13,
30,
4,
18,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
13,
1,
40,
13,
30,
30,
0,
13,
17,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
0,
13,
17,
40,
13,
41,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
4,
18,
4,
18,
13,
17,
17,
17,
17,
17,
17,
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
],
[
193,
14
],
[
193,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
21,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
34,
35
],
[
35,
36
],
[
28,
37
],
[
37,
38
],
[
37,
39
],
[
28,
41
],
[
41,
42
],
[
41,
43
],
[
43,
44
],
[
44,
45
],
[
28,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
48,
51
],
[
28,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
52,
62
],
[
62,
63
],
[
63,
64
],
[
52,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
28,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
15,
85
],
[
85,
86
],
[
193,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
89,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
96,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
110,
119
],
[
119,
120
],
[
119,
121
],
[
110,
122
],
[
122,
123
],
[
123,
124
],
[
110,
125
],
[
126,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
127,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
137,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
151,
152
],
[
151,
153
],
[
137,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
137,
159
],
[
159,
160
],
[
159,
161
],
[
137,
162
],
[
162,
163
],
[
89,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
166,
169
],
[
89,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
179,
182
],
[
179,
183
],
[
177,
184
],
[
177,
185
],
[
175,
186
],
[
175,
187
],
[
89,
188
],
[
188,
189
],
[
87,
190
],
[
190,
191
],
[
0,
192
],
[
192,
193
],
[
192,
194
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\t// バブルソート\n\tpublic static int bubbleSort(int[] array) {\n\t\tint cnt = 0;// 交換回数\n\t\tboolean flg = true;\n\t\tfor (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t// 表示\n\t\tString str = Arrays.toString(array);\n\t\tSystem.out.println(str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\"));\n\t\treturn cnt;\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",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\t// バブルソート\n\tpublic static int bubbleSort(int[] array) {\n\t\tint cnt = 0;// 交換回数\n\t\tboolean flg = true;\n\t\tfor (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t// 表示\n\t\tString str = Arrays.toString(array);\n\t\tSystem.out.println(str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\"));\n\t\treturn cnt;\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"try {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"IOException e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t}",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"String input = br.readLine();",
"input",
"br.readLine()",
"br.readLine",
"br",
"String[] s = input.split(\"\\\\s\");",
"s",
"input.split(\"\\\\s\")",
"input.split",
"input",
"\"\\\\s\"",
"for (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}",
"{\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}",
"array[i] = Integer.parseInt(s[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(s[i])",
"Integer.parseInt",
"Integer",
"s[i]",
"s",
"i",
"System.out.println(bubbleSort(array))",
"System.out.println",
"System.out",
"System",
"System.out",
"bubbleSort(array)",
"bubbleSort",
"array",
"String[] args",
"args",
"// バブルソート\n\tpublic static int bubbleSort(int[] array) {\n\t\tint cnt = 0;// 交換回数\n\t\tboolean flg = true;\n\t\tfor (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t// 表示\n\t\tString str = Arrays.toString(array);\n\t\tSystem.out.println(str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\"));\n\t\treturn cnt;\n\t}",
"bubbleSort",
"{\n\t\tint cnt = 0;// 交換回数\n\t\tboolean flg = true;\n\t\tfor (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t// 表示\n\t\tString str = Arrays.toString(array);\n\t\tSystem.out.println(str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\"));\n\t\treturn cnt;\n\t}",
"int cnt = 0;",
"cnt",
"0",
"boolean flg = true;",
"flg",
"true",
"for (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"flg",
"i++",
"i++",
"i",
"{ // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"{ // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"flg = false",
"flg",
"false",
"for (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"int j = array.length - 1;",
"int j = array.length - 1;",
"j",
"array.length - 1",
"array.length",
"array",
"array.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"if (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"array[j] < array[j - 1]",
"array[j]",
"array",
"j",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"int tmp = array[j - 1];",
"tmp",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"array[j - 1] = array[j]",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"array[j]",
"array",
"j",
"array[j] = tmp",
"array[j]",
"array",
"j",
"tmp",
"flg = true",
"flg",
"true",
"cnt++",
"cnt",
"String str = Arrays.toString(array);",
"str",
"Arrays.toString(array)",
"Arrays.toString",
"Arrays",
"array",
"System.out.println(str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\"))",
"System.out.println",
"System.out",
"System",
"System.out",
"str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\")",
"str.replace(\"[\", \"\").replace(\"]\", \"\").replace",
"str.replace(\"[\", \"\").replace(\"]\", \"\")",
"str.replace(\"[\", \"\").replace",
"str.replace(\"[\", \"\")",
"str.replace",
"str",
"\"[\"",
"\"\"",
"\"]\"",
"\"\"",
"\",\"",
"\"\"",
"return cnt;",
"cnt",
"int[] array",
"array",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\t// バブルソート\n\tpublic static int bubbleSort(int[] array) {\n\t\tint cnt = 0;// 交換回数\n\t\tboolean flg = true;\n\t\tfor (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t// 表示\n\t\tString str = Arrays.toString(array);\n\t\tSystem.out.println(str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\"));\n\t\treturn cnt;\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\ttry {\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tint[] array = new int[n];\n\t\t\tString input = br.readLine();\n\t\t\tString[] s = input.split(\"\\\\s\");\n\t\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\t\tarray[i] = Integer.parseInt(s[i]);\n\t\t\t}\n\t\t\tSystem.out.println(bubbleSort(array));\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}\n\n\t// バブルソート\n\tpublic static int bubbleSort(int[] array) {\n\t\tint cnt = 0;// 交換回数\n\t\tboolean flg = true;\n\t\tfor (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス\n\t\t\tflg = false;\n\t\t\tfor (int j = array.length - 1; j > i; j--) {\n\t\t\t\tif (array[j] < array[j - 1]) {\n\t\t\t\t\tint tmp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = tmp;\n\t\t\t\t\tflg = true;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t// 表示\n\t\tString str = Arrays.toString(array);\n\t\tSystem.out.println(str.replace(\"[\", \"\").replace(\"]\", \"\").replace(\",\", \"\"));\n\t\treturn cnt;\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
int n = Integer.parseInt(br.readLine());
int[] array = new int[n];
String input = br.readLine();
String[] s = input.split("\\s");
for (int i = 0; i < array.length; i++) {
array[i] = Integer.parseInt(s[i]);
}
System.out.println(bubbleSort(array));
} catch (IOException e) {
e.printStackTrace();
}
}
// バブルソート
public static int bubbleSort(int[] array) {
int cnt = 0;// 交換回数
boolean flg = true;
for (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス
flg = false;
for (int j = array.length - 1; j > i; j--) {
if (array[j] < array[j - 1]) {
int tmp = array[j - 1];
array[j - 1] = array[j];
array[j] = tmp;
flg = true;
cnt++;
}
}
}
// 表示
String str = Arrays.toString(array);
System.out.println(str.replace("[", "").replace("]", "").replace(",", ""));
return cnt;
}
}
|
[
7,
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
2,
13,
17,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
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
],
[
166,
5
],
[
166,
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
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
22,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
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
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
52,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
58,
66
],
[
66,
67
],
[
67,
68
],
[
58,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
71,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
71,
83
],
[
83,
84
],
[
84,
85
],
[
71,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
95,
96
],
[
95,
97
],
[
88,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
98,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
98,
120
],
[
120,
121
],
[
8,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
8,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
8,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
6,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"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\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\n\t\tString[] datastr = sc.nextLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tfor (int i=0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n-1]);\n\t\tSystem.out.println(count);\n\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\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\n\t\tString[] datastr = sc.nextLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tfor (int i=0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n-1]);\n\t\tSystem.out.println(count);\n\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\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\n\t\tString[] datastr = sc.nextLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tfor (int i=0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n-1]);\n\t\tSystem.out.println(count);\n\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\n\t\tString[] datastr = sc.nextLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tfor (int i=0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n-1]);\n\t\tSystem.out.println(count);\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",
"String[] datastr = sc.nextLine().split(\" \");",
"datastr",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i=0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}",
"{\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}",
"a[i] = Integer.parseInt(datastr[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(datastr[i])",
"Integer.parseInt",
"Integer",
"datastr[i]",
"datastr",
"i",
"int count = 0;",
"count",
"0",
"for (int i=0; i < n; i++) {\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\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\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}",
"for (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"i+1 <= j",
"i+1",
"i",
"1",
"j",
"j--",
"j--",
"j",
"{\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}",
"{\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}",
"if (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"a[j-1] > a[j]",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j]",
"a",
"j",
"{\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int temp = a[j];",
"temp",
"a[j]",
"a",
"j",
"a[j] = a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1] = temp",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"temp",
"count++",
"count",
"for (int i=0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\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\tSystem.out.print(a[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}",
"System.out.print(a[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i] + \" \"",
"a[i]",
"a",
"i",
"\" \"",
"System.out.println(a[n-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[n-1]",
"a",
"n-1",
"n",
"1",
"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\n\t\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\n\t\tString[] datastr = sc.nextLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tfor (int i=0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n-1]);\n\t\tSystem.out.println(count);\n\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\tint n = sc.nextInt();\n\t\tsc.nextLine();\n\n\t\tString[] datastr = sc.nextLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i=0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(datastr[i]);\n\t\t}\n\n\t\tint count = 0;\n\n\t\tfor (int i=0; i < n; i++) {\n\t\t\tfor (int j = n-1; i+1 <= j; j--) {\n\n\t\t\t\tif (a[j-1] > a[j]) {\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = temp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tfor (int i=0; i < n-1; i++) {\n\t\t\tSystem.out.print(a[i] + \" \");\n\t\t}\n\t\tSystem.out.println(a[n-1]);\n\t\tSystem.out.println(count);\n\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();
sc.nextLine();
String[] datastr = sc.nextLine().split(" ");
int[] a = new int[n];
for (int i=0; i < n; i++) {
a[i] = Integer.parseInt(datastr[i]);
}
int count = 0;
for (int i=0; i < n; i++) {
for (int j = n-1; i+1 <= j; j--) {
if (a[j-1] > a[j]) {
int temp = a[j];
a[j] = a[j-1];
a[j-1] = temp;
count++;
}
}
}
for (int i=0; i < n-1; i++) {
System.out.print(a[i] + " ");
}
System.out.println(a[n-1]);
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
0,
13,
4,
18,
13,
41,
13,
0,
13,
20,
13,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
0,
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,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
169,
5
],
[
169,
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
],
[
8,
22
],
[
22,
23
],
[
22,
24
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
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
],
[
43,
44
],
[
43,
45
],
[
42,
46
],
[
46,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
8,
51
],
[
51,
52
],
[
8,
53
],
[
53,
54
],
[
8,
55
],
[
55,
56
],
[
55,
57
],
[
8,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
58,
68
],
[
68,
69
],
[
69,
70
],
[
58,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
73,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
88,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
98,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
98,
120
],
[
120,
121
],
[
8,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
8,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
8,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
8,
163
],
[
163,
164
],
[
164,
165
],
[
6,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"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=0;\n N = sc.nextInt();\n int[] A;\n A = new int[N];\n int i=0;\n for(i=0;i<N;i++){\n A[i] = sc.nextInt();\n }\n int j;\n int k;\n int z;\n int swap = 0;\n for(j=0;j<N-1;j++){\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }\n\n for(i=0;i<N-1;i++){\n System.out.print(A[i]+\" \");\n }\n System.out.println(A[N-1]);\n System.out.println(swap); \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=0;\n N = sc.nextInt();\n int[] A;\n A = new int[N];\n int i=0;\n for(i=0;i<N;i++){\n A[i] = sc.nextInt();\n }\n int j;\n int k;\n int z;\n int swap = 0;\n for(j=0;j<N-1;j++){\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }\n\n for(i=0;i<N-1;i++){\n System.out.print(A[i]+\" \");\n }\n System.out.println(A[N-1]);\n System.out.println(swap); \n sc.close();\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in); \n int N=0;\n N = sc.nextInt();\n int[] A;\n A = new int[N];\n int i=0;\n for(i=0;i<N;i++){\n A[i] = sc.nextInt();\n }\n int j;\n int k;\n int z;\n int swap = 0;\n for(j=0;j<N-1;j++){\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }\n\n for(i=0;i<N-1;i++){\n System.out.print(A[i]+\" \");\n }\n System.out.println(A[N-1]);\n System.out.println(swap); \n sc.close();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in); \n int N=0;\n N = sc.nextInt();\n int[] A;\n A = new int[N];\n int i=0;\n for(i=0;i<N;i++){\n A[i] = sc.nextInt();\n }\n int j;\n int k;\n int z;\n int swap = 0;\n for(j=0;j<N-1;j++){\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }\n\n for(i=0;i<N-1;i++){\n System.out.print(A[i]+\" \");\n }\n System.out.println(A[N-1]);\n System.out.println(swap); \n sc.close();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N=0;",
"N",
"0",
"N = sc.nextInt()",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] A;",
"A",
"A = new int[N]",
"A",
"new int[N]",
"N",
"int i=0;",
"i",
"0",
"for(i=0;i<N;i++){\n A[i] = sc.nextInt();\n }",
"i=0;",
"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 j;",
"j",
"int k;",
"k",
"int z;",
"z",
"int swap = 0;",
"swap",
"0",
"for(j=0;j<N-1;j++){\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }",
"j=0;",
"j=0",
"j",
"0",
"j<N-1",
"j",
"N-1",
"N",
"1",
"j++",
"j++",
"j",
"{\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }",
"{\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }",
"for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }",
"k=0;",
"k=0",
"k",
"0",
"k<N-1",
"k",
"N-1",
"N",
"1",
"k++",
"k++",
"k",
"{\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }",
"{\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }",
"if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }",
"A[k]>A[k+1]",
"A[k]",
"A",
"k",
"A[k+1]",
"A",
"k+1",
"k",
"1",
"{\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }",
"z = A[k]",
"z",
"A[k]",
"A",
"k",
"A[k] = A[k+1]",
"A[k]",
"A",
"k",
"A[k+1]",
"A",
"k+1",
"k",
"1",
"A[k+1] = z",
"A[k+1]",
"A",
"k+1",
"k",
"1",
"z",
"swap++",
"swap",
"for(i=0;i<N-1;i++){\n System.out.print(A[i]+\" \");\n }",
"i=0;",
"i=0",
"i",
"0",
"i<N-1",
"i",
"N-1",
"N",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(A[i]+\" \");\n }",
"{\n System.out.print(A[i]+\" \");\n }",
"System.out.print(A[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]+\" \"",
"A[i]",
"A",
"i",
"\" \"",
"System.out.println(A[N-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[N-1]",
"A",
"N-1",
"N",
"1",
"System.out.println(swap)",
"System.out.println",
"System.out",
"System",
"System.out",
"swap",
"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=0;\n N = sc.nextInt();\n int[] A;\n A = new int[N];\n int i=0;\n for(i=0;i<N;i++){\n A[i] = sc.nextInt();\n }\n int j;\n int k;\n int z;\n int swap = 0;\n for(j=0;j<N-1;j++){\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }\n\n for(i=0;i<N-1;i++){\n System.out.print(A[i]+\" \");\n }\n System.out.println(A[N-1]);\n System.out.println(swap); \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=0;\n N = sc.nextInt();\n int[] A;\n A = new int[N];\n int i=0;\n for(i=0;i<N;i++){\n A[i] = sc.nextInt();\n }\n int j;\n int k;\n int z;\n int swap = 0;\n for(j=0;j<N-1;j++){\n for(k=0;k<N-1;k++){\n if(A[k]>A[k+1]){\n z = A[k];\n A[k] = A[k+1];\n A[k+1] = z;\n swap++;\n }\n }\n }\n\n for(i=0;i<N-1;i++){\n System.out.print(A[i]+\" \");\n }\n System.out.println(A[N-1]);\n System.out.println(swap); \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=0;
N = sc.nextInt();
int[] A;
A = new int[N];
int i=0;
for(i=0;i<N;i++){
A[i] = sc.nextInt();
}
int j;
int k;
int z;
int swap = 0;
for(j=0;j<N-1;j++){
for(k=0;k<N-1;k++){
if(A[k]>A[k+1]){
z = A[k];
A[k] = A[k+1];
A[k+1] = z;
swap++;
}
}
}
for(i=0;i<N-1;i++){
System.out.print(A[i]+" ");
}
System.out.println(A[N-1]);
System.out.println(swap);
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,
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,
17,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
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
],
[
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
],
[
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
],
[
47,
50
],
[
50,
51
],
[
51,
52
],
[
14,
53
],
[
53,
54
],
[
53,
55
],
[
14,
56
],
[
56,
57
],
[
56,
58
],
[
14,
59
],
[
59,
60
],
[
59,
61
],
[
14,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
70,
77
],
[
77,
78
],
[
77,
79
],
[
70,
80
],
[
80,
81
],
[
81,
82
],
[
70,
83
],
[
84,
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
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
95,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
110,
116
],
[
95,
117
],
[
117,
118
],
[
117,
119
],
[
95,
120
],
[
120,
121
],
[
14,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
122,
130
],
[
130,
131
],
[
131,
132
],
[
122,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
134,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
14,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
14,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
12,
165
],
[
165,
166
]
] | [
"/* 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\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t// your code goes here\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint num[] = new int[n];\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tnum[i] = Integer.parseInt(scanner.next());\n\t\t}\n\t\t\n\t\tint flag = 1;\n\t\tint tmp = 0;\n\t\tint cnt = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1;j >= 1;j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.lang.*;",
"lang.*",
"java",
"import java.io.*;",
"io.*",
"java",
"class Main\n{\n\tpublic static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t// your code goes here\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint num[] = new int[n];\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tnum[i] = Integer.parseInt(scanner.next());\n\t\t}\n\t\t\n\t\tint flag = 1;\n\t\tint tmp = 0;\n\t\tint cnt = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1;j >= 1;j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\t}\n}",
"Main",
"public static void main (String[] args) throws java.lang.Exception\n\t{\n\t\t// your code goes here\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint num[] = new int[n];\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tnum[i] = Integer.parseInt(scanner.next());\n\t\t}\n\t\t\n\t\tint flag = 1;\n\t\tint tmp = 0;\n\t\tint cnt = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1;j >= 1;j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\t\t// your code goes here\n\t\t\n\t\tScanner scanner = new Scanner(System.in);\n\t\t\n\t\tint n = Integer.parseInt(scanner.nextLine());\n\t\tint num[] = new int[n];\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tnum[i] = Integer.parseInt(scanner.next());\n\t\t}\n\t\t\n\t\tint flag = 1;\n\t\tint tmp = 0;\n\t\tint cnt = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1;j >= 1;j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0;i < n;i++){\n\t\t\tif(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(num[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = Integer.parseInt(scanner.nextLine());",
"n",
"Integer.parseInt(scanner.nextLine())",
"Integer.parseInt",
"Integer",
"scanner.nextLine()",
"scanner.nextLine",
"scanner",
"int num[] = new int[n];",
"num",
"new int[n]",
"n",
"for(int i = 0;i < n;i++){\n\t\t\tnum[i] = Integer.parseInt(scanner.next());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = Integer.parseInt(scanner.next());\n\t\t}",
"{\n\t\t\tnum[i] = Integer.parseInt(scanner.next());\n\t\t}",
"num[i] = Integer.parseInt(scanner.next())",
"num[i]",
"num",
"i",
"Integer.parseInt(scanner.next())",
"Integer.parseInt",
"Integer",
"scanner.next()",
"scanner.next",
"scanner",
"int flag = 1;",
"flag",
"1",
"int tmp = 0;",
"tmp",
"0",
"int cnt = 0;",
"cnt",
"0",
"while(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1;j >= 1;j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\tflag = 0;\n\t\t\tfor(int j = n-1;j >= 1;j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = 0",
"flag",
"0",
"for(int j = n-1;j >= 1;j--){\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j >= 1",
"j",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"if(num[j] < num[j-1]){\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"num[j] < num[j-1]",
"num[j]",
"num",
"j",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"{\n\t\t\t\t\ttmp = num[j];\n\t\t\t\t\tnum[j] = num[j-1];\n\t\t\t\t\tnum[j-1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"tmp = num[j]",
"tmp",
"num[j]",
"num",
"j",
"num[j] = num[j-1]",
"num[j]",
"num",
"j",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"num[j-1] = tmp",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"tmp",
"flag = 1",
"flag",
"1",
"cnt++",
"cnt",
"for(int i = 0;i < n;i++){\n\t\t\tif(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(num[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tif(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(num[i]);\n\t\t}",
"{\n\t\t\tif(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\tSystem.out.print(num[i]);\n\t\t}",
"if(i > 0){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i > 0",
"i",
"0",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(num[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"num[i]",
"num",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args"
] | /* 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
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
int num[] = new int[n];
for(int i = 0;i < n;i++){
num[i] = Integer.parseInt(scanner.next());
}
int flag = 1;
int tmp = 0;
int cnt = 0;
while(flag == 1){
flag = 0;
for(int j = n-1;j >= 1;j--){
if(num[j] < num[j-1]){
tmp = num[j];
num[j] = num[j-1];
num[j-1] = tmp;
flag = 1;
cnt++;
}
}
}
for(int i = 0;i < n;i++){
if(i > 0){
System.out.print(" ");
}
System.out.print(num[i]);
}
System.out.println();
System.out.println(cnt);
}
}
|
[
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,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
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
],
[
150,
5
],
[
150,
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
],
[
57,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
57,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
96,
97
],
[
96,
98
],
[
82,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
82,
104
],
[
104,
105
],
[
8,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
106,
116
],
[
116,
117
],
[
117,
118
],
[
106,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
8,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
8,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
6,
147
],
[
147,
148
],
[
0,
149
],
[
149,
150
],
[
149,
151
]
] | [
"/**\n * ?????§?????????\n * FX????????§????????°?????????????????¨????????????????????¨??§????????????????????????????????¨?????§????????????????????°????????????100???????????? 1000???????????????????????????????????? 1?????? 108???????????£??????????£??????¨???(108??? ?????? 100???) ???? 1000?????? == 8000??????????????????????????¨?????§????????????\n * <p>\n * ???????????¨?????????????????????t?????????????????? Rt(t=0,1,2,,,n???1)?????\\?????¨??????????????????????????§??????????????? Rj???Ri (?????????,j>i??¨??????) ????????§???????±??????????????????????\n * <p>\n * ??\\???\n * ?????????????????´??°n?????????????????????????¶????n????????´??° Rt(t=0,1,2,,,n???1) ?????????????????????????????????\n * <p>\n * ??????\n * ?????§??????????????????????????????????????????\n * <p>\n * ??¶?´?\n * 2???n???200,000\n * 1???Rt???10e9\n */\n\nimport java.util.*;\n\npublic class Main {\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[] numbers = new int[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint sortCounter = 0;\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t}\n\t\tSystem.out.println(numbers[N - 1]);\n\t\tSystem.out.println(sortCounter);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\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[] numbers = new int[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint sortCounter = 0;\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t}\n\t\tSystem.out.println(numbers[N - 1]);\n\t\tSystem.out.println(sortCounter);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint N = stdIn.nextInt();\n\t\tint[] numbers = new int[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint sortCounter = 0;\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t}\n\t\tSystem.out.println(numbers[N - 1]);\n\t\tSystem.out.println(sortCounter);\n\t}",
"main",
"{\n\t\tScanner stdIn = new Scanner(System.in);\n\n\t\tint N = stdIn.nextInt();\n\t\tint[] numbers = new int[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint sortCounter = 0;\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t}\n\t\tSystem.out.println(numbers[N - 1]);\n\t\tSystem.out.println(sortCounter);\n\t}",
"Scanner stdIn = new Scanner(System.in);",
"stdIn",
"new Scanner(System.in)",
"int N = stdIn.nextInt();",
"N",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] numbers = new int[N];",
"numbers",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}",
"{\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}",
"numbers[i] = stdIn.nextInt()",
"numbers[i]",
"numbers",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int sortCounter = 0;",
"sortCounter",
"0",
"for (int i = 0; i < N; i++) {\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\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\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}",
"if (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}",
"numbers[j] < numbers[j - 1]",
"numbers[j]",
"numbers",
"j",
"numbers[j - 1]",
"numbers",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}",
"int tmp = numbers[j - 1];",
"tmp",
"numbers[j - 1]",
"numbers",
"j - 1",
"j",
"1",
"numbers[j - 1] = numbers[j]",
"numbers[j - 1]",
"numbers",
"j - 1",
"j",
"1",
"numbers[j]",
"numbers",
"j",
"numbers[j] = tmp",
"numbers[j]",
"numbers",
"j",
"tmp",
"sortCounter++",
"sortCounter",
"for (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(numbers[i] + \" \");\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\tSystem.out.print(numbers[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t}",
"System.out.print(numbers[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"numbers[i] + \" \"",
"numbers[i]",
"numbers",
"i",
"\" \"",
"System.out.println(numbers[N - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"numbers[N - 1]",
"numbers",
"N - 1",
"N",
"1",
"System.out.println(sortCounter)",
"System.out.println",
"System.out",
"System",
"System.out",
"sortCounter",
"String[] args",
"args",
"public class Main {\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[] numbers = new int[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint sortCounter = 0;\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t}\n\t\tSystem.out.println(numbers[N - 1]);\n\t\tSystem.out.println(sortCounter);\n\t}\n}",
"public class Main {\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[] numbers = new int[N];\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tnumbers[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint sortCounter = 0;\n\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (numbers[j] < numbers[j - 1]) {\n\t\t\t\t\tint tmp = numbers[j - 1];\n\t\t\t\t\tnumbers[j - 1] = numbers[j];\n\t\t\t\t\tnumbers[j] = tmp;\n\t\t\t\t\tsortCounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t}\n\t\tSystem.out.println(numbers[N - 1]);\n\t\tSystem.out.println(sortCounter);\n\t}\n}",
"Main"
] | /**
* ?????§?????????
* FX????????§????????°?????????????????¨????????????????????¨??§????????????????????????????????¨?????§????????????????????°????????????100???????????? 1000???????????????????????????????????? 1?????? 108???????????£??????????£??????¨???(108??? ?????? 100???) ???? 1000?????? == 8000??????????????????????????¨?????§????????????
* <p>
* ???????????¨?????????????????????t?????????????????? Rt(t=0,1,2,,,n???1)?????\?????¨??????????????????????????§??????????????? Rj???Ri (?????????,j>i??¨??????) ????????§???????±??????????????????????
* <p>
* ??\???
* ?????????????????´??°n?????????????????????????¶????n????????´??° Rt(t=0,1,2,,,n???1) ?????????????????????????????????
* <p>
* ??????
* ?????§??????????????????????????????????????????
* <p>
* ??¶?´?
* 2???n???200,000
* 1???Rt???10e9
*/
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int N = stdIn.nextInt();
int[] numbers = new int[N];
for (int i = 0; i < N; i++) {
numbers[i] = stdIn.nextInt();
}
int sortCounter = 0;
for (int i = 0; i < N; i++) {
for (int j = N - 1; j > i; j--) {
if (numbers[j] < numbers[j - 1]) {
int tmp = numbers[j - 1];
numbers[j - 1] = numbers[j];
numbers[j] = tmp;
sortCounter++;
}
}
}
for (int i = 0; i < N - 1; i++) {
System.out.print(numbers[i] + " ");
}
System.out.println(numbers[N - 1]);
System.out.println(sortCounter);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
4,
18,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
0,
13,
17,
40,
13,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
176,
5
],
[
176,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
25,
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
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
49,
51
],
[
49,
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
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
65,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
74,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
81,
86
],
[
8,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
8,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
6,
98
],
[
98,
99
],
[
176,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
102,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
117,
124
],
[
124,
125
],
[
124,
126
],
[
117,
127
],
[
127,
128
],
[
128,
129
],
[
117,
130
],
[
131,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
132,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
142,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
150,
156
],
[
156,
157
],
[
156,
158
],
[
142,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
142,
164
],
[
164,
165
],
[
164,
166
],
[
142,
167
],
[
167,
168
],
[
102,
169
],
[
169,
170
],
[
100,
171
],
[
171,
172
],
[
100,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.util.Scanner;\n\npublic class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int n = Integer.parseInt(cin.next());\n int[] array = new int[n];\n cin.nextLine();\n for (int i = 0; i < n; i++)\n {\n array[i] = cin.nextInt();\n }\n\n int cnt = bubbleSort(array, n);\n for (int i = 0; i < n; i++)\n {\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(cnt);\n }\n\n // Return : count\n public static int bubbleSort(int[] A, int N)\n {\n int cnt = 0;\n\n int flag = 1;\n while (flag == 1)\n {\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }\n return cnt;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int n = Integer.parseInt(cin.next());\n int[] array = new int[n];\n cin.nextLine();\n for (int i = 0; i < n; i++)\n {\n array[i] = cin.nextInt();\n }\n\n int cnt = bubbleSort(array, n);\n for (int i = 0; i < n; i++)\n {\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(cnt);\n }\n\n // Return : count\n public static int bubbleSort(int[] A, int N)\n {\n int cnt = 0;\n\n int flag = 1;\n while (flag == 1)\n {\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }\n return cnt;\n }\n}",
"Main",
"public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int n = Integer.parseInt(cin.next());\n int[] array = new int[n];\n cin.nextLine();\n for (int i = 0; i < n; i++)\n {\n array[i] = cin.nextInt();\n }\n\n int cnt = bubbleSort(array, n);\n for (int i = 0; i < n; i++)\n {\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(cnt);\n }",
"main",
"{\n Scanner cin = new Scanner(System.in);\n int n = Integer.parseInt(cin.next());\n int[] array = new int[n];\n cin.nextLine();\n for (int i = 0; i < n; i++)\n {\n array[i] = cin.nextInt();\n }\n\n int cnt = bubbleSort(array, n);\n for (int i = 0; i < n; i++)\n {\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(cnt);\n }",
"Scanner cin = new Scanner(System.in);",
"cin",
"new Scanner(System.in)",
"int n = Integer.parseInt(cin.next());",
"n",
"Integer.parseInt(cin.next())",
"Integer.parseInt",
"Integer",
"cin.next()",
"cin.next",
"cin",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"cin.nextLine()",
"cin.nextLine",
"cin",
"for (int i = 0; i < n; i++)\n {\n array[i] = cin.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n array[i] = cin.nextInt();\n }",
"{\n array[i] = cin.nextInt();\n }",
"array[i] = cin.nextInt()",
"array[i]",
"array",
"i",
"cin.nextInt()",
"cin.nextInt",
"cin",
"int cnt = bubbleSort(array, n);",
"cnt",
"bubbleSort(array, n)",
"bubbleSort",
"array",
"n",
"for (int i = 0; i < n; i++)\n {\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }",
"{\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }",
"System.out.print(array[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i]",
"array",
"i",
"if (i != n - 1)\n {\n System.out.print(\" \");\n }",
"i != n - 1",
"i",
"n - 1",
"n",
"1",
"{\n System.out.print(\" \");\n }",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"// Return : count\n public static int bubbleSort(int[] A, int N)\n {\n int cnt = 0;\n\n int flag = 1;\n while (flag == 1)\n {\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }\n return cnt;\n }",
"bubbleSort",
"{\n int cnt = 0;\n\n int flag = 1;\n while (flag == 1)\n {\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }\n return cnt;\n }",
"int cnt = 0;",
"cnt",
"0",
"int flag = 1;",
"flag",
"1",
"while (flag == 1)\n {\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }",
"flag == 1",
"flag",
"1",
"{\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }",
"flag = 0",
"flag",
"0",
"for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }",
"{\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }",
"if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }",
"A[j] < A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"{\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }",
"int tmp = A[j - 1];",
"tmp",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j - 1] = A[j]",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j]",
"A",
"j",
"A[j] = tmp",
"A[j]",
"A",
"j",
"tmp",
"flag = 1",
"flag",
"1",
"cnt++",
"cnt",
"return cnt;",
"cnt",
"int[] A",
"A",
"int N",
"N",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int n = Integer.parseInt(cin.next());\n int[] array = new int[n];\n cin.nextLine();\n for (int i = 0; i < n; i++)\n {\n array[i] = cin.nextInt();\n }\n\n int cnt = bubbleSort(array, n);\n for (int i = 0; i < n; i++)\n {\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(cnt);\n }\n\n // Return : count\n public static int bubbleSort(int[] A, int N)\n {\n int cnt = 0;\n\n int flag = 1;\n while (flag == 1)\n {\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }\n return cnt;\n }\n}",
"public class Main\n{\n public static void main(String[] args)\n {\n Scanner cin = new Scanner(System.in);\n int n = Integer.parseInt(cin.next());\n int[] array = new int[n];\n cin.nextLine();\n for (int i = 0; i < n; i++)\n {\n array[i] = cin.nextInt();\n }\n\n int cnt = bubbleSort(array, n);\n for (int i = 0; i < n; i++)\n {\n System.out.print(array[i]);\n if (i != n - 1)\n {\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(cnt);\n }\n\n // Return : count\n public static int bubbleSort(int[] A, int N)\n {\n int cnt = 0;\n\n int flag = 1;\n while (flag == 1)\n {\n flag = 0;\n for (int j = N - 1; j > 0; j--)\n {\n if (A[j] < A[j - 1])\n {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = 1;\n cnt++;\n }\n }\n }\n return cnt;\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner cin = new Scanner(System.in);
int n = Integer.parseInt(cin.next());
int[] array = new int[n];
cin.nextLine();
for (int i = 0; i < n; i++)
{
array[i] = cin.nextInt();
}
int cnt = bubbleSort(array, n);
for (int i = 0; i < n; i++)
{
System.out.print(array[i]);
if (i != n - 1)
{
System.out.print(" ");
}
}
System.out.println();
System.out.println(cnt);
}
// Return : count
public static int bubbleSort(int[] A, int N)
{
int cnt = 0;
int flag = 1;
while (flag == 1)
{
flag = 0;
for (int j = N - 1; j > 0; j--)
{
if (A[j] < A[j - 1])
{
int tmp = A[j - 1];
A[j - 1] = A[j];
A[j] = tmp;
flag = 1;
cnt++;
}
}
}
return cnt;
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
12,
13,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
0,
13,
17,
30,
30,
14,
40,
13,
3,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
2,
13,
17,
13,
1,
0,
13,
17,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
17,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
4,
13,
29,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
4,
18,
13,
13,
41,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
201,
5
],
[
201,
6
],
[
6,
7
],
[
201,
8
],
[
8,
9
],
[
201,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
12,
18
],
[
18,
19
],
[
18,
20
],
[
12,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
22,
27
],
[
27,
28
],
[
27,
29
],
[
22,
30
],
[
30,
31
],
[
31,
32
],
[
22,
33
],
[
34,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
35,
39
],
[
39,
40
],
[
40,
41
],
[
10,
42
],
[
42,
43
],
[
201,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
47,
57
],
[
57,
58
],
[
58,
59
],
[
47,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
46,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
201,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
88,
89
],
[
88,
90
],
[
84,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
91,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
91,
105
],
[
106,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
122,
122
],
[
122,
123
],
[
122,
124
],
[
122,
125
],
[
114,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
114,
130
],
[
131,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
132,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
142,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
142,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
160,
166
],
[
142,
167
],
[
167,
168
],
[
167,
169
],
[
84,
170
],
[
170,
171
],
[
84,
172
],
[
172,
173
],
[
201,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
180,
181
],
[
180,
182
],
[
176,
183
],
[
183,
184
],
[
184,
185
],
[
183,
186
],
[
176,
187
],
[
187,
188
],
[
187,
189
],
[
189,
190
],
[
190,
191
],
[
176,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
192,
197
],
[
174,
198
],
[
198,
199
],
[
0,
200
],
[
200,
201
],
[
200,
202
]
] | [
"import java.util.Scanner;\n\n/**\n * Created by zhangrunfeng on 2019-04-30\n */\npublic class Main {\n\n private int arrayLen;\n private int arr[];\n\n private void init(Scanner sc) {\n arrayLen = sc.nextInt();\n arr = new int[arrayLen];\n for (int idx = 0; idx < arrayLen; idx++) {\n arr[idx] = sc.nextInt();\n }\n }\n\n private void printArray() {\n for (int idx = 0; idx < arrayLen-1; idx++) {\n System.out.print(arr[idx] + \" \");\n }\n System.out.println(arr[arrayLen-1]);\n }\n\n private int bubbleSort() {\n int count = 0;\n\n boolean flag = true;\n for (int iter = 0; iter < arrayLen-1; iter+=1) {\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }\n\n printArray();\n\n return count;\n }\n\n public static void main(String[] args) {\n Main bubbleSort = new Main();\n Scanner sc = new Scanner(System.in);\n bubbleSort.init(sc);\n int res = bubbleSort.bubbleSort();\n System.out.println(res);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n private int arrayLen;\n private int arr[];\n\n private void init(Scanner sc) {\n arrayLen = sc.nextInt();\n arr = new int[arrayLen];\n for (int idx = 0; idx < arrayLen; idx++) {\n arr[idx] = sc.nextInt();\n }\n }\n\n private void printArray() {\n for (int idx = 0; idx < arrayLen-1; idx++) {\n System.out.print(arr[idx] + \" \");\n }\n System.out.println(arr[arrayLen-1]);\n }\n\n private int bubbleSort() {\n int count = 0;\n\n boolean flag = true;\n for (int iter = 0; iter < arrayLen-1; iter+=1) {\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }\n\n printArray();\n\n return count;\n }\n\n public static void main(String[] args) {\n Main bubbleSort = new Main();\n Scanner sc = new Scanner(System.in);\n bubbleSort.init(sc);\n int res = bubbleSort.bubbleSort();\n System.out.println(res);\n }\n}",
"Main",
"private int arrayLen;",
"arrayLen",
"private int arr[];",
"arr",
"private void init(Scanner sc) {\n arrayLen = sc.nextInt();\n arr = new int[arrayLen];\n for (int idx = 0; idx < arrayLen; idx++) {\n arr[idx] = sc.nextInt();\n }\n }",
"init",
"{\n arrayLen = sc.nextInt();\n arr = new int[arrayLen];\n for (int idx = 0; idx < arrayLen; idx++) {\n arr[idx] = sc.nextInt();\n }\n }",
"arrayLen = sc.nextInt()",
"arrayLen",
"sc.nextInt()",
"sc.nextInt",
"sc",
"arr = new int[arrayLen]",
"arr",
"new int[arrayLen]",
"arrayLen",
"for (int idx = 0; idx < arrayLen; idx++) {\n arr[idx] = sc.nextInt();\n }",
"int idx = 0;",
"int idx = 0;",
"idx",
"0",
"idx < arrayLen",
"idx",
"arrayLen",
"idx++",
"idx++",
"idx",
"{\n arr[idx] = sc.nextInt();\n }",
"{\n arr[idx] = sc.nextInt();\n }",
"arr[idx] = sc.nextInt()",
"arr[idx]",
"arr",
"idx",
"sc.nextInt()",
"sc.nextInt",
"sc",
"Scanner sc",
"sc",
"private void printArray() {\n for (int idx = 0; idx < arrayLen-1; idx++) {\n System.out.print(arr[idx] + \" \");\n }\n System.out.println(arr[arrayLen-1]);\n }",
"printArray",
"{\n for (int idx = 0; idx < arrayLen-1; idx++) {\n System.out.print(arr[idx] + \" \");\n }\n System.out.println(arr[arrayLen-1]);\n }",
"for (int idx = 0; idx < arrayLen-1; idx++) {\n System.out.print(arr[idx] + \" \");\n }",
"int idx = 0;",
"int idx = 0;",
"idx",
"0",
"idx < arrayLen-1",
"idx",
"arrayLen-1",
"arrayLen",
"1",
"idx++",
"idx++",
"idx",
"{\n System.out.print(arr[idx] + \" \");\n }",
"{\n System.out.print(arr[idx] + \" \");\n }",
"System.out.print(arr[idx] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"arr[idx] + \" \"",
"arr[idx]",
"arr",
"idx",
"\" \"",
"System.out.println(arr[arrayLen-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"arr[arrayLen-1]",
"arr",
"arrayLen-1",
"arrayLen",
"1",
"private int bubbleSort() {\n int count = 0;\n\n boolean flag = true;\n for (int iter = 0; iter < arrayLen-1; iter+=1) {\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }\n\n printArray();\n\n return count;\n }",
"bubbleSort",
"{\n int count = 0;\n\n boolean flag = true;\n for (int iter = 0; iter < arrayLen-1; iter+=1) {\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }\n\n printArray();\n\n return count;\n }",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"for (int iter = 0; iter < arrayLen-1; iter+=1) {\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }",
"int iter = 0;",
"int iter = 0;",
"iter",
"0",
"iter < arrayLen-1",
"iter",
"arrayLen-1",
"arrayLen",
"1",
"iter+=1",
"iter+=1",
"iter",
"1",
"{\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }",
"{\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }",
"if (!flag) break;",
"!flag",
"flag",
"break;",
"flag = false",
"flag",
"false",
"for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }",
"int idx = 0;",
"int idx = 0;",
"idx",
"0",
"idx < arrayLen-1-iter",
"idx",
"arrayLen-1-iter",
"arrayLen-1-iter",
"arrayLen",
"1",
"iter",
"idx+=1",
"idx+=1",
"idx",
"1",
"{\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }",
"{\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }",
"if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }",
"arr[idx] > arr[idx+1]",
"arr[idx]",
"arr",
"idx",
"arr[idx+1]",
"arr",
"idx+1",
"idx",
"1",
"{\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }",
"count += 1",
"count",
"1",
"int tmp = arr[idx];",
"tmp",
"arr[idx]",
"arr",
"idx",
"arr[idx] = arr[idx+1]",
"arr[idx]",
"arr",
"idx",
"arr[idx+1]",
"arr",
"idx+1",
"idx",
"1",
"arr[idx+1] = tmp",
"arr[idx+1]",
"arr",
"idx+1",
"idx",
"1",
"tmp",
"flag = true",
"flag",
"true",
"printArray()",
"printArray",
"return count;",
"count",
"public static void main(String[] args) {\n Main bubbleSort = new Main();\n Scanner sc = new Scanner(System.in);\n bubbleSort.init(sc);\n int res = bubbleSort.bubbleSort();\n System.out.println(res);\n }",
"main",
"{\n Main bubbleSort = new Main();\n Scanner sc = new Scanner(System.in);\n bubbleSort.init(sc);\n int res = bubbleSort.bubbleSort();\n System.out.println(res);\n }",
"Main bubbleSort = new Main();",
"bubbleSort",
"new Main()",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"bubbleSort.init(sc)",
"bubbleSort.init",
"bubbleSort",
"sc",
"int res = bubbleSort.bubbleSort();",
"res",
"bubbleSort.bubbleSort()",
"bubbleSort.bubbleSort",
"bubbleSort",
"System.out.println(res)",
"System.out.println",
"System.out",
"System",
"System.out",
"res",
"String[] args",
"args",
"public class Main {\n\n private int arrayLen;\n private int arr[];\n\n private void init(Scanner sc) {\n arrayLen = sc.nextInt();\n arr = new int[arrayLen];\n for (int idx = 0; idx < arrayLen; idx++) {\n arr[idx] = sc.nextInt();\n }\n }\n\n private void printArray() {\n for (int idx = 0; idx < arrayLen-1; idx++) {\n System.out.print(arr[idx] + \" \");\n }\n System.out.println(arr[arrayLen-1]);\n }\n\n private int bubbleSort() {\n int count = 0;\n\n boolean flag = true;\n for (int iter = 0; iter < arrayLen-1; iter+=1) {\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }\n\n printArray();\n\n return count;\n }\n\n public static void main(String[] args) {\n Main bubbleSort = new Main();\n Scanner sc = new Scanner(System.in);\n bubbleSort.init(sc);\n int res = bubbleSort.bubbleSort();\n System.out.println(res);\n }\n}",
"public class Main {\n\n private int arrayLen;\n private int arr[];\n\n private void init(Scanner sc) {\n arrayLen = sc.nextInt();\n arr = new int[arrayLen];\n for (int idx = 0; idx < arrayLen; idx++) {\n arr[idx] = sc.nextInt();\n }\n }\n\n private void printArray() {\n for (int idx = 0; idx < arrayLen-1; idx++) {\n System.out.print(arr[idx] + \" \");\n }\n System.out.println(arr[arrayLen-1]);\n }\n\n private int bubbleSort() {\n int count = 0;\n\n boolean flag = true;\n for (int iter = 0; iter < arrayLen-1; iter+=1) {\n if (!flag) break;\n flag = false;\n\n for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {\n if (arr[idx] > arr[idx+1]) {\n count += 1;\n\n // swap arr[idx] and arr[idx+1]\n int tmp = arr[idx];\n arr[idx] = arr[idx+1];\n arr[idx+1] = tmp;\n flag = true;\n }\n }\n\n }\n\n printArray();\n\n return count;\n }\n\n public static void main(String[] args) {\n Main bubbleSort = new Main();\n Scanner sc = new Scanner(System.in);\n bubbleSort.init(sc);\n int res = bubbleSort.bubbleSort();\n System.out.println(res);\n }\n}",
"Main"
] | import java.util.Scanner;
/**
* Created by zhangrunfeng on 2019-04-30
*/
public class Main {
private int arrayLen;
private int arr[];
private void init(Scanner sc) {
arrayLen = sc.nextInt();
arr = new int[arrayLen];
for (int idx = 0; idx < arrayLen; idx++) {
arr[idx] = sc.nextInt();
}
}
private void printArray() {
for (int idx = 0; idx < arrayLen-1; idx++) {
System.out.print(arr[idx] + " ");
}
System.out.println(arr[arrayLen-1]);
}
private int bubbleSort() {
int count = 0;
boolean flag = true;
for (int iter = 0; iter < arrayLen-1; iter+=1) {
if (!flag) break;
flag = false;
for (int idx = 0; idx < arrayLen-1-iter; idx+=1) {
if (arr[idx] > arr[idx+1]) {
count += 1;
// swap arr[idx] and arr[idx+1]
int tmp = arr[idx];
arr[idx] = arr[idx+1];
arr[idx+1] = tmp;
flag = true;
}
}
}
printArray();
return count;
}
public static void main(String[] args) {
Main bubbleSort = new Main();
Scanner sc = new Scanner(System.in);
bubbleSort.init(sc);
int res = bubbleSort.bubbleSort();
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,
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,
17,
2,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
2,
2,
18,
13,
2,
13,
17,
17,
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
],
[
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
],
[
59,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
59,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
74,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
84,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
99,
105
],
[
84,
106
],
[
106,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
108,
118
],
[
118,
119
],
[
119,
120
],
[
108,
121
],
[
122,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
8,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
139,
146
],
[
6,
147
],
[
147,
148
]
] | [
"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 int a[] = new int[n];\n int num = 0;\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n\tfor(int i = 1; i < n+1; i++){\n \tfor(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}\n\t}\n for(int i = 0; i < n-1; i++){\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[n-1] + \"\\n\" + num);\n }\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 int a[] = new int[n];\n int num = 0;\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n\tfor(int i = 1; i < n+1; i++){\n \tfor(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}\n\t}\n for(int i = 0; i < n-1; i++){\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[n-1] + \"\\n\" + num);\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 int num = 0;\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n\tfor(int i = 1; i < n+1; i++){\n \tfor(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}\n\t}\n for(int i = 0; i < n-1; i++){\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[n-1] + \"\\n\" + num);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int a[] = new int[n];\n int num = 0;\n for(int i = 0; i < n; i++){\n a[i] = sc.nextInt();\n }\n\tfor(int i = 1; i < n+1; i++){\n \tfor(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}\n\t}\n for(int i = 0; i < n-1; i++){\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[n-1] + \"\\n\" + num);\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",
"int num = 0;",
"num",
"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 = 1; i < n+1; i++){\n \tfor(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}\n\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n+1",
"i",
"n+1",
"n",
"1",
"i++",
"i++",
"i",
"{\n \tfor(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}\n\t}",
"{\n \tfor(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}\n\t}",
"for(int j = 0; j < n-i; j++){\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n-i",
"j",
"n-i",
"n",
"i",
"j++",
"j++",
"j",
"{\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}",
"{\n \t\tif(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}\n \t}",
"if(a[j] > a[j+1]){\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}",
"a[j] > a[j+1]",
"a[j]",
"a",
"j",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"{\n \t\tint work = a[j];\n \t\ta[j] = a[j+1];\n \t\ta[j+1] = work;\n \t\t\tnum++;\n \t\t}",
"int work = a[j];",
"work",
"a[j]",
"a",
"j",
"a[j] = a[j+1]",
"a[j]",
"a",
"j",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"a[j+1] = work",
"a[j+1]",
"a",
"j+1",
"j",
"1",
"work",
"num++",
"num",
"for(int i = 0; i < n-1; i++){\n System.out.print(a[i] + \" \");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(a[i] + \" \");\n }",
"{\n System.out.print(a[i] + \" \");\n }",
"System.out.print(a[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i] + \" \"",
"a[i]",
"a",
"i",
"\" \"",
"System.out.println(a[n-1] + \"\\n\" + num)",
"System.out.println",
"System.out",
"System",
"System.out",
"a[n-1] + \"\\n\" + num",
"a[n-1] + \"\\n\" + num",
"a[n-1]",
"a",
"n-1",
"n",
"1",
"\"\\n\"",
"num",
"String args[]",
"args"
] | import java.util.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
int num = 0;
for(int i = 0; i < n; i++){
a[i] = sc.nextInt();
}
for(int i = 1; i < n+1; i++){
for(int j = 0; j < n-i; j++){
if(a[j] > a[j+1]){
int work = a[j];
a[j] = a[j+1];
a[j+1] = work;
num++;
}
}
}
for(int i = 0; i < n-1; i++){
System.out.print(a[i] + " ");
}
System.out.println(a[n-1] + "\n" + num);
}
}
|
[
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,
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
4,
18,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
2,
17,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
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
],
[
17,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
26,
29
],
[
29,
30
],
[
30,
31
],
[
17,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
34,
39
],
[
17,
40
],
[
40,
41
],
[
40,
42
],
[
17,
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
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
64,
66
],
[
17,
67
],
[
67,
68
],
[
67,
69
],
[
17,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
75,
76
],
[
75,
77
],
[
70,
78
],
[
78,
79
],
[
79,
80
],
[
70,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
83,
90
],
[
90,
91
],
[
90,
92
],
[
83,
93
],
[
93,
94
],
[
94,
95
],
[
83,
96
],
[
97,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
98,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
108,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
108,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
123,
129
],
[
108,
130
],
[
130,
131
],
[
17,
132
],
[
132,
133
],
[
133,
134
],
[
132,
135
],
[
135,
136
],
[
135,
137
],
[
17,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
138,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
17,
158
],
[
158,
159
],
[
159,
160
],
[
17,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
17,
165
],
[
165,
166
],
[
166,
167
],
[
15,
168
],
[
168,
169
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n\nclass Main{\n public static void main(String[] args) throws IOException{\n final PrintWriter out = new PrintWriter(System.out);\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] a = new int[n];\n for(int i = 0; i<n; i++){\n a[i] = Integer.parseInt(in[i]);\n }\n int num = 0;\n for(int i = 0; i<n; i++){\n for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }\n }\n out.print(a[0]);\n for(int i = 1; i<n; i++)\n out.print(\" \"+a[i]);\n out.println();\n out.println(num);\n out.flush();\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",
"class Main{\n public static void main(String[] args) throws IOException{\n final PrintWriter out = new PrintWriter(System.out);\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] a = new int[n];\n for(int i = 0; i<n; i++){\n a[i] = Integer.parseInt(in[i]);\n }\n int num = 0;\n for(int i = 0; i<n; i++){\n for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }\n }\n out.print(a[0]);\n for(int i = 1; i<n; i++)\n out.print(\" \"+a[i]);\n out.println();\n out.println(num);\n out.flush();\n }\n}",
"Main",
"public static void main(String[] args) throws IOException{\n final PrintWriter out = new PrintWriter(System.out);\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] a = new int[n];\n for(int i = 0; i<n; i++){\n a[i] = Integer.parseInt(in[i]);\n }\n int num = 0;\n for(int i = 0; i<n; i++){\n for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }\n }\n out.print(a[0]);\n for(int i = 1; i<n; i++)\n out.print(\" \"+a[i]);\n out.println();\n out.println(num);\n out.flush();\n }",
"main",
"{\n final PrintWriter out = new PrintWriter(System.out);\n final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n final int n = Integer.parseInt(br.readLine());\n final String[] in = br.readLine().split(\" \");\n final int[] a = new int[n];\n for(int i = 0; i<n; i++){\n a[i] = Integer.parseInt(in[i]);\n }\n int num = 0;\n for(int i = 0; i<n; i++){\n for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }\n }\n out.print(a[0]);\n for(int i = 1; i<n; i++)\n out.print(\" \"+a[i]);\n out.println();\n out.println(num);\n out.flush();\n }",
"final PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"final int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"final String[] in = br.readLine().split(\" \");",
"in",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"final int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for(int i = 0; i<n; i++){\n a[i] = Integer.parseInt(in[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = Integer.parseInt(in[i]);\n }",
"{\n a[i] = Integer.parseInt(in[i]);\n }",
"a[i] = Integer.parseInt(in[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(in[i])",
"Integer.parseInt",
"Integer",
"in[i]",
"in",
"i",
"int num = 0;",
"num",
"0",
"for(int i = 0; i<n; i++){\n for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }\n }",
"{\n for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }\n }",
"for(int j = n-1; j>i; j--){\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }",
"{\n if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }\n }",
"if(a[j]<a[j-1]){\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }",
"a[j]<a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"{\n final int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n num++;\n }",
"final int t = a[j];",
"t",
"a[j]",
"a",
"j",
"a[j] = a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1] = t",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"t",
"num++",
"num",
"out.print(a[0])",
"out.print",
"out",
"a[0]",
"a",
"0",
"for(int i = 1; i<n; i++)\n out.print(\" \"+a[i]);",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"out.print(\" \"+a[i]);",
"out.print(\" \"+a[i])",
"out.print",
"out",
"\" \"+a[i]",
"\" \"",
"a[i]",
"a",
"i",
"out.println()",
"out.println",
"out",
"out.println(num)",
"out.println",
"out",
"num",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
class Main{
public static void main(String[] args) throws IOException{
final PrintWriter out = new PrintWriter(System.out);
final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final int n = Integer.parseInt(br.readLine());
final String[] in = br.readLine().split(" ");
final int[] a = new int[n];
for(int i = 0; i<n; i++){
a[i] = Integer.parseInt(in[i]);
}
int num = 0;
for(int i = 0; i<n; i++){
for(int j = n-1; j>i; j--){
if(a[j]<a[j-1]){
final int t = a[j];
a[j] = a[j-1];
a[j-1] = t;
num++;
}
}
}
out.print(a[0]);
for(int i = 1; i<n; i++)
out.print(" "+a[i]);
out.println();
out.println(num);
out.flush();
}
} |
[
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,
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,
4,
13,
13,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
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
],
[
202,
11
],
[
202,
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,
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
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
63,
66
],
[
14,
67
],
[
67,
68
],
[
67,
69
],
[
14,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
70,
75
],
[
12,
76
],
[
76,
77
],
[
202,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
80,
84
],
[
84,
85
],
[
84,
86
],
[
80,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
95,
102
],
[
102,
103
],
[
102,
104
],
[
95,
105
],
[
105,
106
],
[
106,
107
],
[
95,
108
],
[
109,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
110,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
120,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
120,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
135,
141
],
[
120,
142
],
[
142,
143
],
[
142,
144
],
[
120,
145
],
[
145,
146
],
[
80,
147
],
[
147,
148
],
[
78,
149
],
[
149,
150
],
[
78,
151
],
[
151,
152
],
[
202,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
156,
166
],
[
166,
167
],
[
167,
168
],
[
156,
169
],
[
170,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
176,
177
],
[
176,
178
],
[
170,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
179,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
188,
193
],
[
155,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
153,
199
],
[
199,
200
],
[
0,
201
],
[
201,
202
],
[
201,
203
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tint[] array = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint count = bubbleSor(array, n);\n\t\t\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\t\t\n\t}\n\t\n\tstatic int bubbleSor(int[] array, int n){\n\t\tint flag = 1;\n\t\tint count = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count;\n\t}\n\t\n\tstatic void printArray(int[] array){\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\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",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tint[] array = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint count = bubbleSor(array, n);\n\t\t\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\t\t\n\t}\n\t\n\tstatic int bubbleSor(int[] array, int n){\n\t\tint flag = 1;\n\t\tint count = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count;\n\t}\n\t\n\tstatic void printArray(int[] array){\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tint[] array = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint count = bubbleSor(array, n);\n\t\t\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\t\t\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tint[] array = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint count = bubbleSor(array, n);\n\t\t\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\t\t\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[] strArray = br.readLine().split(\" \");",
"strArray",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"{\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}",
"array[i] = Integer.parseInt(strArray[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(strArray[i])",
"Integer.parseInt",
"Integer",
"strArray[i]",
"strArray",
"i",
"int count = bubbleSor(array, n);",
"count",
"bubbleSor(array, n)",
"bubbleSor",
"array",
"n",
"printArray(array)",
"printArray",
"array",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static int bubbleSor(int[] array, int n){\n\t\tint flag = 1;\n\t\tint count = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count;\n\t}",
"bubbleSor",
"{\n\t\tint flag = 1;\n\t\tint count = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count;\n\t}",
"int flag = 1;",
"flag",
"1",
"int count = 0;",
"count",
"0",
"while(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = 0",
"flag",
"0",
"for(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j >= 1",
"j",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"array[j] < array[j - 1]",
"array[j]",
"array",
"j",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp = array[j];",
"tmp",
"array[j]",
"array",
"j",
"array[j] = array[j - 1]",
"array[j]",
"array",
"j",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"array[j - 1] = tmp",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"tmp",
"flag = 1",
"flag",
"1",
"count++",
"count",
"return count;",
"count",
"int[] array",
"array",
"int n",
"n",
"static void printArray(int[] array){\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}",
"printArray",
"{\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}",
"for(int i = 0; i < array.length ;i++){\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"System.out.print(array[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i]",
"array",
"i",
"if(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i != array.length - 1",
"i",
"array.length - 1",
"array.length",
"array",
"array.length",
"1",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int[] array",
"array",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tint[] array = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint count = bubbleSor(array, n);\n\t\t\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\t\t\n\t}\n\t\n\tstatic int bubbleSor(int[] array, int n){\n\t\tint flag = 1;\n\t\tint count = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count;\n\t}\n\t\n\tstatic void printArray(int[] array){\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t\n\t\tString[] strArray = br.readLine().split(\" \");\n\t\tint[] array = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tarray[i] = Integer.parseInt(strArray[i]);\n\t\t}\n\t\t\n\t\tint count = bubbleSor(array, n);\n\t\t\n\t\tprintArray(array);\n\t\tSystem.out.println(count);\n\t\t\n\t}\n\t\n\tstatic int bubbleSor(int[] array, int n){\n\t\tint flag = 1;\n\t\tint count = 0;\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int j = n - 1; j >= 1; j--){\n\t\t\t\tif(array[j] < array[j - 1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j - 1];\n\t\t\t\t\tarray[j - 1] = tmp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn count;\n\t}\n\t\n\tstatic void printArray(int[] array){\n\t\tfor(int i = 0; i < array.length ;i++){\n\t\t\tSystem.out.print(array[i]);\n\t\t\tif(i != array.length - 1){\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}\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 NumberFormatException, IOException {
// TODO ?????????????????????????????????????????????
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] strArray = br.readLine().split(" ");
int[] array = new int[n];
for(int i = 0; i < n; i++){
array[i] = Integer.parseInt(strArray[i]);
}
int count = bubbleSor(array, n);
printArray(array);
System.out.println(count);
}
static int bubbleSor(int[] array, int n){
int flag = 1;
int count = 0;
while(flag == 1){
flag = 0;
for(int j = n - 1; j >= 1; j--){
if(array[j] < array[j - 1]){
int tmp = array[j];
array[j] = array[j - 1];
array[j - 1] = tmp;
flag = 1;
count++;
}
}
}
return count;
}
static void printArray(int[] array){
for(int i = 0; i < array.length ;i++){
System.out.print(array[i]);
if(i != array.length - 1){
System.out.print(" ");
}
}
System.out.println();
}
} |
[
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,
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,
17,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
40,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
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
],
[
177,
11
],
[
177,
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,
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
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
14,
61
],
[
61,
62
],
[
61,
63
],
[
14,
64
],
[
64,
65
],
[
64,
66
],
[
14,
67
],
[
67,
68
],
[
67,
69
],
[
14,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
76,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
76,
88
],
[
88,
89
],
[
89,
90
],
[
76,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
103,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
120,
126
],
[
103,
127
],
[
127,
128
],
[
127,
129
],
[
72,
130
],
[
130,
131
],
[
14,
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
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
144,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
160,
161
],
[
160,
162
],
[
14,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
14,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
168,
173
],
[
12,
174
],
[
174,
175
],
[
0,
176
],
[
176,
177
],
[
176,
178
]
] | [
"\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\tpublic static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in));\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] s = reader.readLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\tint sum = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(sum);\n\n\t}\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\tpublic static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in));\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] s = reader.readLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\tint sum = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(sum);\n\n\t}\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in));\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] s = reader.readLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\tint sum = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(sum);\n\n\t}",
"main",
"{\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in));\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] s = reader.readLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\tint sum = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(sum);\n\n\t}",
"BufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in));",
"reader",
"new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in))",
"int n = Integer.parseInt(reader.readLine());",
"n",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"String[] s = reader.readLine().split(\" \");",
"s",
"reader.readLine().split(\" \")",
"reader.readLine().split",
"reader.readLine()",
"reader.readLine",
"reader",
"\" \"",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}",
"{\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}",
"a[i] = Integer.parseInt(s[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(s[i])",
"Integer.parseInt",
"Integer",
"s[i]",
"s",
"i",
"boolean flag = true;",
"flag",
"true",
"int i = 0;",
"i",
"0",
"int sum = 0;",
"sum",
"0",
"while (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"flag = false",
"flag",
"false",
"for (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j >= i + 1",
"j",
"i + 1",
"i",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"a[j] < a[j - 1]",
"a[j]",
"a",
"j",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"sum++",
"sum",
"int temp = a[j];",
"temp",
"a[j]",
"a",
"j",
"a[j] = a[j - 1]",
"a[j]",
"a",
"j",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"a[j - 1] = temp",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"temp",
"flag = true",
"flag",
"true",
"i++",
"i",
"for (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}",
"int k = 0;",
"int k = 0;",
"k",
"0",
"k < n",
"k",
"n",
"k++",
"k++",
"k",
"{\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}",
"{\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}",
"if (k > 0)\n\t\t\t\tSystem.out.print(\" \");",
"k > 0",
"k",
"0",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(a[k])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[k]",
"a",
"k",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"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 NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in));\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] s = reader.readLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\tint sum = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(sum);\n\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws NumberFormatException,\n\t\t\tIOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(\n\t\t\t\tSystem.in));\n\t\tint n = Integer.parseInt(reader.readLine());\n\t\tString[] s = reader.readLine().split(\" \");\n\t\tint[] a = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = Integer.parseInt(s[i]);\n\t\t}\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\tint sum = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n - 1; j >= i + 1; j--) {\n\t\t\t\tif (a[j] < a[j - 1]) {\n\t\t\t\t\tsum++;\n\t\t\t\t\tint temp = a[j];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tSystem.out.print(\" \");\n\t\t\tSystem.out.print(a[k]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(sum);\n\n\t}\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws NumberFormatException,
IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
int n = Integer.parseInt(reader.readLine());
String[] s = reader.readLine().split(" ");
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = Integer.parseInt(s[i]);
}
boolean flag = true;
int i = 0;
int sum = 0;
while (flag) {
flag = false;
for (int j = n - 1; j >= i + 1; j--) {
if (a[j] < a[j - 1]) {
sum++;
int temp = a[j];
a[j] = a[j - 1];
a[j - 1] = temp;
flag = true;
}
}
i++;
}
for (int k = 0; k < n; k++) {
if (k > 0)
System.out.print(" ");
System.out.print(a[k]);
}
System.out.println();
System.out.println(sum);
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
42,
4,
18,
13,
30,
0,
13,
4,
18,
13,
0,
13,
20,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
4,
18,
18,
13,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
13,
12,
13,
30,
20,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
163,
5
],
[
163,
6
],
[
6,
7
],
[
163,
8
],
[
8,
9
],
[
163,
10
],
[
10,
11
],
[
163,
12
],
[
12,
13
],
[
163,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
24,
30
],
[
30,
31
],
[
30,
32
],
[
24,
34
],
[
34,
35
],
[
34,
36
],
[
24,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
37,
42
],
[
42,
43
],
[
42,
44
],
[
37,
45
],
[
45,
46
],
[
46,
47
],
[
37,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
24,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
56,
61
],
[
61,
62
],
[
61,
63
],
[
56,
64
],
[
64,
65
],
[
65,
66
],
[
56,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
68,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
68,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
92,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
92,
114
],
[
114,
115
],
[
24,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
116,
126
],
[
126,
127
],
[
127,
128
],
[
116,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
130,
136
],
[
136,
137
],
[
136,
138
],
[
24,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
24,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
149,
155
],
[
163,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
156,
160
],
[
160,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
] | [
"import java.util.*;\n\npublic class Main{\n private int n, cnt, tmp;\n private int[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\n\twhile(sc.hasNext()){\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n private int n, cnt, tmp;\n private int[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\n\twhile(sc.hasNext()){\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"Main",
"private int n",
"n",
"cnt",
"cnt",
"tmp;",
"tmp",
"private int[] a;",
"a",
"Main(){\n\tScanner sc = new Scanner(System.in);\n\n\twhile(sc.hasNext()){\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }",
"Main",
"{\n\tScanner sc = new Scanner(System.in);\n\n\twhile(sc.hasNext()){\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"while(sc.hasNext()){\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}",
"sc.hasNext()",
"sc.hasNext",
"sc",
"{\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"a = new int[n]",
"a",
"new int[n]",
"n",
"cnt = 0",
"cnt",
"0",
"for(int i = 0; i < n; ++i)\n\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",
"for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"for(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }",
"for(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j > i",
"j",
"i",
"--j",
"--j",
"j",
"if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }",
"if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }",
"a[j] < a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"{\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }",
"tmp = a[j]",
"tmp",
"a[j]",
"a",
"j",
"a[j] = a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1] = tmp",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"tmp",
"++cnt",
"cnt",
"for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n-1",
"i",
"n-1",
"n",
"1",
"++i",
"++i",
"i",
"System.out.printf(\"%d \", a[i]);",
"System.out.printf(\"%d \", a[i])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d \"",
"a[i]",
"a",
"i",
"System.out.println(a[n-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[n-1]",
"a",
"n-1",
"n",
"1",
"System.out.printf(\"%d\\n\", cnt)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\\n\"",
"cnt",
"public static void main(String[] args){\n\tnew Main();\n }",
"main",
"{\n\tnew Main();\n }",
"new Main()",
"String[] args",
"args",
"public class Main{\n private int n, cnt, tmp;\n private int[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\n\twhile(sc.hasNext()){\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"public class Main{\n private int n, cnt, tmp;\n private int[] a;\n\n Main(){\n\tScanner sc = new Scanner(System.in);\n\n\twhile(sc.hasNext()){\n\t n = sc.nextInt();\n\n\t a = new int[n];\n\t cnt = 0;\n\t for(int i = 0; i < n; ++i)\n\t\ta[i] = sc.nextInt();\n\n\t for(int i = 0; i < n; ++i)\n\t\tfor(int j = n-1; j > i; --j)\n\t\t if(a[j] < a[j-1]){\n\t\t\ttmp = a[j];\n\t\t\ta[j] = a[j-1];\n\t\t\ta[j-1] = tmp;\n\t\t\t++cnt;\n\t\t }\n\n\t for(int i = 0; i < n-1; ++i)\n\t\tSystem.out.printf(\"%d \", a[i]);\n\t System.out.println(a[n-1]);\n\t System.out.printf(\"%d\\n\", cnt);\n\t}\n }\n\n public static void main(String[] args){\n\tnew Main();\n }\n}",
"Main"
] | import java.util.*;
public class Main{
private int n, cnt, tmp;
private int[] a;
Main(){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
n = sc.nextInt();
a = new int[n];
cnt = 0;
for(int i = 0; i < n; ++i)
a[i] = sc.nextInt();
for(int i = 0; i < n; ++i)
for(int j = n-1; j > i; --j)
if(a[j] < a[j-1]){
tmp = a[j];
a[j] = a[j-1];
a[j-1] = tmp;
++cnt;
}
for(int i = 0; i < n-1; ++i)
System.out.printf("%d ", a[i]);
System.out.println(a[n-1]);
System.out.printf("%d\n", cnt);
}
}
public static void main(String[] args){
new Main();
}
} |
[
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,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
0,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
155,
5
],
[
155,
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
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
55,
62
],
[
62,
63
],
[
62,
64
],
[
55,
65
],
[
65,
66
],
[
66,
67
],
[
55,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
77,
78
],
[
77,
79
],
[
70,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
88,
94
],
[
94,
95
],
[
94,
96
],
[
80,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
80,
102
],
[
102,
103
],
[
102,
104
],
[
80,
105
],
[
105,
106
],
[
8,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
107,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
116,
117
],
[
107,
118
],
[
119,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
120,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
120,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
8,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
6,
152
],
[
152,
153
],
[
0,
154
],
[
154,
155
],
[
154,
156
]
] | [
"import java.util.*;\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 boolean sort = true;\n int v;\n int count = 0;\n while(sort) {\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++) {\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[i] + \" \");\n }\n }\n System.out.println(count);\n }\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 int[] a = new int[n];\n for(int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n boolean sort = true;\n int v;\n int count = 0;\n while(sort) {\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++) {\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[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 n = sc.nextInt();\n int[] a = new int[n];\n for(int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n boolean sort = true;\n int v;\n int count = 0;\n while(sort) {\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++) {\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[i] + \" \");\n }\n }\n System.out.println(count);\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 boolean sort = true;\n int v;\n int count = 0;\n while(sort) {\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++) {\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[i] + \" \");\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",
"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",
"boolean sort = true;",
"sort",
"true",
"int v;",
"v",
"int count = 0;",
"count",
"0",
"while(sort) {\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }",
"sort",
"{\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }",
"sort = false",
"sort",
"false",
"for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }",
"int i = n - 1;",
"int i = n - 1;",
"i",
"n - 1",
"n",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }",
"{\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }",
"if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }",
"a[i - 1] > a[i]",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"{\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }",
"v = a[i - 1]",
"v",
"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",
"a[i] = v",
"a[i]",
"a",
"i",
"v",
"sort = true",
"sort",
"true",
"count++",
"count",
"for(int i = 0; i < n; i++) {\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[i] + \" \");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[i] + \" \");\n }\n }",
"{\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[i] + \" \");\n }\n }",
"if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[i] + \" \");\n }",
"i == n - 1",
"i",
"n - 1",
"n",
"1",
"{\n System.out.println(a[i]);\n }",
"System.out.println(a[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"{\n System.out.print(a[i] + \" \");\n }",
"System.out.print(a[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i] + \" \"",
"a[i]",
"a",
"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 n = sc.nextInt();\n int[] a = new int[n];\n for(int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n boolean sort = true;\n int v;\n int count = 0;\n while(sort) {\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++) {\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[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 n = sc.nextInt();\n int[] a = new int[n];\n for(int i = 0; i < n; i++) {\n a[i] = sc.nextInt();\n }\n boolean sort = true;\n int v;\n int count = 0;\n while(sort) {\n sort = false;\n for(int i = n - 1; i > 0; i--) {\n if(a[i - 1] > a[i]) {\n v = a[i - 1];\n a[i - 1] = a[i];\n a[i] = v;\n sort = true;\n count++;\n }\n }\n }\n for(int i = 0; i < n; i++) {\n if(i == n - 1) {\n System.out.println(a[i]);\n } else {\n System.out.print(a[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 n = sc.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
boolean sort = true;
int v;
int count = 0;
while(sort) {
sort = false;
for(int i = n - 1; i > 0; i--) {
if(a[i - 1] > a[i]) {
v = a[i - 1];
a[i - 1] = a[i];
a[i] = v;
sort = true;
count++;
}
}
}
for(int i = 0; i < n; i++) {
if(i == n - 1) {
System.out.println(a[i]);
} else {
System.out.print(a[i] + " ");
}
}
System.out.println(count);
}
}
|
[
7,
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,
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,
13,
2,
13,
17,
1,
40,
13,
30,
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,
40,
13,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
2,
17,
18,
13,
13,
4,
18,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
165,
20
],
[
165,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
23,
35
],
[
35,
36
],
[
35,
37
],
[
23,
39
],
[
39,
40
],
[
39,
41
],
[
23,
42
],
[
42,
43
],
[
42,
44
],
[
23,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
50,
51
],
[
50,
52
],
[
45,
53
],
[
53,
54
],
[
54,
55
],
[
45,
56
],
[
56,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
61,
64
],
[
64,
65
],
[
65,
66
],
[
23,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
76,
77
],
[
67,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
100,
101
],
[
100,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
119,
120
],
[
119,
121
],
[
103,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
23,
127
],
[
127,
128
],
[
127,
129
],
[
23,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
135,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
130,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
23,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
23,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
21,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
]
] | [
"import java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.util.StringTokenizer;\nimport java.io.InputStreamReader;\n\npublic class Main{\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t//BufferedReader br = new BufferedReader(new FileReader(\"sample.txt\"));\n\t\tint n=Integer.parseInt(br.readLine());\n\t\tint[] in=new int[n];\n\t\tint count=0;\nStringTokenizer st=new StringTokenizer(br.readLine());\n\t\tfor(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());\n\t\t\n\t\tfor(int i=n;i>0;i--){\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nStringBuilder stb=new StringBuilder(Integer.toString(in[0]));\nfor(int i=1;i<n;i++)stb.append(\" \"+in[i]);\nSystem.out.println(stb);\n\t\tSystem.out.println(count);\n\n\n\n\n\t}\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.FileNotFoundException;",
"FileNotFoundException",
"java.io",
"import java.io.FileReader;",
"FileReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main{\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t//BufferedReader br = new BufferedReader(new FileReader(\"sample.txt\"));\n\t\tint n=Integer.parseInt(br.readLine());\n\t\tint[] in=new int[n];\n\t\tint count=0;\nStringTokenizer st=new StringTokenizer(br.readLine());\n\t\tfor(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());\n\t\t\n\t\tfor(int i=n;i>0;i--){\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nStringBuilder stb=new StringBuilder(Integer.toString(in[0]));\nfor(int i=1;i<n;i++)stb.append(\" \"+in[i]);\nSystem.out.println(stb);\n\t\tSystem.out.println(count);\n\n\n\n\n\t}\n\n}",
"Main",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t//BufferedReader br = new BufferedReader(new FileReader(\"sample.txt\"));\n\t\tint n=Integer.parseInt(br.readLine());\n\t\tint[] in=new int[n];\n\t\tint count=0;\nStringTokenizer st=new StringTokenizer(br.readLine());\n\t\tfor(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());\n\t\t\n\t\tfor(int i=n;i>0;i--){\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nStringBuilder stb=new StringBuilder(Integer.toString(in[0]));\nfor(int i=1;i<n;i++)stb.append(\" \"+in[i]);\nSystem.out.println(stb);\n\t\tSystem.out.println(count);\n\n\n\n\n\t}",
"main",
"{\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t//BufferedReader br = new BufferedReader(new FileReader(\"sample.txt\"));\n\t\tint n=Integer.parseInt(br.readLine());\n\t\tint[] in=new int[n];\n\t\tint count=0;\nStringTokenizer st=new StringTokenizer(br.readLine());\n\t\tfor(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());\n\t\t\n\t\tfor(int i=n;i>0;i--){\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nStringBuilder stb=new StringBuilder(Integer.toString(in[0]));\nfor(int i=1;i<n;i++)stb.append(\" \"+in[i]);\nSystem.out.println(stb);\n\t\tSystem.out.println(count);\n\n\n\n\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",
"int[] in=new int[n];",
"in",
"new int[n]",
"n",
"int count=0;",
"count",
"0",
"StringTokenizer st=new StringTokenizer(br.readLine());",
"st",
"new StringTokenizer(br.readLine())",
"for(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"in[i]=Integer.parseInt(st.nextToken());",
"in[i]=Integer.parseInt(st.nextToken())",
"in[i]",
"in",
"i",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"for(int i=n;i>0;i--){\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=n;",
"int i=n;",
"i",
"n",
"i>0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}",
"int j=1;",
"int j=1;",
"j",
"1",
"j<i",
"j",
"i",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}",
"if(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}",
"in[j-1]>in[j]",
"in[j-1]",
"in",
"j-1",
"j",
"1",
"in[j]",
"in",
"j",
"{count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}",
"count++",
"count",
"int tmp=in[j-1];",
"tmp",
"in[j-1]",
"in",
"j-1",
"j",
"1",
"in[j-1]=in[j]",
"in[j-1]",
"in",
"j-1",
"j",
"1",
"in[j]",
"in",
"j",
"in[j]=tmp",
"in[j]",
"in",
"j",
"tmp",
"StringBuilder stb=new StringBuilder(Integer.toString(in[0]));",
"stb",
"new StringBuilder(Integer.toString(in[0]))",
"for(int i=1;i<n;i++)stb.append(\" \"+in[i]);",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"stb.append(\" \"+in[i]);",
"stb.append(\" \"+in[i])",
"stb.append",
"stb",
"\" \"+in[i]",
"\" \"",
"in[i]",
"in",
"i",
"System.out.println(stb)",
"System.out.println",
"System.out",
"System",
"System.out",
"stb",
"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) throws NumberFormatException, IOException {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t//BufferedReader br = new BufferedReader(new FileReader(\"sample.txt\"));\n\t\tint n=Integer.parseInt(br.readLine());\n\t\tint[] in=new int[n];\n\t\tint count=0;\nStringTokenizer st=new StringTokenizer(br.readLine());\n\t\tfor(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());\n\t\t\n\t\tfor(int i=n;i>0;i--){\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nStringBuilder stb=new StringBuilder(Integer.toString(in[0]));\nfor(int i=1;i<n;i++)stb.append(\" \"+in[i]);\nSystem.out.println(stb);\n\t\tSystem.out.println(count);\n\n\n\n\n\t}\n\n}",
"public class Main{\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t//BufferedReader br = new BufferedReader(new FileReader(\"sample.txt\"));\n\t\tint n=Integer.parseInt(br.readLine());\n\t\tint[] in=new int[n];\n\t\tint count=0;\nStringTokenizer st=new StringTokenizer(br.readLine());\n\t\tfor(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());\n\t\t\n\t\tfor(int i=n;i>0;i--){\n\t\t\tfor(int j=1;j<i;j++){\n\t\t\t\tif(in[j-1]>in[j]){count++;\n\t\t\t\t\tint tmp=in[j-1];\n\t\t\t\t\tin[j-1]=in[j];\n\t\t\t\t\tin[j]=tmp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\nStringBuilder stb=new StringBuilder(Integer.toString(in[0]));\nfor(int i=1;i<n;i++)stb.append(\" \"+in[i]);\nSystem.out.println(stb);\n\t\tSystem.out.println(count);\n\n\n\n\n\t}\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader br = new BufferedReader(new FileReader("sample.txt"));
int n=Integer.parseInt(br.readLine());
int[] in=new int[n];
int count=0;
StringTokenizer st=new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) in[i]=Integer.parseInt(st.nextToken());
for(int i=n;i>0;i--){
for(int j=1;j<i;j++){
if(in[j-1]>in[j]){count++;
int tmp=in[j-1];
in[j-1]=in[j];
in[j]=tmp;
}
}
}
StringBuilder stb=new StringBuilder(Integer.toString(in[0]));
for(int i=1;i<n;i++)stb.append(" "+in[i]);
System.out.println(stb);
System.out.println(count);
}
} |
[
7,
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,
18,
13,
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,
18,
13,
13,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
13,
17,
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
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
22,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
30,
32
],
[
8,
33
],
[
33,
34
],
[
33,
35
],
[
8,
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
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
57,
59
],
[
8,
60
],
[
60,
61
],
[
60,
62
],
[
8,
63
],
[
63,
64
],
[
8,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
65,
73
],
[
73,
74
],
[
74,
75
],
[
65,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
78,
85
],
[
85,
86
],
[
85,
87
],
[
78,
88
],
[
88,
89
],
[
89,
90
],
[
78,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
103,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
118,
124
],
[
103,
125
],
[
125,
126
],
[
125,
127
],
[
8,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
128,
139
],
[
140,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
146,
147
],
[
145,
148
],
[
148,
149
],
[
148,
150
],
[
8,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
156,
160
],
[
8,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
6,
167
],
[
167,
168
]
] | [
"import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n\n int n = Integer.parseInt(scan.nextLine());\n String[] strArr = scan.nextLine().split(\" \");\n int arrLen = strArr.length;\n int[] intArr = new int[arrLen];\n\n for (int i=0; i<arrLen; i++){\n intArr[i] = Integer.parseInt(strArr[i]);\n }\n\n int swapNum = 0;\n int tmp;\n\n for (int i=0; i<arrLen; i++){\n for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }\n }\n\n for (int i=0; i<arrLen; i++){\n strArr[i] = String.valueOf(intArr[i]);\n }\n\n System.out.println(String.join(\" \", strArr));\n System.out.println(swapNum);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n\n int n = Integer.parseInt(scan.nextLine());\n String[] strArr = scan.nextLine().split(\" \");\n int arrLen = strArr.length;\n int[] intArr = new int[arrLen];\n\n for (int i=0; i<arrLen; i++){\n intArr[i] = Integer.parseInt(strArr[i]);\n }\n\n int swapNum = 0;\n int tmp;\n\n for (int i=0; i<arrLen; i++){\n for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }\n }\n\n for (int i=0; i<arrLen; i++){\n strArr[i] = String.valueOf(intArr[i]);\n }\n\n System.out.println(String.join(\" \", strArr));\n System.out.println(swapNum);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n\n int n = Integer.parseInt(scan.nextLine());\n String[] strArr = scan.nextLine().split(\" \");\n int arrLen = strArr.length;\n int[] intArr = new int[arrLen];\n\n for (int i=0; i<arrLen; i++){\n intArr[i] = Integer.parseInt(strArr[i]);\n }\n\n int swapNum = 0;\n int tmp;\n\n for (int i=0; i<arrLen; i++){\n for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }\n }\n\n for (int i=0; i<arrLen; i++){\n strArr[i] = String.valueOf(intArr[i]);\n }\n\n System.out.println(String.join(\" \", strArr));\n System.out.println(swapNum);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n\n int n = Integer.parseInt(scan.nextLine());\n String[] strArr = scan.nextLine().split(\" \");\n int arrLen = strArr.length;\n int[] intArr = new int[arrLen];\n\n for (int i=0; i<arrLen; i++){\n intArr[i] = Integer.parseInt(strArr[i]);\n }\n\n int swapNum = 0;\n int tmp;\n\n for (int i=0; i<arrLen; i++){\n for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }\n }\n\n for (int i=0; i<arrLen; i++){\n strArr[i] = String.valueOf(intArr[i]);\n }\n\n System.out.println(String.join(\" \", strArr));\n System.out.println(swapNum);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = Integer.parseInt(scan.nextLine());",
"n",
"Integer.parseInt(scan.nextLine())",
"Integer.parseInt",
"Integer",
"scan.nextLine()",
"scan.nextLine",
"scan",
"String[] strArr = scan.nextLine().split(\" \");",
"strArr",
"scan.nextLine().split(\" \")",
"scan.nextLine().split",
"scan.nextLine()",
"scan.nextLine",
"scan",
"\" \"",
"int arrLen = strArr.length;",
"arrLen",
"strArr.length",
"strArr",
"strArr.length",
"int[] intArr = new int[arrLen];",
"intArr",
"new int[arrLen]",
"arrLen",
"for (int i=0; i<arrLen; i++){\n intArr[i] = Integer.parseInt(strArr[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arrLen",
"i",
"arrLen",
"i++",
"i++",
"i",
"{\n intArr[i] = Integer.parseInt(strArr[i]);\n }",
"{\n intArr[i] = Integer.parseInt(strArr[i]);\n }",
"intArr[i] = Integer.parseInt(strArr[i])",
"intArr[i]",
"intArr",
"i",
"Integer.parseInt(strArr[i])",
"Integer.parseInt",
"Integer",
"strArr[i]",
"strArr",
"i",
"int swapNum = 0;",
"swapNum",
"0",
"int tmp;",
"tmp",
"for (int i=0; i<arrLen; i++){\n for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arrLen",
"i",
"arrLen",
"i++",
"i++",
"i",
"{\n for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }\n }",
"{\n for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }\n }",
"for (int j=arrLen-1; j>i; j--){\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }",
"int j=arrLen-1;",
"int j=arrLen-1;",
"j",
"arrLen-1",
"arrLen",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }",
"{\n if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }\n }",
"if (intArr[j] < intArr[j-1]){\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }",
"intArr[j] < intArr[j-1]",
"intArr[j]",
"intArr",
"j",
"intArr[j-1]",
"intArr",
"j-1",
"j",
"1",
"{\n tmp = intArr[j];\n intArr[j] = intArr[j-1];\n intArr[j-1] = tmp;\n swapNum += 1;\n }",
"tmp = intArr[j]",
"tmp",
"intArr[j]",
"intArr",
"j",
"intArr[j] = intArr[j-1]",
"intArr[j]",
"intArr",
"j",
"intArr[j-1]",
"intArr",
"j-1",
"j",
"1",
"intArr[j-1] = tmp",
"intArr[j-1]",
"intArr",
"j-1",
"j",
"1",
"tmp",
"swapNum += 1",
"swapNum",
"1",
"for (int i=0; i<arrLen; i++){\n strArr[i] = String.valueOf(intArr[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<arrLen",
"i",
"arrLen",
"i++",
"i++",
"i",
"{\n strArr[i] = String.valueOf(intArr[i]);\n }",
"{\n strArr[i] = String.valueOf(intArr[i]);\n }",
"strArr[i] = String.valueOf(intArr[i])",
"strArr[i]",
"strArr",
"i",
"String.valueOf(intArr[i])",
"String.valueOf",
"String",
"intArr[i]",
"intArr",
"i",
"System.out.println(String.join(\" \", strArr))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.join(\" \", strArr)",
"String.join",
"String",
"\" \"",
"strArr",
"System.out.println(swapNum)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapNum",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.nextLine());
String[] strArr = scan.nextLine().split(" ");
int arrLen = strArr.length;
int[] intArr = new int[arrLen];
for (int i=0; i<arrLen; i++){
intArr[i] = Integer.parseInt(strArr[i]);
}
int swapNum = 0;
int tmp;
for (int i=0; i<arrLen; i++){
for (int j=arrLen-1; j>i; j--){
if (intArr[j] < intArr[j-1]){
tmp = intArr[j];
intArr[j] = intArr[j-1];
intArr[j-1] = tmp;
swapNum += 1;
}
}
}
for (int i=0; i<arrLen; i++){
strArr[i] = String.valueOf(intArr[i]);
}
System.out.println(String.join(" ", strArr));
System.out.println(swapNum);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
4,
18,
4,
18,
13,
17,
4,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
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,
29,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
4,
18,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
4,
18,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
30,
41,
13,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
4,
18,
13,
2,
13,
17,
13,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
13,
18,
13,
13,
41,
13,
4,
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
],
[
209,
14
],
[
209,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
22,
23
],
[
21,
24
],
[
24,
25
],
[
25,
26
],
[
24,
27
],
[
17,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
28,
38
],
[
38,
39
],
[
39,
40
],
[
28,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
43,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
17,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
59,
60
],
[
15,
61
],
[
61,
62
],
[
209,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
65,
74
],
[
74,
75
],
[
74,
76
],
[
65,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
94,
95
],
[
65,
96
],
[
96,
97
],
[
63,
98
],
[
98,
99
],
[
209,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
113,
117
],
[
106,
118
],
[
118,
119
],
[
119,
120
],
[
106,
121
],
[
122,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
127,
131
],
[
123,
132
],
[
132,
133
],
[
132,
134
],
[
123,
135
],
[
135,
136
],
[
136,
137
],
[
123,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
145,
146
],
[
145,
147
],
[
141,
148
],
[
148,
149
],
[
149,
150
],
[
148,
151
],
[
140,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
156,
157
],
[
155,
158
],
[
152,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
159,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
166,
167
],
[
166,
168
],
[
152,
169
],
[
169,
170
],
[
170,
171
],
[
169,
172
],
[
172,
173
],
[
172,
174
],
[
169,
175
],
[
152,
176
],
[
176,
177
],
[
102,
178
],
[
178,
179
],
[
178,
180
],
[
102,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
181,
186
],
[
102,
187
],
[
187,
188
],
[
100,
189
],
[
189,
190
],
[
209,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
196,
198
],
[
198,
199
],
[
198,
200
],
[
193,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
203,
205
],
[
191,
206
],
[
206,
207
],
[
0,
208
],
[
208,
209
],
[
208,
210
]
] | [
"import java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void printArray(List<Integer> array) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(array.get(0));\n\t\tfor (int j = 1; j < array.size(); j++) {\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}\n\n\tstatic public List<Integer> acceptArray (InputStream ins) {\n\t\tScanner sc = new Scanner(ins);\n\t\tint num = sc.nextInt();\n\t\tList<Integer> array = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarray.add(sc.nextInt());\n\t\t}\n\t\treturn array;\n\t}\n\n\tstatic public List<Integer> bubbleSort (List<Integer> array) {\n\t\t// 1, 2,4,5,3\n\t\t//\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < array.size()-1; i++){\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tprintArray(array);\n\t\tSystem.out.println(swapCount);\n\t\treturn array;\n\t}\n\n\tstatic public void main(String[] args) {\n\t\tList<Integer> array = acceptArray(System.in);\n\t\tList<Integer> sorted = bubbleSort(array);\n\n\t}\n}",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void printArray(List<Integer> array) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(array.get(0));\n\t\tfor (int j = 1; j < array.size(); j++) {\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}\n\n\tstatic public List<Integer> acceptArray (InputStream ins) {\n\t\tScanner sc = new Scanner(ins);\n\t\tint num = sc.nextInt();\n\t\tList<Integer> array = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarray.add(sc.nextInt());\n\t\t}\n\t\treturn array;\n\t}\n\n\tstatic public List<Integer> bubbleSort (List<Integer> array) {\n\t\t// 1, 2,4,5,3\n\t\t//\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < array.size()-1; i++){\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tprintArray(array);\n\t\tSystem.out.println(swapCount);\n\t\treturn array;\n\t}\n\n\tstatic public void main(String[] args) {\n\t\tList<Integer> array = acceptArray(System.in);\n\t\tList<Integer> sorted = bubbleSort(array);\n\n\t}\n}",
"Main",
"public static void printArray(List<Integer> array) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(array.get(0));\n\t\tfor (int j = 1; j < array.size(); j++) {\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}",
"printArray",
"{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(array.get(0));\n\t\tfor (int j = 1; j < array.size(); j++) {\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"sb.append(array.get(0))",
"sb.append",
"sb",
"array.get(0)",
"array.get",
"array",
"0",
"for (int j = 1; j < array.size(); j++) {\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}",
"int j = 1;",
"int j = 1;",
"j",
"1",
"j < array.size()",
"j",
"array.size()",
"array.size",
"array",
"j++",
"j++",
"j",
"{\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}",
"{\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}",
"sb.append(\" \").append(array.get(j))",
"sb.append(\" \").append",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"array.get(j)",
"array.get",
"array",
"j",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"List<Integer> array",
"array",
"static public List<Integer> acceptArray (InputStream ins) {\n\t\tScanner sc = new Scanner(ins);\n\t\tint num = sc.nextInt();\n\t\tList<Integer> array = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarray.add(sc.nextInt());\n\t\t}\n\t\treturn array;\n\t}",
"acceptArray",
"{\n\t\tScanner sc = new Scanner(ins);\n\t\tint num = sc.nextInt();\n\t\tList<Integer> array = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarray.add(sc.nextInt());\n\t\t}\n\t\treturn array;\n\t}",
"Scanner sc = new Scanner(ins);",
"sc",
"new Scanner(ins)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer> array = new ArrayList<Integer>();",
"array",
"new ArrayList<Integer>()",
"for (int i = 0; i < num; i++) {\n\t\t\tarray.add(sc.nextInt());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n\t\t\tarray.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tarray.add(sc.nextInt());\n\t\t}",
"array.add(sc.nextInt())",
"array.add",
"array",
"sc.nextInt()",
"sc.nextInt",
"sc",
"return array;",
"array",
"InputStream ins",
"ins",
"static public List<Integer> bubbleSort (List<Integer> array) {\n\t\t// 1, 2,4,5,3\n\t\t//\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < array.size()-1; i++){\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tprintArray(array);\n\t\tSystem.out.println(swapCount);\n\t\treturn array;\n\t}",
"bubbleSort",
"{\n\t\t// 1, 2,4,5,3\n\t\t//\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < array.size()-1; i++){\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tprintArray(array);\n\t\tSystem.out.println(swapCount);\n\t\treturn array;\n\t}",
"int swapCount = 0;",
"swapCount",
"0",
"for (int i = 0; i < array.size()-1; i++){\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.size()-1",
"i",
"array.size()-1",
"array.size()",
"array.size",
"array",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"{\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}",
"for (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}",
"int j = array.size()-1;",
"int j = array.size()-1;",
"j",
"array.size()-1",
"array.size()",
"array.size",
"array",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}",
"if (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}",
"array.get(j-1) > array.get(j)",
"array.get(j-1)",
"array.get",
"array",
"j-1",
"j",
"1",
"array.get(j)",
"array.get",
"array",
"j",
"{\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}",
"int c = array.get(j);",
"c",
"array.get(j)",
"array.get",
"array",
"j",
"array.set(j, array.get(j-1))",
"array.set",
"array",
"j",
"array.get(j-1)",
"array.get",
"array",
"j-1",
"j",
"1",
"array.set(j-1, c)",
"array.set",
"array",
"j-1",
"j",
"1",
"c",
"swapCount++",
"swapCount",
"printArray(array)",
"printArray",
"array",
"System.out.println(swapCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapCount",
"return array;",
"array",
"List<Integer> array",
"array",
"static public void main(String[] args) {\n\t\tList<Integer> array = acceptArray(System.in);\n\t\tList<Integer> sorted = bubbleSort(array);\n\n\t}",
"main",
"{\n\t\tList<Integer> array = acceptArray(System.in);\n\t\tList<Integer> sorted = bubbleSort(array);\n\n\t}",
"List<Integer> array = acceptArray(System.in);",
"array",
"acceptArray(System.in)",
"acceptArray",
"System.in",
"System",
"System.in",
"List<Integer> sorted = bubbleSort(array);",
"sorted",
"bubbleSort(array)",
"bubbleSort",
"array",
"String[] args",
"args",
"public class Main {\n\tpublic static void printArray(List<Integer> array) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(array.get(0));\n\t\tfor (int j = 1; j < array.size(); j++) {\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}\n\n\tstatic public List<Integer> acceptArray (InputStream ins) {\n\t\tScanner sc = new Scanner(ins);\n\t\tint num = sc.nextInt();\n\t\tList<Integer> array = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarray.add(sc.nextInt());\n\t\t}\n\t\treturn array;\n\t}\n\n\tstatic public List<Integer> bubbleSort (List<Integer> array) {\n\t\t// 1, 2,4,5,3\n\t\t//\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < array.size()-1; i++){\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tprintArray(array);\n\t\tSystem.out.println(swapCount);\n\t\treturn array;\n\t}\n\n\tstatic public void main(String[] args) {\n\t\tList<Integer> array = acceptArray(System.in);\n\t\tList<Integer> sorted = bubbleSort(array);\n\n\t}\n}",
"public class Main {\n\tpublic static void printArray(List<Integer> array) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tsb.append(array.get(0));\n\t\tfor (int j = 1; j < array.size(); j++) {\n\t\t\tsb.append(\" \").append(array.get(j));\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}\n\n\tstatic public List<Integer> acceptArray (InputStream ins) {\n\t\tScanner sc = new Scanner(ins);\n\t\tint num = sc.nextInt();\n\t\tList<Integer> array = new ArrayList<Integer>();\n\t\tfor (int i = 0; i < num; i++) {\n\t\t\tarray.add(sc.nextInt());\n\t\t}\n\t\treturn array;\n\t}\n\n\tstatic public List<Integer> bubbleSort (List<Integer> array) {\n\t\t// 1, 2,4,5,3\n\t\t//\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < array.size()-1; i++){\n\t\t\tfor (int j = array.size()-1; j > i; j--) {\n\t\t\t\tif (array.get(j-1) > array.get(j)) {\n\t\t\t\t\t//swap\n\t\t\t\t\tint c = array.get(j);\n\t\t\t\t\tarray.set(j, array.get(j-1));\n\t\t\t\t\tarray.set(j-1, c);\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tprintArray(array);\n\t\tSystem.out.println(swapCount);\n\t\treturn array;\n\t}\n\n\tstatic public void main(String[] args) {\n\t\tList<Integer> array = acceptArray(System.in);\n\t\tList<Integer> sorted = bubbleSort(array);\n\n\t}\n}",
"Main"
] | import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void printArray(List<Integer> array) {
StringBuilder sb = new StringBuilder();
sb.append(array.get(0));
for (int j = 1; j < array.size(); j++) {
sb.append(" ").append(array.get(j));
}
System.out.println(sb.toString());
}
static public List<Integer> acceptArray (InputStream ins) {
Scanner sc = new Scanner(ins);
int num = sc.nextInt();
List<Integer> array = new ArrayList<Integer>();
for (int i = 0; i < num; i++) {
array.add(sc.nextInt());
}
return array;
}
static public List<Integer> bubbleSort (List<Integer> array) {
// 1, 2,4,5,3
//
int swapCount = 0;
for (int i = 0; i < array.size()-1; i++){
for (int j = array.size()-1; j > i; j--) {
if (array.get(j-1) > array.get(j)) {
//swap
int c = array.get(j);
array.set(j, array.get(j-1));
array.set(j-1, c);
swapCount++;
}
}
}
printArray(array);
System.out.println(swapCount);
return array;
}
static public void main(String[] args) {
List<Integer> array = acceptArray(System.in);
List<Integer> sorted = bubbleSort(array);
}
} |
[
7,
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,
41,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
17,
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
],
[
14,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
22,
27
],
[
8,
28
],
[
28,
29
],
[
28,
30
],
[
8,
32
],
[
32,
33
],
[
8,
34
],
[
34,
35
],
[
34,
36
],
[
8,
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
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
57,
59
],
[
8,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
72,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
73,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
73,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
88,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
98,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
112,
113
],
[
112,
114
],
[
98,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
98,
120
],
[
120,
121
],
[
8,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
122,
130
],
[
130,
131
],
[
131,
132
],
[
122,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
135,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
147,
148
],
[
147,
149
],
[
135,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
156,
158
],
[
150,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
8,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
6,
171
],
[
171,
172
]
] | [
"import java.util.*;\n\nclass Main{\n public static void main(String args[]){\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] arr = new int[n];\n int temp;\n int count = 0;\n for(int x = 0; x < n; x++){\n arr[x] = Integer.parseInt(line[x]);\n }\n\n for(int i = 0;i < n; i++){\n for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }\n }\n for(int x = 0; x < n; x++){\n if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }\n }\n System.out.println(count);\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 = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] arr = new int[n];\n int temp;\n int count = 0;\n for(int x = 0; x < n; x++){\n arr[x] = Integer.parseInt(line[x]);\n }\n\n for(int i = 0;i < n; i++){\n for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }\n }\n for(int x = 0; x < n; x++){\n if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\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 n = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] arr = new int[n];\n int temp;\n int count = 0;\n for(int x = 0; x < n; x++){\n arr[x] = Integer.parseInt(line[x]);\n }\n\n for(int i = 0;i < n; i++){\n for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }\n }\n for(int x = 0; x < n; x++){\n if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.nextLine());\n String[] line = sc.nextLine().split(\" \");\n int[] arr = new int[n];\n int temp;\n int count = 0;\n for(int x = 0; x < n; x++){\n arr[x] = Integer.parseInt(line[x]);\n }\n\n for(int i = 0;i < n; i++){\n for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }\n }\n for(int x = 0; x < n; x++){\n if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }\n }\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.nextLine());",
"n",
"Integer.parseInt(sc.nextLine())",
"Integer.parseInt",
"Integer",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] line = sc.nextLine().split(\" \");",
"line",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"int temp;",
"temp",
"int count = 0;",
"count",
"0",
"for(int x = 0; x < n; x++){\n arr[x] = Integer.parseInt(line[x]);\n }",
"int x = 0;",
"int x = 0;",
"x",
"0",
"x < n",
"x",
"n",
"x++",
"x++",
"x",
"{\n arr[x] = Integer.parseInt(line[x]);\n }",
"{\n arr[x] = Integer.parseInt(line[x]);\n }",
"arr[x] = Integer.parseInt(line[x])",
"arr[x]",
"arr",
"x",
"Integer.parseInt(line[x])",
"Integer.parseInt",
"Integer",
"line[x]",
"line",
"x",
"for(int i = 0;i < n; i++){\n for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }\n }",
"{\n for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }\n }",
"for(int j = n-1; j > i; j--){\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }",
"{\n if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }\n }",
"if(arr[j] < arr[j-1]){\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }",
"arr[j] < arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"{\n temp = arr[j-1];\n arr[j-1] = arr[j];\n arr[j] = temp;\n count++;\n }",
"temp = arr[j-1]",
"temp",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"arr[j-1] = arr[j]",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"arr[j]",
"arr",
"j",
"arr[j] = temp",
"arr[j]",
"arr",
"j",
"temp",
"count++",
"count",
"for(int x = 0; x < n; x++){\n if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }\n }",
"int x = 0;",
"int x = 0;",
"x",
"0",
"x < n",
"x",
"n",
"x++",
"x++",
"x",
"{\n if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }\n }",
"{\n if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }\n }",
"if(x == n-1){\n System.out.println(arr[x]);\n }else{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }",
"x == n-1",
"x",
"n-1",
"n",
"1",
"{\n System.out.println(arr[x]);\n }",
"System.out.println(arr[x])",
"System.out.println",
"System.out",
"System",
"System.out",
"arr[x]",
"arr",
"x",
"{\n System.out.print(arr[x]);\n System.out.print(\" \");\n }",
"System.out.print(arr[x])",
"System.out.print",
"System.out",
"System",
"System.out",
"arr[x]",
"arr",
"x",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"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 sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
String[] line = sc.nextLine().split(" ");
int[] arr = new int[n];
int temp;
int count = 0;
for(int x = 0; x < n; x++){
arr[x] = Integer.parseInt(line[x]);
}
for(int i = 0;i < n; i++){
for(int j = n-1; j > i; j--){
if(arr[j] < arr[j-1]){
temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
count++;
}
}
}
for(int x = 0; x < n; x++){
if(x == n-1){
System.out.println(arr[x]);
}else{
System.out.print(arr[x]);
System.out.print(" ");
}
}
System.out.println(count);
}
} |
[
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,
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,
4,
18,
20,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
18,
36,
13,
13,
0,
18,
36,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
18,
13,
13,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
6,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
14,
2,
2,
13,
17,
2,
13,
18,
13,
13,
30,
0,
13,
4,
18,
4,
18,
4,
18,
13,
17,
0,
13,
17,
29,
18,
13,
40,
13,
12,
13,
30,
29,
4,
13,
12,
13,
30,
0,
13,
17,
0,
13,
17,
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,
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,
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
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
401,
17
],
[
401,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
20,
29
],
[
29,
30
],
[
29,
31
],
[
20,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
33,
41
],
[
41,
42
],
[
42,
43
],
[
33,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
20,
52
],
[
52,
53
],
[
53,
54
],
[
18,
55
],
[
55,
56
],
[
0,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
57,
61
],
[
61,
62
],
[
57,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
65,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
63,
76
],
[
76,
77
],
[
63,
78
],
[
78,
79
],
[
57,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
86,
88
],
[
82,
89
],
[
89,
90
],
[
89,
91
],
[
82,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
98,
100
],
[
93,
101
],
[
101,
102
],
[
102,
103
],
[
93,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
82,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
125,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
118,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
134,
140
],
[
140,
141
],
[
140,
142
],
[
133,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
143,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
143,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
143,
165
],
[
165,
166
],
[
143,
167
],
[
167,
168
],
[
167,
169
],
[
82,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
170,
175
],
[
175,
176
],
[
175,
177
],
[
170,
178
],
[
178,
179
],
[
179,
180
],
[
170,
181
],
[
182,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
183,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
187,
192
],
[
182,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
193,
198
],
[
198,
199
],
[
198,
200
],
[
82,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
201,
206
],
[
82,
207
],
[
207,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
207,
212
],
[
0,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
213,
217
],
[
217,
218
],
[
213,
219
],
[
219,
220
],
[
213,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
213,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
227,
233
],
[
233,
234
],
[
213,
235
],
[
235,
236
],
[
235,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
240,
241
],
[
240,
242
],
[
239,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
245,
247
],
[
238,
248
],
[
248,
249
],
[
249,
250
],
[
249,
251
],
[
251,
252
],
[
252,
253
],
[
253,
254
],
[
254,
255
],
[
255,
256
],
[
256,
257
],
[
251,
258
],
[
248,
259
],
[
259,
260
],
[
259,
261
],
[
237,
262
],
[
262,
263
],
[
263,
264
],
[
263,
265
],
[
265,
266
],
[
213,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
270,
271
],
[
271,
272
],
[
213,
273
],
[
273,
274
],
[
273,
275
],
[
275,
276
],
[
276,
277
],
[
276,
278
],
[
275,
279
],
[
279,
280
],
[
279,
281
],
[
275,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
213,
286
],
[
286,
287
],
[
286,
288
],
[
288,
289
],
[
289,
290
],
[
290,
291
],
[
291,
292
],
[
290,
293
],
[
293,
294
],
[
213,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
300,
301
],
[
299,
302
],
[
302,
303
],
[
213,
304
],
[
304,
305
],
[
304,
306
],
[
306,
307
],
[
307,
308
],
[
308,
309
],
[
309,
310
],
[
308,
311
],
[
311,
312
],
[
213,
313
],
[
313,
314
],
[
313,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
315,
320
],
[
320,
321
],
[
321,
322
],
[
322,
323
],
[
322,
324
],
[
320,
325
],
[
325,
326
],
[
325,
327
],
[
320,
328
],
[
328,
329
],
[
329,
330
],
[
320,
331
],
[
331,
332
],
[
332,
333
],
[
333,
334
],
[
333,
335
],
[
332,
336
],
[
336,
337
],
[
315,
338
],
[
338,
339
],
[
313,
340
],
[
340,
341
],
[
213,
342
],
[
342,
343
],
[
342,
344
],
[
344,
345
],
[
345,
346
],
[
345,
347
],
[
344,
349
],
[
349,
350
],
[
350,
351
],
[
351,
352
],
[
351,
353
],
[
349,
354
],
[
354,
355
],
[
354,
356
],
[
349,
357
],
[
357,
358
],
[
358,
359
],
[
349,
360
],
[
360,
361
],
[
361,
362
],
[
362,
363
],
[
362,
364
],
[
361,
365
],
[
365,
366
],
[
344,
367
],
[
367,
368
],
[
342,
369
],
[
369,
370
],
[
213,
371
],
[
371,
372
],
[
371,
373
],
[
373,
374
],
[
374,
375
],
[
374,
376
],
[
373,
378
],
[
378,
379
],
[
379,
380
],
[
380,
381
],
[
380,
382
],
[
378,
383
],
[
383,
384
],
[
383,
385
],
[
378,
386
],
[
386,
387
],
[
387,
388
],
[
378,
389
],
[
389,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
390,
394
],
[
394,
395
],
[
373,
396
],
[
396,
397
],
[
371,
398
],
[
398,
399
],
[
0,
400
],
[
400,
401
],
[
400,
402
]
] | [
"import java.io.BufferedReader;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tContestScanner scan = new ContestScanner();\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\n\t\tfor(int i=0; i < N; i++) A[i] = scan.nextInt();\n\n\t\t(new Solve(A, N)).solve();\n\t}\n}\nclass Solve {\n\tprivate final int[] A;\n\tprivate final int N;\n\n\tpublic Solve(final int[] A, final int N)\n\t{\n\t\tthis.A = A;\n\t\tthis.N = N;\n\t}\n\n\tpublic void solve()\n\t{\n\t\tint count = 0;\n\t\tboolean cont = true;\n\n\t\tint[] sorted = new int[N];\n\n\t\tfor(int i=0; i < N; i++) sorted[i] = A[i];\n\n\t\twhile(cont)\n\t\t{\n\t\t\tcont = false;\n\n\t\t\tfor(int i=N-1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i < N; i++)\n\t\t{\n\t\t\tif(i > 0) System.out.print(\" \");\n\t\t\tSystem.out.print(sorted[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}\nclass ContestScanner {\n\tBufferedReader reader;\n\tString[] line;\n\tint index;\n\tpublic ContestScanner() {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\tpublic ContestScanner(String filename) throws FileNotFoundException {\n\t\treader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));\n\t}\n\n\tpublic String nextToken() throws IOException {\n\t\tif(line == null || index >= line.length)\n\t\t{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}\n\n\t\treturn line[index++];\n\t}\n\n\tpublic String next() throws IOException {\n\t\treturn nextToken();\n\t}\n\n\tpublic String readLine() throws IOException {\n\t\tline = null;\n\t\tindex = 0;\n\n\t\treturn reader.readLine();\n\t}\n\n\tpublic int nextInt() throws IOException, NumberFormatException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tpublic long nextLong() throws IOException, NumberFormatException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tpublic double nextDouble() throws IOException, NumberFormatException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tpublic int[] nextIntArray(int N) throws IOException, NumberFormatException {\n\t\tint[] result = new int[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextInt();\n\n\t\treturn result;\n\t}\n\n\tpublic long[] nextLongArray(int N) throws IOException, NumberFormatException {\n\t\tlong[] result = new long[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextLong();\n\n\t\treturn result;\n\t}\n\n\tpublic double[] nexDoubleArray(int N) throws IOException, NumberFormatException {\n\t\tdouble[] result = new double[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextDouble();\n\n\t\treturn result;\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.FileInputStream;",
"FileInputStream",
"java.io",
"import java.io.FileNotFoundException;",
"FileNotFoundException",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tContestScanner scan = new ContestScanner();\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\n\t\tfor(int i=0; i < N; i++) A[i] = scan.nextInt();\n\n\t\t(new Solve(A, N)).solve();\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tContestScanner scan = new ContestScanner();\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\n\t\tfor(int i=0; i < N; i++) A[i] = scan.nextInt();\n\n\t\t(new Solve(A, N)).solve();\n\t}",
"main",
"{\n\t\tContestScanner scan = new ContestScanner();\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\n\t\tfor(int i=0; i < N; i++) A[i] = scan.nextInt();\n\n\t\t(new Solve(A, N)).solve();\n\t}",
"ContestScanner scan = new ContestScanner();",
"scan",
"new ContestScanner()",
"int N = scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] A = new int[N];",
"A",
"new int[N]",
"N",
"for(int i=0; i < N; i++) A[i] = scan.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"A[i] = scan.nextInt();",
"A[i] = scan.nextInt()",
"A[i]",
"A",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"(new Solve(A, N)).solve()",
"(new Solve(A, N)).solve",
"(new Solve(A, N))",
"String[] args",
"args",
"class Solve {\n\tprivate final int[] A;\n\tprivate final int N;\n\n\tpublic Solve(final int[] A, final int N)\n\t{\n\t\tthis.A = A;\n\t\tthis.N = N;\n\t}\n\n\tpublic void solve()\n\t{\n\t\tint count = 0;\n\t\tboolean cont = true;\n\n\t\tint[] sorted = new int[N];\n\n\t\tfor(int i=0; i < N; i++) sorted[i] = A[i];\n\n\t\twhile(cont)\n\t\t{\n\t\t\tcont = false;\n\n\t\t\tfor(int i=N-1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i < N; i++)\n\t\t{\n\t\t\tif(i > 0) System.out.print(\" \");\n\t\t\tSystem.out.print(sorted[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}\n}",
"Solve",
"private final int[] A;",
"A",
"private final int N;",
"N",
"public Solve(final int[] A, final int N)\n\t{\n\t\tthis.A = A;\n\t\tthis.N = N;\n\t}",
"Solve",
"{\n\t\tthis.A = A;\n\t\tthis.N = N;\n\t}",
"this.A = A",
"this.A",
"this",
"this.A",
"A",
"this.N = N",
"this.N",
"this",
"this.N",
"N",
"final int[] A",
"A",
"final int N",
"N",
"public void solve()\n\t{\n\t\tint count = 0;\n\t\tboolean cont = true;\n\n\t\tint[] sorted = new int[N];\n\n\t\tfor(int i=0; i < N; i++) sorted[i] = A[i];\n\n\t\twhile(cont)\n\t\t{\n\t\t\tcont = false;\n\n\t\t\tfor(int i=N-1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i < N; i++)\n\t\t{\n\t\t\tif(i > 0) System.out.print(\" \");\n\t\t\tSystem.out.print(sorted[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"solve",
"{\n\t\tint count = 0;\n\t\tboolean cont = true;\n\n\t\tint[] sorted = new int[N];\n\n\t\tfor(int i=0; i < N; i++) sorted[i] = A[i];\n\n\t\twhile(cont)\n\t\t{\n\t\t\tcont = false;\n\n\t\t\tfor(int i=N-1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i=0; i < N; i++)\n\t\t{\n\t\t\tif(i > 0) System.out.print(\" \");\n\t\t\tSystem.out.print(sorted[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"boolean cont = true;",
"cont",
"true",
"int[] sorted = new int[N];",
"sorted",
"new int[N]",
"N",
"for(int i=0; i < N; i++) sorted[i] = A[i];",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"sorted[i] = A[i];",
"sorted[i] = A[i]",
"sorted[i]",
"sorted",
"i",
"A[i]",
"A",
"i",
"while(cont)\n\t\t{\n\t\t\tcont = false;\n\n\t\t\tfor(int i=N-1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"cont",
"{\n\t\t\tcont = false;\n\n\t\t\tfor(int i=N-1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"cont = false",
"cont",
"false",
"for(int i=N-1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}",
"int i=N-1;",
"int i=N-1;",
"i",
"N-1",
"N",
"1",
"i >= 1",
"i",
"1",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}\n\t\t\t}",
"if(sorted[i-1] > sorted[i])\n\t\t\t\t{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}",
"sorted[i-1] > sorted[i]",
"sorted[i-1]",
"sorted",
"i-1",
"i",
"1",
"sorted[i]",
"sorted",
"i",
"{\n\t\t\t\t\tint e = sorted[i];\n\t\t\t\t\tsorted[i] = sorted[i-1];\n\t\t\t\t\tsorted[i-1] = e;\n\t\t\t\t\tcount++;\n\t\t\t\t\tcont = true;\n\t\t\t\t}",
"int e = sorted[i];",
"e",
"sorted[i]",
"sorted",
"i",
"sorted[i] = sorted[i-1]",
"sorted[i]",
"sorted",
"i",
"sorted[i-1]",
"sorted",
"i-1",
"i",
"1",
"sorted[i-1] = e",
"sorted[i-1]",
"sorted",
"i-1",
"i",
"1",
"e",
"count++",
"count",
"cont = true",
"cont",
"true",
"for(int i=0; i < N; i++)\n\t\t{\n\t\t\tif(i > 0) System.out.print(\" \");\n\t\t\tSystem.out.print(sorted[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tif(i > 0) System.out.print(\" \");\n\t\t\tSystem.out.print(sorted[i]);\n\t\t}",
"{\n\t\t\tif(i > 0) System.out.print(\" \");\n\t\t\tSystem.out.print(sorted[i]);\n\t\t}",
"if(i > 0) System.out.print(\" \");",
"i > 0",
"i",
"0",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(sorted[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"sorted[i]",
"sorted",
"i",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"class ContestScanner {\n\tBufferedReader reader;\n\tString[] line;\n\tint index;\n\tpublic ContestScanner() {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t}\n\n\tpublic ContestScanner(String filename) throws FileNotFoundException {\n\t\treader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));\n\t}\n\n\tpublic String nextToken() throws IOException {\n\t\tif(line == null || index >= line.length)\n\t\t{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}\n\n\t\treturn line[index++];\n\t}\n\n\tpublic String next() throws IOException {\n\t\treturn nextToken();\n\t}\n\n\tpublic String readLine() throws IOException {\n\t\tline = null;\n\t\tindex = 0;\n\n\t\treturn reader.readLine();\n\t}\n\n\tpublic int nextInt() throws IOException, NumberFormatException {\n\t\treturn Integer.parseInt(nextToken());\n\t}\n\n\tpublic long nextLong() throws IOException, NumberFormatException {\n\t\treturn Long.parseLong(nextToken());\n\t}\n\n\tpublic double nextDouble() throws IOException, NumberFormatException {\n\t\treturn Double.parseDouble(nextToken());\n\t}\n\n\tpublic int[] nextIntArray(int N) throws IOException, NumberFormatException {\n\t\tint[] result = new int[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextInt();\n\n\t\treturn result;\n\t}\n\n\tpublic long[] nextLongArray(int N) throws IOException, NumberFormatException {\n\t\tlong[] result = new long[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextLong();\n\n\t\treturn result;\n\t}\n\n\tpublic double[] nexDoubleArray(int N) throws IOException, NumberFormatException {\n\t\tdouble[] result = new double[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextDouble();\n\n\t\treturn result;\n\t}\n}",
"ContestScanner",
"BufferedReader reader;",
"reader",
"String[] line;",
"line",
"int index;",
"index",
"public ContestScanner() {\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t}",
"ContestScanner",
"{\n\t\treader = new BufferedReader(new InputStreamReader(System.in));\n\t}",
"reader = new BufferedReader(new InputStreamReader(System.in))",
"reader",
"new BufferedReader(new InputStreamReader(System.in))",
"public ContestScanner(String filename) throws FileNotFoundException {\n\t\treader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));\n\t}",
"ContestScanner",
"{\n\t\treader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));\n\t}",
"reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)))",
"reader",
"new BufferedReader(new InputStreamReader(new FileInputStream(filename)))",
"String filename",
"filename",
"public String nextToken() throws IOException {\n\t\tif(line == null || index >= line.length)\n\t\t{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}\n\n\t\treturn line[index++];\n\t}",
"nextToken",
"{\n\t\tif(line == null || index >= line.length)\n\t\t{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}\n\n\t\treturn line[index++];\n\t}",
"if(line == null || index >= line.length)\n\t\t{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}",
"line == null || index >= line.length",
"line == null",
"line",
"null",
"index >= line.length",
"index",
"line.length",
"line",
"line.length",
"{\n\t\t\tline = reader.readLine().trim().split(\" \");\n\t\t\tindex = 0;\n\t\t}",
"line = reader.readLine().trim().split(\" \")",
"line",
"reader.readLine().trim().split(\" \")",
"reader.readLine().trim().split",
"reader.readLine().trim()",
"reader.readLine().trim",
"reader.readLine()",
"reader.readLine",
"reader",
"\" \"",
"index = 0",
"index",
"0",
"return line[index++];",
"line[index++]",
"line",
"index++",
"index",
"public String next() throws IOException {\n\t\treturn nextToken();\n\t}",
"next",
"{\n\t\treturn nextToken();\n\t}",
"return nextToken();",
"nextToken()",
"nextToken",
"public String readLine() throws IOException {\n\t\tline = null;\n\t\tindex = 0;\n\n\t\treturn reader.readLine();\n\t}",
"readLine",
"{\n\t\tline = null;\n\t\tindex = 0;\n\n\t\treturn reader.readLine();\n\t}",
"line = null",
"line",
"null",
"index = 0",
"index",
"0",
"return reader.readLine();",
"reader.readLine()",
"reader.readLine",
"reader",
"public int nextInt() throws IOException, NumberFormatException {\n\t\treturn Integer.parseInt(nextToken());\n\t}",
"nextInt",
"{\n\t\treturn Integer.parseInt(nextToken());\n\t}",
"return Integer.parseInt(nextToken());",
"Integer.parseInt(nextToken())",
"Integer.parseInt",
"Integer",
"nextToken()",
"nextToken",
"public long nextLong() throws IOException, NumberFormatException {\n\t\treturn Long.parseLong(nextToken());\n\t}",
"nextLong",
"{\n\t\treturn Long.parseLong(nextToken());\n\t}",
"return Long.parseLong(nextToken());",
"Long.parseLong(nextToken())",
"Long.parseLong",
"Long",
"nextToken()",
"nextToken",
"public double nextDouble() throws IOException, NumberFormatException {\n\t\treturn Double.parseDouble(nextToken());\n\t}",
"nextDouble",
"{\n\t\treturn Double.parseDouble(nextToken());\n\t}",
"return Double.parseDouble(nextToken());",
"Double.parseDouble(nextToken())",
"Double.parseDouble",
"Double",
"nextToken()",
"nextToken",
"public int[] nextIntArray(int N) throws IOException, NumberFormatException {\n\t\tint[] result = new int[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextInt();\n\n\t\treturn result;\n\t}",
"nextIntArray",
"{\n\t\tint[] result = new int[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextInt();\n\n\t\treturn result;\n\t}",
"int[] result = new int[N];",
"result",
"new int[N]",
"N",
"for(int i=0; i < N; i++) result[i] = nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"result[i] = nextInt();",
"result[i] = nextInt()",
"result[i]",
"result",
"i",
"nextInt()",
"nextInt",
"return result;",
"result",
"int N",
"N",
"public long[] nextLongArray(int N) throws IOException, NumberFormatException {\n\t\tlong[] result = new long[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextLong();\n\n\t\treturn result;\n\t}",
"nextLongArray",
"{\n\t\tlong[] result = new long[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextLong();\n\n\t\treturn result;\n\t}",
"long[] result = new long[N];",
"result",
"new long[N]",
"N",
"for(int i=0; i < N; i++) result[i] = nextLong();",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"result[i] = nextLong();",
"result[i] = nextLong()",
"result[i]",
"result",
"i",
"nextLong()",
"nextLong",
"return result;",
"result",
"int N",
"N",
"public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {\n\t\tdouble[] result = new double[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextDouble();\n\n\t\treturn result;\n\t}",
"nexDoubleArray",
"{\n\t\tdouble[] result = new double[N];\n\n\t\tfor(int i=0; i < N; i++) result[i] = nextDouble();\n\n\t\treturn result;\n\t}",
"double[] result = new double[N];",
"result",
"new double[N]",
"N",
"for(int i=0; i < N; i++) result[i] = nextDouble();",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"result[i] = nextDouble();",
"result[i] = nextDouble()",
"result[i]",
"result",
"i",
"nextDouble()",
"nextDouble",
"return result;",
"result",
"int N",
"N",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tContestScanner scan = new ContestScanner();\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\n\t\tfor(int i=0; i < N; i++) A[i] = scan.nextInt();\n\n\t\t(new Solve(A, N)).solve();\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tContestScanner scan = new ContestScanner();\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\n\t\tfor(int i=0; i < N; i++) A[i] = scan.nextInt();\n\n\t\t(new Solve(A, N)).solve();\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
ContestScanner scan = new ContestScanner();
int N = scan.nextInt();
int[] A = new int[N];
for(int i=0; i < N; i++) A[i] = scan.nextInt();
(new Solve(A, N)).solve();
}
}
class Solve {
private final int[] A;
private final int N;
public Solve(final int[] A, final int N)
{
this.A = A;
this.N = N;
}
public void solve()
{
int count = 0;
boolean cont = true;
int[] sorted = new int[N];
for(int i=0; i < N; i++) sorted[i] = A[i];
while(cont)
{
cont = false;
for(int i=N-1; i >= 1; i--)
{
if(sorted[i-1] > sorted[i])
{
int e = sorted[i];
sorted[i] = sorted[i-1];
sorted[i-1] = e;
count++;
cont = true;
}
}
}
for(int i=0; i < N; i++)
{
if(i > 0) System.out.print(" ");
System.out.print(sorted[i]);
}
System.out.println("");
System.out.println(count);
}
}
class ContestScanner {
BufferedReader reader;
String[] line;
int index;
public ContestScanner() {
reader = new BufferedReader(new InputStreamReader(System.in));
}
public ContestScanner(String filename) throws FileNotFoundException {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
}
public String nextToken() throws IOException {
if(line == null || index >= line.length)
{
line = reader.readLine().trim().split(" ");
index = 0;
}
return line[index++];
}
public String next() throws IOException {
return nextToken();
}
public String readLine() throws IOException {
line = null;
index = 0;
return reader.readLine();
}
public int nextInt() throws IOException, NumberFormatException {
return Integer.parseInt(nextToken());
}
public long nextLong() throws IOException, NumberFormatException {
return Long.parseLong(nextToken());
}
public double nextDouble() throws IOException, NumberFormatException {
return Double.parseDouble(nextToken());
}
public int[] nextIntArray(int N) throws IOException, NumberFormatException {
int[] result = new int[N];
for(int i=0; i < N; i++) result[i] = nextInt();
return result;
}
public long[] nextLongArray(int N) throws IOException, NumberFormatException {
long[] result = new long[N];
for(int i=0; i < N; i++) result[i] = nextLong();
return result;
}
public double[] nexDoubleArray(int N) throws IOException, NumberFormatException {
double[] result = new double[N];
for(int i=0; i < N; i++) result[i] = nextDouble();
return result;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
41,
13,
17,
0,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
13,
41,
13,
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
8,
2,
13,
2,
13,
17,
17,
17,
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
],
[
8,
14
],
[
14,
15
],
[
14,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
22,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
8,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
33,
34
],
[
32,
35
],
[
8,
36
],
[
36,
37
],
[
36,
38
],
[
8,
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
],
[
57,
60
],
[
60,
61
],
[
60,
62
],
[
8,
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
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
76,
83
],
[
83,
84
],
[
83,
85
],
[
76,
86
],
[
86,
87
],
[
87,
88
],
[
76,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
91,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
107,
111
],
[
111,
112
],
[
111,
113
],
[
113,
114
],
[
113,
115
],
[
101,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
116,
122
],
[
101,
123
],
[
123,
124
],
[
8,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
130,
132
],
[
125,
133
],
[
133,
134
],
[
134,
135
],
[
125,
136
],
[
137,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
147,
153
],
[
147,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
6,
161
],
[
161,
162
]
] | [
"import java.io.*;\nclass Main\n{\n public static void main(String args[])throws IOException\n {\n\tBufferedReader input=new BufferedReader(new InputStreamReader(System.in));\n\tint n,k=0;\n\t n=Integer.parseInt(input.readLine());\n\tString str=input.readLine();\n\tString str_ary[]=str.split(\" \");\n\tint a[]=new int[n];\n\tfor(int i=0;i<n;i++)\n\t {\n\t\ta[i]=Integer.parseInt(str_ary[i]);\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tfor(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tSystem.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"));\n\t }\n\tSystem.out.println(k);\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main\n{\n public static void main(String args[])throws IOException\n {\n\tBufferedReader input=new BufferedReader(new InputStreamReader(System.in));\n\tint n,k=0;\n\t n=Integer.parseInt(input.readLine());\n\tString str=input.readLine();\n\tString str_ary[]=str.split(\" \");\n\tint a[]=new int[n];\n\tfor(int i=0;i<n;i++)\n\t {\n\t\ta[i]=Integer.parseInt(str_ary[i]);\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tfor(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tSystem.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"));\n\t }\n\tSystem.out.println(k);\n }\n}",
"Main",
"public static void main(String args[])throws IOException\n {\n\tBufferedReader input=new BufferedReader(new InputStreamReader(System.in));\n\tint n,k=0;\n\t n=Integer.parseInt(input.readLine());\n\tString str=input.readLine();\n\tString str_ary[]=str.split(\" \");\n\tint a[]=new int[n];\n\tfor(int i=0;i<n;i++)\n\t {\n\t\ta[i]=Integer.parseInt(str_ary[i]);\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tfor(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tSystem.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"));\n\t }\n\tSystem.out.println(k);\n }",
"main",
"{\n\tBufferedReader input=new BufferedReader(new InputStreamReader(System.in));\n\tint n,k=0;\n\t n=Integer.parseInt(input.readLine());\n\tString str=input.readLine();\n\tString str_ary[]=str.split(\" \");\n\tint a[]=new int[n];\n\tfor(int i=0;i<n;i++)\n\t {\n\t\ta[i]=Integer.parseInt(str_ary[i]);\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tfor(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }\n\t }\n\tfor(int i=0;i<n;i++)\n\t {\n\t\tSystem.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"));\n\t }\n\tSystem.out.println(k);\n }",
"BufferedReader input=new BufferedReader(new InputStreamReader(System.in));",
"input",
"new BufferedReader(new InputStreamReader(System.in))",
"int n",
"n",
"k=0;",
"k",
"0",
"n=Integer.parseInt(input.readLine())",
"n",
"Integer.parseInt(input.readLine())",
"Integer.parseInt",
"Integer",
"input.readLine()",
"input.readLine",
"input",
"String str=input.readLine();",
"str",
"input.readLine()",
"input.readLine",
"input",
"String str_ary[]=str.split(\" \");",
"str_ary",
"str.split(\" \")",
"str.split",
"str",
"\" \"",
"int a[]=new int[n];",
"a",
"new int[n]",
"n",
"for(int i=0;i<n;i++)\n\t {\n\t\ta[i]=Integer.parseInt(str_ary[i]);\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\ta[i]=Integer.parseInt(str_ary[i]);\n\t }",
"{\n\t\ta[i]=Integer.parseInt(str_ary[i]);\n\t }",
"a[i]=Integer.parseInt(str_ary[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(str_ary[i])",
"Integer.parseInt",
"Integer",
"str_ary[i]",
"str_ary",
"i",
"for(int i=0;i<n;i++)\n\t {\n\t\tfor(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\tfor(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }\n\t }",
"{\n\t\tfor(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }\n\t }",
"for(int j=n-1;j>i;j--)\n\t\t {\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }",
"int j=n-1;",
"int j=n-1;",
"j",
"n-1",
"n",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }",
"{\n\t\t\tif(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }\n\t\t }",
"if(a[j]<a[j-1])\n\t\t\t {\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }",
"a[j]<a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"{\n\t\t\t\tint tmp=a[j];\n\t\t\t\ta[j]=a[j-1];\n\t\t\t\ta[j-1]=tmp;\n\t\t\t\tk++;\n\t\t\t }",
"int tmp=a[j];",
"tmp",
"a[j]",
"a",
"j",
"a[j]=a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1]=tmp",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"tmp",
"k++",
"k",
"for(int i=0;i<n;i++)\n\t {\n\t\tSystem.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"));\n\t }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\tSystem.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"));\n\t }",
"{\n\t\tSystem.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"));\n\t }",
"System.out.print(a[i]+((i!=n-1)?\" \":\"\\n\"))",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i]+((i!=n-1)?\" \":\"\\n\")",
"a[i]",
"a",
"i",
"((i!=n-1)?\" \":\"\\n\")",
"(i!=n-1)",
"i",
"n-1",
"n",
"1",
"\" \"",
"\"\\n\"",
"System.out.println(k)",
"System.out.println",
"System.out",
"System",
"System.out",
"k",
"String args[]",
"args"
] | import java.io.*;
class Main
{
public static void main(String args[])throws IOException
{
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
int n,k=0;
n=Integer.parseInt(input.readLine());
String str=input.readLine();
String str_ary[]=str.split(" ");
int a[]=new int[n];
for(int i=0;i<n;i++)
{
a[i]=Integer.parseInt(str_ary[i]);
}
for(int i=0;i<n;i++)
{
for(int j=n-1;j>i;j--)
{
if(a[j]<a[j-1])
{
int tmp=a[j];
a[j]=a[j-1];
a[j-1]=tmp;
k++;
}
}
}
for(int i=0;i<n;i++)
{
System.out.print(a[i]+((i!=n-1)?" ":"\n"));
}
System.out.println(k);
}
} |
[
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,
41,
13,
17,
42,
40,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
18,
13,
13,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
173,
5
],
[
173,
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
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
46,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
53,
60
],
[
60,
61
],
[
60,
62
],
[
53,
63
],
[
63,
64
],
[
64,
65
],
[
53,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
79,
82
],
[
82,
83
],
[
82,
84
],
[
79,
85
],
[
78,
86
],
[
86,
87
],
[
78,
88
],
[
88,
89
],
[
88,
90
],
[
8,
91
],
[
91,
92
],
[
91,
93
],
[
8,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
94,
99
],
[
6,
100
],
[
100,
101
],
[
173,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
104,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
114,
116
],
[
104,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
102,
122
],
[
122,
123
],
[
102,
124
],
[
124,
125
],
[
102,
126
],
[
126,
127
],
[
173,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
131,
143
],
[
143,
144
],
[
144,
145
],
[
131,
146
],
[
147,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
130,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
128,
170
],
[
170,
171
],
[
0,
172
],
[
172,
173
],
[
172,
174
]
] | [
"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 int[] a = new int[n];\n\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n\n int swapCount = 0;\n boolean sorted = false;\n while (!sorted) {\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }\n printlnArray(a);\n System.out.println(swapCount);\n }\n \n static void swap(int[] a, int i, int j) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n \n private static void printlnArray(int[] a) {\n for (int i = 0; i < a.length - 1; i++) {\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[a.length - 1]);\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 int[] a = new int[n];\n\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n\n int swapCount = 0;\n boolean sorted = false;\n while (!sorted) {\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }\n printlnArray(a);\n System.out.println(swapCount);\n }\n \n static void swap(int[] a, int i, int j) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n \n private static void printlnArray(int[] a) {\n for (int i = 0; i < a.length - 1; i++) {\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[a.length - 1]);\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\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n\n int swapCount = 0;\n boolean sorted = false;\n while (!sorted) {\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }\n printlnArray(a);\n System.out.println(swapCount);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] a = new int[n];\n\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n\n int swapCount = 0;\n boolean sorted = false;\n while (!sorted) {\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }\n printlnArray(a);\n System.out.println(swapCount);\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",
"int swapCount = 0;",
"swapCount",
"0",
"boolean sorted = false;",
"sorted",
"false",
"while (!sorted) {\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }",
"!sorted",
"sorted",
"{\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }",
"sorted = true",
"sorted",
"true",
"for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }",
"int i = n - 1;",
"int i = n - 1;",
"i",
"n - 1",
"n",
"1",
"i >= 1",
"i",
"1",
"i--",
"i--",
"i",
"{\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }",
"{\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }",
"if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }",
"a[i] < a[i - 1]",
"a[i]",
"a",
"i",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"{\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }",
"swap(a, i-1, i)",
"swap",
"a",
"i-1",
"i",
"1",
"i",
"swapCount++",
"swapCount",
"sorted = false",
"sorted",
"false",
"printlnArray(a)",
"printlnArray",
"a",
"System.out.println(swapCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapCount",
"String[] args",
"args",
"static void swap(int[] a, int i, int j) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }",
"swap",
"{\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",
"int i",
"i",
"int j",
"j",
"private static void printlnArray(int[] a) {\n for (int i = 0; i < a.length - 1; i++) {\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[a.length - 1]);\n }",
"printlnArray",
"{\n for (int i = 0; i < a.length - 1; i++) {\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[a.length - 1]);\n }",
"for (int i = 0; i < a.length - 1; i++) {\n System.out.print(a[i] + \" \");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length - 1",
"i",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(a[i] + \" \");\n }",
"{\n System.out.print(a[i] + \" \");\n }",
"System.out.print(a[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i] + \" \"",
"a[i]",
"a",
"i",
"\" \"",
"System.out.println(a[a.length - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[a.length - 1]",
"a",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"int[] a",
"a",
"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\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n\n int swapCount = 0;\n boolean sorted = false;\n while (!sorted) {\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }\n printlnArray(a);\n System.out.println(swapCount);\n }\n \n static void swap(int[] a, int i, int j) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n \n private static void printlnArray(int[] a) {\n for (int i = 0; i < a.length - 1; i++) {\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[a.length - 1]);\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\n for (int i = 0; i < n; i++)\n a[i] = sc.nextInt();\n\n int swapCount = 0;\n boolean sorted = false;\n while (!sorted) {\n sorted = true;\n for (int i = n - 1; i >= 1; i--) {\n if (a[i] < a[i - 1]) {\n swap(a, i-1, i);\n swapCount++;\n sorted = false;\n }\n }\n }\n printlnArray(a);\n System.out.println(swapCount);\n }\n \n static void swap(int[] a, int i, int j) {\n int temp = a[i];\n a[i] = a[j];\n a[j] = temp;\n }\n \n private static void printlnArray(int[] a) {\n for (int i = 0; i < a.length - 1; i++) {\n System.out.print(a[i] + \" \");\n }\n System.out.println(a[a.length - 1]);\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();
int swapCount = 0;
boolean sorted = false;
while (!sorted) {
sorted = true;
for (int i = n - 1; i >= 1; i--) {
if (a[i] < a[i - 1]) {
swap(a, i-1, i);
swapCount++;
sorted = false;
}
}
}
printlnArray(a);
System.out.println(swapCount);
}
static void swap(int[] a, int i, int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
private static void printlnArray(int[] a) {
for (int i = 0; i < a.length - 1; i++) {
System.out.print(a[i] + " ");
}
System.out.println(a[a.length - 1]);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
17,
0,
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,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
159,
5
],
[
159,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
8,
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
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
8,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
59,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
59,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
75,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
74,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
84,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
84,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
99,
105
],
[
84,
106
],
[
106,
107
],
[
84,
108
],
[
108,
109
],
[
108,
110
],
[
8,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
111,
122
],
[
123,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
129,
131
],
[
123,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
132,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
8,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
8,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
6,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int size = 0, time = 0, b = 0;\n boolean flag = true;\n size = sc.nextInt();\n int[] a = new int[size];\n for (int i = 0; i < size; i++) {\n a[i] = sc.nextInt();\n }\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }\n for (int k = 0; k < size; k++) {\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }\n System.out.print(\"\\n\");\n System.out.println(time);\n\n\n }\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 size = 0, time = 0, b = 0;\n boolean flag = true;\n size = sc.nextInt();\n int[] a = new int[size];\n for (int i = 0; i < size; i++) {\n a[i] = sc.nextInt();\n }\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }\n for (int k = 0; k < size; k++) {\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }\n System.out.print(\"\\n\");\n System.out.println(time);\n\n\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int size = 0, time = 0, b = 0;\n boolean flag = true;\n size = sc.nextInt();\n int[] a = new int[size];\n for (int i = 0; i < size; i++) {\n a[i] = sc.nextInt();\n }\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }\n for (int k = 0; k < size; k++) {\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }\n System.out.print(\"\\n\");\n System.out.println(time);\n\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int size = 0, time = 0, b = 0;\n boolean flag = true;\n size = sc.nextInt();\n int[] a = new int[size];\n for (int i = 0; i < size; i++) {\n a[i] = sc.nextInt();\n }\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }\n for (int k = 0; k < size; k++) {\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }\n System.out.print(\"\\n\");\n System.out.println(time);\n\n\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int size = 0",
"size",
"0",
"time = 0",
"time",
"0",
"b = 0;",
"b",
"0",
"boolean flag = true;",
"flag",
"true",
"size = sc.nextInt()",
"size",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] a = new int[size];",
"a",
"new int[size]",
"size",
"for (int i = 0; i < size; i++) {\n a[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < size",
"i",
"size",
"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",
"while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }",
"int j = size - 1;",
"int j = size - 1;",
"j",
"size - 1",
"size",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }",
"{\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }",
"if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }",
"a[j] < a[j - 1]",
"a[j]",
"a",
"j",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"{\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }",
"b = a[j]",
"b",
"a[j]",
"a",
"j",
"a[j] = a[j - 1]",
"a[j]",
"a",
"j",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"a[j - 1] = b",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"b",
"time++",
"time",
"flag = true",
"flag",
"true",
"for (int k = 0; k < size; k++) {\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }",
"int k = 0;",
"int k = 0;",
"k",
"0",
"k < size",
"k",
"size",
"k++",
"k++",
"k",
"{\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }",
"{\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }",
"System.out.print(a[k])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[k]",
"a",
"k",
"if(k != (size-1))System.out.print(\" \");",
"k != (size-1)",
"k",
"(size-1)",
"size",
"1",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"",
"System.out.println(time)",
"System.out.println",
"System.out",
"System",
"System.out",
"time",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int size = 0, time = 0, b = 0;\n boolean flag = true;\n size = sc.nextInt();\n int[] a = new int[size];\n for (int i = 0; i < size; i++) {\n a[i] = sc.nextInt();\n }\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }\n for (int k = 0; k < size; k++) {\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }\n System.out.print(\"\\n\");\n System.out.println(time);\n\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int size = 0, time = 0, b = 0;\n boolean flag = true;\n size = sc.nextInt();\n int[] a = new int[size];\n for (int i = 0; i < size; i++) {\n a[i] = sc.nextInt();\n }\n while (flag) {\n flag = false;\n for (int j = size - 1; j > 0; j--) {\n if (a[j] < a[j - 1]) {\n b = a[j];\n a[j] = a[j - 1];\n a[j - 1] = b;\n time++;\n flag = true;\n }\n }\n }\n for (int k = 0; k < size; k++) {\n System.out.print(a[k]);\n if(k != (size-1))System.out.print(\" \");\n }\n System.out.print(\"\\n\");\n System.out.println(time);\n\n\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int size = 0, time = 0, b = 0;
boolean flag = true;
size = sc.nextInt();
int[] a = new int[size];
for (int i = 0; i < size; i++) {
a[i] = sc.nextInt();
}
while (flag) {
flag = false;
for (int j = size - 1; j > 0; j--) {
if (a[j] < a[j - 1]) {
b = a[j];
a[j] = a[j - 1];
a[j - 1] = b;
time++;
flag = true;
}
}
}
for (int k = 0; k < size; k++) {
System.out.print(a[k]);
if(k != (size-1))System.out.print(" ");
}
System.out.print("\n");
System.out.println(time);
}
}
|
[
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,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
40,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
11,
1,
0,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
160,
5
],
[
160,
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
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
49,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
53,
60
],
[
60,
61
],
[
60,
62
],
[
53,
63
],
[
63,
64
],
[
64,
65
],
[
53,
66
],
[
67,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
68,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
78,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
78,
102
],
[
102,
103
],
[
102,
104
],
[
8,
105
],
[
105,
106
],
[
105,
107
],
[
105,
108
],
[
8,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
109,
114
],
[
6,
115
],
[
115,
116
],
[
160,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
120,
121
],
[
119,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
122,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
122,
132
],
[
132,
133
],
[
133,
134
],
[
122,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
119,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
117,
155
],
[
155,
156
],
[
117,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] | [
"import java.util.Scanner;\n\npublic class Main{\npublic static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int A[] = new int[100];\n\n for(int i=0;i<n;i++){\n A[i] = scan.nextInt();\n }\n int count = 0;\n boolean flag = true;\n while(flag){\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }\n printArray(A, n);\n System.out.println(count);\n }\n\n // スペース区切りで表示\n public static void printArray(int A[], int n){\n int i;\n for(i=0;i<n-1;i++){\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[i]);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\npublic static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int A[] = new int[100];\n\n for(int i=0;i<n;i++){\n A[i] = scan.nextInt();\n }\n int count = 0;\n boolean flag = true;\n while(flag){\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }\n printArray(A, n);\n System.out.println(count);\n }\n\n // スペース区切りで表示\n public static void printArray(int A[], int n){\n int i;\n for(i=0;i<n-1;i++){\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[i]);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int A[] = new int[100];\n\n for(int i=0;i<n;i++){\n A[i] = scan.nextInt();\n }\n int count = 0;\n boolean flag = true;\n while(flag){\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }\n printArray(A, n);\n System.out.println(count);\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int A[] = new int[100];\n\n for(int i=0;i<n;i++){\n A[i] = scan.nextInt();\n }\n int count = 0;\n boolean flag = true;\n while(flag){\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }\n printArray(A, n);\n System.out.println(count);\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int A[] = new int[100];",
"A",
"new int[100]",
"100",
"for(int i=0;i<n;i++){\n A[i] = scan.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = scan.nextInt();\n }",
"{\n A[i] = scan.nextInt();\n }",
"A[i] = scan.nextInt()",
"A[i]",
"A",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"while(flag){\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }",
"int i=n-1;",
"int i=n-1;",
"i",
"n-1",
"n",
"1",
"i>=1",
"i",
"1",
"i--",
"i--",
"i",
"{\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }",
"{\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }",
"if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }",
"A[i] < A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }",
"count++",
"count",
"int tmp = A[i];",
"tmp",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i-1] = tmp",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"tmp",
"flag = true",
"flag",
"true",
"printArray(A, n)",
"printArray",
"A",
"n",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"// スペース区切りで表示\n public static void printArray(int A[], int n){\n int i;\n for(i=0;i<n-1;i++){\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[i]);\n }",
"printArray",
"{\n int i;\n for(i=0;i<n-1;i++){\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[i]);\n }",
"int i;",
"i",
"for(i=0;i<n-1;i++){\n System.out.print(A[i] + \" \");\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(A[i] + \" \");\n }",
"{\n System.out.print(A[i] + \" \");\n }",
"System.out.print(A[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i] + \" \"",
"A[i]",
"A",
"i",
"\" \"",
"System.out.println(A[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"int A[]",
"A",
"int n",
"n",
"public class Main{\npublic static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int A[] = new int[100];\n\n for(int i=0;i<n;i++){\n A[i] = scan.nextInt();\n }\n int count = 0;\n boolean flag = true;\n while(flag){\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }\n printArray(A, n);\n System.out.println(count);\n }\n\n // スペース区切りで表示\n public static void printArray(int A[], int n){\n int i;\n for(i=0;i<n-1;i++){\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[i]);\n }\n}",
"public class Main{\npublic static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n int A[] = new int[100];\n\n for(int i=0;i<n;i++){\n A[i] = scan.nextInt();\n }\n int count = 0;\n boolean flag = true;\n while(flag){\n flag = false;\n for(int i=n-1;i>=1;i--){\n if(A[i] < A[i-1]){\n count++;\n // 要素の交換\n int tmp = A[i];\n A[i] = A[i-1];\n A[i-1] = tmp;\n flag = true;\n }\n }\n }\n printArray(A, n);\n System.out.println(count);\n }\n\n // スペース区切りで表示\n public static void printArray(int A[], int n){\n int i;\n for(i=0;i<n-1;i++){\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[i]);\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();
int A[] = new int[100];
for(int i=0;i<n;i++){
A[i] = scan.nextInt();
}
int count = 0;
boolean flag = true;
while(flag){
flag = false;
for(int i=n-1;i>=1;i--){
if(A[i] < A[i-1]){
count++;
// 要素の交換
int tmp = A[i];
A[i] = A[i-1];
A[i-1] = tmp;
flag = true;
}
}
}
printArray(A, n);
System.out.println(count);
}
// スペース区切りで表示
public static void printArray(int A[], int n){
int i;
for(i=0;i<n-1;i++){
System.out.print(A[i] + " ");
}
System.out.println(A[i]);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
4,
13,
13,
23,
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,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
2,
13,
17,
18,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
14,
2,
18,
13,
13,
17,
29,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
18,
13,
13,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
182,
5
],
[
182,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
6,
17
],
[
17,
18
],
[
182,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
21,
27
],
[
27,
28
],
[
27,
29
],
[
21,
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
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
21,
51
],
[
51,
52
],
[
51,
53
],
[
21,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
54,
64
],
[
64,
65
],
[
65,
66
],
[
54,
67
],
[
68,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
69,
78
],
[
78,
79
],
[
78,
80
],
[
69,
81
],
[
81,
82
],
[
82,
83
],
[
69,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
93,
95
],
[
86,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
96,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
96,
118
],
[
118,
119
],
[
21,
120
],
[
120,
121
],
[
120,
122
],
[
21,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
19,
129
],
[
129,
130
],
[
182,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
134,
140
],
[
133,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
141,
153
],
[
153,
154
],
[
154,
155
],
[
141,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
162,
166
],
[
133,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
174,
178
],
[
131,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n try (Scanner in = new Scanner(System.in)) {\n solve(in);\n }\n }\n\n private static void solve(Scanner in) {\n final int N = in.nextInt();\n final int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n\n int count = 0;\n for (int i = 0; i < A.length; i++) {\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }\n print(A);\n System.out.println(count);\n }\n\n private static void print(int[] A) {\n if (A.length == 0)\n return;\n for (int i = 0; i < A.length - 1; i++)\n System.out.print(A[i] + \" \");\n System.out.println(A[A.length - 1]);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n try (Scanner in = new Scanner(System.in)) {\n solve(in);\n }\n }\n\n private static void solve(Scanner in) {\n final int N = in.nextInt();\n final int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n\n int count = 0;\n for (int i = 0; i < A.length; i++) {\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }\n print(A);\n System.out.println(count);\n }\n\n private static void print(int[] A) {\n if (A.length == 0)\n return;\n for (int i = 0; i < A.length - 1; i++)\n System.out.print(A[i] + \" \");\n System.out.println(A[A.length - 1]);\n }\n}",
"Main",
"public static void main(String[] args) {\n try (Scanner in = new Scanner(System.in)) {\n solve(in);\n }\n }",
"main",
"{\n try (Scanner in = new Scanner(System.in)) {\n solve(in);\n }\n }",
"try (Scanner in = new Scanner(System.in)) {\n solve(in);\n }",
"{\n solve(in);\n }",
"Scanner in = new Scanner(System.in)",
"Scanner in = new Scanner(System.in)",
"new Scanner(System.in)",
"solve(in)",
"solve",
"in",
"String[] args",
"args",
"private static void solve(Scanner in) {\n final int N = in.nextInt();\n final int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n\n int count = 0;\n for (int i = 0; i < A.length; i++) {\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }\n print(A);\n System.out.println(count);\n }",
"solve",
"{\n final int N = in.nextInt();\n final int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n\n int count = 0;\n for (int i = 0; i < A.length; i++) {\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }\n print(A);\n System.out.println(count);\n }",
"final int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"final int[] A = new int[N];",
"A",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = in.nextInt();\n }",
"{\n A[i] = in.nextInt();\n }",
"A[i] = in.nextInt()",
"A[i]",
"A",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < A.length; i++) {\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }",
"{\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }",
"for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }",
"int j = A.length - 1;",
"int j = A.length - 1;",
"j",
"A.length - 1",
"A.length",
"A",
"A.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }",
"{\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }",
"if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }",
"A[j - 1] > A[j]",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j]",
"A",
"j",
"{\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }",
"int temp = A[j];",
"temp",
"A[j]",
"A",
"j",
"A[j] = A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j - 1] = temp",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"temp",
"count++",
"count",
"print(A)",
"print",
"A",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"Scanner in",
"in",
"private static void print(int[] A) {\n if (A.length == 0)\n return;\n for (int i = 0; i < A.length - 1; i++)\n System.out.print(A[i] + \" \");\n System.out.println(A[A.length - 1]);\n }",
"print",
"{\n if (A.length == 0)\n return;\n for (int i = 0; i < A.length - 1; i++)\n System.out.print(A[i] + \" \");\n System.out.println(A[A.length - 1]);\n }",
"if (A.length == 0)\n return;",
"A.length == 0",
"A.length",
"A",
"A.length",
"0",
"return;",
"for (int i = 0; i < A.length - 1; i++)\n System.out.print(A[i] + \" \");",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < A.length - 1",
"i",
"A.length - 1",
"A.length",
"A",
"A.length",
"1",
"i++",
"i++",
"i",
"System.out.print(A[i] + \" \");",
"System.out.print(A[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i] + \" \"",
"A[i]",
"A",
"i",
"\" \"",
"System.out.println(A[A.length - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[A.length - 1]",
"A",
"A.length - 1",
"A.length",
"A",
"A.length",
"1",
"int[] A",
"A",
"public class Main {\n\n public static void main(String[] args) {\n try (Scanner in = new Scanner(System.in)) {\n solve(in);\n }\n }\n\n private static void solve(Scanner in) {\n final int N = in.nextInt();\n final int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n\n int count = 0;\n for (int i = 0; i < A.length; i++) {\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }\n print(A);\n System.out.println(count);\n }\n\n private static void print(int[] A) {\n if (A.length == 0)\n return;\n for (int i = 0; i < A.length - 1; i++)\n System.out.print(A[i] + \" \");\n System.out.println(A[A.length - 1]);\n }\n}",
"public class Main {\n\n public static void main(String[] args) {\n try (Scanner in = new Scanner(System.in)) {\n solve(in);\n }\n }\n\n private static void solve(Scanner in) {\n final int N = in.nextInt();\n final int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n\n int count = 0;\n for (int i = 0; i < A.length; i++) {\n for (int j = A.length - 1; j > i; j--) {\n if (A[j - 1] > A[j]) {\n int temp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = temp;\n count++;\n }\n }\n // print(A);\n // System.out.println(count);\n }\n print(A);\n System.out.println(count);\n }\n\n private static void print(int[] A) {\n if (A.length == 0)\n return;\n for (int i = 0; i < A.length - 1; i++)\n System.out.print(A[i] + \" \");\n System.out.println(A[A.length - 1]);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try (Scanner in = new Scanner(System.in)) {
solve(in);
}
}
private static void solve(Scanner in) {
final int N = in.nextInt();
final int[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = in.nextInt();
}
int count = 0;
for (int i = 0; i < A.length; i++) {
for (int j = A.length - 1; j > i; j--) {
if (A[j - 1] > A[j]) {
int temp = A[j];
A[j] = A[j - 1];
A[j - 1] = temp;
count++;
}
}
// print(A);
// System.out.println(count);
}
print(A);
System.out.println(count);
}
private static void print(int[] A) {
if (A.length == 0)
return;
for (int i = 0; i < A.length - 1; i++)
System.out.print(A[i] + " ");
System.out.println(A[A.length - 1]);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
42,
4,
18,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
13,
18,
13,
13,
4,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
18,
13,
17,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
29,
17,
23,
13,
12,
13,
30,
4,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
181,
5
],
[
181,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
11,
12
],
[
10,
13
],
[
6,
14
],
[
14,
15
],
[
181,
16
],
[
16,
17
],
[
16,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
18,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
26,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
37,
42
],
[
26,
43
],
[
43,
44
],
[
43,
45
],
[
26,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
46,
58
],
[
58,
59
],
[
59,
60
],
[
46,
61
],
[
62,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
63,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
63,
77
],
[
77,
78
],
[
78,
79
],
[
63,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
83,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
82,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
96,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
96,
118
],
[
118,
119
],
[
26,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
120,
130
],
[
130,
131
],
[
131,
132
],
[
120,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
135,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
144,
146
],
[
135,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
26,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
26,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
18,
168
],
[
168,
169
],
[
16,
170
],
[
170,
171
],
[
181,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
172,
178
],
[
178,
179
],
[
0,
180
],
[
180,
181
],
[
180,
182
]
] | [
"import java.util.Scanner;\n\n/**\n * Created by ??\\??? on 2016/12/6.\n */\npublic class Main {\n static int si(String s) {\n return Integer.parseInt(s);\n }\n static int run(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()) {\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }\n return 1;\n }\n\n public static void main(String[] args) {\n run(args);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static int si(String s) {\n return Integer.parseInt(s);\n }\n static int run(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()) {\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }\n return 1;\n }\n\n public static void main(String[] args) {\n run(args);\n }\n}",
"Main",
"static int si(String s) {\n return Integer.parseInt(s);\n }",
"si",
"{\n return Integer.parseInt(s);\n }",
"return Integer.parseInt(s);",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"String s",
"s",
"static int run(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()) {\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }\n return 1;\n }",
"run",
"{\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()) {\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }\n return 1;\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"while(scan.hasNext()) {\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }",
"scan.hasNext()",
"scan.hasNext",
"scan",
"{\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }",
"int T = Integer.parseInt(scan.nextLine());",
"T",
"Integer.parseInt(scan.nextLine())",
"Integer.parseInt",
"Integer",
"scan.nextLine()",
"scan.nextLine",
"scan",
"String[] lines = scan.nextLine().split(\" \");",
"lines",
"scan.nextLine().split(\" \")",
"scan.nextLine().split",
"scan.nextLine()",
"scan.nextLine",
"scan",
"\" \"",
"int sum = 0;",
"sum",
"0",
"for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<lines.length-1",
"i",
"lines.length-1",
"lines.length",
"lines",
"lines.length",
"1",
"i++",
"i++",
"i",
"{\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }",
"{\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }",
"for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }",
"int j = lines.length - 1;",
"int j = lines.length - 1;",
"j",
"lines.length - 1",
"lines.length",
"lines",
"lines.length",
"1",
"j>=i+1",
"j",
"i+1",
"i",
"1",
"j--",
"j--",
"j",
"{\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }",
"{\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }",
"if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }",
"si(lines[j])<si(lines[j-1])",
"si(lines[j])",
"si",
"lines[j]",
"lines",
"j",
"si(lines[j-1])",
"si",
"lines[j-1]",
"lines",
"j-1",
"j",
"1",
"{\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }",
"String s = lines[j];",
"s",
"lines[j]",
"lines",
"j",
"lines[j] = lines[j-1]",
"lines[j]",
"lines",
"j",
"lines[j-1]",
"lines",
"j-1",
"j",
"1",
"lines[j-1] = s",
"lines[j-1]",
"lines",
"j-1",
"j",
"1",
"s",
"sum++",
"sum",
"for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<lines.length",
"i",
"lines.length",
"lines",
"lines.length",
"i++",
"i++",
"i",
"{\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }",
"{\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }",
"if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);",
"i==0",
"i",
"0",
"System.out.print(lines[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"lines[0]",
"lines",
"0",
"System.out.print(\" \"+lines[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"+lines[i]",
"\" \"",
"lines[i]",
"lines",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"return 1;",
"1",
"String[] args",
"args",
"public static void main(String[] args) {\n run(args);\n }",
"main",
"{\n run(args);\n }",
"run(args)",
"run",
"args",
"String[] args",
"args",
"public class Main {\n static int si(String s) {\n return Integer.parseInt(s);\n }\n static int run(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()) {\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }\n return 1;\n }\n\n public static void main(String[] args) {\n run(args);\n }\n}",
"public class Main {\n static int si(String s) {\n return Integer.parseInt(s);\n }\n static int run(String[] args){\n Scanner scan = new Scanner(System.in);\n while(scan.hasNext()) {\n int T = Integer.parseInt(scan.nextLine());\n String[] lines = scan.nextLine().split(\" \");\n int sum = 0;\n for(int i = 0;i<lines.length-1;i++){\n for(int j = lines.length - 1;j>=i+1;j--){\n if(si(lines[j])<si(lines[j-1])){\n String s = lines[j];\n lines[j] = lines[j-1];\n lines[j-1] = s;\n sum++;\n }\n }\n }\n for(int i = 0;i<lines.length;i++){\n if(i==0)\n System.out.print(lines[0]);\n else\n System.out.print(\" \"+lines[i]);\n }\n System.out.println();\n System.out.println(sum);\n\n }\n return 1;\n }\n\n public static void main(String[] args) {\n run(args);\n }\n}",
"Main"
] | import java.util.Scanner;
/**
* Created by ??\??? on 2016/12/6.
*/
public class Main {
static int si(String s) {
return Integer.parseInt(s);
}
static int run(String[] args){
Scanner scan = new Scanner(System.in);
while(scan.hasNext()) {
int T = Integer.parseInt(scan.nextLine());
String[] lines = scan.nextLine().split(" ");
int sum = 0;
for(int i = 0;i<lines.length-1;i++){
for(int j = lines.length - 1;j>=i+1;j--){
if(si(lines[j])<si(lines[j-1])){
String s = lines[j];
lines[j] = lines[j-1];
lines[j-1] = s;
sum++;
}
}
}
for(int i = 0;i<lines.length;i++){
if(i==0)
System.out.print(lines[0]);
else
System.out.print(" "+lines[i]);
}
System.out.println();
System.out.println(sum);
}
return 1;
}
public static void main(String[] args) {
run(args);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
38,
5,
13,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
41,
13,
41,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
41,
13,
17,
0,
13,
4,
13,
13,
13,
41,
13,
20,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
4,
18,
13,
17,
4,
18,
13,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
0,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
0,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
29,
13,
23,
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
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
16,
21
],
[
12,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
25,
28
],
[
28,
29
],
[
29,
30
],
[
22,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
33,
38
],
[
22,
39
],
[
39,
40
],
[
39,
41
],
[
22,
43
],
[
43,
44
],
[
22,
45
],
[
45,
46
],
[
22,
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
],
[
60,
64
],
[
64,
65
],
[
65,
66
],
[
64,
67
],
[
67,
68
],
[
67,
69
],
[
22,
70
],
[
70,
71
],
[
70,
72
],
[
22,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
75,
78
],
[
22,
79
],
[
79,
80
],
[
79,
81
],
[
22,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
82,
87
],
[
87,
88
],
[
87,
89
],
[
82,
90
],
[
90,
91
],
[
91,
92
],
[
82,
93
],
[
94,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
94,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
22,
105
],
[
105,
106
],
[
106,
107
],
[
105,
108
],
[
108,
109
],
[
109,
110
],
[
108,
111
],
[
22,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
112,
117
],
[
22,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
22,
124
],
[
124,
125
],
[
125,
126
],
[
6,
127
],
[
127,
128
],
[
4,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
131,
134
],
[
134,
135
],
[
131,
136
],
[
136,
137
],
[
131,
138
],
[
138,
139
],
[
131,
140
],
[
140,
141
],
[
140,
142
],
[
131,
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
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
156,
163
],
[
163,
164
],
[
163,
165
],
[
156,
166
],
[
166,
167
],
[
167,
168
],
[
156,
169
],
[
170,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
171,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
181,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
192,
194
],
[
189,
195
],
[
195,
196
],
[
195,
197
],
[
181,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
181,
203
],
[
203,
204
],
[
131,
205
],
[
205,
206
],
[
129,
207
],
[
207,
208
],
[
129,
209
],
[
209,
210
]
] | [
"import java.io.*;\n \nclass Main {\n\t\n public static void main(String[] args) {\n BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n try {\n int n = Integer.parseInt( kb.readLine() );\n\t\t\tString[] nums = kb.readLine().split( \" \" );\n\t\t\tint[] A = new int[n];\n int i, j;\n \n for( i=0; i<n; i++ ) {\n \tA[i] = Integer.parseInt( nums[i] );\n }\n \n int cnt = 0;\n\t\t\tcnt = bubbleSort( A, n );\n\t\t\t\n StringBuilder output = new StringBuilder( 200+1 );\n for( i=0; i<n; i++ ) {\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }\n output.deleteCharAt( output.lastIndexOf( \" \" ) );\n\n System.out.println( output );\n System.out.println( cnt );\n\t\t\t \n kb.close();\n } catch( IOException e ) {\n System.err.println( e );\n } \n }\n \n static int bubbleSort( int[] A, int n ) \n {\n \tint tmp;\n \tint i, j, cnt;\n \t\n \tcnt = 0;\n \t\tfor( i=0; i<n; i++ ) {\n \t\t\tfor( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn cnt;\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main {\n\t\n public static void main(String[] args) {\n BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n try {\n int n = Integer.parseInt( kb.readLine() );\n\t\t\tString[] nums = kb.readLine().split( \" \" );\n\t\t\tint[] A = new int[n];\n int i, j;\n \n for( i=0; i<n; i++ ) {\n \tA[i] = Integer.parseInt( nums[i] );\n }\n \n int cnt = 0;\n\t\t\tcnt = bubbleSort( A, n );\n\t\t\t\n StringBuilder output = new StringBuilder( 200+1 );\n for( i=0; i<n; i++ ) {\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }\n output.deleteCharAt( output.lastIndexOf( \" \" ) );\n\n System.out.println( output );\n System.out.println( cnt );\n\t\t\t \n kb.close();\n } catch( IOException e ) {\n System.err.println( e );\n } \n }\n \n static int bubbleSort( int[] A, int n ) \n {\n \tint tmp;\n \tint i, j, cnt;\n \t\n \tcnt = 0;\n \t\tfor( i=0; i<n; i++ ) {\n \t\t\tfor( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn cnt;\n }\n}",
"Main",
"public static void main(String[] args) {\n BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n try {\n int n = Integer.parseInt( kb.readLine() );\n\t\t\tString[] nums = kb.readLine().split( \" \" );\n\t\t\tint[] A = new int[n];\n int i, j;\n \n for( i=0; i<n; i++ ) {\n \tA[i] = Integer.parseInt( nums[i] );\n }\n \n int cnt = 0;\n\t\t\tcnt = bubbleSort( A, n );\n\t\t\t\n StringBuilder output = new StringBuilder( 200+1 );\n for( i=0; i<n; i++ ) {\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }\n output.deleteCharAt( output.lastIndexOf( \" \" ) );\n\n System.out.println( output );\n System.out.println( cnt );\n\t\t\t \n kb.close();\n } catch( IOException e ) {\n System.err.println( e );\n } \n }",
"main",
"{\n BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );\n try {\n int n = Integer.parseInt( kb.readLine() );\n\t\t\tString[] nums = kb.readLine().split( \" \" );\n\t\t\tint[] A = new int[n];\n int i, j;\n \n for( i=0; i<n; i++ ) {\n \tA[i] = Integer.parseInt( nums[i] );\n }\n \n int cnt = 0;\n\t\t\tcnt = bubbleSort( A, n );\n\t\t\t\n StringBuilder output = new StringBuilder( 200+1 );\n for( i=0; i<n; i++ ) {\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }\n output.deleteCharAt( output.lastIndexOf( \" \" ) );\n\n System.out.println( output );\n System.out.println( cnt );\n\t\t\t \n kb.close();\n } catch( IOException e ) {\n System.err.println( e );\n } \n }",
"BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );",
"kb",
"new BufferedReader( new InputStreamReader( System.in ) )",
"try {\n int n = Integer.parseInt( kb.readLine() );\n\t\t\tString[] nums = kb.readLine().split( \" \" );\n\t\t\tint[] A = new int[n];\n int i, j;\n \n for( i=0; i<n; i++ ) {\n \tA[i] = Integer.parseInt( nums[i] );\n }\n \n int cnt = 0;\n\t\t\tcnt = bubbleSort( A, n );\n\t\t\t\n StringBuilder output = new StringBuilder( 200+1 );\n for( i=0; i<n; i++ ) {\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }\n output.deleteCharAt( output.lastIndexOf( \" \" ) );\n\n System.out.println( output );\n System.out.println( cnt );\n\t\t\t \n kb.close();\n } catch( IOException e ) {\n System.err.println( e );\n }",
"catch( IOException e ) {\n System.err.println( e );\n }",
"IOException e",
"{\n System.err.println( e );\n }",
"System.err.println( e )",
"System.err.println",
"System.err",
"System",
"System.err",
"e",
"{\n int n = Integer.parseInt( kb.readLine() );\n\t\t\tString[] nums = kb.readLine().split( \" \" );\n\t\t\tint[] A = new int[n];\n int i, j;\n \n for( i=0; i<n; i++ ) {\n \tA[i] = Integer.parseInt( nums[i] );\n }\n \n int cnt = 0;\n\t\t\tcnt = bubbleSort( A, n );\n\t\t\t\n StringBuilder output = new StringBuilder( 200+1 );\n for( i=0; i<n; i++ ) {\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }\n output.deleteCharAt( output.lastIndexOf( \" \" ) );\n\n System.out.println( output );\n System.out.println( cnt );\n\t\t\t \n kb.close();\n }",
"int n = Integer.parseInt( kb.readLine() );",
"n",
"Integer.parseInt( kb.readLine() )",
"Integer.parseInt",
"Integer",
"kb.readLine()",
"kb.readLine",
"kb",
"String[] nums = kb.readLine().split( \" \" );",
"nums",
"kb.readLine().split( \" \" )",
"kb.readLine().split",
"kb.readLine()",
"kb.readLine",
"kb",
"\" \"",
"int[] A = new int[n];",
"A",
"new int[n]",
"n",
"int i",
"i",
"j;",
"j",
"for( i=0; i<n; i++ ) {\n \tA[i] = Integer.parseInt( nums[i] );\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \tA[i] = Integer.parseInt( nums[i] );\n }",
"{\n \tA[i] = Integer.parseInt( nums[i] );\n }",
"A[i] = Integer.parseInt( nums[i] )",
"A[i]",
"A",
"i",
"Integer.parseInt( nums[i] )",
"Integer.parseInt",
"Integer",
"nums[i]",
"nums",
"i",
"int cnt = 0;",
"cnt",
"0",
"cnt = bubbleSort( A, n )",
"cnt",
"bubbleSort( A, n )",
"bubbleSort",
"A",
"n",
"StringBuilder output = new StringBuilder( 200+1 );",
"output",
"new StringBuilder( 200+1 )",
"for( i=0; i<n; i++ ) {\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }",
"{\n \toutput.append( A[i] );\n \toutput.append( \" \" );\n }",
"output.append( A[i] )",
"output.append",
"output",
"A[i]",
"A",
"i",
"output.append( \" \" )",
"output.append",
"output",
"\" \"",
"output.deleteCharAt( output.lastIndexOf( \" \" ) )",
"output.deleteCharAt",
"output",
"output.lastIndexOf( \" \" )",
"output.lastIndexOf",
"output",
"\" \"",
"System.out.println( output )",
"System.out.println",
"System.out",
"System",
"System.out",
"output",
"System.out.println( cnt )",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"kb.close()",
"kb.close",
"kb",
"String[] args",
"args",
"static int bubbleSort( int[] A, int n ) \n {\n \tint tmp;\n \tint i, j, cnt;\n \t\n \tcnt = 0;\n \t\tfor( i=0; i<n; i++ ) {\n \t\t\tfor( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn cnt;\n }",
"bubbleSort",
"{\n \tint tmp;\n \tint i, j, cnt;\n \t\n \tcnt = 0;\n \t\tfor( i=0; i<n; i++ ) {\n \t\t\tfor( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn cnt;\n }",
"int tmp;",
"tmp",
"int i",
"i",
"j",
"j",
"cnt;",
"cnt",
"cnt = 0",
"cnt",
"0",
"for( i=0; i<n; i++ ) {\n \t\t\tfor( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}\n \t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \t\t\tfor( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}\n \t\t}",
"{\n \t\t\tfor( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}\n \t\t}",
"for( j=n-1; i<j; j-- ) {\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}",
"j=n-1;",
"j=n-1",
"j",
"n-1",
"n",
"1",
"i<j",
"i",
"j",
"j--",
"j--",
"j",
"{\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}",
"{\n \t\t\t\tif( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}\n \t\t\t}",
"if( A[j] < A[ j-1 ] ) {\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}",
"A[j] < A[ j-1 ]",
"A[j]",
"A",
"j",
"A[ j-1 ]",
"A",
"j-1",
"j",
"1",
"{\n \t\t\t\t\ttmp = A[ j-1 ];\n \t\t\t\t\tA[ j-1 ] = A[ j ];\n \t\t\t\t\tA[ j ] = tmp;\n \t\t\t\t\tcnt++;\n \t\t\t\t}",
"tmp = A[ j-1 ]",
"tmp",
"A[ j-1 ]",
"A",
"j-1",
"j",
"1",
"A[ j-1 ] = A[ j ]",
"A[ j-1 ]",
"A",
"j-1",
"j",
"1",
"A[ j ]",
"A",
"j",
"A[ j ] = tmp",
"A[ j ]",
"A",
"j",
"tmp",
"cnt++",
"cnt",
"return cnt;",
"cnt",
"int[] A",
"A",
"int n",
"n"
] | import java.io.*;
class Main {
public static void main(String[] args) {
BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
try {
int n = Integer.parseInt( kb.readLine() );
String[] nums = kb.readLine().split( " " );
int[] A = new int[n];
int i, j;
for( i=0; i<n; i++ ) {
A[i] = Integer.parseInt( nums[i] );
}
int cnt = 0;
cnt = bubbleSort( A, n );
StringBuilder output = new StringBuilder( 200+1 );
for( i=0; i<n; i++ ) {
output.append( A[i] );
output.append( " " );
}
output.deleteCharAt( output.lastIndexOf( " " ) );
System.out.println( output );
System.out.println( cnt );
kb.close();
} catch( IOException e ) {
System.err.println( e );
}
}
static int bubbleSort( int[] A, int n )
{
int tmp;
int i, j, cnt;
cnt = 0;
for( i=0; i<n; i++ ) {
for( j=n-1; i<j; j-- ) {
if( A[j] < A[ j-1 ] ) {
tmp = A[ j-1 ];
A[ j-1 ] = A[ j ];
A[ j ] = tmp;
cnt++;
}
}
}
return cnt;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
18,
13,
13,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
4,
18,
13,
17,
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,
20,
4,
18,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
4,
18,
13,
18,
13,
13,
17,
4,
18,
13,
2,
4,
18,
13,
17,
4,
18,
13,
17,
4,
18,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
6,
13,
41,
13,
12,
13,
30,
0,
13,
17,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
40,
13,
23,
13,
23,
13,
12,
13,
30,
29,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
13,
18
],
[
9,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
19,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
31,
32
],
[
32,
33
],
[
19,
34
],
[
34,
35
],
[
34,
36
],
[
19,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
43,
44
],
[
40,
45
],
[
19,
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
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
63,
66
],
[
66,
67
],
[
66,
68
],
[
19,
69
],
[
69,
70
],
[
69,
71
],
[
19,
72
],
[
72,
73
],
[
73,
74
],
[
72,
75
],
[
72,
76
],
[
19,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
77,
82
],
[
82,
83
],
[
82,
84
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
77,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
95,
97
],
[
90,
98
],
[
19,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
102,
106
],
[
19,
107
],
[
107,
108
],
[
108,
109
],
[
107,
110
],
[
19,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
115,
116
],
[
19,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
6,
123
],
[
123,
124
],
[
0,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
125,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
135,
137
],
[
131,
138
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
143,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
147,
154
],
[
154,
155
],
[
154,
156
],
[
147,
157
],
[
157,
158
],
[
158,
159
],
[
147,
160
],
[
161,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
163,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
169,
171
],
[
162,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
175,
177
],
[
172,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
178,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
172,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
190,
192
],
[
187,
193
],
[
172,
194
],
[
194,
195
],
[
194,
196
],
[
172,
197
],
[
197,
198
],
[
143,
199
],
[
199,
200
],
[
129,
201
],
[
201,
202
],
[
129,
203
],
[
203,
204
],
[
125,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
208,
209
]
] | [
"/* ALDS1_2_A */\nimport java.io.*;\n\nclass Main\n{\n public static void main(String[] args)\n {\n try{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();\n int n = Integer.parseInt(br.readLine());\n int[] array = new int[n];\n String[] str = br.readLine().split(\" \");\n\n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(str[i]);\n }\n\n BubbleSort bs = new BubbleSort();\n bs.bubbleSort(array, n);\n\n for(int i = 0; i < n ; i++){\n sb.append(array[i]).append(\" \");\n }\n sb.deleteCharAt(sb.length() - 1);\n sb.append(\"\\n\");\n sb.append(bs.getCount());\n\n System.out.println(sb);\n }catch(Exception e){\n System.out.println(e);\n }\n }\n}\n\nclass BubbleSort\n{\n private static int changeCount;\n\n public void bubbleSort(int[] A, int N)\n {\n changeCount = 0;\n boolean flag = true;\n int i = 0;\n\n while(flag){\n flag = false;\n for(int j = N-1; j > i; j--){\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }\n i++;\n }\n }\n\n public int getCount()\n {\n return changeCount;\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main\n{\n public static void main(String[] args)\n {\n try{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();\n int n = Integer.parseInt(br.readLine());\n int[] array = new int[n];\n String[] str = br.readLine().split(\" \");\n\n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(str[i]);\n }\n\n BubbleSort bs = new BubbleSort();\n bs.bubbleSort(array, n);\n\n for(int i = 0; i < n ; i++){\n sb.append(array[i]).append(\" \");\n }\n sb.deleteCharAt(sb.length() - 1);\n sb.append(\"\\n\");\n sb.append(bs.getCount());\n\n System.out.println(sb);\n }catch(Exception e){\n System.out.println(e);\n }\n }\n}",
"Main",
"public static void main(String[] args)\n {\n try{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();\n int n = Integer.parseInt(br.readLine());\n int[] array = new int[n];\n String[] str = br.readLine().split(\" \");\n\n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(str[i]);\n }\n\n BubbleSort bs = new BubbleSort();\n bs.bubbleSort(array, n);\n\n for(int i = 0; i < n ; i++){\n sb.append(array[i]).append(\" \");\n }\n sb.deleteCharAt(sb.length() - 1);\n sb.append(\"\\n\");\n sb.append(bs.getCount());\n\n System.out.println(sb);\n }catch(Exception e){\n System.out.println(e);\n }\n }",
"main",
"{\n try{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();\n int n = Integer.parseInt(br.readLine());\n int[] array = new int[n];\n String[] str = br.readLine().split(\" \");\n\n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(str[i]);\n }\n\n BubbleSort bs = new BubbleSort();\n bs.bubbleSort(array, n);\n\n for(int i = 0; i < n ; i++){\n sb.append(array[i]).append(\" \");\n }\n sb.deleteCharAt(sb.length() - 1);\n sb.append(\"\\n\");\n sb.append(bs.getCount());\n\n System.out.println(sb);\n }catch(Exception e){\n System.out.println(e);\n }\n }",
"try{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();\n int n = Integer.parseInt(br.readLine());\n int[] array = new int[n];\n String[] str = br.readLine().split(\" \");\n\n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(str[i]);\n }\n\n BubbleSort bs = new BubbleSort();\n bs.bubbleSort(array, n);\n\n for(int i = 0; i < n ; i++){\n sb.append(array[i]).append(\" \");\n }\n sb.deleteCharAt(sb.length() - 1);\n sb.append(\"\\n\");\n sb.append(bs.getCount());\n\n System.out.println(sb);\n }catch(Exception e){\n System.out.println(e);\n }",
"catch(Exception e){\n System.out.println(e);\n }",
"Exception e",
"{\n System.out.println(e);\n }",
"System.out.println(e)",
"System.out.println",
"System.out",
"System",
"System.out",
"e",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n StringBuilder sb = new StringBuilder();\n int n = Integer.parseInt(br.readLine());\n int[] array = new int[n];\n String[] str = br.readLine().split(\" \");\n\n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(str[i]);\n }\n\n BubbleSort bs = new BubbleSort();\n bs.bubbleSort(array, n);\n\n for(int i = 0; i < n ; i++){\n sb.append(array[i]).append(\" \");\n }\n sb.deleteCharAt(sb.length() - 1);\n sb.append(\"\\n\");\n sb.append(bs.getCount());\n\n System.out.println(sb);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int n = Integer.parseInt(br.readLine());",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"int[] array = new int[n];",
"array",
"new int[n]",
"n",
"String[] str = br.readLine().split(\" \");",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(str[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n array[i] = Integer.parseInt(str[i]);\n }",
"{\n array[i] = Integer.parseInt(str[i]);\n }",
"array[i] = Integer.parseInt(str[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"BubbleSort bs = new BubbleSort();",
"bs",
"new BubbleSort()",
"bs.bubbleSort(array, n)",
"bs.bubbleSort",
"bs",
"array",
"n",
"for(int i = 0; i < n ; i++){\n sb.append(array[i]).append(\" \");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n sb.append(array[i]).append(\" \");\n }",
"{\n sb.append(array[i]).append(\" \");\n }",
"sb.append(array[i]).append(\" \")",
"sb.append(array[i]).append",
"sb.append(array[i])",
"sb.append",
"sb",
"array[i]",
"array",
"i",
"\" \"",
"sb.deleteCharAt(sb.length() - 1)",
"sb.deleteCharAt",
"sb",
"sb.length() - 1",
"sb.length()",
"sb.length",
"sb",
"1",
"sb.append(\"\\n\")",
"sb.append",
"sb",
"\"\\n\"",
"sb.append(bs.getCount())",
"sb.append",
"sb",
"bs.getCount()",
"bs.getCount",
"bs",
"System.out.println(sb)",
"System.out.println",
"System.out",
"System",
"System.out",
"sb",
"String[] args",
"args",
"class BubbleSort\n{\n private static int changeCount;\n\n public void bubbleSort(int[] A, int N)\n {\n changeCount = 0;\n boolean flag = true;\n int i = 0;\n\n while(flag){\n flag = false;\n for(int j = N-1; j > i; j--){\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }\n i++;\n }\n }\n\n public int getCount()\n {\n return changeCount;\n }\n}",
"BubbleSort",
"private static int changeCount;",
"changeCount",
"public void bubbleSort(int[] A, int N)\n {\n changeCount = 0;\n boolean flag = true;\n int i = 0;\n\n while(flag){\n flag = false;\n for(int j = N-1; j > i; j--){\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }\n i++;\n }\n }",
"bubbleSort",
"{\n changeCount = 0;\n boolean flag = true;\n int i = 0;\n\n while(flag){\n flag = false;\n for(int j = N-1; j > i; j--){\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }\n i++;\n }\n }",
"changeCount = 0",
"changeCount",
"0",
"boolean flag = true;",
"flag",
"true",
"int i = 0;",
"i",
"0",
"while(flag){\n flag = false;\n for(int j = N-1; j > i; j--){\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }\n i++;\n }",
"flag",
"{\n flag = false;\n for(int j = N-1; j > i; j--){\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }\n i++;\n }",
"flag = false",
"flag",
"false",
"for(int j = N-1; j > i; j--){\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }",
"int j = N-1;",
"int j = N-1;",
"j",
"N-1",
"N",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }",
"{\n if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }\n }",
"if(A[j] < A[j-1]){\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n changeCount++;\n }",
"int tmp = A[j];",
"tmp",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = tmp",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"tmp",
"flag = true",
"flag",
"true",
"changeCount++",
"changeCount",
"i++",
"i",
"int[] A",
"A",
"int N",
"N",
"public int getCount()\n {\n return changeCount;\n }",
"getCount",
"{\n return changeCount;\n }",
"return changeCount;",
"changeCount"
] | /* ALDS1_2_A */
import java.io.*;
class Main
{
public static void main(String[] args)
{
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int n = Integer.parseInt(br.readLine());
int[] array = new int[n];
String[] str = br.readLine().split(" ");
for(int i = 0; i < n; i++){
array[i] = Integer.parseInt(str[i]);
}
BubbleSort bs = new BubbleSort();
bs.bubbleSort(array, n);
for(int i = 0; i < n ; i++){
sb.append(array[i]).append(" ");
}
sb.deleteCharAt(sb.length() - 1);
sb.append("\n");
sb.append(bs.getCount());
System.out.println(sb);
}catch(Exception e){
System.out.println(e);
}
}
}
class BubbleSort
{
private static int changeCount;
public void bubbleSort(int[] A, int N)
{
changeCount = 0;
boolean flag = true;
int i = 0;
while(flag){
flag = false;
for(int j = N-1; j > i; j--){
if(A[j] < A[j-1]){
int tmp = A[j];
A[j] = A[j-1];
A[j-1] = tmp;
flag = true;
changeCount++;
}
}
i++;
}
}
public int getCount()
{
return changeCount;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
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,
4,
13,
13,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
41,
13,
18,
13,
13,
41,
13,
2,
13,
17,
42,
2,
2,
13,
17,
2,
18,
13,
13,
13,
30,
0,
18,
13,
2,
13,
17,
18,
13,
13,
40,
13,
0,
18,
13,
2,
13,
17,
13,
4,
18,
18,
13,
13,
4,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
13,
2,
13,
17,
40,
13,
0,
13,
17,
4,
18,
18,
13,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
13,
17,
4,
18,
13,
18,
13,
13,
29,
4,
18,
13,
23,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
293,
8
],
[
293,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
22,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
11,
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
],
[
46,
48
],
[
45,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
52,
53
],
[
52,
54
],
[
11,
55
],
[
55,
56
],
[
55,
57
],
[
55,
58
],
[
9,
59
],
[
59,
60
],
[
293,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
69,
72
],
[
63,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
73,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
73,
83
],
[
83,
84
],
[
84,
85
],
[
73,
86
],
[
87,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
87,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
98,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
115,
116
],
[
115,
117
],
[
108,
118
],
[
118,
119
],
[
87,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
120,
126
],
[
87,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
132,
135
],
[
61,
136
],
[
136,
137
],
[
61,
138
],
[
138,
139
],
[
293,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
146,
147
],
[
146,
148
],
[
142,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
155,
162
],
[
162,
163
],
[
162,
164
],
[
155,
165
],
[
165,
166
],
[
166,
167
],
[
155,
168
],
[
169,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
170,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
181,
184
],
[
181,
185
],
[
185,
186
],
[
185,
187
],
[
180,
188
],
[
188,
189
],
[
180,
190
],
[
190,
191
],
[
190,
192
],
[
142,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
193,
198
],
[
198,
199
],
[
198,
200
],
[
198,
201
],
[
142,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
204,
206
],
[
202,
207
],
[
140,
208
],
[
208,
209
],
[
140,
210
],
[
210,
211
],
[
293,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
217,
219
],
[
214,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
220,
224
],
[
224,
225
],
[
224,
226
],
[
214,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
227,
231
],
[
212,
232
],
[
232,
233
],
[
212,
234
],
[
234,
235
],
[
212,
236
],
[
236,
237
],
[
293,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
241,
243
],
[
240,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
244,
249
],
[
249,
250
],
[
249,
251
],
[
244,
252
],
[
252,
253
],
[
253,
254
],
[
244,
255
],
[
256,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
257,
261
],
[
261,
262
],
[
262,
263
],
[
263,
264
],
[
262,
265
],
[
256,
266
],
[
266,
267
],
[
267,
268
],
[
266,
269
],
[
269,
270
],
[
269,
271
],
[
240,
272
],
[
272,
273
],
[
273,
274
],
[
274,
275
],
[
238,
276
],
[
276,
277
],
[
238,
278
],
[
278,
279
],
[
293,
280
],
[
280,
281
],
[
280,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
284,
287
],
[
287,
288
],
[
288,
289
],
[
280,
290
],
[
290,
291
],
[
0,
292
],
[
292,
293
],
[
292,
294
]
] | [
"\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n int N = readInt(r);\n String[] numStrings = r.readLine().split(\" \");\n int[] A = new int[N];\n for (int i = 0;i < N;i++) {\n A[i] = Integer.parseInt(numStrings[i]);\n }\n// insertionSort(A, N);\n bubbleSort(A, N);\n }\n \n public static void insertionSort(int[] A, int N) {\n System.out.println(dump(A, N));\n for (int i = 1;i <= (N - 1);i++) {\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }\n }\n \n public static void bubbleSort(int[] A, int N) {\n int swapCount = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(dump(A, N));\n System.out.println(swapCount);\n }\n \n public static void swapInt(int[] A, int j, int k) {\n int v = A[j];\n A[j] = A[k];\n A[k] = v;\n }\n \n public static String dump(int[] A, int N) {\n StringBuilder builder = new StringBuilder();\n for (int i = 0;i < N;i++) {\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }\n return builder.toString();\n }\n \n public static int readInt(BufferedReader r) throws Exception {\n return Integer.parseInt(r.readLine());\n }\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n int N = readInt(r);\n String[] numStrings = r.readLine().split(\" \");\n int[] A = new int[N];\n for (int i = 0;i < N;i++) {\n A[i] = Integer.parseInt(numStrings[i]);\n }\n// insertionSort(A, N);\n bubbleSort(A, N);\n }\n \n public static void insertionSort(int[] A, int N) {\n System.out.println(dump(A, N));\n for (int i = 1;i <= (N - 1);i++) {\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }\n }\n \n public static void bubbleSort(int[] A, int N) {\n int swapCount = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(dump(A, N));\n System.out.println(swapCount);\n }\n \n public static void swapInt(int[] A, int j, int k) {\n int v = A[j];\n A[j] = A[k];\n A[k] = v;\n }\n \n public static String dump(int[] A, int N) {\n StringBuilder builder = new StringBuilder();\n for (int i = 0;i < N;i++) {\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }\n return builder.toString();\n }\n \n public static int readInt(BufferedReader r) throws Exception {\n return Integer.parseInt(r.readLine());\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n int N = readInt(r);\n String[] numStrings = r.readLine().split(\" \");\n int[] A = new int[N];\n for (int i = 0;i < N;i++) {\n A[i] = Integer.parseInt(numStrings[i]);\n }\n// insertionSort(A, N);\n bubbleSort(A, N);\n }",
"main",
"{\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n int N = readInt(r);\n String[] numStrings = r.readLine().split(\" \");\n int[] A = new int[N];\n for (int i = 0;i < N;i++) {\n A[i] = Integer.parseInt(numStrings[i]);\n }\n// insertionSort(A, N);\n bubbleSort(A, N);\n }",
"BufferedReader r = new BufferedReader(new InputStreamReader(System.in));",
"r",
"new BufferedReader(new InputStreamReader(System.in))",
"int N = readInt(r);",
"N",
"readInt(r)",
"readInt",
"r",
"String[] numStrings = r.readLine().split(\" \");",
"numStrings",
"r.readLine().split(\" \")",
"r.readLine().split",
"r.readLine()",
"r.readLine",
"r",
"\" \"",
"int[] A = new int[N];",
"A",
"new int[N]",
"N",
"for (int i = 0;i < N;i++) {\n A[i] = Integer.parseInt(numStrings[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = Integer.parseInt(numStrings[i]);\n }",
"{\n A[i] = Integer.parseInt(numStrings[i]);\n }",
"A[i] = Integer.parseInt(numStrings[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(numStrings[i])",
"Integer.parseInt",
"Integer",
"numStrings[i]",
"numStrings",
"i",
"bubbleSort(A, N)",
"bubbleSort",
"A",
"N",
"String[] args",
"args",
"public static void insertionSort(int[] A, int N) {\n System.out.println(dump(A, N));\n for (int i = 1;i <= (N - 1);i++) {\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }\n }",
"insertionSort",
"{\n System.out.println(dump(A, N));\n for (int i = 1;i <= (N - 1);i++) {\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }\n }",
"System.out.println(dump(A, N))",
"System.out.println",
"System.out",
"System",
"System.out",
"dump(A, N)",
"dump",
"A",
"N",
"for (int i = 1;i <= (N - 1);i++) {\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i <= (N - 1)",
"i",
"(N - 1)",
"N",
"1",
"i++",
"i++",
"i",
"{\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }",
"{\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }",
"int v = A[i];",
"v",
"A[i]",
"A",
"i",
"int j = i - 1;",
"j",
"i - 1",
"i",
"1",
"while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }",
"j >= 0 && A[j] > v",
"j >= 0",
"j",
"0",
"A[j] > v",
"A[j]",
"A",
"j",
"v",
"{\n A[j + 1] = A[j];\n j--;\n }",
"A[j + 1] = A[j]",
"A[j + 1]",
"A",
"j + 1",
"j",
"1",
"A[j]",
"A",
"j",
"j--",
"j",
"A[j + 1] = v",
"A[j + 1]",
"A",
"j + 1",
"j",
"1",
"v",
"System.out.println(dump(A, N))",
"System.out.println",
"System.out",
"System",
"System.out",
"dump(A, N)",
"dump",
"A",
"N",
"int[] A",
"A",
"int N",
"N",
"public static void bubbleSort(int[] A, int N) {\n int swapCount = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(dump(A, N));\n System.out.println(swapCount);\n }",
"bubbleSort",
"{\n int swapCount = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(dump(A, N));\n System.out.println(swapCount);\n }",
"int swapCount = 0;",
"swapCount",
"0",
"boolean flag = true;",
"flag",
"true",
"while (flag) {\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j >= 1",
"j",
"1",
"j--",
"j--",
"j",
"{\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }",
"{\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }",
"if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }",
"A[j] < A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"{\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }",
"swapInt(A, j, j - 1)",
"swapInt",
"A",
"j",
"j - 1",
"j",
"1",
"swapCount++",
"swapCount",
"flag = true",
"flag",
"true",
"System.out.println(dump(A, N))",
"System.out.println",
"System.out",
"System",
"System.out",
"dump(A, N)",
"dump",
"A",
"N",
"System.out.println(swapCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapCount",
"int[] A",
"A",
"int N",
"N",
"public static void swapInt(int[] A, int j, int k) {\n int v = A[j];\n A[j] = A[k];\n A[k] = v;\n }",
"swapInt",
"{\n int v = A[j];\n A[j] = A[k];\n A[k] = v;\n }",
"int v = A[j];",
"v",
"A[j]",
"A",
"j",
"A[j] = A[k]",
"A[j]",
"A",
"j",
"A[k]",
"A",
"k",
"A[k] = v",
"A[k]",
"A",
"k",
"v",
"int[] A",
"A",
"int j",
"j",
"int k",
"k",
"public static String dump(int[] A, int N) {\n StringBuilder builder = new StringBuilder();\n for (int i = 0;i < N;i++) {\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }\n return builder.toString();\n }",
"dump",
"{\n StringBuilder builder = new StringBuilder();\n for (int i = 0;i < N;i++) {\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }\n return builder.toString();\n }",
"StringBuilder builder = new StringBuilder();",
"builder",
"new StringBuilder()",
"for (int i = 0;i < N;i++) {\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }",
"{\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }",
"if (i != 0) {\n builder.append(\" \");\n }",
"i != 0",
"i",
"0",
"{\n builder.append(\" \");\n }",
"builder.append(\" \")",
"builder.append",
"builder",
"\" \"",
"builder.append(A[i])",
"builder.append",
"builder",
"A[i]",
"A",
"i",
"return builder.toString();",
"builder.toString()",
"builder.toString",
"builder",
"int[] A",
"A",
"int N",
"N",
"public static int readInt(BufferedReader r) throws Exception {\n return Integer.parseInt(r.readLine());\n }",
"readInt",
"{\n return Integer.parseInt(r.readLine());\n }",
"return Integer.parseInt(r.readLine());",
"Integer.parseInt(r.readLine())",
"Integer.parseInt",
"Integer",
"r.readLine()",
"r.readLine",
"r",
"BufferedReader r",
"r",
"public class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n int N = readInt(r);\n String[] numStrings = r.readLine().split(\" \");\n int[] A = new int[N];\n for (int i = 0;i < N;i++) {\n A[i] = Integer.parseInt(numStrings[i]);\n }\n// insertionSort(A, N);\n bubbleSort(A, N);\n }\n \n public static void insertionSort(int[] A, int N) {\n System.out.println(dump(A, N));\n for (int i = 1;i <= (N - 1);i++) {\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }\n }\n \n public static void bubbleSort(int[] A, int N) {\n int swapCount = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(dump(A, N));\n System.out.println(swapCount);\n }\n \n public static void swapInt(int[] A, int j, int k) {\n int v = A[j];\n A[j] = A[k];\n A[k] = v;\n }\n \n public static String dump(int[] A, int N) {\n StringBuilder builder = new StringBuilder();\n for (int i = 0;i < N;i++) {\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }\n return builder.toString();\n }\n \n public static int readInt(BufferedReader r) throws Exception {\n return Integer.parseInt(r.readLine());\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n int N = readInt(r);\n String[] numStrings = r.readLine().split(\" \");\n int[] A = new int[N];\n for (int i = 0;i < N;i++) {\n A[i] = Integer.parseInt(numStrings[i]);\n }\n// insertionSort(A, N);\n bubbleSort(A, N);\n }\n \n public static void insertionSort(int[] A, int N) {\n System.out.println(dump(A, N));\n for (int i = 1;i <= (N - 1);i++) {\n int v = A[i];\n int j = i - 1;\n while (j >= 0 && A[j] > v) {\n A[j + 1] = A[j];\n j--;\n }\n A[j + 1] = v;\n System.out.println(dump(A, N));\n }\n }\n \n public static void bubbleSort(int[] A, int N) {\n int swapCount = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int j = N - 1;j >= 1;j--) {\n if (A[j] < A[j - 1]) {\n swapInt(A, j, j - 1);\n swapCount++;\n flag = true;\n }\n }\n }\n System.out.println(dump(A, N));\n System.out.println(swapCount);\n }\n \n public static void swapInt(int[] A, int j, int k) {\n int v = A[j];\n A[j] = A[k];\n A[k] = v;\n }\n \n public static String dump(int[] A, int N) {\n StringBuilder builder = new StringBuilder();\n for (int i = 0;i < N;i++) {\n if (i != 0) {\n builder.append(\" \");\n }\n builder.append(A[i]);\n }\n return builder.toString();\n }\n \n public static int readInt(BufferedReader r) throws Exception {\n return Integer.parseInt(r.readLine());\n }\n}",
"Main"
] |
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
int N = readInt(r);
String[] numStrings = r.readLine().split(" ");
int[] A = new int[N];
for (int i = 0;i < N;i++) {
A[i] = Integer.parseInt(numStrings[i]);
}
// insertionSort(A, N);
bubbleSort(A, N);
}
public static void insertionSort(int[] A, int N) {
System.out.println(dump(A, N));
for (int i = 1;i <= (N - 1);i++) {
int v = A[i];
int j = i - 1;
while (j >= 0 && A[j] > v) {
A[j + 1] = A[j];
j--;
}
A[j + 1] = v;
System.out.println(dump(A, N));
}
}
public static void bubbleSort(int[] A, int N) {
int swapCount = 0;
boolean flag = true;
while (flag) {
flag = false;
for (int j = N - 1;j >= 1;j--) {
if (A[j] < A[j - 1]) {
swapInt(A, j, j - 1);
swapCount++;
flag = true;
}
}
}
System.out.println(dump(A, N));
System.out.println(swapCount);
}
public static void swapInt(int[] A, int j, int k) {
int v = A[j];
A[j] = A[k];
A[k] = v;
}
public static String dump(int[] A, int N) {
StringBuilder builder = new StringBuilder();
for (int i = 0;i < N;i++) {
if (i != 0) {
builder.append(" ");
}
builder.append(A[i]);
}
return builder.toString();
}
public static int readInt(BufferedReader r) throws Exception {
return Integer.parseInt(r.readLine());
}
} |
[
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,
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,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
17,
30,
4,
18,
18,
13,
13,
2,
18,
13,
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
],
[
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
],
[
17,
50
],
[
50,
51
],
[
50,
52
],
[
17,
53
],
[
53,
54
],
[
53,
55
],
[
17,
56
],
[
56,
57
],
[
56,
58
],
[
17,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
67,
74
],
[
74,
75
],
[
74,
76
],
[
67,
77
],
[
77,
78
],
[
78,
79
],
[
67,
80
],
[
81,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
92,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
107,
113
],
[
92,
114
],
[
114,
115
],
[
114,
116
],
[
92,
117
],
[
117,
118
],
[
17,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
119,
130
],
[
131,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
132,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
144,
146
],
[
138,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
132,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
17,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
15,
170
],
[
170,
171
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.util.Scanner;\nimport java.util.Arrays;\n\nclass Main{\n\tpublic static void main(String[] args)throws Exception{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] numbers = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t numbers[i] = scanner.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint temp = 0;\n\t\tint flag = 1;\n\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int i = n-1; i > 0; i--){\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tif(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.Arrays;",
"Arrays",
"java.util",
"class Main{\n\tpublic static void main(String[] args)throws Exception{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] numbers = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t numbers[i] = scanner.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint temp = 0;\n\t\tint flag = 1;\n\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int i = n-1; i > 0; i--){\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tif(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args)throws Exception{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] numbers = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t numbers[i] = scanner.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint temp = 0;\n\t\tint flag = 1;\n\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int i = n-1; i > 0; i--){\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tif(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint n = scanner.nextInt();\n\t\tint[] numbers = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t numbers[i] = scanner.nextInt();\n\t\t}\n\t\tint count = 0;\n\t\tint temp = 0;\n\t\tint flag = 1;\n\n\t\twhile(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int i = n-1; i > 0; i--){\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor(int i = 0; i < n; i++){\n\t\t\tif(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] numbers = new int[n];",
"numbers",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t numbers[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t numbers[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t numbers[i] = scanner.nextInt();\n\t\t}",
"numbers[i] = scanner.nextInt()",
"numbers[i]",
"numbers",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int count = 0;",
"count",
"0",
"int temp = 0;",
"temp",
"0",
"int flag = 1;",
"flag",
"1",
"while(flag == 1){\n\t\t\tflag = 0;\n\t\t\tfor(int i = n-1; i > 0; i--){\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\tflag = 0;\n\t\t\tfor(int i = n-1; i > 0; i--){\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = 0",
"flag",
"0",
"for(int i = n-1; i > 0; i--){\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int i = n-1;",
"int i = n-1;",
"i",
"n-1",
"n",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(numbers[i] < numbers[i-1]){\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"numbers[i] < numbers[i-1]",
"numbers[i]",
"numbers",
"i",
"numbers[i-1]",
"numbers",
"i-1",
"i",
"1",
"{\n\t\t\t\t\ttemp = numbers[i];\n\t\t\t\t\tnumbers[i] = numbers[i-1];\n\t\t\t\t\tnumbers[i-1] = temp;\n\t\t\t\t\tflag = 1;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"temp = numbers[i]",
"temp",
"numbers[i]",
"numbers",
"i",
"numbers[i] = numbers[i-1]",
"numbers[i]",
"numbers",
"i",
"numbers[i-1]",
"numbers",
"i-1",
"i",
"1",
"numbers[i-1] = temp",
"numbers[i-1]",
"numbers",
"i-1",
"i",
"1",
"temp",
"flag = 1",
"flag",
"1",
"count++",
"count",
"for(int i = 0; i < n; i++){\n\t\t\tif(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[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(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}\n\t\t}",
"if(i == n-1){\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}",
"i == n-1",
"i",
"n-1",
"n",
"1",
"{\n\t\t\t\tSystem.out.print(numbers[i]);\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}",
"System.out.print(numbers[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"numbers[i]",
"numbers",
"i",
"System.out.print(\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"",
"{\n\t\t\t\tSystem.out.print(numbers[i] + \" \");\n\t\t\t}",
"System.out.print(numbers[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"numbers[i] + \" \"",
"numbers[i]",
"numbers",
"i",
"\" \"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Arrays;
class Main{
public static void main(String[] args)throws Exception{
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] numbers = new int[n];
for(int i = 0; i < n; i++){
numbers[i] = scanner.nextInt();
}
int count = 0;
int temp = 0;
int flag = 1;
while(flag == 1){
flag = 0;
for(int i = n-1; i > 0; i--){
if(numbers[i] < numbers[i-1]){
temp = numbers[i];
numbers[i] = numbers[i-1];
numbers[i-1] = temp;
flag = 1;
count++;
}
}
}
for(int i = 0; i < n; i++){
if(i == n-1){
System.out.print(numbers[i]);
System.out.print("\n");
}else{
System.out.print(numbers[i] + " ");
}
}
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,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
164,
5
],
[
164,
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
],
[
54,
55
],
[
54,
56
],
[
47,
57
],
[
57,
58
],
[
58,
59
],
[
47,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
62,
69
],
[
69,
70
],
[
69,
71
],
[
62,
72
],
[
72,
73
],
[
73,
74
],
[
62,
75
],
[
76,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
87,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
87,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
87,
109
],
[
109,
110
],
[
8,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
111,
122
],
[
123,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
124,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
124,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
8,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
6,
161
],
[
161,
162
],
[
0,
163
],
[
163,
164
],
[
163,
165
]
] | [
"import java.util.*;\n\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\t\tint[] A = new int[N];\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint cnt = 0, tmp = 0;\n\t\t\n\t\tfor(int i = 0; i < N - 1; i++) {\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(cnt);\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\n\t\tint N = sc.nextInt();\n\t\t\n\t\tint[] A = new int[N];\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint cnt = 0, tmp = 0;\n\t\t\n\t\tfor(int i = 0; i < N - 1; i++) {\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\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\t\n\t\tint N = sc.nextInt();\n\t\t\n\t\tint[] A = new int[N];\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint cnt = 0, tmp = 0;\n\t\t\n\t\tfor(int i = 0; i < N - 1; i++) {\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\tint N = sc.nextInt();\n\t\t\n\t\tint[] A = new int[N];\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint cnt = 0, tmp = 0;\n\t\t\n\t\tfor(int i = 0; i < N - 1; i++) {\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(cnt);\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();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = sc.nextInt();\n\t\t}",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int cnt = 0",
"cnt",
"0",
"tmp = 0;",
"tmp",
"0",
"for(int i = 0; i < N - 1; i++) {\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\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\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"if(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"A[j] < A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"tmp = A[j]",
"tmp",
"A[j]",
"A",
"j",
"A[j] = A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j - 1] = tmp",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"tmp",
"cnt++",
"cnt",
"for(int i = 0; i < N; i++) {\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(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(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}",
"if(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}",
"i == N - 1",
"i",
"N - 1",
"N",
"1",
"{\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t}",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"{\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}",
"System.out.print(A[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i] + \" \"",
"A[i]",
"A",
"i",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"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\t\n\t\tint N = sc.nextInt();\n\t\t\n\t\tint[] A = new int[N];\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint cnt = 0, tmp = 0;\n\t\t\n\t\tfor(int i = 0; i < N - 1; i++) {\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\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\t\n\t\tint N = sc.nextInt();\n\t\t\n\t\tint[] A = new int[N];\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tA[i] = sc.nextInt();\n\t\t}\n\t\t\n\t\tint cnt = 0, tmp = 0;\n\t\t\n\t\tfor(int i = 0; i < N - 1; i++) {\n\t\t\tfor(int j = N - 1; j > i; j--) {\n\t\t\t\tif(A[j] < A[j - 1]) {\n\t\t\t\t\ttmp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = tmp;\n\t\t\t\t\t\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor(int i = 0; i < N; i++) {\n\t\t\tif(i == N - 1) {\n\t\t\t\tSystem.out.print(A[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(A[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\t\n\t\tSystem.out.println(cnt);\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[] A = new int[N];
for(int i = 0; i < N; i++) {
A[i] = sc.nextInt();
}
int cnt = 0, tmp = 0;
for(int i = 0; i < N - 1; i++) {
for(int j = N - 1; j > i; j--) {
if(A[j] < A[j - 1]) {
tmp = A[j];
A[j] = A[j - 1];
A[j - 1] = tmp;
cnt++;
}
}
}
for(int i = 0; i < N; i++) {
if(i == N - 1) {
System.out.print(A[i]);
} else {
System.out.print(A[i] + " ");
}
}
System.out.println();
System.out.println(cnt);
}
} |
[
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,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
157,
5
],
[
157,
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
],
[
57,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
57,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
82,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
82,
104
],
[
104,
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
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
119,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
131,
132
],
[
131,
133
],
[
119,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
8,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
8,
151
],
[
151,
152
],
[
152,
153
],
[
6,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
] | [
"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\tint array[] = new int[N];\n\t\tint count = 0;\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\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\tint array[] = new int[N];\n\t\tint count = 0;\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\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\tint array[] = new int[N];\n\t\tint count = 0;\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\n\t}",
"main",
"{\n\t\t// TODO 自動生成されたメソッド・スタブ\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint array[] = new int[N];\n\t\tint count = 0;\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int array[] = new int[N];",
"array",
"new int[N]",
"N",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < N; i++){\n\t\t\tarray[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tarray[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tarray[i] = sc.nextInt();\n\t\t}",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < N; i++){\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\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\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = N-1;",
"int j = N-1;",
"j",
"N-1",
"N",
"1",
"j >=1",
"j",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"array[j]< array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp = array[j];",
"tmp",
"array[j]",
"array",
"j",
"array[j] = array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"array[j-1] = tmp",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"tmp",
"count++",
"count",
"for(int i = 0; i < N; i++){\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[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(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}",
"if(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}",
"i == N-1",
"i",
"N-1",
"N",
"1",
"{\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}",
"System.out.println(array[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"array[i]",
"array",
"i",
"{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}",
"System.out.print(array[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i] + \" \"",
"array[i]",
"array",
"i",
"\" \"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"sc.close()",
"sc.close",
"sc",
"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\tint array[] = new int[N];\n\t\tint count = 0;\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\n\t}\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\tint array[] = new int[N];\n\t\tint count = 0;\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tfor(int j = N-1; j >=1; j--){\n\t\t\t\tif(array[j]< array[j-1]){\n\t\t\t\t\tint tmp = array[j];\n\t\t\t\t\tarray[j] = array[j-1];\n\t\t\t\t\tarray[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i = 0; i < N; i++){\n\t\t\tif(i == N-1){\n\t\t\t\tSystem.out.println(array[i]);\n\t\t\t}else{\n\t\t\t\tSystem.out.print(array[i] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t\tsc.close();\n\n\t}\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();
int array[] = new int[N];
int count = 0;
for(int i = 0; i < N; i++){
array[i] = sc.nextInt();
}
for(int i = 0; i < N; i++){
for(int j = N-1; j >=1; j--){
if(array[j]< array[j-1]){
int tmp = array[j];
array[j] = array[j-1];
array[j-1] = tmp;
count++;
}
}
}
for(int i = 0; i < N; i++){
if(i == N-1){
System.out.println(array[i]);
}else{
System.out.print(array[i] + " ");
}
}
System.out.println(count);
sc.close();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
41,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
13,
4,
18,
13,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
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,
2,
17,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
13,
17,
4,
18,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
2,
13,
17,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
13,
17,
40,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
14,
40,
13,
3,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
14,
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,
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
],
[
253,
14
],
[
14,
15
],
[
253,
16
],
[
16,
17
],
[
253,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
20,
27
],
[
27,
28
],
[
28,
29
],
[
20,
30
],
[
30,
31
],
[
31,
32
],
[
20,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
33,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
40,
42
],
[
18,
43
],
[
43,
44
],
[
253,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
47,
56
],
[
56,
57
],
[
56,
58
],
[
47,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
60,
65
],
[
65,
66
],
[
65,
67
],
[
60,
68
],
[
68,
69
],
[
69,
70
],
[
60,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
253,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
90,
91
],
[
90,
92
],
[
85,
93
],
[
93,
94
],
[
94,
95
],
[
85,
96
],
[
97,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
97,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
81,
116
],
[
116,
117
],
[
117,
118
],
[
253,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
125,
135
],
[
135,
136
],
[
136,
137
],
[
125,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
148,
149
],
[
148,
150
],
[
151,
151
],
[
151,
152
],
[
151,
153
],
[
151,
154
],
[
143,
155
],
[
155,
156
],
[
156,
157
],
[
143,
158
],
[
159,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
167,
169
],
[
160,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
170,
174
],
[
174,
175
],
[
170,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
170,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
181,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
187,
189
],
[
170,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
193,
195
],
[
190,
196
],
[
139,
197
],
[
197,
198
],
[
198,
199
],
[
197,
200
],
[
253,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
201,
205
],
[
205,
206
],
[
201,
207
],
[
207,
208
],
[
207,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
207,
213
],
[
213,
214
],
[
201,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
219,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
218,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
228,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
217,
239
],
[
239,
240
],
[
240,
241
],
[
241,
242
],
[
201,
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.List;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n int[] arr;\n\n int size;\n\n int swaps;\n\n public static void main(String[] args)\n {\n\n Main g = new Main();\n\n g.readArray();\n\n g.bubbleSort();\n\n g.printArray();\n\n System.out.println(\"\\n\" + g.swaps);\n }\n\n private void readArray() {\n\n InputReader reader = new InputReader(System.in);\n\n size = reader.nextInt();\n\n arr = new int[size];\n\n for(int i=0; i<size; ++i)\n arr[i] = reader.nextInt();\n }\n\n private void printArray() {\n\n PrintWriter writer = new PrintWriter(System.out);\n\n for(int i=0; i<size; ++i) {\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }\n\n writer.flush();\n }\n\n\n private void bubbleSort() {\n\n boolean flag=false;\n\n for(int i=0; i<size-1; ++i) {\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }\n\n }\n\n\n class InputReader {\n\n private BufferedReader reader;\n\n private StringTokenizer tokenizer;\n\n InputReader(InputStream ip) {\n\n reader = new BufferedReader(new InputStreamReader(ip));\n }\n\n String next() {\n\n if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n\n return Integer.parseInt(next());\n }\n }\n}\n",
"import java.io.*;",
"io.*",
"java",
"import java.util.List;",
"List",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"public class Main {\n\n int[] arr;\n\n int size;\n\n int swaps;\n\n public static void main(String[] args)\n {\n\n Main g = new Main();\n\n g.readArray();\n\n g.bubbleSort();\n\n g.printArray();\n\n System.out.println(\"\\n\" + g.swaps);\n }\n\n private void readArray() {\n\n InputReader reader = new InputReader(System.in);\n\n size = reader.nextInt();\n\n arr = new int[size];\n\n for(int i=0; i<size; ++i)\n arr[i] = reader.nextInt();\n }\n\n private void printArray() {\n\n PrintWriter writer = new PrintWriter(System.out);\n\n for(int i=0; i<size; ++i) {\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }\n\n writer.flush();\n }\n\n\n private void bubbleSort() {\n\n boolean flag=false;\n\n for(int i=0; i<size-1; ++i) {\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }\n\n }\n\n\n class InputReader {\n\n private BufferedReader reader;\n\n private StringTokenizer tokenizer;\n\n InputReader(InputStream ip) {\n\n reader = new BufferedReader(new InputStreamReader(ip));\n }\n\n String next() {\n\n if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n\n return Integer.parseInt(next());\n }\n }\n}",
"Main",
"int[] arr;",
"arr",
"int size;",
"size",
"int swaps;",
"swaps",
"public static void main(String[] args)\n {\n\n Main g = new Main();\n\n g.readArray();\n\n g.bubbleSort();\n\n g.printArray();\n\n System.out.println(\"\\n\" + g.swaps);\n }",
"main",
"{\n\n Main g = new Main();\n\n g.readArray();\n\n g.bubbleSort();\n\n g.printArray();\n\n System.out.println(\"\\n\" + g.swaps);\n }",
"Main g = new Main();",
"g",
"new Main()",
"g.readArray()",
"g.readArray",
"g",
"g.bubbleSort()",
"g.bubbleSort",
"g",
"g.printArray()",
"g.printArray",
"g",
"System.out.println(\"\\n\" + g.swaps)",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\\n\" + g.swaps",
"\"\\n\"",
"g.swaps",
"g",
"g.swaps",
"String[] args",
"args",
"private void readArray() {\n\n InputReader reader = new InputReader(System.in);\n\n size = reader.nextInt();\n\n arr = new int[size];\n\n for(int i=0; i<size; ++i)\n arr[i] = reader.nextInt();\n }",
"readArray",
"{\n\n InputReader reader = new InputReader(System.in);\n\n size = reader.nextInt();\n\n arr = new int[size];\n\n for(int i=0; i<size; ++i)\n arr[i] = reader.nextInt();\n }",
"InputReader reader = new InputReader(System.in);",
"reader",
"new InputReader(System.in)",
"size = reader.nextInt()",
"size",
"reader.nextInt()",
"reader.nextInt",
"reader",
"arr = new int[size]",
"arr",
"new int[size]",
"size",
"for(int i=0; i<size; ++i)\n arr[i] = reader.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<size",
"i",
"size",
"++i",
"++i",
"i",
"arr[i] = reader.nextInt();",
"arr[i] = reader.nextInt()",
"arr[i]",
"arr",
"i",
"reader.nextInt()",
"reader.nextInt",
"reader",
"private void printArray() {\n\n PrintWriter writer = new PrintWriter(System.out);\n\n for(int i=0; i<size; ++i) {\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }\n\n writer.flush();\n }",
"printArray",
"{\n\n PrintWriter writer = new PrintWriter(System.out);\n\n for(int i=0; i<size; ++i) {\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }\n\n writer.flush();\n }",
"PrintWriter writer = new PrintWriter(System.out);",
"writer",
"new PrintWriter(System.out)",
"for(int i=0; i<size; ++i) {\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<size",
"i",
"size",
"++i",
"++i",
"i",
"{\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }",
"{\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }",
"writer.write(\"\" + arr[i])",
"writer.write",
"writer",
"\"\" + arr[i]",
"\"\"",
"arr[i]",
"arr",
"i",
"if(i<size-1) writer.write(\" \");",
"i<size-1",
"i",
"size-1",
"size",
"1",
"writer.write(\" \")",
"writer.write",
"writer",
"\" \"",
"writer.flush()",
"writer.flush",
"writer",
"private void bubbleSort() {\n\n boolean flag=false;\n\n for(int i=0; i<size-1; ++i) {\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }\n\n }",
"bubbleSort",
"{\n\n boolean flag=false;\n\n for(int i=0; i<size-1; ++i) {\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }\n\n }",
"boolean flag=false;",
"flag",
"false",
"for(int i=0; i<size-1; ++i) {\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<size-1",
"i",
"size-1",
"size",
"1",
"++i",
"++i",
"i",
"{\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }",
"{\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }",
"flag=false",
"flag",
"false",
"for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<size-1-i",
"j",
"size-1-i",
"size-1-i",
"size",
"1",
"i",
"++j",
"++j",
"j",
"{\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }",
"{\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }",
"if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }",
"arr[j]>arr[j+1]",
"arr[j]",
"arr",
"j",
"arr[j+1]",
"arr",
"j+1",
"j",
"1",
"{\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }",
"flag=true",
"flag",
"true",
"++swaps",
"swaps",
"int tmp = arr[j];",
"tmp",
"arr[j]",
"arr",
"j",
"arr[j] = arr[j+1]",
"arr[j]",
"arr",
"j",
"arr[j+1]",
"arr",
"j+1",
"j",
"1",
"arr[j+1] = tmp",
"arr[j+1]",
"arr",
"j+1",
"j",
"1",
"tmp",
"if(!flag) break;",
"!flag",
"flag",
"break;",
"class InputReader {\n\n private BufferedReader reader;\n\n private StringTokenizer tokenizer;\n\n InputReader(InputStream ip) {\n\n reader = new BufferedReader(new InputStreamReader(ip));\n }\n\n String next() {\n\n if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n\n return Integer.parseInt(next());\n }\n }",
"InputReader",
"private BufferedReader reader;",
"reader",
"private StringTokenizer tokenizer;",
"tokenizer",
"InputReader(InputStream ip) {\n\n reader = new BufferedReader(new InputStreamReader(ip));\n }",
"InputReader",
"{\n\n reader = new BufferedReader(new InputStreamReader(ip));\n }",
"reader = new BufferedReader(new InputStreamReader(ip))",
"reader",
"new BufferedReader(new InputStreamReader(ip))",
"InputStream ip",
"ip",
"String next() {\n\n if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return tokenizer.nextToken();\n }",
"next",
"{\n\n if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return tokenizer.nextToken();\n }",
"if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"tokenizer==null || !tokenizer.hasMoreTokens()",
"tokenizer==null",
"tokenizer",
"null",
"!tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens()",
"tokenizer.hasMoreTokens",
"tokenizer",
"{\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }",
"try {\n tokenizer = new StringTokenizer(reader.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 tokenizer = new StringTokenizer(reader.readLine());\n }",
"tokenizer = new StringTokenizer(reader.readLine())",
"tokenizer",
"new StringTokenizer(reader.readLine())",
"return tokenizer.nextToken();",
"tokenizer.nextToken()",
"tokenizer.nextToken",
"tokenizer",
"int nextInt() {\n\n return Integer.parseInt(next());\n }",
"nextInt",
"{\n\n return Integer.parseInt(next());\n }",
"return Integer.parseInt(next());",
"Integer.parseInt(next())",
"Integer.parseInt",
"Integer",
"next()",
"next",
"public class Main {\n\n int[] arr;\n\n int size;\n\n int swaps;\n\n public static void main(String[] args)\n {\n\n Main g = new Main();\n\n g.readArray();\n\n g.bubbleSort();\n\n g.printArray();\n\n System.out.println(\"\\n\" + g.swaps);\n }\n\n private void readArray() {\n\n InputReader reader = new InputReader(System.in);\n\n size = reader.nextInt();\n\n arr = new int[size];\n\n for(int i=0; i<size; ++i)\n arr[i] = reader.nextInt();\n }\n\n private void printArray() {\n\n PrintWriter writer = new PrintWriter(System.out);\n\n for(int i=0; i<size; ++i) {\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }\n\n writer.flush();\n }\n\n\n private void bubbleSort() {\n\n boolean flag=false;\n\n for(int i=0; i<size-1; ++i) {\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }\n\n }\n\n\n class InputReader {\n\n private BufferedReader reader;\n\n private StringTokenizer tokenizer;\n\n InputReader(InputStream ip) {\n\n reader = new BufferedReader(new InputStreamReader(ip));\n }\n\n String next() {\n\n if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n\n return Integer.parseInt(next());\n }\n }\n}",
"public class Main {\n\n int[] arr;\n\n int size;\n\n int swaps;\n\n public static void main(String[] args)\n {\n\n Main g = new Main();\n\n g.readArray();\n\n g.bubbleSort();\n\n g.printArray();\n\n System.out.println(\"\\n\" + g.swaps);\n }\n\n private void readArray() {\n\n InputReader reader = new InputReader(System.in);\n\n size = reader.nextInt();\n\n arr = new int[size];\n\n for(int i=0; i<size; ++i)\n arr[i] = reader.nextInt();\n }\n\n private void printArray() {\n\n PrintWriter writer = new PrintWriter(System.out);\n\n for(int i=0; i<size; ++i) {\n\n writer.write(\"\" + arr[i]);\n\n if(i<size-1) writer.write(\" \");\n }\n\n writer.flush();\n }\n\n\n private void bubbleSort() {\n\n boolean flag=false;\n\n for(int i=0; i<size-1; ++i) {\n\n flag=false;\n\n for(int j=0; j<size-1-i; ++j) {\n\n if(arr[j]>arr[j+1]) {\n\n flag=true;\n\n ++swaps;\n\n int tmp = arr[j];\n arr[j] = arr[j+1];\n arr[j+1] = tmp;\n }\n }\n\n // no swap has taken place so array is already sorted at this point\n if(!flag) break;\n }\n\n }\n\n\n class InputReader {\n\n private BufferedReader reader;\n\n private StringTokenizer tokenizer;\n\n InputReader(InputStream ip) {\n\n reader = new BufferedReader(new InputStreamReader(ip));\n }\n\n String next() {\n\n if(tokenizer==null || !tokenizer.hasMoreTokens()) {\n\n try {\n tokenizer = new StringTokenizer(reader.readLine());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n return tokenizer.nextToken();\n }\n\n int nextInt() {\n\n return Integer.parseInt(next());\n }\n }\n}",
"Main"
] | import java.io.*;
import java.util.List;
import java.util.StringTokenizer;
public class Main {
int[] arr;
int size;
int swaps;
public static void main(String[] args)
{
Main g = new Main();
g.readArray();
g.bubbleSort();
g.printArray();
System.out.println("\n" + g.swaps);
}
private void readArray() {
InputReader reader = new InputReader(System.in);
size = reader.nextInt();
arr = new int[size];
for(int i=0; i<size; ++i)
arr[i] = reader.nextInt();
}
private void printArray() {
PrintWriter writer = new PrintWriter(System.out);
for(int i=0; i<size; ++i) {
writer.write("" + arr[i]);
if(i<size-1) writer.write(" ");
}
writer.flush();
}
private void bubbleSort() {
boolean flag=false;
for(int i=0; i<size-1; ++i) {
flag=false;
for(int j=0; j<size-1-i; ++j) {
if(arr[j]>arr[j+1]) {
flag=true;
++swaps;
int tmp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = tmp;
}
}
// no swap has taken place so array is already sorted at this point
if(!flag) break;
}
}
class InputReader {
private BufferedReader reader;
private StringTokenizer tokenizer;
InputReader(InputStream ip) {
reader = new BufferedReader(new InputStreamReader(ip));
}
String next() {
if(tokenizer==null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return tokenizer.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
12,
13,
30,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
0,
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,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
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,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
0,
13,
17,
40,
13,
40,
13,
41,
13,
17,
28,
13,
13,
30,
30,
0,
13,
13,
0,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
154,
5
],
[
154,
6
],
[
6,
7
],
[
154,
8
],
[
8,
9
],
[
8,
10
],
[
154,
11
],
[
11,
12
],
[
11,
13
],
[
13,
14
],
[
14,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
154,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
21,
30
],
[
30,
31
],
[
30,
32
],
[
21,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
36,
38
],
[
34,
39
],
[
39,
40
],
[
39,
41
],
[
34,
42
],
[
42,
43
],
[
43,
44
],
[
34,
45
],
[
46,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
21,
54
],
[
54,
55
],
[
54,
56
],
[
21,
57
],
[
57,
58
],
[
57,
59
],
[
21,
60
],
[
60,
61
],
[
60,
62
],
[
21,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
73,
75
],
[
69,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
69,
81
],
[
81,
82
],
[
82,
83
],
[
69,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
86,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
96,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
104,
110
],
[
110,
111
],
[
110,
112
],
[
96,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
96,
118
],
[
118,
119
],
[
118,
120
],
[
96,
121
],
[
121,
122
],
[
65,
123
],
[
123,
124
],
[
21,
125
],
[
125,
126
],
[
125,
127
],
[
21,
128
],
[
128,
129
],
[
128,
130
],
[
128,
131
],
[
132,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
136,
138
],
[
21,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
145,
146
],
[
21,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n public Main() {\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n private Scanner sc;\n\n private void solve() {\n 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 boolean flag = true;\n int cnt = 0;\n int i = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }\n\n String ans = \"\";\n for (int num : A) {\n ans += num;\n ans += \" \";\n }\n System.out.println(ans.trim());\n System.out.println(cnt);\n }\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public Main() {\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n private Scanner sc;\n\n private void solve() {\n 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 boolean flag = true;\n int cnt = 0;\n int i = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }\n\n String ans = \"\";\n for (int num : A) {\n ans += num;\n ans += \" \";\n }\n System.out.println(ans.trim());\n System.out.println(cnt);\n }\n\n}",
"Main",
"private Scanner sc;",
"sc",
"public Main() {\n }",
"Main",
"{\n }",
"public static void main(String[] args) {\n new Main().solve();\n }",
"main",
"{\n new Main().solve();\n }",
"new Main().solve()",
"new Main().solve",
"new Main()",
"String[] args",
"args",
"private void solve() {\n 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 boolean flag = true;\n int cnt = 0;\n int i = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }\n\n String ans = \"\";\n for (int num : A) {\n ans += num;\n ans += \" \";\n }\n System.out.println(ans.trim());\n System.out.println(cnt);\n }",
"solve",
"{\n 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 boolean flag = true;\n int cnt = 0;\n int i = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }\n\n String ans = \"\";\n for (int num : A) {\n ans += num;\n ans += \" \";\n }\n System.out.println(ans.trim());\n System.out.println(cnt);\n }",
"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",
"boolean flag = true;",
"flag",
"true",
"int cnt = 0;",
"cnt",
"0",
"int i = 0;",
"i",
"0",
"while (flag) {\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }",
"flag",
"{\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }",
"flag = false",
"flag",
"false",
"for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j >= i + 1",
"j",
"i + 1",
"i",
"1",
"j--",
"j--",
"j",
"{\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }",
"{\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }",
"if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }",
"A[j] < A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"{\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }",
"int tmp = A[j - 1];",
"tmp",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j - 1] = A[j]",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j]",
"A",
"j",
"A[j] = tmp",
"A[j]",
"A",
"j",
"tmp",
"flag = true",
"flag",
"true",
"cnt++",
"cnt",
"i++",
"i",
"String ans = \"\";",
"ans",
"\"\"",
"for (int num : A) {\n ans += num;\n ans += \" \";\n }",
"int num",
"A",
"{\n ans += num;\n ans += \" \";\n }",
"{\n ans += num;\n ans += \" \";\n }",
"ans += num",
"ans",
"num",
"ans += \" \"",
"ans",
"\" \"",
"System.out.println(ans.trim())",
"System.out.println",
"System.out",
"System",
"System.out",
"ans.trim()",
"ans.trim",
"ans",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"public class Main {\n\n public Main() {\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n private Scanner sc;\n\n private void solve() {\n 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 boolean flag = true;\n int cnt = 0;\n int i = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }\n\n String ans = \"\";\n for (int num : A) {\n ans += num;\n ans += \" \";\n }\n System.out.println(ans.trim());\n System.out.println(cnt);\n }\n\n}",
"public class Main {\n\n public Main() {\n }\n\n public static void main(String[] args) {\n new Main().solve();\n }\n\n private Scanner sc;\n\n private void solve() {\n 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 boolean flag = true;\n int cnt = 0;\n int i = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= i + 1; j--) {\n if (A[j] < A[j - 1]) {\n int tmp = A[j - 1];\n A[j - 1] = A[j];\n A[j] = tmp;\n flag = true;\n cnt++;\n }\n }\n i++;\n }\n\n String ans = \"\";\n for (int num : A) {\n ans += num;\n ans += \" \";\n }\n System.out.println(ans.trim());\n System.out.println(cnt);\n }\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public Main() {
}
public static void main(String[] args) {
new Main().solve();
}
private Scanner sc;
private void solve() {
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();
}
boolean flag = true;
int cnt = 0;
int i = 0;
while (flag) {
flag = false;
for (int j = N - 1; j >= i + 1; j--) {
if (A[j] < A[j - 1]) {
int tmp = A[j - 1];
A[j - 1] = A[j];
A[j] = tmp;
flag = true;
cnt++;
}
}
i++;
}
String ans = "";
for (int num : A) {
ans += num;
ans += " ";
}
System.out.println(ans.trim());
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
17,
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,
17,
41,
13,
17,
42,
2,
13,
2,
13,
17,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
40,
17,
1,
40,
13,
30,
30,
41,
13,
2,
13,
17,
14,
2,
18,
13,
13,
18,
13,
13,
30,
41,
13,
18,
13,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
40,
13,
40,
13,
14,
2,
13,
17,
30,
3,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
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
],
[
180,
5
],
[
180,
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
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
8,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
34,
37
],
[
8,
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
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
55,
58
],
[
58,
59
],
[
58,
60
],
[
8,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
8,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
67,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
74,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
74,
85
],
[
85,
86
],
[
86,
87
],
[
74,
88
],
[
89,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
95,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
103,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
103,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
103,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
103,
124
],
[
124,
125
],
[
89,
126
],
[
126,
127
],
[
89,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
73,
134
],
[
134,
135
],
[
8,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
136,
146
],
[
146,
147
],
[
147,
148
],
[
136,
149
],
[
150,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
8,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
8,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
6,
177
],
[
177,
178
],
[
0,
179
],
[
179,
180
],
[
179,
181
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] arges) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line = sc.nextLine();\n\t\tint v = Integer.parseInt(line);\n\t\tint[] vs = new int[v];\n\t\tString line2 = sc.nextLine();\n\t\tString[] k = line2.split(\" \");\n\t\tfor (int i = 0; i < v; i++) {\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i<v-1){\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < v-1 ; j++) {\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}\n\t\t\t\tSystem.out.println(vs[v-1]);\n\t\t\t\tSystem.out.println(count);\n\n\n\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] arges) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line = sc.nextLine();\n\t\tint v = Integer.parseInt(line);\n\t\tint[] vs = new int[v];\n\t\tString line2 = sc.nextLine();\n\t\tString[] k = line2.split(\" \");\n\t\tfor (int i = 0; i < v; i++) {\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i<v-1){\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < v-1 ; j++) {\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}\n\t\t\t\tSystem.out.println(vs[v-1]);\n\t\t\t\tSystem.out.println(count);\n\n\n\n\t}\n}",
"Main",
"public static void main(String[] arges) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line = sc.nextLine();\n\t\tint v = Integer.parseInt(line);\n\t\tint[] vs = new int[v];\n\t\tString line2 = sc.nextLine();\n\t\tString[] k = line2.split(\" \");\n\t\tfor (int i = 0; i < v; i++) {\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i<v-1){\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < v-1 ; j++) {\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}\n\t\t\t\tSystem.out.println(vs[v-1]);\n\t\t\t\tSystem.out.println(count);\n\n\n\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line = sc.nextLine();\n\t\tint v = Integer.parseInt(line);\n\t\tint[] vs = new int[v];\n\t\tString line2 = sc.nextLine();\n\t\tString[] k = line2.split(\" \");\n\t\tfor (int i = 0; i < v; i++) {\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i<v-1){\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < v-1 ; j++) {\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}\n\t\t\t\tSystem.out.println(vs[v-1]);\n\t\t\t\tSystem.out.println(count);\n\n\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"String line = sc.nextLine();",
"line",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int v = Integer.parseInt(line);",
"v",
"Integer.parseInt(line)",
"Integer.parseInt",
"Integer",
"line",
"int[] vs = new int[v];",
"vs",
"new int[v]",
"v",
"String line2 = sc.nextLine();",
"line2",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] k = line2.split(\" \");",
"k",
"line2.split(\" \")",
"line2.split",
"line2",
"\" \"",
"for (int i = 0; i < v; i++) {\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < v",
"i",
"v",
"i++",
"i++",
"i",
"{\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}",
"{\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}",
"vs[i] = Integer.parseInt(k[i])",
"vs[i]",
"vs",
"i",
"Integer.parseInt(k[i])",
"Integer.parseInt",
"Integer",
"k[i]",
"k",
"i",
"int i = 0;",
"i",
"0",
"int count = 0;",
"count",
"0",
"while(i<v-1){\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}",
"i<v-1",
"i",
"v-1",
"v",
"1",
"{\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}",
"for (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int j = v-1;",
"int j = v-1;",
"j",
"v-1",
"v",
"1",
"j >-1",
"j",
"-1",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}",
"int key=j-1;",
"key",
"j-1",
"j",
"1",
"if(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"vs[key]>vs[j]",
"vs[key]",
"vs",
"key",
"vs[j]",
"vs",
"j",
"{\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int a=vs[key];",
"a",
"vs[key]",
"vs",
"key",
"int b = vs[j];",
"b",
"vs[j]",
"vs",
"j",
"vs[key]=b",
"vs[key]",
"vs",
"key",
"b",
"vs[j]=a",
"vs[j]",
"vs",
"j",
"a",
"count++",
"count",
"key--",
"key",
"if (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"key<0",
"key",
"0",
"{\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"break;",
"i++",
"i",
"for (int j = 0; j < v-1 ; j++) {\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < v-1",
"j",
"v-1",
"v",
"1",
"j++",
"j++",
"j",
"{\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}",
"{\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}",
"System.out.print(vs[j]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"vs[j]+\" \"",
"vs[j]",
"vs",
"j",
"\" \"",
"System.out.println(vs[v-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"vs[v-1]",
"vs",
"v-1",
"v",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] arges",
"arges",
"public class Main {\n\tpublic static void main(String[] arges) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line = sc.nextLine();\n\t\tint v = Integer.parseInt(line);\n\t\tint[] vs = new int[v];\n\t\tString line2 = sc.nextLine();\n\t\tString[] k = line2.split(\" \");\n\t\tfor (int i = 0; i < v; i++) {\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i<v-1){\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < v-1 ; j++) {\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}\n\t\t\t\tSystem.out.println(vs[v-1]);\n\t\t\t\tSystem.out.println(count);\n\n\n\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] arges) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tString line = sc.nextLine();\n\t\tint v = Integer.parseInt(line);\n\t\tint[] vs = new int[v];\n\t\tString line2 = sc.nextLine();\n\t\tString[] k = line2.split(\" \");\n\t\tfor (int i = 0; i < v; i++) {\n\t\t\tvs[i] = Integer.parseInt(k[i]);\n\t\t}\n\t\tint i = 0;\n\t\tint count = 0;\n\t\twhile(i<v-1){\n\t\t\tfor (int j = v-1; j >-1; j--) {\n\t\t\t\tint key=j-1;\n\t\t\t\tif(vs[key]>vs[j]){\n\t\t\t\t\tint a=vs[key];\n\t\t\t\t\tint b = vs[j];\n\t\t\t\t\tvs[key]=b;\n\t\t\t\t\tvs[j]=a;\n\t\t\t\t\tcount++;\n\t\t\t\t}key--;\n\t\t\t\tif (key<0) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}i++;\n\t\t}\n\t\t\n\t\tfor (int j = 0; j < v-1 ; j++) {\n\t\t\tSystem.out.print(vs[j]+\" \");\n\n\t\t}\n\t\t\t\tSystem.out.println(vs[v-1]);\n\t\t\t\tSystem.out.println(count);\n\n\n\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] arges) {
Scanner sc = new Scanner(System.in);
String line = sc.nextLine();
int v = Integer.parseInt(line);
int[] vs = new int[v];
String line2 = sc.nextLine();
String[] k = line2.split(" ");
for (int i = 0; i < v; i++) {
vs[i] = Integer.parseInt(k[i]);
}
int i = 0;
int count = 0;
while(i<v-1){
for (int j = v-1; j >-1; j--) {
int key=j-1;
if(vs[key]>vs[j]){
int a=vs[key];
int b = vs[j];
vs[key]=b;
vs[j]=a;
count++;
}key--;
if (key<0) {
break;
}
}i++;
}
for (int j = 0; j < v-1 ; j++) {
System.out.print(vs[j]+" ");
}
System.out.println(vs[v-1]);
System.out.println(count);
}
} |
[
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,
4,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
0,
13,
17,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
13,
2,
18,
13,
13,
17,
4,
18,
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
],
[
170,
8
],
[
170,
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
],
[
44,
47
],
[
9,
48
],
[
48,
49
],
[
170,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
56,
58
],
[
52,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
61,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
65,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
65,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
87,
89
],
[
80,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
90,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
90,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
105,
111
],
[
90,
112
],
[
112,
113
],
[
112,
114
],
[
90,
115
],
[
115,
116
],
[
115,
117
],
[
52,
118
],
[
118,
119
],
[
118,
120
],
[
52,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
50,
127
],
[
127,
128
],
[
50,
129
],
[
129,
130
],
[
170,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
137,
147
],
[
147,
148
],
[
148,
149
],
[
137,
150
],
[
151,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
133,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
164,
165
],
[
165,
166
],
[
131,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"import java.io.IOException;\nimport java.util.Scanner;\n\n/**\n * バブルソート\n * \n *\n */\n\npublic class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint n = s.nextInt();\n\t\t\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = s.nextInt();\n\t\t}\n\t\t\n\t\tbubbleSort(arr, n);\n\t\t\n\t}\n\t\n\tpublic static void bubbleSort(int[] arr, int n) {\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(arr);\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void printArray(int[] arr) {\n\t\tString ans = \"\";\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tans += arr[i] + \" \";\n\t\t}\n\t\tSystem.out.println(ans.trim());\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint n = s.nextInt();\n\t\t\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = s.nextInt();\n\t\t}\n\t\t\n\t\tbubbleSort(arr, n);\n\t\t\n\t}\n\t\n\tpublic static void bubbleSort(int[] arr, int n) {\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(arr);\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void printArray(int[] arr) {\n\t\tString ans = \"\";\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tans += arr[i] + \" \";\n\t\t}\n\t\tSystem.out.println(ans.trim());\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint n = s.nextInt();\n\t\t\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = s.nextInt();\n\t\t}\n\t\t\n\t\tbubbleSort(arr, n);\n\t\t\n\t}",
"main",
"{\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint n = s.nextInt();\n\t\t\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = s.nextInt();\n\t\t}\n\t\t\n\t\tbubbleSort(arr, n);\n\t\t\n\t}",
"Scanner s = new Scanner(System.in);",
"s",
"new Scanner(System.in)",
"int n = s.nextInt();",
"n",
"s.nextInt()",
"s.nextInt",
"s",
"int[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tarr[i] = s.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tarr[i] = s.nextInt();\n\t\t}",
"{\n\t\t\tarr[i] = s.nextInt();\n\t\t}",
"arr[i] = s.nextInt()",
"arr[i]",
"arr",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"bubbleSort(arr, n)",
"bubbleSort",
"arr",
"n",
"String[] args",
"args",
"public static void bubbleSort(int[] arr, int n) {\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(arr);\n\t\tSystem.out.println(count);\n\t}",
"bubbleSort",
"{\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(arr);\n\t\tSystem.out.println(count);\n\t}",
"boolean flag = true;",
"flag",
"true",
"int count = 0;",
"count",
"0",
"while (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = false",
"flag",
"false",
"for (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}",
"int j = n-1;",
"int j = n-1;",
"j",
"n-1",
"n",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}",
"if (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}",
"arr[j] < arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}",
"int tmp = arr[j];",
"tmp",
"arr[j]",
"arr",
"j",
"arr[j] = arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"arr[j-1] = tmp",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"tmp",
"flag = true",
"flag",
"true",
"count += 1",
"count",
"1",
"printArray(arr)",
"printArray",
"arr",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int[] arr",
"arr",
"int n",
"n",
"public static void printArray(int[] arr) {\n\t\tString ans = \"\";\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tans += arr[i] + \" \";\n\t\t}\n\t\tSystem.out.println(ans.trim());\n\t}",
"printArray",
"{\n\t\tString ans = \"\";\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tans += arr[i] + \" \";\n\t\t}\n\t\tSystem.out.println(ans.trim());\n\t}",
"String ans = \"\";",
"ans",
"\"\"",
"for (int i = 0; i < arr.length; i++) {\n\t\t\tans += arr[i] + \" \";\n\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\tans += arr[i] + \" \";\n\t\t}",
"{\n\t\t\tans += arr[i] + \" \";\n\t\t}",
"ans += arr[i] + \" \"",
"ans",
"arr[i] + \" \"",
"arr[i]",
"arr",
"i",
"\" \"",
"System.out.println(ans.trim())",
"System.out.println",
"System.out",
"System",
"System.out",
"ans.trim()",
"ans.trim",
"ans",
"int[] arr",
"arr",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint n = s.nextInt();\n\t\t\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = s.nextInt();\n\t\t}\n\t\t\n\t\tbubbleSort(arr, n);\n\t\t\n\t}\n\t\n\tpublic static void bubbleSort(int[] arr, int n) {\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(arr);\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void printArray(int[] arr) {\n\t\tString ans = \"\";\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tans += arr[i] + \" \";\n\t\t}\n\t\tSystem.out.println(ans.trim());\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws IOException {\n\t\tScanner s = new Scanner(System.in);\n\n\t\tint n = s.nextInt();\n\t\t\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tarr[i] = s.nextInt();\n\t\t}\n\t\t\n\t\tbubbleSort(arr, n);\n\t\t\n\t}\n\t\n\tpublic static void bubbleSort(int[] arr, int n) {\n\t\tboolean flag = true;\n\t\tint count = 0;\n\t\twhile (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int j = n-1; j > 0; j--) {\n\t\t\t\tif (arr[j] < arr[j-1]) {\n\t\t\t\t\tint tmp = arr[j];\n\t\t\t\t\tarr[j] = arr[j-1];\n\t\t\t\t\tarr[j-1] = tmp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(arr);\n\t\tSystem.out.println(count);\n\t}\n\t\n\tpublic static void printArray(int[] arr) {\n\t\tString ans = \"\";\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tans += arr[i] + \" \";\n\t\t}\n\t\tSystem.out.println(ans.trim());\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.util.Scanner;
/**
* バブルソート
*
*
*/
public class Main {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextInt();
}
bubbleSort(arr, n);
}
public static void bubbleSort(int[] arr, int n) {
boolean flag = true;
int count = 0;
while (flag) {
flag = false;
for (int j = n-1; j > 0; j--) {
if (arr[j] < arr[j-1]) {
int tmp = arr[j];
arr[j] = arr[j-1];
arr[j-1] = tmp;
flag = true;
count += 1;
}
}
}
printArray(arr);
System.out.println(count);
}
public static void printArray(int[] arr) {
String ans = "";
for (int i = 0; i < arr.length; i++) {
ans += arr[i] + " ";
}
System.out.println(ans.trim());
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
4,
18,
13,
4,
18,
13,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
30,
4,
18,
13,
13,
13,
2,
13,
17,
40,
13,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
4,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
139,
5
],
[
139,
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
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
35,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
54,
56
],
[
50,
57
],
[
57,
58
],
[
57,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
50,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
66,
71
],
[
71,
72
],
[
72,
73
],
[
71,
74
],
[
74,
75
],
[
74,
76
],
[
65,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
78,
81
],
[
78,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
77,
86
],
[
86,
87
],
[
77,
88
],
[
88,
89
],
[
88,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
96,
97
],
[
96,
98
],
[
91,
99
],
[
99,
100
],
[
100,
101
],
[
91,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
113,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
8,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
8,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
6,
136
],
[
136,
137
],
[
0,
138
],
[
138,
139
],
[
138,
140
]
] | [
"\nimport java.util.*;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),c=0;List<Integer> A=new ArrayList<>();\n\t\tfor(int i=0;i<n;i++)A.add(cin.nextInt());\n\t\t\n\t\tboolean flag=true;\n\t\twhile(flag) {\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(c);\n\t}\n\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),c=0;List<Integer> A=new ArrayList<>();\n\t\tfor(int i=0;i<n;i++)A.add(cin.nextInt());\n\t\t\n\t\tboolean flag=true;\n\t\twhile(flag) {\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(c);\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),c=0;List<Integer> A=new ArrayList<>();\n\t\tfor(int i=0;i<n;i++)A.add(cin.nextInt());\n\t\t\n\t\tboolean flag=true;\n\t\twhile(flag) {\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(c);\n\t}",
"main",
"{\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),c=0;List<Integer> A=new ArrayList<>();\n\t\tfor(int i=0;i<n;i++)A.add(cin.nextInt());\n\t\t\n\t\tboolean flag=true;\n\t\twhile(flag) {\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(c);\n\t}",
"Scanner cin=new Scanner(System.in);",
"cin",
"new Scanner(System.in)",
"int n=cin.nextInt()",
"n",
"cin.nextInt()",
"cin.nextInt",
"cin",
"c=0;",
"c",
"0",
"List<Integer> A=new ArrayList<>();",
"A",
"new ArrayList<>()",
"for(int i=0;i<n;i++)A.add(cin.nextInt());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"A.add(cin.nextInt());",
"A.add(cin.nextInt())",
"A.add",
"A",
"cin.nextInt()",
"cin.nextInt",
"cin",
"boolean flag=true;",
"flag",
"true",
"while(flag) {\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"flag",
"{\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"flag=false",
"flag",
"false",
"for(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"int i=n-1;",
"int i=n-1;",
"i",
"n-1",
"n",
"1",
"i>0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"if(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}",
"A.get(i)<A.get(i-1)",
"A.get(i)",
"A.get",
"A",
"i",
"A.get(i-1)",
"A.get",
"A",
"i-1",
"i",
"1",
"{\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}",
"Collections.swap(A, i, i-1)",
"Collections.swap",
"Collections",
"A",
"i",
"i-1",
"i",
"1",
"c++",
"c",
"flag=true",
"flag",
"true",
"for(int i=0;i<n;i++) {\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}",
"System.out.print(A.get(i))",
"System.out.print",
"System.out",
"System",
"System.out",
"A.get(i)",
"A.get",
"A",
"i",
"if(i!=n-1)System.out.print(\" \");",
"i!=n-1",
"i",
"n-1",
"n",
"1",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),c=0;List<Integer> A=new ArrayList<>();\n\t\tfor(int i=0;i<n;i++)A.add(cin.nextInt());\n\t\t\n\t\tboolean flag=true;\n\t\twhile(flag) {\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(c);\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner cin=new Scanner(System.in);\n\t\t\n\t\tint n=cin.nextInt(),c=0;List<Integer> A=new ArrayList<>();\n\t\tfor(int i=0;i<n;i++)A.add(cin.nextInt());\n\t\t\n\t\tboolean flag=true;\n\t\twhile(flag) {\n\t\t\tflag=false;\n\t\t\tfor(int i=n-1;i>0;i--) {\n\t\t\t\tif(A.get(i)<A.get(i-1)) {\n\t\t\t\t\tCollections.swap(A, i, i-1);\n\t\t\t\t\tc++;\n\t\t\t\t\tflag=true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tSystem.out.print(A.get(i));\n\t\t\tif(i!=n-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(c);\n\t}\n\n}",
"Main"
] |
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner cin=new Scanner(System.in);
int n=cin.nextInt(),c=0;List<Integer> A=new ArrayList<>();
for(int i=0;i<n;i++)A.add(cin.nextInt());
boolean flag=true;
while(flag) {
flag=false;
for(int i=n-1;i>0;i--) {
if(A.get(i)<A.get(i-1)) {
Collections.swap(A, i, i-1);
c++;
flag=true;
}
}
}
for(int i=0;i<n;i++) {
System.out.print(A.get(i));
if(i!=n-1)System.out.print(" ");
}
System.out.println();
System.out.println(c);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
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,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
4,
18,
13,
2,
13,
17,
4,
18,
13,
13,
30,
41,
13,
4,
18,
13,
13,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
4,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
2,
4,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
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
],
[
161,
8
],
[
161,
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
],
[
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
],
[
36,
39
],
[
39,
40
],
[
40,
41
],
[
11,
42
],
[
42,
43
],
[
42,
44
],
[
11,
45
],
[
45,
46
],
[
45,
47
],
[
11,
48
],
[
48,
49
],
[
48,
50
],
[
11,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
61,
62
],
[
61,
63
],
[
57,
64
],
[
64,
65
],
[
64,
66
],
[
57,
67
],
[
67,
68
],
[
68,
69
],
[
57,
70
],
[
71,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
77,
79
],
[
73,
80
],
[
80,
81
],
[
81,
82
],
[
80,
83
],
[
72,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
84,
91
],
[
91,
92
],
[
92,
93
],
[
91,
94
],
[
91,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
84,
101
],
[
101,
102
],
[
102,
103
],
[
101,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
84,
108
],
[
108,
109
],
[
84,
110
],
[
110,
111
],
[
110,
112
],
[
53,
113
],
[
113,
114
],
[
11,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
115,
125
],
[
125,
126
],
[
126,
127
],
[
115,
128
],
[
129,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
135,
140
],
[
11,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
149,
150
],
[
149,
151
],
[
11,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
9,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
]
] | [
"import java.io.*;\nimport java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> nums = new ArrayList<>();\n for(int i=0; i<n; ++i) {\n nums.add(sc.nextInt());\n }\n\n boolean flag = true;\n int inversion = 0;\n int index = 0;\n while(flag) {\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }\n\n for(int i=0; i<n-1; ++i) {\n System.out.print(nums.get(i) + \" \");\n }\n System.out.println(nums.get(n-1));\n System.out.println(inversion);\n }\n}",
"import java.io.*;",
"io.*",
"java",
"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 List<Integer> nums = new ArrayList<>();\n for(int i=0; i<n; ++i) {\n nums.add(sc.nextInt());\n }\n\n boolean flag = true;\n int inversion = 0;\n int index = 0;\n while(flag) {\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }\n\n for(int i=0; i<n-1; ++i) {\n System.out.print(nums.get(i) + \" \");\n }\n System.out.println(nums.get(n-1));\n System.out.println(inversion);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> nums = new ArrayList<>();\n for(int i=0; i<n; ++i) {\n nums.add(sc.nextInt());\n }\n\n boolean flag = true;\n int inversion = 0;\n int index = 0;\n while(flag) {\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }\n\n for(int i=0; i<n-1; ++i) {\n System.out.print(nums.get(i) + \" \");\n }\n System.out.println(nums.get(n-1));\n System.out.println(inversion);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> nums = new ArrayList<>();\n for(int i=0; i<n; ++i) {\n nums.add(sc.nextInt());\n }\n\n boolean flag = true;\n int inversion = 0;\n int index = 0;\n while(flag) {\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }\n\n for(int i=0; i<n-1; ++i) {\n System.out.print(nums.get(i) + \" \");\n }\n System.out.println(nums.get(n-1));\n System.out.println(inversion);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer> nums = new ArrayList<>();",
"nums",
"new ArrayList<>()",
"for(int i=0; i<n; ++i) {\n nums.add(sc.nextInt());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"++i",
"++i",
"i",
"{\n nums.add(sc.nextInt());\n }",
"{\n nums.add(sc.nextInt());\n }",
"nums.add(sc.nextInt())",
"nums.add",
"nums",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean flag = true;",
"flag",
"true",
"int inversion = 0;",
"inversion",
"0",
"int index = 0;",
"index",
"0",
"while(flag) {\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }",
"flag",
"{\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }",
"flag = false",
"flag",
"false",
"for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }",
"int i=n-1;",
"int i=n-1;",
"i",
"n-1",
"n",
"1",
"i>index",
"i",
"index",
"--i",
"--i",
"i",
"{\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }",
"{\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }",
"if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }",
"nums.get(i-1) > nums.get(i)",
"nums.get(i-1)",
"nums.get",
"nums",
"i-1",
"i",
"1",
"nums.get(i)",
"nums.get",
"nums",
"i",
"{\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }",
"int tmp = nums.get(i);",
"tmp",
"nums.get(i)",
"nums.get",
"nums",
"i",
"nums.set(i, nums.get(i-1))",
"nums.set",
"nums",
"i",
"nums.get(i-1)",
"nums.get",
"nums",
"i-1",
"i",
"1",
"nums.set(i-1, tmp)",
"nums.set",
"nums",
"i-1",
"i",
"1",
"tmp",
"inversion++",
"inversion",
"flag = true",
"flag",
"true",
"index++",
"index",
"for(int i=0; i<n-1; ++i) {\n System.out.print(nums.get(i) + \" \");\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n-1",
"i",
"n-1",
"n",
"1",
"++i",
"++i",
"i",
"{\n System.out.print(nums.get(i) + \" \");\n }",
"{\n System.out.print(nums.get(i) + \" \");\n }",
"System.out.print(nums.get(i) + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"nums.get(i) + \" \"",
"nums.get(i)",
"nums.get",
"nums",
"i",
"\" \"",
"System.out.println(nums.get(n-1))",
"System.out.println",
"System.out",
"System",
"System.out",
"nums.get(n-1)",
"nums.get",
"nums",
"n-1",
"n",
"1",
"System.out.println(inversion)",
"System.out.println",
"System.out",
"System",
"System.out",
"inversion",
"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 List<Integer> nums = new ArrayList<>();\n for(int i=0; i<n; ++i) {\n nums.add(sc.nextInt());\n }\n\n boolean flag = true;\n int inversion = 0;\n int index = 0;\n while(flag) {\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }\n\n for(int i=0; i<n-1; ++i) {\n System.out.print(nums.get(i) + \" \");\n }\n System.out.println(nums.get(n-1));\n System.out.println(inversion);\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 List<Integer> nums = new ArrayList<>();\n for(int i=0; i<n; ++i) {\n nums.add(sc.nextInt());\n }\n\n boolean flag = true;\n int inversion = 0;\n int index = 0;\n while(flag) {\n flag = false;\n for(int i=n-1; i>index;--i) {\n if(nums.get(i-1) > nums.get(i)) {\n int tmp = nums.get(i);\n nums.set(i, nums.get(i-1));\n nums.set(i-1, tmp);\n inversion++;\n flag = true;\n }\n }\n index++;\n }\n\n for(int i=0; i<n-1; ++i) {\n System.out.print(nums.get(i) + \" \");\n }\n System.out.println(nums.get(n-1));\n System.out.println(inversion);\n }\n}",
"Main"
] | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
List<Integer> nums = new ArrayList<>();
for(int i=0; i<n; ++i) {
nums.add(sc.nextInt());
}
boolean flag = true;
int inversion = 0;
int index = 0;
while(flag) {
flag = false;
for(int i=n-1; i>index;--i) {
if(nums.get(i-1) > nums.get(i)) {
int tmp = nums.get(i);
nums.set(i, nums.get(i-1));
nums.set(i-1, tmp);
inversion++;
flag = true;
}
}
index++;
}
for(int i=0; i<n-1; ++i) {
System.out.print(nums.get(i) + " ");
}
System.out.println(nums.get(n-1));
System.out.println(inversion);
}
} |
[
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,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
0,
18,
13,
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,
0,
18,
13,
13,
2,
18,
13,
13,
18,
13,
2,
13,
17,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
175,
5
],
[
175,
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
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
55,
62
],
[
62,
63
],
[
62,
64
],
[
55,
65
],
[
65,
66
],
[
66,
67
],
[
55,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
70,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
85,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
80,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
80,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
117,
119
],
[
119,
120
],
[
119,
121
],
[
80,
122
],
[
122,
123
],
[
122,
124
],
[
80,
125
],
[
125,
126
],
[
8,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
127,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
145,
147
],
[
139,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
148,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
8,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
8,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
6,
172
],
[
172,
173
],
[
0,
174
],
[
174,
175
],
[
174,
176
]
] | [
"import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner a = new Scanner(System.in);\n int n = a.nextInt();\n int A[] = new int[n];\n for(int i=0; i<n; i++){\n A[i] = a.nextInt();\n }\n int flag = 1;\n int count = 0;\n while(flag==1){\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }\n for(int i=0; i<n; i++){\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args){\n Scanner a = new Scanner(System.in);\n int n = a.nextInt();\n int A[] = new int[n];\n for(int i=0; i<n; i++){\n A[i] = a.nextInt();\n }\n int flag = 1;\n int count = 0;\n while(flag==1){\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }\n for(int i=0; i<n; i++){\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner a = new Scanner(System.in);\n int n = a.nextInt();\n int A[] = new int[n];\n for(int i=0; i<n; i++){\n A[i] = a.nextInt();\n }\n int flag = 1;\n int count = 0;\n while(flag==1){\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }\n for(int i=0; i<n; i++){\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(count);\n }",
"main",
"{\n Scanner a = new Scanner(System.in);\n int n = a.nextInt();\n int A[] = new int[n];\n for(int i=0; i<n; i++){\n A[i] = a.nextInt();\n }\n int flag = 1;\n int count = 0;\n while(flag==1){\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }\n for(int i=0; i<n; i++){\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(count);\n }",
"Scanner a = new Scanner(System.in);",
"a",
"new Scanner(System.in)",
"int n = a.nextInt();",
"n",
"a.nextInt()",
"a.nextInt",
"a",
"int A[] = new int[n];",
"A",
"new int[n]",
"n",
"for(int i=0; i<n; i++){\n A[i] = a.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n A[i] = a.nextInt();\n }",
"{\n A[i] = a.nextInt();\n }",
"A[i] = a.nextInt()",
"A[i]",
"A",
"i",
"a.nextInt()",
"a.nextInt",
"a",
"int flag = 1;",
"flag",
"1",
"int count = 0;",
"count",
"0",
"while(flag==1){\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }",
"flag==1",
"flag",
"1",
"{\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }",
"flag = 0",
"flag",
"0",
"for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n }",
"int i=n-1;",
"int i=n-1;",
"i",
"n-1",
"n",
"1",
"i>=1",
"i",
"1",
"i--",
"i--",
"i",
"{\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n }",
"{\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n }",
"if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }",
"A[i] < A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }",
"A[i] = A[i] + A[i-1]",
"A[i]",
"A",
"i",
"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",
"A[i]= A[i] - A[i-1]",
"A[i]",
"A",
"i",
"A[i] - A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"flag = 1",
"flag",
"1",
"count++",
"count",
"for(int i=0; i<n; i++){\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }",
"{\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"if(i<n-1){\n System.out.print(\" \");\n }",
"i<n-1",
"i",
"n-1",
"n",
"1",
"{\n System.out.print(\" \");\n }",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"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 a = new Scanner(System.in);\n int n = a.nextInt();\n int A[] = new int[n];\n for(int i=0; i<n; i++){\n A[i] = a.nextInt();\n }\n int flag = 1;\n int count = 0;\n while(flag==1){\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }\n for(int i=0; i<n; i++){\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner a = new Scanner(System.in);\n int n = a.nextInt();\n int A[] = new int[n];\n for(int i=0; i<n; i++){\n A[i] = a.nextInt();\n }\n int flag = 1;\n int count = 0;\n while(flag==1){\n flag = 0;\n for(int i=n-1; i>=1; i--){\n if(A[i] < A[i-1]){\n A[i] = A[i] + A[i-1];\n A[i-1] = A[i] - A[i-1];\n A[i]= A[i] - A[i-1];\n flag = 1;\n count++;\n }\n } \n }\n for(int i=0; i<n; i++){\n System.out.print(A[i]);\n if(i<n-1){\n System.out.print(\" \");\n }\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"Main"
] | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner a = new Scanner(System.in);
int n = a.nextInt();
int A[] = new int[n];
for(int i=0; i<n; i++){
A[i] = a.nextInt();
}
int flag = 1;
int count = 0;
while(flag==1){
flag = 0;
for(int i=n-1; i>=1; i--){
if(A[i] < A[i-1]){
A[i] = A[i] + A[i-1];
A[i-1] = A[i] - A[i-1];
A[i]= A[i] - A[i-1];
flag = 1;
count++;
}
}
}
for(int i=0; i<n; i++){
System.out.print(A[i]);
if(i<n-1){
System.out.print(" ");
}
}
System.out.println();
System.out.println(count);
}
}
|
[
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,
4,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
0,
13,
17,
40,
13,
40,
13,
41,
13,
4,
18,
4,
18,
13,
13,
17,
17,
4,
18,
18,
13,
13,
4,
18,
13,
17,
2,
4,
18,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
160,
8
],
[
160,
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
],
[
44,
47
],
[
11,
48
],
[
48,
49
],
[
49,
50
],
[
9,
51
],
[
51,
52
],
[
160,
53
],
[
53,
54
],
[
53,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
55,
59
],
[
59,
60
],
[
59,
61
],
[
55,
62
],
[
62,
63
],
[
62,
64
],
[
55,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
67,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
75,
76
],
[
75,
77
],
[
71,
78
],
[
78,
79
],
[
78,
80
],
[
71,
81
],
[
81,
82
],
[
82,
83
],
[
71,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
86,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
108,
110
],
[
96,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
96,
118
],
[
118,
119
],
[
118,
120
],
[
96,
121
],
[
121,
122
],
[
67,
123
],
[
123,
124
],
[
55,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
127,
133
],
[
127,
134
],
[
55,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
141,
142
],
[
140,
143
],
[
140,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
144,
148
],
[
55,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
53,
155
],
[
155,
156
],
[
53,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] | [
"\n\nimport java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tbubbleSort(A, N);\n\t\tscan.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\t// ???????????°\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tString output = Arrays.toString(A).replaceAll(\",\", \"\");\n\t\tSystem.out.println(output.substring(1, output.length() - 1));\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tbubbleSort(A, N);\n\t\tscan.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\t// ???????????°\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tString output = Arrays.toString(A).replaceAll(\",\", \"\");\n\t\tSystem.out.println(output.substring(1, output.length() - 1));\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tbubbleSort(A, N);\n\t\tscan.close();\n\t}",
"main",
"{\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tbubbleSort(A, N);\n\t\tscan.close();\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 = new int[N];",
"A",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tA[i] = scan.nextInt();\n\t\t}",
"{\n\t\t\tA[i] = scan.nextInt();\n\t\t}",
"A[i] = scan.nextInt()",
"A[i]",
"A",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"bubbleSort(A, N)",
"bubbleSort",
"A",
"N",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public static void bubbleSort(int[] A, int N) {\n\t\t// ???????????°\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tString output = Arrays.toString(A).replaceAll(\",\", \"\");\n\t\tSystem.out.println(output.substring(1, output.length() - 1));\n\t\tSystem.out.println(count);\n\t}",
"bubbleSort",
"{\n\t\t// ???????????°\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tString output = Arrays.toString(A).replaceAll(\",\", \"\");\n\t\tSystem.out.println(output.substring(1, output.length() - 1));\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"int i = 0;",
"i",
"0",
"while(flag){\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}",
"flag = false",
"flag",
"false",
"for (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = N - 1;",
"int j = N - 1;",
"j",
"N - 1",
"N",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"A[j] < A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int temp = A[j];",
"temp",
"A[j]",
"A",
"j",
"A[j] = A[j - 1]",
"A[j]",
"A",
"j",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"A[j - 1] = temp",
"A[j - 1]",
"A",
"j - 1",
"j",
"1",
"temp",
"flag = true",
"flag",
"true",
"count++",
"count",
"i++",
"i",
"String output = Arrays.toString(A).replaceAll(\",\", \"\");",
"output",
"Arrays.toString(A).replaceAll(\",\", \"\")",
"Arrays.toString(A).replaceAll",
"Arrays.toString(A)",
"Arrays.toString",
"Arrays",
"A",
"\",\"",
"\"\"",
"System.out.println(output.substring(1, output.length() - 1))",
"System.out.println",
"System.out",
"System",
"System.out",
"output.substring(1, output.length() - 1)",
"output.substring",
"output",
"1",
"output.length() - 1",
"output.length()",
"output.length",
"output",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int[] A",
"A",
"int N",
"N",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tbubbleSort(A, N);\n\t\tscan.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\t// ???????????°\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tString output = Arrays.toString(A).replaceAll(\",\", \"\");\n\t\tSystem.out.println(output.substring(1, output.length() - 1));\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint N = scan.nextInt();\n\t\tint[] A = new int[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tA[i] = scan.nextInt();\n\t\t}\n\t\tbubbleSort(A, N);\n\t\tscan.close();\n\t}\n\n\tpublic static void bubbleSort(int[] A, int N) {\n\t\t// ???????????°\n\t\tint count = 0;\n\t\tboolean flag = true;\n\t\tint i = 0;\n\t\twhile(flag){\n\t\t\tflag = false;\n\t\t\tfor (int j = N - 1; j > i; j--) {\n\t\t\t\tif (A[j] < A[j - 1]) {\n\t\t\t\t\tint temp = A[j];\n\t\t\t\t\tA[j] = A[j - 1];\n\t\t\t\t\tA[j - 1] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tString output = Arrays.toString(A).replaceAll(\",\", \"\");\n\t\tSystem.out.println(output.substring(1, output.length() - 1));\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = scan.nextInt();
}
bubbleSort(A, N);
scan.close();
}
public static void bubbleSort(int[] A, int N) {
// ???????????°
int count = 0;
boolean flag = true;
int i = 0;
while(flag){
flag = false;
for (int j = N - 1; j > i; j--) {
if (A[j] < A[j - 1]) {
int temp = A[j];
A[j] = A[j - 1];
A[j - 1] = temp;
flag = true;
count++;
}
}
i++;
}
String output = Arrays.toString(A).replaceAll(",", "");
System.out.println(output.substring(1, output.length() - 1));
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,
4,
13,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
18,
13,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
13,
2,
13,
17,
40,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
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,
4,
18,
13,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
17,
4,
18,
13,
17,
4,
18,
18,
13,
13,
4,
18,
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
],
[
43,
44
],
[
43,
45
],
[
8,
46
],
[
46,
47
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
6,
55
],
[
55,
56
],
[
4,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
59,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
63,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
70,
72
],
[
63,
73
],
[
73,
74
],
[
74,
75
],
[
63,
76
],
[
77,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
78,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
78,
92
],
[
92,
93
],
[
93,
94
],
[
78,
95
],
[
96,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
108,
111
],
[
108,
112
],
[
112,
113
],
[
112,
114
],
[
107,
115
],
[
115,
116
],
[
59,
117
],
[
117,
118
],
[
57,
119
],
[
119,
120
],
[
4,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
123,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
123,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
121,
141
],
[
141,
142
],
[
121,
143
],
[
143,
144
],
[
121,
145
],
[
145,
146
],
[
4,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
153,
163
],
[
163,
164
],
[
164,
165
],
[
153,
166
],
[
167,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
168,
171
],
[
171,
172
],
[
171,
173
],
[
167,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
177,
181
],
[
174,
182
],
[
182,
183
],
[
183,
184
],
[
182,
185
],
[
149,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
186,
191
],
[
191,
192
],
[
192,
193
],
[
147,
194
],
[
194,
195
]
] | [
"import java.util.Scanner;\n\nclass Main { \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n int[] numbers = new int[N];\n for (int i = 0; i < N; i++) {\n numbers[i] = in.nextInt();\n }\n int count = bubbleSort(numbers);\n trace(numbers);\n System.out.println(count);\n }\n \n public static int bubbleSort(int[] array) {\n int count = 0;\n for (int i = 0; i < array.length; i++) {\n for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }\n }\n return count;\n }\n \n public static void swap(int[] array, int p, int q) {\n int temp = array[p];\n array[p] = array[q];\n array[q] = temp;\n }\n \n public static void trace(int[] array) {\n StringBuilder output = new StringBuilder();\n for (int i = 0; i < array.length; i++) {\n output.append(array[i]);\n if (i != array.length -1) output.append(\" \");\n }\n System.out.println(output.toString());\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main { \n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n int[] numbers = new int[N];\n for (int i = 0; i < N; i++) {\n numbers[i] = in.nextInt();\n }\n int count = bubbleSort(numbers);\n trace(numbers);\n System.out.println(count);\n }\n \n public static int bubbleSort(int[] array) {\n int count = 0;\n for (int i = 0; i < array.length; i++) {\n for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }\n }\n return count;\n }\n \n public static void swap(int[] array, int p, int q) {\n int temp = array[p];\n array[p] = array[q];\n array[q] = temp;\n }\n \n public static void trace(int[] array) {\n StringBuilder output = new StringBuilder();\n for (int i = 0; i < array.length; i++) {\n output.append(array[i]);\n if (i != array.length -1) output.append(\" \");\n }\n System.out.println(output.toString());\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n int[] numbers = new int[N];\n for (int i = 0; i < N; i++) {\n numbers[i] = in.nextInt();\n }\n int count = bubbleSort(numbers);\n trace(numbers);\n System.out.println(count);\n }",
"main",
"{\n Scanner in = new Scanner(System.in);\n int N = in.nextInt();\n int[] numbers = new int[N];\n for (int i = 0; i < N; i++) {\n numbers[i] = in.nextInt();\n }\n int count = bubbleSort(numbers);\n trace(numbers);\n System.out.println(count);\n }",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"int[] numbers = new int[N];",
"numbers",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n numbers[i] = in.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n numbers[i] = in.nextInt();\n }",
"{\n numbers[i] = in.nextInt();\n }",
"numbers[i] = in.nextInt()",
"numbers[i]",
"numbers",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"int count = bubbleSort(numbers);",
"count",
"bubbleSort(numbers)",
"bubbleSort",
"numbers",
"trace(numbers)",
"trace",
"numbers",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int bubbleSort(int[] array) {\n int count = 0;\n for (int i = 0; i < array.length; i++) {\n for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }\n }\n return count;\n }",
"bubbleSort",
"{\n int count = 0;\n for (int i = 0; i < array.length; i++) {\n for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }\n }\n return count;\n }",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < array.length; i++) {\n for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }\n }",
"{\n for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }\n }",
"for (int j = array.length - 1; j >= i + 1; j--) {\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }",
"int j = array.length - 1;",
"int j = array.length - 1;",
"j",
"array.length - 1",
"array.length",
"array",
"array.length",
"1",
"j >= i + 1",
"j",
"i + 1",
"i",
"1",
"j--",
"j--",
"j",
"{\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }",
"{\n if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }\n }",
"if (array[j] < array[j - 1]) {\n swap(array, j, j - 1);\n count++;\n }",
"array[j] < array[j - 1]",
"array[j]",
"array",
"j",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"{\n swap(array, j, j - 1);\n count++;\n }",
"swap(array, j, j - 1)",
"swap",
"array",
"j",
"j - 1",
"j",
"1",
"count++",
"count",
"return count;",
"count",
"int[] array",
"array",
"public static void swap(int[] array, int p, int q) {\n int temp = array[p];\n array[p] = array[q];\n array[q] = temp;\n }",
"swap",
"{\n int temp = array[p];\n array[p] = array[q];\n array[q] = temp;\n }",
"int temp = array[p];",
"temp",
"array[p]",
"array",
"p",
"array[p] = array[q]",
"array[p]",
"array",
"p",
"array[q]",
"array",
"q",
"array[q] = temp",
"array[q]",
"array",
"q",
"temp",
"int[] array",
"array",
"int p",
"p",
"int q",
"q",
"public static void trace(int[] array) {\n StringBuilder output = new StringBuilder();\n for (int i = 0; i < array.length; i++) {\n output.append(array[i]);\n if (i != array.length -1) output.append(\" \");\n }\n System.out.println(output.toString());\n }",
"trace",
"{\n StringBuilder output = new StringBuilder();\n for (int i = 0; i < array.length; i++) {\n output.append(array[i]);\n if (i != array.length -1) output.append(\" \");\n }\n System.out.println(output.toString());\n }",
"StringBuilder output = new StringBuilder();",
"output",
"new StringBuilder()",
"for (int i = 0; i < array.length; i++) {\n output.append(array[i]);\n if (i != array.length -1) output.append(\" \");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n output.append(array[i]);\n if (i != array.length -1) output.append(\" \");\n }",
"{\n output.append(array[i]);\n if (i != array.length -1) output.append(\" \");\n }",
"output.append(array[i])",
"output.append",
"output",
"array[i]",
"array",
"i",
"if (i != array.length -1) output.append(\" \");",
"i != array.length -1",
"i",
"array.length -1",
"array.length",
"array",
"array.length",
"1",
"output.append(\" \")",
"output.append",
"output",
"\" \"",
"System.out.println(output.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"output.toString()",
"output.toString",
"output",
"int[] array",
"array"
] | import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[] numbers = new int[N];
for (int i = 0; i < N; i++) {
numbers[i] = in.nextInt();
}
int count = bubbleSort(numbers);
trace(numbers);
System.out.println(count);
}
public static int bubbleSort(int[] array) {
int count = 0;
for (int i = 0; i < array.length; i++) {
for (int j = array.length - 1; j >= i + 1; j--) {
if (array[j] < array[j - 1]) {
swap(array, j, j - 1);
count++;
}
}
}
return count;
}
public static void swap(int[] array, int p, int q) {
int temp = array[p];
array[p] = array[q];
array[q] = temp;
}
public static void trace(int[] array) {
StringBuilder output = new StringBuilder();
for (int i = 0; i < array.length; i++) {
output.append(array[i]);
if (i != array.length -1) output.append(" ");
}
System.out.println(output.toString());
}
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.