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,
17,
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,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
41,
13,
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,
30,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
2,
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
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
17,
20
],
[
20,
21
],
[
21,
22
],
[
8,
23
],
[
23,
24
],
[
23,
25
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
29,
34
],
[
8,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
55,
57
],
[
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
],
[
8,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
135,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
130,
141
],
[
142,
142
],
[
142,
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
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
6,
161
],
[
161,
162
]
] | [
"import java.util.Scanner;\n\nclass Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int n = Integer.parseInt(sc.nextLine());\n int[] array = new int[n];\n String[] input = sc.nextLine().split(\" \");\n \n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(input[i]);\n }\n for(int i = 0; i < n-1; i++){\n for(int j = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < n; i++){\n System.out.print(\" \"+array[i]);\n }\n System.out.println(\"\\n\"+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\n int count = 0;\n int n = Integer.parseInt(sc.nextLine());\n int[] array = new int[n];\n String[] input = sc.nextLine().split(\" \");\n \n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(input[i]);\n }\n for(int i = 0; i < n-1; i++){\n for(int j = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < n; i++){\n System.out.print(\" \"+array[i]);\n }\n System.out.println(\"\\n\"+count);\n \n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int n = Integer.parseInt(sc.nextLine());\n int[] array = new int[n];\n String[] input = sc.nextLine().split(\" \");\n \n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(input[i]);\n }\n for(int i = 0; i < n-1; i++){\n for(int j = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < n; i++){\n System.out.print(\" \"+array[i]);\n }\n System.out.println(\"\\n\"+count);\n \n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int n = Integer.parseInt(sc.nextLine());\n int[] array = new int[n];\n String[] input = sc.nextLine().split(\" \");\n \n for(int i = 0; i < n; i++){\n array[i] = Integer.parseInt(input[i]);\n }\n for(int i = 0; i < n-1; i++){\n for(int j = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < n; i++){\n System.out.print(\" \"+array[i]);\n }\n System.out.println(\"\\n\"+count);\n \n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count = 0;",
"count",
"0",
"int n = Integer.parseInt(sc.nextLine());",
"n",
"Integer.parseInt(sc.nextLine())",
"Integer.parseInt",
"Integer",
"sc.nextLine()",
"sc.nextLine",
"sc",
"int[] array = new int[n];",
"array",
"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 array[i] = Integer.parseInt(input[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n array[i] = Integer.parseInt(input[i]);\n }",
"{\n array[i] = Integer.parseInt(input[i]);\n }",
"array[i] = Integer.parseInt(input[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"for(int i = 0; i < n-1; i++){\n for(int j = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\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 = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }\n }",
"{\n for(int j = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }\n }",
"for(int j = 0; j < n-1; j++){\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n-1",
"j",
"n-1",
"n",
"1",
"j++",
"j++",
"j",
"{\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }",
"{\n if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }\n }",
"if(array[j] > array[j+1]){\n int tmp = array[j];\n array[j] = array[j+1];\n array[j+1] = 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];\n array[j] = array[j+1];\n array[j+1] = tmp;\n count++;\n }",
"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",
"System.out.print(array[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"array[0]",
"array",
"0",
"for(int i = 1; i < n; i++){\n System.out.print(\" \"+array[i]);\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"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(\"\\n\"+count)",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\\n\"+count",
"\"\\n\"",
"count",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int count = 0;
int n = Integer.parseInt(sc.nextLine());
int[] array = new int[n];
String[] input = sc.nextLine().split(" ");
for(int i = 0; i < n; i++){
array[i] = Integer.parseInt(input[i]);
}
for(int i = 0; i < n-1; i++){
for(int j = 0; j < n-1; j++){
if(array[j] > array[j+1]){
int tmp = array[j];
array[j] = array[j+1];
array[j+1] = tmp;
count++;
}
}
}
System.out.print(array[0]);
for(int i = 1; i < n; i++){
System.out.print(" "+array[i]);
}
System.out.println("\n"+count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
42,
4,
18,
13,
30,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
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,
41,
13,
4,
13,
13,
4,
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,
18,
13,
13,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
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,
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,
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
],
[
221,
14
],
[
221,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
24,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
29,
32
],
[
32,
33
],
[
33,
34
],
[
17,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
39,
42
],
[
37,
43
],
[
17,
44
],
[
44,
45
],
[
44,
46
],
[
47,
48
],
[
47,
49
],
[
17,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
57,
59
],
[
50,
60
],
[
60,
61
],
[
61,
62
],
[
50,
63
],
[
64,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
72,
73
],
[
72,
74
],
[
17,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
77,
79
],
[
17,
80
],
[
80,
81
],
[
80,
82
],
[
80,
83
],
[
15,
84
],
[
84,
85
],
[
221,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
89,
101
],
[
101,
102
],
[
102,
103
],
[
89,
104
],
[
105,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
108,
109
],
[
108,
110
],
[
106,
111
],
[
111,
112
],
[
111,
113
],
[
105,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
88,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
88,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
86,
138
],
[
138,
139
],
[
86,
140
],
[
140,
141
],
[
221,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
147,
148
],
[
147,
149
],
[
144,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
150,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
150,
160
],
[
160,
161
],
[
161,
162
],
[
150,
163
],
[
164,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
165,
174
],
[
174,
175
],
[
174,
176
],
[
165,
177
],
[
177,
178
],
[
178,
179
],
[
165,
180
],
[
181,
181
],
[
181,
182
],
[
182,
183
],
[
183,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
183,
189
],
[
189,
190
],
[
189,
191
],
[
182,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
195,
197
],
[
192,
198
],
[
198,
199
],
[
199,
200
],
[
199,
201
],
[
198,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
204,
206
],
[
192,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
210,
211
],
[
210,
212
],
[
207,
213
],
[
192,
214
],
[
214,
215
],
[
144,
216
],
[
216,
217
],
[
142,
218
],
[
218,
219
],
[
0,
220
],
[
220,
221
],
[
220,
222
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.util.ArrayList;\n\npublic class Main {\n\n\tpublic static void main(String[] args) throws IOException{\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tArrayList<String> lines = new ArrayList<String>();\n\t\twhile (br.ready()){\n\t\t\tlines.add(br.readLine());\n\t\t}\n\t\tString[] tmp = lines.get(1).split(\" \");\n\t\tint[] num = new int[tmp.length];\n\t\tfor(int i=0; i<tmp.length; i++){\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}\n\t\tint N= sort(num);\n\t\tprint(num, N);\n\n\n\t}\n\tstatic void print(int[] num, int cnt){\n\t\tfor(int i=0;i<num.length-1;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(num[num.length-1]);\n\t\tSystem.out.println(cnt);\n\t}\n\tstatic int sort(int[] num){\n\t\tint tmp;\n\t\tint cnt=0;\n\t\tfor(int i=0; i<num.length;i++){\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t\t\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException{\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tArrayList<String> lines = new ArrayList<String>();\n\t\twhile (br.ready()){\n\t\t\tlines.add(br.readLine());\n\t\t}\n\t\tString[] tmp = lines.get(1).split(\" \");\n\t\tint[] num = new int[tmp.length];\n\t\tfor(int i=0; i<tmp.length; i++){\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}\n\t\tint N= sort(num);\n\t\tprint(num, N);\n\n\n\t}\n\tstatic void print(int[] num, int cnt){\n\t\tfor(int i=0;i<num.length-1;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(num[num.length-1]);\n\t\tSystem.out.println(cnt);\n\t}\n\tstatic int sort(int[] num){\n\t\tint tmp;\n\t\tint cnt=0;\n\t\tfor(int i=0; i<num.length;i++){\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t\t\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException{\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tArrayList<String> lines = new ArrayList<String>();\n\t\twhile (br.ready()){\n\t\t\tlines.add(br.readLine());\n\t\t}\n\t\tString[] tmp = lines.get(1).split(\" \");\n\t\tint[] num = new int[tmp.length];\n\t\tfor(int i=0; i<tmp.length; i++){\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}\n\t\tint N= sort(num);\n\t\tprint(num, N);\n\n\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tArrayList<String> lines = new ArrayList<String>();\n\t\twhile (br.ready()){\n\t\t\tlines.add(br.readLine());\n\t\t}\n\t\tString[] tmp = lines.get(1).split(\" \");\n\t\tint[] num = new int[tmp.length];\n\t\tfor(int i=0; i<tmp.length; i++){\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}\n\t\tint N= sort(num);\n\t\tprint(num, N);\n\n\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"ArrayList<String> lines = new ArrayList<String>();",
"lines",
"new ArrayList<String>()",
"while (br.ready()){\n\t\t\tlines.add(br.readLine());\n\t\t}",
"br.ready()",
"br.ready",
"br",
"{\n\t\t\tlines.add(br.readLine());\n\t\t}",
"lines.add(br.readLine())",
"lines.add",
"lines",
"br.readLine()",
"br.readLine",
"br",
"String[] tmp = lines.get(1).split(\" \");",
"tmp",
"lines.get(1).split(\" \")",
"lines.get(1).split",
"lines.get(1)",
"lines.get",
"lines",
"1",
"\" \"",
"int[] num = new int[tmp.length];",
"num",
"new int[tmp.length]",
"tmp.length",
"tmp",
"tmp.length",
"for(int i=0; i<tmp.length; i++){\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<tmp.length",
"i",
"tmp.length",
"tmp",
"tmp.length",
"i++",
"i++",
"i",
"{\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}",
"{\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}",
"num[i] = Integer.parseInt(tmp[i])",
"num[i]",
"num",
"i",
"Integer.parseInt(tmp[i])",
"Integer.parseInt",
"Integer",
"tmp[i]",
"tmp",
"i",
"int N= sort(num);",
"N",
"sort(num)",
"sort",
"num",
"print(num, N)",
"print",
"num",
"N",
"String[] args",
"args",
"static void print(int[] num, int cnt){\n\t\tfor(int i=0;i<num.length-1;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(num[num.length-1]);\n\t\tSystem.out.println(cnt);\n\t}",
"print",
"{\n\t\tfor(int i=0;i<num.length-1;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(num[num.length-1]);\n\t\tSystem.out.println(cnt);\n\t}",
"for(int i=0;i<num.length-1;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\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\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(num[i]);\n\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",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println(num[num.length-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"num[num.length-1]",
"num",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"int[] num",
"num",
"int cnt",
"cnt",
"static int sort(int[] num){\n\t\tint tmp;\n\t\tint cnt=0;\n\t\tfor(int i=0; i<num.length;i++){\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t\t\n\t}",
"sort",
"{\n\t\tint tmp;\n\t\tint cnt=0;\n\t\tfor(int i=0; i<num.length;i++){\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t\t\n\t}",
"int tmp;",
"tmp",
"int cnt=0;",
"cnt",
"0",
"for(int i=0; i<num.length;i++){\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\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;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j=num.length-1;i<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\tcnt++;\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",
"i<j",
"i",
"j",
"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\tcnt++;\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\tcnt++;\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\tcnt++;\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\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",
"cnt++",
"cnt",
"return cnt;",
"cnt",
"int[] num",
"num",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException{\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tArrayList<String> lines = new ArrayList<String>();\n\t\twhile (br.ready()){\n\t\t\tlines.add(br.readLine());\n\t\t}\n\t\tString[] tmp = lines.get(1).split(\" \");\n\t\tint[] num = new int[tmp.length];\n\t\tfor(int i=0; i<tmp.length; i++){\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}\n\t\tint N= sort(num);\n\t\tprint(num, N);\n\n\n\t}\n\tstatic void print(int[] num, int cnt){\n\t\tfor(int i=0;i<num.length-1;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(num[num.length-1]);\n\t\tSystem.out.println(cnt);\n\t}\n\tstatic int sort(int[] num){\n\t\tint tmp;\n\t\tint cnt=0;\n\t\tfor(int i=0; i<num.length;i++){\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t\t\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException{\n\t\t// TODO Auto-generated method stub\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tArrayList<String> lines = new ArrayList<String>();\n\t\twhile (br.ready()){\n\t\t\tlines.add(br.readLine());\n\t\t}\n\t\tString[] tmp = lines.get(1).split(\" \");\n\t\tint[] num = new int[tmp.length];\n\t\tfor(int i=0; i<tmp.length; i++){\n\t\t\tnum[i] = Integer.parseInt(tmp[i]);\n\t\t}\n\t\tint N= sort(num);\n\t\tprint(num, N);\n\n\n\t}\n\tstatic void print(int[] num, int cnt){\n\t\tfor(int i=0;i<num.length-1;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println(num[num.length-1]);\n\t\tSystem.out.println(cnt);\n\t}\n\tstatic int sort(int[] num){\n\t\tint tmp;\n\t\tint cnt=0;\n\t\tfor(int i=0; i<num.length;i++){\n\t\t\tfor(int j=num.length-1;i<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\tcnt++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cnt;\n\t\t\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> lines = new ArrayList<String>();
while (br.ready()){
lines.add(br.readLine());
}
String[] tmp = lines.get(1).split(" ");
int[] num = new int[tmp.length];
for(int i=0; i<tmp.length; i++){
num[i] = Integer.parseInt(tmp[i]);
}
int N= sort(num);
print(num, N);
}
static void print(int[] num, int cnt){
for(int i=0;i<num.length-1;i++){
System.out.print(num[i]);
System.out.print(" ");
}
System.out.println(num[num.length-1]);
System.out.println(cnt);
}
static int sort(int[] num){
int tmp;
int cnt=0;
for(int i=0; i<num.length;i++){
for(int j=num.length-1;i<j;j--){
if(num[j-1]>num[j]){
tmp = num[j];
num[j] = num[j-1];
num[j-1] = tmp;
cnt++;
}
}
}
return cnt;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
17,
42,
4,
18,
13,
30,
0,
18,
13,
40,
13,
4,
18,
13,
4,
18,
13,
4,
13,
13,
13,
23,
13,
12,
13,
30,
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,
41,
13,
18,
13,
13,
41,
13,
18,
13,
2,
13,
17,
14,
2,
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,
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,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
17,
30,
3,
0,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
203,
14
],
[
203,
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
],
[
17,
38
],
[
38,
39
],
[
38,
40
],
[
17,
41
],
[
41,
42
],
[
41,
43
],
[
17,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
49,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
57,
58
],
[
58,
59
],
[
17,
60
],
[
60,
61
],
[
60,
62
],
[
60,
63
],
[
15,
64
],
[
64,
65
],
[
203,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
72,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
91,
93
],
[
87,
94
],
[
94,
95
],
[
94,
96
],
[
87,
97
],
[
97,
98
],
[
98,
99
],
[
87,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
101,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
101,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
119,
120
],
[
118,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
128,
134
],
[
134,
135
],
[
134,
136
],
[
118,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
68,
142
],
[
142,
143
],
[
142,
144
],
[
68,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
66,
151
],
[
151,
152
],
[
66,
153
],
[
153,
154
],
[
203,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
161,
171
],
[
171,
172
],
[
172,
173
],
[
161,
174
],
[
175,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
175,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
184,
188
],
[
181,
189
],
[
189,
190
],
[
175,
191
],
[
191,
192
],
[
191,
193
],
[
157,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
194,
199
],
[
155,
200
],
[
200,
201
],
[
0,
202
],
[
202,
203
],
[
202,
204
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\npublic class Main {\n\n /**\n * @param args\n * @throws IOException\n */\n public static void main(String[] args) throws IOException {\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));\n\n int len = Integer.parseInt(reader.readLine());\n int[] arr = new int[len];\n\n String arrStr = reader.readLine();\n StringTokenizer tokenizer = new StringTokenizer(arrStr, \" \");\n\n int i = 0;\n while (tokenizer.hasMoreElements()) {\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }\n\n// int[] arr = {1,2,3,4,5};\n// int len = arr.length;\n\n bubblesort(arr, len);\n }\n \n\n private static void bubblesort(int[] arr, int len) {\n \n int swapCnt = 0;\n \n for (int i = 0; i < len - 1; i++) {\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }\n printArr(arr);\n System.out.println(swapCnt);\n }\n\n static void printArr(int[] arr) {\n String msg = \"\";\n for (int i = 0; i < arr.length; i++) {\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }\n\n System.out.println(msg);\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\n /**\n * @param args\n * @throws IOException\n */\n public static void main(String[] args) throws IOException {\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));\n\n int len = Integer.parseInt(reader.readLine());\n int[] arr = new int[len];\n\n String arrStr = reader.readLine();\n StringTokenizer tokenizer = new StringTokenizer(arrStr, \" \");\n\n int i = 0;\n while (tokenizer.hasMoreElements()) {\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }\n\n// int[] arr = {1,2,3,4,5};\n// int len = arr.length;\n\n bubblesort(arr, len);\n }\n \n\n private static void bubblesort(int[] arr, int len) {\n \n int swapCnt = 0;\n \n for (int i = 0; i < len - 1; i++) {\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }\n printArr(arr);\n System.out.println(swapCnt);\n }\n\n static void printArr(int[] arr) {\n String msg = \"\";\n for (int i = 0; i < arr.length; i++) {\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }\n\n System.out.println(msg);\n }\n\n}",
"Main",
"/**\n * @param args\n * @throws IOException\n */\n public static void main(String[] args) throws IOException {\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));\n\n int len = Integer.parseInt(reader.readLine());\n int[] arr = new int[len];\n\n String arrStr = reader.readLine();\n StringTokenizer tokenizer = new StringTokenizer(arrStr, \" \");\n\n int i = 0;\n while (tokenizer.hasMoreElements()) {\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }\n\n// int[] arr = {1,2,3,4,5};\n// int len = arr.length;\n\n bubblesort(arr, len);\n }",
"main",
"{\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));\n\n int len = Integer.parseInt(reader.readLine());\n int[] arr = new int[len];\n\n String arrStr = reader.readLine();\n StringTokenizer tokenizer = new StringTokenizer(arrStr, \" \");\n\n int i = 0;\n while (tokenizer.hasMoreElements()) {\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }\n\n// int[] arr = {1,2,3,4,5};\n// int len = arr.length;\n\n bubblesort(arr, len);\n }",
"BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));",
"reader",
"new BufferedReader(new InputStreamReader(\n System.in))",
"int len = Integer.parseInt(reader.readLine());",
"len",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"int[] arr = new int[len];",
"arr",
"new int[len]",
"len",
"String arrStr = reader.readLine();",
"arrStr",
"reader.readLine()",
"reader.readLine",
"reader",
"StringTokenizer tokenizer = new StringTokenizer(arrStr, \" \");",
"tokenizer",
"new StringTokenizer(arrStr, \" \")",
"int i = 0;",
"i",
"0",
"while (tokenizer.hasMoreElements()) {\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }",
"tokenizer.hasMoreElements()",
"tokenizer.hasMoreElements",
"tokenizer",
"{\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }",
"arr[i++] = Integer.parseInt((String) tokenizer.nextElement())",
"arr[i++]",
"arr",
"i++",
"i",
"Integer.parseInt((String) tokenizer.nextElement())",
"Integer.parseInt",
"Integer",
"(String) tokenizer.nextElement()",
"tokenizer.nextElement",
"tokenizer",
"bubblesort(arr, len)",
"bubblesort",
"arr",
"len",
"String[] args",
"args",
"private static void bubblesort(int[] arr, int len) {\n \n int swapCnt = 0;\n \n for (int i = 0; i < len - 1; i++) {\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }\n printArr(arr);\n System.out.println(swapCnt);\n }",
"bubblesort",
"{\n \n int swapCnt = 0;\n \n for (int i = 0; i < len - 1; i++) {\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }\n printArr(arr);\n System.out.println(swapCnt);\n }",
"int swapCnt = 0;",
"swapCnt",
"0",
"for (int i = 0; i < len - 1; i++) {\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < len - 1",
"i",
"len - 1",
"len",
"1",
"i++",
"i++",
"i",
"{\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }",
"{\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }",
"for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }",
"int j = (len - 1);",
"int j = (len - 1);",
"j",
"(len - 1)",
"len",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }",
"{\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }",
"int current = arr[j];",
"current",
"arr[j]",
"arr",
"j",
"int target = arr[j - 1];",
"target",
"arr[j - 1]",
"arr",
"j - 1",
"j",
"1",
"if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }",
"target > current",
"target",
"current",
"{\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }",
"swapCnt++",
"swapCnt",
"int swap = arr[j -1];",
"swap",
"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] = swap",
"arr[j]",
"arr",
"j",
"swap",
"printArr(arr)",
"printArr",
"arr",
"System.out.println(swapCnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapCnt",
"int[] arr",
"arr",
"int len",
"len",
"static void printArr(int[] arr) {\n String msg = \"\";\n for (int i = 0; i < arr.length; i++) {\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }\n\n System.out.println(msg);\n }",
"printArr",
"{\n String msg = \"\";\n for (int i = 0; i < arr.length; i++) {\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }\n\n System.out.println(msg);\n }",
"String msg = \"\";",
"msg",
"\"\"",
"for (int i = 0; i < arr.length; i++) {\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }",
"{\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }",
"msg += arr[i]",
"msg",
"arr[i]",
"arr",
"i",
"if (i == arr.length - 1) {\n break;\n }",
"i == arr.length - 1",
"i",
"arr.length - 1",
"arr.length",
"arr",
"arr.length",
"1",
"{\n break;\n }",
"break;",
"msg += \" \"",
"msg",
"\" \"",
"System.out.println(msg)",
"System.out.println",
"System.out",
"System",
"System.out",
"msg",
"int[] arr",
"arr",
"public class Main {\n\n /**\n * @param args\n * @throws IOException\n */\n public static void main(String[] args) throws IOException {\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));\n\n int len = Integer.parseInt(reader.readLine());\n int[] arr = new int[len];\n\n String arrStr = reader.readLine();\n StringTokenizer tokenizer = new StringTokenizer(arrStr, \" \");\n\n int i = 0;\n while (tokenizer.hasMoreElements()) {\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }\n\n// int[] arr = {1,2,3,4,5};\n// int len = arr.length;\n\n bubblesort(arr, len);\n }\n \n\n private static void bubblesort(int[] arr, int len) {\n \n int swapCnt = 0;\n \n for (int i = 0; i < len - 1; i++) {\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }\n printArr(arr);\n System.out.println(swapCnt);\n }\n\n static void printArr(int[] arr) {\n String msg = \"\";\n for (int i = 0; i < arr.length; i++) {\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }\n\n System.out.println(msg);\n }\n\n}",
"public class Main {\n\n /**\n * @param args\n * @throws IOException\n */\n public static void main(String[] args) throws IOException {\n\n BufferedReader reader = new BufferedReader(new InputStreamReader(\n System.in));\n\n int len = Integer.parseInt(reader.readLine());\n int[] arr = new int[len];\n\n String arrStr = reader.readLine();\n StringTokenizer tokenizer = new StringTokenizer(arrStr, \" \");\n\n int i = 0;\n while (tokenizer.hasMoreElements()) {\n arr[i++] = Integer.parseInt((String) tokenizer.nextElement());\n }\n\n// int[] arr = {1,2,3,4,5};\n// int len = arr.length;\n\n bubblesort(arr, len);\n }\n \n\n private static void bubblesort(int[] arr, int len) {\n \n int swapCnt = 0;\n \n for (int i = 0; i < len - 1; i++) {\n \n// System.out.println(\"===========================\");\n for (int j = (len - 1); j > i ; j--) {\n\n// System.out.println(\"i:\" + i + \" j:\" + j);\n \n int current = arr[j];\n int target = arr[j - 1];\n\n if (target > current) {\n\n swapCnt++;\n\n int swap = arr[j -1];\n arr[j - 1] = arr[j];\n arr[j] = swap;\n }\n \n \n }\n \n \n }\n printArr(arr);\n System.out.println(swapCnt);\n }\n\n static void printArr(int[] arr) {\n String msg = \"\";\n for (int i = 0; i < arr.length; i++) {\n msg += arr[i];\n if (i == arr.length - 1) {\n break;\n }\n msg += \" \";\n }\n\n System.out.println(msg);\n }\n\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
int len = Integer.parseInt(reader.readLine());
int[] arr = new int[len];
String arrStr = reader.readLine();
StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
int i = 0;
while (tokenizer.hasMoreElements()) {
arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
}
// int[] arr = {1,2,3,4,5};
// int len = arr.length;
bubblesort(arr, len);
}
private static void bubblesort(int[] arr, int len) {
int swapCnt = 0;
for (int i = 0; i < len - 1; i++) {
// System.out.println("===========================");
for (int j = (len - 1); j > i ; j--) {
// System.out.println("i:" + i + " j:" + j);
int current = arr[j];
int target = arr[j - 1];
if (target > current) {
swapCnt++;
int swap = arr[j -1];
arr[j - 1] = arr[j];
arr[j] = swap;
}
}
}
printArr(arr);
System.out.println(swapCnt);
}
static void printArr(int[] arr) {
String msg = "";
for (int i = 0; i < arr.length; i++) {
msg += arr[i];
if (i == arr.length - 1) {
break;
}
msg += " ";
}
System.out.println(msg);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
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,
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,
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
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
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
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
108,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
120,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
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 public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextInt();\n }\n int swap = 0;\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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }\n System.out.println(\"\");\n System.out.println(swap);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextInt();\n }\n int swap = 0;\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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }\n System.out.println(\"\");\n System.out.println(swap);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextInt();\n }\n int swap = 0;\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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }\n System.out.println(\"\");\n System.out.println(swap);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextInt();\n }\n int swap = 0;\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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }\n System.out.println(\"\");\n System.out.println(swap);\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 < n; i++) {\n a[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = scanner.nextInt();\n }",
"{\n a[i] = scanner.nextInt();\n }",
"a[i] = scanner.nextInt()",
"a[i]",
"a",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int swap = 0;",
"swap",
"0",
"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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\n }\n }\n }",
"{\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 swap++;\n }\n }\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 swap++;\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 swap++;\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 swap++;\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 swap++;\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 swap++;\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",
"swap++",
"swap",
"for (int i = 0; i < n; i++) {\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }",
"{\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }",
"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",
"\"\"",
"System.out.println(swap)",
"System.out.println",
"System.out",
"System",
"System.out",
"swap",
"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 int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextInt();\n }\n int swap = 0;\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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }\n System.out.println(\"\");\n System.out.println(swap);\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 int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = scanner.nextInt();\n }\n int swap = 0;\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 int tmp = a[j];\n a[j] = a[j-1];\n a[j-1] = tmp;\n swap++;\n }\n }\n }\n for (int i = 0; i < n; i++) {\n if (i > 0) System.out.print(' ');\n System.out.print(a[i]);\n }\n System.out.println(\"\");\n System.out.println(swap);\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 < n; i++) {
a[i] = scanner.nextInt();
}
int swap = 0;
for (int i = 0; i < n-1; 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;
swap++;
}
}
}
for (int i = 0; i < n; i++) {
if (i > 0) System.out.print(' ');
System.out.print(a[i]);
}
System.out.println("");
System.out.println(swap);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
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,
4,
13,
13,
13,
4,
13,
13,
13,
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,
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,
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,
29,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
182,
5
],
[
182,
6
],
[
6,
7
],
[
182,
8
],
[
8,
9
],
[
8,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
10,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
10,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
45,
48
],
[
10,
49
],
[
49,
50
],
[
49,
51
],
[
49,
52
],
[
10,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
8,
59
],
[
59,
60
],
[
182,
61
],
[
61,
62
],
[
61,
63
],
[
63,
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
],
[
79,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
84,
88
],
[
63,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
89,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
61,
99
],
[
99,
100
],
[
61,
101
],
[
101,
102
],
[
182,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
105,
112
],
[
112,
113
],
[
112,
114
],
[
105,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
117,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
121,
128
],
[
128,
129
],
[
128,
130
],
[
121,
131
],
[
131,
132
],
[
132,
133
],
[
121,
134
],
[
135,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
136,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
146,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
158,
160
],
[
146,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
161,
167
],
[
146,
168
],
[
168,
169
],
[
168,
170
],
[
146,
171
],
[
171,
172
],
[
117,
173
],
[
173,
174
],
[
105,
175
],
[
175,
176
],
[
103,
177
],
[
177,
178
],
[
103,
179
],
[
179,
180
],
[
0,
181
],
[
181,
182
],
[
181,
183
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tprivate static Scanner sc;\n\tpublic static void main(String[] args){\n\t\tsc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tint ans=bubbleSort(a,n);\n\t\twrite(a,n);\n\t\tSystem.out.println(ans);\n\t}\n\tstatic void write(int[] a,int 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}\n\tstatic int bubbleSort(int[] a, int n){\n\t\tboolean flag=true;\n\t\tint i=0;\n\t\tint count=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\treturn count;\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tprivate static Scanner sc;\n\tpublic static void main(String[] args){\n\t\tsc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tint ans=bubbleSort(a,n);\n\t\twrite(a,n);\n\t\tSystem.out.println(ans);\n\t}\n\tstatic void write(int[] a,int 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}\n\tstatic int bubbleSort(int[] a, int n){\n\t\tboolean flag=true;\n\t\tint i=0;\n\t\tint count=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\treturn count;\n\t}\n\n}",
"Main",
"private static Scanner sc;",
"sc",
"public static void main(String[] args){\n\t\tsc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tint ans=bubbleSort(a,n);\n\t\twrite(a,n);\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tsc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tint ans=bubbleSort(a,n);\n\t\twrite(a,n);\n\t\tSystem.out.println(ans);\n\t}",
"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 ans=bubbleSort(a,n);",
"ans",
"bubbleSort(a,n)",
"bubbleSort",
"a",
"n",
"write(a,n)",
"write",
"a",
"n",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"static void write(int[] a,int 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}",
"write",
"{\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}",
"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",
"int[] a",
"a",
"int n",
"n",
"static int bubbleSort(int[] a, int n){\n\t\tboolean flag=true;\n\t\tint i=0;\n\t\tint count=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\treturn count;\n\t}",
"bubbleSort",
"{\n\t\tboolean flag=true;\n\t\tint i=0;\n\t\tint count=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\treturn count;\n\t}",
"boolean flag=true;",
"flag",
"true",
"int i=0;",
"i",
"0",
"int count=0;",
"count",
"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",
"return count;",
"count",
"int[] a",
"a",
"int n",
"n",
"public class Main {\n\tprivate static Scanner sc;\n\tpublic static void main(String[] args){\n\t\tsc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tint ans=bubbleSort(a,n);\n\t\twrite(a,n);\n\t\tSystem.out.println(ans);\n\t}\n\tstatic void write(int[] a,int 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}\n\tstatic int bubbleSort(int[] a, int n){\n\t\tboolean flag=true;\n\t\tint i=0;\n\t\tint count=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\treturn count;\n\t}\n\n}",
"public class Main {\n\tprivate static Scanner sc;\n\tpublic static void main(String[] args){\n\t\tsc=new Scanner(System.in);\n\t\tint n=sc.nextInt();\n\t\tint[] a=new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\ta[i]=sc.nextInt();\n\t\t}\n\t\tint ans=bubbleSort(a,n);\n\t\twrite(a,n);\n\t\tSystem.out.println(ans);\n\t}\n\tstatic void write(int[] a,int 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}\n\tstatic int bubbleSort(int[] a, int n){\n\t\tboolean flag=true;\n\t\tint i=0;\n\t\tint count=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\treturn count;\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
private static Scanner sc;
public static void main(String[] args){
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 ans=bubbleSort(a,n);
write(a,n);
System.out.println(ans);
}
static void write(int[] a,int n){
for(int i=0;i<n-1;i++){
System.out.print(a[i]+" ");
}
System.out.println(a[n-1]);
}
static int bubbleSort(int[] a, int n){
boolean flag=true;
int i=0;
int count=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++;
}
return 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,
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,
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,
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,
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
],
[
44,
46
],
[
8,
47
],
[
47,
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
],
[
76,
77
],
[
76,
78
],
[
73,
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
],
[
82,
106
],
[
106,
107
],
[
106,
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
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
121,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
137,
138
],
[
137,
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.*;\n\nclass 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\n for(int i = 0;i < n;i++){\n A[i] = sc.nextInt();\n }\n\n int flag = 1,count = 0,tmp;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1;i > 0;i--){\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }\n }\n\n for(int i = 0;i < n;i++){\n if(i != 0) System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\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\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\n int flag = 1,count = 0,tmp;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1;i > 0;i--){\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }\n }\n\n for(int i = 0;i < n;i++){\n if(i != 0) System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\n System.out.println(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\n for(int i = 0;i < n;i++){\n A[i] = sc.nextInt();\n }\n\n int flag = 1,count = 0,tmp;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1;i > 0;i--){\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }\n }\n\n for(int i = 0;i < n;i++){\n if(i != 0) System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\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\n int flag = 1,count = 0,tmp;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1;i > 0;i--){\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }\n }\n\n for(int i = 0;i < n;i++){\n if(i != 0) System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\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 flag = 1",
"flag",
"1",
"count = 0",
"count",
"0",
"tmp;",
"tmp",
"while(flag == 1){\n flag = 0;\n for(int i = n - 1;i > 0;i--){\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }\n }",
"flag == 1",
"flag",
"1",
"{\n flag = 0;\n for(int i = n - 1;i > 0;i--){\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }\n }",
"flag = 0",
"flag",
"0",
"for(int i = n - 1;i > 0;i--){\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\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 tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }",
"{\n if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }\n }",
"if(A[i - 1] > A[i]){\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }",
"A[i - 1] > A[i]",
"A[i - 1]",
"A",
"i - 1",
"i",
"1",
"A[i]",
"A",
"i",
"{\n tmp = A[i - 1];\n A[i - 1] = A[i];\n A[i] = tmp;\n count++;\n flag = 1;\n }",
"tmp = A[i - 1]",
"tmp",
"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] = tmp",
"A[i]",
"A",
"i",
"tmp",
"count++",
"count",
"flag = 1",
"flag",
"1",
"for(int i = 0;i < n;i++){\n if(i != 0) System.out.print(\" \");\n System.out.print(A[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(i != 0) System.out.print(\" \");\n System.out.print(A[i]);\n }",
"{\n if(i != 0) System.out.print(\" \");\n System.out.print(A[i]);\n }",
"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",
"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 = sc.nextInt();
int[] A = new int[n];
for(int i = 0;i < n;i++){
A[i] = sc.nextInt();
}
int flag = 1,count = 0,tmp;
while(flag == 1){
flag = 0;
for(int i = n - 1;i > 0;i--){
if(A[i - 1] > A[i]){
tmp = A[i - 1];
A[i - 1] = A[i];
A[i] = tmp;
count++;
flag = 1;
}
}
}
for(int i = 0;i < n;i++){
if(i != 0) System.out.print(" ");
System.out.print(A[i]);
}
System.out.println();
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
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,
17,
23,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
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,
41,
13,
17,
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,
0,
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,
4,
13,
13,
13,
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
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
9,
14
],
[
14,
15
],
[
14,
16
],
[
9,
17
],
[
17,
18
],
[
18,
19
],
[
9,
20
],
[
21,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
21,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
8,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
40,
45
],
[
6,
46
],
[
46,
47
],
[
6,
48
],
[
48,
49
],
[
168,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
52,
57
],
[
57,
58
],
[
57,
59
],
[
52,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
52,
65
],
[
65,
66
],
[
65,
67
],
[
52,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
85,
86
],
[
86,
87
],
[
52,
88
],
[
88,
89
],
[
88,
90
],
[
52,
91
],
[
91,
92
],
[
91,
93
],
[
52,
94
],
[
94,
95
],
[
94,
96
],
[
52,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
103,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
103,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
136,
142
],
[
142,
143
],
[
142,
144
],
[
128,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
128,
150
],
[
150,
151
],
[
128,
152
],
[
152,
153
],
[
152,
154
],
[
52,
155
],
[
155,
156
],
[
155,
157
],
[
155,
158
],
[
52,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
50,
165
],
[
165,
166
],
[
0,
167
],
[
167,
168
],
[
167,
169
]
] | [
"import java.util.Scanner;\npublic class Main{ \n public static void trace ( int n,int []A){\n for ( int j = 0; j < n; j++){\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }\n System.out.print(\"\\n\");\n }\n \n \n public static void main(String[] args){\n int n;\n int[] A;\n \n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n A = new int[n];\n \n for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();\n //bubble sort\n int k=0;\n int tmp=0;\n boolean flag = true;\n while (flag){\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }\n }\n trace(n,A);\n System.out.println(k);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{ \n public static void trace ( int n,int []A){\n for ( int j = 0; j < n; j++){\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }\n System.out.print(\"\\n\");\n }\n \n \n public static void main(String[] args){\n int n;\n int[] A;\n \n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n A = new int[n];\n \n for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();\n //bubble sort\n int k=0;\n int tmp=0;\n boolean flag = true;\n while (flag){\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }\n }\n trace(n,A);\n System.out.println(k);\n }\n}",
"Main",
"public static void trace ( int n,int []A){\n for ( int j = 0; j < n; j++){\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }\n System.out.print(\"\\n\");\n }",
"trace",
"{\n for ( int j = 0; j < n; j++){\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }\n System.out.print(\"\\n\");\n }",
"for ( int j = 0; j < n; j++){\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }",
"{\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }",
"if ( j > 0 ) System.out.print(\" \");",
"j > 0",
"j",
"0",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(A[j])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[j]",
"A",
"j",
"System.out.print(\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"",
"int n",
"n",
"int []A",
"A",
"public static void main(String[] args){\n int n;\n int[] A;\n \n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n A = new int[n];\n \n for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();\n //bubble sort\n int k=0;\n int tmp=0;\n boolean flag = true;\n while (flag){\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }\n }\n trace(n,A);\n System.out.println(k);\n }",
"main",
"{\n int n;\n int[] A;\n \n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n A = new int[n];\n \n for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();\n //bubble sort\n int k=0;\n int tmp=0;\n boolean flag = true;\n while (flag){\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }\n }\n trace(n,A);\n System.out.println(k);\n }",
"int n;",
"n",
"int[] A;",
"A",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"A = new int[n]",
"A",
"new int[n]",
"n",
"for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"A[j] = sc.nextInt();",
"A[j] = sc.nextInt()",
"A[j]",
"A",
"j",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int k=0;",
"k",
"0",
"int tmp=0;",
"tmp",
"0",
"boolean flag = true;",
"flag",
"true",
"while (flag){\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\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 tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\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 tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }",
"{\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }",
"if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }",
"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",
"k++",
"k",
"flag = true",
"flag",
"true",
"trace(n,A)",
"trace",
"n",
"A",
"System.out.println(k)",
"System.out.println",
"System.out",
"System",
"System.out",
"k",
"String[] args",
"args",
"public class Main{ \n public static void trace ( int n,int []A){\n for ( int j = 0; j < n; j++){\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }\n System.out.print(\"\\n\");\n }\n \n \n public static void main(String[] args){\n int n;\n int[] A;\n \n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n A = new int[n];\n \n for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();\n //bubble sort\n int k=0;\n int tmp=0;\n boolean flag = true;\n while (flag){\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }\n }\n trace(n,A);\n System.out.println(k);\n }\n}",
"public class Main{ \n public static void trace ( int n,int []A){\n for ( int j = 0; j < n; j++){\n if ( j > 0 ) System.out.print(\" \");\n System.out.print(A[j]);\n }\n System.out.print(\"\\n\");\n }\n \n \n public static void main(String[] args){\n int n;\n int[] A;\n \n Scanner sc = new Scanner(System.in);\n n = sc.nextInt();\n A = new int[n];\n \n for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();\n //bubble sort\n int k=0;\n int tmp=0;\n boolean flag = true;\n while (flag){\n flag = false;\n for ( int j = n-1;j > 0; j--){\n if ( A[j] < A[j-1] ) {\n tmp = A[j-1];\n A[j-1] = A[j];\n A[j] = tmp; \n k++;\n flag = true;\n }\n }\n }\n trace(n,A);\n System.out.println(k);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void trace ( int n,int []A){
for ( int j = 0; j < n; j++){
if ( j > 0 ) System.out.print(" ");
System.out.print(A[j]);
}
System.out.print("\n");
}
public static void main(String[] args){
int n;
int[] A;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
A = new int[n];
for ( int j = 0; j < n; j++ ) A[j] = sc.nextInt();
//bubble sort
int k=0;
int tmp=0;
boolean flag = true;
while (flag){
flag = false;
for ( int j = n-1;j > 0; j--){
if ( A[j] < A[j-1] ) {
tmp = A[j-1];
A[j-1] = A[j];
A[j] = tmp;
k++;
flag = true;
}
}
}
trace(n,A);
System.out.println(k);
}
} |
[
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,
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,
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
],
[
163,
5
],
[
163,
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
],
[
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
],
[
61,
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
],
[
92,
116
],
[
116,
117
],
[
116,
118
],
[
8,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
119,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
8,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
8,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
6,
160
],
[
160,
161
],
[
0,
162
],
[
162,
163
],
[
162,
164
]
] | [
"import java.util.Scanner;\npublic class Main{\n public static void main(String[] args){\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] input = scan.nextLine().split(\" \");\n\tint[] elements = new int[n];\n\tfor (int i = 0; i < n; i++) {\n\t elements[i] = Integer.parseInt(input[i]);\n\t}\n\tint cnt = 0;\n\tboolean flag = true;\n\twhile (flag) {\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}\n for (int i = 0; i < n-1; i++){\n\t System.out.print(elements[i] + \" \");\n\t}\n\tSystem.out.println(elements[n-1]);\n\tSystem.out.println(cnt);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String[] args){\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] input = scan.nextLine().split(\" \");\n\tint[] elements = new int[n];\n\tfor (int i = 0; i < n; i++) {\n\t elements[i] = Integer.parseInt(input[i]);\n\t}\n\tint cnt = 0;\n\tboolean flag = true;\n\twhile (flag) {\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}\n for (int i = 0; i < n-1; i++){\n\t System.out.print(elements[i] + \" \");\n\t}\n\tSystem.out.println(elements[n-1]);\n\tSystem.out.println(cnt);\n }\n}",
"Main",
"public static void main(String[] args){\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] input = scan.nextLine().split(\" \");\n\tint[] elements = new int[n];\n\tfor (int i = 0; i < n; i++) {\n\t elements[i] = Integer.parseInt(input[i]);\n\t}\n\tint cnt = 0;\n\tboolean flag = true;\n\twhile (flag) {\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}\n for (int i = 0; i < n-1; i++){\n\t System.out.print(elements[i] + \" \");\n\t}\n\tSystem.out.println(elements[n-1]);\n\tSystem.out.println(cnt);\n }",
"main",
"{\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] input = scan.nextLine().split(\" \");\n\tint[] elements = new int[n];\n\tfor (int i = 0; i < n; i++) {\n\t elements[i] = Integer.parseInt(input[i]);\n\t}\n\tint cnt = 0;\n\tboolean flag = true;\n\twhile (flag) {\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}\n for (int i = 0; i < n-1; i++){\n\t System.out.print(elements[i] + \" \");\n\t}\n\tSystem.out.println(elements[n-1]);\n\tSystem.out.println(cnt);\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[] input = scan.nextLine().split(\" \");",
"input",
"scan.nextLine().split(\" \")",
"scan.nextLine().split",
"scan.nextLine()",
"scan.nextLine",
"scan",
"\" \"",
"int[] elements = new int[n];",
"elements",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t elements[i] = Integer.parseInt(input[i]);\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t elements[i] = Integer.parseInt(input[i]);\n\t}",
"{\n\t elements[i] = Integer.parseInt(input[i]);\n\t}",
"elements[i] = Integer.parseInt(input[i])",
"elements[i]",
"elements",
"i",
"Integer.parseInt(input[i])",
"Integer.parseInt",
"Integer",
"input[i]",
"input",
"i",
"int cnt = 0;",
"cnt",
"0",
"boolean flag = true;",
"flag",
"true",
"while (flag) {\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}",
"flag",
"{\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}",
"flag = false",
"flag",
"false",
"for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }",
"int i = n-1;",
"int i = n-1;",
"i",
"n-1",
"n",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }",
"{\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }",
"if (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}",
"elements[i] < elements[i-1]",
"elements[i]",
"elements",
"i",
"elements[i-1]",
"elements",
"i-1",
"i",
"1",
"{\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}",
"int tmp = elements[i];",
"tmp",
"elements[i]",
"elements",
"i",
"elements[i] = elements[i-1]",
"elements[i]",
"elements",
"i",
"elements[i-1]",
"elements",
"i-1",
"i",
"1",
"elements[i-1] = tmp",
"elements[i-1]",
"elements",
"i-1",
"i",
"1",
"tmp",
"cnt++",
"cnt",
"flag = true",
"flag",
"true",
"for (int i = 0; i < n-1; i++){\n\t System.out.print(elements[i] + \" \");\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"{\n\t System.out.print(elements[i] + \" \");\n\t}",
"{\n\t System.out.print(elements[i] + \" \");\n\t}",
"System.out.print(elements[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"elements[i] + \" \"",
"elements[i]",
"elements",
"i",
"\" \"",
"System.out.println(elements[n-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"elements[n-1]",
"elements",
"n-1",
"n",
"1",
"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){\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] input = scan.nextLine().split(\" \");\n\tint[] elements = new int[n];\n\tfor (int i = 0; i < n; i++) {\n\t elements[i] = Integer.parseInt(input[i]);\n\t}\n\tint cnt = 0;\n\tboolean flag = true;\n\twhile (flag) {\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}\n for (int i = 0; i < n-1; i++){\n\t System.out.print(elements[i] + \" \");\n\t}\n\tSystem.out.println(elements[n-1]);\n\tSystem.out.println(cnt);\n }\n}",
"public class Main{\n public static void main(String[] args){\n\tScanner scan = new Scanner(System.in);\n\tint n = Integer.parseInt(scan.nextLine());\n\tString[] input = scan.nextLine().split(\" \");\n\tint[] elements = new int[n];\n\tfor (int i = 0; i < n; i++) {\n\t elements[i] = Integer.parseInt(input[i]);\n\t}\n\tint cnt = 0;\n\tboolean flag = true;\n\twhile (flag) {\n\t flag = false;\n\t for (int i = n-1; i > 0; i--) {\n\t\tif (elements[i] < elements[i-1]) {\n\t\t int tmp = elements[i];\n\t\t elements[i] = elements[i-1];\n\t\t elements[i-1] = tmp;\n\t\t cnt++;\n\t\t flag = true;\n\t\t}\n\t }\n\t}\n for (int i = 0; i < n-1; i++){\n\t System.out.print(elements[i] + \" \");\n\t}\n\tSystem.out.println(elements[n-1]);\n\tSystem.out.println(cnt);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = Integer.parseInt(scan.nextLine());
String[] input = scan.nextLine().split(" ");
int[] elements = new int[n];
for (int i = 0; i < n; i++) {
elements[i] = Integer.parseInt(input[i]);
}
int cnt = 0;
boolean flag = true;
while (flag) {
flag = false;
for (int i = n-1; i > 0; i--) {
if (elements[i] < elements[i-1]) {
int tmp = elements[i];
elements[i] = elements[i-1];
elements[i-1] = tmp;
cnt++;
flag = true;
}
}
}
for (int i = 0; i < n-1; i++){
System.out.print(elements[i] + " ");
}
System.out.println(elements[n-1]);
System.out.println(cnt);
}
} |
[
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,
41,
13,
4,
18,
13,
4,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
17,
2,
13,
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,
4,
18,
13,
2,
13,
17,
4,
18,
13,
2,
13,
17,
40,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
4,
18,
13,
2,
4,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
2,
4,
18,
13,
17,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
4,
18,
13,
29,
13,
12,
13,
30,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
13,
29,
13,
23,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
41,
13,
4,
18,
4,
18,
4,
18,
13,
17,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
29,
13,
29,
17,
12,
13,
30,
38,
5,
13,
30,
4,
18,
13,
30,
4,
18,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
23,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
23,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
23,
37
],
[
37,
38
],
[
37,
39
],
[
37,
40
],
[
23,
41
],
[
41,
42
],
[
42,
43
],
[
21,
44
],
[
44,
45
],
[
19,
46
],
[
46,
47
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
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
],
[
65,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
72,
74
],
[
65,
75
],
[
75,
76
],
[
76,
77
],
[
65,
78
],
[
79,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
83,
84
],
[
82,
85
],
[
81,
86
],
[
86,
87
],
[
87,
88
],
[
86,
89
],
[
89,
90
],
[
89,
91
],
[
80,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
92,
103
],
[
103,
104
],
[
104,
105
],
[
103,
106
],
[
106,
107
],
[
106,
108
],
[
92,
109
],
[
109,
110
],
[
48,
111
],
[
111,
112
],
[
111,
113
],
[
48,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
122,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
114,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
129,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
132,
137
],
[
48,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
144,
145
],
[
143,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
146,
150
],
[
143,
151
],
[
151,
152
],
[
152,
153
],
[
48,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
46,
160
],
[
160,
161
],
[
46,
162
],
[
162,
163
],
[
0,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
172,
173
],
[
172,
174
],
[
171,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
175,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
186,
187
],
[
185,
188
],
[
188,
189
],
[
189,
190
],
[
171,
191
],
[
191,
192
],
[
164,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
196,
197
],
[
196,
198
],
[
195,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
201,
203
],
[
199,
204
],
[
204,
205
],
[
204,
206
],
[
199,
207
],
[
207,
208
],
[
208,
209
],
[
199,
210
],
[
211,
211
],
[
211,
212
],
[
212,
213
],
[
213,
214
],
[
212,
215
],
[
215,
216
],
[
195,
217
],
[
217,
218
],
[
193,
219
],
[
219,
220
],
[
164,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
224,
225
],
[
225,
226
],
[
225,
227
],
[
227,
228
],
[
228,
229
],
[
229,
230
],
[
224,
231
],
[
231,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
236,
237
],
[
237,
238
],
[
238,
239
],
[
239,
240
],
[
234,
241
],
[
231,
242
],
[
242,
243
],
[
242,
244
],
[
231,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
245,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
252,
254
],
[
245,
255
],
[
255,
256
],
[
256,
257
],
[
245,
258
],
[
259,
259
],
[
259,
260
],
[
260,
261
],
[
261,
262
],
[
260,
263
],
[
263,
264
],
[
264,
265
],
[
263,
266
],
[
266,
267
],
[
266,
268
],
[
231,
269
],
[
269,
270
],
[
223,
271
],
[
271,
272
],
[
164,
273
],
[
273,
274
],
[
273,
275
],
[
275,
276
],
[
276,
277
],
[
277,
278
],
[
277,
279
],
[
279,
280
],
[
280,
281
],
[
281,
282
],
[
276,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
]
] | [
"import java.util.List;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.ArrayList;\nimport java.util.List;\n\nclass Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tInput stdIn = new Input();\n\n\t\tint n = stdIn.getValue();\n\t\tList<Integer> values = stdIn.getLine();\n\n\t\tbubbleSort(values, n);\n\n\t\tstdIn.close();\n\n\t}\n\n\tpublic static void bubbleSort(List<Integer> values, int n) {\n\n\t\tint count = 0;\n\n\t\tfor (int i = n; i > 1; i--) {\n\t\t\tfor (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}\n\t\t}\n\t\tStringBuilder output = new StringBuilder();\n\t\tfor(int k = 0; k < values.size(); k++) {\n\t\t\toutput.append(values.get(k) + \" \");\n\t\t}\n\t\tSystem.out.println(output.delete(output.length()-1, output.length()));\n\t\tSystem.out.println(count);\n\t}\n}\nclass Input {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tpublic int getValue() {\n\t\tint n = 0;\n\t\ttry {\n\t\t\tn = Integer.parseInt(br.readLine());\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn n;\n\t}\n\n\tpublic List<Integer> getValueLines(int n) {\n\t\tList<Integer> values = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tvalues.add(getValue());\n\t\t}\n\t\treturn values;\n\t}\n\n\tpublic List<Integer> getLine() {\n\t\ttry {\n\t\t\tString[] s = br.readLine().trim().split(\" \");\n\t\t\tList<Integer> ary = new ArrayList<>();\n\t\t\tfor (int i = 0; i < s.length; i++) {\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}\n\t\t\treturn ary;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic void close() {\n\t\ttry {\n\t\t\tbr.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"import java.util.List;",
"List",
"java.util",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.List;",
"List",
"java.util",
"class Main {\n\n\tpublic static void main(String[] args) {\n\n\t\tInput stdIn = new Input();\n\n\t\tint n = stdIn.getValue();\n\t\tList<Integer> values = stdIn.getLine();\n\n\t\tbubbleSort(values, n);\n\n\t\tstdIn.close();\n\n\t}\n\n\tpublic static void bubbleSort(List<Integer> values, int n) {\n\n\t\tint count = 0;\n\n\t\tfor (int i = n; i > 1; i--) {\n\t\t\tfor (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}\n\t\t}\n\t\tStringBuilder output = new StringBuilder();\n\t\tfor(int k = 0; k < values.size(); k++) {\n\t\t\toutput.append(values.get(k) + \" \");\n\t\t}\n\t\tSystem.out.println(output.delete(output.length()-1, output.length()));\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tInput stdIn = new Input();\n\n\t\tint n = stdIn.getValue();\n\t\tList<Integer> values = stdIn.getLine();\n\n\t\tbubbleSort(values, n);\n\n\t\tstdIn.close();\n\n\t}",
"main",
"{\n\n\t\tInput stdIn = new Input();\n\n\t\tint n = stdIn.getValue();\n\t\tList<Integer> values = stdIn.getLine();\n\n\t\tbubbleSort(values, n);\n\n\t\tstdIn.close();\n\n\t}",
"Input stdIn = new Input();",
"stdIn",
"new Input()",
"int n = stdIn.getValue();",
"n",
"stdIn.getValue()",
"stdIn.getValue",
"stdIn",
"List<Integer> values = stdIn.getLine();",
"values",
"stdIn.getLine()",
"stdIn.getLine",
"stdIn",
"bubbleSort(values, n)",
"bubbleSort",
"values",
"n",
"stdIn.close()",
"stdIn.close",
"stdIn",
"String[] args",
"args",
"public static void bubbleSort(List<Integer> values, int n) {\n\n\t\tint count = 0;\n\n\t\tfor (int i = n; i > 1; i--) {\n\t\t\tfor (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}\n\t\t}\n\t\tStringBuilder output = new StringBuilder();\n\t\tfor(int k = 0; k < values.size(); k++) {\n\t\t\toutput.append(values.get(k) + \" \");\n\t\t}\n\t\tSystem.out.println(output.delete(output.length()-1, output.length()));\n\t\tSystem.out.println(count);\n\t}",
"bubbleSort",
"{\n\n\t\tint count = 0;\n\n\t\tfor (int i = n; i > 1; i--) {\n\t\t\tfor (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}\n\t\t}\n\t\tStringBuilder output = new StringBuilder();\n\t\tfor(int k = 0; k < values.size(); k++) {\n\t\t\toutput.append(values.get(k) + \" \");\n\t\t}\n\t\tSystem.out.println(output.delete(output.length()-1, output.length()));\n\t\tSystem.out.println(count);\n\t}",
"int count = 0;",
"count",
"0",
"for (int i = n; i > 1; i--) {\n\t\t\tfor (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}\n\t\t}",
"int i = n;",
"int i = n;",
"i",
"n",
"i > 1",
"i",
"1",
"i--",
"i--",
"i",
"{\n\t\t\tfor (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}\n\t\t}",
"for (int j = 0; j < i - 1; j++) {\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < i - 1",
"j",
"i - 1",
"i",
"1",
"j++",
"j++",
"j",
"{\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}",
"{\n\t\t\t\tif (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n//\t\t\t\tSystem.out.println(values);\n//\t\t\t\tSystem.out.println(count);\n\t\t\t}",
"if (values.get(j) > values.get(j + 1)) {\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"values.get(j) > values.get(j + 1)",
"values.get(j)",
"values.get",
"values",
"j",
"values.get(j + 1)",
"values.get",
"values",
"j + 1",
"j",
"1",
"{\n\t\t\t\t\tvalues.add(j, values.get(j + 1));\n//\t\t\t\t\tSystem.out.println(values);\n\t\t\t\t\tvalues.remove(j + 2);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"values.add(j, values.get(j + 1))",
"values.add",
"values",
"j",
"values.get(j + 1)",
"values.get",
"values",
"j + 1",
"j",
"1",
"values.remove(j + 2)",
"values.remove",
"values",
"j + 2",
"j",
"2",
"count++",
"count",
"StringBuilder output = new StringBuilder();",
"output",
"new StringBuilder()",
"for(int k = 0; k < values.size(); k++) {\n\t\t\toutput.append(values.get(k) + \" \");\n\t\t}",
"int k = 0;",
"int k = 0;",
"k",
"0",
"k < values.size()",
"k",
"values.size()",
"values.size",
"values",
"k++",
"k++",
"k",
"{\n\t\t\toutput.append(values.get(k) + \" \");\n\t\t}",
"{\n\t\t\toutput.append(values.get(k) + \" \");\n\t\t}",
"output.append(values.get(k) + \" \")",
"output.append",
"output",
"values.get(k) + \" \"",
"values.get(k)",
"values.get",
"values",
"k",
"\" \"",
"System.out.println(output.delete(output.length()-1, output.length()))",
"System.out.println",
"System.out",
"System",
"System.out",
"output.delete(output.length()-1, output.length())",
"output.delete",
"output",
"output.length()-1",
"output.length()",
"output.length",
"output",
"1",
"output.length()",
"output.length",
"output",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"List<Integer> values",
"values",
"int n",
"n",
"class Input {\n\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\tpublic int getValue() {\n\t\tint n = 0;\n\t\ttry {\n\t\t\tn = Integer.parseInt(br.readLine());\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn n;\n\t}\n\n\tpublic List<Integer> getValueLines(int n) {\n\t\tList<Integer> values = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tvalues.add(getValue());\n\t\t}\n\t\treturn values;\n\t}\n\n\tpublic List<Integer> getLine() {\n\t\ttry {\n\t\t\tString[] s = br.readLine().trim().split(\" \");\n\t\t\tList<Integer> ary = new ArrayList<>();\n\t\t\tfor (int i = 0; i < s.length; i++) {\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}\n\t\t\treturn ary;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic void close() {\n\t\ttry {\n\t\t\tbr.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"Input",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"public int getValue() {\n\t\tint n = 0;\n\t\ttry {\n\t\t\tn = Integer.parseInt(br.readLine());\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn n;\n\t}",
"getValue",
"{\n\t\tint n = 0;\n\t\ttry {\n\t\t\tn = Integer.parseInt(br.readLine());\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn n;\n\t}",
"int n = 0;",
"n",
"0",
"try {\n\t\t\tn = Integer.parseInt(br.readLine());\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\tn = Integer.parseInt(br.readLine());\n\t\t}",
"n = Integer.parseInt(br.readLine())",
"n",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"return n;",
"n",
"public List<Integer> getValueLines(int n) {\n\t\tList<Integer> values = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tvalues.add(getValue());\n\t\t}\n\t\treturn values;\n\t}",
"getValueLines",
"{\n\t\tList<Integer> values = new ArrayList<>();\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tvalues.add(getValue());\n\t\t}\n\t\treturn values;\n\t}",
"List<Integer> values = new ArrayList<>();",
"values",
"new ArrayList<>()",
"for(int i = 0; i < n; i++) {\n\t\t\tvalues.add(getValue());\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tvalues.add(getValue());\n\t\t}",
"{\n\t\t\tvalues.add(getValue());\n\t\t}",
"values.add(getValue())",
"values.add",
"values",
"getValue()",
"getValue",
"return values;",
"values",
"int n",
"n",
"public List<Integer> getLine() {\n\t\ttry {\n\t\t\tString[] s = br.readLine().trim().split(\" \");\n\t\t\tList<Integer> ary = new ArrayList<>();\n\t\t\tfor (int i = 0; i < s.length; i++) {\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}\n\t\t\treturn ary;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}",
"getLine",
"{\n\t\ttry {\n\t\t\tString[] s = br.readLine().trim().split(\" \");\n\t\t\tList<Integer> ary = new ArrayList<>();\n\t\t\tfor (int i = 0; i < s.length; i++) {\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}\n\t\t\treturn ary;\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\treturn null;\n\t}",
"try {\n\t\t\tString[] s = br.readLine().trim().split(\" \");\n\t\t\tList<Integer> ary = new ArrayList<>();\n\t\t\tfor (int i = 0; i < s.length; i++) {\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}\n\t\t\treturn ary;\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\tString[] s = br.readLine().trim().split(\" \");\n\t\t\tList<Integer> ary = new ArrayList<>();\n\t\t\tfor (int i = 0; i < s.length; i++) {\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}\n\t\t\treturn ary;\n\t\t}",
"String[] s = br.readLine().trim().split(\" \");",
"s",
"br.readLine().trim().split(\" \")",
"br.readLine().trim().split",
"br.readLine().trim()",
"br.readLine().trim",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"List<Integer> ary = new ArrayList<>();",
"ary",
"new ArrayList<>()",
"for (int i = 0; i < s.length; i++) {\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < s.length",
"i",
"s.length",
"s",
"s.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}",
"{\n\t\t\t\tary.add(Integer.parseInt(s[i]));\n\t\t\t}",
"ary.add(Integer.parseInt(s[i]))",
"ary.add",
"ary",
"Integer.parseInt(s[i])",
"Integer.parseInt",
"Integer",
"s[i]",
"s",
"i",
"return ary;",
"ary",
"return null;",
"null",
"public void close() {\n\t\ttry {\n\t\t\tbr.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"close",
"{\n\t\ttry {\n\t\t\tbr.close();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"try {\n\t\t\tbr.close();\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\tbr.close();\n\t\t}",
"br.close()",
"br.close",
"br"
] | import java.util.List;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
class Main {
public static void main(String[] args) {
Input stdIn = new Input();
int n = stdIn.getValue();
List<Integer> values = stdIn.getLine();
bubbleSort(values, n);
stdIn.close();
}
public static void bubbleSort(List<Integer> values, int n) {
int count = 0;
for (int i = n; i > 1; i--) {
for (int j = 0; j < i - 1; j++) {
if (values.get(j) > values.get(j + 1)) {
values.add(j, values.get(j + 1));
// System.out.println(values);
values.remove(j + 2);
count++;
}
// System.out.println(values);
// System.out.println(count);
}
}
StringBuilder output = new StringBuilder();
for(int k = 0; k < values.size(); k++) {
output.append(values.get(k) + " ");
}
System.out.println(output.delete(output.length()-1, output.length()));
System.out.println(count);
}
}
class Input {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public int getValue() {
int n = 0;
try {
n = Integer.parseInt(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return n;
}
public List<Integer> getValueLines(int n) {
List<Integer> values = new ArrayList<>();
for(int i = 0; i < n; i++) {
values.add(getValue());
}
return values;
}
public List<Integer> getLine() {
try {
String[] s = br.readLine().trim().split(" ");
List<Integer> ary = new ArrayList<>();
for (int i = 0; i < s.length; i++) {
ary.add(Integer.parseInt(s[i]));
}
return ary;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public void close() {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} |
[
7,
15,
13,
17,
6,
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,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
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,
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
],
[
176,
5
],
[
176,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
15,
20
],
[
15,
21
],
[
21,
22
],
[
22,
23
],
[
15,
24
],
[
25,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
25,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
33,
35
],
[
29,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
38,
40
],
[
29,
41
],
[
41,
42
],
[
42,
43
],
[
29,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
46,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
56,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
56,
78
],
[
78,
79
],
[
78,
80
],
[
56,
81
],
[
81,
82
],
[
8,
83
],
[
83,
84
],
[
6,
85
],
[
85,
86
],
[
6,
87
],
[
87,
88
],
[
176,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
91,
100
],
[
100,
101
],
[
100,
102
],
[
91,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
91,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
125,
128
],
[
91,
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
],
[
141,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
150,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
150,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
91,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
89,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n static int bubbleSort(int[] a, int n) {\n int sw = 0;\n boolean flag = true;\n for (int i = 0; flag; i ++) {\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }\n return sw;\n }\n\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int sw = bubbleSort(a, n);\n for (int i = 0; i < n; i++) {\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\n }\n System.out.println(sw);\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n static int bubbleSort(int[] a, int n) {\n int sw = 0;\n boolean flag = true;\n for (int i = 0; flag; i ++) {\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }\n return sw;\n }\n\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int sw = bubbleSort(a, n);\n for (int i = 0; i < n; i++) {\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\n }\n System.out.println(sw);\n }\n}",
"Main",
"static int bubbleSort(int[] a, int n) {\n int sw = 0;\n boolean flag = true;\n for (int i = 0; flag; i ++) {\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }\n return sw;\n }",
"bubbleSort",
"{\n int sw = 0;\n boolean flag = true;\n for (int i = 0; flag; i ++) {\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }\n return sw;\n }",
"int sw = 0;",
"sw",
"0",
"boolean flag = true;",
"flag",
"true",
"for (int i = 0; flag; i ++) {\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"flag",
"i ++",
"i ++",
"i",
"{\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }",
"{\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\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 t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }",
"{\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }",
"if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }",
"a[j] < a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"{\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }",
"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",
"flag = true",
"flag",
"true",
"sw++",
"sw",
"return sw;",
"sw",
"int[] a",
"a",
"int n",
"n",
"public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int sw = bubbleSort(a, n);\n for (int i = 0; i < n; i++) {\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\n }\n System.out.println(sw);\n }",
"main",
"{\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int sw = bubbleSort(a, n);\n for (int i = 0; i < n; i++) {\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\n }\n System.out.println(sw);\n }",
"Scanner stdIn = new Scanner(System.in);",
"stdIn",
"new Scanner(System.in)",
"int n = stdIn.nextInt();",
"n",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = stdIn.nextInt();",
"a[i] = stdIn.nextInt()",
"a[i]",
"a",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int sw = bubbleSort(a, n);",
"sw",
"bubbleSort(a, n)",
"bubbleSort",
"a",
"n",
"for (int i = 0; i < n; i++) {\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\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) System.out.print(' ');\n else System.out.println();\n }",
"{\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\n }",
"System.out.print(a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"if (i != n - 1) System.out.print(' ');\n else System.out.println();",
"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(sw)",
"System.out.println",
"System.out",
"System",
"System.out",
"sw",
"String[] args",
"args",
"public class Main {\n\n static int bubbleSort(int[] a, int n) {\n int sw = 0;\n boolean flag = true;\n for (int i = 0; flag; i ++) {\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }\n return sw;\n }\n\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int sw = bubbleSort(a, n);\n for (int i = 0; i < n; i++) {\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\n }\n System.out.println(sw);\n }\n}",
"public class Main {\n\n static int bubbleSort(int[] a, int n) {\n int sw = 0;\n boolean flag = true;\n for (int i = 0; flag; i ++) {\n flag = false;\n for (int j = n - 1; j >= i + 1; j--) {\n if (a[j] < a[j-1]) {\n int t = a[j];\n a[j] = a[j-1];\n a[j-1] = t;\n flag = true;\n sw++;\n }\n }\n }\n return sw;\n }\n\n public static void main(String[] args) {\n Scanner stdIn = new Scanner(System.in);\n int n = stdIn.nextInt();\n int[] a = new int[n];\n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();\n int sw = bubbleSort(a, n);\n for (int i = 0; i < n; i++) {\n System.out.print(a[i]);\n if (i != n - 1) System.out.print(' ');\n else System.out.println();\n }\n System.out.println(sw);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static int bubbleSort(int[] a, int n) {
int sw = 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 t = a[j];
a[j] = a[j-1];
a[j-1] = t;
flag = true;
sw++;
}
}
}
return sw;
}
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
int sw = 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.println();
}
System.out.println(sw);
}
} |
[
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,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
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,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
13,
17,
4,
18,
13,
18,
13,
13,
4,
18,
4,
18,
13,
17,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
176,
11
],
[
176,
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
],
[
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
],
[
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
],
[
111,
112
],
[
111,
113
],
[
106,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
106,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
123,
129
],
[
14,
130
],
[
130,
131
],
[
130,
132
],
[
14,
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
],
[
145,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
157,
158
],
[
157,
159
],
[
14,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
162,
165
],
[
160,
166
],
[
14,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
167,
172
],
[
12,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"\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\tint sum = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\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}\n\t\t\t}\n\t\t}\n\t\tStringBuilder builder = new StringBuilder();\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}\n\t\tbuilder.append(\"\\n\").append(sum);\n\t\tSystem.out.println(builder);\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\tint sum = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\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}\n\t\t\t}\n\t\t}\n\t\tStringBuilder builder = new StringBuilder();\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}\n\t\tbuilder.append(\"\\n\").append(sum);\n\t\tSystem.out.println(builder);\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\tint sum = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\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}\n\t\t\t}\n\t\t}\n\t\tStringBuilder builder = new StringBuilder();\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}\n\t\tbuilder.append(\"\\n\").append(sum);\n\t\tSystem.out.println(builder);\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\tint sum = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\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}\n\t\t\t}\n\t\t}\n\t\tStringBuilder builder = new StringBuilder();\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}\n\t\tbuilder.append(\"\\n\").append(sum);\n\t\tSystem.out.println(builder);\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",
"int sum = 0;",
"sum",
"0",
"for (int i = 0; i < n - 1; i++) {\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}\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 + 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}\n\t\t\t}\n\t\t}",
"{\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}\n\t\t\t}\n\t\t}",
"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}\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}\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}\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}",
"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}",
"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",
"StringBuilder builder = new StringBuilder();",
"builder",
"new StringBuilder()",
"for (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(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\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}",
"{\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}",
"if (k > 0)\n\t\t\t\tbuilder.append(\" \");",
"k > 0",
"k",
"0",
"builder.append(\" \")",
"builder.append",
"builder",
"\" \"",
"builder.append(a[k])",
"builder.append",
"builder",
"a[k]",
"a",
"k",
"builder.append(\"\\n\").append(sum)",
"builder.append(\"\\n\").append",
"builder.append(\"\\n\")",
"builder.append",
"builder",
"\"\\n\"",
"sum",
"System.out.println(builder)",
"System.out.println",
"System.out",
"System",
"System.out",
"builder",
"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\tint sum = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\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}\n\t\t\t}\n\t\t}\n\t\tStringBuilder builder = new StringBuilder();\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}\n\t\tbuilder.append(\"\\n\").append(sum);\n\t\tSystem.out.println(builder);\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\tint sum = 0;\n\t\tfor (int i = 0; i < n - 1; i++) {\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}\n\t\t\t}\n\t\t}\n\t\tStringBuilder builder = new StringBuilder();\n\t\tfor (int k = 0; k < n; k++) {\n\t\t\tif (k > 0)\n\t\t\t\tbuilder.append(\" \");\n\t\t\tbuilder.append(a[k]);\n\t\t}\n\t\tbuilder.append(\"\\n\").append(sum);\n\t\tSystem.out.println(builder);\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]);
}
int sum = 0;
for (int i = 0; i < n - 1; i++) {
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;
}
}
}
StringBuilder builder = new StringBuilder();
for (int k = 0; k < n; k++) {
if (k > 0)
builder.append(" ");
builder.append(a[k]);
}
builder.append("\n").append(sum);
System.out.println(builder);
}
} |
[
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,
4,
13,
13,
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,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
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,
17,
2,
13,
2,
18,
13,
13,
17,
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
] | [
[
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
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
37,
38
],
[
38,
39
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
8,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
45,
57
],
[
57,
58
],
[
58,
59
],
[
45,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
8,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
8,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
83,
88
],
[
6,
89
],
[
89,
90
],
[
4,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
93,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
99,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
99,
111
],
[
111,
112
],
[
112,
113
],
[
99,
114
],
[
115,
115
],
[
115,
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
],
[
134,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
133,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
143,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
151,
157
],
[
157,
158
],
[
157,
159
],
[
143,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
143,
165
],
[
165,
166
],
[
93,
167
],
[
167,
168
],
[
91,
169
],
[
169,
170
]
] | [
"\n\nimport java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String[] args){\n\t\tScanner input=new Scanner(System.in);\n\t\tint sortLong=input.nextInt();\n\t\t\n\t\tint[] sortNumber=new int[sortLong];\n\t\t\n\t\tfor(int i=0;i<sortLong;i++)\n\t\t\tsortNumber[i]=input.nextInt();\n\t\t\n\t\tint number=sort(sortNumber);\n\t\t\n\t\tfor(int i=0;i<sortNumber.length-1;i++)\n\t\t\tSystem.out.print(sortNumber[i]+\" \");\n\t\tSystem.out.println(sortNumber[sortNumber.length-1]);\n\t\tSystem.out.println(number);\n\t\t\n\t}\n\t\n\tpublic static int sort(int[] sortArray){\n\t\tint minNumber;\n\t\tint changeFrequency=0;\n\t\t\n\t\tfor(int i=0;i<sortArray.length-1;i++){\n\t\t\tfor(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn changeFrequency;\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\tpublic static void main(String[] args){\n\t\tScanner input=new Scanner(System.in);\n\t\tint sortLong=input.nextInt();\n\t\t\n\t\tint[] sortNumber=new int[sortLong];\n\t\t\n\t\tfor(int i=0;i<sortLong;i++)\n\t\t\tsortNumber[i]=input.nextInt();\n\t\t\n\t\tint number=sort(sortNumber);\n\t\t\n\t\tfor(int i=0;i<sortNumber.length-1;i++)\n\t\t\tSystem.out.print(sortNumber[i]+\" \");\n\t\tSystem.out.println(sortNumber[sortNumber.length-1]);\n\t\tSystem.out.println(number);\n\t\t\n\t}\n\t\n\tpublic static int sort(int[] sortArray){\n\t\tint minNumber;\n\t\tint changeFrequency=0;\n\t\t\n\t\tfor(int i=0;i<sortArray.length-1;i++){\n\t\t\tfor(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn changeFrequency;\n\t}\n\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner input=new Scanner(System.in);\n\t\tint sortLong=input.nextInt();\n\t\t\n\t\tint[] sortNumber=new int[sortLong];\n\t\t\n\t\tfor(int i=0;i<sortLong;i++)\n\t\t\tsortNumber[i]=input.nextInt();\n\t\t\n\t\tint number=sort(sortNumber);\n\t\t\n\t\tfor(int i=0;i<sortNumber.length-1;i++)\n\t\t\tSystem.out.print(sortNumber[i]+\" \");\n\t\tSystem.out.println(sortNumber[sortNumber.length-1]);\n\t\tSystem.out.println(number);\n\t\t\n\t}",
"main",
"{\n\t\tScanner input=new Scanner(System.in);\n\t\tint sortLong=input.nextInt();\n\t\t\n\t\tint[] sortNumber=new int[sortLong];\n\t\t\n\t\tfor(int i=0;i<sortLong;i++)\n\t\t\tsortNumber[i]=input.nextInt();\n\t\t\n\t\tint number=sort(sortNumber);\n\t\t\n\t\tfor(int i=0;i<sortNumber.length-1;i++)\n\t\t\tSystem.out.print(sortNumber[i]+\" \");\n\t\tSystem.out.println(sortNumber[sortNumber.length-1]);\n\t\tSystem.out.println(number);\n\t\t\n\t}",
"Scanner input=new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int sortLong=input.nextInt();",
"sortLong",
"input.nextInt()",
"input.nextInt",
"input",
"int[] sortNumber=new int[sortLong];",
"sortNumber",
"new int[sortLong]",
"sortLong",
"for(int i=0;i<sortLong;i++)\n\t\t\tsortNumber[i]=input.nextInt();",
"int i=0;",
"int i=0;",
"i",
"0",
"i<sortLong",
"i",
"sortLong",
"i++",
"i++",
"i",
"sortNumber[i]=input.nextInt();",
"sortNumber[i]=input.nextInt()",
"sortNumber[i]",
"sortNumber",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"int number=sort(sortNumber);",
"number",
"sort(sortNumber)",
"sort",
"sortNumber",
"for(int i=0;i<sortNumber.length-1;i++)\n\t\t\tSystem.out.print(sortNumber[i]+\" \");",
"int i=0;",
"int i=0;",
"i",
"0",
"i<sortNumber.length-1",
"i",
"sortNumber.length-1",
"sortNumber.length",
"sortNumber",
"sortNumber.length",
"1",
"i++",
"i++",
"i",
"System.out.print(sortNumber[i]+\" \");",
"System.out.print(sortNumber[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"sortNumber[i]+\" \"",
"sortNumber[i]",
"sortNumber",
"i",
"\" \"",
"System.out.println(sortNumber[sortNumber.length-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"sortNumber[sortNumber.length-1]",
"sortNumber",
"sortNumber.length-1",
"sortNumber.length",
"sortNumber",
"sortNumber.length",
"1",
"System.out.println(number)",
"System.out.println",
"System.out",
"System",
"System.out",
"number",
"String[] args",
"args",
"public static int sort(int[] sortArray){\n\t\tint minNumber;\n\t\tint changeFrequency=0;\n\t\t\n\t\tfor(int i=0;i<sortArray.length-1;i++){\n\t\t\tfor(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn changeFrequency;\n\t}",
"sort",
"{\n\t\tint minNumber;\n\t\tint changeFrequency=0;\n\t\t\n\t\tfor(int i=0;i<sortArray.length-1;i++){\n\t\t\tfor(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn changeFrequency;\n\t}",
"int minNumber;",
"minNumber",
"int changeFrequency=0;",
"changeFrequency",
"0",
"for(int i=0;i<sortArray.length-1;i++){\n\t\t\tfor(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<sortArray.length-1",
"i",
"sortArray.length-1",
"sortArray.length",
"sortArray",
"sortArray.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}",
"for(int j=0;j<sortArray.length-1;j++){\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"int j=0;",
"int j=0;",
"j",
"0",
"j<sortArray.length-1",
"j",
"sortArray.length-1",
"sortArray.length",
"sortArray",
"sortArray.length",
"1",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\tif(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"if(sortArray[j]>sortArray[j+1]){\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}",
"sortArray[j]>sortArray[j+1]",
"sortArray[j]",
"sortArray",
"j",
"sortArray[j+1]",
"sortArray",
"j+1",
"j",
"1",
"{\n\t\t\t\t\tminNumber=sortArray[j+1];\n\t\t\t\t\t\n\t\t\t\t\tsortArray[j+1]=sortArray[j];\n\t\t\t\t\tsortArray[j]=minNumber;\n\t\t\t\t\t\n\t\t\t\t\tchangeFrequency++;\n\t\t\t\t}",
"minNumber=sortArray[j+1]",
"minNumber",
"sortArray[j+1]",
"sortArray",
"j+1",
"j",
"1",
"sortArray[j+1]=sortArray[j]",
"sortArray[j+1]",
"sortArray",
"j+1",
"j",
"1",
"sortArray[j]",
"sortArray",
"j",
"sortArray[j]=minNumber",
"sortArray[j]",
"sortArray",
"j",
"minNumber",
"changeFrequency++",
"changeFrequency",
"return changeFrequency;",
"changeFrequency",
"int[] sortArray",
"sortArray"
] |
import java.util.Scanner;
class Main {
public static void main(String[] args){
Scanner input=new Scanner(System.in);
int sortLong=input.nextInt();
int[] sortNumber=new int[sortLong];
for(int i=0;i<sortLong;i++)
sortNumber[i]=input.nextInt();
int number=sort(sortNumber);
for(int i=0;i<sortNumber.length-1;i++)
System.out.print(sortNumber[i]+" ");
System.out.println(sortNumber[sortNumber.length-1]);
System.out.println(number);
}
public static int sort(int[] sortArray){
int minNumber;
int changeFrequency=0;
for(int i=0;i<sortArray.length-1;i++){
for(int j=0;j<sortArray.length-1;j++){
if(sortArray[j]>sortArray[j+1]){
minNumber=sortArray[j+1];
sortArray[j+1]=sortArray[j];
sortArray[j]=minNumber;
changeFrequency++;
}
}
}
return changeFrequency;
}
} |
[
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,
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,
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,
18,
13,
13,
17,
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
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
59,
68
],
[
68,
69
],
[
68,
70
],
[
59,
71
],
[
71,
72
],
[
72,
73
],
[
59,
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
],
[
87,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
94,
95
],
[
8,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
96,
108
],
[
108,
109
],
[
109,
110
],
[
96,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
118,
122
],
[
8,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
8,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
6,
141
],
[
141,
142
],
[
4,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
155
],
[
155,
156
],
[
155,
157
],
[
145,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
143,
163
],
[
163,
164
],
[
143,
165
],
[
165,
166
],
[
143,
167
],
[
167,
168
]
] | [
"import java.util.*;\n\nclass Main {\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\tint n = stdIn.nextInt();\n\t\tint[] ary = new int[n];\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tary[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<ary.length; i++) {\n\t\t\tfor (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-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<ary.length-1; i++) {\n\t\t\tSystem.out.print(ary[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ary[ary.length-1]);\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic void swap(int[] ary,int x,int y){\n\t\tint temp = ary[x];\n\t\tary[x] = ary[y];\n\t\tary[y] = temp;\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\tint n = stdIn.nextInt();\n\t\tint[] ary = new int[n];\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tary[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<ary.length; i++) {\n\t\t\tfor (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-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<ary.length-1; i++) {\n\t\t\tSystem.out.print(ary[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ary[ary.length-1]);\n\t\tSystem.out.println(count);\n\t}\n\n\tstatic void swap(int[] ary,int x,int y){\n\t\tint temp = ary[x];\n\t\tary[x] = ary[y];\n\t\tary[y] = temp;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner stdIn = new Scanner(System.in);\n\t\tint n = stdIn.nextInt();\n\t\tint[] ary = new int[n];\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tary[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<ary.length; i++) {\n\t\t\tfor (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-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<ary.length-1; i++) {\n\t\t\tSystem.out.print(ary[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ary[ary.length-1]);\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner stdIn = new Scanner(System.in);\n\t\tint n = stdIn.nextInt();\n\t\tint[] ary = new int[n];\n\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tary[i] = stdIn.nextInt();\n\t\t}\n\n\t\tint count = 0;\n\t\tfor (int i=0; i<ary.length; i++) {\n\t\t\tfor (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-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<ary.length-1; i++) {\n\t\t\tSystem.out.print(ary[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ary[ary.length-1]);\n\t\tSystem.out.println(count);\n\t}",
"Scanner stdIn = new Scanner(System.in);",
"stdIn",
"new Scanner(System.in)",
"int n = stdIn.nextInt();",
"n",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int[] ary = new int[n];",
"ary",
"new int[n]",
"n",
"for (int i=0; i<n; i++) {\n\t\t\tary[i] = stdIn.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tary[i] = stdIn.nextInt();\n\t\t}",
"{\n\t\t\tary[i] = stdIn.nextInt();\n\t\t}",
"ary[i] = stdIn.nextInt()",
"ary[i]",
"ary",
"i",
"stdIn.nextInt()",
"stdIn.nextInt",
"stdIn",
"int count = 0;",
"count",
"0",
"for (int i=0; i<ary.length; i++) {\n\t\t\tfor (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-1);\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<ary.length",
"i",
"ary.length",
"ary",
"ary.length",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j=ary.length-1; j>i; j--) {\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j=ary.length-1;",
"int j=ary.length-1;",
"j",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-1);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (ary[j] < ary[j-1]) {\n\t\t\t\t\tswap(ary,j,j-1);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"ary[j] < ary[j-1]",
"ary[j]",
"ary",
"j",
"ary[j-1]",
"ary",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tswap(ary,j,j-1);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"swap(ary,j,j-1)",
"swap",
"ary",
"j",
"j-1",
"j",
"1",
"count++",
"count",
"for (int i=0; i<ary.length-1; i++) {\n\t\t\tSystem.out.print(ary[i] + \" \");\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ary.length-1",
"i",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(ary[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(ary[i] + \" \");\n\t\t}",
"System.out.print(ary[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"ary[i] + \" \"",
"ary[i]",
"ary",
"i",
"\" \"",
"System.out.println(ary[ary.length-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"ary[ary.length-1]",
"ary",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static void swap(int[] ary,int x,int y){\n\t\tint temp = ary[x];\n\t\tary[x] = ary[y];\n\t\tary[y] = temp;\n\t}",
"swap",
"{\n\t\tint temp = ary[x];\n\t\tary[x] = ary[y];\n\t\tary[y] = temp;\n\t}",
"int temp = ary[x];",
"temp",
"ary[x]",
"ary",
"x",
"ary[x] = ary[y]",
"ary[x]",
"ary",
"x",
"ary[y]",
"ary",
"y",
"ary[y] = temp",
"ary[y]",
"ary",
"y",
"temp",
"int[] ary",
"ary",
"int x",
"x",
"int y",
"y"
] | import java.util.*;
class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int n = stdIn.nextInt();
int[] ary = new int[n];
for (int i=0; i<n; i++) {
ary[i] = stdIn.nextInt();
}
int count = 0;
for (int i=0; i<ary.length; i++) {
for (int j=ary.length-1; j>i; j--) {
if (ary[j] < ary[j-1]) {
swap(ary,j,j-1);
count++;
}
}
}
for (int i=0; i<ary.length-1; i++) {
System.out.print(ary[i] + " ");
}
System.out.println(ary[ary.length-1]);
System.out.println(count);
}
static void swap(int[] ary,int x,int y){
int temp = ary[x];
ary[x] = ary[y];
ary[y] = temp;
}
} |
[
7,
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,
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,
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,
18,
13,
13,
13,
4,
18,
18,
13,
13,
4,
18,
13,
4,
18,
13,
17,
13,
4,
18,
18,
13,
13,
4,
18,
13,
18,
13,
13,
23,
13,
12,
13,
30,
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,
0,
13,
17,
29,
20,
23,
13,
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,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
229,
11
],
[
229,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
18,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
29,
30
],
[
28,
31
],
[
31,
32
],
[
32,
33
],
[
25,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
36,
41
],
[
25,
42
],
[
42,
43
],
[
42,
44
],
[
25,
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
],
[
25,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
71,
73
],
[
71,
74
],
[
25,
75
],
[
75,
76
],
[
75,
77
],
[
25,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
79,
84
],
[
84,
85
],
[
84,
86
],
[
79,
87
],
[
87,
88
],
[
88,
89
],
[
79,
90
],
[
91,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
25,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
112,
113
],
[
113,
114
],
[
112,
115
],
[
112,
116
],
[
25,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
123,
124
],
[
122,
125
],
[
125,
126
],
[
125,
127
],
[
12,
128
],
[
128,
129
],
[
229,
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
],
[
136,
144
],
[
144,
145
],
[
145,
146
],
[
136,
147
],
[
148,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
149,
156
],
[
156,
157
],
[
156,
158
],
[
149,
159
],
[
159,
160
],
[
160,
161
],
[
149,
162
],
[
163,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
165,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
164,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
177,
178
],
[
177,
179
],
[
174,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
180,
184
],
[
184,
185
],
[
184,
186
],
[
186,
187
],
[
186,
188
],
[
174,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
192,
193
],
[
192,
194
],
[
189,
195
],
[
174,
196
],
[
196,
197
],
[
196,
198
],
[
132,
199
],
[
199,
200
],
[
130,
201
],
[
201,
202
],
[
130,
203
],
[
203,
204
],
[
0,
205
],
[
205,
206
],
[
205,
207
],
[
207,
208
],
[
205,
209
],
[
209,
210
],
[
205,
211
],
[
211,
212
],
[
211,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
214,
218
],
[
213,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
219,
223
],
[
211,
224
],
[
224,
225
],
[
211,
226
],
[
226,
227
],
[
0,
228
],
[
228,
229
],
[
228,
230
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\n\npublic class Main {\n public static void main(String[] args) {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \n } catch(IOException e) {\n e.printStackTrace();\n }\n }\n \n static Sort bubbleSort(int num, int[] arr) {\n int count = 0;\n for(int i=0; i<num; i++) {\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }\n return new Sort(count, arr);\n }\n}\n\nclass Sort{\n public int count;\n public int[] array;\n \n public Sort(int count, int[] array){\n this.count = count;\n this.array = array;\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) {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \n } catch(IOException e) {\n e.printStackTrace();\n }\n }\n \n static Sort bubbleSort(int num, int[] arr) {\n int count = 0;\n for(int i=0; i<num; i++) {\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }\n return new Sort(count, arr);\n }\n}",
"Main",
"public static void main(String[] args) {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \n } catch(IOException e) {\n e.printStackTrace();\n }\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \n } catch(IOException e) {\n e.printStackTrace();\n }\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"try {\n // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \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 // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \n }",
"int num = Integer.parseInt(br.readLine());",
"num",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] temp = br.readLine().split(\"\\\\s\");",
"temp",
"br.readLine().split(\"\\\\s\")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\"\\\\s\"",
"int[] arr = new int[num];",
"arr",
"new int[num]",
"num",
"for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num",
"i",
"num",
"i++",
"i++",
"i",
"{\n arr[i] = Integer.parseInt(temp[i]);\n }",
"{\n arr[i] = Integer.parseInt(temp[i]);\n }",
"arr[i] = Integer.parseInt(temp[i])",
"arr[i]",
"arr",
"i",
"Integer.parseInt(temp[i])",
"Integer.parseInt",
"Integer",
"temp[i]",
"temp",
"i",
"Sort sort = bubbleSort(num, arr);",
"sort",
"bubbleSort(num, arr)",
"bubbleSort",
"num",
"arr",
"String[] output = new String[num];",
"output",
"new String[num]",
"num",
"for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num",
"i",
"num",
"i++",
"i++",
"i",
"{\n output[i] = String.valueOf(sort.array[i]);\n }",
"{\n output[i] = String.valueOf(sort.array[i]);\n }",
"output[i] = String.valueOf(sort.array[i])",
"output[i]",
"output",
"i",
"String.valueOf(sort.array[i])",
"String.valueOf",
"String",
"sort.array[i]",
"sort.array",
"sort",
"sort.array",
"i",
"System.out.println(String.valueOf(String.join(\" \", output)))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.valueOf(String.join(\" \", output))",
"String.valueOf",
"String",
"String.join(\" \", output)",
"String.join",
"String",
"\" \"",
"output",
"System.out.println(String.valueOf(sort.count))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.valueOf(sort.count)",
"String.valueOf",
"String",
"sort.count",
"sort",
"sort.count",
"String[] args",
"args",
"static Sort bubbleSort(int num, int[] arr) {\n int count = 0;\n for(int i=0; i<num; i++) {\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }\n return new Sort(count, arr);\n }",
"bubbleSort",
"{\n int count = 0;\n for(int i=0; i<num; i++) {\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }\n return new Sort(count, arr);\n }",
"int count = 0;",
"count",
"0",
"for(int i=0; i<num; i++) {\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<num",
"i",
"num",
"i++",
"i++",
"i",
"{\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }",
"{\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }",
"for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }",
"int j=num-1;",
"int j=num-1;",
"j",
"num-1",
"num",
"1",
"i<j",
"i",
"j",
"j--",
"j--",
"j",
"{\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }",
"{\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }",
"if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }",
"arr[j] < arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"{\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }",
"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",
"count += 1",
"count",
"1",
"return new Sort(count, arr);",
"new Sort(count, arr)",
"int num",
"num",
"int[] arr",
"arr",
"class Sort{\n public int count;\n public int[] array;\n \n public Sort(int count, int[] array){\n this.count = count;\n this.array = array;\n }\n}",
"Sort",
"public int count;",
"count",
"public int[] array;",
"array",
"public Sort(int count, int[] array){\n this.count = count;\n this.array = array;\n }",
"Sort",
"{\n this.count = count;\n this.array = array;\n }",
"this.count = count",
"this.count",
"this",
"this.count",
"count",
"this.array = array",
"this.array",
"this",
"this.array",
"array",
"int count",
"count",
"int[] array",
"array",
"public class Main {\n public static void main(String[] args) {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \n } catch(IOException e) {\n e.printStackTrace();\n }\n }\n \n static Sort bubbleSort(int num, int[] arr) {\n int count = 0;\n for(int i=0; i<num; i++) {\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }\n return new Sort(count, arr);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n try {\n // int num = 5;\n // int[] arr = {5, 3, 2, 4, 1};\n \n int num = Integer.parseInt(br.readLine());\n String[] temp = br.readLine().split(\"\\\\s\");\n int[] arr = new int[num];\n \n for(int i=0; i<num; i++) {\n arr[i] = Integer.parseInt(temp[i]);\n }\n \n Sort sort = bubbleSort(num, arr);\n \n String[] output = new String[num];\n \n for(int i=0; i<num; i++){\n output[i] = String.valueOf(sort.array[i]);\n }\n System.out.println(String.valueOf(String.join(\" \", output)));\n System.out.println(String.valueOf(sort.count));\n \n \n } catch(IOException e) {\n e.printStackTrace();\n }\n }\n \n static Sort bubbleSort(int num, int[] arr) {\n int count = 0;\n for(int i=0; i<num; i++) {\n for(int j=num-1; i<j; j--){\n if(arr[j] < arr[j-1]) {\n int tmp = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = tmp;\n count += 1;\n }\n }\n }\n return new Sort(count, arr);\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
// int num = 5;
// int[] arr = {5, 3, 2, 4, 1};
int num = Integer.parseInt(br.readLine());
String[] temp = br.readLine().split("\\s");
int[] arr = new int[num];
for(int i=0; i<num; i++) {
arr[i] = Integer.parseInt(temp[i]);
}
Sort sort = bubbleSort(num, arr);
String[] output = new String[num];
for(int i=0; i<num; i++){
output[i] = String.valueOf(sort.array[i]);
}
System.out.println(String.valueOf(String.join(" ", output)));
System.out.println(String.valueOf(sort.count));
} catch(IOException e) {
e.printStackTrace();
}
}
static Sort bubbleSort(int num, int[] arr) {
int count = 0;
for(int i=0; i<num; i++) {
for(int j=num-1; i<j; j--){
if(arr[j] < arr[j-1]) {
int tmp = arr[j];
arr[j] = arr[j-1];
arr[j-1] = tmp;
count += 1;
}
}
}
return new Sort(count, arr);
}
}
class Sort{
public int count;
public int[] array;
public Sort(int count, int[] array){
this.count = count;
this.array = array;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
5,
13,
30,
4,
18,
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,
4,
13,
13,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
2,
13,
17,
13,
1,
40,
13,
30,
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,
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,
13,
23,
13,
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,
4,
18,
13,
18,
13,
13,
17,
4,
18,
4,
18,
4,
18,
4,
18,
13,
18,
13,
2,
18,
13,
13,
17,
17,
13,
17,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
216,
5
],
[
216,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
10,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
9,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
25,
26
],
[
26,
27
],
[
16,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
30,
35
],
[
16,
36
],
[
36,
37
],
[
36,
38
],
[
16,
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
],
[
16,
63
],
[
63,
64
],
[
63,
65
],
[
63,
66
],
[
66,
67
],
[
66,
68
],
[
6,
69
],
[
69,
70
],
[
216,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
77,
79
],
[
73,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
80,
87
],
[
80,
88
],
[
88,
89
],
[
89,
90
],
[
80,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
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
],
[
110,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
109,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
119,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
127,
133
],
[
133,
134
],
[
133,
135
],
[
119,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
119,
141
],
[
141,
142
],
[
141,
143
],
[
119,
144
],
[
144,
145
],
[
73,
146
],
[
146,
147
],
[
146,
148
],
[
146,
149
],
[
71,
150
],
[
150,
151
],
[
71,
152
],
[
152,
153
],
[
216,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
160,
172
],
[
172,
173
],
[
173,
174
],
[
160,
175
],
[
176,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
179,
182
],
[
182,
183
],
[
182,
184
],
[
177,
185
],
[
156,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
192,
195
],
[
195,
196
],
[
195,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
197,
201
],
[
190,
202
],
[
188,
203
],
[
186,
204
],
[
156,
205
],
[
205,
206
],
[
206,
207
],
[
207,
208
],
[
207,
209
],
[
205,
210
],
[
154,
211
],
[
211,
212
],
[
154,
213
],
[
213,
214
],
[
0,
215
],
[
215,
216
],
[
215,
217
]
] | [
"import java.io.*;\n\npublic class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublic static void bubbleSort(int[] a , int l)\n\t{\n\t\tboolean bool = true;\n\t\tint cou = 0;\n\t\tfor(int i = l-1 ; bool ; i-- )\n\t\t{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(a,cou);\t\t\n\t}\n\tpublic static void show(int[] b,int co){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i= 0;i<b.length-1;i++)\n\t\t{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}\n\t\tsb.append(b[b.length-1]).append(\"\\n\").append(co).append(\"\\n\");\t\n\t\tSystem.out.print(sb);\n\t}\n}",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublic static void bubbleSort(int[] a , int l)\n\t{\n\t\tboolean bool = true;\n\t\tint cou = 0;\n\t\tfor(int i = l-1 ; bool ; i-- )\n\t\t{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(a,cou);\t\t\n\t}\n\tpublic static void show(int[] b,int co){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i= 0;i<b.length-1;i++)\n\t\t{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}\n\t\tsb.append(b[b.length-1]).append(\"\\n\").append(co).append(\"\\n\");\t\n\t\tSystem.out.print(sb);\n\t}\n}",
"Main",
"public static void main(String[] args)\n\t{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"main",
"{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"try{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}",
"catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}",
"Exception e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\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[] str = br.readLine().split(\" \");",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] ar = new int[n];",
"ar",
"new int[n]",
"n",
"for(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}",
"int i=0 ;",
"int i=0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}",
"{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}",
"ar[i] = Integer.parseInt(str[i])",
"ar[i]",
"ar",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"bubbleSort(ar,ar.length)",
"bubbleSort",
"ar",
"ar.length",
"ar",
"ar.length",
"String[] args",
"args",
"public static void bubbleSort(int[] a , int l)\n\t{\n\t\tboolean bool = true;\n\t\tint cou = 0;\n\t\tfor(int i = l-1 ; bool ; i-- )\n\t\t{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(a,cou);\t\t\n\t}",
"bubbleSort",
"{\n\t\tboolean bool = true;\n\t\tint cou = 0;\n\t\tfor(int i = l-1 ; bool ; i-- )\n\t\t{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(a,cou);\t\t\n\t}",
"boolean bool = true;",
"bool",
"true",
"int cou = 0;",
"cou",
"0",
"for(int i = l-1 ; bool ; i-- )\n\t\t{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = l-1 ;",
"int i = l-1 ;",
"i",
"l-1",
"l",
"1",
"bool",
"i--",
"i--",
"i",
"{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"bool = false",
"bool",
"false",
"for(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\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{\n\t\t\t\t\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\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+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}",
"int temp = a[j+1];",
"temp",
"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] = temp",
"a[j]",
"a",
"j",
"temp",
"bool = true",
"bool",
"true",
"cou++",
"cou",
"show(a,cou)",
"show",
"a",
"cou",
"int[] a",
"a",
"int l",
"l",
"public static void show(int[] b,int co){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i= 0;i<b.length-1;i++)\n\t\t{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}\n\t\tsb.append(b[b.length-1]).append(\"\\n\").append(co).append(\"\\n\");\t\n\t\tSystem.out.print(sb);\n\t}",
"show",
"{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i= 0;i<b.length-1;i++)\n\t\t{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}\n\t\tsb.append(b[b.length-1]).append(\"\\n\").append(co).append(\"\\n\");\t\n\t\tSystem.out.print(sb);\n\t}",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for(int i= 0;i<b.length-1;i++)\n\t\t{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}",
"int i= 0;",
"int i= 0;",
"i",
"0",
"i<b.length-1",
"i",
"b.length-1",
"b.length",
"b",
"b.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}",
"{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}",
"sb.append(b[i]).append(\" \")",
"sb.append(b[i]).append",
"sb.append(b[i])",
"sb.append",
"sb",
"b[i]",
"b",
"i",
"\" \"",
"sb.append(b[b.length-1]).append(\"\\n\").append(co).append(\"\\n\")",
"sb.append(b[b.length-1]).append(\"\\n\").append(co).append",
"sb.append(b[b.length-1]).append(\"\\n\").append(co)",
"sb.append(b[b.length-1]).append(\"\\n\").append",
"sb.append(b[b.length-1]).append(\"\\n\")",
"sb.append(b[b.length-1]).append",
"sb.append(b[b.length-1])",
"sb.append",
"sb",
"b[b.length-1]",
"b",
"b.length-1",
"b.length",
"b",
"b.length",
"1",
"\"\\n\"",
"co",
"\"\\n\"",
"System.out.print(sb)",
"System.out.print",
"System.out",
"System",
"System.out",
"sb",
"int[] b",
"b",
"int co",
"co",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublic static void bubbleSort(int[] a , int l)\n\t{\n\t\tboolean bool = true;\n\t\tint cou = 0;\n\t\tfor(int i = l-1 ; bool ; i-- )\n\t\t{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(a,cou);\t\t\n\t}\n\tpublic static void show(int[] b,int co){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i= 0;i<b.length-1;i++)\n\t\t{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}\n\t\tsb.append(b[b.length-1]).append(\"\\n\").append(co).append(\"\\n\");\t\n\t\tSystem.out.print(sb);\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args)\n\t{\n\t\ttry{\n\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\t\tint n = Integer.parseInt(br.readLine());\n\t\t\tString[] str = br.readLine().split(\" \");\n\t\t\tint[] ar = new int[n];\n\t\t\tfor(int i=0 ; i < n ; i++)\n\t\t\t{\n\t\t\t\tar[i] = Integer.parseInt(str[i]);\n\t\t\t}\n\t\t\tbubbleSort(ar,ar.length);\n\t\t\t\n\t\t}catch(Exception e){\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\tpublic static void bubbleSort(int[] a , int l)\n\t{\n\t\tboolean bool = true;\n\t\tint cou = 0;\n\t\tfor(int i = l-1 ; bool ; i-- )\n\t\t{\n\t\t\tbool = false;\n\t\t\tfor(int j = 0 ; j < i ; 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\tint temp = a[j+1];\n\t\t\t\t\ta[j+1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tbool = true;\n\t\t\t\t\tcou++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tshow(a,cou);\t\t\n\t}\n\tpublic static void show(int[] b,int co){\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i= 0;i<b.length-1;i++)\n\t\t{\n\t\t\tsb.append(b[i]).append(\" \");\t\n\t\t}\n\t\tsb.append(b[b.length-1]).append(\"\\n\").append(co).append(\"\\n\");\t\n\t\tSystem.out.print(sb);\n\t}\n}",
"Main"
] | import java.io.*;
public class Main{
public static void main(String[] args)
{
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] str = br.readLine().split(" ");
int[] ar = new int[n];
for(int i=0 ; i < n ; i++)
{
ar[i] = Integer.parseInt(str[i]);
}
bubbleSort(ar,ar.length);
}catch(Exception e){
e.printStackTrace();
}
}
public static void bubbleSort(int[] a , int l)
{
boolean bool = true;
int cou = 0;
for(int i = l-1 ; bool ; i-- )
{
bool = false;
for(int j = 0 ; j < i ; j++)
{
if(a[j] > a[j+1])
{
int temp = a[j+1];
a[j+1] = a[j];
a[j] = temp;
bool = true;
cou++;
}
}
}
show(a,cou);
}
public static void show(int[] b,int co){
StringBuilder sb = new StringBuilder();
for(int i= 0;i<b.length-1;i++)
{
sb.append(b[i]).append(" ");
}
sb.append(b[b.length-1]).append("\n").append(co).append("\n");
System.out.print(sb);
}
} |
[
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,
0,
13,
4,
13,
13,
13,
4,
18,
18,
13,
13,
13,
4,
18,
13,
23,
13,
12,
13,
30,
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,
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,
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,
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
],
[
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
],
[
46,
47
],
[
46,
48
],
[
46,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
8,
56
],
[
56,
57
],
[
57,
58
],
[
6,
59
],
[
59,
60
],
[
4,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
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
],
[
101,
102
],
[
101,
103
],
[
98,
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
],
[
63,
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
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
152,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
63,
172
],
[
172,
173
],
[
61,
174
],
[
174,
175
],
[
61,
176
],
[
176,
177
]
] | [
"import java.util.Scanner;\n\nclass Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint num = scanner.nextInt();//要素数\n\t\tint array[] = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tarray[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(array, num);\n\n\t\tSystem.out.println(count);\n\t\t\n\t\tscanner.close();\n\t}\n\n\tpublic static int bubbleSort( int[] numArray, int num){ // N 個の要素を含む 0-オリジンの配列 A\n\t\tint count = 0;\n\t\t\n\t\t//バブルソート処理\n\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tfor (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t//出力\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tSystem.out.print(numArray[i]);\n\t\t\tif( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint num = scanner.nextInt();//要素数\n\t\tint array[] = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tarray[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(array, num);\n\n\t\tSystem.out.println(count);\n\t\t\n\t\tscanner.close();\n\t}\n\n\tpublic static int bubbleSort( int[] numArray, int num){ // N 個の要素を含む 0-オリジンの配列 A\n\t\tint count = 0;\n\t\t\n\t\t//バブルソート処理\n\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tfor (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t//出力\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tSystem.out.print(numArray[i]);\n\t\t\tif( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\n}",
"Main",
"public static void main(String args[]) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint num = scanner.nextInt();//要素数\n\t\tint array[] = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tarray[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(array, num);\n\n\t\tSystem.out.println(count);\n\t\t\n\t\tscanner.close();\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint num = scanner.nextInt();//要素数\n\t\tint array[] = new int[num];\n\t\tint count = 0;\n\t\t\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tarray[i] = scanner.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(array, num);\n\n\t\tSystem.out.println(count);\n\t\t\n\t\tscanner.close();\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int num = scanner.nextInt();",
"num",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int array[] = new int[num];",
"array",
"new int[num]",
"num",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < num; i ++ ){\n\t\t\tarray[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i ++",
"i ++",
"i",
"{\n\t\t\tarray[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tarray[i] = scanner.nextInt();\n\t\t}",
"array[i] = scanner.nextInt()",
"array[i]",
"array",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"count = bubbleSort(array, num)",
"count",
"bubbleSort(array, num)",
"bubbleSort",
"array",
"num",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"scanner.close()",
"scanner.close",
"scanner",
"String args[]",
"args",
"public static int bubbleSort( int[] numArray, int num){ // N 個の要素を含む 0-オリジンの配列 A\n\t\tint count = 0;\n\t\t\n\t\t//バブルソート処理\n\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tfor (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t//出力\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tSystem.out.print(numArray[i]);\n\t\t\tif( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}",
"bubbleSort",
"{ // N 個の要素を含む 0-オリジンの配列 A\n\t\tint count = 0;\n\t\t\n\t\t//バブルソート処理\n\t\tfor (int i = 0; i < num - 1; i++) {\n\t\t\t\tfor (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t//出力\n\t\tfor(int i = 0; i < num; i ++ ){\n\t\t\tSystem.out.print(numArray[i]);\n\t\t\tif( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t}",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < num - 1; i++) {\n\t\t\t\tfor (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\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\tfor (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tfor (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for (int j = num - 1; j > i; j--) {\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}",
"int j = num - 1;",
"int j = num - 1;",
"j",
"num - 1",
"num",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}\n\t\t\t\t}",
"if (numArray[j - 1] > numArray[j]) {\n\t\t\t\t\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\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\t\tint work = numArray[j - 1];\n\t\t\t\t\t\tnumArray[j - 1] = numArray[j];\n\t\t\t\t\t\tnumArray[j] = work;\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t}",
"int work = numArray[j - 1];",
"work",
"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] = work",
"numArray[j]",
"numArray",
"j",
"work",
"count++",
"count",
"for(int i = 0; i < num; i ++ ){\n\t\t\tSystem.out.print(numArray[i]);\n\t\t\tif( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i ++",
"i ++",
"i",
"{\n\t\t\tSystem.out.print(numArray[i]);\n\t\t\tif( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tSystem.out.print(numArray[i]);\n\t\t\tif( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"System.out.print(numArray[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"numArray[i]",
"numArray",
"i",
"if( i == num - 1) {\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}else {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i == num - 1",
"i",
"num - 1",
"num",
"1",
"{\n\t\t\tSystem.out.print(\"\\n\");\n\t\t\t}",
"System.out.print(\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"return count;",
"count",
"int[] numArray",
"numArray",
"int num",
"num"
] | import java.util.Scanner;
class Main {
public static void main(String args[]) {
Scanner scanner = new Scanner(System.in);
int num = scanner.nextInt();//要素数
int array[] = new int[num];
int count = 0;
for(int i = 0; i < num; i ++ ){
array[i] = scanner.nextInt();
}
count = bubbleSort(array, num);
System.out.println(count);
scanner.close();
}
public static int bubbleSort( int[] numArray, int num){ // N 個の要素を含む 0-オリジンの配列 A
int count = 0;
//バブルソート処理
for (int i = 0; i < num - 1; i++) {
for (int j = num - 1; j > i; j--) {
if (numArray[j - 1] > numArray[j]) {
int work = numArray[j - 1];
numArray[j - 1] = numArray[j];
numArray[j] = work;
count++;
}
}
}
//出力
for(int i = 0; i < num; i ++ ){
System.out.print(numArray[i]);
if( i == num - 1) {
System.out.print("\n");
}else {
System.out.print(" ");
}
}
return count;
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
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,
4,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
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,
0,
13,
17,
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,
14,
2,
13,
17,
40,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
181,
5
],
[
181,
6
],
[
6,
7
],
[
181,
8
],
[
8,
9
],
[
8,
10
],
[
181,
12
],
[
12,
13
],
[
12,
14
],
[
181,
15
],
[
15,
16
],
[
15,
17
],
[
181,
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
],
[
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
],
[
20,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
20,
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
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
84,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
77,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
94,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
20,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
18,
114
],
[
114,
115
],
[
181,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
119,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
119,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
137,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
147,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
147,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
162,
168
],
[
147,
169
],
[
169,
170
],
[
169,
171
],
[
133,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
172,
176
],
[
176,
177
],
[
116,
178
],
[
178,
179
],
[
0,
180
],
[
180,
181
],
[
180,
182
]
] | [
"import java.util.Scanner;\n\npublic class Main\n{\n public static int N;\n public static int[] List=new int[100];\n public static int Count=0;\n public static int flag=0;\n\n\n public static void main(String[] args)\n {\n Scanner scan=new Scanner(System.in);\n N=scan.nextInt();\n\n for(int k=0;k<N;k++)\n {\n List[k]=scan.nextInt();\n }\n\n for(int k=0;k<N;k++)\n {\n BubbleSort(k);\n }\n\n for(int n=0;n<N;n++)\n {\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }\n System.out.println(Count);\n\n }\n\n public static void BubbleSort(int j)\n {\n for(int k=N-1;k>=1;k--)\n {\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n public static int N;\n public static int[] List=new int[100];\n public static int Count=0;\n public static int flag=0;\n\n\n public static void main(String[] args)\n {\n Scanner scan=new Scanner(System.in);\n N=scan.nextInt();\n\n for(int k=0;k<N;k++)\n {\n List[k]=scan.nextInt();\n }\n\n for(int k=0;k<N;k++)\n {\n BubbleSort(k);\n }\n\n for(int n=0;n<N;n++)\n {\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }\n System.out.println(Count);\n\n }\n\n public static void BubbleSort(int j)\n {\n for(int k=N-1;k>=1;k--)\n {\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }\n }\n}",
"Main",
"public static int N;",
"N",
"public static int[] List=new int[100];",
"List",
"new int[100]",
"100",
"public static int Count=0;",
"Count",
"0",
"public static int flag=0;",
"flag",
"0",
"public static void main(String[] args)\n {\n Scanner scan=new Scanner(System.in);\n N=scan.nextInt();\n\n for(int k=0;k<N;k++)\n {\n List[k]=scan.nextInt();\n }\n\n for(int k=0;k<N;k++)\n {\n BubbleSort(k);\n }\n\n for(int n=0;n<N;n++)\n {\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }\n System.out.println(Count);\n\n }",
"main",
"{\n Scanner scan=new Scanner(System.in);\n N=scan.nextInt();\n\n for(int k=0;k<N;k++)\n {\n List[k]=scan.nextInt();\n }\n\n for(int k=0;k<N;k++)\n {\n BubbleSort(k);\n }\n\n for(int n=0;n<N;n++)\n {\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }\n System.out.println(Count);\n\n }",
"Scanner scan=new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"N=scan.nextInt()",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int k=0;k<N;k++)\n {\n List[k]=scan.nextInt();\n }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<N",
"k",
"N",
"k++",
"k++",
"k",
"{\n List[k]=scan.nextInt();\n }",
"{\n List[k]=scan.nextInt();\n }",
"List[k]=scan.nextInt()",
"List[k]",
"List",
"k",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int k=0;k<N;k++)\n {\n BubbleSort(k);\n }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<N",
"k",
"N",
"k++",
"k++",
"k",
"{\n BubbleSort(k);\n }",
"{\n BubbleSort(k);\n }",
"BubbleSort(k)",
"BubbleSort",
"k",
"for(int n=0;n<N;n++)\n {\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }",
"int n=0;",
"int n=0;",
"n",
"0",
"n<N",
"n",
"N",
"n++",
"n++",
"n",
"{\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }",
"{\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }",
"if(n!=N-1)\n System.out.print(List[n]+\" \");",
"n!=N-1",
"n",
"N-1",
"N",
"1",
"System.out.print(List[n]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"List[n]+\" \"",
"List[n]",
"List",
"n",
"\" \"",
"if(n==N-1)\n System.out.println(List[n]);",
"n==N-1",
"n",
"N-1",
"N",
"1",
"System.out.println(List[n])",
"System.out.println",
"System.out",
"System",
"System.out",
"List[n]",
"List",
"n",
"System.out.println(Count)",
"System.out.println",
"System.out",
"System",
"System.out",
"Count",
"String[] args",
"args",
"public static void BubbleSort(int j)\n {\n for(int k=N-1;k>=1;k--)\n {\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }\n }",
"BubbleSort",
"{\n for(int k=N-1;k>=1;k--)\n {\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }\n }",
"for(int k=N-1;k>=1;k--)\n {\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }",
"int k=N-1;",
"int k=N-1;",
"k",
"N-1",
"N",
"1",
"k>=1",
"k",
"1",
"k--",
"k--",
"k",
"{\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }",
"{\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }",
"flag=0",
"flag",
"0",
"if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }",
"List[k]<List[k-1]",
"List[k]",
"List",
"k",
"List[k-1]",
"List",
"k-1",
"k",
"1",
"{\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }",
"int tmp=List[k];",
"tmp",
"List[k]",
"List",
"k",
"List[k]=List[k-1]",
"List[k]",
"List",
"k",
"List[k-1]",
"List",
"k-1",
"k",
"1",
"List[k-1]=tmp",
"List[k-1]",
"List",
"k-1",
"k",
"1",
"tmp",
"flag=1",
"flag",
"1",
"if(flag==1) Count++;",
"flag==1",
"flag",
"1",
"Count++",
"Count",
"int j",
"j",
"public class Main\n{\n public static int N;\n public static int[] List=new int[100];\n public static int Count=0;\n public static int flag=0;\n\n\n public static void main(String[] args)\n {\n Scanner scan=new Scanner(System.in);\n N=scan.nextInt();\n\n for(int k=0;k<N;k++)\n {\n List[k]=scan.nextInt();\n }\n\n for(int k=0;k<N;k++)\n {\n BubbleSort(k);\n }\n\n for(int n=0;n<N;n++)\n {\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }\n System.out.println(Count);\n\n }\n\n public static void BubbleSort(int j)\n {\n for(int k=N-1;k>=1;k--)\n {\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }\n }\n}",
"public class Main\n{\n public static int N;\n public static int[] List=new int[100];\n public static int Count=0;\n public static int flag=0;\n\n\n public static void main(String[] args)\n {\n Scanner scan=new Scanner(System.in);\n N=scan.nextInt();\n\n for(int k=0;k<N;k++)\n {\n List[k]=scan.nextInt();\n }\n\n for(int k=0;k<N;k++)\n {\n BubbleSort(k);\n }\n\n for(int n=0;n<N;n++)\n {\n if(n!=N-1)\n System.out.print(List[n]+\" \");\n if(n==N-1)\n System.out.println(List[n]);\n }\n System.out.println(Count);\n\n }\n\n public static void BubbleSort(int j)\n {\n for(int k=N-1;k>=1;k--)\n {\n flag=0;\n if(List[k]<List[k-1])\n {\n int tmp=List[k];\n List[k]=List[k-1];\n List[k-1]=tmp;\n flag=1;\n }\n if(flag==1) Count++;\n }\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main
{
public static int N;
public static int[] List=new int[100];
public static int Count=0;
public static int flag=0;
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
N=scan.nextInt();
for(int k=0;k<N;k++)
{
List[k]=scan.nextInt();
}
for(int k=0;k<N;k++)
{
BubbleSort(k);
}
for(int n=0;n<N;n++)
{
if(n!=N-1)
System.out.print(List[n]+" ");
if(n==N-1)
System.out.println(List[n]);
}
System.out.println(Count);
}
public static void BubbleSort(int j)
{
for(int k=N-1;k>=1;k--)
{
flag=0;
if(List[k]<List[k-1])
{
int tmp=List[k];
List[k]=List[k-1];
List[k-1]=tmp;
flag=1;
}
if(flag==1) Count++;
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
5,
13,
30,
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,
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,
41,
13,
20,
28,
13,
13,
30,
30,
4,
18,
4,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
4,
18,
13,
4,
18,
18,
13,
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
],
[
10,
11
],
[
10,
12
],
[
9,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
13,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
22,
23
],
[
23,
24
],
[
13,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
27,
32
],
[
13,
33
],
[
33,
34
],
[
33,
35
],
[
13,
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
],
[
13,
60
],
[
60,
61
],
[
60,
62
],
[
13,
63
],
[
63,
64
],
[
63,
65
],
[
13,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
74,
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
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
96,
98
],
[
89,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
99,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
99,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
114,
120
],
[
99,
121
],
[
121,
122
],
[
121,
123
],
[
99,
124
],
[
124,
125
],
[
13,
126
],
[
126,
127
],
[
126,
128
],
[
13,
129
],
[
129,
130
],
[
129,
131
],
[
129,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
134,
140
],
[
13,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
13,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
6,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
]
] | [
"import java.io.*;\n\npublic class Main {\n public static void main(String[] args) {\n try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n } catch (IOException e) {\n }\n }\n}",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n public static void main(String[] args) {\n try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n } catch (IOException e) {\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n } catch (IOException e) {\n }\n }",
"main",
"{\n try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n } catch (IOException e) {\n }\n }",
"try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n } catch (IOException e) {\n }",
"catch (IOException e) {\n }",
"IOException e",
"{\n }",
"{\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n }",
"BufferedReader in = new BufferedReader(new InputStreamReader(System.in));",
"in",
"new BufferedReader(new InputStreamReader(System.in))",
"int count = Integer.parseInt(in.readLine());",
"count",
"Integer.parseInt(in.readLine())",
"Integer.parseInt",
"Integer",
"in.readLine()",
"in.readLine",
"in",
"String[] arrStr = in.readLine().split(\" \");",
"arrStr",
"in.readLine().split(\" \")",
"in.readLine().split",
"in.readLine()",
"in.readLine",
"in",
"\" \"",
"int[] arrInt = new int[count];",
"arrInt",
"new int[count]",
"count",
"for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<count",
"i",
"count",
"i++",
"i++",
"i",
"{ arrInt[i] = Integer.parseInt(arrStr[i]); }",
"{ arrInt[i] = Integer.parseInt(arrStr[i]); }",
"arrInt[i] = Integer.parseInt(arrStr[i])",
"arrInt[i]",
"arrInt",
"i",
"Integer.parseInt(arrStr[i])",
"Integer.parseInt",
"Integer",
"arrStr[i]",
"arrStr",
"i",
"int flag = 1;",
"flag",
"1",
"int cntResult = 0;",
"cntResult",
"0",
"while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }",
"flag==1",
"flag",
"1",
"{\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }",
"flag = 0",
"flag",
"0",
"for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }",
"int j = count-1;",
"int j = count-1;",
"j",
"count-1",
"count",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }",
"{\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }",
"if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }",
"arrInt[j] < arrInt[j-1]",
"arrInt[j]",
"arrInt",
"j",
"arrInt[j-1]",
"arrInt",
"j-1",
"j",
"1",
"{\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }",
"int tmp = arrInt[j];",
"tmp",
"arrInt[j]",
"arrInt",
"j",
"arrInt[j] = arrInt[j-1]",
"arrInt[j]",
"arrInt",
"j",
"arrInt[j-1]",
"arrInt",
"j-1",
"j",
"1",
"arrInt[j-1] = tmp",
"arrInt[j-1]",
"arrInt",
"j-1",
"j",
"1",
"tmp",
"flag = 1",
"flag",
"1",
"cntResult++",
"cntResult",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for( int i : arrInt ) { sb.append(i).append(\" \"); }",
"int i",
"arrInt",
"{ sb.append(i).append(\" \"); }",
"{ sb.append(i).append(\" \"); }",
"sb.append(i).append(\" \")",
"sb.append(i).append",
"sb.append(i)",
"sb.append",
"sb",
"i",
"\" \"",
"System.out.println(sb.toString().trim())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString().trim()",
"sb.toString().trim",
"sb.toString()",
"sb.toString",
"sb",
"System.out.println(cntResult)",
"System.out.println",
"System.out",
"System",
"System.out",
"cntResult",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n } catch (IOException e) {\n }\n }\n}",
"public class Main {\n public static void main(String[] args) {\n try {\n BufferedReader in = new BufferedReader(new InputStreamReader(System.in));\n int count = Integer.parseInt(in.readLine());\n String[] arrStr = in.readLine().split(\" \");\n int[] arrInt = new int[count];\n for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }\n int flag = 1;\n int cntResult = 0;\n while(flag==1) {\n flag = 0;\n for( int j = count-1; j > 0; j-- ) {\n if(arrInt[j] < arrInt[j-1]) {\n int tmp = arrInt[j];\n arrInt[j] = arrInt[j-1];\n arrInt[j-1] = tmp;\n flag = 1;\n cntResult++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for( int i : arrInt ) { sb.append(i).append(\" \"); }\n System.out.println(sb.toString().trim());\n System.out.println(cntResult);\n } catch (IOException e) {\n }\n }\n}",
"Main"
] | import java.io.*;
public class Main {
public static void main(String[] args) {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int count = Integer.parseInt(in.readLine());
String[] arrStr = in.readLine().split(" ");
int[] arrInt = new int[count];
for(int i=0; i<count; i++) { arrInt[i] = Integer.parseInt(arrStr[i]); }
int flag = 1;
int cntResult = 0;
while(flag==1) {
flag = 0;
for( int j = count-1; j > 0; j-- ) {
if(arrInt[j] < arrInt[j-1]) {
int tmp = arrInt[j];
arrInt[j] = arrInt[j-1];
arrInt[j-1] = tmp;
flag = 1;
cntResult++;
}
}
}
StringBuilder sb = new StringBuilder();
for( int i : arrInt ) { sb.append(i).append(" "); }
System.out.println(sb.toString().trim());
System.out.println(cntResult);
} catch (IOException e) {
}
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
0,
13,
20,
17,
41,
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,
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,
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
],
[
152,
5
],
[
152,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
23,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
46,
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
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
76,
78
],
[
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
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
8,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
143,
148
],
[
6,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
] | [
"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 count = 0;\n int[] x;\n x = new int[100];\n int N = sc.nextInt();\n\n for(int i = 0;i<N;i++){\n x[i] = sc.nextInt();\n }\n\n for(int i = N-1;i>0;i--){\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }\n\n for(int i = 0;i<N-1;i++){\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N-1]);\n System.out.println(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 count = 0;\n int[] x;\n x = new int[100];\n int N = sc.nextInt();\n\n for(int i = 0;i<N;i++){\n x[i] = sc.nextInt();\n }\n\n for(int i = N-1;i>0;i--){\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }\n\n for(int i = 0;i<N-1;i++){\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N-1]);\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int[] x;\n x = new int[100];\n int N = sc.nextInt();\n\n for(int i = 0;i<N;i++){\n x[i] = sc.nextInt();\n }\n\n for(int i = N-1;i>0;i--){\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }\n\n for(int i = 0;i<N-1;i++){\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N-1]);\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int[] x;\n x = new int[100];\n int N = sc.nextInt();\n\n for(int i = 0;i<N;i++){\n x[i] = sc.nextInt();\n }\n\n for(int i = N-1;i>0;i--){\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }\n\n for(int i = 0;i<N-1;i++){\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N-1]);\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count = 0;",
"count",
"0",
"int[] x;",
"x",
"x = new int[100]",
"x",
"new int[100]",
"100",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0;i<N;i++){\n x[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n x[i] = sc.nextInt();\n }",
"{\n x[i] = sc.nextInt();\n }",
"x[i] = sc.nextInt()",
"x[i]",
"x",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = N-1;i>0;i--){\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }",
"int i = N-1;",
"int i = N-1;",
"i",
"N-1",
"N",
"1",
"i>0",
"i",
"0",
"i--",
"i--",
"i",
"{\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }",
"{\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }",
"for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j<i",
"j",
"i",
"j++",
"j++",
"j",
"{\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }",
"{\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }",
"if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }",
"x[j]>x[j+1]",
"x[j]",
"x",
"j",
"x[j+1]",
"x",
"j+1",
"j",
"1",
"{\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }",
"int temp = x[j];",
"temp",
"x[j]",
"x",
"j",
"x[j] = x[j+1]",
"x[j]",
"x",
"j",
"x[j+1]",
"x",
"j+1",
"j",
"1",
"x[j+1] = temp",
"x[j+1]",
"x",
"j+1",
"j",
"1",
"temp",
"count++",
"count",
"for(int i = 0;i<N-1;i++){\n System.out.print(x[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(x[i] + \" \");\n }",
"{\n System.out.print(x[i] + \" \");\n }",
"System.out.print(x[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"x[i] + \" \"",
"x[i]",
"x",
"i",
"\" \"",
"System.out.println(x[N-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"x[N-1]",
"x",
"N-1",
"N",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int[] x;\n x = new int[100];\n int N = sc.nextInt();\n\n for(int i = 0;i<N;i++){\n x[i] = sc.nextInt();\n }\n\n for(int i = N-1;i>0;i--){\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }\n\n for(int i = 0;i<N-1;i++){\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N-1]);\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\n int count = 0;\n int[] x;\n x = new int[100];\n int N = sc.nextInt();\n\n for(int i = 0;i<N;i++){\n x[i] = sc.nextInt();\n }\n\n for(int i = N-1;i>0;i--){\n for(int j = 0;j<i;j++){\n if(x[j]>x[j+1]){\n int temp = x[j];\n x[j] = x[j+1];\n x[j+1] = temp;\n count++;\n }\n }\n }\n\n for(int i = 0;i<N-1;i++){\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N-1]);\n System.out.println(count);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int count = 0;
int[] x;
x = new int[100];
int N = sc.nextInt();
for(int i = 0;i<N;i++){
x[i] = sc.nextInt();
}
for(int i = N-1;i>0;i--){
for(int j = 0;j<i;j++){
if(x[j]>x[j+1]){
int temp = x[j];
x[j] = x[j+1];
x[j+1] = temp;
count++;
}
}
}
for(int i = 0;i<N-1;i++){
System.out.print(x[i] + " ");
}
System.out.println(x[N-1]);
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
20,
17,
41,
13,
12,
13,
30,
41,
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,
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,
40,
13,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
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,
12,
13,
30,
4,
18,
20,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
6,
8
],
[
4,
9
],
[
9,
10
],
[
9,
11
],
[
4,
13
],
[
13,
14
],
[
4,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
17,
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
],
[
17,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
47,
49
],
[
43,
50
],
[
50,
51
],
[
50,
52
],
[
43,
53
],
[
53,
54
],
[
54,
55
],
[
43,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
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
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
71,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
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
],
[
81,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
17,
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
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
125,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
118,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
17,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
4,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
150,
156
],
[
156,
157
]
] | [
"import java.util.*;\nclass Main{\n\tScanner sc=new Scanner(System.in);\n\tint[] su=new int[100];\n\tint sum;\n\tvoid go(){\n\t\tint n=sc.nextInt();\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsu[i]=sc.nextInt();\n\t\t}\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(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\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.print(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\tpublic static void main(String[]agrs){\n\t\tnew Main().go();\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"class Main{\n\tScanner sc=new Scanner(System.in);\n\tint[] su=new int[100];\n\tint sum;\n\tvoid go(){\n\t\tint n=sc.nextInt();\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsu[i]=sc.nextInt();\n\t\t}\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(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\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.print(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}\n\tpublic static void main(String[]agrs){\n\t\tnew Main().go();\n\t}\n}",
"Main",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int[] su=new int[100];",
"su",
"new int[100]",
"100",
"int sum;",
"sum",
"void go(){\n\t\tint n=sc.nextInt();\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsu[i]=sc.nextInt();\n\t\t}\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(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\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.print(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"go",
"{\n\t\tint n=sc.nextInt();\n\t\t\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsu[i]=sc.nextInt();\n\t\t}\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(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\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.print(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sum);\n\t}",
"int n=sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=0; i<n; i++){\n\t\t\tsu[i]=sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tsu[i]=sc.nextInt();\n\t\t}",
"{\n\t\t\tsu[i]=sc.nextInt();\n\t\t}",
"su[i]=sc.nextInt()",
"su[i]",
"su",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i=n-1; i>0; i--){\n\t\t\tfor(int j=0; j<i; j++){\n\t\t\t\tif(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\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(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\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(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j=0; j<i; j++){\n\t\t\t\tif(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\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(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\n\t\t\t\t}\n\t\t\t}",
"if(su[j]>su[j+1]){\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\n\t\t\t\t}",
"su[j]>su[j+1]",
"su[j]",
"su",
"j",
"su[j+1]",
"su",
"j+1",
"j",
"1",
"{\n\t\t\t\t\tsum++;\n\t\t\t\t\tint a=su[j+1];\n\t\t\t\t\tsu[j+1]=su[j];\n\t \t\t\t \tsu[j]=a;\n\t\t\t\t}",
"sum++",
"sum",
"int a=su[j+1];",
"a",
"su[j+1]",
"su",
"j+1",
"j",
"1",
"su[j+1]=su[j]",
"su[j+1]",
"su",
"j+1",
"j",
"1",
"su[j]",
"su",
"j",
"su[j]=a",
"su[j]",
"su",
"j",
"a",
"for(int i=0; i<n; i++){\n\t\t\tif(i<n-1){\n\t\t\t\tSystem.out.print(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[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(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i<n-1){\n\t\t\t\tSystem.out.print(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}\n\t\t}",
"if(i<n-1){\n\t\t\t\tSystem.out.print(su[i]+\" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}",
"i<n-1",
"i",
"n-1",
"n",
"1",
"{\n\t\t\t\tSystem.out.print(su[i]+\" \");\n\t\t\t}",
"System.out.print(su[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"su[i]+\" \"",
"su[i]",
"su",
"i",
"\" \"",
"{\n\t\t\t\tSystem.out.println(su[i]);\n\t\t\t}",
"System.out.println(su[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"su[i]",
"su",
"i",
"System.out.println(sum)",
"System.out.println",
"System.out",
"System",
"System.out",
"sum",
"public static void main(String[]agrs){\n\t\tnew Main().go();\n\t}",
"main",
"{\n\t\tnew Main().go();\n\t}",
"new Main().go()",
"new Main().go",
"new Main()",
"String[]agrs",
"agrs"
] | import java.util.*;
class Main{
Scanner sc=new Scanner(System.in);
int[] su=new int[100];
int sum;
void go(){
int n=sc.nextInt();
for(int i=0; i<n; i++){
su[i]=sc.nextInt();
}
for(int i=n-1; i>0; i--){
for(int j=0; j<i; j++){
if(su[j]>su[j+1]){
sum++;
int a=su[j+1];
su[j+1]=su[j];
su[j]=a;
}
}
}
for(int i=0; i<n; i++){
if(i<n-1){
System.out.print(su[i]+" ");
}else{
System.out.println(su[i]);
}
}
System.out.println(sum);
}
public static void main(String[]agrs){
new Main().go();
}
} |
[
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,
41,
13,
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,
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
],
[
153,
5
],
[
153,
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
],
[
8,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
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
],
[
56,
66
],
[
66,
67
],
[
67,
68
],
[
56,
69
],
[
70,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
78,
80
],
[
71,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
84,
86
],
[
81,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
87,
91
],
[
91,
92
],
[
91,
93
],
[
93,
94
],
[
93,
95
],
[
81,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
81,
103
],
[
103,
104
],
[
103,
105
],
[
81,
106
],
[
106,
107
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
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
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
8,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
8,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
6,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] | [
"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 A[] = new int[N];\n\n for(int i = 0; i < N; i++)\n A[i] = sc.nextInt();\n\n int count = 0;\n int flag = 1;\n int tmp;\n\n while (flag != 0) {\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }\n System.out.print(A[0]);\n for(int i = 1; i < N; i++)\n System.out.print(\" \" + A[i]);\n System.out.println(\"\");\n System.out.println(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\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 count = 0;\n int flag = 1;\n int tmp;\n\n while (flag != 0) {\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }\n System.out.print(A[0]);\n for(int i = 1; i < N; i++)\n System.out.print(\" \" + A[i]);\n System.out.println(\"\");\n System.out.println(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\n for(int i = 0; i < N; i++)\n A[i] = sc.nextInt();\n\n int count = 0;\n int flag = 1;\n int tmp;\n\n while (flag != 0) {\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }\n System.out.print(A[0]);\n for(int i = 1; i < N; i++)\n System.out.print(\" \" + A[i]);\n System.out.println(\"\");\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\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 count = 0;\n int flag = 1;\n int tmp;\n\n while (flag != 0) {\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }\n System.out.print(A[0]);\n for(int i = 1; i < N; i++)\n System.out.print(\" \" + A[i]);\n System.out.println(\"\");\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();",
"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 count = 0;",
"count",
"0",
"int flag = 1;",
"flag",
"1",
"int tmp;",
"tmp",
"while (flag != 0) {\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }",
"flag != 0",
"flag",
"0",
"{\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }",
"flag = 0",
"flag",
"0",
"for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\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 tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }",
"{\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }",
"if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }",
"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 = 1",
"flag",
"1",
"count++",
"count",
"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 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(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\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 count = 0;\n int flag = 1;\n int tmp;\n\n while (flag != 0) {\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }\n System.out.print(A[0]);\n for(int i = 1; i < N; i++)\n System.out.print(\" \" + A[i]);\n System.out.println(\"\");\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\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 count = 0;\n int flag = 1;\n int tmp;\n\n while (flag != 0) {\n flag = 0;\n for(int j = N - 1; j > 0; j--) {\n if(A[j] < A[j-1]) {\n tmp = A[j];\n A[j] = A[j - 1];\n A[j - 1] = tmp;\n flag = 1;\n count++;\n }\n }\n }\n System.out.print(A[0]);\n for(int i = 1; i < N; i++)\n System.out.print(\" \" + A[i]);\n System.out.println(\"\");\n System.out.println(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 = 0;
int flag = 1;
int tmp;
while (flag != 0) {
flag = 0;
for(int j = N - 1; j > 0; j--) {
if(A[j] < A[j-1]) {
tmp = A[j];
A[j] = A[j - 1];
A[j - 1] = tmp;
flag = 1;
count++;
}
}
}
System.out.print(A[0]);
for(int i = 1; i < N; i++)
System.out.print(" " + A[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,
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,
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,
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,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
151,
5
],
[
151,
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
],
[
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
],
[
8,
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
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
8,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
8,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
6,
148
],
[
148,
149
],
[
0,
150
],
[
150,
151
],
[
150,
152
]
] | [
"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[] arr = new int[n];\n for(int i = 0; i < n; i++) {\n arr[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < n; i++ ) {\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }\n\n System.out.print(arr[0]);\n for(int i = 1; i < n; i++) {\n System.out.print(\" \" + arr[i]);\n }\n\n System.out.println();\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[] arr = new int[n];\n for(int i = 0; i < n; i++) {\n arr[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < n; i++ ) {\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }\n\n System.out.print(arr[0]);\n for(int i = 1; i < n; i++) {\n System.out.print(\" \" + arr[i]);\n }\n\n System.out.println();\n System.out.println(count);\n\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++) {\n arr[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < n; i++ ) {\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }\n\n System.out.print(arr[0]);\n for(int i = 1; i < n; i++) {\n System.out.print(\" \" + arr[i]);\n }\n\n System.out.println();\n System.out.println(count);\n\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++) {\n arr[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < n; i++ ) {\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }\n\n System.out.print(arr[0]);\n for(int i = 1; i < n; i++) {\n System.out.print(\" \" + arr[i]);\n }\n\n System.out.println();\n System.out.println(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[] arr = new int[n];",
"arr",
"new int[n]",
"n",
"for(int i = 0; i < n; i++) {\n arr[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr[i] = sc.nextInt();\n }",
"{\n arr[i] = sc.nextInt();\n }",
"arr[i] = sc.nextInt()",
"arr[i]",
"arr",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < n; i++ ) {\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\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 > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }",
"{\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }",
"for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }",
"{\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }",
"if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }",
"arr[j] < arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"{\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }",
"int v = arr[j];",
"v",
"arr[j]",
"arr",
"j",
"arr[j] = arr[j-1]",
"arr[j]",
"arr",
"j",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"arr[j-1] = v",
"arr[j-1]",
"arr",
"j-1",
"j",
"1",
"v",
"count++",
"count",
"System.out.print(arr[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"arr[0]",
"arr",
"0",
"for(int i = 1; i < n; i++) {\n System.out.print(\" \" + arr[i]);\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"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()",
"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 sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] arr = new int[n];\n for(int i = 0; i < n; i++) {\n arr[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < n; i++ ) {\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }\n\n System.out.print(arr[0]);\n for(int i = 1; i < n; i++) {\n System.out.print(\" \" + arr[i]);\n }\n\n System.out.println();\n System.out.println(count);\n\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[] arr = new int[n];\n for(int i = 0; i < n; i++) {\n arr[i] = sc.nextInt();\n }\n\n int count = 0;\n for(int i = 0; i < n; i++ ) {\n for(int j = n - 1; j > 0; j--) {\n if(arr[j] < arr[j-1]) {\n int v = arr[j];\n arr[j] = arr[j-1];\n arr[j-1] = v;\n count++;\n }\n }\n }\n\n System.out.print(arr[0]);\n for(int i = 1; i < n; i++) {\n System.out.print(\" \" + arr[i]);\n }\n\n System.out.println();\n System.out.println(count);\n\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[] arr = new int[n];
for(int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
int count = 0;
for(int i = 0; i < n; i++ ) {
for(int j = n - 1; j > 0; j--) {
if(arr[j] < arr[j-1]) {
int v = arr[j];
arr[j] = arr[j-1];
arr[j-1] = v;
count++;
}
}
}
System.out.print(arr[0]);
for(int i = 1; i < n; i++) {
System.out.print(" " + arr[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,
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,
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,
30,
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
],
[
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
],
[
78,
102
],
[
102,
103
],
[
102,
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
],
[
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{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint[] ary = new int[N];\n\n\t\tfor (int i = 0; i < N; i++)\n\t\t{\n\t\t\tary[i] = sc.nextInt();\n\t\t}\n\n\t\tboolean flag = true;\n\t\tint numSwap = 0;\n\t\twhile (flag)\n\t\t{\n\t\t\tflag = false;\n\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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; i++)\n\t\t{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(numSwap);\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint[] ary = new int[N];\n\n\t\tfor (int i = 0; i < N; i++)\n\t\t{\n\t\t\tary[i] = sc.nextInt();\n\t\t}\n\n\t\tboolean flag = true;\n\t\tint numSwap = 0;\n\t\twhile (flag)\n\t\t{\n\t\t\tflag = false;\n\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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; i++)\n\t\t{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(numSwap);\n\t}\n}",
"Main",
"public static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint[] ary = new int[N];\n\n\t\tfor (int i = 0; i < N; i++)\n\t\t{\n\t\t\tary[i] = sc.nextInt();\n\t\t}\n\n\t\tboolean flag = true;\n\t\tint numSwap = 0;\n\t\twhile (flag)\n\t\t{\n\t\t\tflag = false;\n\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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; i++)\n\t\t{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(numSwap);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint[] ary = new int[N];\n\n\t\tfor (int i = 0; i < N; i++)\n\t\t{\n\t\t\tary[i] = sc.nextInt();\n\t\t}\n\n\t\tboolean flag = true;\n\t\tint numSwap = 0;\n\t\twhile (flag)\n\t\t{\n\t\t\tflag = false;\n\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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; i++)\n\t\t{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(numSwap);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ary = new int[N];",
"ary",
"new int[N]",
"N",
"for (int i = 0; i < N; i++)\n\t\t{\n\t\t\tary[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tary[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tary[i] = sc.nextInt();\n\t\t}",
"ary[i] = sc.nextInt()",
"ary[i]",
"ary",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean flag = true;",
"flag",
"true",
"int numSwap = 0;",
"numSwap",
"0",
"while (flag)\n\t\t{\n\t\t\tflag = false;\n\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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 (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"ary[i] < ary[i - 1]",
"ary[i]",
"ary",
"i",
"ary[i - 1]",
"ary",
"i - 1",
"i",
"1",
"{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"int temp = ary[i];",
"temp",
"ary[i]",
"ary",
"i",
"ary[i] = ary[i - 1]",
"ary[i]",
"ary",
"i",
"ary[i - 1]",
"ary",
"i - 1",
"i",
"1",
"ary[i - 1] = temp",
"ary[i - 1]",
"ary",
"i - 1",
"i",
"1",
"temp",
"numSwap++",
"numSwap",
"flag = true",
"flag",
"true",
"for (int i = 0; i < N; i++)\n\t\t{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\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(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}",
"System.out.print(ary[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"ary[i]",
"ary",
"i",
"if (i < N - 1)\n\t\t\t{\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(numSwap)",
"System.out.println",
"System.out",
"System",
"System.out",
"numSwap",
"String[] args",
"args",
"public class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint[] ary = new int[N];\n\n\t\tfor (int i = 0; i < N; i++)\n\t\t{\n\t\t\tary[i] = sc.nextInt();\n\t\t}\n\n\t\tboolean flag = true;\n\t\tint numSwap = 0;\n\t\twhile (flag)\n\t\t{\n\t\t\tflag = false;\n\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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; i++)\n\t\t{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(numSwap);\n\t}\n}",
"public class Main\n{\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint N = sc.nextInt();\n\t\tint[] ary = new int[N];\n\n\t\tfor (int i = 0; i < N; i++)\n\t\t{\n\t\t\tary[i] = sc.nextInt();\n\t\t}\n\n\t\tboolean flag = true;\n\t\tint numSwap = 0;\n\t\twhile (flag)\n\t\t{\n\t\t\tflag = false;\n\n\t\t\tfor (int i = N - 1; i >= 1; i--)\n\t\t\t{\n\t\t\t\tif (ary[i] < ary[i - 1])\n\t\t\t\t{\n\t\t\t\t\tint temp = ary[i];\n\t\t\t\t\tary[i] = ary[i - 1];\n\t\t\t\t\tary[i - 1] = temp;\n\n\t\t\t\t\tnumSwap++;\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; i++)\n\t\t{\n\t\t\tSystem.out.print(ary[i]);\n\t\t\tif (i < N - 1)\n\t\t\t{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(numSwap);\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[] ary = new int[N];
for (int i = 0; i < N; i++)
{
ary[i] = sc.nextInt();
}
boolean flag = true;
int numSwap = 0;
while (flag)
{
flag = false;
for (int i = N - 1; i >= 1; i--)
{
if (ary[i] < ary[i - 1])
{
int temp = ary[i];
ary[i] = ary[i - 1];
ary[i - 1] = temp;
numSwap++;
flag = true;
}
}
}
for (int i = 0; i < N; i++)
{
System.out.print(ary[i]);
if (i < N - 1)
{
System.out.print(" ");
}
}
System.out.println("");
System.out.println(numSwap);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
4,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
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,
41,
13,
18,
13,
13,
41,
13,
2,
13,
17,
42,
2,
2,
13,
17,
2,
13,
18,
13,
13,
30,
0,
18,
13,
2,
13,
17,
18,
13,
13,
40,
13,
0,
18,
13,
2,
13,
17,
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,
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,
41,
13,
11,
1,
0,
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,
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,
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,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
335,
5
],
[
335,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
6,
11
],
[
11,
12
],
[
335,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
15,
24
],
[
24,
25
],
[
24,
26
],
[
15,
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
],
[
15,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
61,
72
],
[
73,
73
],
[
73,
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
],
[
86,
87
],
[
86,
88
],
[
74,
89
],
[
89,
90
],
[
90,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
90,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
60,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
60,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
60,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
60,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
115,
125
],
[
125,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
126,
132
],
[
132,
133
],
[
132,
134
],
[
125,
135
],
[
135,
136
],
[
60,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
140,
142
],
[
137,
143
],
[
15,
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
],
[
160,
161
],
[
160,
162
],
[
157,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
157,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
178,
182
],
[
15,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
335,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
197,
198
],
[
190,
199
],
[
199,
200
],
[
199,
201
],
[
190,
203
],
[
203,
204
],
[
203,
205
],
[
190,
206
],
[
206,
207
],
[
207,
208
],
[
208,
209
],
[
208,
210
],
[
206,
211
],
[
211,
212
],
[
211,
213
],
[
206,
214
],
[
214,
215
],
[
215,
216
],
[
206,
217
],
[
218,
218
],
[
218,
219
],
[
219,
220
],
[
220,
221
],
[
220,
222
],
[
219,
223
],
[
223,
224
],
[
224,
225
],
[
190,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
226,
231
],
[
231,
232
],
[
231,
233
],
[
226,
234
],
[
234,
235
],
[
235,
236
],
[
226,
237
],
[
238,
238
],
[
238,
239
],
[
239,
240
],
[
238,
241
],
[
241,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
245,
246
],
[
245,
247
],
[
241,
248
],
[
248,
249
],
[
248,
250
],
[
241,
251
],
[
251,
252
],
[
252,
253
],
[
241,
254
],
[
255,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
258,
259
],
[
258,
260
],
[
260,
261
],
[
260,
262
],
[
257,
263
],
[
263,
264
],
[
263,
265
],
[
256,
266
],
[
266,
267
],
[
267,
268
],
[
267,
269
],
[
269,
270
],
[
269,
271
],
[
271,
272
],
[
271,
273
],
[
266,
274
],
[
274,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
277,
279
],
[
274,
280
],
[
280,
281
],
[
280,
282
],
[
266,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
283,
287
],
[
266,
288
],
[
288,
289
],
[
190,
290
],
[
290,
291
],
[
291,
292
],
[
292,
293
],
[
292,
294
],
[
290,
295
],
[
295,
296
],
[
295,
297
],
[
290,
298
],
[
298,
299
],
[
299,
300
],
[
290,
301
],
[
302,
302
],
[
302,
303
],
[
303,
304
],
[
304,
305
],
[
305,
306
],
[
305,
307
],
[
303,
308
],
[
308,
309
],
[
308,
310
],
[
302,
311
],
[
311,
312
],
[
312,
313
],
[
312,
314
],
[
314,
315
],
[
314,
316
],
[
311,
317
],
[
317,
318
],
[
318,
319
],
[
319,
320
],
[
319,
321
],
[
317,
322
],
[
190,
323
],
[
323,
324
],
[
324,
325
],
[
325,
326
],
[
325,
327
],
[
190,
328
],
[
328,
329
],
[
329,
330
],
[
330,
331
],
[
330,
332
],
[
328,
333
],
[
0,
334
],
[
334,
335
],
[
334,
336
]
] | [
"import java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\t//ALDS1_1_A(); \n\t\tALDS1_2_A();\n\t}\n\tpublic static void ALDS1_1_A() {\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\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void ALDS1_2_A() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint countAns = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\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}\n\t\tSystem.out.println();\n\t\tSystem.out.println(countAns);\n\t}\n}\n",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t//ALDS1_1_A(); \n\t\tALDS1_2_A();\n\t}\n\tpublic static void ALDS1_1_A() {\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\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void ALDS1_2_A() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint countAns = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\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}\n\t\tSystem.out.println();\n\t\tSystem.out.println(countAns);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\t//ALDS1_1_A(); \n\t\tALDS1_2_A();\n\t}",
"main",
"{\n\t\t//ALDS1_1_A(); \n\t\tALDS1_2_A();\n\t}",
"ALDS1_2_A()",
"ALDS1_2_A",
"String[] args",
"args",
"public static void ALDS1_1_A() {\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\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}",
"ALDS1_1_A",
"{\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\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\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",
"for(int i = 1; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}",
"{\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}",
"for(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}",
"if(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}",
"j == n - 1",
"j",
"n - 1",
"n",
"1",
"{\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}",
"System.out.print(a[j])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[j]",
"a",
"j",
"{\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}",
"System.out.print(a[j] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[j] + \" \"",
"a[j]",
"a",
"j",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int temp = a[i];",
"temp",
"a[i]",
"a",
"i",
"int j = i - 1;",
"j",
"i - 1",
"i",
"1",
"while(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}",
"j >= 0 && temp < a[j]",
"j >= 0",
"j",
"0",
"temp < a[j]",
"temp",
"a[j]",
"a",
"j",
"{\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}",
"a[j + 1] = a[j]",
"a[j + 1]",
"a",
"j + 1",
"j",
"1",
"a[j]",
"a",
"j",
"j--",
"j",
"a[j + 1] = temp",
"a[j + 1]",
"a",
"j + 1",
"j",
"1",
"temp",
"for(int j = 0; j < n; j++) {\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}",
"if(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}",
"j == n - 1",
"j",
"n - 1",
"n",
"1",
"{\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}",
"System.out.print(a[j])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[j]",
"a",
"j",
"{\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}",
"System.out.print(a[j] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[j] + \" \"",
"a[j]",
"a",
"j",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"public static void ALDS1_2_A() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint countAns = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\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}\n\t\tSystem.out.println();\n\t\tSystem.out.println(countAns);\n\t}",
"ALDS1_2_A",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint countAns = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\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}\n\t\tSystem.out.println();\n\t\tSystem.out.println(countAns);\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",
"int countAns = 0;",
"countAns",
"0",
"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 i = 0; i < n; i++) {\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\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\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\t*/\n\t\t}",
"{\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\t\t\t}\n\t\t\t*/\n\t\t}",
"int j;",
"j",
"for(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}",
"j = n - 2;",
"j = n - 2",
"j",
"n - 2",
"n",
"2",
"j >= i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}",
"if(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\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 + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}",
"int temp = a[j + 1];",
"temp",
"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] = temp",
"a[j]",
"a",
"j",
"temp",
"countAns++",
"countAns",
"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}",
"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}",
"{\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}",
"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(\" \");",
"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(countAns)",
"System.out.println",
"System.out",
"System",
"System.out",
"countAns",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t//ALDS1_1_A(); \n\t\tALDS1_2_A();\n\t}\n\tpublic static void ALDS1_1_A() {\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\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void ALDS1_2_A() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint countAns = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\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}\n\t\tSystem.out.println();\n\t\tSystem.out.println(countAns);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\t//ALDS1_1_A(); \n\t\tALDS1_2_A();\n\t}\n\tpublic static void ALDS1_1_A() {\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\n\t\tfor(int i = 1; i < n; i++) {\n\t\t\tfor(int j = 0; j < n; j++) {\n\t\t\t\tif(j == n - 1) {\n\t\t\t\t\tSystem.out.print(a[j]);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tint temp = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && temp < a[j]) {\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j + 1] = temp;\n\t\t}\n\n\t\tfor(int j = 0; j < n; j++) {\n\t\t\tif(j == n - 1) {\n\t\t\t\tSystem.out.print(a[j]);\n\t\t\t}else {\n\t\t\t\tSystem.out.print(a[j] + \" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void ALDS1_2_A() {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = new int[n];\n\t\tint countAns = 0;\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tfor(int i = 0; i < n; i++) {\n\t\t\tint j;\n\t\t\tfor(j = n - 2; j >= i; j--) {\n\t\t\t\tif(a[j + 1] < a[j]) {\n\t\t\t\t\tint temp = a[j + 1];\n\t\t\t\t\ta[j + 1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tcountAns++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\tfor(int ans: a) {\n\t\t\t\tSystem.out.print(ans + \" \");\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\twhile(j >= 0 && a[j + 1] < a[j]) {\n\t\t\t\tint temp = a[j + 1];\n\t\t\t\ta[j + 1] = a[j];\n\t\t\t\ta[j] = temp;\n\t\t\t\tcountAns++;\n\t\t\t\tj--;\n\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}\n\t\tSystem.out.println();\n\t\tSystem.out.println(countAns);\n\t}\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) {
//ALDS1_1_A();
ALDS1_2_A();
}
public static void ALDS1_1_A() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
for(int i = 1; i < n; i++) {
for(int j = 0; j < n; j++) {
if(j == n - 1) {
System.out.print(a[j]);
}else {
System.out.print(a[j] + " ");
}
}
System.out.println();
int temp = a[i];
int j = i - 1;
while(j >= 0 && temp < a[j]) {
a[j + 1] = a[j];
j--;
}
a[j + 1] = temp;
}
for(int j = 0; j < n; j++) {
if(j == n - 1) {
System.out.print(a[j]);
}else {
System.out.print(a[j] + " ");
}
}
System.out.println();
}
public static void ALDS1_2_A() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
int countAns = 0;
for(int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
for(int i = 0; i < n; i++) {
int j;
for(j = n - 2; j >= i; j--) {
if(a[j + 1] < a[j]) {
int temp = a[j + 1];
a[j + 1] = a[j];
a[j] = temp;
countAns++;
}
}
/*
for(int ans: a) {
System.out.print(ans + " ");
}
System.out.println();
while(j >= 0 && a[j + 1] < a[j]) {
int temp = a[j + 1];
a[j + 1] = a[j];
a[j] = temp;
countAns++;
j--;
}
*/
}
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(countAns);
}
}
|
[
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,
41,
13,
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,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
2,
18,
13,
13,
18,
13,
2,
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,
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
],
[
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
],
[
22,
26
],
[
26,
27
],
[
21,
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
],
[
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
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
88,
90
],
[
85,
91
],
[
91,
92
],
[
91,
93
],
[
84,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
84,
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
],
[
84,
118
],
[
118,
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
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
8,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
150,
151
],
[
150,
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\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\n\t\tint[] ar = new int[N];\n\t\t\n\t\tfor (int i = 0,j; i < N; i++) {\n\t\t\t ar[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\t\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\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(ar[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ar[N - 1]);\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\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\n\t\tint[] ar = new int[N];\n\t\t\n\t\tfor (int i = 0,j; i < N; i++) {\n\t\t\t ar[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\t\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\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(ar[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ar[N - 1]);\n\t\t\n\t\tSystem.out.println(cnt);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\n\t\tint[] ar = new int[N];\n\t\t\n\t\tfor (int i = 0,j; i < N; i++) {\n\t\t\t ar[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\t\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\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(ar[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ar[N - 1]);\n\t\t\n\t\tSystem.out.println(cnt);\n\t}",
"main",
"{\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\n\t\tint[] ar = new int[N];\n\t\t\n\t\tfor (int i = 0,j; i < N; i++) {\n\t\t\t ar[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\t\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\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(ar[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ar[N - 1]);\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[] ar = new int[N];",
"ar",
"new int[N]",
"N",
"for (int i = 0,j; i < N; i++) {\n\t\t\t ar[i] = sc.nextInt();\n\t\t}",
"int i = 0,j;",
"int i = 0",
"i",
"0",
"j;",
"j",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t ar[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\t ar[i] = sc.nextInt();\n\t\t}",
"ar[i] = sc.nextInt()",
"ar[i]",
"ar",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int cnt = 0;",
"cnt",
"0",
"for (int i = 0; i < N; i++){\n\t\t\tfor(int j = N - 1; j > i; j-- ){\n\t\t\t\tif (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\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",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = N - 1; j > i; j-- ){\n\t\t\t\tif (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 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 > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\n\t\t\t\t}\n\t\t\t}",
"if (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"ar[j] < ar[j - 1]",
"ar[j]",
"ar",
"j",
"ar[j - 1]",
"ar",
"j - 1",
"j",
"1",
"{\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\n\t\t\t\t}",
"ar[j - 1] -= ar[j]",
"ar[j - 1]",
"ar",
"j - 1",
"j",
"1",
"ar[j]",
"ar",
"j",
"ar[j] += ar[j - 1]",
"ar[j]",
"ar",
"j",
"ar[j - 1]",
"ar",
"j - 1",
"j",
"1",
"ar[j - 1] = ar[j] - ar[j - 1]",
"ar[j - 1]",
"ar",
"j - 1",
"j",
"1",
"ar[j] - ar[j - 1]",
"ar[j]",
"ar",
"j",
"ar[j - 1]",
"ar",
"j - 1",
"j",
"1",
"cnt++",
"cnt",
"for (int i = 0; i < N - 1; i++) {\n\t\t\tSystem.out.print(ar[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(ar[i] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(ar[i] + \" \");\n\t\t}",
"System.out.print(ar[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"ar[i] + \" \"",
"ar[i]",
"ar",
"i",
"\" \"",
"System.out.println(ar[N - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"ar[N - 1]",
"ar",
"N - 1",
"N",
"1",
"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\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\n\t\tint[] ar = new int[N];\n\t\t\n\t\tfor (int i = 0,j; i < N; i++) {\n\t\t\t ar[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\t\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\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(ar[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ar[N - 1]);\n\t\t\n\t\tSystem.out.println(cnt);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\n\t\tint[] ar = new int[N];\n\t\t\n\t\tfor (int i = 0,j; i < N; i++) {\n\t\t\t ar[i] = sc.nextInt();\n\t\t}\n\n\t\tint cnt = 0;\n\t\t\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 (ar[j] < ar[j - 1]){\n\t\t\t\t\tar[j - 1] -= ar[j];\n\t\t\t\t\tar[j] += ar[j - 1];\n\t\t\t\t\tar[j - 1] = ar[j] - ar[j - 1];\n\t\t\t\t\tcnt++;\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(ar[i] + \" \");\n\t\t}\n\t\tSystem.out.println(ar[N - 1]);\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[] ar = new int[N];
for (int i = 0,j; i < N; i++) {
ar[i] = sc.nextInt();
}
int cnt = 0;
for (int i = 0; i < N; i++){
for(int j = N - 1; j > i; j-- ){
if (ar[j] < ar[j - 1]){
ar[j - 1] -= ar[j];
ar[j] += ar[j - 1];
ar[j - 1] = ar[j] - ar[j - 1];
cnt++;
}
}
}
for (int i = 0; i < N - 1; i++) {
System.out.print(ar[i] + " ");
}
System.out.println(ar[N - 1]);
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
41,
13,
17,
42,
13,
30,
41,
13,
17,
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,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
40,
13,
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,
30,
4,
18,
13,
17,
4,
18,
13,
13,
4,
18,
18,
13,
13,
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
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
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
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
49,
51
],
[
8,
52
],
[
52,
53
],
[
52,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
58,
60
],
[
54,
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
],
[
88,
112
],
[
112,
113
],
[
112,
114
],
[
54,
115
],
[
115,
116
],
[
8,
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
],
[
132,
135
],
[
135,
136
],
[
135,
137
],
[
131,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
138,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
147,
150
],
[
138,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
8,
156
],
[
156,
157
],
[
157,
158
],
[
156,
159
],
[
8,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
6,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.util.Scanner;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n boolean flag = true;\n int count = 0;\n while(flag){\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }\n build.append(count);\n System.out.println(build);\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 StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n boolean flag = true;\n int count = 0;\n while(flag){\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }\n build.append(count);\n System.out.println(build);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n boolean flag = true;\n int count = 0;\n while(flag){\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }\n build.append(count);\n System.out.println(build);\n }",
"main",
"{\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n boolean flag = true;\n int count = 0;\n while(flag){\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }\n build.append(count);\n System.out.println(build);\n }",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"StringBuilder build = new StringBuilder();",
"build",
"new StringBuilder()",
"int z = sc.nextInt();",
"z",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ary = new int[z];",
"ary",
"new int[z]",
"z",
"for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < ary.length",
"i",
"ary.length",
"ary",
"ary.length",
"i++",
"i++",
"i",
"{\n ary[i] = sc.nextInt();\n }",
"{\n ary[i] = sc.nextInt();\n }",
"ary[i] = sc.nextInt()",
"ary[i]",
"ary",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean flag = true;",
"flag",
"true",
"int count = 0;",
"count",
"0",
"while(flag){\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }",
"flag",
"{\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }",
"int j = 0;",
"j",
"0",
"flag = false",
"flag",
"false",
"for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }",
"int i = ary.length-1;",
"int i = ary.length-1;",
"i",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"i > j",
"i",
"j",
"i--",
"i--",
"i",
"{\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }",
"{\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }",
"if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }",
"ary[i] < ary[i-1]",
"ary[i]",
"ary",
"i",
"ary[i-1]",
"ary",
"i-1",
"i",
"1",
"{\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }",
"int temp = ary[i];",
"temp",
"ary[i]",
"ary",
"i",
"ary[i] = ary[i-1]",
"ary[i]",
"ary",
"i",
"ary[i-1]",
"ary",
"i-1",
"i",
"1",
"ary[i-1] = temp",
"ary[i-1]",
"ary",
"i-1",
"i",
"1",
"temp",
"count++",
"count",
"flag = true",
"flag",
"true",
"j++",
"j",
"for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < ary.length",
"i",
"ary.length",
"ary",
"ary.length",
"i++",
"i++",
"i",
"{\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }",
"{\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }",
"build.append(ary[i])",
"build.append",
"build",
"ary[i]",
"ary",
"i",
"if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }",
"i == ary.length-1",
"i",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"{\n build.append(\"\\n\");\n }",
"build.append(\"\\n\")",
"build.append",
"build",
"\"\\n\"",
"{ build.append(\" \");\n }",
"build.append(\" \")",
"build.append",
"build",
"\" \"",
"build.append(count)",
"build.append",
"build",
"count",
"System.out.println(build)",
"System.out.println",
"System.out",
"System",
"System.out",
"build",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n boolean flag = true;\n int count = 0;\n while(flag){\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }\n build.append(count);\n System.out.println(build);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n boolean flag = true;\n int count = 0;\n while(flag){\n int j = 0;\n flag = false;\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n flag = true;\n }\n }\n j++;\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n if(i == ary.length-1){\n build.append(\"\\n\");\n }else{ build.append(\" \");\n }\n }\n build.append(count);\n System.out.println(build);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
StringBuilder build = new StringBuilder();
int z = sc.nextInt();
int[] ary = new int[z];
for(int i = 0 ; i < ary.length; i++){
ary[i] = sc.nextInt();
}
boolean flag = true;
int count = 0;
while(flag){
int j = 0;
flag = false;
for(int i = ary.length-1; i > j; i--){
if(ary[i] < ary[i-1]){
int temp = ary[i];
ary[i] = ary[i-1];
ary[i-1] = temp;
count++;
flag = true;
}
}
j++;
}
for(int i = 0; i < ary.length; i++){
build.append(ary[i]);
if(i == ary.length-1){
build.append("\n");
}else{ build.append(" ");
}
}
build.append(count);
System.out.println(build);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
20,
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,
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,
13,
4,
18,
13,
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,
18,
13,
13,
2,
2,
4,
18,
13,
17,
13,
23,
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
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
28,
29
],
[
25,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
35,
43
],
[
43,
44
],
[
44,
45
],
[
35,
46
],
[
47,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
52,
55
],
[
55,
56
],
[
55,
57
],
[
11,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
58,
62
],
[
9,
63
],
[
63,
64
],
[
0,
65
],
[
65,
66
],
[
65,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
73,
75
],
[
69,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
76,
84
],
[
84,
85
],
[
85,
86
],
[
76,
87
],
[
88,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
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
],
[
108,
109
],
[
108,
110
],
[
105,
111
],
[
111,
112
],
[
111,
113
],
[
104,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
114,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
114,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
129,
135
],
[
114,
136
],
[
136,
137
],
[
114,
138
],
[
138,
139
],
[
138,
140
],
[
69,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
144,
145
],
[
144,
146
],
[
69,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
147,
155
],
[
155,
156
],
[
156,
157
],
[
147,
158
],
[
159,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
69,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
168,
173
],
[
174,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
174,
178
],
[
174,
179
],
[
67,
180
],
[
180,
181
],
[
67,
182
],
[
182,
183
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\n\nclass Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint count = Integer.parseInt(br.readLine());\n\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] numList = new int[count];\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tnumList[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\tTool.bubleSort(numList, count);\n\t}\n}\n\nclass Tool {\n\tstatic void bubleSort(int[] numList, int count) {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tint flag = 0;\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tfor (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsb.append(numList[0]);\n\t\tfor(int i = 1; i < count; i++){\n\t\t\tsb.append(\" \" + numList[i]);\n\t\t}\n\t\tSystem.out.println(sb.toString() + \"\\n\" + flag);\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint count = Integer.parseInt(br.readLine());\n\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] numList = new int[count];\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tnumList[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\tTool.bubleSort(numList, count);\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint count = Integer.parseInt(br.readLine());\n\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] numList = new int[count];\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tnumList[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\tTool.bubleSort(numList, count);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint count = Integer.parseInt(br.readLine());\n\n\t\tString[] str = br.readLine().split(\" \");\n\t\tint[] numList = new int[count];\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tnumList[i] = Integer.parseInt(str[i]);\n\t\t}\n\t\tTool.bubleSort(numList, count);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int count = Integer.parseInt(br.readLine());",
"count",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] str = br.readLine().split(\" \");",
"str",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] numList = new int[count];",
"numList",
"new int[count]",
"count",
"for (int i = 0; i < count; i++) {\n\t\t\tnumList[i] = Integer.parseInt(str[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n\t\t\tnumList[i] = Integer.parseInt(str[i]);\n\t\t}",
"{\n\t\t\tnumList[i] = Integer.parseInt(str[i]);\n\t\t}",
"numList[i] = Integer.parseInt(str[i])",
"numList[i]",
"numList",
"i",
"Integer.parseInt(str[i])",
"Integer.parseInt",
"Integer",
"str[i]",
"str",
"i",
"Tool.bubleSort(numList, count)",
"Tool.bubleSort",
"Tool",
"numList",
"count",
"String[] args",
"args",
"class Tool {\n\tstatic void bubleSort(int[] numList, int count) {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tint flag = 0;\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tfor (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsb.append(numList[0]);\n\t\tfor(int i = 1; i < count; i++){\n\t\t\tsb.append(\" \" + numList[i]);\n\t\t}\n\t\tSystem.out.println(sb.toString() + \"\\n\" + flag);\n\t}\n}",
"Tool",
"static void bubleSort(int[] numList, int count) {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tint flag = 0;\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tfor (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsb.append(numList[0]);\n\t\tfor(int i = 1; i < count; i++){\n\t\t\tsb.append(\" \" + numList[i]);\n\t\t}\n\t\tSystem.out.println(sb.toString() + \"\\n\" + flag);\n\t}",
"bubleSort",
"{\n\t\tStringBuffer sb = new StringBuffer();\n\t\tint flag = 0;\n\t\tfor (int i = 0; i < count; i++) {\n\t\t\tfor (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsb.append(numList[0]);\n\t\tfor(int i = 1; i < count; i++){\n\t\t\tsb.append(\" \" + numList[i]);\n\t\t}\n\t\tSystem.out.println(sb.toString() + \"\\n\" + flag);\n\t}",
"StringBuffer sb = new StringBuffer();",
"sb",
"new StringBuffer()",
"int flag = 0;",
"flag",
"0",
"for (int i = 0; i < count; i++) {\n\t\t\tfor (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n\t\t\tfor (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for (int j = count - 1; j > i; j--) {\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}",
"int j = count - 1;",
"int j = count - 1;",
"j",
"count - 1",
"count",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}\n\t\t\t}",
"if (numList[j - 1] > numList[j]) {\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}",
"numList[j - 1] > numList[j]",
"numList[j - 1]",
"numList",
"j - 1",
"j",
"1",
"numList[j]",
"numList",
"j",
"{\n\t\t\t\t\tint temp = numList[j];\n\t\t\t\t\tnumList[j] = numList[j - 1];\n\t\t\t\t\tnumList[j - 1] = temp;\n\t\t\t\t\tflag++;\n\t\t\t\t\tj = count;\n\t\t\t\t}",
"int temp = numList[j];",
"temp",
"numList[j]",
"numList",
"j",
"numList[j] = numList[j - 1]",
"numList[j]",
"numList",
"j",
"numList[j - 1]",
"numList",
"j - 1",
"j",
"1",
"numList[j - 1] = temp",
"numList[j - 1]",
"numList",
"j - 1",
"j",
"1",
"temp",
"flag++",
"flag",
"j = count",
"j",
"count",
"sb.append(numList[0])",
"sb.append",
"sb",
"numList[0]",
"numList",
"0",
"for(int i = 1; i < count; i++){\n\t\t\tsb.append(\" \" + numList[i]);\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n\t\t\tsb.append(\" \" + numList[i]);\n\t\t}",
"{\n\t\t\tsb.append(\" \" + numList[i]);\n\t\t}",
"sb.append(\" \" + numList[i])",
"sb.append",
"sb",
"\" \" + numList[i]",
"\" \"",
"numList[i]",
"numList",
"i",
"System.out.println(sb.toString() + \"\\n\" + flag)",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString() + \"\\n\" + flag",
"sb.toString() + \"\\n\" + flag",
"sb.toString()",
"sb.toString",
"sb",
"\"\\n\"",
"flag",
"int[] numList",
"numList",
"int count",
"count"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int count = Integer.parseInt(br.readLine());
String[] str = br.readLine().split(" ");
int[] numList = new int[count];
for (int i = 0; i < count; i++) {
numList[i] = Integer.parseInt(str[i]);
}
Tool.bubleSort(numList, count);
}
}
class Tool {
static void bubleSort(int[] numList, int count) {
StringBuffer sb = new StringBuffer();
int flag = 0;
for (int i = 0; i < count; i++) {
for (int j = count - 1; j > i; j--) {
if (numList[j - 1] > numList[j]) {
int temp = numList[j];
numList[j] = numList[j - 1];
numList[j - 1] = temp;
flag++;
j = count;
}
}
}
sb.append(numList[0]);
for(int i = 1; i < count; i++){
sb.append(" " + numList[i]);
}
System.out.println(sb.toString() + "\n" + flag);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
4,
18,
13,
17,
41,
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,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
4,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
17,
11,
1,
41,
13,
2,
18,
13,
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,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
0,
13,
17,
4,
13,
13,
4,
18,
18,
13,
13,
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,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
209,
5
],
[
209,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
12,
15
],
[
15,
16
],
[
16,
17
],
[
15,
18
],
[
8,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
27,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
8,
35
],
[
35,
36
],
[
35,
37
],
[
8,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
39,
49
],
[
49,
50
],
[
50,
51
],
[
39,
52
],
[
53,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
54,
58
],
[
58,
59
],
[
59,
60
],
[
58,
61
],
[
61,
62
],
[
61,
63
],
[
8,
64
],
[
64,
65
],
[
64,
66
],
[
6,
67
],
[
67,
68
],
[
209,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
75
],
[
75,
76
],
[
75,
77
],
[
71,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
89
],
[
90,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
94,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
94,
108
],
[
108,
109
],
[
109,
110
],
[
94,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
117,
118
],
[
117,
119
],
[
114,
120
],
[
120,
121
],
[
120,
122
],
[
113,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
137,
138
],
[
137,
139
],
[
123,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
123,
145
],
[
145,
146
],
[
123,
147
],
[
147,
148
],
[
147,
149
],
[
71,
150
],
[
150,
151
],
[
150,
152
],
[
71,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
69,
159
],
[
159,
160
],
[
209,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
164,
174
],
[
174,
175
],
[
175,
176
],
[
164,
177
],
[
178,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
179,
184
],
[
184,
185
],
[
184,
186
],
[
178,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
187,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
195,
200
],
[
163,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
203,
205
],
[
161,
206
],
[
206,
207
],
[
0,
208
],
[
208,
209
],
[
208,
210
]
] | [
"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\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String data = sc.next();\n\n //String???Int????????????\n String[] datas = data.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = Integer.parseInt(datas[i]);\n\t\t}\n\n \tbubble(A);\n\t}\n\n\t/**\n\t * ??????????????????\n\t * @param a\n\t */\n\tprivate static void bubble(int[] A) {\n\t\tint cnt = 0;\n\t\t//??°???????????¢????????????????´?\n\t\tboolean flag = true;\n\t\tfor(int i=0; flag==true; i++){\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdisp(A);\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static void disp(int[] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\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\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String data = sc.next();\n\n //String???Int????????????\n String[] datas = data.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = Integer.parseInt(datas[i]);\n\t\t}\n\n \tbubble(A);\n\t}\n\n\t/**\n\t * ??????????????????\n\t * @param a\n\t */\n\tprivate static void bubble(int[] A) {\n\t\tint cnt = 0;\n\t\t//??°???????????¢????????????????´?\n\t\tboolean flag = true;\n\t\tfor(int i=0; flag==true; i++){\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdisp(A);\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static void disp(int[] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String data = sc.next();\n\n //String???Int????????????\n String[] datas = data.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = Integer.parseInt(datas[i]);\n\t\t}\n\n \tbubble(A);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String data = sc.next();\n\n //String???Int????????????\n String[] datas = data.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = Integer.parseInt(datas[i]);\n\t\t}\n\n \tbubble(A);\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"sc.useDelimiter(System.getProperty(\"line.separator\"))",
"sc.useDelimiter",
"sc",
"System.getProperty(\"line.separator\")",
"System.getProperty",
"System",
"\"line.separator\"",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"String data = sc.next();",
"data",
"sc.next()",
"sc.next",
"sc",
"String[] datas = data.split(\" \");",
"datas",
"data.split(\" \")",
"data.split",
"data",
"\" \"",
"int[] A = new int[n];",
"A",
"new int[n]",
"n",
"for (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = Integer.parseInt(datas[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\tA[i] = Integer.parseInt(datas[i]);\n\t\t}",
"{\n\t\t\tA[i] = Integer.parseInt(datas[i]);\n\t\t}",
"A[i] = Integer.parseInt(datas[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(datas[i])",
"Integer.parseInt",
"Integer",
"datas[i]",
"datas",
"i",
"bubble(A)",
"bubble",
"A",
"String[] args",
"args",
"/**\n\t * ??????????????????\n\t * @param a\n\t */\n\tprivate static void bubble(int[] A) {\n\t\tint cnt = 0;\n\t\t//??°???????????¢????????????????´?\n\t\tboolean flag = true;\n\t\tfor(int i=0; flag==true; i++){\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdisp(A);\n\t\tSystem.out.println(cnt);\n\n\t}",
"bubble",
"{\n\t\tint cnt = 0;\n\t\t//??°???????????¢????????????????´?\n\t\tboolean flag = true;\n\t\tfor(int i=0; flag==true; i++){\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdisp(A);\n\t\tSystem.out.println(cnt);\n\n\t}",
"int cnt = 0;",
"cnt",
"0",
"boolean flag = true;",
"flag",
"true",
"for(int i=0; flag==true; i++){\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"flag==true",
"flag",
"true",
"i++",
"i++",
"i",
"{\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\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 j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\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+1",
"j",
"i+1",
"i",
"1",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\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 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\tcnt++;\n\t\t\t\t\tflag = true;\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",
"cnt++",
"cnt",
"flag = true",
"flag",
"true",
"disp(A)",
"disp",
"A",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"int[] A",
"A",
"private static void disp(int[] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}",
"disp",
"{\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}",
"for (int i = 0; i < a.length; i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\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(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-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!=a.length-1)System.out.print(\" \");",
"i!=a.length-1",
"i",
"a.length-1",
"a.length",
"a",
"a.length",
"1",
"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",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String data = sc.next();\n\n //String???Int????????????\n String[] datas = data.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = Integer.parseInt(datas[i]);\n\t\t}\n\n \tbubble(A);\n\t}\n\n\t/**\n\t * ??????????????????\n\t * @param a\n\t */\n\tprivate static void bubble(int[] A) {\n\t\tint cnt = 0;\n\t\t//??°???????????¢????????????????´?\n\t\tboolean flag = true;\n\t\tfor(int i=0; flag==true; i++){\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdisp(A);\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static void disp(int[] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\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\tsc.useDelimiter(System.getProperty(\"line.separator\"));\n int n = sc.nextInt();\n String data = sc.next();\n\n //String???Int????????????\n String[] datas = data.split(\" \");\n int[] A = new int[n];\n for (int i = 0; i < A.length; i++) {\n\t\t\tA[i] = Integer.parseInt(datas[i]);\n\t\t}\n\n \tbubble(A);\n\t}\n\n\t/**\n\t * ??????????????????\n\t * @param a\n\t */\n\tprivate static void bubble(int[] A) {\n\t\tint cnt = 0;\n\t\t//??°???????????¢????????????????´?\n\t\tboolean flag = true;\n\t\tfor(int i=0; flag==true; i++){\n\t\t\tflag = false;\n\t\t\tfor(int j= A.length-1; j>=i+1; j--){\n\t\t\t\tif(A[j-1] > A[j]){\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdisp(A);\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static void disp(int[] a) {\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tSystem.out.print(a[i]);\n\t\t\tif(i!=a.length-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
sc.useDelimiter(System.getProperty("line.separator"));
int n = sc.nextInt();
String data = sc.next();
//String???Int????????????
String[] datas = data.split(" ");
int[] A = new int[n];
for (int i = 0; i < A.length; i++) {
A[i] = Integer.parseInt(datas[i]);
}
bubble(A);
}
/**
* ??????????????????
* @param a
*/
private static void bubble(int[] A) {
int cnt = 0;
//??°???????????¢????????????????´?
boolean flag = true;
for(int i=0; flag==true; i++){
flag = false;
for(int j= A.length-1; j>=i+1; j--){
if(A[j-1] > A[j]){
int tmp = A[j-1];
A[j-1] = A[j];
A[j] = tmp;
cnt++;
flag = true;
}
}
}
disp(A);
System.out.println(cnt);
}
private static void disp(int[] a) {
for (int i = 0; i < a.length; i++) {
System.out.print(a[i]);
if(i!=a.length-1)System.out.print(" ");
}
System.out.println();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
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,
40,
13,
0,
13,
17,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
18,
13,
13,
4,
18,
4,
18,
13,
13,
17,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
153,
8
],
[
153,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
11,
43
],
[
43,
44
],
[
43,
45
],
[
43,
46
],
[
9,
47
],
[
47,
48
],
[
153,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
55,
57
],
[
51,
58
],
[
58,
59
],
[
58,
60
],
[
51,
61
],
[
61,
62
],
[
61,
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
],
[
92,
116
],
[
116,
117
],
[
116,
118
],
[
63,
119
],
[
119,
120
],
[
51,
121
],
[
121,
122
],
[
121,
123
],
[
51,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
49,
130
],
[
130,
131
],
[
49,
132
],
[
132,
133
],
[
153,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
144,
147
],
[
142,
148
],
[
142,
149
],
[
134,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();\n\n bubbleSort(n, nums);\n }\n\n private static void bubbleSort(int n, int[] a) {\n \tboolean flg = true;\n \tint i = 0;\n \tint sw = 0;\n \twhile (flg) {\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}\n \ttrace(a);\n \tSystem.out.println(sw);\n }\n\n private static void trace(int[] nums) {\n \tSystem.out.println(Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\"));\n }\n\n}",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();\n\n bubbleSort(n, nums);\n }\n\n private static void bubbleSort(int n, int[] a) {\n \tboolean flg = true;\n \tint i = 0;\n \tint sw = 0;\n \twhile (flg) {\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}\n \ttrace(a);\n \tSystem.out.println(sw);\n }\n\n private static void trace(int[] nums) {\n \tSystem.out.println(Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\"));\n }\n\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();\n\n bubbleSort(n, nums);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();\n\n bubbleSort(n, nums);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int n = scanner.nextInt();",
"n",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] nums = new int[n];",
"nums",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"nums[i] = scanner.nextInt();",
"nums[i] = scanner.nextInt()",
"nums[i]",
"nums",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"bubbleSort(n, nums)",
"bubbleSort",
"n",
"nums",
"String[] args",
"args",
"private static void bubbleSort(int n, int[] a) {\n \tboolean flg = true;\n \tint i = 0;\n \tint sw = 0;\n \twhile (flg) {\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}\n \ttrace(a);\n \tSystem.out.println(sw);\n }",
"bubbleSort",
"{\n \tboolean flg = true;\n \tint i = 0;\n \tint sw = 0;\n \twhile (flg) {\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}\n \ttrace(a);\n \tSystem.out.println(sw);\n }",
"boolean flg = true;",
"flg",
"true",
"int i = 0;",
"i",
"0",
"int sw = 0;",
"sw",
"0",
"while (flg) {\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}",
"flg",
"{\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}",
"flg = false",
"flg",
"false",
"for (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\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\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}",
"{\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}",
"if (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\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 w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\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",
"sw++",
"sw",
"flg = true",
"flg",
"true",
"i++",
"i",
"trace(a)",
"trace",
"a",
"System.out.println(sw)",
"System.out.println",
"System.out",
"System",
"System.out",
"sw",
"int n",
"n",
"int[] a",
"a",
"private static void trace(int[] nums) {\n \tSystem.out.println(Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\"));\n }",
"trace",
"{\n \tSystem.out.println(Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\"));\n }",
"System.out.println(Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\"))",
"System.out.println",
"System.out",
"System",
"System.out",
"Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\")",
"Arrays.toString(nums).replaceAll",
"Arrays.toString(nums)",
"Arrays.toString",
"Arrays",
"nums",
"\"[\\\\[\\\\],]\"",
"\"\"",
"int[] nums",
"nums",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();\n\n bubbleSort(n, nums);\n }\n\n private static void bubbleSort(int n, int[] a) {\n \tboolean flg = true;\n \tint i = 0;\n \tint sw = 0;\n \twhile (flg) {\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}\n \ttrace(a);\n \tSystem.out.println(sw);\n }\n\n private static void trace(int[] nums) {\n \tSystem.out.println(Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\"));\n }\n\n}",
"public class Main {\n\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n\n int n = scanner.nextInt();\n int[] nums = new int[n];\n for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();\n\n bubbleSort(n, nums);\n }\n\n private static void bubbleSort(int n, int[] a) {\n \tboolean flg = true;\n \tint i = 0;\n \tint sw = 0;\n \twhile (flg) {\n \t\tflg = false;\n \t\tfor (int j = n - 1; j > i; j--) {\n \t\t\tif (a[j] < a[j-1]) {\n \t\t\t\tint w = a[j];\n \t\t\t\ta[j] = a[j-1];\n \t\t\t\ta[j-1] = w;\n \t\t\t\tsw++;\n \t\t\t\tflg = true;\n \t\t\t}\n \t\t}\n \t\ti++;\n \t}\n \ttrace(a);\n \tSystem.out.println(sw);\n }\n\n private static void trace(int[] nums) {\n \tSystem.out.println(Arrays.toString(nums).replaceAll(\"[\\\\[\\\\],]\", \"\"));\n }\n\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i++) nums[i] = scanner.nextInt();
bubbleSort(n, nums);
}
private static void bubbleSort(int n, int[] a) {
boolean flg = true;
int i = 0;
int sw = 0;
while (flg) {
flg = false;
for (int j = n - 1; j > i; j--) {
if (a[j] < a[j-1]) {
int w = a[j];
a[j] = a[j-1];
a[j-1] = w;
sw++;
flg = true;
}
}
i++;
}
trace(a);
System.out.println(sw);
}
private static void trace(int[] nums) {
System.out.println(Arrays.toString(nums).replaceAll("[\\[\\],]", ""));
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
4,
18,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
41,
13,
11,
1,
41,
13,
17,
13,
30,
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,
4,
13,
13,
13,
4,
18,
13,
4,
18,
13,
4,
18,
13,
13,
4,
18,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
13,
17,
4,
18,
13,
18,
13,
13,
4,
18,
13,
13,
23,
13,
23,
13,
12,
13,
30,
4,
18,
20,
23,
13,
6,
13,
41,
13,
20,
12,
13,
30,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
41,
13,
20,
13,
41,
13,
17,
28,
13,
4,
18,
4,
18,
13,
17,
30,
30,
0,
18,
13,
40,
13,
4,
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
],
[
225,
14
],
[
225,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
225,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
22,
26
],
[
26,
27
],
[
26,
28
],
[
22,
29
],
[
29,
30
],
[
29,
31
],
[
22,
32
],
[
32,
33
],
[
32,
34
],
[
22,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
22,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
42,
45
],
[
22,
46
],
[
46,
47
],
[
22,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
48,
54
],
[
55,
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
],
[
22,
111
],
[
111,
112
],
[
111,
113
],
[
111,
114
],
[
22,
115
],
[
115,
116
],
[
116,
117
],
[
115,
118
],
[
118,
119
],
[
119,
120
],
[
22,
121
],
[
121,
122
],
[
122,
123
],
[
121,
124
],
[
22,
125
],
[
125,
126
],
[
126,
127
],
[
225,
128
],
[
128,
129
],
[
128,
130
],
[
130,
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
],
[
147,
149
],
[
146,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
145,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
157,
158
],
[
157,
159
],
[
130,
160
],
[
160,
161
],
[
161,
162
],
[
160,
163
],
[
128,
164
],
[
164,
165
],
[
128,
166
],
[
166,
167
],
[
225,
168
],
[
168,
169
],
[
168,
170
],
[
170,
171
],
[
171,
172
],
[
172,
173
],
[
168,
174
],
[
174,
175
],
[
0,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
178,
180
],
[
176,
181
],
[
181,
182
],
[
181,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
185,
188
],
[
188,
189
],
[
189,
190
],
[
176,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
193,
198
],
[
198,
199
],
[
198,
200
],
[
193,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
204,
205
],
[
205,
206
],
[
206,
207
],
[
203,
208
],
[
201,
209
],
[
210,
210
],
[
210,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
214,
215
],
[
211,
216
],
[
216,
217
],
[
217,
218
],
[
216,
219
],
[
193,
220
],
[
220,
221
],
[
191,
222
],
[
222,
223
],
[
0,
224
],
[
224,
225
],
[
224,
226
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\n \npublic class Main {\n private static final String CRLF = System.lineSeparator();\n public void exec() throws IOException {\n \tSimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder();\n int count=0;\n int N = in.readInt();\n int[] A = in.readIntArray(N);\n int tmp;\n for(boolean flag=true;flag;){\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }\n intArrayToString(A,sb);\n out.print(sb.toString());\n out.println(count);\n out.flush();\n }\n \n private void intArrayToString(int[] a, StringBuilder sb) {\n for(int i=0; i<a.length; i++) {\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }\n sb.append(CRLF);\n }\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n}\n\nclass SimpleInputUtil {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n public int readInt() throws NumberFormatException, IOException{\n \treturn Integer.parseInt(br.readLine());\n }\n public int[] readIntArray(int len) throws NumberFormatException, IOException{\n int[] a = new int[len];\n int i=0;\n for(String s: br.readLine().split(\" \")){\n a[i++] = Integer.parseInt(s);\n }\n return a;\n }\n \n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"public class Main {\n private static final String CRLF = System.lineSeparator();\n public void exec() throws IOException {\n \tSimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder();\n int count=0;\n int N = in.readInt();\n int[] A = in.readIntArray(N);\n int tmp;\n for(boolean flag=true;flag;){\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }\n intArrayToString(A,sb);\n out.print(sb.toString());\n out.println(count);\n out.flush();\n }\n \n private void intArrayToString(int[] a, StringBuilder sb) {\n for(int i=0; i<a.length; i++) {\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }\n sb.append(CRLF);\n }\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n}",
"Main",
"private static final String CRLF = System.lineSeparator();",
"CRLF",
"System.lineSeparator()",
"System.lineSeparator",
"System",
"public void exec() throws IOException {\n \tSimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder();\n int count=0;\n int N = in.readInt();\n int[] A = in.readIntArray(N);\n int tmp;\n for(boolean flag=true;flag;){\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }\n intArrayToString(A,sb);\n out.print(sb.toString());\n out.println(count);\n out.flush();\n }",
"exec",
"{\n \tSimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder();\n int count=0;\n int N = in.readInt();\n int[] A = in.readIntArray(N);\n int tmp;\n for(boolean flag=true;flag;){\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }\n intArrayToString(A,sb);\n out.print(sb.toString());\n out.println(count);\n out.flush();\n }",
"SimpleInputUtil in = new SimpleInputUtil();",
"in",
"new SimpleInputUtil()",
"PrintWriter out = new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int count=0;",
"count",
"0",
"int N = in.readInt();",
"N",
"in.readInt()",
"in.readInt",
"in",
"int[] A = in.readIntArray(N);",
"A",
"in.readIntArray(N)",
"in.readIntArray",
"in",
"N",
"int tmp;",
"tmp",
"for(boolean flag=true;flag;){\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }",
"boolean flag=true;",
"boolean flag=true;",
"flag",
"true",
"flag",
"{\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }",
"{\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }",
"flag=false",
"flag",
"false",
"for(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}",
"int j=N-1;",
"int j=N-1;",
"j",
"N-1",
"N",
"1",
"j>=1",
"j",
"1",
"j--",
"j--",
"j",
"{\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}",
"{\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \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\tcount++;\n \t\t\tflag=true;\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\tcount++;\n \t\t\tflag=true;\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",
"count++",
"count",
"flag=true",
"flag",
"true",
"intArrayToString(A,sb)",
"intArrayToString",
"A",
"sb",
"out.print(sb.toString())",
"out.print",
"out",
"sb.toString()",
"sb.toString",
"sb",
"out.println(count)",
"out.println",
"out",
"count",
"out.flush()",
"out.flush",
"out",
"private void intArrayToString(int[] a, StringBuilder sb) {\n for(int i=0; i<a.length; i++) {\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }\n sb.append(CRLF);\n }",
"intArrayToString",
"{\n for(int i=0; i<a.length; i++) {\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }\n sb.append(CRLF);\n }",
"for(int i=0; i<a.length; i++) {\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }",
"{\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }",
"if (i>0)\n sb.append(\" \");",
"i>0",
"i",
"0",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"sb.append(a[i])",
"sb.append",
"sb",
"a[i]",
"a",
"i",
"sb.append(CRLF)",
"sb.append",
"sb",
"CRLF",
"int[] a",
"a",
"StringBuilder sb",
"sb",
"public static void main(String[] args) throws IOException {\n new Main().exec();\n }",
"main",
"{\n new Main().exec();\n }",
"new Main().exec()",
"new Main().exec",
"new Main()",
"String[] args",
"args",
"class SimpleInputUtil {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n public int readInt() throws NumberFormatException, IOException{\n \treturn Integer.parseInt(br.readLine());\n }\n public int[] readIntArray(int len) throws NumberFormatException, IOException{\n int[] a = new int[len];\n int i=0;\n for(String s: br.readLine().split(\" \")){\n a[i++] = Integer.parseInt(s);\n }\n return a;\n }\n \n}",
"SimpleInputUtil",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"public int readInt() throws NumberFormatException, IOException{\n \treturn Integer.parseInt(br.readLine());\n }",
"readInt",
"{\n \treturn Integer.parseInt(br.readLine());\n }",
"return Integer.parseInt(br.readLine());",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"public int[] readIntArray(int len) throws NumberFormatException, IOException{\n int[] a = new int[len];\n int i=0;\n for(String s: br.readLine().split(\" \")){\n a[i++] = Integer.parseInt(s);\n }\n return a;\n }",
"readIntArray",
"{\n int[] a = new int[len];\n int i=0;\n for(String s: br.readLine().split(\" \")){\n a[i++] = Integer.parseInt(s);\n }\n return a;\n }",
"int[] a = new int[len];",
"a",
"new int[len]",
"len",
"int i=0;",
"i",
"0",
"for(String s: br.readLine().split(\" \")){\n a[i++] = Integer.parseInt(s);\n }",
"String s",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"{\n a[i++] = Integer.parseInt(s);\n }",
"{\n a[i++] = Integer.parseInt(s);\n }",
"a[i++] = Integer.parseInt(s)",
"a[i++]",
"a",
"i++",
"i",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"return a;",
"a",
"int len",
"len",
"public class Main {\n private static final String CRLF = System.lineSeparator();\n public void exec() throws IOException {\n \tSimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder();\n int count=0;\n int N = in.readInt();\n int[] A = in.readIntArray(N);\n int tmp;\n for(boolean flag=true;flag;){\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }\n intArrayToString(A,sb);\n out.print(sb.toString());\n out.println(count);\n out.flush();\n }\n \n private void intArrayToString(int[] a, StringBuilder sb) {\n for(int i=0; i<a.length; i++) {\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }\n sb.append(CRLF);\n }\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n}",
"public class Main {\n private static final String CRLF = System.lineSeparator();\n public void exec() throws IOException {\n \tSimpleInputUtil in = new SimpleInputUtil();\n PrintWriter out = new PrintWriter(System.out);\n StringBuilder sb = new StringBuilder();\n int count=0;\n int N = in.readInt();\n int[] A = in.readIntArray(N);\n int tmp;\n for(boolean flag=true;flag;){\n \tflag=false;\n \tfor(int j=N-1;j>=1;j--){\n \t\tif(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\tcount++;\n \t\t\tflag=true;\n \t\t}\n \t}\n }\n intArrayToString(A,sb);\n out.print(sb.toString());\n out.println(count);\n out.flush();\n }\n \n private void intArrayToString(int[] a, StringBuilder sb) {\n for(int i=0; i<a.length; i++) {\n if (i>0)\n sb.append(\" \");\n sb.append(a[i]);\n }\n sb.append(CRLF);\n }\n \n public static void main(String[] args) throws IOException {\n new Main().exec();\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
private static final String CRLF = System.lineSeparator();
public void exec() throws IOException {
SimpleInputUtil in = new SimpleInputUtil();
PrintWriter out = new PrintWriter(System.out);
StringBuilder sb = new StringBuilder();
int count=0;
int N = in.readInt();
int[] A = in.readIntArray(N);
int tmp;
for(boolean flag=true;flag;){
flag=false;
for(int j=N-1;j>=1;j--){
if(A[j] < A[j-1]){
tmp = A[j];
A[j] = A[j-1];
A[j-1] = tmp;
count++;
flag=true;
}
}
}
intArrayToString(A,sb);
out.print(sb.toString());
out.println(count);
out.flush();
}
private void intArrayToString(int[] a, StringBuilder sb) {
for(int i=0; i<a.length; i++) {
if (i>0)
sb.append(" ");
sb.append(a[i]);
}
sb.append(CRLF);
}
public static void main(String[] args) throws IOException {
new Main().exec();
}
}
class SimpleInputUtil {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public int readInt() throws NumberFormatException, IOException{
return Integer.parseInt(br.readLine());
}
public int[] readIntArray(int len) throws NumberFormatException, IOException{
int[] a = new int[len];
int i=0;
for(String s: br.readLine().split(" ")){
a[i++] = Integer.parseInt(s);
}
return a;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
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,
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,
12,
13,
30,
41,
13,
20,
28,
13,
13,
30,
4,
18,
4,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
4,
18,
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
],
[
13,
14
],
[
6,
15
],
[
15,
16
],
[
159,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
26,
27
],
[
19,
28
],
[
28,
29
],
[
28,
30
],
[
19,
32
],
[
32,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
32,
37
],
[
37,
38
],
[
37,
39
],
[
32,
40
],
[
40,
41
],
[
41,
42
],
[
32,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
44,
48
],
[
48,
49
],
[
49,
50
],
[
19,
51
],
[
51,
52
],
[
51,
53
],
[
19,
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
],
[
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
],
[
19,
120
],
[
120,
121
],
[
120,
122
],
[
19,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
159,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
135,
137
],
[
135,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
141,
144
],
[
139,
145
],
[
131,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
129,
156
],
[
156,
157
],
[
0,
158
],
[
158,
159
],
[
158,
160
]
] | [
"import java.util.*;\n\npublic class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] xs = new int[n];\n for (int i = 0; i < n; i++) xs[i] = input.nextInt();\n \n // sort\n int count = 0;\n for (int i = 0; i < xs.length; i++) {\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }\n print(xs);\n System.out.println(count);\n }\n \n private void print(int[] xs) {\n StringBuilder sb = new StringBuilder();\n for (int x : xs) sb.append(x).append(' ');\n System.out.println(sb.toString().trim());\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] xs = new int[n];\n for (int i = 0; i < n; i++) xs[i] = input.nextInt();\n \n // sort\n int count = 0;\n for (int i = 0; i < xs.length; i++) {\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }\n print(xs);\n System.out.println(count);\n }\n \n private void print(int[] xs) {\n StringBuilder sb = new StringBuilder();\n for (int x : xs) sb.append(x).append(' ');\n System.out.println(sb.toString().trim());\n }\n}",
"Main",
"public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }",
"main",
"{\n Main main = new Main();\n main.solv();\n }",
"Main main = new Main();",
"main",
"new Main()",
"main.solv()",
"main.solv",
"main",
"String[] args",
"args",
"private void solv() {\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] xs = new int[n];\n for (int i = 0; i < n; i++) xs[i] = input.nextInt();\n \n // sort\n int count = 0;\n for (int i = 0; i < xs.length; i++) {\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }\n print(xs);\n System.out.println(count);\n }",
"solv",
"{\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] xs = new int[n];\n for (int i = 0; i < n; i++) xs[i] = input.nextInt();\n \n // sort\n int count = 0;\n for (int i = 0; i < xs.length; i++) {\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }\n print(xs);\n System.out.println(count);\n }",
"Scanner input = new Scanner(System.in);",
"input",
"new Scanner(System.in)",
"int n = input.nextInt();",
"n",
"input.nextInt()",
"input.nextInt",
"input",
"int[] xs = new int[n];",
"xs",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) xs[i] = input.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"xs[i] = input.nextInt();",
"xs[i] = input.nextInt()",
"xs[i]",
"xs",
"i",
"input.nextInt()",
"input.nextInt",
"input",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < xs.length; i++) {\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < xs.length",
"i",
"xs.length",
"xs",
"xs.length",
"i++",
"i++",
"i",
"{\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }",
"{\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }",
"for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }",
"int j = xs.length - 1;",
"int j = xs.length - 1;",
"j",
"xs.length - 1",
"xs.length",
"xs",
"xs.length",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }",
"{\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }",
"if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }",
"xs[j] < xs[j-1]",
"xs[j]",
"xs",
"j",
"xs[j-1]",
"xs",
"j-1",
"j",
"1",
"{\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }",
"int temp = xs[j];",
"temp",
"xs[j]",
"xs",
"j",
"xs[j] = xs[j-1]",
"xs[j]",
"xs",
"j",
"xs[j-1]",
"xs",
"j-1",
"j",
"1",
"xs[j-1] = temp",
"xs[j-1]",
"xs",
"j-1",
"j",
"1",
"temp",
"count++",
"count",
"print(xs)",
"print",
"xs",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"private void print(int[] xs) {\n StringBuilder sb = new StringBuilder();\n for (int x : xs) sb.append(x).append(' ');\n System.out.println(sb.toString().trim());\n }",
"print",
"{\n StringBuilder sb = new StringBuilder();\n for (int x : xs) sb.append(x).append(' ');\n System.out.println(sb.toString().trim());\n }",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (int x : xs) sb.append(x).append(' ');",
"int x",
"xs",
"sb.append(x).append(' ');",
"sb.append(x).append(' ')",
"sb.append(x).append",
"sb.append(x)",
"sb.append",
"sb",
"x",
"' '",
"System.out.println(sb.toString().trim())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString().trim()",
"sb.toString().trim",
"sb.toString()",
"sb.toString",
"sb",
"int[] xs",
"xs",
"public class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] xs = new int[n];\n for (int i = 0; i < n; i++) xs[i] = input.nextInt();\n \n // sort\n int count = 0;\n for (int i = 0; i < xs.length; i++) {\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }\n print(xs);\n System.out.println(count);\n }\n \n private void print(int[] xs) {\n StringBuilder sb = new StringBuilder();\n for (int x : xs) sb.append(x).append(' ');\n System.out.println(sb.toString().trim());\n }\n}",
"public class Main {\n \n public static void main(String[] args) {\n Main main = new Main();\n main.solv();\n }\n \n private void solv() {\n Scanner input = new Scanner(System.in);\n int n = input.nextInt();\n int[] xs = new int[n];\n for (int i = 0; i < n; i++) xs[i] = input.nextInt();\n \n // sort\n int count = 0;\n for (int i = 0; i < xs.length; i++) {\n for (int j = xs.length - 1; j > i; j--) {\n if (xs[j] < xs[j-1]) {\n int temp = xs[j];\n xs[j] = xs[j-1];\n xs[j-1] = temp;\n count++;\n }\n }\n }\n print(xs);\n System.out.println(count);\n }\n \n private void print(int[] xs) {\n StringBuilder sb = new StringBuilder();\n for (int x : xs) sb.append(x).append(' ');\n System.out.println(sb.toString().trim());\n }\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.solv();
}
private void solv() {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int[] xs = new int[n];
for (int i = 0; i < n; i++) xs[i] = input.nextInt();
// sort
int count = 0;
for (int i = 0; i < xs.length; i++) {
for (int j = xs.length - 1; j > i; j--) {
if (xs[j] < xs[j-1]) {
int temp = xs[j];
xs[j] = xs[j-1];
xs[j-1] = temp;
count++;
}
}
}
print(xs);
System.out.println(count);
}
private void print(int[] xs) {
StringBuilder sb = new StringBuilder();
for (int x : xs) sb.append(x).append(' ');
System.out.println(sb.toString().trim());
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
0,
13,
4,
18,
13,
41,
13,
4,
18,
13,
13,
0,
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,
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,
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,
30,
14,
2,
13,
2,
13,
17,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
4,
18,
13,
17,
30,
4,
18,
13,
4,
18,
13,
18,
13,
13,
4,
18,
13,
17,
4,
18,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
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
],
[
202,
8
],
[
202,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
24,
25
],
[
25,
26
],
[
24,
27
],
[
11,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
11,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
36,
37
],
[
35,
38
],
[
11,
39
],
[
39,
40
],
[
39,
41
],
[
11,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
43,
51
],
[
51,
52
],
[
52,
53
],
[
43,
54
],
[
55,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
60,
61
],
[
61,
62
],
[
60,
63
],
[
63,
64
],
[
63,
65
],
[
11,
66
],
[
66,
67
],
[
66,
68
],
[
11,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
69,
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
],
[
107,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
107,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
117,
123
],
[
123,
124
],
[
123,
125
],
[
107,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
11,
131
],
[
131,
132
],
[
131,
133
],
[
11,
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
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
147,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
154,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
160,
161
],
[
160,
162
],
[
153,
163
],
[
163,
164
],
[
164,
165
],
[
163,
166
],
[
147,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
168,
171
],
[
171,
172
],
[
172,
173
],
[
171,
174
],
[
174,
175
],
[
174,
176
],
[
11,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
11,
181
],
[
181,
182
],
[
182,
183
],
[
181,
184
],
[
184,
185
],
[
185,
186
],
[
184,
187
],
[
11,
188
],
[
188,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
188,
193
],
[
193,
194
],
[
194,
195
],
[
11,
196
],
[
196,
197
],
[
197,
198
],
[
9,
199
],
[
199,
200
],
[
0,
201
],
[
201,
202
],
[
201,
203
]
] | [
"import java.io.*;\nimport java.util.*;\n\n\n\npublic class Main{\n public static void main(String[] args)throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str;\n \n str = br.readLine();\n int N = Integer.parseInt(str);\n str = br.readLine();\n \n String[] strs = str.split(\"\\\\s\");\n int[] line = new int[N];\n for(int i=0;i<N;i++){\n line[i] = Integer.parseInt(strs[i]);\n }\n\n int ans =0;\n\n for(int i=0;i<N;i++){\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }\n\n StringBuilder sb = new StringBuilder();\n for(int i =0;i<N;i++){\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }\n sb.append(\"\\n\");\n sb.append(String.valueOf(ans));\n System.out.println(sb.toString());\n br.close();\n }\n\n \n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n public static void main(String[] args)throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str;\n \n str = br.readLine();\n int N = Integer.parseInt(str);\n str = br.readLine();\n \n String[] strs = str.split(\"\\\\s\");\n int[] line = new int[N];\n for(int i=0;i<N;i++){\n line[i] = Integer.parseInt(strs[i]);\n }\n\n int ans =0;\n\n for(int i=0;i<N;i++){\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }\n\n StringBuilder sb = new StringBuilder();\n for(int i =0;i<N;i++){\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }\n sb.append(\"\\n\");\n sb.append(String.valueOf(ans));\n System.out.println(sb.toString());\n br.close();\n }\n\n \n}",
"Main",
"public static void main(String[] args)throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str;\n \n str = br.readLine();\n int N = Integer.parseInt(str);\n str = br.readLine();\n \n String[] strs = str.split(\"\\\\s\");\n int[] line = new int[N];\n for(int i=0;i<N;i++){\n line[i] = Integer.parseInt(strs[i]);\n }\n\n int ans =0;\n\n for(int i=0;i<N;i++){\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }\n\n StringBuilder sb = new StringBuilder();\n for(int i =0;i<N;i++){\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }\n sb.append(\"\\n\");\n sb.append(String.valueOf(ans));\n System.out.println(sb.toString());\n br.close();\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str;\n \n str = br.readLine();\n int N = Integer.parseInt(str);\n str = br.readLine();\n \n String[] strs = str.split(\"\\\\s\");\n int[] line = new int[N];\n for(int i=0;i<N;i++){\n line[i] = Integer.parseInt(strs[i]);\n }\n\n int ans =0;\n\n for(int i=0;i<N;i++){\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }\n\n StringBuilder sb = new StringBuilder();\n for(int i =0;i<N;i++){\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }\n sb.append(\"\\n\");\n sb.append(String.valueOf(ans));\n System.out.println(sb.toString());\n br.close();\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String str;",
"str",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"int N = Integer.parseInt(str);",
"N",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"str = br.readLine()",
"str",
"br.readLine()",
"br.readLine",
"br",
"String[] strs = str.split(\"\\\\s\");",
"strs",
"str.split(\"\\\\s\")",
"str.split",
"str",
"\"\\\\s\"",
"int[] line = new int[N];",
"line",
"new int[N]",
"N",
"for(int i=0;i<N;i++){\n line[i] = Integer.parseInt(strs[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n line[i] = Integer.parseInt(strs[i]);\n }",
"{\n line[i] = Integer.parseInt(strs[i]);\n }",
"line[i] = Integer.parseInt(strs[i])",
"line[i]",
"line",
"i",
"Integer.parseInt(strs[i])",
"Integer.parseInt",
"Integer",
"strs[i]",
"strs",
"i",
"int ans =0;",
"ans",
"0",
"for(int i=0;i<N;i++){\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\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 >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }",
"{\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }",
"for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }",
"int j = N-1;",
"int j = N-1;",
"j",
"N-1",
"N",
"1",
"j >= 1",
"j",
"1",
"j--",
"j--",
"j",
"{\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }",
"{\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }",
"if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }",
"line[j] < line[j -1]",
"line[j]",
"line",
"j",
"line[j -1]",
"line",
"j -1",
"j",
"1",
"{\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }",
"ans++",
"ans",
"int temp = line[j-1];",
"temp",
"line[j-1]",
"line",
"j-1",
"j",
"1",
"line[j -1] = line[j]",
"line[j -1]",
"line",
"j -1",
"j",
"1",
"line[j]",
"line",
"j",
"line[j] = temp",
"line[j]",
"line",
"j",
"temp",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for(int i =0;i<N;i++){\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }",
"{\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }",
"if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }",
"i != N -1",
"i",
"N -1",
"N",
"1",
"{\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }",
"sb.append(String.valueOf(line[i]))",
"sb.append",
"sb",
"String.valueOf(line[i])",
"String.valueOf",
"String",
"line[i]",
"line",
"i",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"{\n sb.append(String.valueOf(line[i]));\n }",
"sb.append(String.valueOf(line[i]))",
"sb.append",
"sb",
"String.valueOf(line[i])",
"String.valueOf",
"String",
"line[i]",
"line",
"i",
"sb.append(\"\\n\")",
"sb.append",
"sb",
"\"\\n\"",
"sb.append(String.valueOf(ans))",
"sb.append",
"sb",
"String.valueOf(ans)",
"String.valueOf",
"String",
"ans",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"br.close()",
"br.close",
"br",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args)throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str;\n \n str = br.readLine();\n int N = Integer.parseInt(str);\n str = br.readLine();\n \n String[] strs = str.split(\"\\\\s\");\n int[] line = new int[N];\n for(int i=0;i<N;i++){\n line[i] = Integer.parseInt(strs[i]);\n }\n\n int ans =0;\n\n for(int i=0;i<N;i++){\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }\n\n StringBuilder sb = new StringBuilder();\n for(int i =0;i<N;i++){\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }\n sb.append(\"\\n\");\n sb.append(String.valueOf(ans));\n System.out.println(sb.toString());\n br.close();\n }\n\n \n}",
"public class Main{\n public static void main(String[] args)throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n String str;\n \n str = br.readLine();\n int N = Integer.parseInt(str);\n str = br.readLine();\n \n String[] strs = str.split(\"\\\\s\");\n int[] line = new int[N];\n for(int i=0;i<N;i++){\n line[i] = Integer.parseInt(strs[i]);\n }\n\n int ans =0;\n\n for(int i=0;i<N;i++){\n for(int j = N-1;j >= 1; j--){\n if(line[j] < line[j -1]){\n ans++;\n int temp = line[j-1];\n line[j -1] = line[j];\n line[j] = temp;\n }\n }\n }\n\n StringBuilder sb = new StringBuilder();\n for(int i =0;i<N;i++){\n if(i != N -1){\n sb.append(String.valueOf(line[i]));\n sb.append(\" \");\n }else{\n sb.append(String.valueOf(line[i]));\n }\n }\n sb.append(\"\\n\");\n sb.append(String.valueOf(ans));\n System.out.println(sb.toString());\n br.close();\n }\n\n \n}",
"Main"
] | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str;
str = br.readLine();
int N = Integer.parseInt(str);
str = br.readLine();
String[] strs = str.split("\\s");
int[] line = new int[N];
for(int i=0;i<N;i++){
line[i] = Integer.parseInt(strs[i]);
}
int ans =0;
for(int i=0;i<N;i++){
for(int j = N-1;j >= 1; j--){
if(line[j] < line[j -1]){
ans++;
int temp = line[j-1];
line[j -1] = line[j];
line[j] = temp;
}
}
}
StringBuilder sb = new StringBuilder();
for(int i =0;i<N;i++){
if(i != N -1){
sb.append(String.valueOf(line[i]));
sb.append(" ");
}else{
sb.append(String.valueOf(line[i]));
}
}
sb.append("\n");
sb.append(String.valueOf(ans));
System.out.println(sb.toString());
br.close();
}
}
|
[
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,
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,
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,
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
],
[
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
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
47,
52
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
47,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
61,
68
],
[
68,
69
],
[
68,
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
],
[
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
],
[
110,
112
],
[
88,
113
],
[
113,
114
],
[
8,
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
],
[
136,
138
],
[
135,
139
],
[
8,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
145,
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;\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\t\n\t\tint[] a = new int [100];\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 sw = 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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i1 = 0; i1 < N - 1; i1++) {\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}\n\t\tSystem.out.println(a[N-1]);\n\t\tSystem.out.println(sw);\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\t\n\t\tint[] a = new int [100];\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 sw = 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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i1 = 0; i1 < N - 1; i1++) {\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}\n\t\tSystem.out.println(a[N-1]);\n\t\tSystem.out.println(sw);\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\t\n\t\tint[] a = new int [100];\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 sw = 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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i1 = 0; i1 < N - 1; i1++) {\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}\n\t\tSystem.out.println(a[N-1]);\n\t\tSystem.out.println(sw);\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\t\n\t\tint[] a = new int [100];\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 sw = 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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i1 = 0; i1 < N - 1; i1++) {\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}\n\t\tSystem.out.println(a[N-1]);\n\t\tSystem.out.println(sw);\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 [100];",
"a",
"new int [100]",
"100",
"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 sw = 0;",
"sw",
"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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\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-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}\n\t\t\t}",
"if(a[j] < a[j-1]) {\n\t\t\t\t\tint temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\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-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}",
"int temp = a[j-1];",
"temp",
"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] = temp",
"a[j]",
"a",
"j",
"temp",
"flag = true",
"flag",
"true",
"sw++",
"sw",
"for (int i1 = 0; i1 < N - 1; i1++) {\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}",
"int i1 = 0;",
"int i1 = 0;",
"i1",
"0",
"i1 < N - 1",
"i1",
"N - 1",
"N",
"1",
"i1++",
"i1++",
"i1",
"{\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}",
"System.out.print(a[i1] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i1] + \" \"",
"a[i1]",
"a",
"i1",
"\" \"",
"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(sw)",
"System.out.println",
"System.out",
"System",
"System.out",
"sw",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\t\n\t\tint[] a = new int [100];\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 sw = 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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i1 = 0; i1 < N - 1; i1++) {\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}\n\t\tSystem.out.println(a[N-1]);\n\t\tSystem.out.println(sw);\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\t\n\t\tint[] a = new int [100];\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 sw = 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 temp = a[j-1];\n\t\t\t\t\ta[j-1] = a[j];\n\t\t\t\t\ta[j] = temp;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tsw++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor (int i1 = 0; i1 < N - 1; i1++) {\n\t\t\tSystem.out.print(a[i1] + \" \");\n\t\t}\n\t\tSystem.out.println(a[N-1]);\n\t\tSystem.out.println(sw);\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[] a = new int [100];
for(int i = 0; i < N; i++) {
a[i] = sc.nextInt();
}
int sw = 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 temp = a[j-1];
a[j-1] = a[j];
a[j] = temp;
flag = true;
sw++;
}
}
}
for (int i1 = 0; i1 < N - 1; i1++) {
System.out.print(a[i1] + " ");
}
System.out.println(a[N-1]);
System.out.println(sw);
}
}
|
[
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,
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,
30,
4,
18,
18,
13,
13,
17,
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,
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,
29,
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
],
[
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
],
[
61,
66
],
[
66,
67
],
[
66,
68
],
[
60,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
69,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
8,
91
],
[
91,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
91,
96
],
[
6,
97
],
[
97,
98
],
[
176,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
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
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
120,
129
],
[
129,
130
],
[
129,
131
],
[
120,
132
],
[
132,
133
],
[
133,
134
],
[
120,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
138,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
137,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
150,
151
],
[
150,
152
],
[
147,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
147,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
165,
166
],
[
165,
167
],
[
162,
168
],
[
147,
169
],
[
169,
170
],
[
101,
171
],
[
171,
172
],
[
99,
173
],
[
173,
174
],
[
0,
175
],
[
175,
176
],
[
175,
177
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int[] a = new int[N];\n for (int i = 0; i < N; i++) {\n a[i] = scanner.nextInt();\n }\n int n = bubbleSort(a);\n for (int i = 0; i < a.length; i++) {\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }\n System.out.println(n);\n }\n\n private static int bubbleSort(int[] a) {\n int n = 0;\n for (int i = 0; i < a.length; i++) {\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }\n return n;\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int[] a = new int[N];\n for (int i = 0; i < N; i++) {\n a[i] = scanner.nextInt();\n }\n int n = bubbleSort(a);\n for (int i = 0; i < a.length; i++) {\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }\n System.out.println(n);\n }\n\n private static int bubbleSort(int[] a) {\n int n = 0;\n for (int i = 0; i < a.length; i++) {\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }\n return n;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int[] a = new int[N];\n for (int i = 0; i < N; i++) {\n a[i] = scanner.nextInt();\n }\n int n = bubbleSort(a);\n for (int i = 0; i < a.length; i++) {\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }\n System.out.println(n);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int[] a = new int[N];\n for (int i = 0; i < N; i++) {\n a[i] = scanner.nextInt();\n }\n int n = bubbleSort(a);\n for (int i = 0; i < a.length; i++) {\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }\n System.out.println(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 < N; i++) {\n a[i] = scanner.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n a[i] = scanner.nextInt();\n }",
"{\n a[i] = scanner.nextInt();\n }",
"a[i] = scanner.nextInt()",
"a[i]",
"a",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int n = bubbleSort(a);",
"n",
"bubbleSort(a)",
"bubbleSort",
"a",
"for (int i = 0; i < a.length; i++) {\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }",
"{\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }",
"System.out.print(a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"a[i]",
"a",
"i",
"if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }",
"i < a.length - 1",
"i",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"{\n System.out.print(\" \");\n }",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"{\n System.out.println(\"\");\n }",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(n)",
"System.out.println",
"System.out",
"System",
"System.out",
"n",
"String[] args",
"args",
"private static int bubbleSort(int[] a) {\n int n = 0;\n for (int i = 0; i < a.length; i++) {\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }\n return n;\n }",
"bubbleSort",
"{\n int n = 0;\n for (int i = 0; i < a.length; i++) {\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }\n return n;\n }",
"int n = 0;",
"n",
"0",
"for (int i = 0; i < a.length; i++) {\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\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] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }",
"{\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }",
"for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\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] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }",
"{\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }",
"if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }",
"a[j] < a[j - 1]",
"a[j]",
"a",
"j",
"a[j - 1]",
"a",
"j - 1",
"j",
"1",
"{\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }",
"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",
"n++",
"n",
"return n;",
"n",
"int[] a",
"a",
"public class Main {\n public static void main(String[] args) {\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n int[] a = new int[N];\n for (int i = 0; i < N; i++) {\n a[i] = scanner.nextInt();\n }\n int n = bubbleSort(a);\n for (int i = 0; i < a.length; i++) {\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }\n System.out.println(n);\n }\n\n private static int bubbleSort(int[] a) {\n int n = 0;\n for (int i = 0; i < a.length; i++) {\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }\n return n;\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 int[] a = new int[N];\n for (int i = 0; i < N; i++) {\n a[i] = scanner.nextInt();\n }\n int n = bubbleSort(a);\n for (int i = 0; i < a.length; i++) {\n System.out.print(a[i]);\n if (i < a.length - 1) {\n System.out.print(\" \");\n } else {\n System.out.println(\"\");\n }\n }\n System.out.println(n);\n }\n\n private static int bubbleSort(int[] a) {\n int n = 0;\n for (int i = 0; i < a.length; i++) {\n for (int j = a.length - 1; j > i; j--) {\n if (a[j] < a[j - 1]) {\n int t = a[j];\n a[j] = a[j - 1];\n a[j - 1] = t;\n n++;\n }\n }\n }\n return n;\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 < N; i++) {
a[i] = scanner.nextInt();
}
int n = bubbleSort(a);
for (int i = 0; i < a.length; i++) {
System.out.print(a[i]);
if (i < a.length - 1) {
System.out.print(" ");
} else {
System.out.println("");
}
}
System.out.println(n);
}
private static int bubbleSort(int[] a) {
int n = 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 t = a[j];
a[j] = a[j - 1];
a[j - 1] = t;
n++;
}
}
}
return n;
}
} |
[
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,
2,
13,
17,
30,
0,
13,
17,
14,
2,
18,
13,
13,
17,
30,
11,
1,
41,
13,
17,
2,
13,
18,
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,
0,
13,
17,
40,
13,
4,
18,
20,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
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,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
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
],
[
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
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
55,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
62,
67
],
[
67,
68
],
[
67,
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
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
84,
85
],
[
84,
86
],
[
77,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
101,
103
],
[
87,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
87,
109
],
[
109,
110
],
[
109,
111
],
[
87,
112
],
[
112,
113
],
[
8,
114
],
[
114,
115
],
[
115,
116
],
[
114,
117
],
[
8,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
6,
124
],
[
124,
125
],
[
175,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
129,
142
],
[
143,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
158,
160
],
[
144,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
126,
172
],
[
172,
173
],
[
0,
174
],
[
174,
175
],
[
174,
176
]
] | [
"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\tint len = scanner.nextInt();\n\t\tint nums[] = new int[len];\n\t\tint counts = 0;\n\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}\n\t\tint flag = 1;\n\t\twhile (flag == 1) {\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnew Main().arrayToString(nums);\n\t\tSystem.out.println(counts);\n\t}\n\n\tpublic void arrayToString(int[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++) {\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}\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\tint len = scanner.nextInt();\n\t\tint nums[] = new int[len];\n\t\tint counts = 0;\n\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}\n\t\tint flag = 1;\n\t\twhile (flag == 1) {\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnew Main().arrayToString(nums);\n\t\tSystem.out.println(counts);\n\t}\n\n\tpublic void arrayToString(int[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++) {\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint len = scanner.nextInt();\n\t\tint nums[] = new int[len];\n\t\tint counts = 0;\n\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}\n\t\tint flag = 1;\n\t\twhile (flag == 1) {\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnew Main().arrayToString(nums);\n\t\tSystem.out.println(counts);\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint len = scanner.nextInt();\n\t\tint nums[] = new int[len];\n\t\tint counts = 0;\n\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}\n\t\tint flag = 1;\n\t\twhile (flag == 1) {\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnew Main().arrayToString(nums);\n\t\tSystem.out.println(counts);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int len = scanner.nextInt();",
"len",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int nums[] = new int[len];",
"nums",
"new int[len]",
"len",
"int counts = 0;",
"counts",
"0",
"for (int i = 0; i < len; i++) {\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < len",
"i",
"len",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}",
"nums[i] = scanner.nextInt()",
"nums[i]",
"nums",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int flag = 1;",
"flag",
"1",
"while (flag == 1) {\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag == 1",
"flag",
"1",
"{\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flag = 0",
"flag",
"0",
"if (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"nums.length > 1",
"nums.length",
"nums",
"nums.length",
"1",
"{\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < nums.length",
"i",
"nums.length",
"nums",
"nums.length",
"i++",
"i++",
"i",
"{\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}",
"if (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}",
"nums[i-1] > nums[i]",
"nums[i-1]",
"nums",
"i-1",
"i",
"1",
"nums[i]",
"nums",
"i",
"{\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}",
"int tmp = nums[i-1];",
"tmp",
"nums[i-1]",
"nums",
"i-1",
"i",
"1",
"nums[i-1] = nums[i]",
"nums[i-1]",
"nums",
"i-1",
"i",
"1",
"nums[i]",
"nums",
"i",
"nums[i] = tmp",
"nums[i]",
"nums",
"i",
"tmp",
"flag = 1",
"flag",
"1",
"counts++",
"counts",
"new Main().arrayToString(nums)",
"new Main().arrayToString",
"new Main()",
"nums",
"System.out.println(counts)",
"System.out.println",
"System.out",
"System",
"System.out",
"counts",
"String[] args",
"args",
"public void arrayToString(int[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++) {\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}\n\t}",
"arrayToString",
"{\n\t\tfor (int i = 0; i < arr.length; i++) {\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}\n\t}",
"for (int i = 0; i < arr.length; i++) {\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}",
"{\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}",
"if (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}",
"i == arr.length - 1",
"i",
"arr.length - 1",
"arr.length",
"arr",
"arr.length",
"1",
"{\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t}",
"System.out.println(arr[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"arr[i]",
"arr",
"i",
"{\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}",
"System.out.print(arr[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"arr[i] + \" \"",
"arr[i]",
"arr",
"i",
"\" \"",
"int[] arr",
"arr",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint len = scanner.nextInt();\n\t\tint nums[] = new int[len];\n\t\tint counts = 0;\n\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}\n\t\tint flag = 1;\n\t\twhile (flag == 1) {\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnew Main().arrayToString(nums);\n\t\tSystem.out.println(counts);\n\t}\n\n\tpublic void arrayToString(int[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++) {\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}\n\t}\n\n}",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint len = scanner.nextInt();\n\t\tint nums[] = new int[len];\n\t\tint counts = 0;\n\n\t\tfor (int i = 0; i < len; i++) {\n\t\t\tnums[i] = scanner.nextInt();\n\t\t}\n\t\tint flag = 1;\n\t\twhile (flag == 1) {\n\t\t\tflag = 0;\n\t\t\tif (nums.length > 1) {\n\t\t\t\tfor (int i = 1; i < nums.length; i++) {\n\t\t\t\t\tif (nums[i-1] > nums[i]) {\n\t\t\t\t\t\tint tmp = nums[i-1];\n\t\t\t\t\t\tnums[i-1] = nums[i];\n\t\t\t\t\t\tnums[i] = tmp;\n\t\t\t\t\t\tflag = 1;\n\t\t\t\t\t\tcounts++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnew Main().arrayToString(nums);\n\t\tSystem.out.println(counts);\n\t}\n\n\tpublic void arrayToString(int[] arr) {\n\t\tfor (int i = 0; i < arr.length; i++) {\n\n\t\t\tif (i == arr.length - 1) {\n\t\t\t\tSystem.out.println(arr[i]);\n\t\t\t} else {\n\t\t\t\tSystem.out.print(arr[i] + \" \");\n\t\t\t}\n\t\t}\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int len = scanner.nextInt();
int nums[] = new int[len];
int counts = 0;
for (int i = 0; i < len; i++) {
nums[i] = scanner.nextInt();
}
int flag = 1;
while (flag == 1) {
flag = 0;
if (nums.length > 1) {
for (int i = 1; i < nums.length; i++) {
if (nums[i-1] > nums[i]) {
int tmp = nums[i-1];
nums[i-1] = nums[i];
nums[i] = tmp;
flag = 1;
counts++;
}
}
}
}
new Main().arrayToString(nums);
System.out.println(counts);
}
public void arrayToString(int[] arr) {
for (int i = 0; i < arr.length; i++) {
if (i == arr.length - 1) {
System.out.println(arr[i]);
} else {
System.out.print(arr[i] + " ");
}
}
}
}
|
[
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,
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,
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,
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,
17,
2,
4,
18,
13,
17,
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,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
197,
11
],
[
197,
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
],
[
28,
34
],
[
14,
35
],
[
35,
36
],
[
35,
37
],
[
14,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
39,
44
],
[
44,
45
],
[
44,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
39,
50
],
[
51,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
52,
56
],
[
56,
57
],
[
57,
58
],
[
56,
59
],
[
59,
60
],
[
59,
61
],
[
14,
62
],
[
62,
63
],
[
62,
64
],
[
62,
65
],
[
12,
66
],
[
66,
67
],
[
197,
68
],
[
68,
69
],
[
68,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
74,
76
],
[
70,
77
],
[
77,
78
],
[
77,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
79,
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
],
[
109,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
108,
118
],
[
118,
119
],
[
118,
120
],
[
70,
121
],
[
121,
122
],
[
121,
123
],
[
70,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
131,
133
],
[
124,
134
],
[
134,
135
],
[
135,
136
],
[
124,
137
],
[
138,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
70,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
152,
153
],
[
151,
154
],
[
151,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
155,
159
],
[
70,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
160,
165
],
[
68,
166
],
[
166,
167
],
[
68,
168
],
[
168,
169
],
[
197,
170
],
[
170,
171
],
[
170,
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
],
[
172,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
185,
189
],
[
170,
190
],
[
190,
191
],
[
170,
192
],
[
192,
193
],
[
170,
194
],
[
194,
195
],
[
0,
196
],
[
196,
197
],
[
196,
198
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n/**\n * Created by hwzheng on 2017/3/27.\n */\npublic class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));\n int N = Integer.parseInt(Reader.readLine());\n String A[] = Reader.readLine().split(\" \",0);\n int[] arr = new int[N];\n for (int i=0; i < N; i++){\n arr[i] = Integer.parseInt(A[i]);\n }\n bubbleSort(arr,N);\n }\n\n private static void bubbleSort(int[] arr, int n) {\n boolean flag = true;\n int exCount = 0;\n while (flag){\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }\n String str = \"\";\n for (int i = 0; i < arr.length; i++){\n str += arr[i] + \" \";\n }\n System.out.println(str.substring(0,str.length()-1));\n System.out.println(exCount);\n }\n\n private static void exch(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.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));\n int N = Integer.parseInt(Reader.readLine());\n String A[] = Reader.readLine().split(\" \",0);\n int[] arr = new int[N];\n for (int i=0; i < N; i++){\n arr[i] = Integer.parseInt(A[i]);\n }\n bubbleSort(arr,N);\n }\n\n private static void bubbleSort(int[] arr, int n) {\n boolean flag = true;\n int exCount = 0;\n while (flag){\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }\n String str = \"\";\n for (int i = 0; i < arr.length; i++){\n str += arr[i] + \" \";\n }\n System.out.println(str.substring(0,str.length()-1));\n System.out.println(exCount);\n }\n\n private static void exch(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 Reader = new BufferedReader (new InputStreamReader(System.in));\n int N = Integer.parseInt(Reader.readLine());\n String A[] = Reader.readLine().split(\" \",0);\n int[] arr = new int[N];\n for (int i=0; i < N; i++){\n arr[i] = Integer.parseInt(A[i]);\n }\n bubbleSort(arr,N);\n }",
"main",
"{\n BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));\n int N = Integer.parseInt(Reader.readLine());\n String A[] = Reader.readLine().split(\" \",0);\n int[] arr = new int[N];\n for (int i=0; i < N; i++){\n arr[i] = Integer.parseInt(A[i]);\n }\n bubbleSort(arr,N);\n }",
"BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));",
"Reader",
"new BufferedReader (new InputStreamReader(System.in))",
"int N = Integer.parseInt(Reader.readLine());",
"N",
"Integer.parseInt(Reader.readLine())",
"Integer.parseInt",
"Integer",
"Reader.readLine()",
"Reader.readLine",
"Reader",
"String A[] = Reader.readLine().split(\" \",0);",
"A",
"Reader.readLine().split(\" \",0)",
"Reader.readLine().split",
"Reader.readLine()",
"Reader.readLine",
"Reader",
"\" \"",
"0",
"int[] arr = new int[N];",
"arr",
"new int[N]",
"N",
"for (int i=0; i < N; i++){\n arr[i] = Integer.parseInt(A[i]);\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n arr[i] = Integer.parseInt(A[i]);\n }",
"{\n arr[i] = Integer.parseInt(A[i]);\n }",
"arr[i] = Integer.parseInt(A[i])",
"arr[i]",
"arr",
"i",
"Integer.parseInt(A[i])",
"Integer.parseInt",
"Integer",
"A[i]",
"A",
"i",
"bubbleSort(arr,N)",
"bubbleSort",
"arr",
"N",
"String[] args",
"args",
"private static void bubbleSort(int[] arr, int n) {\n boolean flag = true;\n int exCount = 0;\n while (flag){\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }\n String str = \"\";\n for (int i = 0; i < arr.length; i++){\n str += arr[i] + \" \";\n }\n System.out.println(str.substring(0,str.length()-1));\n System.out.println(exCount);\n }",
"bubbleSort",
"{\n boolean flag = true;\n int exCount = 0;\n while (flag){\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }\n String str = \"\";\n for (int i = 0; i < arr.length; i++){\n str += arr[i] + \" \";\n }\n System.out.println(str.substring(0,str.length()-1));\n System.out.println(exCount);\n }",
"boolean flag = true;",
"flag",
"true",
"int exCount = 0;",
"exCount",
"0",
"while (flag){\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\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 (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }",
"{\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }",
"if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }",
"arr[i] < arr[i-1]",
"arr[i]",
"arr",
"i",
"arr[i-1]",
"arr",
"i-1",
"i",
"1",
"{\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }",
"exch(arr,i,i-1)",
"exch",
"arr",
"i",
"i-1",
"i",
"1",
"exCount++",
"exCount",
"flag = true",
"flag",
"true",
"String str = \"\";",
"str",
"\"\"",
"for (int i = 0; i < arr.length; i++){\n str += arr[i] + \" \";\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < arr.length",
"i",
"arr.length",
"arr",
"arr.length",
"i++",
"i++",
"i",
"{\n str += arr[i] + \" \";\n }",
"{\n str += arr[i] + \" \";\n }",
"str += arr[i] + \" \"",
"str",
"arr[i] + \" \"",
"arr[i]",
"arr",
"i",
"\" \"",
"System.out.println(str.substring(0,str.length()-1))",
"System.out.println",
"System.out",
"System",
"System.out",
"str.substring(0,str.length()-1)",
"str.substring",
"str",
"0",
"str.length()-1",
"str.length()",
"str.length",
"str",
"1",
"System.out.println(exCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"exCount",
"int[] arr",
"arr",
"int n",
"n",
"private static void exch(int[] arr, int i, int j){\n int tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }",
"exch",
"{\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 Reader = new BufferedReader (new InputStreamReader(System.in));\n int N = Integer.parseInt(Reader.readLine());\n String A[] = Reader.readLine().split(\" \",0);\n int[] arr = new int[N];\n for (int i=0; i < N; i++){\n arr[i] = Integer.parseInt(A[i]);\n }\n bubbleSort(arr,N);\n }\n\n private static void bubbleSort(int[] arr, int n) {\n boolean flag = true;\n int exCount = 0;\n while (flag){\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }\n String str = \"\";\n for (int i = 0; i < arr.length; i++){\n str += arr[i] + \" \";\n }\n System.out.println(str.substring(0,str.length()-1));\n System.out.println(exCount);\n }\n\n private static void exch(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 Reader = new BufferedReader (new InputStreamReader(System.in));\n int N = Integer.parseInt(Reader.readLine());\n String A[] = Reader.readLine().split(\" \",0);\n int[] arr = new int[N];\n for (int i=0; i < N; i++){\n arr[i] = Integer.parseInt(A[i]);\n }\n bubbleSort(arr,N);\n }\n\n private static void bubbleSort(int[] arr, int n) {\n boolean flag = true;\n int exCount = 0;\n while (flag){\n flag = false;\n for (int i = n - 1; i > 0; i--){\n if (arr[i] < arr[i-1]){\n exch(arr,i,i-1);\n exCount++;\n flag = true;\n }\n }\n }\n String str = \"\";\n for (int i = 0; i < arr.length; i++){\n str += arr[i] + \" \";\n }\n System.out.println(str.substring(0,str.length()-1));\n System.out.println(exCount);\n }\n\n private static void exch(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.IOException;
import java.io.InputStreamReader;
/**
* Created by hwzheng on 2017/3/27.
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));
int N = Integer.parseInt(Reader.readLine());
String A[] = Reader.readLine().split(" ",0);
int[] arr = new int[N];
for (int i=0; i < N; i++){
arr[i] = Integer.parseInt(A[i]);
}
bubbleSort(arr,N);
}
private static void bubbleSort(int[] arr, int n) {
boolean flag = true;
int exCount = 0;
while (flag){
flag = false;
for (int i = n - 1; i > 0; i--){
if (arr[i] < arr[i-1]){
exch(arr,i,i-1);
exCount++;
flag = true;
}
}
}
String str = "";
for (int i = 0; i < arr.length; i++){
str += arr[i] + " ";
}
System.out.println(str.substring(0,str.length()-1));
System.out.println(exCount);
}
private static void exch(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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
23,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
13,
18,
13,
13,
0,
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,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
41,
13,
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,
17,
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,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
4,
13,
13,
13,
13,
4,
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
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
9,
14
],
[
14,
15
],
[
14,
16
],
[
9,
17
],
[
17,
18
],
[
18,
19
],
[
9,
20
],
[
21,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
25,
26
],
[
25,
27
],
[
22,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
28,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
22,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
6,
46
],
[
46,
47
],
[
6,
48
],
[
48,
49
],
[
4,
50
],
[
50,
51
],
[
50,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
53,
61
],
[
61,
62
],
[
62,
63
],
[
53,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
71,
72
],
[
50,
73
],
[
73,
74
],
[
50,
75
],
[
75,
76
],
[
50,
77
],
[
77,
78
],
[
4,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
81,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
86,
97
],
[
98,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
98,
109
],
[
109,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
109,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
120,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
98,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
98,
138
],
[
138,
139
],
[
138,
140
],
[
138,
141
],
[
79,
142
],
[
142,
143
],
[
79,
144
],
[
144,
145
],
[
4,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
148,
152
],
[
152,
153
],
[
152,
154
],
[
148,
155
],
[
155,
156
],
[
148,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
157,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
169,
171
],
[
165,
172
],
[
172,
173
],
[
172,
174
],
[
165,
175
],
[
175,
176
],
[
176,
177
],
[
165,
178
],
[
179,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
181,
185
],
[
185,
186
],
[
185,
187
],
[
187,
188
],
[
187,
189
],
[
180,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
190,
194
],
[
194,
195
],
[
194,
196
],
[
196,
197
],
[
196,
198
],
[
190,
199
],
[
199,
200
],
[
200,
201
],
[
200,
202
],
[
199,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
205,
207
],
[
190,
208
],
[
208,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
211,
213
],
[
208,
214
],
[
190,
215
],
[
215,
216
],
[
215,
217
],
[
148,
218
],
[
218,
219
],
[
218,
220
],
[
218,
221
],
[
148,
222
],
[
222,
223
],
[
223,
224
],
[
224,
225
],
[
224,
226
],
[
222,
227
],
[
146,
228
],
[
228,
229
],
[
146,
230
],
[
230,
231
],
[
4,
232
],
[
232,
233
],
[
232,
234
],
[
234,
235
],
[
235,
236
],
[
235,
237
],
[
234,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
241,
242
],
[
234,
243
],
[
243,
244
],
[
243,
245
],
[
234,
247
],
[
247,
248
],
[
247,
249
],
[
247,
250
],
[
247,
251
],
[
234,
252
],
[
252,
253
],
[
252,
254
],
[
252,
255
],
[
232,
256
],
[
256,
257
]
] | [
"import java.util.Scanner;\nclass Main {\n\n\tpublic static void printArray(int[] a,int n){\n \tfor(int f=0;f<n;f++){\n \t\tif(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);\n \t}\n\t}\n\n\tpublic static void scanArray(int[] a,int n, Scanner s){\n \tfor(int i=0;i<n;i++){\n \t\ta[i] = s.nextInt();\n \t}\n\t}\n\n\tpublic static void insertSort(int[] a,int n){\n\t\tint v,j;\n \tfor(int i=1;i<n;i++){\n \t\tv=a[i];\n \t\tj=i-1;\n \t\twhile(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}\n \t\ta[j+1]=v;\n\n \t\tprintArray(a,n);\n \t}\n\t}\n\n\tpublic static void bubbleSort(int[] a,int n){\n\t\tint f = 1;\n\t\tint c = 0;\n\t\tint tmp;\n\t\twhile(f==1){\n\t\t\tf=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\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(a,n);\n\t\tSystem.out.println(c);\n\t}\n\n\n\tpublic static void main(String args[]) {\n \tScanner scan = new Scanner(System.in);\n \tint n = scan.nextInt();\n \tint a[] = new int[n];\n\n \tscanArray(a,n,scan);\n \t//printArray(a,n);\n \t//insertSort(a,n);\n \tbubbleSort(a,n);\n\n\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\n\tpublic static void printArray(int[] a,int n){\n \tfor(int f=0;f<n;f++){\n \t\tif(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);\n \t}\n\t}\n\n\tpublic static void scanArray(int[] a,int n, Scanner s){\n \tfor(int i=0;i<n;i++){\n \t\ta[i] = s.nextInt();\n \t}\n\t}\n\n\tpublic static void insertSort(int[] a,int n){\n\t\tint v,j;\n \tfor(int i=1;i<n;i++){\n \t\tv=a[i];\n \t\tj=i-1;\n \t\twhile(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}\n \t\ta[j+1]=v;\n\n \t\tprintArray(a,n);\n \t}\n\t}\n\n\tpublic static void bubbleSort(int[] a,int n){\n\t\tint f = 1;\n\t\tint c = 0;\n\t\tint tmp;\n\t\twhile(f==1){\n\t\t\tf=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\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(a,n);\n\t\tSystem.out.println(c);\n\t}\n\n\n\tpublic static void main(String args[]) {\n \tScanner scan = new Scanner(System.in);\n \tint n = scan.nextInt();\n \tint a[] = new int[n];\n\n \tscanArray(a,n,scan);\n \t//printArray(a,n);\n \t//insertSort(a,n);\n \tbubbleSort(a,n);\n\n\n }\n}",
"Main",
"public static void printArray(int[] a,int n){\n \tfor(int f=0;f<n;f++){\n \t\tif(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);\n \t}\n\t}",
"printArray",
"{\n \tfor(int f=0;f<n;f++){\n \t\tif(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);\n \t}\n\t}",
"for(int f=0;f<n;f++){\n \t\tif(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);\n \t}",
"int f=0;",
"int f=0;",
"f",
"0",
"f<n",
"f",
"n",
"f++",
"f++",
"f",
"{\n \t\tif(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);\n \t}",
"{\n \t\tif(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);\n \t}",
"if(f<n-1)System.out.print(a[f]+\" \");\n \t\telse System.out.println(a[f]);",
"f<n-1",
"f",
"n-1",
"n",
"1",
"System.out.print(a[f]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"a[f]+\" \"",
"a[f]",
"a",
"f",
"\" \"",
"System.out.println(a[f])",
"System.out.println",
"System.out",
"System",
"System.out",
"a[f]",
"a",
"f",
"int[] a",
"a",
"int n",
"n",
"public static void scanArray(int[] a,int n, Scanner s){\n \tfor(int i=0;i<n;i++){\n \t\ta[i] = s.nextInt();\n \t}\n\t}",
"scanArray",
"{\n \tfor(int i=0;i<n;i++){\n \t\ta[i] = s.nextInt();\n \t}\n\t}",
"for(int i=0;i<n;i++){\n \t\ta[i] = s.nextInt();\n \t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \t\ta[i] = s.nextInt();\n \t}",
"{\n \t\ta[i] = s.nextInt();\n \t}",
"a[i] = s.nextInt()",
"a[i]",
"a",
"i",
"s.nextInt()",
"s.nextInt",
"s",
"int[] a",
"a",
"int n",
"n",
"Scanner s",
"s",
"public static void insertSort(int[] a,int n){\n\t\tint v,j;\n \tfor(int i=1;i<n;i++){\n \t\tv=a[i];\n \t\tj=i-1;\n \t\twhile(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}\n \t\ta[j+1]=v;\n\n \t\tprintArray(a,n);\n \t}\n\t}",
"insertSort",
"{\n\t\tint v,j;\n \tfor(int i=1;i<n;i++){\n \t\tv=a[i];\n \t\tj=i-1;\n \t\twhile(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}\n \t\ta[j+1]=v;\n\n \t\tprintArray(a,n);\n \t}\n\t}",
"int v",
"v",
"j;",
"j",
"for(int i=1;i<n;i++){\n \t\tv=a[i];\n \t\tj=i-1;\n \t\twhile(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}\n \t\ta[j+1]=v;\n\n \t\tprintArray(a,n);\n \t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \t\tv=a[i];\n \t\tj=i-1;\n \t\twhile(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}\n \t\ta[j+1]=v;\n\n \t\tprintArray(a,n);\n \t}",
"{\n \t\tv=a[i];\n \t\tj=i-1;\n \t\twhile(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}\n \t\ta[j+1]=v;\n\n \t\tprintArray(a,n);\n \t}",
"v=a[i]",
"v",
"a[i]",
"a",
"i",
"j=i-1",
"j",
"i-1",
"i",
"1",
"while(j>=0 && a[j]>v){\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}",
"j>=0 && a[j]>v",
"j>=0",
"j",
"0",
"a[j]>v",
"a[j]",
"a",
"j",
"v",
"{\n \t\t\ta[j+1]=a[j];\n \t\t\tj--;\n \t\t}",
"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",
"printArray(a,n)",
"printArray",
"a",
"n",
"int[] a",
"a",
"int n",
"n",
"public static void bubbleSort(int[] a,int n){\n\t\tint f = 1;\n\t\tint c = 0;\n\t\tint tmp;\n\t\twhile(f==1){\n\t\t\tf=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\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(a,n);\n\t\tSystem.out.println(c);\n\t}",
"bubbleSort",
"{\n\t\tint f = 1;\n\t\tint c = 0;\n\t\tint tmp;\n\t\twhile(f==1){\n\t\t\tf=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\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(a,n);\n\t\tSystem.out.println(c);\n\t}",
"int f = 1;",
"f",
"1",
"int c = 0;",
"c",
"0",
"int tmp;",
"tmp",
"while(f==1){\n\t\t\tf=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\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"f==1",
"f",
"1",
"{\n\t\t\tf=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\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"f=0",
"f",
"0",
"for(int j=n-1;j>=1;j--){\n\t\t\t\tif(a[j]<a[j-1]){\n\t\t\t\t\tc+=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\tf=1;\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\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(a[j]<a[j-1]){\n\t\t\t\t\tc+=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\tf=1;\n\t\t\t\t}\n\t\t\t}",
"if(a[j]<a[j-1]){\n\t\t\t\t\tc+=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\tf=1;\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\tc+=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\tf=1;\n\t\t\t\t}",
"c+=1",
"c",
"1",
"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",
"f=1",
"f",
"1",
"printArray(a,n)",
"printArray",
"a",
"n",
"System.out.println(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"int[] a",
"a",
"int n",
"n",
"public static void main(String args[]) {\n \tScanner scan = new Scanner(System.in);\n \tint n = scan.nextInt();\n \tint a[] = new int[n];\n\n \tscanArray(a,n,scan);\n \t//printArray(a,n);\n \t//insertSort(a,n);\n \tbubbleSort(a,n);\n\n\n }",
"main",
"{\n \tScanner scan = new Scanner(System.in);\n \tint n = scan.nextInt();\n \tint a[] = new int[n];\n\n \tscanArray(a,n,scan);\n \t//printArray(a,n);\n \t//insertSort(a,n);\n \tbubbleSort(a,n);\n\n\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[n];",
"a",
"new int[n]",
"n",
"scanArray(a,n,scan)",
"scanArray",
"a",
"n",
"scan",
"bubbleSort(a,n)",
"bubbleSort",
"a",
"n",
"String args[]",
"args"
] | import java.util.Scanner;
class Main {
public static void printArray(int[] a,int n){
for(int f=0;f<n;f++){
if(f<n-1)System.out.print(a[f]+" ");
else System.out.println(a[f]);
}
}
public static void scanArray(int[] a,int n, Scanner s){
for(int i=0;i<n;i++){
a[i] = s.nextInt();
}
}
public static void insertSort(int[] a,int n){
int v,j;
for(int i=1;i<n;i++){
v=a[i];
j=i-1;
while(j>=0 && a[j]>v){
a[j+1]=a[j];
j--;
}
a[j+1]=v;
printArray(a,n);
}
}
public static void bubbleSort(int[] a,int n){
int f = 1;
int c = 0;
int tmp;
while(f==1){
f=0;
for(int j=n-1;j>=1;j--){
if(a[j]<a[j-1]){
c+=1;
tmp=a[j];
a[j]=a[j-1];
a[j-1]=tmp;
f=1;
}
}
}
printArray(a,n);
System.out.println(c);
}
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int a[] = new int[n];
scanArray(a,n,scan);
//printArray(a,n);
//insertSort(a,n);
bubbleSort(a,n);
}
} |
[
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,
18,
13,
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,
42,
13,
30,
0,
13,
17,
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,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
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,
18,
13,
13,
4,
18,
4,
18,
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
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
28,
33
],
[
14,
34
],
[
34,
35
],
[
34,
36
],
[
37,
38
],
[
37,
39
],
[
14,
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
],
[
14,
63
],
[
63,
64
],
[
63,
65
],
[
14,
66
],
[
66,
67
],
[
66,
68
],
[
14,
69
],
[
69,
70
],
[
69,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
71,
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
],
[
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
],
[
102,
126
],
[
126,
127
],
[
126,
128
],
[
14,
129
],
[
129,
130
],
[
129,
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
],
[
145,
148
],
[
148,
149
],
[
148,
150
],
[
144,
151
],
[
151,
152
],
[
152,
153
],
[
151,
154
],
[
14,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
160,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
14,
165
],
[
165,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
165,
170
],
[
12,
171
],
[
171,
172
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\nclass Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] s_nums = br.readLine().split(\" \");\n\n\t\tint[] nums = new int[s_nums.length];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = Integer.parseInt(s_nums[i]);\n\n\t\t}\n\n\t\tboolean jeudge = true;\n\n\t\tint count =0;\n\n\t\twhile(jeudge){\n\t\t\tjeudge = false;\n\t\t\tfor(int k = nums.length-1; k>=1; k--){\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsb.append(nums[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\n\t\tSystem.out.println(count);\n\t}\n\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] s_nums = br.readLine().split(\" \");\n\n\t\tint[] nums = new int[s_nums.length];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = Integer.parseInt(s_nums[i]);\n\n\t\t}\n\n\t\tboolean jeudge = true;\n\n\t\tint count =0;\n\n\t\twhile(jeudge){\n\t\t\tjeudge = false;\n\t\t\tfor(int k = nums.length-1; k>=1; k--){\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsb.append(nums[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\n\t\tSystem.out.println(count);\n\t}\n\n\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] s_nums = br.readLine().split(\" \");\n\n\t\tint[] nums = new int[s_nums.length];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = Integer.parseInt(s_nums[i]);\n\n\t\t}\n\n\t\tboolean jeudge = true;\n\n\t\tint count =0;\n\n\t\twhile(jeudge){\n\t\t\tjeudge = false;\n\t\t\tfor(int k = nums.length-1; k>=1; k--){\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsb.append(nums[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint n = Integer.parseInt(br.readLine());\n\n\t\tString[] s_nums = br.readLine().split(\" \");\n\n\t\tint[] nums = new int[s_nums.length];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = Integer.parseInt(s_nums[i]);\n\n\t\t}\n\n\t\tboolean jeudge = true;\n\n\t\tint count =0;\n\n\t\twhile(jeudge){\n\t\t\tjeudge = false;\n\t\t\tfor(int k = nums.length-1; k>=1; k--){\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor(int i=0; i<n; i++){\n\t\t\tsb.append(nums[i]);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\n\t\tSystem.out.println(count);\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[] s_nums = br.readLine().split(\" \");",
"s_nums",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] nums = new int[s_nums.length];",
"nums",
"new int[s_nums.length]",
"s_nums.length",
"s_nums",
"s_nums.length",
"for (int i = 0; i < n; i++) {\n\t\t\tnums[i] = Integer.parseInt(s_nums[i]);\n\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = Integer.parseInt(s_nums[i]);\n\n\t\t}",
"{\n\t\t\tnums[i] = Integer.parseInt(s_nums[i]);\n\n\t\t}",
"nums[i] = Integer.parseInt(s_nums[i])",
"nums[i]",
"nums",
"i",
"Integer.parseInt(s_nums[i])",
"Integer.parseInt",
"Integer",
"s_nums[i]",
"s_nums",
"i",
"boolean jeudge = true;",
"jeudge",
"true",
"int count =0;",
"count",
"0",
"while(jeudge){\n\t\t\tjeudge = false;\n\t\t\tfor(int k = nums.length-1; k>=1; k--){\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"jeudge",
"{\n\t\t\tjeudge = false;\n\t\t\tfor(int k = nums.length-1; k>=1; k--){\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"jeudge = false",
"jeudge",
"false",
"for(int k = nums.length-1; k>=1; k--){\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}",
"int k = nums.length-1;",
"int k = nums.length-1;",
"k",
"nums.length-1",
"nums.length",
"nums",
"nums.length",
"1",
"k>=1",
"k",
"1",
"k--",
"k--",
"k",
"{\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\n\t\t\t\tif(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}\n\t\t\t}",
"if(nums[k]<nums[k-1]){\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}",
"nums[k]<nums[k-1]",
"nums[k]",
"nums",
"k",
"nums[k-1]",
"nums",
"k-1",
"k",
"1",
"{\n\t\t\t\t\tint a = nums[k];\n\n\t\t\t\t\tnums[k] =nums[k-1];\n\n\t\t\t\t\tnums[k-1] =a;\n\n\t\t\t\t\tcount++;\n\n\t\t\t\t\tjeudge = true;\n\t\t\t\t}",
"int a = nums[k];",
"a",
"nums[k]",
"nums",
"k",
"nums[k] =nums[k-1]",
"nums[k]",
"nums",
"k",
"nums[k-1]",
"nums",
"k-1",
"k",
"1",
"nums[k-1] =a",
"nums[k-1]",
"nums",
"k-1",
"k",
"1",
"a",
"count++",
"count",
"jeudge = true",
"jeudge",
"true",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for(int i=0; i<n; i++){\n\t\t\tsb.append(nums[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(nums[i]);\n\t\t\tsb.append(\" \");\n\t\t}",
"{\n\t\t\tsb.append(nums[i]);\n\t\t\tsb.append(\" \");\n\t\t}",
"sb.append(nums[i])",
"sb.append",
"sb",
"nums[i]",
"nums",
"i",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"System.out.println(sb.toString().trim())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString().trim()",
"sb.toString().trim",
"sb.toString()",
"sb.toString",
"sb",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] s_nums = br.readLine().split(" ");
int[] nums = new int[s_nums.length];
for (int i = 0; i < n; i++) {
nums[i] = Integer.parseInt(s_nums[i]);
}
boolean jeudge = true;
int count =0;
while(jeudge){
jeudge = false;
for(int k = nums.length-1; k>=1; k--){
if(nums[k]<nums[k-1]){
int a = nums[k];
nums[k] =nums[k-1];
nums[k-1] =a;
count++;
jeudge = true;
}
}
}
StringBuilder sb = new StringBuilder();
for(int i=0; i<n; i++){
sb.append(nums[i]);
sb.append(" ");
}
System.out.println(sb.toString().trim());
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
38,
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,
0,
18,
13,
13,
4,
18,
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,
40,
13,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
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,
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
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
13,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
19,
22
],
[
22,
23
],
[
23,
24
],
[
13,
25
],
[
25,
26
],
[
25,
27
],
[
13,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
29,
34
],
[
34,
35
],
[
34,
36
],
[
29,
37
],
[
37,
38
],
[
38,
39
],
[
29,
40
],
[
40,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
45,
46
],
[
46,
47
],
[
45,
48
],
[
48,
49
],
[
49,
50
],
[
13,
51
],
[
51,
52
],
[
51,
53
],
[
13,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
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
],
[
92,
95
],
[
95,
96
],
[
95,
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
],
[
108,
110
],
[
92,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
13,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
121,
123
],
[
13,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
129,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
124,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
13,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
13,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
6,
157
],
[
157,
158
]
] | [
"import java.util.Scanner;\nclass Main {\n\tpublic static void main(String[] args){\n\t\tfinal int Number=100;\n\t\ttry(Scanner sc = new Scanner(System.in)){\n\t\t\tint N = Integer.parseInt(sc.next());\n\t\t\tint[] p=new int[N];\n\t\t\tfor(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0;i<N;i++){\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.print(p[0]);\n\t\t\tfor(int i=1;i<N;i++)System.out.print(\" \"+p[i]);\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(cnt);\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\tpublic static void main(String[] args){\n\t\tfinal int Number=100;\n\t\ttry(Scanner sc = new Scanner(System.in)){\n\t\t\tint N = Integer.parseInt(sc.next());\n\t\t\tint[] p=new int[N];\n\t\t\tfor(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0;i<N;i++){\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.print(p[0]);\n\t\t\tfor(int i=1;i<N;i++)System.out.print(\" \"+p[i]);\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(cnt);\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tfinal int Number=100;\n\t\ttry(Scanner sc = new Scanner(System.in)){\n\t\t\tint N = Integer.parseInt(sc.next());\n\t\t\tint[] p=new int[N];\n\t\t\tfor(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0;i<N;i++){\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.print(p[0]);\n\t\t\tfor(int i=1;i<N;i++)System.out.print(\" \"+p[i]);\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(cnt);\n\t\t}\n\t}",
"main",
"{\n\t\tfinal int Number=100;\n\t\ttry(Scanner sc = new Scanner(System.in)){\n\t\t\tint N = Integer.parseInt(sc.next());\n\t\t\tint[] p=new int[N];\n\t\t\tfor(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0;i<N;i++){\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.print(p[0]);\n\t\t\tfor(int i=1;i<N;i++)System.out.print(\" \"+p[i]);\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(cnt);\n\t\t}\n\t}",
"final int Number=100;",
"Number",
"100",
"try(Scanner sc = new Scanner(System.in)){\n\t\t\tint N = Integer.parseInt(sc.next());\n\t\t\tint[] p=new int[N];\n\t\t\tfor(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0;i<N;i++){\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.print(p[0]);\n\t\t\tfor(int i=1;i<N;i++)System.out.print(\" \"+p[i]);\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(cnt);\n\t\t}",
"{\n\t\t\tint N = Integer.parseInt(sc.next());\n\t\t\tint[] p=new int[N];\n\t\t\tfor(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());\n\t\t\tint cnt=0;\n\t\t\tfor(int i=0;i<N;i++){\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tSystem.out.print(p[0]);\n\t\t\tfor(int i=1;i<N;i++)System.out.print(\" \"+p[i]);\n\t\t\tSystem.out.println();\n\t\t\tSystem.out.println(cnt);\n\t\t}",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int N = Integer.parseInt(sc.next());",
"N",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int[] p=new int[N];",
"p",
"new int[N]",
"N",
"for(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"p[i] = Integer.parseInt(sc.next());",
"p[i] = Integer.parseInt(sc.next())",
"p[i]",
"p",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"int cnt=0;",
"cnt",
"0",
"for(int i=0;i<N;i++){\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tfor(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for(int j=N-1;j>i;j--){\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\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\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}\n\t\t\t\t}",
"if(p[j]<p[j-1]){\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}",
"p[j]<p[j-1]",
"p[j]",
"p",
"j",
"p[j-1]",
"p",
"j-1",
"j",
"1",
"{\n\t\t\t\t\t\tcnt++;\n\t\t\t\t\t\tint tmp=p[j-1];\n\t\t\t\t\t\tp[j-1]=p[j];\n\t\t\t\t\t\tp[j]=tmp;\n\t\t\t\t\t}",
"cnt++",
"cnt",
"int tmp=p[j-1];",
"tmp",
"p[j-1]",
"p",
"j-1",
"j",
"1",
"p[j-1]=p[j]",
"p[j-1]",
"p",
"j-1",
"j",
"1",
"p[j]",
"p",
"j",
"p[j]=tmp",
"p[j]",
"p",
"j",
"tmp",
"System.out.print(p[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"p[0]",
"p",
"0",
"for(int i=1;i<N;i++)System.out.print(\" \"+p[i]);",
"int i=1;",
"int i=1;",
"i",
"1",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"System.out.print(\" \"+p[i]);",
"System.out.print(\" \"+p[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"+p[i]",
"\" \"",
"p[i]",
"p",
"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"
] | import java.util.Scanner;
class Main {
public static void main(String[] args){
final int Number=100;
try(Scanner sc = new Scanner(System.in)){
int N = Integer.parseInt(sc.next());
int[] p=new int[N];
for(int i=0;i<N;i++) p[i] = Integer.parseInt(sc.next());
int cnt=0;
for(int i=0;i<N;i++){
for(int j=N-1;j>i;j--){
if(p[j]<p[j-1]){
cnt++;
int tmp=p[j-1];
p[j-1]=p[j];
p[j]=tmp;
}
}
}
System.out.print(p[0]);
for(int i=1;i<N;i++)System.out.print(" "+p[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,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
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,
13,
17,
1,
40,
13,
30,
30,
14,
2,
2,
13,
17,
18,
13,
13,
3,
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,
40,
13,
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,
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
],
[
178,
5
],
[
178,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
24,
26
],
[
8,
27
],
[
27,
28
],
[
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
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
56,
60
],
[
49,
61
],
[
61,
62
],
[
62,
63
],
[
49,
64
],
[
65,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
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
],
[
81,
89
],
[
80,
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
],
[
65,
124
],
[
124,
125
],
[
8,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
126,
131
],
[
131,
132
],
[
131,
133
],
[
133,
134
],
[
133,
135
],
[
126,
136
],
[
136,
137
],
[
137,
138
],
[
126,
139
],
[
140,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
146,
147
],
[
146,
148
],
[
140,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
152,
156
],
[
149,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
149,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
8,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
169,
174
],
[
6,
175
],
[
175,
176
],
[
0,
177
],
[
177,
178
],
[
177,
179
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tScanner number = new Scanner(System.in);\n\t\tint a = number.nextInt();\n\t\tint[] b = new int[a];\n\t\tint c = 0,count = 0;\n\t\tdouble d;\n\n\t\tfor(int i = 0;i < a;i++) {\n\t\t\tb[i] = number.nextInt();\n\t\t}\n\t\tfor(int i = 0;i < b.length - 1;i++) {\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}\n\t\tfor(int i = 0;i < b.length;i++) {\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\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 number = new Scanner(System.in);\n\t\tint a = number.nextInt();\n\t\tint[] b = new int[a];\n\t\tint c = 0,count = 0;\n\t\tdouble d;\n\n\t\tfor(int i = 0;i < a;i++) {\n\t\t\tb[i] = number.nextInt();\n\t\t}\n\t\tfor(int i = 0;i < b.length - 1;i++) {\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}\n\t\tfor(int i = 0;i < b.length;i++) {\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner number = new Scanner(System.in);\n\t\tint a = number.nextInt();\n\t\tint[] b = new int[a];\n\t\tint c = 0,count = 0;\n\t\tdouble d;\n\n\t\tfor(int i = 0;i < a;i++) {\n\t\t\tb[i] = number.nextInt();\n\t\t}\n\t\tfor(int i = 0;i < b.length - 1;i++) {\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}\n\t\tfor(int i = 0;i < b.length;i++) {\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tScanner number = new Scanner(System.in);\n\t\tint a = number.nextInt();\n\t\tint[] b = new int[a];\n\t\tint c = 0,count = 0;\n\t\tdouble d;\n\n\t\tfor(int i = 0;i < a;i++) {\n\t\t\tb[i] = number.nextInt();\n\t\t}\n\t\tfor(int i = 0;i < b.length - 1;i++) {\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}\n\t\tfor(int i = 0;i < b.length;i++) {\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"Scanner number = new Scanner(System.in);",
"number",
"new Scanner(System.in)",
"int a = number.nextInt();",
"a",
"number.nextInt()",
"number.nextInt",
"number",
"int[] b = new int[a];",
"b",
"new int[a]",
"a",
"int c = 0",
"c",
"0",
"count = 0;",
"count",
"0",
"double d;",
"d",
"for(int i = 0;i < a;i++) {\n\t\t\tb[i] = number.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < a",
"i",
"a",
"i++",
"i++",
"i",
"{\n\t\t\tb[i] = number.nextInt();\n\t\t}",
"{\n\t\t\tb[i] = number.nextInt();\n\t\t}",
"b[i] = number.nextInt()",
"b[i]",
"b",
"i",
"number.nextInt()",
"number.nextInt",
"number",
"for(int i = 0;i < b.length - 1;i++) {\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < b.length - 1",
"i",
"b.length - 1",
"b.length",
"b",
"b.length",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}",
"{\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}",
"for(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < a - 1",
"j",
"a - 1",
"a",
"1",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}",
"if(j + 1 > b.length) break;",
"j + 1 > b.length",
"j + 1",
"j",
"1",
"b.length",
"b",
"b.length",
"break;",
"if(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"b[j] > b[j + 1]",
"b[j]",
"b",
"j",
"b[j + 1]",
"b",
"j + 1",
"j",
"1",
"{\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"c = b[j]",
"c",
"b[j]",
"b",
"j",
"b[j] = b[j + 1]",
"b[j]",
"b",
"j",
"b[j + 1]",
"b",
"j + 1",
"j",
"1",
"b[j + 1] = c",
"b[j + 1]",
"b",
"j + 1",
"j",
"1",
"c",
"count++",
"count",
"a--",
"a",
"for(int i = 0;i < b.length;i++) {\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < b.length",
"i",
"b.length",
"b",
"b.length",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\n\t\t}",
"{\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\n\t\t}",
"System.out.print(b[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"b[i]",
"b",
"i",
"if(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");",
"i != b.length - 1",
"i",
"b.length - 1",
"b.length",
"b",
"b.length",
"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 number = new Scanner(System.in);\n\t\tint a = number.nextInt();\n\t\tint[] b = new int[a];\n\t\tint c = 0,count = 0;\n\t\tdouble d;\n\n\t\tfor(int i = 0;i < a;i++) {\n\t\t\tb[i] = number.nextInt();\n\t\t}\n\t\tfor(int i = 0;i < b.length - 1;i++) {\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}\n\t\tfor(int i = 0;i < b.length;i++) {\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\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 number = new Scanner(System.in);\n\t\tint a = number.nextInt();\n\t\tint[] b = new int[a];\n\t\tint c = 0,count = 0;\n\t\tdouble d;\n\n\t\tfor(int i = 0;i < a;i++) {\n\t\t\tb[i] = number.nextInt();\n\t\t}\n\t\tfor(int i = 0;i < b.length - 1;i++) {\n\t\t\tfor(int j = 0;j < a - 1;j++) {\n\t\t\t\tif(j + 1 > b.length) break;\n\t\t\t\tif(b[j] > b[j + 1]) {\n\t\t\t\t\tc = b[j];\n\t\t\t\t\tb[j] = b[j + 1];\n\t\t\t\t\tb[j + 1] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\ta--;\n\t\t}\n\t\tfor(int i = 0;i < b.length;i++) {\n\t\t\tSystem.out.print(b[i]);\n\t\t\tif(i != b.length - 1) System.out.print(\" \");\n\t\t\telse System.out.println(\"\");\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 number = new Scanner(System.in);
int a = number.nextInt();
int[] b = new int[a];
int c = 0,count = 0;
double d;
for(int i = 0;i < a;i++) {
b[i] = number.nextInt();
}
for(int i = 0;i < b.length - 1;i++) {
for(int j = 0;j < a - 1;j++) {
if(j + 1 > b.length) break;
if(b[j] > b[j + 1]) {
c = b[j];
b[j] = b[j + 1];
b[j + 1] = c;
count++;
}
}
a--;
}
for(int i = 0;i < b.length;i++) {
System.out.print(b[i]);
if(i != b.length - 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,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
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,
17,
18,
13,
13,
30,
4,
18,
18,
13,
13,
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
],
[
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
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
26,
27
],
[
26,
28
],
[
21,
29
],
[
29,
30
],
[
30,
31
],
[
21,
32
],
[
33,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
38
],
[
38,
39
],
[
39,
40
],
[
8,
41
],
[
41,
42
],
[
41,
43
],
[
8,
44
],
[
44,
45
],
[
45,
46
],
[
46,
47
],
[
46,
48
],
[
44,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
44,
54
],
[
54,
55
],
[
55,
56
],
[
44,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
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
],
[
8,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
108,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
128,
134
],
[
134,
135
],
[
134,
136
],
[
121,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
138,
144
],
[
144,
145
],
[
144,
146
],
[
8,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
8,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
6,
159
],
[
159,
160
],
[
0,
161
],
[
161,
162
],
[
161,
163
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[]argc){\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=0;\n for(int s=0;s<N-1;s++){\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }\n for(int k=0;k<N;k++){\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }\n System.out.printf(\"\\n\");\n System.out.println(count);\n }\n }\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String[]argc){\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=0;\n for(int s=0;s<N-1;s++){\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }\n for(int k=0;k<N;k++){\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }\n System.out.printf(\"\\n\");\n System.out.println(count);\n }\n }",
"Main",
"public static void main(String[]argc){\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=0;\n for(int s=0;s<N-1;s++){\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }\n for(int k=0;k<N;k++){\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }\n System.out.printf(\"\\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=0;\n for(int s=0;s<N-1;s++){\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }\n for(int k=0;k<N;k++){\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }\n System.out.printf(\"\\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=0;",
"count",
"0",
"for(int s=0;s<N-1;s++){\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }",
"int s=0;",
"int s=0;",
"s",
"0",
"s<N-1",
"s",
"N-1",
"N",
"1",
"s++",
"s++",
"s",
"{\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }",
"{\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }",
"for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }",
"int j=N-1;",
"int j=N-1;",
"j",
"N-1",
"N",
"1",
"j>s",
"j",
"s",
"j--",
"j--",
"j",
"{\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }",
"{\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }",
"if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }",
"A[j]<A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }",
"int x = A[j];",
"x",
"A[j]",
"A",
"j",
"A[j]=A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1]=x",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"x",
"count++",
"count",
"for(int k=0;k<N;k++){\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<N",
"k",
"N",
"k++",
"k++",
"k",
"{\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }",
"{\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }",
"if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }",
"k==N-1",
"k",
"N-1",
"N",
"1",
"{\n System.out.printf(\"%d\",A[k]);\n }",
"System.out.printf(\"%d\",A[k])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d\"",
"A[k]",
"A",
"k",
"{\n System.out.printf(\"%d \",A[k]);\n }",
"System.out.printf(\"%d \",A[k])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d \"",
"A[k]",
"A",
"k",
"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",
"String[]argc",
"argc",
"public class Main{\n public static void main(String[]argc){\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=0;\n for(int s=0;s<N-1;s++){\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }\n for(int k=0;k<N;k++){\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }\n System.out.printf(\"\\n\");\n System.out.println(count);\n }\n }",
"public class Main{\n public static void main(String[]argc){\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=0;\n for(int s=0;s<N-1;s++){\n for(int j=N-1;j>s;j--){\n if(A[j]<A[j-1]){\n int x = A[j];\n A[j]=A[j-1];\n A[j-1]=x;\n count++;\n }\n }\n }\n for(int k=0;k<N;k++){\n if(k==N-1){\n System.out.printf(\"%d\",A[k]);\n }else{\n System.out.printf(\"%d \",A[k]);\n }\n }\n System.out.printf(\"\\n\");\n System.out.println(count);\n }\n }",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[]argc){
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;
for(int s=0;s<N-1;s++){
for(int j=N-1;j>s;j--){
if(A[j]<A[j-1]){
int x = A[j];
A[j]=A[j-1];
A[j-1]=x;
count++;
}
}
}
for(int k=0;k<N;k++){
if(k==N-1){
System.out.printf("%d",A[k]);
}else{
System.out.printf("%d ",A[k]);
}
}
System.out.printf("\n");
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
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,
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,
13,
18,
13,
13,
4,
18,
13,
8,
2,
13,
2,
18,
13,
13,
17,
17,
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
],
[
164,
5
],
[
164,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
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
],
[
46,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
49,
59
],
[
59,
60
],
[
60,
61
],
[
49,
62
],
[
63,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
64,
73
],
[
73,
74
],
[
73,
75
],
[
64,
76
],
[
76,
77
],
[
77,
78
],
[
64,
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
],
[
8,
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
],
[
130,
133
],
[
133,
134
],
[
133,
135
],
[
129,
136
],
[
136,
137
],
[
137,
138
],
[
136,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
142,
146
],
[
139,
147
],
[
139,
148
],
[
8,
149
],
[
149,
150
],
[
150,
151
],
[
149,
152
],
[
8,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
153,
158
],
[
158,
159
],
[
159,
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 StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n int count = 0;\n for(int j = 0; j < ary.length; j++){\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }\n build.append(count);\n System.out.println(build.toString());\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 StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n int count = 0;\n for(int j = 0; j < ary.length; j++){\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }\n build.append(count);\n System.out.println(build.toString());\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n int count = 0;\n for(int j = 0; j < ary.length; j++){\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }\n build.append(count);\n System.out.println(build.toString());\n }",
"main",
"{\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n int count = 0;\n for(int j = 0; j < ary.length; j++){\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }\n build.append(count);\n System.out.println(build.toString());\n }",
"Scanner sc =new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"StringBuilder build = new StringBuilder();",
"build",
"new StringBuilder()",
"int z = sc.nextInt();",
"z",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ary = new int[z];",
"ary",
"new int[z]",
"z",
"for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < ary.length",
"i",
"ary.length",
"ary",
"ary.length",
"i++",
"i++",
"i",
"{\n ary[i] = sc.nextInt();\n }",
"{\n ary[i] = sc.nextInt();\n }",
"ary[i] = sc.nextInt()",
"ary[i]",
"ary",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"for(int j = 0; j < ary.length; j++){\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < ary.length",
"j",
"ary.length",
"ary",
"ary.length",
"j++",
"j++",
"j",
"{\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }",
"{\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }",
"for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }",
"int i = ary.length-1;",
"int i = ary.length-1;",
"i",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"i > j",
"i",
"j",
"i--",
"i--",
"i",
"{\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }",
"{\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }",
"if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }",
"ary[i] < ary[i-1]",
"ary[i]",
"ary",
"i",
"ary[i-1]",
"ary",
"i-1",
"i",
"1",
"{\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }",
"int temp = ary[i];",
"temp",
"ary[i]",
"ary",
"i",
"ary[i] = ary[i-1]",
"ary[i]",
"ary",
"i",
"ary[i-1]",
"ary",
"i-1",
"i",
"1",
"ary[i-1] = temp",
"ary[i-1]",
"ary",
"i-1",
"i",
"1",
"temp",
"count++",
"count",
"for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < ary.length",
"i",
"ary.length",
"ary",
"ary.length",
"i++",
"i++",
"i",
"{\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }",
"{\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }",
"build.append(ary[i])",
"build.append",
"build",
"ary[i]",
"ary",
"i",
"build.append(i==ary.length-1 ? \"\\n\" : \" \")",
"build.append",
"build",
"i==ary.length-1 ? \"\\n\" : \" \"",
"i==ary.length-1",
"i",
"ary.length-1",
"ary.length",
"ary",
"ary.length",
"1",
"\"\\n\"",
"\" \"",
"build.append(count)",
"build.append",
"build",
"count",
"System.out.println(build.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"build.toString()",
"build.toString",
"build",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n int count = 0;\n for(int j = 0; j < ary.length; j++){\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }\n build.append(count);\n System.out.println(build.toString());\n }\n}",
"public class Main {\n public static void main(String[] args) {\n Scanner sc =new Scanner(System.in);\n StringBuilder build = new StringBuilder();\n int z = sc.nextInt();\n int[] ary = new int[z];\n for(int i = 0 ; i < ary.length; i++){\n ary[i] = sc.nextInt();\n }\n int count = 0;\n for(int j = 0; j < ary.length; j++){\n for(int i = ary.length-1; i > j; i--){\n if(ary[i] < ary[i-1]){\n int temp = ary[i];\n ary[i] = ary[i-1];\n ary[i-1] = temp;\n count++;\n }\n }\n }\n for(int i = 0; i < ary.length; i++){\n build.append(ary[i]);\n build.append(i==ary.length-1 ? \"\\n\" : \" \");\n }\n build.append(count);\n System.out.println(build.toString());\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
StringBuilder build = new StringBuilder();
int z = sc.nextInt();
int[] ary = new int[z];
for(int i = 0 ; i < ary.length; i++){
ary[i] = sc.nextInt();
}
int count = 0;
for(int j = 0; j < ary.length; j++){
for(int i = ary.length-1; i > j; i--){
if(ary[i] < ary[i-1]){
int temp = ary[i];
ary[i] = ary[i-1];
ary[i-1] = temp;
count++;
}
}
}
for(int i = 0; i < ary.length; i++){
build.append(ary[i]);
build.append(i==ary.length-1 ? "\n" : " ");
}
build.append(count);
System.out.println(build.toString());
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
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,
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,
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,
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
],
[
20,
22
],
[
8,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
8,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
46,
48
],
[
46,
49
],
[
8,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
50,
55
],
[
55,
56
],
[
55,
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
],
[
65,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
8,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
75,
80
],
[
80,
81
],
[
80,
82
],
[
82,
83
],
[
82,
84
],
[
8,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
6,
91
],
[
91,
92
],
[
169,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
95,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
102,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
110,
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
],
[
126,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
125,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
135,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
135,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
150,
156
],
[
135,
157
],
[
157,
158
],
[
157,
159
],
[
135,
160
],
[
160,
161
],
[
95,
162
],
[
162,
163
],
[
93,
164
],
[
164,
165
],
[
93,
166
],
[
166,
167
],
[
0,
168
],
[
168,
169
],
[
168,
170
]
] | [
"import java.util.*;\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n StringBuilder bd = new StringBuilder();\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 int counter = bubbleSort(A, N);\n for (int i=0; i<N-1; i++) {\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[N-1]);\n System.out.println(counter);\n }\n\n\n public static int bubbleSort(int[] A, int 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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }\n }\n }\n return count;\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n StringBuilder bd = new StringBuilder();\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 int counter = bubbleSort(A, N);\n for (int i=0; i<N-1; i++) {\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[N-1]);\n System.out.println(counter);\n }\n\n\n public static int bubbleSort(int[] A, int 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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }\n }\n }\n return count;\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n StringBuilder bd = new StringBuilder();\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 int counter = bubbleSort(A, N);\n for (int i=0; i<N-1; i++) {\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[N-1]);\n System.out.println(counter);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n StringBuilder bd = new StringBuilder();\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 int counter = bubbleSort(A, N);\n for (int i=0; i<N-1; i++) {\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[N-1]);\n System.out.println(counter);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"StringBuilder bd = new StringBuilder();",
"bd",
"new StringBuilder()",
"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 counter = bubbleSort(A, N);",
"counter",
"bubbleSort(A, N)",
"bubbleSort",
"A",
"N",
"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])",
"System.out.println",
"System.out",
"System",
"System.out",
"A[N-1]",
"A",
"N-1",
"N",
"1",
"System.out.println(counter)",
"System.out.println",
"System.out",
"System",
"System.out",
"counter",
"String[] args",
"args",
"public static int bubbleSort(int[] A, int 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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }\n }\n }\n return count;\n }",
"bubbleSort",
"{\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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }\n }\n }\n return count;\n }",
"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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }\n }",
"{\n if (A[i] < A[i-1]) {\n int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }\n }",
"if (A[i] < A[i-1]) {\n int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }",
"A[i] < A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"{\n int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }",
"int t = A[i];",
"t",
"A[i]",
"A",
"i",
"A[i] = A[i-1]",
"A[i]",
"A",
"i",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"A[i-1] = t",
"A[i-1]",
"A",
"i-1",
"i",
"1",
"t",
"flag = 1",
"flag",
"1",
"count++",
"count",
"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 StringBuilder bd = new StringBuilder();\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 int counter = bubbleSort(A, N);\n for (int i=0; i<N-1; i++) {\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[N-1]);\n System.out.println(counter);\n }\n\n\n public static int bubbleSort(int[] A, int 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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\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 StringBuilder bd = new StringBuilder();\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 int counter = bubbleSort(A, N);\n for (int i=0; i<N-1; i++) {\n System.out.print(A[i] + \" \");\n }\n System.out.println(A[N-1]);\n System.out.println(counter);\n }\n\n\n public static int bubbleSort(int[] A, int 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 int t = A[i];\n A[i] = A[i-1];\n A[i-1] = t;\n flag = 1;\n count++;\n }\n }\n }\n return count;\n }\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
StringBuilder bd = new StringBuilder();
int N = sc.nextInt();
int[] A = new int[N];
for (int i=0; i<N; i++) {
A[i] = sc.nextInt();
}
int counter = bubbleSort(A, N);
for (int i=0; i<N-1; i++) {
System.out.print(A[i] + " ");
}
System.out.println(A[N-1]);
System.out.println(counter);
}
public static int bubbleSort(int[] A, int N) {
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]) {
int t = A[i];
A[i] = A[i-1];
A[i-1] = t;
flag = 1;
count++;
}
}
}
return count;
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
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,
4,
18,
13,
13,
4,
18,
13,
2,
13,
17,
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,
14,
2,
13,
2,
13,
17,
30,
4,
18,
18,
13,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
2,
4,
18,
13,
13,
17,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
145,
5
],
[
145,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
39,
40
],
[
40,
41
],
[
8,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
42,
47
],
[
47,
48
],
[
47,
49
],
[
42,
50
],
[
50,
51
],
[
51,
52
],
[
42,
53
],
[
54,
54
],
[
54,
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
],
[
73,
74
],
[
72,
75
],
[
71,
76
],
[
76,
77
],
[
77,
78
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
70,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
86,
87
],
[
85,
88
],
[
82,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
93,
96
],
[
96,
97
],
[
96,
98
],
[
82,
99
],
[
99,
100
],
[
100,
101
],
[
99,
102
],
[
102,
103
],
[
102,
104
],
[
99,
105
],
[
82,
106
],
[
106,
107
],
[
54,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
108,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
121,
122
],
[
120,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
108,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
137,
140
],
[
136,
141
],
[
6,
142
],
[
142,
143
],
[
0,
144
],
[
144,
145
],
[
144,
146
]
] | [
"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 List<Integer> arr = new ArrayList<>();\n int count = 0;\n for(int i = 0; i < n; i++) {\n arr.add(sc.nextInt());\n }\n for(int i = 0; i < n; i++) {\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }\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 List<Integer> arr = new ArrayList<>();\n int count = 0;\n for(int i = 0; i < n; i++) {\n arr.add(sc.nextInt());\n }\n for(int i = 0; i < n; i++) {\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> arr = new ArrayList<>();\n int count = 0;\n for(int i = 0; i < n; i++) {\n arr.add(sc.nextInt());\n }\n for(int i = 0; i < n; i++) {\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n List<Integer> arr = new ArrayList<>();\n int count = 0;\n for(int i = 0; i < n; i++) {\n arr.add(sc.nextInt());\n }\n for(int i = 0; i < n; i++) {\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"List<Integer> arr = new ArrayList<>();",
"arr",
"new ArrayList<>()",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < n; i++) {\n arr.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n arr.add(sc.nextInt());\n }",
"{\n arr.add(sc.nextInt());\n }",
"arr.add(sc.nextInt())",
"arr.add",
"arr",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < n; i++) {\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\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.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }",
"{\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }",
"for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\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.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }",
"{\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }",
"if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }",
"arr.get(j) < arr.get(j - 1)",
"arr.get(j)",
"arr.get",
"arr",
"j",
"arr.get(j - 1)",
"arr.get",
"arr",
"j - 1",
"j",
"1",
"{\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }",
"int v = arr.get(j);",
"v",
"arr.get(j)",
"arr.get",
"arr",
"j",
"arr.set(j, arr.get(j - 1))",
"arr.set",
"arr",
"j",
"arr.get(j - 1)",
"arr.get",
"arr",
"j - 1",
"j",
"1",
"arr.set(j - 1, v)",
"arr.set",
"arr",
"j - 1",
"j",
"1",
"v",
"count++",
"count",
"if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }",
"i == n - 1",
"i",
"n - 1",
"n",
"1",
"{\n System.out.println(arr.get(i));\n System.out.println(count);\n }",
"System.out.println(arr.get(i))",
"System.out.println",
"System.out",
"System",
"System.out",
"arr.get(i)",
"arr.get",
"arr",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"{\n System.out.print(arr.get(i) + \" \");\n }",
"System.out.print(arr.get(i) + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"arr.get(i) + \" \"",
"arr.get(i)",
"arr.get",
"arr",
"i",
"\" \"",
"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> arr = new ArrayList<>();\n int count = 0;\n for(int i = 0; i < n; i++) {\n arr.add(sc.nextInt());\n }\n for(int i = 0; i < n; i++) {\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }\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> arr = new ArrayList<>();\n int count = 0;\n for(int i = 0; i < n; i++) {\n arr.add(sc.nextInt());\n }\n for(int i = 0; i < n; i++) {\n for(int j = n - 1; j > i; j--) {\n if(arr.get(j) < arr.get(j - 1)) {\n int v = arr.get(j);\n arr.set(j, arr.get(j - 1));\n arr.set(j - 1, v);\n count++;\n }\n }\n if(i == n - 1) {\n System.out.println(arr.get(i));\n System.out.println(count);\n } else {\n System.out.print(arr.get(i) + \" \");\n }\n }\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();
List<Integer> arr = new ArrayList<>();
int count = 0;
for(int i = 0; i < n; i++) {
arr.add(sc.nextInt());
}
for(int i = 0; i < n; i++) {
for(int j = n - 1; j > i; j--) {
if(arr.get(j) < arr.get(j - 1)) {
int v = arr.get(j);
arr.set(j, arr.get(j - 1));
arr.set(j - 1, v);
count++;
}
}
if(i == n - 1) {
System.out.println(arr.get(i));
System.out.println(count);
} else {
System.out.print(arr.get(i) + " ");
}
}
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
12,
13,
30,
41,
13,
4,
18,
13,
41,
13,
4,
13,
13,
4,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
42,
13,
30,
0,
13,
17,
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,
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,
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,
4,
18,
18,
13,
13,
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,
29,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
181,
5
],
[
181,
6
],
[
6,
7
],
[
6,
8
],
[
181,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
11,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
19,
21
],
[
11,
22
],
[
22,
23
],
[
22,
24
],
[
9,
25
],
[
25,
26
],
[
181,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
33,
35
],
[
29,
36
],
[
36,
37
],
[
36,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
38,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
42,
51
],
[
51,
52
],
[
51,
53
],
[
42,
54
],
[
54,
55
],
[
55,
56
],
[
42,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
66,
68
],
[
59,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
69,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
77,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
69,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
86,
92
],
[
69,
93
],
[
93,
94
],
[
69,
95
],
[
95,
96
],
[
95,
97
],
[
29,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
98,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
98,
108
],
[
108,
109
],
[
109,
110
],
[
98,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
112,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
29,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
29,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
141,
146
],
[
27,
147
],
[
147,
148
],
[
181,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
152,
153
],
[
152,
154
],
[
151,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
161,
162
],
[
161,
163
],
[
156,
164
],
[
164,
165
],
[
165,
166
],
[
156,
167
],
[
168,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
170,
172
],
[
169,
173
],
[
173,
174
],
[
174,
175
],
[
151,
176
],
[
176,
177
],
[
149,
178
],
[
178,
179
],
[
0,
180
],
[
180,
181
],
[
180,
182
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] A = inpNum(n);\n\n\t\tbubbleSort(A);\n\n\t}\n\n\tprivate static void bubbleSort(int[] A) {\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\n\t\twhile(flag) {\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int k = 0; k < A.length; k++ ) {\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static int[] inpNum(int n) {\n\t\tint[] nums = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\treturn nums;\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] A = inpNum(n);\n\n\t\tbubbleSort(A);\n\n\t}\n\n\tprivate static void bubbleSort(int[] A) {\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\n\t\twhile(flag) {\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int k = 0; k < A.length; k++ ) {\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static int[] inpNum(int n) {\n\t\tint[] nums = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\treturn nums;\n\t}\n\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] A = inpNum(n);\n\n\t\tbubbleSort(A);\n\n\t}",
"main",
"{\n\t\tint n = sc.nextInt();\n\t\tint[] A = inpNum(n);\n\n\t\tbubbleSort(A);\n\n\t}",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] A = inpNum(n);",
"A",
"inpNum(n)",
"inpNum",
"n",
"bubbleSort(A)",
"bubbleSort",
"A",
"String[] args",
"args",
"private static void bubbleSort(int[] A) {\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\n\t\twhile(flag) {\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int k = 0; k < A.length; k++ ) {\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\n\t}",
"bubbleSort",
"{\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\n\t\twhile(flag) {\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int k = 0; k < A.length; k++ ) {\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\n\t}",
"boolean flag = true;",
"flag",
"true",
"int cnt = 0;",
"cnt",
"0",
"while(flag) {\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}",
"flag",
"{\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}",
"flag = false",
"flag",
"false",
"for (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}",
"int j = A.length - 1;",
"int j = A.length - 1;",
"j",
"A.length - 1",
"A.length",
"A",
"A.length",
"1",
"j > 0",
"j",
"0",
"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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\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\tcnt++;\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\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\tcnt++;\n\t\t\t\t\tflag = true;\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",
"cnt++",
"cnt",
"flag = true",
"flag",
"true",
"for (int k = 0; k < A.length; k++ ) {\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}",
"int k = 0;",
"int k = 0;",
"k",
"0",
"k < A.length",
"k",
"A.length",
"A",
"A.length",
"k++",
"k++",
"k",
"{\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}",
"{\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}",
"System.out.print(A[k])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[k]",
"A",
"k",
"if(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"k < A.length -1",
"k",
"A.length -1",
"A.length",
"A",
"A.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",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"int[] A",
"A",
"private static int[] inpNum(int n) {\n\t\tint[] nums = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\treturn nums;\n\t}",
"inpNum",
"{\n\t\tint[] nums = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\treturn nums;\n\t}",
"int[] nums = new int[n];",
"nums",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"nums[i] = sc.nextInt()",
"nums[i]",
"nums",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"return nums;",
"nums",
"int n",
"n",
"public class Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] A = inpNum(n);\n\n\t\tbubbleSort(A);\n\n\t}\n\n\tprivate static void bubbleSort(int[] A) {\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\n\t\twhile(flag) {\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int k = 0; k < A.length; k++ ) {\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static int[] inpNum(int n) {\n\t\tint[] nums = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\treturn nums;\n\t}\n\n}",
"public class Main {\n\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] A = inpNum(n);\n\n\t\tbubbleSort(A);\n\n\t}\n\n\tprivate static void bubbleSort(int[] A) {\n\t\tboolean flag = true;\n\t\tint cnt = 0;\n\n\t\twhile(flag) {\n\t\t\tflag = false;\n\n\t\t\tfor (int j = A.length - 1; j > 0; 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\tcnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t\tfor (int k = 0; k < A.length; k++ ) {\n\t\t\tSystem.out.print(A[k]);\n\t\t\tif(k < A.length -1) {\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(cnt);\n\n\t}\n\n\tprivate static int[] inpNum(int n) {\n\t\tint[] nums = new int[n];\n\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\treturn nums;\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
int[] A = inpNum(n);
bubbleSort(A);
}
private static void bubbleSort(int[] A) {
boolean flag = true;
int cnt = 0;
while(flag) {
flag = false;
for (int j = A.length - 1; j > 0; j-- ) {
if (A[j] < A[j -1]) {
int tmp;
tmp = A[j];
A[j] = A[j - 1];
A[j -1] = tmp;
cnt++;
flag = true;
}
}
}
for (int k = 0; k < A.length; k++ ) {
System.out.print(A[k]);
if(k < A.length -1) {
System.out.print(" ");
}
}
System.out.println();
System.out.println(cnt);
}
private static int[] inpNum(int n) {
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] = sc.nextInt();
}
return nums;
}
}
|
[
7,
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,
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,
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
],
[
158,
5
],
[
158,
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
],
[
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
48,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
8,
53
],
[
53,
54
],
[
53,
55
],
[
8,
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
],
[
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
],
[
87,
111
],
[
111,
112
],
[
111,
113
],
[
8,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
114,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
8,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
8,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
6,
155
],
[
155,
156
],
[
0,
157
],
[
157,
158
],
[
157,
159
]
] | [
"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 = Integer.parseInt(sc.next());\n\t\tint A[] = new int[N];\n\t\tfor(int i=0;i<N;i++){\n\t\t\tA[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\tsc.close();\n\t\t\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(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\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-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\t\n\n\t}\n\t\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = Integer.parseInt(sc.next());\n\t\tint A[] = new int[N];\n\t\tfor(int i=0;i<N;i++){\n\t\t\tA[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\tsc.close();\n\t\t\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(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\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-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\t\n\n\t}\n\t\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = Integer.parseInt(sc.next());\n\t\tint A[] = new int[N];\n\t\tfor(int i=0;i<N;i++){\n\t\t\tA[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\tsc.close();\n\t\t\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(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\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-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\t\n\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = Integer.parseInt(sc.next());\n\t\tint A[] = new int[N];\n\t\tfor(int i=0;i<N;i++){\n\t\t\tA[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\tsc.close();\n\t\t\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(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\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-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\t\n\n\t}",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N = Integer.parseInt(sc.next());",
"N",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"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(sc.next());\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(sc.next());\n\t\t}",
"{\n\t\t\tA[i]=Integer.parseInt(sc.next());\n\t\t}",
"A[i]=Integer.parseInt(sc.next())",
"A[i]",
"A",
"i",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"sc.close()",
"sc.close",
"sc",
"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(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\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(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\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(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\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(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\tcount++;\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\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\tflag=true;\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\tcount++;\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\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\tflag=true;\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",
"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\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = Integer.parseInt(sc.next());\n\t\tint A[] = new int[N];\n\t\tfor(int i=0;i<N;i++){\n\t\t\tA[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\tsc.close();\n\t\t\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(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\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-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\t\n\n\t}\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 = Integer.parseInt(sc.next());\n\t\tint A[] = new int[N];\n\t\tfor(int i=0;i<N;i++){\n\t\t\tA[i]=Integer.parseInt(sc.next());\n\t\t}\n\t\tsc.close();\n\t\t\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(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\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-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\t\n\n\t}\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 = Integer.parseInt(sc.next());
int A[] = new int[N];
for(int i=0;i<N;i++){
A[i]=Integer.parseInt(sc.next());
}
sc.close();
boolean flag = true;
int count = 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;
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,
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,
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,
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,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
4,
18,
13,
17,
30,
4,
18,
18,
13,
13,
4,
18,
13,
13,
30,
4,
18,
18,
13,
13,
2,
4,
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
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
172,
8
],
[
172,
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
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
45,
50
],
[
50,
51
],
[
50,
52
],
[
45,
53
],
[
53,
54
],
[
54,
55
],
[
45,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
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
],
[
78,
79
],
[
77,
80
],
[
76,
81
],
[
81,
82
],
[
82,
83
],
[
81,
84
],
[
84,
85
],
[
84,
86
],
[
75,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
90,
93
],
[
93,
94
],
[
93,
95
],
[
87,
96
],
[
96,
97
],
[
97,
98
],
[
96,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
103,
104
],
[
102,
105
],
[
87,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
106,
110
],
[
87,
111
],
[
111,
112
],
[
11,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
113,
123
],
[
123,
124
],
[
124,
125
],
[
113,
126
],
[
127,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
131,
135
],
[
128,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
143,
144
],
[
142,
145
],
[
128,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
153,
156
],
[
152,
157
],
[
11,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
11,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
9,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
] | [
"import java.util.ArrayList;\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tArrayList<Integer> list=new ArrayList<Integer>();\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tint ans=0;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<list.size();i++)\n\t\t{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(ans);\n\t}\n}\n",
"import java.util.ArrayList;",
"ArrayList",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tArrayList<Integer> list=new ArrayList<Integer>();\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tint ans=0;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<list.size();i++)\n\t\t{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main",
"public static void main(String[] args)\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tArrayList<Integer> list=new ArrayList<Integer>();\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tint ans=0;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<list.size();i++)\n\t\t{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(ans);\n\t}",
"main",
"{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tArrayList<Integer> list=new ArrayList<Integer>();\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tint ans=0;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<list.size();i++)\n\t\t{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(ans);\n\t}",
"Scanner sc=new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int N=sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"ArrayList<Integer> list=new ArrayList<Integer>();",
"list",
"new ArrayList<Integer>()",
"for(int i=0;i<N;i++)\n\t\t{\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"{\n\t\t\tlist.add(sc.nextInt());\n\t\t}",
"list.add(sc.nextInt())",
"list.add",
"list",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int ans=0;",
"ans",
"0",
"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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\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{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}",
"if(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\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 temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}",
"int temp=list.get(j-1);",
"temp",
"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,temp)",
"list.set",
"list",
"j",
"temp",
"ans++",
"ans",
"for(int i=0;i<list.size();i++)\n\t\t{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<list.size()",
"i",
"list.size()",
"list.size",
"list",
"i++",
"i++",
"i",
"{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}",
"if(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}",
"i==list.size()-1",
"i",
"list.size()-1",
"list.size()",
"list.size",
"list",
"1",
"{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}",
"System.out.print(list.get(i))",
"System.out.print",
"System.out",
"System",
"System.out",
"list.get(i)",
"list.get",
"list",
"i",
"{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}",
"System.out.print(list.get(i)+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"list.get(i)+\" \"",
"list.get(i)",
"list.get",
"list",
"i",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(ans)",
"System.out.println",
"System.out",
"System",
"System.out",
"ans",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tArrayList<Integer> list=new ArrayList<Integer>();\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tint ans=0;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<list.size();i++)\n\t\t{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(ans);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args)\n\t{\n\t\tScanner sc=new Scanner(System.in);\n\t\tint N=sc.nextInt();\n\t\tArrayList<Integer> list=new ArrayList<Integer>();\n\t\tfor(int i=0;i<N;i++)\n\t\t{\n\t\t\tlist.add(sc.nextInt());\n\t\t}\n\t\tint ans=0;\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(list.get(j)<list.get(j-1))\n\t\t\t\t{\n\t\t\t\t\tint temp=list.get(j-1);\n\t\t\t\t\tlist.set(j-1,list.get(j));\n\t\t\t\t\tlist.set(j,temp);\n\t\t\t\t\tans++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor(int i=0;i<list.size();i++)\n\t\t{\n\t\t\tif(i==list.size()-1)\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.print(list.get(i)+\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(ans);\n\t}\n}",
"Main"
] | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
ArrayList<Integer> list=new ArrayList<Integer>();
for(int i=0;i<N;i++)
{
list.add(sc.nextInt());
}
int ans=0;
for(int i=0;i<N;i++)
{
for(int j=N-1;j>=i+1;j--)
{
if(list.get(j)<list.get(j-1))
{
int temp=list.get(j-1);
list.set(j-1,list.get(j));
list.set(j,temp);
ans++;
}
}
}
for(int i=0;i<list.size();i++)
{
if(i==list.size()-1)
{
System.out.print(list.get(i));
}
else
{
System.out.print(list.get(i)+" ");
}
}
System.out.println();
System.out.println(ans);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
4,
18,
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,
20,
4,
18,
13,
4,
18,
13,
4,
18,
13,
23,
13,
6,
13,
41,
13,
41,
13,
17,
12,
13,
30,
0,
18,
36,
13,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
41,
13,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
9,
0,
13,
18,
13,
13,
0,
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,
40,
13,
0,
18,
13,
2,
13,
17,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
18,
13,
13,
9,
4,
18,
18,
13,
13,
2,
17,
18,
13,
13,
4,
18,
18,
13,
13,
17,
12,
13,
30,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
199,
5
],
[
199,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
12,
14
],
[
15,
16
],
[
16,
17
],
[
8,
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
],
[
8,
40
],
[
40,
41
],
[
40,
42
],
[
8,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
6,
52
],
[
52,
53
],
[
0,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
54,
58
],
[
58,
59
],
[
58,
60
],
[
54,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
61,
69
],
[
69,
70
],
[
54,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
77,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
77,
89
],
[
89,
90
],
[
90,
91
],
[
77,
92
],
[
93,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
98,
99
],
[
93,
100
],
[
100,
101
],
[
100,
102
],
[
102,
103
],
[
102,
104
],
[
93,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
93,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
111,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
110,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
127,
128
],
[
127,
129
],
[
120,
130
],
[
130,
131
],
[
120,
132
],
[
132,
133
],
[
93,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
134,
140
],
[
54,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
144,
154
],
[
154,
155
],
[
155,
156
],
[
144,
157
],
[
158,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
159,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
164,
169
],
[
169,
170
],
[
169,
171
],
[
163,
172
],
[
158,
173
],
[
173,
174
],
[
174,
175
],
[
175,
176
],
[
175,
177
],
[
173,
178
],
[
178,
179
],
[
178,
180
],
[
180,
181
],
[
180,
182
],
[
143,
183
],
[
183,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
183,
188
],
[
54,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
194,
195
],
[
194,
196
],
[
192,
197
],
[
0,
198
],
[
198,
199
],
[
198,
200
]
] | [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int[] bubNum = new int[sc.nextInt()];\n \n for(int i = 0; i < bubNum.length; i++){\n bubNum[i] = sc.nextInt();\n }\n BubbleSort bs = new BubbleSort(bubNum);\n bs.changeOfBubNum();\n bs.outPutOfBubNum();\n bs.outPutOfBubCount();\n }\n}\n\nclass BubbleSort{\n int[] bubNum;\n public BubbleSort(int[] bubNum){\n this.bubNum = bubNum;\n }\n \n int count = 0;\n public void changeOfBubNum(){\n int minNum = 0;\n for(int i = 0, j; i < bubNum.length; i++){\n if(i == 0){\n continue;\n }\n minNum = bubNum[i];\n j = i - 1;\n while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }\n bubNum[j + 1] = minNum;\n }\n }\n \n public void outPutOfBubNum(){\n for(int i = 0; i < bubNum.length; i++){\n if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }\n System.out.print(\" \" + bubNum[i]);\n }\n System.out.print(\"\\n\");\n }\n \n public void outPutOfBubCount(){\n System.out.println(count);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int[] bubNum = new int[sc.nextInt()];\n \n for(int i = 0; i < bubNum.length; i++){\n bubNum[i] = sc.nextInt();\n }\n BubbleSort bs = new BubbleSort(bubNum);\n bs.changeOfBubNum();\n bs.outPutOfBubNum();\n bs.outPutOfBubCount();\n }\n}",
"Main",
"public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int[] bubNum = new int[sc.nextInt()];\n \n for(int i = 0; i < bubNum.length; i++){\n bubNum[i] = sc.nextInt();\n }\n BubbleSort bs = new BubbleSort(bubNum);\n bs.changeOfBubNum();\n bs.outPutOfBubNum();\n bs.outPutOfBubCount();\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int[] bubNum = new int[sc.nextInt()];\n \n for(int i = 0; i < bubNum.length; i++){\n bubNum[i] = sc.nextInt();\n }\n BubbleSort bs = new BubbleSort(bubNum);\n bs.changeOfBubNum();\n bs.outPutOfBubNum();\n bs.outPutOfBubCount();\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int[] bubNum = new int[sc.nextInt()];",
"bubNum",
"new int[sc.nextInt()]",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for(int i = 0; i < bubNum.length; i++){\n bubNum[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < bubNum.length",
"i",
"bubNum.length",
"bubNum",
"bubNum.length",
"i++",
"i++",
"i",
"{\n bubNum[i] = sc.nextInt();\n }",
"{\n bubNum[i] = sc.nextInt();\n }",
"bubNum[i] = sc.nextInt()",
"bubNum[i]",
"bubNum",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"BubbleSort bs = new BubbleSort(bubNum);",
"bs",
"new BubbleSort(bubNum)",
"bs.changeOfBubNum()",
"bs.changeOfBubNum",
"bs",
"bs.outPutOfBubNum()",
"bs.outPutOfBubNum",
"bs",
"bs.outPutOfBubCount()",
"bs.outPutOfBubCount",
"bs",
"String[] args",
"args",
"class BubbleSort{\n int[] bubNum;\n public BubbleSort(int[] bubNum){\n this.bubNum = bubNum;\n }\n \n int count = 0;\n public void changeOfBubNum(){\n int minNum = 0;\n for(int i = 0, j; i < bubNum.length; i++){\n if(i == 0){\n continue;\n }\n minNum = bubNum[i];\n j = i - 1;\n while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }\n bubNum[j + 1] = minNum;\n }\n }\n \n public void outPutOfBubNum(){\n for(int i = 0; i < bubNum.length; i++){\n if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }\n System.out.print(\" \" + bubNum[i]);\n }\n System.out.print(\"\\n\");\n }\n \n public void outPutOfBubCount(){\n System.out.println(count);\n }\n}",
"BubbleSort",
"int[] bubNum;",
"bubNum",
"int count = 0;",
"count",
"0",
"public BubbleSort(int[] bubNum){\n this.bubNum = bubNum;\n }",
"BubbleSort",
"{\n this.bubNum = bubNum;\n }",
"this.bubNum = bubNum",
"this.bubNum",
"this",
"this.bubNum",
"bubNum",
"int[] bubNum",
"bubNum",
"public void changeOfBubNum(){\n int minNum = 0;\n for(int i = 0, j; i < bubNum.length; i++){\n if(i == 0){\n continue;\n }\n minNum = bubNum[i];\n j = i - 1;\n while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }\n bubNum[j + 1] = minNum;\n }\n }",
"changeOfBubNum",
"{\n int minNum = 0;\n for(int i = 0, j; i < bubNum.length; i++){\n if(i == 0){\n continue;\n }\n minNum = bubNum[i];\n j = i - 1;\n while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }\n bubNum[j + 1] = minNum;\n }\n }",
"int minNum = 0;",
"minNum",
"0",
"for(int i = 0, j; i < bubNum.length; i++){\n if(i == 0){\n continue;\n }\n minNum = bubNum[i];\n j = i - 1;\n while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }\n bubNum[j + 1] = minNum;\n }",
"int i = 0, j;",
"int i = 0",
"i",
"0",
"j;",
"j",
"i < bubNum.length",
"i",
"bubNum.length",
"bubNum",
"bubNum.length",
"i++",
"i++",
"i",
"{\n if(i == 0){\n continue;\n }\n minNum = bubNum[i];\n j = i - 1;\n while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }\n bubNum[j + 1] = minNum;\n }",
"{\n if(i == 0){\n continue;\n }\n minNum = bubNum[i];\n j = i - 1;\n while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }\n bubNum[j + 1] = minNum;\n }",
"if(i == 0){\n continue;\n }",
"i == 0",
"i",
"0",
"{\n continue;\n }",
"continue;",
"minNum = bubNum[i]",
"minNum",
"bubNum[i]",
"bubNum",
"i",
"j = i - 1",
"j",
"i - 1",
"i",
"1",
"while(j >= 0 && bubNum[j] > minNum){\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }",
"j >= 0 && bubNum[j] > minNum",
"j >= 0",
"j",
"0",
"bubNum[j] > minNum",
"bubNum[j]",
"bubNum",
"j",
"minNum",
"{\n bubNum[j + 1] = bubNum[j];\n count++;\n j--;\n }",
"bubNum[j + 1] = bubNum[j]",
"bubNum[j + 1]",
"bubNum",
"j + 1",
"j",
"1",
"bubNum[j]",
"bubNum",
"j",
"count++",
"count",
"j--",
"j",
"bubNum[j + 1] = minNum",
"bubNum[j + 1]",
"bubNum",
"j + 1",
"j",
"1",
"minNum",
"public void outPutOfBubNum(){\n for(int i = 0; i < bubNum.length; i++){\n if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }\n System.out.print(\" \" + bubNum[i]);\n }\n System.out.print(\"\\n\");\n }",
"outPutOfBubNum",
"{\n for(int i = 0; i < bubNum.length; i++){\n if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }\n System.out.print(\" \" + bubNum[i]);\n }\n System.out.print(\"\\n\");\n }",
"for(int i = 0; i < bubNum.length; i++){\n if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }\n System.out.print(\" \" + bubNum[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < bubNum.length",
"i",
"bubNum.length",
"bubNum",
"bubNum.length",
"i++",
"i++",
"i",
"{\n if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }\n System.out.print(\" \" + bubNum[i]);\n }",
"{\n if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }\n System.out.print(\" \" + bubNum[i]);\n }",
"if(i == 0){\n System.out.print(bubNum[i]);\n continue;\n }",
"i == 0",
"i",
"0",
"{\n System.out.print(bubNum[i]);\n continue;\n }",
"System.out.print(bubNum[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"bubNum[i]",
"bubNum",
"i",
"continue;",
"System.out.print(\" \" + bubNum[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \" + bubNum[i]",
"\" \"",
"bubNum[i]",
"bubNum",
"i",
"System.out.print(\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"",
"public void outPutOfBubCount(){\n System.out.println(count);\n }",
"outPutOfBubCount",
"{\n System.out.println(count);\n }",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int[] bubNum = new int[sc.nextInt()];\n \n for(int i = 0; i < bubNum.length; i++){\n bubNum[i] = sc.nextInt();\n }\n BubbleSort bs = new BubbleSort(bubNum);\n bs.changeOfBubNum();\n bs.outPutOfBubNum();\n bs.outPutOfBubCount();\n }\n}",
"public class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int[] bubNum = new int[sc.nextInt()];\n \n for(int i = 0; i < bubNum.length; i++){\n bubNum[i] = sc.nextInt();\n }\n BubbleSort bs = new BubbleSort(bubNum);\n bs.changeOfBubNum();\n bs.outPutOfBubNum();\n bs.outPutOfBubCount();\n }\n}",
"Main"
] | import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int[] bubNum = new int[sc.nextInt()];
for(int i = 0; i < bubNum.length; i++){
bubNum[i] = sc.nextInt();
}
BubbleSort bs = new BubbleSort(bubNum);
bs.changeOfBubNum();
bs.outPutOfBubNum();
bs.outPutOfBubCount();
}
}
class BubbleSort{
int[] bubNum;
public BubbleSort(int[] bubNum){
this.bubNum = bubNum;
}
int count = 0;
public void changeOfBubNum(){
int minNum = 0;
for(int i = 0, j; i < bubNum.length; i++){
if(i == 0){
continue;
}
minNum = bubNum[i];
j = i - 1;
while(j >= 0 && bubNum[j] > minNum){
bubNum[j + 1] = bubNum[j];
count++;
j--;
}
bubNum[j + 1] = minNum;
}
}
public void outPutOfBubNum(){
for(int i = 0; i < bubNum.length; i++){
if(i == 0){
System.out.print(bubNum[i]);
continue;
}
System.out.print(" " + bubNum[i]);
}
System.out.print("\n");
}
public void outPutOfBubCount(){
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
38,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
18,
13,
13,
18,
13,
13,
4,
18,
13,
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,
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,
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
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
10,
19
],
[
19,
20
],
[
19,
21
],
[
10,
23
],
[
23,
24
],
[
23,
25
],
[
10,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
39,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
10,
54
],
[
54,
55
],
[
55,
56
],
[
54,
57
],
[
10,
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
],
[
71,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
80,
87
],
[
10,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
93,
94
],
[
93,
95
],
[
93,
96
],
[
6,
97
],
[
97,
98
],
[
4,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
105,
107
],
[
101,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
111,
112
],
[
111,
113
],
[
110,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
114,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
114,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
139,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
154,
160
],
[
139,
161
],
[
161,
162
],
[
161,
163
],
[
139,
164
],
[
164,
165
],
[
101,
166
],
[
166,
167
],
[
99,
168
],
[
168,
169
],
[
99,
170
],
[
170,
171
]
] | [
"import java.util.*;\n\nclass Main {\n public static void main(String args[]) {\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] B = new int[N];\n\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n B[i] = A[i];\n }\n Arrays.sort(B);\n for (int i = 0; i < N; i++) {\n System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }\n System.out.println(bubbleSort(A, N));\n }\n }\n private static int bubbleSort(int[] A, int N) {\n boolean flag = true;\n int ans = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= 1; 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 ans++;\n }\n }\n }\n return ans;\n }\n}",
"import java.util.*;",
"util.*",
"java",
"class Main {\n public static void main(String args[]) {\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] B = new int[N];\n\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n B[i] = A[i];\n }\n Arrays.sort(B);\n for (int i = 0; i < N; i++) {\n System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }\n System.out.println(bubbleSort(A, N));\n }\n }\n private static int bubbleSort(int[] A, int N) {\n boolean flag = true;\n int ans = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= 1; 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 ans++;\n }\n }\n }\n return ans;\n }\n}",
"Main",
"public static void main(String args[]) {\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] B = new int[N];\n\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n B[i] = A[i];\n }\n Arrays.sort(B);\n for (int i = 0; i < N; i++) {\n System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }\n System.out.println(bubbleSort(A, N));\n }\n }",
"main",
"{\n try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] B = new int[N];\n\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n B[i] = A[i];\n }\n Arrays.sort(B);\n for (int i = 0; i < N; i++) {\n System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }\n System.out.println(bubbleSort(A, N));\n }\n }",
"try (Scanner sc = new Scanner(System.in)) {\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] B = new int[N];\n\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n B[i] = A[i];\n }\n Arrays.sort(B);\n for (int i = 0; i < N; i++) {\n System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }\n System.out.println(bubbleSort(A, N));\n }",
"{\n int N = sc.nextInt();\n int[] A = new int[N];\n int[] B = new int[N];\n\n for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n B[i] = A[i];\n }\n Arrays.sort(B);\n for (int i = 0; i < N; i++) {\n System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }\n System.out.println(bubbleSort(A, N));\n }",
"Scanner sc = new Scanner(System.in)",
"Scanner sc = new Scanner(System.in)",
"new Scanner(System.in)",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] A = new int[N];",
"A",
"new int[N]",
"N",
"int[] B = new int[N];",
"B",
"new int[N]",
"N",
"for (int i = 0; i < N; i++) {\n A[i] = sc.nextInt();\n B[i] = A[i];\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n A[i] = sc.nextInt();\n B[i] = A[i];\n }",
"{\n A[i] = sc.nextInt();\n B[i] = A[i];\n }",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"B[i] = A[i]",
"B[i]",
"B",
"i",
"A[i]",
"A",
"i",
"Arrays.sort(B)",
"Arrays.sort",
"Arrays",
"B",
"for (int i = 0; i < N; i++) {\n System.out.print(B[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(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }",
"{\n System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"));\n }",
"System.out.print(B[i] + (i == N-1 ? \"\\n\" : \" \"))",
"System.out.print",
"System.out",
"System",
"System.out",
"B[i] + (i == N-1 ? \"\\n\" : \" \")",
"B[i]",
"B",
"i",
"(i == N-1 ? \"\\n\" : \" \")",
"i == N-1",
"i",
"N-1",
"N",
"1",
"\"\\n\"",
"\" \"",
"System.out.println(bubbleSort(A, N))",
"System.out.println",
"System.out",
"System",
"System.out",
"bubbleSort(A, N)",
"bubbleSort",
"A",
"N",
"String args[]",
"args",
"private static int bubbleSort(int[] A, int N) {\n boolean flag = true;\n int ans = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= 1; 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 ans++;\n }\n }\n }\n return ans;\n }",
"bubbleSort",
"{\n boolean flag = true;\n int ans = 0;\n while (flag) {\n flag = false;\n for (int j = N - 1; j >= 1; 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 ans++;\n }\n }\n }\n return ans;\n }",
"boolean flag = true;",
"flag",
"true",
"int ans = 0;",
"ans",
"0",
"while (flag) {\n flag = false;\n for (int j = N - 1; j >= 1; 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 ans++;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int j = N - 1; j >= 1; 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 ans++;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int j = N - 1; j >= 1; 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 ans++;\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 int tmp = A[j];\n A[j] = A[j-1];\n A[j-1] = tmp;\n flag = true;\n ans++;\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 ans++;\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 ans++;\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 ans++;\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",
"ans++",
"ans",
"return ans;",
"ans",
"int[] A",
"A",
"int N",
"N"
] | import java.util.*;
class Main {
public static void main(String args[]) {
try (Scanner sc = new Scanner(System.in)) {
int N = sc.nextInt();
int[] A = new int[N];
int[] B = new int[N];
for (int i = 0; i < N; i++) {
A[i] = sc.nextInt();
B[i] = A[i];
}
Arrays.sort(B);
for (int i = 0; i < N; i++) {
System.out.print(B[i] + (i == N-1 ? "\n" : " "));
}
System.out.println(bubbleSort(A, N));
}
}
private static int bubbleSort(int[] A, int N) {
boolean flag = true;
int ans = 0;
while (flag) {
flag = false;
for (int j = N - 1; j >= 1; j--) {
if (A[j] < A[j-1]) {
int tmp = A[j];
A[j] = A[j-1];
A[j-1] = tmp;
flag = true;
ans++;
}
}
}
return ans;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
13,
0,
13,
4,
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,
41,
13,
13,
41,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
13,
30,
0,
13,
18,
13,
13,
30,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
14,
2,
13,
13,
3,
4,
13,
13,
4,
18,
18,
13,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
4,
18,
13,
18,
13,
13,
8,
2,
13,
2,
18,
13,
13,
17,
17,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
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,
18,
13,
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
],
[
240,
11
],
[
240,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
18,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
28,
29
],
[
14,
30
],
[
30,
31
],
[
30,
32
],
[
32,
33
],
[
32,
34
],
[
12,
35
],
[
35,
36
],
[
240,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
43,
53
],
[
53,
54
],
[
54,
55
],
[
43,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
57,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
71,
72
],
[
71,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
73,
77
],
[
66,
78
],
[
78,
79
],
[
79,
80
],
[
66,
81
],
[
82,
82
],
[
82,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
83,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
92,
94
],
[
83,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
99,
101
],
[
96,
102
],
[
102,
103
],
[
102,
104
],
[
95,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
105,
109
],
[
95,
110
],
[
110,
111
],
[
57,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
39,
117
],
[
117,
118
],
[
117,
119
],
[
39,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
39,
126
],
[
126,
127
],
[
37,
128
],
[
128,
129
],
[
240,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
139,
140
],
[
138,
141
],
[
132,
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
],
[
160,
161
],
[
159,
162
],
[
162,
163
],
[
162,
164
],
[
157,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
165,
173
],
[
165,
174
],
[
132,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
130,
181
],
[
181,
182
],
[
240,
183
],
[
183,
184
],
[
183,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
185,
189
],
[
189,
190
],
[
189,
191
],
[
191,
192
],
[
192,
193
],
[
191,
194
],
[
194,
195
],
[
195,
196
],
[
185,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
199,
204
],
[
185,
205
],
[
205,
206
],
[
206,
207
],
[
185,
208
],
[
208,
209
],
[
208,
210
],
[
185,
212
],
[
212,
213
],
[
213,
214
],
[
214,
215
],
[
214,
216
],
[
212,
217
],
[
217,
218
],
[
217,
219
],
[
219,
220
],
[
219,
221
],
[
212,
222
],
[
222,
223
],
[
223,
224
],
[
212,
225
],
[
226,
226
],
[
226,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
227,
231
],
[
231,
232
],
[
232,
233
],
[
231,
234
],
[
234,
235
],
[
234,
236
],
[
185,
237
],
[
237,
238
],
[
0,
239
],
[
239,
240
],
[
239,
241
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tint[] seq = null;\n\t\t\n\t\ttry {\n\t\t\tseq = getSequence();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tseq = bubbleSort(seq);\n\t}\n\t\n\tpublic static int[] bubbleSort(int[] seq) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}\n\t\t\n\t\tprintArray(seq);\n\t\tSystem.out.println(count);\n\t\treturn seq;\n\t}\n\t\n\tpublic static void printArray(int[] seq) {\n\t\tStringBuilder p = new StringBuilder();\n\t\tString lb = System.getProperty(\"line.separator\");\n\t\t\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}\n\t\tSystem.out.print(p);\n\t}\n\t\n\tpublic static int[] getSequence() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tfinal int n = Integer.parseInt(reader.readLine());\n\t\tfinal String[] line = reader.readLine().split(\" \");\n\t\treader.close();\n\t\t\n\t\tfinal int[] seq = new int[n];\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\t\n\t\treturn seq;\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\t\n\tpublic static void main(String[] args) {\n\t\tint[] seq = null;\n\t\t\n\t\ttry {\n\t\t\tseq = getSequence();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tseq = bubbleSort(seq);\n\t}\n\t\n\tpublic static int[] bubbleSort(int[] seq) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}\n\t\t\n\t\tprintArray(seq);\n\t\tSystem.out.println(count);\n\t\treturn seq;\n\t}\n\t\n\tpublic static void printArray(int[] seq) {\n\t\tStringBuilder p = new StringBuilder();\n\t\tString lb = System.getProperty(\"line.separator\");\n\t\t\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}\n\t\tSystem.out.print(p);\n\t}\n\t\n\tpublic static int[] getSequence() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tfinal int n = Integer.parseInt(reader.readLine());\n\t\tfinal String[] line = reader.readLine().split(\" \");\n\t\treader.close();\n\t\t\n\t\tfinal int[] seq = new int[n];\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\t\n\t\treturn seq;\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tint[] seq = null;\n\t\t\n\t\ttry {\n\t\t\tseq = getSequence();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tseq = bubbleSort(seq);\n\t}",
"main",
"{\n\t\tint[] seq = null;\n\t\t\n\t\ttry {\n\t\t\tseq = getSequence();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tseq = bubbleSort(seq);\n\t}",
"int[] seq = null;",
"seq",
"null",
"try {\n\t\t\tseq = getSequence();\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\tseq = getSequence();\n\t\t}",
"seq = getSequence()",
"seq",
"getSequence()",
"getSequence",
"seq = bubbleSort(seq)",
"seq",
"bubbleSort(seq)",
"bubbleSort",
"seq",
"String[] args",
"args",
"public static int[] bubbleSort(int[] seq) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}\n\t\t\n\t\tprintArray(seq);\n\t\tSystem.out.println(count);\n\t\treturn seq;\n\t}",
"bubbleSort",
"{\n\t\tint count = 0;\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}\n\t\t\n\t\tprintArray(seq);\n\t\tSystem.out.println(count);\n\t\treturn seq;\n\t}",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < seq.length; i++) {\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < seq.length",
"i",
"seq.length",
"seq",
"seq.length",
"i++",
"i++",
"i",
"{\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}",
"{\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}",
"final int check = count;",
"check",
"count",
"int key = seq[0];",
"key",
"seq[0]",
"seq",
"0",
"for (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"int j = 1;",
"int j = 1;",
"j",
"1",
"j < seq.length-i",
"j",
"seq.length-i",
"seq.length",
"seq",
"seq.length",
"i",
"j++",
"j++",
"j",
"{\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"key <= seq[j]",
"key",
"seq[j]",
"seq",
"j",
"{\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t}",
"key = seq[j]",
"key",
"seq[j]",
"seq",
"j",
"{\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"seq[j-1] = seq[j]",
"seq[j-1]",
"seq",
"j-1",
"j",
"1",
"seq[j]",
"seq",
"j",
"seq[j] = key",
"seq[j]",
"seq",
"j",
"key",
"count++",
"count",
"if (check == count) break;",
"check == count",
"check",
"count",
"break;",
"printArray(seq)",
"printArray",
"seq",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"return seq;",
"seq",
"int[] seq",
"seq",
"public static void printArray(int[] seq) {\n\t\tStringBuilder p = new StringBuilder();\n\t\tString lb = System.getProperty(\"line.separator\");\n\t\t\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}\n\t\tSystem.out.print(p);\n\t}",
"printArray",
"{\n\t\tStringBuilder p = new StringBuilder();\n\t\tString lb = System.getProperty(\"line.separator\");\n\t\t\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}\n\t\tSystem.out.print(p);\n\t}",
"StringBuilder p = new StringBuilder();",
"p",
"new StringBuilder()",
"String lb = System.getProperty(\"line.separator\");",
"lb",
"System.getProperty(\"line.separator\")",
"System.getProperty",
"System",
"\"line.separator\"",
"for (int i = 0; i < seq.length; i++) {\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < seq.length",
"i",
"seq.length",
"seq",
"seq.length",
"i++",
"i++",
"i",
"{\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}",
"{\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}",
"p.append(seq[i]).append(i < seq.length-1 ? \" \" : lb)",
"p.append(seq[i]).append",
"p.append(seq[i])",
"p.append",
"p",
"seq[i]",
"seq",
"i",
"i < seq.length-1 ? \" \" : lb",
"i < seq.length-1",
"i",
"seq.length-1",
"seq.length",
"seq",
"seq.length",
"1",
"\" \"",
"lb",
"System.out.print(p)",
"System.out.print",
"System.out",
"System",
"System.out",
"p",
"int[] seq",
"seq",
"public static int[] getSequence() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tfinal int n = Integer.parseInt(reader.readLine());\n\t\tfinal String[] line = reader.readLine().split(\" \");\n\t\treader.close();\n\t\t\n\t\tfinal int[] seq = new int[n];\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\t\n\t\treturn seq;\n\t}",
"getSequence",
"{\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tfinal int n = Integer.parseInt(reader.readLine());\n\t\tfinal String[] line = reader.readLine().split(\" \");\n\t\treader.close();\n\t\t\n\t\tfinal int[] seq = new int[n];\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\t\n\t\treturn seq;\n\t}",
"BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));",
"reader",
"new BufferedReader(new InputStreamReader(System.in))",
"final int n = Integer.parseInt(reader.readLine());",
"n",
"Integer.parseInt(reader.readLine())",
"Integer.parseInt",
"Integer",
"reader.readLine()",
"reader.readLine",
"reader",
"final String[] line = reader.readLine().split(\" \");",
"line",
"reader.readLine().split(\" \")",
"reader.readLine().split",
"reader.readLine()",
"reader.readLine",
"reader",
"\" \"",
"reader.close()",
"reader.close",
"reader",
"final int[] seq = new int[n];",
"seq",
"new int[n]",
"n",
"for (int i = 0; i < seq.length; i++) {\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < seq.length",
"i",
"seq.length",
"seq",
"seq.length",
"i++",
"i++",
"i",
"{\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}",
"{\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}",
"seq[i] = Integer.parseInt(line[i])",
"seq[i]",
"seq",
"i",
"Integer.parseInt(line[i])",
"Integer.parseInt",
"Integer",
"line[i]",
"line",
"i",
"return seq;",
"seq",
"public class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tint[] seq = null;\n\t\t\n\t\ttry {\n\t\t\tseq = getSequence();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tseq = bubbleSort(seq);\n\t}\n\t\n\tpublic static int[] bubbleSort(int[] seq) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}\n\t\t\n\t\tprintArray(seq);\n\t\tSystem.out.println(count);\n\t\treturn seq;\n\t}\n\t\n\tpublic static void printArray(int[] seq) {\n\t\tStringBuilder p = new StringBuilder();\n\t\tString lb = System.getProperty(\"line.separator\");\n\t\t\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}\n\t\tSystem.out.print(p);\n\t}\n\t\n\tpublic static int[] getSequence() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tfinal int n = Integer.parseInt(reader.readLine());\n\t\tfinal String[] line = reader.readLine().split(\" \");\n\t\treader.close();\n\t\t\n\t\tfinal int[] seq = new int[n];\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\t\n\t\treturn seq;\n\t}\n}",
"public class Main {\n\t\n\tpublic static void main(String[] args) {\n\t\tint[] seq = null;\n\t\t\n\t\ttry {\n\t\t\tseq = getSequence();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\tseq = bubbleSort(seq);\n\t}\n\t\n\tpublic static int[] bubbleSort(int[] seq) {\n\t\tint count = 0;\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tfinal int check = count;\n\t\t\tint key = seq[0];\n\t\t\tfor (int j = 1; j < seq.length-i; j++) {\n\t\t\t\tif (key <= seq[j]) {\n\t\t\t\t\tkey = seq[j];\n\t\t\t\t} else {\n\t\t\t\t\tseq[j-1] = seq[j];\n\t\t\t\t\tseq[j] = key;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (check == count) break;\n\t\t}\n\t\t\n\t\tprintArray(seq);\n\t\tSystem.out.println(count);\n\t\treturn seq;\n\t}\n\t\n\tpublic static void printArray(int[] seq) {\n\t\tStringBuilder p = new StringBuilder();\n\t\tString lb = System.getProperty(\"line.separator\");\n\t\t\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tp.append(seq[i]).append(i < seq.length-1 ? \" \" : lb);\n\t\t}\n\t\tSystem.out.print(p);\n\t}\n\t\n\tpublic static int[] getSequence() throws IOException {\n\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(System.in));\n\t\tfinal int n = Integer.parseInt(reader.readLine());\n\t\tfinal String[] line = reader.readLine().split(\" \");\n\t\treader.close();\n\t\t\n\t\tfinal int[] seq = new int[n];\n\t\tfor (int i = 0; i < seq.length; i++) {\n\t\t\tseq[i] = Integer.parseInt(line[i]);\n\t\t}\n\t\t\n\t\treturn seq;\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) {
int[] seq = null;
try {
seq = getSequence();
} catch (IOException e) {
e.printStackTrace();
}
seq = bubbleSort(seq);
}
public static int[] bubbleSort(int[] seq) {
int count = 0;
for (int i = 0; i < seq.length; i++) {
final int check = count;
int key = seq[0];
for (int j = 1; j < seq.length-i; j++) {
if (key <= seq[j]) {
key = seq[j];
} else {
seq[j-1] = seq[j];
seq[j] = key;
count++;
}
}
if (check == count) break;
}
printArray(seq);
System.out.println(count);
return seq;
}
public static void printArray(int[] seq) {
StringBuilder p = new StringBuilder();
String lb = System.getProperty("line.separator");
for (int i = 0; i < seq.length; i++) {
p.append(seq[i]).append(i < seq.length-1 ? " " : lb);
}
System.out.print(p);
}
public static int[] getSequence() throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
final int n = Integer.parseInt(reader.readLine());
final String[] line = reader.readLine().split(" ");
reader.close();
final int[] seq = new int[n];
for (int i = 0; i < seq.length; i++) {
seq[i] = Integer.parseInt(line[i]);
}
return seq;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
41,
13,
41,
13,
17,
11,
1,
0,
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,
0,
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,
2,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
17,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
158,
5
],
[
158,
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
],
[
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
],
[
48,
53
],
[
53,
54
],
[
53,
55
],
[
48,
56
],
[
56,
57
],
[
57,
58
],
[
48,
59
],
[
60,
60
],
[
60,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
61,
68
],
[
68,
69
],
[
68,
70
],
[
61,
71
],
[
71,
72
],
[
72,
73
],
[
61,
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
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
8,
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
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
126,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
137,
138
],
[
137,
139
],
[
126,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
140,
146
],
[
146,
147
],
[
146,
148
],
[
8,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
6,
155
],
[
155,
156
],
[
0,
157
],
[
157,
158
],
[
157,
159
]
] | [
"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[] num = new int[n];\n int i;\n int j;\n int count=0;\n for(i=0;i<n;i++){\n num[i]=sc.nextInt();\n }\n for(int k=0;k<n;k++) {\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }\n for(i=0;i<n;i++) {\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[i]);\n\n }\n System.out.println(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[] num = new int[n];\n int i;\n int j;\n int count=0;\n for(i=0;i<n;i++){\n num[i]=sc.nextInt();\n }\n for(int k=0;k<n;k++) {\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }\n for(i=0;i<n;i++) {\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[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[] num = new int[n];\n int i;\n int j;\n int count=0;\n for(i=0;i<n;i++){\n num[i]=sc.nextInt();\n }\n for(int k=0;k<n;k++) {\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }\n for(i=0;i<n;i++) {\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[i]);\n\n }\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] num = new int[n];\n int i;\n int j;\n int count=0;\n for(i=0;i<n;i++){\n num[i]=sc.nextInt();\n }\n for(int k=0;k<n;k++) {\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }\n for(i=0;i<n;i++) {\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[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[] num = new int[n];",
"num",
"new int[n]",
"n",
"int i;",
"i",
"int j;",
"j",
"int count=0;",
"count",
"0",
"for(i=0;i<n;i++){\n num[i]=sc.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"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 k=0;k<n;k++) {\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<n",
"k",
"n",
"k++",
"k++",
"k",
"{\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }",
"{\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }",
"for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }",
"j = n - 1;",
"j = n - 1",
"j",
"n - 1",
"n",
"1",
"j > 0",
"j",
"0",
"j--",
"j--",
"j",
"{\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }",
"{\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }",
"if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }",
"num[j]<num[j-1]",
"num[j]",
"num",
"j",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"{\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }",
"int a = num[j];",
"a",
"num[j]",
"num",
"j",
"num[j] = num[j - 1]",
"num[j]",
"num",
"j",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"num[j - 1] = a",
"num[j - 1]",
"num",
"j - 1",
"j",
"1",
"a",
"count=count+1",
"count",
"count+1",
"count",
"1",
"for(i=0;i<n;i++) {\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[i]);\n\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[i]);\n\n }",
"{\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[i]);\n\n }",
"if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[i]);",
"i==n-1",
"i",
"n-1",
"n",
"1",
"System.out.println(num[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"num[i]",
"num",
"i",
"System.out.printf(\"%d \",num[i])",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"%d \"",
"num[i]",
"num",
"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[] num = new int[n];\n int i;\n int j;\n int count=0;\n for(i=0;i<n;i++){\n num[i]=sc.nextInt();\n }\n for(int k=0;k<n;k++) {\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }\n for(i=0;i<n;i++) {\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[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[] num = new int[n];\n int i;\n int j;\n int count=0;\n for(i=0;i<n;i++){\n num[i]=sc.nextInt();\n }\n for(int k=0;k<n;k++) {\n for (j = n - 1; j > 0; j--) {\n\n if(num[j]<num[j-1]) {\n int a = num[j];\n num[j] = num[j - 1];\n num[j - 1] = a;\n count=count+1;\n }\n }\n }\n for(i=0;i<n;i++) {\n if(i==n-1) System.out.println(num[i]);\n else System.out.printf(\"%d \",num[i]);\n\n }\n System.out.println(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[] num = new int[n];
int i;
int j;
int count=0;
for(i=0;i<n;i++){
num[i]=sc.nextInt();
}
for(int k=0;k<n;k++) {
for (j = n - 1; j > 0; j--) {
if(num[j]<num[j-1]) {
int a = num[j];
num[j] = num[j - 1];
num[j - 1] = a;
count=count+1;
}
}
}
for(i=0;i<n;i++) {
if(i==n-1) System.out.println(num[i]);
else System.out.printf("%d ",num[i]);
}
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,
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,
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,
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
],
[
161,
5
],
[
161,
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
],
[
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
],
[
41,
44
],
[
44,
45
],
[
45,
46
],
[
8,
47
],
[
47,
48
],
[
47,
49
],
[
8,
50
],
[
50,
51
],
[
50,
52
],
[
8,
53
],
[
53,
54
],
[
53,
55
],
[
8,
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
],
[
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
],
[
87,
111
],
[
111,
112
],
[
111,
113
],
[
8,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
114,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
129,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
8,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
8,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
6,
158
],
[
158,
159
],
[
0,
160
],
[
160,
161
],
[
160,
162
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = Integer.valueOf(scan.next());\n int[] ns = new int[n];\n for(int i=0;i<n;i++) {\n \tns[i] = Integer.valueOf(scan.next());\n }\n boolean fg = true;\n int change = 0;\n int cnt=0;\n while(fg) {\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }\n for(int i=0;i<n-1;i++) {\n \tSystem.out.print(ns[i]+\" \");\n }\n System.out.println(ns[n-1]);\n System.out.println(cnt);\n scan.close();\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = Integer.valueOf(scan.next());\n int[] ns = new int[n];\n for(int i=0;i<n;i++) {\n \tns[i] = Integer.valueOf(scan.next());\n }\n boolean fg = true;\n int change = 0;\n int cnt=0;\n while(fg) {\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }\n for(int i=0;i<n-1;i++) {\n \tSystem.out.print(ns[i]+\" \");\n }\n System.out.println(ns[n-1]);\n System.out.println(cnt);\n scan.close();\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = Integer.valueOf(scan.next());\n int[] ns = new int[n];\n for(int i=0;i<n;i++) {\n \tns[i] = Integer.valueOf(scan.next());\n }\n boolean fg = true;\n int change = 0;\n int cnt=0;\n while(fg) {\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }\n for(int i=0;i<n-1;i++) {\n \tSystem.out.print(ns[i]+\" \");\n }\n System.out.println(ns[n-1]);\n System.out.println(cnt);\n scan.close();\n }",
"main",
"{\n Scanner scan = new Scanner(System.in);\n int n = Integer.valueOf(scan.next());\n int[] ns = new int[n];\n for(int i=0;i<n;i++) {\n \tns[i] = Integer.valueOf(scan.next());\n }\n boolean fg = true;\n int change = 0;\n int cnt=0;\n while(fg) {\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }\n for(int i=0;i<n-1;i++) {\n \tSystem.out.print(ns[i]+\" \");\n }\n System.out.println(ns[n-1]);\n System.out.println(cnt);\n scan.close();\n }",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = Integer.valueOf(scan.next());",
"n",
"Integer.valueOf(scan.next())",
"Integer.valueOf",
"Integer",
"scan.next()",
"scan.next",
"scan",
"int[] ns = new int[n];",
"ns",
"new int[n]",
"n",
"for(int i=0;i<n;i++) {\n \tns[i] = Integer.valueOf(scan.next());\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n \tns[i] = Integer.valueOf(scan.next());\n }",
"{\n \tns[i] = Integer.valueOf(scan.next());\n }",
"ns[i] = Integer.valueOf(scan.next())",
"ns[i]",
"ns",
"i",
"Integer.valueOf(scan.next())",
"Integer.valueOf",
"Integer",
"scan.next()",
"scan.next",
"scan",
"boolean fg = true;",
"fg",
"true",
"int change = 0;",
"change",
"0",
"int cnt=0;",
"cnt",
"0",
"while(fg) {\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }",
"fg",
"{\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }",
"fg = false",
"fg",
"false",
"for(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}",
"int i=n-1;",
"int i=n-1;",
"i",
"n-1",
"n",
"1",
"i>0",
"i",
"0",
"i--",
"i--",
"i",
"{\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}",
"{\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}",
"if(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}",
"ns[i] < ns[i-1]",
"ns[i]",
"ns",
"i",
"ns[i-1]",
"ns",
"i-1",
"i",
"1",
"{\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}",
"change = ns[i]",
"change",
"ns[i]",
"ns",
"i",
"ns[i] = ns[i-1]",
"ns[i]",
"ns",
"i",
"ns[i-1]",
"ns",
"i-1",
"i",
"1",
"ns[i-1] = change",
"ns[i-1]",
"ns",
"i-1",
"i",
"1",
"change",
"cnt++",
"cnt",
"fg=true",
"fg",
"true",
"for(int i=0;i<n-1;i++) {\n \tSystem.out.print(ns[i]+\" \");\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"{\n \tSystem.out.print(ns[i]+\" \");\n }",
"{\n \tSystem.out.print(ns[i]+\" \");\n }",
"System.out.print(ns[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"ns[i]+\" \"",
"ns[i]",
"ns",
"i",
"\" \"",
"System.out.println(ns[n-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"ns[n-1]",
"ns",
"n-1",
"n",
"1",
"System.out.println(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = Integer.valueOf(scan.next());\n int[] ns = new int[n];\n for(int i=0;i<n;i++) {\n \tns[i] = Integer.valueOf(scan.next());\n }\n boolean fg = true;\n int change = 0;\n int cnt=0;\n while(fg) {\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }\n for(int i=0;i<n-1;i++) {\n \tSystem.out.print(ns[i]+\" \");\n }\n System.out.println(ns[n-1]);\n System.out.println(cnt);\n scan.close();\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner scan = new Scanner(System.in);\n int n = Integer.valueOf(scan.next());\n int[] ns = new int[n];\n for(int i=0;i<n;i++) {\n \tns[i] = Integer.valueOf(scan.next());\n }\n boolean fg = true;\n int change = 0;\n int cnt=0;\n while(fg) {\n \tfg = false;\n \tfor(int i=n-1;i>0;i--) {\n \t\tif(ns[i] < ns[i-1]) {\n \t\t\tchange = ns[i];\n \t\t\tns[i] = ns[i-1];\n \t\t\tns[i-1] = change;\n \t\t\tcnt++;\n \t\t\tfg=true;\n \t\t}\n \t}\n }\n for(int i=0;i<n-1;i++) {\n \tSystem.out.print(ns[i]+\" \");\n }\n System.out.println(ns[n-1]);\n System.out.println(cnt);\n scan.close();\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = Integer.valueOf(scan.next());
int[] ns = new int[n];
for(int i=0;i<n;i++) {
ns[i] = Integer.valueOf(scan.next());
}
boolean fg = true;
int change = 0;
int cnt=0;
while(fg) {
fg = false;
for(int i=n-1;i>0;i--) {
if(ns[i] < ns[i-1]) {
change = ns[i];
ns[i] = ns[i-1];
ns[i-1] = change;
cnt++;
fg=true;
}
}
}
for(int i=0;i<n-1;i++) {
System.out.print(ns[i]+" ");
}
System.out.println(ns[n-1]);
System.out.println(cnt);
scan.close();
}
}
|
[
7,
15,
13,
17,
6,
13,
41,
13,
12,
13,
30,
41,
13,
17,
41,
13,
20,
41,
13,
20,
41,
13,
4,
18,
13,
0,
13,
20,
13,
42,
2,
13,
13,
30,
0,
18,
13,
40,
13,
4,
18,
13,
41,
13,
17,
0,
13,
4,
18,
13,
13,
4,
18,
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,
2,
13,
17,
40,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
17,
41,
13,
17,
0,
13,
18,
13,
13,
0,
13,
18,
13,
13,
0,
18,
13,
13,
13,
0,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
42,
17,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
40,
13,
14,
2,
13,
13,
3,
4,
18,
18,
13,
13,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
6,
7
],
[
4,
8
],
[
8,
9
],
[
8,
10
],
[
10,
11
],
[
11,
12
],
[
11,
13
],
[
10,
14
],
[
14,
15
],
[
14,
16
],
[
10,
17
],
[
17,
18
],
[
17,
19
],
[
10,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
10,
25
],
[
25,
26
],
[
25,
27
],
[
10,
29
],
[
29,
30
],
[
30,
31
],
[
30,
32
],
[
29,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
34,
39
],
[
39,
40
],
[
40,
41
],
[
10,
42
],
[
42,
43
],
[
42,
44
],
[
10,
45
],
[
45,
46
],
[
45,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
10,
51
],
[
51,
52
],
[
52,
53
],
[
51,
54
],
[
10,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
8,
61
],
[
61,
62
],
[
4,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
69,
79
],
[
79,
80
],
[
80,
81
],
[
69,
82
],
[
83,
83
],
[
83,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
84,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
84,
98
],
[
98,
99
],
[
99,
100
],
[
84,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
114,
117
],
[
117,
118
],
[
117,
119
],
[
113,
120
],
[
120,
121
],
[
65,
122
],
[
122,
123
],
[
63,
124
],
[
124,
125
],
[
4,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
132,
133
],
[
132,
134
],
[
128,
135
],
[
135,
136
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
128,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
128,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
128,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
126,
155
],
[
155,
156
],
[
126,
157
],
[
157,
158
],
[
4,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
162,
163
],
[
162,
164
],
[
161,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
169,
170
],
[
169,
171
],
[
168,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
172,
177
],
[
167,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
178,
183
],
[
183,
184
],
[
183,
185
],
[
167,
186
],
[
186,
187
],
[
167,
188
],
[
188,
189
],
[
189,
190
],
[
189,
191
],
[
188,
192
],
[
161,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
159,
198
],
[
198,
199
]
] | [
"import java.util.Scanner;\nclass Main{\n \n static int[] A;\n\n public static void main(String[] args){\n\tint i = 0;\n\tMain bubble = new Main();\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tA = new int[n];\n\t\n\twhile(i<n){\n\t A[i++] = scan.nextInt();\n\t //\t i++;\n\t}\n\tint count = 0;\n\tcount = bubble.bubblesort(A);\n\tbubble.call(n);\n\tSystem.out.println(count);\n }\n \n\n\n public int bubblesort(int[] A){\n\tint count =0;\n\tfor(int i = 0;i<A.length ;i++){\n\n\t for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }\n\t}\n\treturn count;\n\t\n }\n\n public void swap(int x,int y){\n\tint m = 0;\n\tint n = 0;\n\tm = A[x];\n\tn = A[y];\n\tA[x] = n;\n\tA[y] = m;\n\n }\n\n public void call(int n){\n\tint i =0;\n\twhile(true){\n\t if(i!=0) System.out.print(\" \");\n\t System.out.print(A[i]);\n\t i++;\n\t if(i==n)break;\n\t}\n\tSystem.out.println();\n }\n \n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n \n static int[] A;\n\n public static void main(String[] args){\n\tint i = 0;\n\tMain bubble = new Main();\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tA = new int[n];\n\t\n\twhile(i<n){\n\t A[i++] = scan.nextInt();\n\t //\t i++;\n\t}\n\tint count = 0;\n\tcount = bubble.bubblesort(A);\n\tbubble.call(n);\n\tSystem.out.println(count);\n }\n \n\n\n public int bubblesort(int[] A){\n\tint count =0;\n\tfor(int i = 0;i<A.length ;i++){\n\n\t for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }\n\t}\n\treturn count;\n\t\n }\n\n public void swap(int x,int y){\n\tint m = 0;\n\tint n = 0;\n\tm = A[x];\n\tn = A[y];\n\tA[x] = n;\n\tA[y] = m;\n\n }\n\n public void call(int n){\n\tint i =0;\n\twhile(true){\n\t if(i!=0) System.out.print(\" \");\n\t System.out.print(A[i]);\n\t i++;\n\t if(i==n)break;\n\t}\n\tSystem.out.println();\n }\n \n\n}",
"Main",
"static int[] A;",
"A",
"public static void main(String[] args){\n\tint i = 0;\n\tMain bubble = new Main();\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tA = new int[n];\n\t\n\twhile(i<n){\n\t A[i++] = scan.nextInt();\n\t //\t i++;\n\t}\n\tint count = 0;\n\tcount = bubble.bubblesort(A);\n\tbubble.call(n);\n\tSystem.out.println(count);\n }",
"main",
"{\n\tint i = 0;\n\tMain bubble = new Main();\n\tScanner scan = new Scanner(System.in);\n\tint n = scan.nextInt();\n\tA = new int[n];\n\t\n\twhile(i<n){\n\t A[i++] = scan.nextInt();\n\t //\t i++;\n\t}\n\tint count = 0;\n\tcount = bubble.bubblesort(A);\n\tbubble.call(n);\n\tSystem.out.println(count);\n }",
"int i = 0;",
"i",
"0",
"Main bubble = new Main();",
"bubble",
"new Main()",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int n = scan.nextInt();",
"n",
"scan.nextInt()",
"scan.nextInt",
"scan",
"A = new int[n]",
"A",
"new int[n]",
"n",
"while(i<n){\n\t A[i++] = scan.nextInt();\n\t //\t i++;\n\t}",
"i<n",
"i",
"n",
"{\n\t A[i++] = scan.nextInt();\n\t //\t i++;\n\t}",
"A[i++] = scan.nextInt()",
"A[i++]",
"A",
"i++",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int count = 0;",
"count",
"0",
"count = bubble.bubblesort(A)",
"count",
"bubble.bubblesort(A)",
"bubble.bubblesort",
"bubble",
"A",
"bubble.call(n)",
"bubble.call",
"bubble",
"n",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public int bubblesort(int[] A){\n\tint count =0;\n\tfor(int i = 0;i<A.length ;i++){\n\n\t for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }\n\t}\n\treturn count;\n\t\n }",
"bubblesort",
"{\n\tint count =0;\n\tfor(int i = 0;i<A.length ;i++){\n\n\t for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }\n\t}\n\treturn count;\n\t\n }",
"int count =0;",
"count",
"0",
"for(int i = 0;i<A.length ;i++){\n\n\t for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n\n\t for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }\n\t}",
"{\n\n\t for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }\n\t}",
"for(int j = A.length-1;j >=i+1;j--){\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\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\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }",
"{\n\t\tif(A[j]<A[j-1]){\n\t\t swap(j,j-1);\n\t\t count++;\n\t\t}\n\t }",
"if(A[j]<A[j-1]){\n\t\t swap(j,j-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 swap(j,j-1);\n\t\t count++;\n\t\t}",
"swap(j,j-1)",
"swap",
"j",
"j-1",
"j",
"1",
"count++",
"count",
"return count;",
"count",
"int[] A",
"A",
"public void swap(int x,int y){\n\tint m = 0;\n\tint n = 0;\n\tm = A[x];\n\tn = A[y];\n\tA[x] = n;\n\tA[y] = m;\n\n }",
"swap",
"{\n\tint m = 0;\n\tint n = 0;\n\tm = A[x];\n\tn = A[y];\n\tA[x] = n;\n\tA[y] = m;\n\n }",
"int m = 0;",
"m",
"0",
"int n = 0;",
"n",
"0",
"m = A[x]",
"m",
"A[x]",
"A",
"x",
"n = A[y]",
"n",
"A[y]",
"A",
"y",
"A[x] = n",
"A[x]",
"A",
"x",
"n",
"A[y] = m",
"A[y]",
"A",
"y",
"m",
"int x",
"x",
"int y",
"y",
"public void call(int n){\n\tint i =0;\n\twhile(true){\n\t if(i!=0) System.out.print(\" \");\n\t System.out.print(A[i]);\n\t i++;\n\t if(i==n)break;\n\t}\n\tSystem.out.println();\n }",
"call",
"{\n\tint i =0;\n\twhile(true){\n\t if(i!=0) System.out.print(\" \");\n\t System.out.print(A[i]);\n\t i++;\n\t if(i==n)break;\n\t}\n\tSystem.out.println();\n }",
"int i =0;",
"i",
"0",
"while(true){\n\t if(i!=0) System.out.print(\" \");\n\t System.out.print(A[i]);\n\t i++;\n\t if(i==n)break;\n\t}",
"true",
"{\n\t if(i!=0) System.out.print(\" \");\n\t System.out.print(A[i]);\n\t i++;\n\t if(i==n)break;\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(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"i++",
"i",
"if(i==n)break;",
"i==n",
"i",
"n",
"break;",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int n",
"n"
] | import java.util.Scanner;
class Main{
static int[] A;
public static void main(String[] args){
int i = 0;
Main bubble = new Main();
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
A = new int[n];
while(i<n){
A[i++] = scan.nextInt();
// i++;
}
int count = 0;
count = bubble.bubblesort(A);
bubble.call(n);
System.out.println(count);
}
public int bubblesort(int[] A){
int count =0;
for(int i = 0;i<A.length ;i++){
for(int j = A.length-1;j >=i+1;j--){
if(A[j]<A[j-1]){
swap(j,j-1);
count++;
}
}
}
return count;
}
public void swap(int x,int y){
int m = 0;
int n = 0;
m = A[x];
n = A[y];
A[x] = n;
A[y] = m;
}
public void call(int n){
int i =0;
while(true){
if(i!=0) System.out.print(" ");
System.out.print(A[i]);
i++;
if(i==n)break;
}
System.out.println();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
4,
18,
20,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
4,
18,
4,
18,
13,
17,
18,
13,
13,
29,
4,
18,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
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,
4,
18,
18,
13,
13,
4,
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
],
[
14,
15
],
[
15,
16
],
[
14,
17
],
[
17,
18
],
[
17,
19
],
[
11,
20
],
[
20,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
20,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
27,
29
],
[
20,
30
],
[
30,
31
],
[
31,
32
],
[
20,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
36,
39
],
[
34,
40
],
[
40,
41
],
[
40,
42
],
[
11,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
9,
47
],
[
47,
48
],
[
7,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
51,
60
],
[
60,
61
],
[
60,
62
],
[
51,
64
],
[
64,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
64,
69
],
[
69,
70
],
[
69,
71
],
[
64,
72
],
[
72,
73
],
[
73,
74
],
[
64,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
80,
81
],
[
81,
82
],
[
51,
83
],
[
83,
84
],
[
83,
85
],
[
51,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
91,
93
],
[
86,
94
],
[
94,
95
],
[
95,
96
],
[
86,
97
],
[
98,
98
],
[
98,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
99,
106
],
[
106,
107
],
[
106,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
99,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
115,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
132,
138
],
[
138,
139
],
[
138,
140
],
[
124,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
124,
146
],
[
146,
147
],
[
51,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
153,
154
],
[
153,
155
],
[
51,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
49,
162
],
[
162,
163
]
] | [
"import java.util.Scanner;\nimport java.lang.StringBuilder;\n\nclass Main {\n\n\n private static String toString(int[] numbers){\n StringBuilder ans = new StringBuilder().append(numbers[0]);\n for (int x = 1; x < numbers.length; x++)\n ans.append(\" \").append(numbers[x]);\n return ans.toString();\n }\n\n public static void main(String[] args) {\n\n\n\n Scanner sc = new Scanner(System.in);\n\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\n int count = 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 int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }\n }\n\n System.out.println(toString(A));\n System.out.println(count);\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.lang.StringBuilder;",
"StringBuilder",
"java.lang",
"class Main {\n\n\n private static String toString(int[] numbers){\n StringBuilder ans = new StringBuilder().append(numbers[0]);\n for (int x = 1; x < numbers.length; x++)\n ans.append(\" \").append(numbers[x]);\n return ans.toString();\n }\n\n public static void main(String[] args) {\n\n\n\n Scanner sc = new Scanner(System.in);\n\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\n int count = 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 int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }\n }\n\n System.out.println(toString(A));\n System.out.println(count);\n }\n}",
"Main",
"private static String toString(int[] numbers){\n StringBuilder ans = new StringBuilder().append(numbers[0]);\n for (int x = 1; x < numbers.length; x++)\n ans.append(\" \").append(numbers[x]);\n return ans.toString();\n }",
"toString",
"{\n StringBuilder ans = new StringBuilder().append(numbers[0]);\n for (int x = 1; x < numbers.length; x++)\n ans.append(\" \").append(numbers[x]);\n return ans.toString();\n }",
"StringBuilder ans = new StringBuilder().append(numbers[0]);",
"ans",
"new StringBuilder().append(numbers[0])",
"new StringBuilder().append",
"new StringBuilder()",
"numbers[0]",
"numbers",
"0",
"for (int x = 1; x < numbers.length; x++)\n ans.append(\" \").append(numbers[x]);",
"int x = 1;",
"int x = 1;",
"x",
"1",
"x < numbers.length",
"x",
"numbers.length",
"numbers",
"numbers.length",
"x++",
"x++",
"x",
"ans.append(\" \").append(numbers[x]);",
"ans.append(\" \").append(numbers[x])",
"ans.append(\" \").append",
"ans.append(\" \")",
"ans.append",
"ans",
"\" \"",
"numbers[x]",
"numbers",
"x",
"return ans.toString();",
"ans.toString()",
"ans.toString",
"ans",
"int[] numbers",
"numbers",
"public static void main(String[] args) {\n\n\n\n Scanner sc = new Scanner(System.in);\n\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\n int count = 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 int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }\n }\n\n System.out.println(toString(A));\n System.out.println(count);\n }",
"main",
"{\n\n\n\n Scanner sc = new Scanner(System.in);\n\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\n int count = 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 int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }\n }\n\n System.out.println(toString(A));\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();",
"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 count = 0;",
"count",
"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 int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\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 int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }\n }",
"{\n for (int j = n-1; j > i; j--) {\n if(A[j] < A[j-1]){\n int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }\n }",
"for (int j = n-1; j > i; j--) {\n if(A[j] < A[j-1]){\n int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\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 temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }",
"{\n if(A[j] < A[j-1]){\n int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }\n\n }",
"if(A[j] < A[j-1]){\n int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }",
"A[j] < A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n int temp = A[j-1];\n A[j-1] = A[j];\n A[j] = temp;\n count++;\n }",
"int temp = A[j-1];",
"temp",
"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] = temp",
"A[j]",
"A",
"j",
"temp",
"count++",
"count",
"System.out.println(toString(A))",
"System.out.println",
"System.out",
"System",
"System.out",
"toString(A)",
"toString",
"A",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.util.Scanner;
import java.lang.StringBuilder;
class Main {
private static String toString(int[] numbers){
StringBuilder ans = new StringBuilder().append(numbers[0]);
for (int x = 1; x < numbers.length; x++)
ans.append(" ").append(numbers[x]);
return ans.toString();
}
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;
for (int i = 0; i < n; i++) {
for (int j = n-1; j > i; j--) {
if(A[j] < A[j-1]){
int temp = A[j-1];
A[j-1] = A[j];
A[j] = temp;
count++;
}
}
}
System.out.println(toString(A));
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,
41,
13,
17,
11,
1,
41,
13,
13,
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,
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,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
13,
23,
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
],
[
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
],
[
166,
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
],
[
64,
66
],
[
60,
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
],
[
83,
89
],
[
89,
90
],
[
89,
91
],
[
82,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
92,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
100,
106
],
[
106,
107
],
[
106,
108
],
[
92,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
92,
114
],
[
114,
115
],
[
92,
116
],
[
116,
117
],
[
116,
118
],
[
60,
119
],
[
119,
120
],
[
49,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
126,
127
],
[
126,
128
],
[
121,
129
],
[
129,
130
],
[
130,
131
],
[
121,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
139,
141
],
[
133,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
142,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
49,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
154,
159
],
[
154,
160
],
[
47,
161
],
[
161,
162
],
[
47,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\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\tpublic static void bubbleSort(int[] A,int N){\n\t\tint flag = 1,count=0;\n\t\twhile(flag==1){\n\t\t\tflag = 0;\n\t\t\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i!=N-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",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 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\tpublic static void bubbleSort(int[] A,int N){\n\t\tint flag = 1,count=0;\n\t\twhile(flag==1){\n\t\t\tflag = 0;\n\t\t\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i!=N-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",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}",
"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,count=0;\n\t\twhile(flag==1){\n\t\t\tflag = 0;\n\t\t\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i!=N-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\t}",
"bubbleSort",
"{\n\t\tint flag = 1,count=0;\n\t\twhile(flag==1){\n\t\t\tflag = 0;\n\t\t\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i!=N-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",count);\n\t}",
"int flag = 1",
"flag",
"1",
"count=0;",
"count",
"0",
"while(flag==1){\n\t\t\tflag = 0;\n\t\t\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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",
"int i=0;",
"i",
"0",
"for(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}",
"int j=i;",
"int j=i;",
"j",
"i",
"j<N-1",
"j",
"N-1",
"N",
"1",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}\n\t\t\t}",
"if(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\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 c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\n\t\t\t\t\tcount++;\n\t\t\t\t\tflag = 1;\n\t\t\t\t}",
"int c = A[j+1];",
"c",
"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] = c",
"A[j]",
"A",
"j",
"c",
"count++",
"count",
"flag = 1",
"flag",
"1",
"i++",
"i",
"for(int i=0;i<N;i++){\n\t\t\tSystem.out.print(A[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[i]);\n\t\t\tif(i!=N-1)System.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(A[i]);\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.printf(\"\\n%d\\n\",count)",
"System.out.printf",
"System.out",
"System",
"System.out",
"\"\\n%d\\n\"",
"count",
"int[] A",
"A",
"int N",
"N",
"public class Main{\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\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\tpublic static void bubbleSort(int[] A,int N){\n\t\tint flag = 1,count=0;\n\t\twhile(flag==1){\n\t\t\tflag = 0;\n\t\t\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i!=N-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",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 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\tpublic static void bubbleSort(int[] A,int N){\n\t\tint flag = 1,count=0;\n\t\twhile(flag==1){\n\t\t\tflag = 0;\n\t\t\tint i=0;\n\t\t\tfor(int j=i;j<N-1;j++){\n\t\t\t\tif(A[j+1]<A[j]){\n\t\t\t\t\tint c = A[j+1];\n\t\t\t\t\tA[j+1] = A[j];\n\t\t\t\t\tA[j] = c;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tSystem.out.print(A[i]);\n\t\t\tif(i!=N-1)System.out.print(\" \");\n\t\t}\n\t\tSystem.out.printf(\"\\n%d\\n\",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);
}
public static void bubbleSort(int[] A,int N){
int flag = 1,count=0;
while(flag==1){
flag = 0;
int i=0;
for(int j=i;j<N-1;j++){
if(A[j+1]<A[j]){
int c = A[j+1];
A[j+1] = A[j];
A[j] = c;
count++;
flag = 1;
}
}
i++;
}
for(int i=0;i<N;i++){
System.out.print(A[i]);
if(i!=N-1)System.out.print(" ");
}
System.out.printf("\n%d\n",count);
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
13,
4,
18,
13,
41,
13,
4,
13,
4,
18,
13,
4,
13,
4,
18,
13,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
18,
13,
13,
13,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
17,
29,
4,
18,
18,
13,
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,
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,
4,
18,
18,
13,
13,
13,
23,
13,
23,
13,
12,
13,
30,
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,
4,
18,
18,
13,
13,
4,
18,
13,
17,
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,
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,
4,
18,
13,
17,
41,
13,
18,
13,
13,
41,
13,
20,
13,
42,
2,
40,
13,
17,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
17,
41,
13,
18,
13,
13,
41,
13,
20,
13,
42,
2,
40,
13,
17,
30,
0,
18,
13,
13,
4,
18,
13,
18,
13,
13,
29,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
12,
13,
30,
29,
4,
18,
13,
13,
23,
13,
6,
13,
41,
13,
17,
41,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
40,
13,
0,
18,
36,
13,
13,
0,
18,
36,
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
],
[
382,
11
],
[
382,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
14,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
32,
37
],
[
12,
38
],
[
38,
39
],
[
382,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
45,
46
],
[
45,
47
],
[
43,
48
],
[
48,
49
],
[
48,
50
],
[
50,
51
],
[
50,
52
],
[
43,
53
],
[
53,
54
],
[
54,
55
],
[
43,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
64
],
[
59,
65
],
[
65,
66
],
[
66,
67
],
[
66,
68
],
[
65,
69
],
[
58,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
71,
76
],
[
70,
77
],
[
42,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
40,
84
],
[
84,
85
],
[
40,
86
],
[
86,
87
],
[
382,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
94,
95
],
[
94,
96
],
[
90,
97
],
[
97,
98
],
[
97,
99
],
[
99,
100
],
[
100,
101
],
[
100,
102
],
[
99,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
103,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
103,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
119,
123
],
[
123,
124
],
[
123,
125
],
[
125,
126
],
[
125,
127
],
[
118,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
129,
132
],
[
129,
133
],
[
133,
134
],
[
133,
135
],
[
128,
136
],
[
136,
137
],
[
128,
138
],
[
138,
139
],
[
138,
140
],
[
90,
141
],
[
141,
142
],
[
141,
143
],
[
90,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
88,
150
],
[
150,
151
],
[
88,
152
],
[
152,
153
],
[
382,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
156,
162
],
[
162,
163
],
[
162,
164
],
[
156,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
171,
172
],
[
171,
173
],
[
166,
174
],
[
174,
175
],
[
175,
176
],
[
166,
177
],
[
178,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
183,
186
],
[
186,
187
],
[
186,
188
],
[
156,
189
],
[
189,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
189,
194
],
[
194,
195
],
[
195,
196
],
[
194,
197
],
[
194,
198
],
[
154,
199
],
[
199,
200
],
[
382,
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
],
[
382,
227
],
[
227,
228
],
[
227,
229
],
[
229,
230
],
[
230,
231
],
[
230,
232
],
[
232,
233
],
[
232,
234
],
[
229,
235
],
[
235,
236
],
[
236,
237
],
[
236,
238
],
[
235,
239
],
[
239,
240
],
[
239,
241
],
[
229,
242
],
[
242,
243
],
[
243,
244
],
[
243,
245
],
[
242,
246
],
[
227,
247
],
[
247,
248
],
[
227,
249
],
[
249,
250
],
[
227,
251
],
[
251,
252
],
[
382,
253
],
[
253,
254
],
[
253,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
258,
259
],
[
259,
260
],
[
258,
261
],
[
255,
262
],
[
262,
263
],
[
262,
264
],
[
264,
265
],
[
264,
266
],
[
255,
267
],
[
267,
268
],
[
267,
269
],
[
255,
271
],
[
271,
272
],
[
272,
273
],
[
273,
274
],
[
272,
275
],
[
271,
276
],
[
276,
277
],
[
277,
278
],
[
278,
279
],
[
278,
280
],
[
277,
281
],
[
281,
282
],
[
282,
283
],
[
281,
284
],
[
284,
285
],
[
284,
286
],
[
255,
287
],
[
287,
288
],
[
253,
289
],
[
289,
290
],
[
382,
291
],
[
291,
292
],
[
291,
293
],
[
293,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
297,
298
],
[
296,
299
],
[
293,
300
],
[
300,
301
],
[
300,
302
],
[
302,
303
],
[
302,
304
],
[
293,
305
],
[
305,
306
],
[
305,
307
],
[
293,
309
],
[
309,
310
],
[
310,
311
],
[
311,
312
],
[
310,
313
],
[
309,
314
],
[
314,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
315,
319
],
[
319,
320
],
[
320,
321
],
[
319,
322
],
[
322,
323
],
[
322,
324
],
[
293,
325
],
[
325,
326
],
[
291,
327
],
[
327,
328
],
[
382,
329
],
[
329,
330
],
[
329,
331
],
[
331,
332
],
[
332,
333
],
[
333,
334
],
[
334,
335
],
[
333,
336
],
[
329,
337
],
[
337,
338
],
[
382,
339
],
[
339,
340
],
[
339,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
344,
345
],
[
343,
346
],
[
339,
347
],
[
347,
348
],
[
0,
349
],
[
349,
350
],
[
349,
351
],
[
351,
352
],
[
351,
353
],
[
349,
354
],
[
354,
355
],
[
349,
356
],
[
356,
357
],
[
349,
358
],
[
358,
359
],
[
349,
360
],
[
360,
361
],
[
360,
362
],
[
362,
363
],
[
363,
364
],
[
363,
365
],
[
365,
366
],
[
362,
367
],
[
367,
368
],
[
368,
369
],
[
368,
370
],
[
367,
371
],
[
362,
372
],
[
372,
373
],
[
373,
374
],
[
373,
375
],
[
372,
376
],
[
360,
377
],
[
377,
378
],
[
360,
379
],
[
379,
380
],
[
0,
381
],
[
381,
382
],
[
381,
383
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\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 = ip(br.readLine());\n int[] list = createListInt(br.readLine());\n bubbleSort(list.clone(), n);\n }\n\n static void checkStable(Card[] list1, Card[] list2) {\n for (int i = 0; i < list1.length; i++) {\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }\n System.out.println(\"Stable\");\n }\n\n static void bubbleSort(int[] list, int n) {\n int count = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }\n print(list);\n System.out.println(count);\n }\n\n private static void print(int[] list) {\n int n = list.length;\n String[] str = new String[n];\n for (int i = 0; i < n; i++) {\n str[i] = String.valueOf(list[i]);\n }\n System.out.println(String.join(\" \", str));\n }\n\n static void swap(Card[] list, int a, int b) {\n Card temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static void swap(int[] list, int a, int b) {\n int temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\n }\n}\n\nclass Card {\n static int n = 0;\n int serialN;\n char suit;\n int rank;\n\n Card(char suit, int rank) {\n serialN = n++;\n this.suit = suit;\n this.rank = rank;\n }\n\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] list = createListInt(br.readLine());\n bubbleSort(list.clone(), n);\n }\n\n static void checkStable(Card[] list1, Card[] list2) {\n for (int i = 0; i < list1.length; i++) {\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }\n System.out.println(\"Stable\");\n }\n\n static void bubbleSort(int[] list, int n) {\n int count = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }\n print(list);\n System.out.println(count);\n }\n\n private static void print(int[] list) {\n int n = list.length;\n String[] str = new String[n];\n for (int i = 0; i < n; i++) {\n str[i] = String.valueOf(list[i]);\n }\n System.out.println(String.join(\" \", str));\n }\n\n static void swap(Card[] list, int a, int b) {\n Card temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static void swap(int[] list, int a, int b) {\n int temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] list = createListInt(br.readLine());\n bubbleSort(list.clone(), n);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] list = createListInt(br.readLine());\n bubbleSort(list.clone(), n);\n }",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int n = ip(br.readLine());",
"n",
"ip(br.readLine())",
"ip",
"br.readLine()",
"br.readLine",
"br",
"int[] list = createListInt(br.readLine());",
"list",
"createListInt(br.readLine())",
"createListInt",
"br.readLine()",
"br.readLine",
"br",
"bubbleSort(list.clone(), n)",
"bubbleSort",
"list.clone()",
"list.clone",
"list",
"n",
"String[] args",
"args",
"static void checkStable(Card[] list1, Card[] list2) {\n for (int i = 0; i < list1.length; i++) {\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }\n System.out.println(\"Stable\");\n }",
"checkStable",
"{\n for (int i = 0; i < list1.length; i++) {\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }\n System.out.println(\"Stable\");\n }",
"for (int i = 0; i < list1.length; i++) {\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < list1.length",
"i",
"list1.length",
"list1",
"list1.length",
"i++",
"i++",
"i",
"{\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }",
"{\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }",
"if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }",
"list1[i].serialN != list2[i].serialN",
"list1[i].serialN",
"list1[i]",
"list1",
"i",
"list1[i].serialN",
"list2[i].serialN",
"list2[i]",
"list2",
"i",
"list2[i].serialN",
"{\n System.out.println(\"Not stable\");\n return;\n }",
"System.out.println(\"Not stable\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"Not stable\"",
"return;",
"System.out.println(\"Stable\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"Stable\"",
"Card[] list1",
"list1",
"Card[] list2",
"list2",
"static void bubbleSort(int[] list, int n) {\n int count = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }\n print(list);\n System.out.println(count);\n }",
"bubbleSort",
"{\n int count = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }\n print(list);\n System.out.println(count);\n }",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }",
"flag",
"{\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\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 (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }",
"{\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }",
"if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }",
"list[i] < list[i - 1]",
"list[i]",
"list",
"i",
"list[i - 1]",
"list",
"i - 1",
"i",
"1",
"{\n swap(list, i, i - 1);\n count++;\n flag = true;\n }",
"swap(list, i, i - 1)",
"swap",
"list",
"i",
"i - 1",
"i",
"1",
"count++",
"count",
"flag = true",
"flag",
"true",
"print(list)",
"print",
"list",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"int[] list",
"list",
"int n",
"n",
"private static void print(int[] list) {\n int n = list.length;\n String[] str = new String[n];\n for (int i = 0; i < n; i++) {\n str[i] = String.valueOf(list[i]);\n }\n System.out.println(String.join(\" \", str));\n }",
"print",
"{\n int n = list.length;\n String[] str = new String[n];\n for (int i = 0; i < n; i++) {\n str[i] = String.valueOf(list[i]);\n }\n System.out.println(String.join(\" \", str));\n }",
"int n = list.length;",
"n",
"list.length",
"list",
"list.length",
"String[] str = new String[n];",
"str",
"new String[n]",
"n",
"for (int i = 0; i < n; i++) {\n str[i] = String.valueOf(list[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n str[i] = String.valueOf(list[i]);\n }",
"{\n str[i] = String.valueOf(list[i]);\n }",
"str[i] = String.valueOf(list[i])",
"str[i]",
"str",
"i",
"String.valueOf(list[i])",
"String.valueOf",
"String",
"list[i]",
"list",
"i",
"System.out.println(String.join(\" \", str))",
"System.out.println",
"System.out",
"System",
"System.out",
"String.join(\" \", str)",
"String.join",
"String",
"\" \"",
"str",
"int[] list",
"list",
"static void swap(Card[] list, int a, int b) {\n Card temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }",
"swap",
"{\n Card temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }",
"Card temp = list[a];",
"temp",
"list[a]",
"list",
"a",
"list[a] = list[b]",
"list[a]",
"list",
"a",
"list[b]",
"list",
"b",
"list[b] = temp",
"list[b]",
"list",
"b",
"temp",
"Card[] list",
"list",
"int a",
"a",
"int b",
"b",
"static void swap(int[] list, int a, int b) {\n int temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }",
"swap",
"{\n int temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }",
"int temp = list[a];",
"temp",
"list[a]",
"list",
"a",
"list[a] = list[b]",
"list[a]",
"list",
"a",
"list[b]",
"list",
"b",
"list[b] = temp",
"list[b]",
"list",
"b",
"temp",
"int[] list",
"list",
"int a",
"a",
"int b",
"b",
"static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }",
"createListInt",
"{\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }",
"String[] lines = line.split(\" \");",
"lines",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"int n = lines.length;",
"n",
"lines.length",
"lines",
"lines.length",
"int[] list = new int[n];",
"list",
"new int[n]",
"n",
"while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }",
"n-- > 0",
"n--",
"n",
"0",
"{\n list[n] = Integer.parseInt(lines[n]);\n }",
"list[n] = Integer.parseInt(lines[n])",
"list[n]",
"list",
"n",
"Integer.parseInt(lines[n])",
"Integer.parseInt",
"Integer",
"lines[n]",
"lines",
"n",
"return list;",
"list",
"String line",
"line",
"static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }",
"createListLong",
"{\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }",
"String[] lines = line.split(\" \");",
"lines",
"line.split(\" \")",
"line.split",
"line",
"\" \"",
"int n = lines.length;",
"n",
"lines.length",
"lines",
"lines.length",
"long[] list = new long[n];",
"list",
"new long[n]",
"n",
"while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }",
"n-- > 0",
"n--",
"n",
"0",
"{\n list[n] = Long.parseLong(lines[n]);\n }",
"list[n] = Long.parseLong(lines[n])",
"list[n]",
"list",
"n",
"Long.parseLong(lines[n])",
"Long.parseLong",
"Long",
"lines[n]",
"lines",
"n",
"return list;",
"list",
"String line",
"line",
"static int ip(String s) {\n return Integer.parseInt(s);\n }",
"ip",
"{\n return Integer.parseInt(s);\n }",
"return Integer.parseInt(s);",
"Integer.parseInt(s)",
"Integer.parseInt",
"Integer",
"s",
"String s",
"s",
"static long lp(String s) {\n return Long.parseLong(s);\n }",
"lp",
"{\n return Long.parseLong(s);\n }",
"return Long.parseLong(s);",
"Long.parseLong(s)",
"Long.parseLong",
"Long",
"s",
"String s",
"s",
"class Card {\n static int n = 0;\n int serialN;\n char suit;\n int rank;\n\n Card(char suit, int rank) {\n serialN = n++;\n this.suit = suit;\n this.rank = rank;\n }\n\n}",
"Card",
"static int n = 0;",
"n",
"0",
"int serialN;",
"serialN",
"char suit;",
"suit",
"int rank;",
"rank",
"Card(char suit, int rank) {\n serialN = n++;\n this.suit = suit;\n this.rank = rank;\n }",
"Card",
"{\n serialN = n++;\n this.suit = suit;\n this.rank = rank;\n }",
"serialN = n++",
"serialN",
"n++",
"n",
"this.suit = suit",
"this.suit",
"this",
"this.suit",
"suit",
"this.rank = rank",
"this.rank",
"this",
"this.rank",
"rank",
"char suit",
"suit",
"int rank",
"rank",
"public class Main {\n public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = ip(br.readLine());\n int[] list = createListInt(br.readLine());\n bubbleSort(list.clone(), n);\n }\n\n static void checkStable(Card[] list1, Card[] list2) {\n for (int i = 0; i < list1.length; i++) {\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }\n System.out.println(\"Stable\");\n }\n\n static void bubbleSort(int[] list, int n) {\n int count = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }\n print(list);\n System.out.println(count);\n }\n\n private static void print(int[] list) {\n int n = list.length;\n String[] str = new String[n];\n for (int i = 0; i < n; i++) {\n str[i] = String.valueOf(list[i]);\n }\n System.out.println(String.join(\" \", str));\n }\n\n static void swap(Card[] list, int a, int b) {\n Card temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static void swap(int[] list, int a, int b) {\n int temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\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 = ip(br.readLine());\n int[] list = createListInt(br.readLine());\n bubbleSort(list.clone(), n);\n }\n\n static void checkStable(Card[] list1, Card[] list2) {\n for (int i = 0; i < list1.length; i++) {\n if (list1[i].serialN != list2[i].serialN) {\n System.out.println(\"Not stable\");\n return;\n }\n }\n System.out.println(\"Stable\");\n }\n\n static void bubbleSort(int[] list, int n) {\n int count = 0;\n boolean flag = true;\n while (flag) {\n flag = false;\n for (int i = n - 1; i > 0; i--) {\n if (list[i] < list[i - 1]) {\n swap(list, i, i - 1);\n count++;\n flag = true;\n }\n }\n }\n print(list);\n System.out.println(count);\n }\n\n private static void print(int[] list) {\n int n = list.length;\n String[] str = new String[n];\n for (int i = 0; i < n; i++) {\n str[i] = String.valueOf(list[i]);\n }\n System.out.println(String.join(\" \", str));\n }\n\n static void swap(Card[] list, int a, int b) {\n Card temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static void swap(int[] list, int a, int b) {\n int temp = list[a];\n list[a] = list[b];\n list[b] = temp;\n }\n\n static int[] createListInt(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n int[] list = new int[n];\n while (n-- > 0) {\n list[n] = Integer.parseInt(lines[n]);\n }\n return list;\n }\n\n static long[] createListLong(String line) {\n String[] lines = line.split(\" \");\n int n = lines.length;\n long[] list = new long[n];\n while (n-- > 0) {\n list[n] = Long.parseLong(lines[n]);\n }\n return list;\n }\n\n static int ip(String s) {\n return Integer.parseInt(s);\n }\n\n static long lp(String s) {\n return Long.parseLong(s);\n }\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = ip(br.readLine());
int[] list = createListInt(br.readLine());
bubbleSort(list.clone(), n);
}
static void checkStable(Card[] list1, Card[] list2) {
for (int i = 0; i < list1.length; i++) {
if (list1[i].serialN != list2[i].serialN) {
System.out.println("Not stable");
return;
}
}
System.out.println("Stable");
}
static void bubbleSort(int[] list, int n) {
int count = 0;
boolean flag = true;
while (flag) {
flag = false;
for (int i = n - 1; i > 0; i--) {
if (list[i] < list[i - 1]) {
swap(list, i, i - 1);
count++;
flag = true;
}
}
}
print(list);
System.out.println(count);
}
private static void print(int[] list) {
int n = list.length;
String[] str = new String[n];
for (int i = 0; i < n; i++) {
str[i] = String.valueOf(list[i]);
}
System.out.println(String.join(" ", str));
}
static void swap(Card[] list, int a, int b) {
Card temp = list[a];
list[a] = list[b];
list[b] = temp;
}
static void swap(int[] list, int a, int b) {
int temp = list[a];
list[a] = list[b];
list[b] = temp;
}
static int[] createListInt(String line) {
String[] lines = line.split(" ");
int n = lines.length;
int[] list = new int[n];
while (n-- > 0) {
list[n] = Integer.parseInt(lines[n]);
}
return list;
}
static long[] createListLong(String line) {
String[] lines = line.split(" ");
int n = lines.length;
long[] list = new long[n];
while (n-- > 0) {
list[n] = Long.parseLong(lines[n]);
}
return list;
}
static int ip(String s) {
return Integer.parseInt(s);
}
static long lp(String s) {
return Long.parseLong(s);
}
}
class Card {
static int n = 0;
int serialN;
char suit;
int rank;
Card(char suit, int rank) {
serialN = n++;
this.suit = suit;
this.rank = rank;
}
} |
[
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,
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,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
0,
13,
2,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
8,
2,
13,
17,
18,
13,
13,
2,
17,
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
],
[
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
],
[
14,
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
],
[
95,
99
],
[
99,
100
],
[
99,
101
],
[
101,
102
],
[
101,
103
],
[
94,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
112,
118
],
[
118,
119
],
[
118,
120
],
[
104,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
104,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
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
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
149,
153
],
[
153,
154
],
[
153,
155
],
[
149,
156
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
158,
160
],
[
14,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
14,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
166,
171
],
[
12,
172
],
[
172,
173
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\n\nclass Main {\n public static void main(String[] args) throws IOException {\n \tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \tint n = Integer.parseInt(br.readLine());\n \tint[] a = new int[n];\n \tString[] elements = br.readLine().split(\" \");\n \t\n\tfor (int i = 0; i < n; ++i){\n\t\ta[i] = Integer.parseInt(elements[i]);\n\t}\n\t\n\tint num = 0;\n\t\n\tfor (int i = 0; i < n-1; ++i){\n\t\tfor (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(int i = 0; i < n; ++i){\n\t\tSystem.out.print(i == 0 ? a[i] : \" \" + a[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(num);\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",
"class Main {\n public static void main(String[] args) throws IOException {\n \tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \tint n = Integer.parseInt(br.readLine());\n \tint[] a = new int[n];\n \tString[] elements = br.readLine().split(\" \");\n \t\n\tfor (int i = 0; i < n; ++i){\n\t\ta[i] = Integer.parseInt(elements[i]);\n\t}\n\t\n\tint num = 0;\n\t\n\tfor (int i = 0; i < n-1; ++i){\n\t\tfor (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(int i = 0; i < n; ++i){\n\t\tSystem.out.print(i == 0 ? a[i] : \" \" + a[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(num);\n\t\n }\n}",
"Main",
"public static void main(String[] args) throws IOException {\n \tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \tint n = Integer.parseInt(br.readLine());\n \tint[] a = new int[n];\n \tString[] elements = br.readLine().split(\" \");\n \t\n\tfor (int i = 0; i < n; ++i){\n\t\ta[i] = Integer.parseInt(elements[i]);\n\t}\n\t\n\tint num = 0;\n\t\n\tfor (int i = 0; i < n-1; ++i){\n\t\tfor (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(int i = 0; i < n; ++i){\n\t\tSystem.out.print(i == 0 ? a[i] : \" \" + a[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(num);\n\t\n }",
"main",
"{\n \tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n \tint n = Integer.parseInt(br.readLine());\n \tint[] a = new int[n];\n \tString[] elements = br.readLine().split(\" \");\n \t\n\tfor (int i = 0; i < n; ++i){\n\t\ta[i] = Integer.parseInt(elements[i]);\n\t}\n\t\n\tint num = 0;\n\t\n\tfor (int i = 0; i < n-1; ++i){\n\t\tfor (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfor(int i = 0; i < n; ++i){\n\t\tSystem.out.print(i == 0 ? a[i] : \" \" + a[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(num);\n\t\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",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"String[] elements = br.readLine().split(\" \");",
"elements",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for (int i = 0; i < n; ++i){\n\t\ta[i] = Integer.parseInt(elements[i]);\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"{\n\t\ta[i] = Integer.parseInt(elements[i]);\n\t}",
"{\n\t\ta[i] = Integer.parseInt(elements[i]);\n\t}",
"a[i] = Integer.parseInt(elements[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(elements[i])",
"Integer.parseInt",
"Integer",
"elements[i]",
"elements",
"i",
"int num = 0;",
"num",
"0",
"for (int i = 0; i < n-1; ++i){\n\t\tfor (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n-1",
"i",
"n-1",
"n",
"1",
"++i",
"++i",
"i",
"{\n\t\tfor (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}\n\t}",
"{\n\t\tfor (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}\n\t}",
"for (int j = n - 1; j > i; --j){\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\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\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\t\t\t}\n\t\t}",
"if(a[j] < a[j-1]){\n\t\t\t\tint tmp = a[j-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\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-1];\n\t\t\t\ta[j-1] = a[j];\n\t\t\t\ta[j] = tmp;\n\t\t\t\tnum = num + 1;\n\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",
"num = num + 1",
"num",
"num + 1",
"num",
"1",
"for(int i = 0; i < n; ++i){\n\t\tSystem.out.print(i == 0 ? a[i] : \" \" + a[i]);\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"++i",
"++i",
"i",
"{\n\t\tSystem.out.print(i == 0 ? a[i] : \" \" + a[i]);\n\t}",
"{\n\t\tSystem.out.print(i == 0 ? a[i] : \" \" + a[i]);\n\t}",
"System.out.print(i == 0 ? a[i] : \" \" + a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"i == 0 ? a[i] : \" \" + a[i]",
"i == 0",
"i",
"0",
"a[i]",
"a",
"i",
"\" \" + a[i]",
"\" \"",
"a[i]",
"a",
"i",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"System.out.println(num)",
"System.out.println",
"System.out",
"System",
"System.out",
"num",
"String[] args",
"args"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
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[] elements = br.readLine().split(" ");
for (int i = 0; i < n; ++i){
a[i] = Integer.parseInt(elements[i]);
}
int num = 0;
for (int i = 0; i < n-1; ++i){
for (int j = n - 1; j > i; --j){
if(a[j] < a[j-1]){
int tmp = a[j-1];
a[j-1] = a[j];
a[j] = tmp;
num = num + 1;
}
}
}
for(int i = 0; i < n; ++i){
System.out.print(i == 0 ? a[i] : " " + a[i]);
}
System.out.println();
System.out.println(num);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
4,
18,
20,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
4,
13,
13,
13,
4,
18,
13,
12,
13,
30,
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,
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,
29,
13,
23,
13,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
13,
13,
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,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
13,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
14,
2,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
4,
13,
13,
4,
18,
18,
13,
13,
13,
29,
13,
23,
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
],
[
338,
5
],
[
338,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
10,
11
],
[
6,
12
],
[
12,
13
],
[
338,
14
],
[
14,
15
],
[
14,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
16,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
16,
25
],
[
25,
26
],
[
25,
27
],
[
16,
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
],
[
16,
49
],
[
49,
50
],
[
49,
51
],
[
51,
52
],
[
51,
53
],
[
51,
54
],
[
16,
55
],
[
55,
56
],
[
56,
57
],
[
338,
58
],
[
58,
59
],
[
58,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
60,
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
],
[
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
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
106,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
112,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
106,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
106,
128
],
[
128,
129
],
[
60,
130
],
[
130,
131
],
[
130,
132
],
[
60,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
60,
139
],
[
139,
140
],
[
58,
141
],
[
141,
142
],
[
58,
143
],
[
143,
144
],
[
338,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
153,
154
],
[
153,
155
],
[
148,
156
],
[
156,
157
],
[
157,
158
],
[
148,
159
],
[
160,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
160,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
160,
169
],
[
169,
170
],
[
169,
171
],
[
171,
172
],
[
171,
173
],
[
160,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
175,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
174,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
186,
188
],
[
188,
189
],
[
188,
190
],
[
185,
191
],
[
191,
192
],
[
191,
193
],
[
184,
194
],
[
194,
195
],
[
160,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
199,
200
],
[
199,
201
],
[
196,
202
],
[
147,
203
],
[
203,
204
],
[
145,
205
],
[
205,
206
],
[
145,
207
],
[
207,
208
],
[
338,
209
],
[
209,
210
],
[
209,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
211,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
217,
219
],
[
215,
220
],
[
220,
221
],
[
220,
222
],
[
215,
223
],
[
223,
224
],
[
224,
225
],
[
215,
226
],
[
227,
227
],
[
227,
228
],
[
228,
229
],
[
228,
230
],
[
227,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
233,
235
],
[
231,
236
],
[
236,
237
],
[
236,
238
],
[
231,
239
],
[
239,
240
],
[
240,
241
],
[
231,
242
],
[
243,
243
],
[
243,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
246,
248
],
[
245,
249
],
[
249,
250
],
[
249,
251
],
[
244,
252
],
[
252,
253
],
[
252,
254
],
[
227,
255
],
[
255,
256
],
[
256,
257
],
[
256,
258
],
[
255,
259
],
[
259,
260
],
[
260,
261
],
[
260,
262
],
[
262,
263
],
[
262,
264
],
[
259,
265
],
[
265,
266
],
[
266,
267
],
[
266,
268
],
[
265,
269
],
[
269,
270
],
[
269,
271
],
[
259,
272
],
[
272,
273
],
[
273,
274
],
[
273,
275
],
[
272,
276
],
[
259,
277
],
[
277,
278
],
[
211,
279
],
[
279,
280
],
[
279,
281
],
[
211,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
284,
286
],
[
282,
287
],
[
211,
288
],
[
288,
289
],
[
209,
290
],
[
290,
291
],
[
209,
292
],
[
292,
293
],
[
338,
294
],
[
294,
295
],
[
294,
296
],
[
296,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
299,
301
],
[
297,
302
],
[
302,
303
],
[
302,
304
],
[
296,
305
],
[
305,
306
],
[
306,
307
],
[
307,
308
],
[
307,
309
],
[
305,
310
],
[
310,
311
],
[
310,
312
],
[
312,
313
],
[
312,
314
],
[
305,
315
],
[
315,
316
],
[
316,
317
],
[
305,
318
],
[
319,
319
],
[
319,
320
],
[
320,
321
],
[
321,
322
],
[
322,
323
],
[
322,
324
],
[
320,
325
],
[
325,
326
],
[
325,
327
],
[
327,
328
],
[
327,
329
],
[
296,
330
],
[
330,
331
],
[
331,
332
],
[
332,
333
],
[
332,
334
],
[
294,
335
],
[
335,
336
],
[
0,
337
],
[
337,
338
],
[
337,
339
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tnew Main().start();\n\t}\n\tvoid start(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n//\t\ta = insertionSort(a,n);\n//\t\ta = selectionSort(a,n);\n\t\ta = bubbleSort(a,n);\n\n\t\tin.close();\n\n\t}\n\tint[] bubbleSort(int[] c, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n-1; i++){\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(c);\n\t\tSystem.out.println(count);\n\t\treturn c;\n\t}\n\tint[] insertionSort(int[]a, int n){\n\t\tfor(int i = 1; i < n; i++){\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}\n\t\treturn a;\n\t}\n\tint[] selectionSort(int[] a, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n; i++){\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintArray(a);\n\t\tSystem.out.println(count);\n\t\treturn a;\n\t}\n\tvoid printArray(int[] a){\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\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\tnew Main().start();\n\t}\n\tvoid start(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n//\t\ta = insertionSort(a,n);\n//\t\ta = selectionSort(a,n);\n\t\ta = bubbleSort(a,n);\n\n\t\tin.close();\n\n\t}\n\tint[] bubbleSort(int[] c, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n-1; i++){\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(c);\n\t\tSystem.out.println(count);\n\t\treturn c;\n\t}\n\tint[] insertionSort(int[]a, int n){\n\t\tfor(int i = 1; i < n; i++){\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}\n\t\treturn a;\n\t}\n\tint[] selectionSort(int[] a, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n; i++){\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintArray(a);\n\t\tSystem.out.println(count);\n\t\treturn a;\n\t}\n\tvoid printArray(int[] a){\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tnew Main().start();\n\t}",
"main",
"{\n\t\t// TODO ?????????????????????????????????????????????\n\t\tnew Main().start();\n\t}",
"new Main().start()",
"new Main().start",
"new Main()",
"String[] args",
"args",
"void start(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n//\t\ta = insertionSort(a,n);\n//\t\ta = selectionSort(a,n);\n\t\ta = bubbleSort(a,n);\n\n\t\tin.close();\n\n\t}",
"start",
"{\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n//\t\ta = insertionSort(a,n);\n//\t\ta = selectionSort(a,n);\n\t\ta = bubbleSort(a,n);\n\n\t\tin.close();\n\n\t}",
"Scanner in = new Scanner(System.in);",
"in",
"new Scanner(System.in)",
"int n = in.nextInt();",
"n",
"in.nextInt()",
"in.nextInt",
"in",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"{\n\t\t\ta[i] = in.nextInt();\n\t\t}",
"a[i] = in.nextInt()",
"a[i]",
"a",
"i",
"in.nextInt()",
"in.nextInt",
"in",
"a = bubbleSort(a,n)",
"a",
"bubbleSort(a,n)",
"bubbleSort",
"a",
"n",
"in.close()",
"in.close",
"in",
"int[] bubbleSort(int[] c, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n-1; i++){\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(c);\n\t\tSystem.out.println(count);\n\t\treturn c;\n\t}",
"bubbleSort",
"{\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n-1; i++){\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(c);\n\t\tSystem.out.println(count);\n\t\treturn c;\n\t}",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < n-1; i++){\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[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-1",
"i",
"n-1",
"n",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[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(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[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(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[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(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"c[j] < c[j-1]",
"c[j]",
"c",
"j",
"c[j-1]",
"c",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"int tmp = c[j];",
"tmp",
"c[j]",
"c",
"j",
"c[j] = c[j-1]",
"c[j]",
"c",
"j",
"c[j-1]",
"c",
"j-1",
"j",
"1",
"c[j-1] = tmp",
"c[j-1]",
"c",
"j-1",
"j",
"1",
"tmp",
"count++",
"count",
"printArray(c)",
"printArray",
"c",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"return c;",
"c",
"int[] c",
"c",
"int n",
"n",
"int[] insertionSort(int[]a, int n){\n\t\tfor(int i = 1; i < n; i++){\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}\n\t\treturn a;\n\t}",
"insertionSort",
"{\n\t\tfor(int i = 1; i < n; i++){\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}\n\t\treturn a;\n\t}",
"for(int i = 1; i < n; i++){\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}",
"{\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}",
"printArray(a)",
"printArray",
"a",
"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\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}",
"j >= 0 && a[j] > v",
"j >= 0",
"j",
"0",
"a[j] > v",
"a[j]",
"a",
"j",
"v",
"{\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}",
"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",
"return a;",
"a",
"int[]a",
"a",
"int n",
"n",
"int[] selectionSort(int[] a, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n; i++){\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintArray(a);\n\t\tSystem.out.println(count);\n\t\treturn a;\n\t}",
"selectionSort",
"{\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n; i++){\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintArray(a);\n\t\tSystem.out.println(count);\n\t\treturn a;\n\t}",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < n; i++){\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\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\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"{\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}",
"int minj = i;",
"minj",
"i",
"for(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}",
"int j = i;",
"int j = i;",
"j",
"i",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}",
"{\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}",
"if(a[j] < a[minj]) minj = j;",
"a[j] < a[minj]",
"a[j]",
"a",
"j",
"a[minj]",
"a",
"minj",
"minj = j",
"minj",
"j",
"if(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}",
"minj != i",
"minj",
"i",
"{\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}",
"int tmp = a[i];",
"tmp",
"a[i]",
"a",
"i",
"a[i] = a[minj]",
"a[i]",
"a",
"i",
"a[minj]",
"a",
"minj",
"a[minj] = tmp",
"a[minj]",
"a",
"minj",
"tmp",
"count++",
"count",
"printArray(a)",
"printArray",
"a",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"return a;",
"a",
"int[] a",
"a",
"int n",
"n",
"void printArray(int[] a){\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}",
"printArray",
"{\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}",
"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\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}",
"int i= 1;",
"int i= 1;",
"i",
"1",
"i < a.length",
"i",
"a.length",
"a",
"a.length",
"i++",
"i++",
"i",
"{\n\t\t\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()",
"System.out.println",
"System.out",
"System",
"System.out",
"int[] a",
"a",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tnew Main().start();\n\t}\n\tvoid start(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n//\t\ta = insertionSort(a,n);\n//\t\ta = selectionSort(a,n);\n\t\ta = bubbleSort(a,n);\n\n\t\tin.close();\n\n\t}\n\tint[] bubbleSort(int[] c, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n-1; i++){\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(c);\n\t\tSystem.out.println(count);\n\t\treturn c;\n\t}\n\tint[] insertionSort(int[]a, int n){\n\t\tfor(int i = 1; i < n; i++){\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}\n\t\treturn a;\n\t}\n\tint[] selectionSort(int[] a, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n; i++){\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintArray(a);\n\t\tSystem.out.println(count);\n\t\treturn a;\n\t}\n\tvoid printArray(int[] a){\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\t// TODO ?????????????????????????????????????????????\n\t\tnew Main().start();\n\t}\n\tvoid start(){\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = in.nextInt();\n\t\tint[] a = new int[n];\n\t\tfor(int i = 0; i < n; i++){\n\t\t\ta[i] = in.nextInt();\n\t\t}\n//\t\ta = insertionSort(a,n);\n//\t\ta = selectionSort(a,n);\n\t\ta = bubbleSort(a,n);\n\n\t\tin.close();\n\n\t}\n\tint[] bubbleSort(int[] c, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n-1; i++){\n\t\t\tfor(int j = n-1; j >= i+1; j--){\n\t\t\t\tif(c[j] < c[j-1]){\n\t\t\t\t\tint tmp = c[j];\n\t\t\t\t\tc[j] = c[j-1];\n\t\t\t\t\tc[j-1] = tmp;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(c);\n\t\tSystem.out.println(count);\n\t\treturn c;\n\t}\n\tint[] insertionSort(int[]a, int n){\n\t\tfor(int i = 1; i < n; i++){\n\t\t\tprintArray(a);\n\t\t\tint v = a[i];\n\t\t\tint j = i - 1;\n\t\t\twhile(j >= 0 && a[j] > v){\n\t\t\t\ta[j+1] = a[j];\n\t\t\t\tj--;\n\t\t\t}\n\t\t\ta[j+1] = v;\n\t\t}\n\t\treturn a;\n\t}\n\tint[] selectionSort(int[] a, int n){\n\t\tint count = 0;\n\t\tfor(int i = 0; i < n; i++){\n//\t\t\tprintArray(a);\n\t\t\tint minj = i;\n\t\t\tfor(int j = i; j < n;j++){\n\t\t\t\tif(a[j] < a[minj]) minj = j;\n\t\t\t}\n\t\t\tif(minj != i){\n\t\t\t\tint tmp = a[i];\n\t\t\t\ta[i] = a[minj];\n\t\t\t\ta[minj] = tmp;\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\tprintArray(a);\n\t\tSystem.out.println(count);\n\t\treturn a;\n\t}\n\tvoid printArray(int[] a){\n\t\tSystem.out.print(a[0]);\n\t\tfor(int i= 1; i < a.length; i++){\n\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO ?????????????????????????????????????????????
new Main().start();
}
void start(){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++){
a[i] = in.nextInt();
}
// a = insertionSort(a,n);
// a = selectionSort(a,n);
a = bubbleSort(a,n);
in.close();
}
int[] bubbleSort(int[] c, int n){
int count = 0;
for(int i = 0; i < n-1; i++){
for(int j = n-1; j >= i+1; j--){
if(c[j] < c[j-1]){
int tmp = c[j];
c[j] = c[j-1];
c[j-1] = tmp;
count++;
}
}
}
printArray(c);
System.out.println(count);
return c;
}
int[] insertionSort(int[]a, int n){
for(int i = 1; i < n; i++){
printArray(a);
int v = a[i];
int j = i - 1;
while(j >= 0 && a[j] > v){
a[j+1] = a[j];
j--;
}
a[j+1] = v;
}
return a;
}
int[] selectionSort(int[] a, int n){
int count = 0;
for(int i = 0; i < n; i++){
// printArray(a);
int minj = i;
for(int j = i; j < n;j++){
if(a[j] < a[minj]) minj = j;
}
if(minj != i){
int tmp = a[i];
a[i] = a[minj];
a[minj] = tmp;
count++;
}
}
printArray(a);
System.out.println(count);
return a;
}
void printArray(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,
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,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
29,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
4,
18,
13,
0,
13,
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,
41,
13,
4,
13,
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
],
[
188,
5
],
[
188,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
8,
12
],
[
12,
13
],
[
13,
14
],
[
14,
15
],
[
14,
16
],
[
12,
17
],
[
17,
18
],
[
17,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
19,
23
],
[
12,
24
],
[
24,
25
],
[
25,
26
],
[
12,
27
],
[
28,
28
],
[
28,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
34,
36
],
[
33,
37
],
[
29,
38
],
[
38,
39
],
[
38,
40
],
[
29,
41
],
[
41,
42
],
[
42,
43
],
[
29,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
46,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
56,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
56,
78
],
[
78,
79
],
[
8,
80
],
[
80,
81
],
[
6,
82
],
[
82,
83
],
[
188,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
86,
90
],
[
90,
91
],
[
90,
92
],
[
92,
93
],
[
93,
94
],
[
92,
95
],
[
95,
96
],
[
96,
97
],
[
86,
98
],
[
98,
99
],
[
98,
100
],
[
86,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
86,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
110,
111
],
[
109,
112
],
[
86,
113
],
[
113,
114
],
[
113,
115
],
[
86,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
117,
122
],
[
122,
123
],
[
122,
124
],
[
117,
125
],
[
125,
126
],
[
126,
127
],
[
117,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
129,
133
],
[
133,
134
],
[
134,
135
],
[
133,
136
],
[
136,
137
],
[
136,
138
],
[
86,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
141,
143
],
[
86,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
144,
154
],
[
154,
155
],
[
155,
156
],
[
144,
157
],
[
158,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
164,
168
],
[
86,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
169,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
176,
178
],
[
86,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
179,
184
],
[
84,
185
],
[
185,
186
],
[
0,
187
],
[
187,
188
],
[
187,
189
]
] | [
"import java.io.*;\npublic class Main{\n\tprivate static int bubble(int a[]){\n\t\tint count=0;\n\t\tfor(int i = 0 ; i < a.length-1 ; 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 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\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\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[] strdata = new String[n];\n\t\tString str = br.readLine();\n\t\tstrdata = str.split(\" \");\n\t\tint[] data = new int[n];\n\t\tfor(int i = 0 ; i < n ; i ++)\n\t\t\tdata[i] = Integer.parseInt(strdata[i]);\n\t\tint count = bubble(data);\n\t\tfor(int i = 0 ; i < n-1; i++){\n\t\t\tSystem.out.print(data[i]+\" \");\n\t\t}\n\t\tSystem.out.println(data[n-1]);\n\t\tSystem.out.println(count);\n\t}\n}",
"import java.io.*;",
"io.*",
"java",
"public class Main{\n\tprivate static int bubble(int a[]){\n\t\tint count=0;\n\t\tfor(int i = 0 ; i < a.length-1 ; 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 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\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\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[] strdata = new String[n];\n\t\tString str = br.readLine();\n\t\tstrdata = str.split(\" \");\n\t\tint[] data = new int[n];\n\t\tfor(int i = 0 ; i < n ; i ++)\n\t\t\tdata[i] = Integer.parseInt(strdata[i]);\n\t\tint count = bubble(data);\n\t\tfor(int i = 0 ; i < n-1; i++){\n\t\t\tSystem.out.print(data[i]+\" \");\n\t\t}\n\t\tSystem.out.println(data[n-1]);\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"private static int bubble(int a[]){\n\t\tint count=0;\n\t\tfor(int i = 0 ; i < a.length-1 ; 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 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\t\t\t}\n\t\t}\n\t\treturn count;\n\t}",
"bubble",
"{\n\t\tint count=0;\n\t\tfor(int i = 0 ; i < a.length-1 ; 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 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\t\t\t}\n\t\t}\n\t\treturn count;\n\t}",
"int count=0;",
"count",
"0",
"for(int i = 0 ; i < a.length-1 ; 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 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\t\t\t}\n\t\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\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 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\t\t\t}\n\t\t}",
"{\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 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\t\t\t}\n\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 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\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",
"{\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\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\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\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\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",
"return count;",
"count",
"int a[]",
"a",
"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[] strdata = new String[n];\n\t\tString str = br.readLine();\n\t\tstrdata = str.split(\" \");\n\t\tint[] data = new int[n];\n\t\tfor(int i = 0 ; i < n ; i ++)\n\t\t\tdata[i] = Integer.parseInt(strdata[i]);\n\t\tint count = bubble(data);\n\t\tfor(int i = 0 ; i < n-1; i++){\n\t\t\tSystem.out.print(data[i]+\" \");\n\t\t}\n\t\tSystem.out.println(data[n-1]);\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] strdata = new String[n];\n\t\tString str = br.readLine();\n\t\tstrdata = str.split(\" \");\n\t\tint[] data = new int[n];\n\t\tfor(int i = 0 ; i < n ; i ++)\n\t\t\tdata[i] = Integer.parseInt(strdata[i]);\n\t\tint count = bubble(data);\n\t\tfor(int i = 0 ; i < n-1; i++){\n\t\t\tSystem.out.print(data[i]+\" \");\n\t\t}\n\t\tSystem.out.println(data[n-1]);\n\t\tSystem.out.println(count);\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[] strdata = new String[n];",
"strdata",
"new String[n]",
"n",
"String str = br.readLine();",
"str",
"br.readLine()",
"br.readLine",
"br",
"strdata = str.split(\" \")",
"strdata",
"str.split(\" \")",
"str.split",
"str",
"\" \"",
"int[] data = new int[n];",
"data",
"new int[n]",
"n",
"for(int i = 0 ; i < n ; i ++)\n\t\t\tdata[i] = Integer.parseInt(strdata[i]);",
"int i = 0 ;",
"int i = 0 ;",
"i",
"0",
"i < n",
"i",
"n",
"i ++",
"i ++",
"i",
"data[i] = Integer.parseInt(strdata[i]);",
"data[i] = Integer.parseInt(strdata[i])",
"data[i]",
"data",
"i",
"Integer.parseInt(strdata[i])",
"Integer.parseInt",
"Integer",
"strdata[i]",
"strdata",
"i",
"int count = bubble(data);",
"count",
"bubble(data)",
"bubble",
"data",
"for(int i = 0 ; i < n-1; i++){\n\t\t\tSystem.out.print(data[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(data[i]+\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(data[i]+\" \");\n\t\t}",
"System.out.print(data[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"data[i]+\" \"",
"data[i]",
"data",
"i",
"\" \"",
"System.out.println(data[n-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"data[n-1]",
"data",
"n-1",
"n",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main{\n\tprivate static int bubble(int a[]){\n\t\tint count=0;\n\t\tfor(int i = 0 ; i < a.length-1 ; 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 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\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\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[] strdata = new String[n];\n\t\tString str = br.readLine();\n\t\tstrdata = str.split(\" \");\n\t\tint[] data = new int[n];\n\t\tfor(int i = 0 ; i < n ; i ++)\n\t\t\tdata[i] = Integer.parseInt(strdata[i]);\n\t\tint count = bubble(data);\n\t\tfor(int i = 0 ; i < n-1; i++){\n\t\t\tSystem.out.print(data[i]+\" \");\n\t\t}\n\t\tSystem.out.println(data[n-1]);\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main{\n\tprivate static int bubble(int a[]){\n\t\tint count=0;\n\t\tfor(int i = 0 ; i < a.length-1 ; 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 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\t\t\t}\n\t\t}\n\t\treturn count;\n\t}\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[] strdata = new String[n];\n\t\tString str = br.readLine();\n\t\tstrdata = str.split(\" \");\n\t\tint[] data = new int[n];\n\t\tfor(int i = 0 ; i < n ; i ++)\n\t\t\tdata[i] = Integer.parseInt(strdata[i]);\n\t\tint count = bubble(data);\n\t\tfor(int i = 0 ; i < n-1; i++){\n\t\t\tSystem.out.print(data[i]+\" \");\n\t\t}\n\t\tSystem.out.println(data[n-1]);\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.*;
public class Main{
private static int bubble(int a[]){
int count=0;
for(int i = 0 ; i < a.length-1 ; i++){
for(int j = a.length-1;j>i;j--){
if(a[j]<a[j-1]){
int temp=a[j];
a[j]=a[j-1];
a[j-1]=temp;
count++;
}
}
}
return count;
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] strdata = new String[n];
String str = br.readLine();
strdata = str.split(" ");
int[] data = new int[n];
for(int i = 0 ; i < n ; i ++)
data[i] = Integer.parseInt(strdata[i]);
int count = bubble(data);
for(int i = 0 ; i < n-1; i++){
System.out.print(data[i]+" ");
}
System.out.println(data[n-1]);
System.out.println(count);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
41,
13,
17,
41,
13,
17,
41,
13,
17,
41,
13,
41,
13,
17,
0,
13,
4,
18,
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,
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,
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,
4,
18,
13,
18,
13,
13,
17,
30,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
13,
4,
18,
13,
17,
4,
18,
13,
13,
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
],
[
8,
15
],
[
15,
16
],
[
15,
17
],
[
8,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
21,
23
],
[
8,
24
],
[
24,
25
],
[
8,
26
],
[
26,
27
],
[
26,
28
],
[
8,
29
],
[
29,
30
],
[
29,
31
],
[
31,
32
],
[
32,
33
],
[
31,
34
],
[
34,
35
],
[
35,
36
],
[
8,
37
],
[
37,
38
],
[
37,
39
],
[
8,
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
],
[
62,
63
],
[
8,
64
],
[
64,
65
],
[
64,
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
],
[
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
],
[
145,
146
],
[
144,
147
],
[
147,
148
],
[
147,
149
],
[
142,
150
],
[
135,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
155,
156
],
[
155,
157
],
[
8,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
163,
164
],
[
164,
165
],
[
8,
166
],
[
166,
167
],
[
167,
168
],
[
166,
169
],
[
8,
170
],
[
170,
171
],
[
171,
172
],
[
170,
173
],
[
8,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
176,
178
],
[
174,
179
],
[
179,
180
],
[
180,
181
],
[
6,
182
],
[
182,
183
]
] | [
"import java.util.Scanner;\n\n/**\n * \n */\n\n/**\n * @author kawakami\n *\n */\nclass Main {\n\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tStringBuilder sb = new StringBuilder();\n\t\tScanner as = new Scanner(System.in);\n\t\t\n\t\tint N = 0;\n\t\tint tre = 0;\n\t\tint count = 0;\n\t\tint A[];\n\t\t\n\t\tBoolean flag = true;\n\t\t\n\t\tN = Integer.parseInt(as.next());\n\t\t\n\t\tA = new int[N];\n\t\t\n\t\tfor(int i=0;i<N;i++){\n\t\t\t\n\t\t\tA[i] = Integer.parseInt(as.next());\n\t\t\t\n\t\t}\n\t\t\n\t\twhile(flag){\n\t\t\t\n\t\t\tflag = false;\n\t\t\tfor(int j=N-1;j>=1;j--){\n\t\t\t\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\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\t\n\t\t\tif(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t\tsb.setLength(0);\n\t\tsb.append(count);\n\t\tSystem.out.println(sb.toString());\n\n\t}\n\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n\n\t/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tStringBuilder sb = new StringBuilder();\n\t\tScanner as = new Scanner(System.in);\n\t\t\n\t\tint N = 0;\n\t\tint tre = 0;\n\t\tint count = 0;\n\t\tint A[];\n\t\t\n\t\tBoolean flag = true;\n\t\t\n\t\tN = Integer.parseInt(as.next());\n\t\t\n\t\tA = new int[N];\n\t\t\n\t\tfor(int i=0;i<N;i++){\n\t\t\t\n\t\t\tA[i] = Integer.parseInt(as.next());\n\t\t\t\n\t\t}\n\t\t\n\t\twhile(flag){\n\t\t\t\n\t\t\tflag = false;\n\t\t\tfor(int j=N-1;j>=1;j--){\n\t\t\t\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\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\t\n\t\t\tif(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t\tsb.setLength(0);\n\t\tsb.append(count);\n\t\tSystem.out.println(sb.toString());\n\n\t}\n\n}",
"Main",
"/**\n\t * @param args\n\t */\n\tpublic static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\t\tStringBuilder sb = new StringBuilder();\n\t\tScanner as = new Scanner(System.in);\n\t\t\n\t\tint N = 0;\n\t\tint tre = 0;\n\t\tint count = 0;\n\t\tint A[];\n\t\t\n\t\tBoolean flag = true;\n\t\t\n\t\tN = Integer.parseInt(as.next());\n\t\t\n\t\tA = new int[N];\n\t\t\n\t\tfor(int i=0;i<N;i++){\n\t\t\t\n\t\t\tA[i] = Integer.parseInt(as.next());\n\t\t\t\n\t\t}\n\t\t\n\t\twhile(flag){\n\t\t\t\n\t\t\tflag = false;\n\t\t\tfor(int j=N-1;j>=1;j--){\n\t\t\t\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\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\t\n\t\t\tif(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t\tsb.setLength(0);\n\t\tsb.append(count);\n\t\tSystem.out.println(sb.toString());\n\n\t}",
"main",
"{\n\t\t// TODO Auto-generated method stub\n\t\tStringBuilder sb = new StringBuilder();\n\t\tScanner as = new Scanner(System.in);\n\t\t\n\t\tint N = 0;\n\t\tint tre = 0;\n\t\tint count = 0;\n\t\tint A[];\n\t\t\n\t\tBoolean flag = true;\n\t\t\n\t\tN = Integer.parseInt(as.next());\n\t\t\n\t\tA = new int[N];\n\t\t\n\t\tfor(int i=0;i<N;i++){\n\t\t\t\n\t\t\tA[i] = Integer.parseInt(as.next());\n\t\t\t\n\t\t}\n\t\t\n\t\twhile(flag){\n\t\t\t\n\t\t\tflag = false;\n\t\t\tfor(int j=N-1;j>=1;j--){\n\t\t\t\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\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\t\n\t\t\tif(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t\tsb.setLength(0);\n\t\tsb.append(count);\n\t\tSystem.out.println(sb.toString());\n\n\t}",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"Scanner as = new Scanner(System.in);",
"as",
"new Scanner(System.in)",
"int N = 0;",
"N",
"0",
"int tre = 0;",
"tre",
"0",
"int count = 0;",
"count",
"0",
"int A[];",
"A",
"Boolean flag = true;",
"flag",
"true",
"N = Integer.parseInt(as.next())",
"N",
"Integer.parseInt(as.next())",
"Integer.parseInt",
"Integer",
"as.next()",
"as.next",
"as",
"A = new int[N]",
"A",
"new int[N]",
"N",
"for(int i=0;i<N;i++){\n\t\t\t\n\t\t\tA[i] = Integer.parseInt(as.next());\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\n\t\t\tA[i] = Integer.parseInt(as.next());\n\t\t\t\n\t\t}",
"{\n\t\t\t\n\t\t\tA[i] = Integer.parseInt(as.next());\n\t\t\t\n\t\t}",
"A[i] = Integer.parseInt(as.next())",
"A[i]",
"A",
"i",
"Integer.parseInt(as.next())",
"Integer.parseInt",
"Integer",
"as.next()",
"as.next",
"as",
"while(flag){\n\t\t\t\n\t\t\tflag = false;\n\t\t\tfor(int j=N-1;j>=1;j--){\n\t\t\t\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}",
"flag",
"{\n\t\t\t\n\t\t\tflag = false;\n\t\t\tfor(int j=N-1;j>=1;j--){\n\t\t\t\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\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\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\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\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\t\n\t\t\t\tif(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"if(A[j] < A[j-1]){\n\t\t\t\t\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\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\t\n\t\t\t\t\ttre = A[j];\n\t\t\t\t\tA[j] = A[j-1];\n\t\t\t\t\tA[j-1] = tre;\n\t\t\t\t\tflag = true;\n\t\t\t\t\tcount++;\n\t\t\t\t\t\n\t\t\t\t}",
"tre = A[j]",
"tre",
"A[j]",
"A",
"j",
"A[j] = A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1] = tre",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"tre",
"flag = true",
"flag",
"true",
"count++",
"count",
"for(int i=0;i<N;i++){\n\t\t\t\n\t\t\tif(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\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\n\t\t\tif(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}\n\t\t}",
"{\n\t\t\t\n\t\t\tif(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}\n\t\t}",
"if(i != N-1){\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}",
"i != N-1",
"i",
"N-1",
"N",
"1",
"{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]).append(' ');\n\t\t\t\n\t\t\t}",
"sb.append(A[i]).append(' ')",
"sb.append(A[i]).append",
"sb.append(A[i])",
"sb.append",
"sb",
"A[i]",
"A",
"i",
"' '",
"{\n\t\t\t\t\n\t\t\t\tsb.append(A[i]);\n\t\t\t\t\n\t\t\t}",
"sb.append(A[i])",
"sb.append",
"sb",
"A[i]",
"A",
"i",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"sb.setLength(0)",
"sb.setLength",
"sb",
"0",
"sb.append(count)",
"sb.append",
"sb",
"count",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"String[] args",
"args"
] | import java.util.Scanner;
/**
*
*/
/**
* @author kawakami
*
*/
class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
StringBuilder sb = new StringBuilder();
Scanner as = new Scanner(System.in);
int N = 0;
int tre = 0;
int count = 0;
int A[];
Boolean flag = true;
N = Integer.parseInt(as.next());
A = new int[N];
for(int i=0;i<N;i++){
A[i] = Integer.parseInt(as.next());
}
while(flag){
flag = false;
for(int j=N-1;j>=1;j--){
if(A[j] < A[j-1]){
tre = A[j];
A[j] = A[j-1];
A[j-1] = tre;
flag = true;
count++;
}
}
}
for(int i=0;i<N;i++){
if(i != N-1){
sb.append(A[i]).append(' ');
}
else{
sb.append(A[i]);
}
}
System.out.println(sb.toString());
sb.setLength(0);
sb.append(count);
System.out.println(sb.toString());
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
0,
13,
20,
41,
13,
20,
4,
18,
13,
4,
18,
13,
23,
13,
6,
13,
12,
13,
30,
41,
13,
4,
18,
13,
41,
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,
0,
13,
4,
13,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
13,
17,
30,
4,
18,
13,
17,
4,
18,
13,
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,
29,
13,
23,
13,
23,
13,
6,
13,
41,
13,
41,
13,
12,
13,
30,
0,
13,
20,
23,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
4,
18,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
12,
13,
30,
42,
2,
2,
13,
17,
40,
4,
18,
13,
30,
0,
13,
20,
29,
4,
18,
13,
4,
18,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
10,
11
],
[
10,
12
],
[
0,
13
],
[
13,
14
],
[
13,
15
],
[
0,
16
],
[
16,
17
],
[
16,
18
],
[
0,
19
],
[
19,
20
],
[
19,
21
],
[
0,
22
],
[
22,
23
],
[
22,
24
],
[
0,
25
],
[
25,
26
],
[
25,
27
],
[
0,
28
],
[
28,
29
],
[
28,
30
],
[
0,
31
],
[
31,
32
],
[
31,
33
],
[
0,
34
],
[
34,
35
],
[
34,
36
],
[
0,
37
],
[
37,
38
],
[
37,
39
],
[
0,
40
],
[
40,
41
],
[
40,
42
],
[
0,
43
],
[
43,
44
],
[
43,
45
],
[
0,
46
],
[
46,
47
],
[
46,
48
],
[
0,
49
],
[
49,
50
],
[
49,
51
],
[
0,
52
],
[
52,
53
],
[
52,
54
],
[
0,
55
],
[
55,
56
],
[
55,
57
],
[
0,
58
],
[
342,
59
],
[
342,
60
],
[
60,
61
],
[
342,
62
],
[
62,
63
],
[
342,
64
],
[
64,
65
],
[
64,
66
],
[
66,
67
],
[
67,
68
],
[
67,
69
],
[
66,
70
],
[
70,
71
],
[
70,
72
],
[
66,
73
],
[
73,
74
],
[
73,
75
],
[
66,
76
],
[
76,
77
],
[
77,
78
],
[
66,
79
],
[
79,
80
],
[
80,
81
],
[
64,
82
],
[
82,
83
],
[
342,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
91,
92
],
[
92,
93
],
[
88,
94
],
[
94,
95
],
[
88,
96
],
[
96,
97
],
[
96,
98
],
[
88,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
100,
105
],
[
105,
106
],
[
105,
107
],
[
100,
108
],
[
108,
109
],
[
109,
110
],
[
100,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
113,
117
],
[
117,
118
],
[
118,
119
],
[
88,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
122,
125
],
[
88,
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
],
[
139,
142
],
[
142,
143
],
[
142,
144
],
[
138,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
152,
155
],
[
145,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
157,
160
],
[
88,
161
],
[
161,
162
],
[
162,
163
],
[
161,
164
],
[
84,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
171,
172
],
[
171,
173
],
[
167,
174
],
[
174,
175
],
[
174,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
176,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
184,
186
],
[
180,
187
],
[
187,
188
],
[
187,
189
],
[
180,
190
],
[
190,
191
],
[
191,
192
],
[
180,
193
],
[
194,
194
],
[
194,
195
],
[
195,
196
],
[
196,
197
],
[
197,
198
],
[
197,
199
],
[
196,
200
],
[
200,
201
],
[
200,
202
],
[
202,
203
],
[
202,
204
],
[
195,
205
],
[
205,
206
],
[
206,
207
],
[
206,
208
],
[
208,
209
],
[
208,
210
],
[
205,
211
],
[
211,
212
],
[
212,
213
],
[
212,
214
],
[
211,
215
],
[
215,
216
],
[
215,
217
],
[
217,
218
],
[
217,
219
],
[
205,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
223,
225
],
[
220,
226
],
[
205,
227
],
[
227,
228
],
[
205,
229
],
[
229,
230
],
[
229,
231
],
[
167,
232
],
[
232,
233
],
[
165,
234
],
[
234,
235
],
[
165,
236
],
[
236,
237
],
[
342,
238
],
[
238,
239
],
[
238,
240
],
[
240,
241
],
[
238,
242
],
[
242,
243
],
[
238,
244
],
[
244,
245
],
[
244,
246
],
[
246,
247
],
[
247,
248
],
[
247,
249
],
[
244,
250
],
[
250,
251
],
[
238,
252
],
[
252,
253
],
[
252,
254
],
[
254,
255
],
[
255,
256
],
[
256,
257
],
[
257,
258
],
[
257,
259
],
[
256,
260
],
[
260,
261
],
[
261,
262
],
[
262,
263
],
[
255,
264
],
[
264,
265
],
[
265,
266
],
[
265,
267
],
[
254,
268
],
[
268,
269
],
[
269,
270
],
[
270,
271
],
[
269,
272
],
[
272,
273
],
[
273,
274
],
[
238,
275
],
[
275,
276
],
[
275,
277
],
[
277,
278
],
[
278,
279
],
[
279,
280
],
[
280,
281
],
[
280,
282
],
[
279,
283
],
[
283,
284
],
[
284,
285
],
[
285,
286
],
[
278,
287
],
[
287,
288
],
[
288,
289
],
[
288,
290
],
[
277,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
292,
295
],
[
295,
296
],
[
296,
297
],
[
238,
298
],
[
298,
299
],
[
298,
300
],
[
300,
301
],
[
301,
302
],
[
302,
303
],
[
303,
304
],
[
303,
305
],
[
302,
306
],
[
306,
307
],
[
307,
308
],
[
308,
309
],
[
301,
310
],
[
310,
311
],
[
311,
312
],
[
311,
313
],
[
300,
314
],
[
314,
315
],
[
315,
316
],
[
316,
317
],
[
238,
318
],
[
318,
319
],
[
318,
320
],
[
320,
321
],
[
321,
322
],
[
322,
323
],
[
323,
324
],
[
323,
325
],
[
322,
326
],
[
326,
327
],
[
327,
328
],
[
328,
329
],
[
321,
330
],
[
330,
331
],
[
331,
332
],
[
331,
333
],
[
320,
334
],
[
334,
335
],
[
335,
336
],
[
336,
337
],
[
335,
338
],
[
338,
339
],
[
339,
340
],
[
0,
341
],
[
341,
342
],
[
341,
343
]
] | [
"import java.awt.Frame;\nimport java.awt.image.SinglePixelPackedSampleModel;\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.StringTokenizer;\n\nimport javax.print.attribute.standard.Chromaticity;\nimport javax.sql.rowset.FilteredRowSet;\nimport javax.swing.BorderFactory;\nimport javax.xml.parsers.DocumentBuilder;\nimport javax.xml.stream.events.EndDocument;\nimport javax.xml.transform.Templates;\n\nimport java.math.BigInteger;\nimport java.time.chrono.MinguoChronology;\nimport java.util.Scanner;\n\npublic class Main {\n static InputReader in;\n static PrintWriter out;\n \n static class Solution {\n void solve() throws IOException {\n int N = in.nextInt();\n int cnt;\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n \n cnt = bubbleSort(A, N);\n \n for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }\n \n out.println(cnt);\n// End solve()\n }\n \n int bubbleSort(int[] A, int N) {\n int cnt = 0;\n \n boolean flg = true;\n while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }\n return cnt;\n }\n \n// End solution\n } \n \n\n public static void main(String[] args) throws IOException {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n Solution solver = new Solution();\n solver.solve();\n out.close();\n}\n\n static class InputReader {\n public BufferedReader br;\n public StringTokenizer st;\n \n public InputReader(InputStream stream) {\n br = new BufferedReader(new InputStreamReader(stream));\n }\n \n public int nextInt() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Integer.parseInt(st.nextToken());\n }\n \n public long nextLong() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Long.parseLong(st.nextToken()); \n }\n \n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public double nextDouble() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Double.parseDouble(st.nextToken());\n }\n \n }\n \n}",
"import java.awt.Frame;",
"Frame",
"java.awt",
"import java.awt.image.SinglePixelPackedSampleModel;",
"SinglePixelPackedSampleModel",
"java.awt.image",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.io.OutputStream;",
"OutputStream",
"java.io",
"import java.io.PrintWriter;",
"PrintWriter",
"java.io",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"import javax.print.attribute.standard.Chromaticity;",
"Chromaticity",
"javax.print.attribute.standard",
"import javax.sql.rowset.FilteredRowSet;",
"FilteredRowSet",
"javax.sql.rowset",
"import javax.swing.BorderFactory;",
"BorderFactory",
"javax.swing",
"import javax.xml.parsers.DocumentBuilder;",
"DocumentBuilder",
"javax.xml.parsers",
"import javax.xml.stream.events.EndDocument;",
"EndDocument",
"javax.xml.stream.events",
"import javax.xml.transform.Templates;",
"Templates",
"javax.xml.transform",
"import java.math.BigInteger;",
"BigInteger",
"java.math",
"import java.time.chrono.MinguoChronology;",
"MinguoChronology",
"java.time.chrono",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n static InputReader in;\n static PrintWriter out;\n \n static class Solution {\n void solve() throws IOException {\n int N = in.nextInt();\n int cnt;\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n \n cnt = bubbleSort(A, N);\n \n for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }\n \n out.println(cnt);\n// End solve()\n }\n \n int bubbleSort(int[] A, int N) {\n int cnt = 0;\n \n boolean flg = true;\n while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }\n return cnt;\n }\n \n// End solution\n } \n \n\n public static void main(String[] args) throws IOException {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n Solution solver = new Solution();\n solver.solve();\n out.close();\n}\n\n static class InputReader {\n public BufferedReader br;\n public StringTokenizer st;\n \n public InputReader(InputStream stream) {\n br = new BufferedReader(new InputStreamReader(stream));\n }\n \n public int nextInt() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Integer.parseInt(st.nextToken());\n }\n \n public long nextLong() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Long.parseLong(st.nextToken()); \n }\n \n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public double nextDouble() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Double.parseDouble(st.nextToken());\n }\n \n }\n \n}",
"Main",
"static InputReader in;",
"in",
"static PrintWriter out;",
"out",
"public static void main(String[] args) throws IOException {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n Solution solver = new Solution();\n solver.solve();\n out.close();\n}",
"main",
"{\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n Solution solver = new Solution();\n solver.solve();\n out.close();\n}",
"in = new InputReader(System.in)",
"in",
"new InputReader(System.in)",
"out = new PrintWriter(System.out)",
"out",
"new PrintWriter(System.out)",
"Solution solver = new Solution();",
"solver",
"new Solution()",
"solver.solve()",
"solver.solve",
"solver",
"out.close()",
"out.close",
"out",
"String[] args",
"args",
"static class Solution {\n void solve() throws IOException {\n int N = in.nextInt();\n int cnt;\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n \n cnt = bubbleSort(A, N);\n \n for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }\n \n out.println(cnt);\n// End solve()\n }\n \n int bubbleSort(int[] A, int N) {\n int cnt = 0;\n \n boolean flg = true;\n while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }\n return cnt;\n }\n \n// End solution\n }",
"Solution",
"void solve() throws IOException {\n int N = in.nextInt();\n int cnt;\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n \n cnt = bubbleSort(A, N);\n \n for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }\n \n out.println(cnt);\n// End solve()\n }",
"solve",
"{\n int N = in.nextInt();\n int cnt;\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n \n cnt = bubbleSort(A, N);\n \n for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }\n \n out.println(cnt);\n// End solve()\n }",
"int N = in.nextInt();",
"N",
"in.nextInt()",
"in.nextInt",
"in",
"int cnt;",
"cnt",
"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",
"cnt = bubbleSort(A, N)",
"cnt",
"bubbleSort(A, N)",
"bubbleSort",
"A",
"N",
"for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }",
"{\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }",
"out.print(A[i])",
"out.print",
"out",
"A[i]",
"A",
"i",
"if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }",
"i != N - 1",
"i",
"N - 1",
"N",
"1",
"{ \n out.print(\" \");\n }",
"out.print(\" \")",
"out.print",
"out",
"\" \"",
"{\n out.print(\"\\n\");\n }",
"out.print(\"\\n\")",
"out.print",
"out",
"\"\\n\"",
"out.println(cnt)",
"out.println",
"out",
"cnt",
"int bubbleSort(int[] A, int N) {\n int cnt = 0;\n \n boolean flg = true;\n while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }\n return cnt;\n }",
"bubbleSort",
"{\n int cnt = 0;\n \n boolean flg = true;\n while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }\n return cnt;\n }",
"int cnt = 0;",
"cnt",
"0",
"boolean flg = true;",
"flg",
"true",
"while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }",
"flg",
"{\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }",
"flg = false",
"flg",
"false",
"for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = 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 tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }",
"{\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }",
"if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }",
"A[i] < A[i - 1]",
"A[i]",
"A",
"i",
"A[i - 1]",
"A",
"i - 1",
"i",
"1",
"{\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }",
"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",
"cnt++",
"cnt",
"flg = true",
"flg",
"true",
"return cnt;",
"cnt",
"int[] A",
"A",
"int N",
"N",
"static class InputReader {\n public BufferedReader br;\n public StringTokenizer st;\n \n public InputReader(InputStream stream) {\n br = new BufferedReader(new InputStreamReader(stream));\n }\n \n public int nextInt() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Integer.parseInt(st.nextToken());\n }\n \n public long nextLong() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Long.parseLong(st.nextToken()); \n }\n \n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public double nextDouble() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Double.parseDouble(st.nextToken());\n }\n \n }",
"InputReader",
"public BufferedReader br;",
"br",
"public StringTokenizer st;",
"st",
"public InputReader(InputStream stream) {\n br = new BufferedReader(new InputStreamReader(stream));\n }",
"InputReader",
"{\n br = new BufferedReader(new InputStreamReader(stream));\n }",
"br = new BufferedReader(new InputStreamReader(stream))",
"br",
"new BufferedReader(new InputStreamReader(stream))",
"InputStream stream",
"stream",
"public int nextInt() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Integer.parseInt(st.nextToken());\n }",
"nextInt",
"{\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Integer.parseInt(st.nextToken());\n }",
"while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return Integer.parseInt(st.nextToken());",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"public long nextLong() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Long.parseLong(st.nextToken()); \n }",
"nextLong",
"{\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Long.parseLong(st.nextToken()); \n }",
"while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return Long.parseLong(st.nextToken());",
"Long.parseLong(st.nextToken())",
"Long.parseLong",
"Long",
"st.nextToken()",
"st.nextToken",
"st",
"public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }",
"next",
"{\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }",
"while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return st.nextToken();",
"st.nextToken()",
"st.nextToken",
"st",
"public double nextDouble() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Double.parseDouble(st.nextToken());\n }",
"nextDouble",
"{\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Double.parseDouble(st.nextToken());\n }",
"while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }",
"st == null || !st.hasMoreTokens()",
"st == null",
"st",
"null",
"!st.hasMoreTokens()",
"st.hasMoreTokens()",
"st.hasMoreTokens",
"st",
"{\n st = new StringTokenizer(br.readLine());\n }",
"st = new StringTokenizer(br.readLine())",
"st",
"new StringTokenizer(br.readLine())",
"return Double.parseDouble(st.nextToken());",
"Double.parseDouble(st.nextToken())",
"Double.parseDouble",
"Double",
"st.nextToken()",
"st.nextToken",
"st",
"public class Main {\n static InputReader in;\n static PrintWriter out;\n \n static class Solution {\n void solve() throws IOException {\n int N = in.nextInt();\n int cnt;\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n \n cnt = bubbleSort(A, N);\n \n for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }\n \n out.println(cnt);\n// End solve()\n }\n \n int bubbleSort(int[] A, int N) {\n int cnt = 0;\n \n boolean flg = true;\n while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }\n return cnt;\n }\n \n// End solution\n } \n \n\n public static void main(String[] args) throws IOException {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n Solution solver = new Solution();\n solver.solve();\n out.close();\n}\n\n static class InputReader {\n public BufferedReader br;\n public StringTokenizer st;\n \n public InputReader(InputStream stream) {\n br = new BufferedReader(new InputStreamReader(stream));\n }\n \n public int nextInt() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Integer.parseInt(st.nextToken());\n }\n \n public long nextLong() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Long.parseLong(st.nextToken()); \n }\n \n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public double nextDouble() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Double.parseDouble(st.nextToken());\n }\n \n }\n \n}",
"public class Main {\n static InputReader in;\n static PrintWriter out;\n \n static class Solution {\n void solve() throws IOException {\n int N = in.nextInt();\n int cnt;\n int[] A = new int[N];\n for (int i = 0; i < N; i++) {\n A[i] = in.nextInt();\n }\n \n cnt = bubbleSort(A, N);\n \n for (int i = 0; i < N; i++) {\n out.print(A[i]);\n if (i != N - 1) { \n out.print(\" \");\n } else {\n out.print(\"\\n\");\n }\n }\n \n out.println(cnt);\n// End solve()\n }\n \n int bubbleSort(int[] A, int N) {\n int cnt = 0;\n \n boolean flg = true;\n while (flg) {\n flg = false;\n for (int i = N - 1; i > 0; i--) {\n if (A[i] < A[i - 1]) {\n int tmp = A[i];\n A[i] = A[i - 1];\n A[i - 1] = tmp;\n \n cnt++;\n flg = true;\n }\n }\n \n }\n return cnt;\n }\n \n// End solution\n } \n \n\n public static void main(String[] args) throws IOException {\n in = new InputReader(System.in);\n out = new PrintWriter(System.out);\n Solution solver = new Solution();\n solver.solve();\n out.close();\n}\n\n static class InputReader {\n public BufferedReader br;\n public StringTokenizer st;\n \n public InputReader(InputStream stream) {\n br = new BufferedReader(new InputStreamReader(stream));\n }\n \n public int nextInt() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Integer.parseInt(st.nextToken());\n }\n \n public long nextLong() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Long.parseLong(st.nextToken()); \n }\n \n public String next() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return st.nextToken();\n }\n \n public double nextDouble() throws IOException {\n while (st == null || !st.hasMoreTokens()) {\n st = new StringTokenizer(br.readLine());\n }\n return Double.parseDouble(st.nextToken());\n }\n \n }\n \n}",
"Main"
] | import java.awt.Frame;
import java.awt.image.SinglePixelPackedSampleModel;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import javax.print.attribute.standard.Chromaticity;
import javax.sql.rowset.FilteredRowSet;
import javax.swing.BorderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.stream.events.EndDocument;
import javax.xml.transform.Templates;
import java.math.BigInteger;
import java.time.chrono.MinguoChronology;
import java.util.Scanner;
public class Main {
static InputReader in;
static PrintWriter out;
static class Solution {
void solve() throws IOException {
int N = in.nextInt();
int cnt;
int[] A = new int[N];
for (int i = 0; i < N; i++) {
A[i] = in.nextInt();
}
cnt = bubbleSort(A, N);
for (int i = 0; i < N; i++) {
out.print(A[i]);
if (i != N - 1) {
out.print(" ");
} else {
out.print("\n");
}
}
out.println(cnt);
// End solve()
}
int bubbleSort(int[] A, int N) {
int cnt = 0;
boolean flg = true;
while (flg) {
flg = false;
for (int i = N - 1; i > 0; i--) {
if (A[i] < A[i - 1]) {
int tmp = A[i];
A[i] = A[i - 1];
A[i - 1] = tmp;
cnt++;
flg = true;
}
}
}
return cnt;
}
// End solution
}
public static void main(String[] args) throws IOException {
in = new InputReader(System.in);
out = new PrintWriter(System.out);
Solution solver = new Solution();
solver.solve();
out.close();
}
static class InputReader {
public BufferedReader br;
public StringTokenizer st;
public InputReader(InputStream stream) {
br = new BufferedReader(new InputStreamReader(stream));
}
public int nextInt() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return Integer.parseInt(st.nextToken());
}
public long nextLong() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return Long.parseLong(st.nextToken());
}
public String next() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return st.nextToken();
}
public double nextDouble() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(br.readLine());
}
return Double.parseDouble(st.nextToken());
}
}
} |
[
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,
4,
18,
13,
41,
13,
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,
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,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
2,
2,
17,
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
],
[
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
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
30,
31
],
[
31,
32
],
[
30,
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
],
[
14,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
76,
78
],
[
72,
79
],
[
79,
80
],
[
79,
81
],
[
72,
82
],
[
82,
83
],
[
83,
84
],
[
72,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
88,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
94,
96
],
[
87,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
100,
101
],
[
100,
102
],
[
97,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
97,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
112,
118
],
[
97,
119
],
[
119,
120
],
[
119,
121
],
[
97,
122
],
[
122,
123
],
[
14,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
124,
129
],
[
129,
130
],
[
129,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
124,
135
],
[
136,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
139,
140
],
[
139,
141
],
[
137,
142
],
[
142,
143
],
[
142,
144
],
[
136,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
14,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
163,
163
],
[
163,
164
],
[
163,
165
],
[
163,
166
],
[
12,
167
],
[
167,
168
],
[
0,
169
],
[
169,
170
],
[
169,
171
]
] | [
"import java.awt.datatransfer.FlavorEvent;\nimport java.util.Scanner;\nimport javax.sound.midi.SysexMessage;\n \npublic class Main{ \n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String str = sc.nextLine();\n String str2[] = str.split(\" \");\n int ints[] = new int[n];\n int flag = 1;\n int count = 0;\n\n for(int i = 0;i<n;i++)\n {\n ints[i]= sc.nextInt();\n }\n\n while (flag==1){\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }\n for (int i = 0; i<n;i++)\n {\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }\n System.out.print(\"\\n\"+count+\"\\n\");\n } \n}",
"import java.awt.datatransfer.FlavorEvent;",
"FlavorEvent",
"java.awt.datatransfer",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import javax.sound.midi.SysexMessage;",
"SysexMessage",
"javax.sound.midi",
"public class Main{ \n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String str = sc.nextLine();\n String str2[] = str.split(\" \");\n int ints[] = new int[n];\n int flag = 1;\n int count = 0;\n\n for(int i = 0;i<n;i++)\n {\n ints[i]= sc.nextInt();\n }\n\n while (flag==1){\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }\n for (int i = 0; i<n;i++)\n {\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }\n System.out.print(\"\\n\"+count+\"\\n\");\n } \n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String str = sc.nextLine();\n String str2[] = str.split(\" \");\n int ints[] = new int[n];\n int flag = 1;\n int count = 0;\n\n for(int i = 0;i<n;i++)\n {\n ints[i]= sc.nextInt();\n }\n\n while (flag==1){\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }\n for (int i = 0; i<n;i++)\n {\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }\n System.out.print(\"\\n\"+count+\"\\n\");\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n String str = sc.nextLine();\n String str2[] = str.split(\" \");\n int ints[] = new int[n];\n int flag = 1;\n int count = 0;\n\n for(int i = 0;i<n;i++)\n {\n ints[i]= sc.nextInt();\n }\n\n while (flag==1){\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }\n for (int i = 0; i<n;i++)\n {\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }\n System.out.print(\"\\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",
"String str = sc.nextLine();",
"str",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String str2[] = str.split(\" \");",
"str2",
"str.split(\" \")",
"str.split",
"str",
"\" \"",
"int ints[] = new int[n];",
"ints",
"new int[n]",
"n",
"int flag = 1;",
"flag",
"1",
"int count = 0;",
"count",
"0",
"for(int i = 0;i<n;i++)\n {\n ints[i]= sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n ints[i]= sc.nextInt();\n }",
"{\n ints[i]= sc.nextInt();\n }",
"ints[i]= sc.nextInt()",
"ints[i]",
"ints",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"while (flag==1){\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }",
"flag==1",
"flag",
"1",
"{\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }",
"flag = 0",
"flag",
"0",
"for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }",
"int j=n-1;",
"int j=n-1;",
"j",
"n-1",
"n",
"1",
"j>0",
"j",
"0",
"j--",
"j--",
"j",
"{\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }",
"{\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }",
"if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }",
"ints[j]<ints[j-1]",
"ints[j]",
"ints",
"j",
"ints[j-1]",
"ints",
"j-1",
"j",
"1",
"{\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }",
"int x = ints[j];",
"x",
"ints[j]",
"ints",
"j",
"ints[j]=ints[j-1]",
"ints[j]",
"ints",
"j",
"ints[j-1]",
"ints",
"j-1",
"j",
"1",
"ints[j-1]=x",
"ints[j-1]",
"ints",
"j-1",
"j",
"1",
"x",
"flag = 1",
"flag",
"1",
"count++",
"count",
"for (int i = 0; i<n;i++)\n {\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }",
"{\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }",
"System.out.print(ints[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"ints[i]",
"ints",
"i",
"if(i!=n-1)\n System.out.print(\" \");",
"i!=n-1",
"i",
"n-1",
"n",
"1",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(\"\\n\"+count+\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"+count+\"\\n\"",
"\"\\n\"+count+\"\\n\"",
"\"\\n\"",
"count",
"\"\\n\"",
"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 String str = sc.nextLine();\n String str2[] = str.split(\" \");\n int ints[] = new int[n];\n int flag = 1;\n int count = 0;\n\n for(int i = 0;i<n;i++)\n {\n ints[i]= sc.nextInt();\n }\n\n while (flag==1){\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }\n for (int i = 0; i<n;i++)\n {\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }\n System.out.print(\"\\n\"+count+\"\\n\");\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 String str = sc.nextLine();\n String str2[] = str.split(\" \");\n int ints[] = new int[n];\n int flag = 1;\n int count = 0;\n\n for(int i = 0;i<n;i++)\n {\n ints[i]= sc.nextInt();\n }\n\n while (flag==1){\n flag = 0;\n for(int j=n-1;j>0;j--)\n {\n if(ints[j]<ints[j-1])\n {\n int x = ints[j];\n ints[j]=ints[j-1];\n ints[j-1]=x;\n flag = 1;\n count++;\n }\n }\n }\n for (int i = 0; i<n;i++)\n {\n System.out.print(ints[i]);\n if(i!=n-1)\n System.out.print(\" \");\n }\n System.out.print(\"\\n\"+count+\"\\n\");\n } \n}",
"Main"
] | import java.awt.datatransfer.FlavorEvent;
import java.util.Scanner;
import javax.sound.midi.SysexMessage;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String str = sc.nextLine();
String str2[] = str.split(" ");
int ints[] = new int[n];
int flag = 1;
int count = 0;
for(int i = 0;i<n;i++)
{
ints[i]= sc.nextInt();
}
while (flag==1){
flag = 0;
for(int j=n-1;j>0;j--)
{
if(ints[j]<ints[j-1])
{
int x = ints[j];
ints[j]=ints[j-1];
ints[j-1]=x;
flag = 1;
count++;
}
}
}
for (int i = 0; i<n;i++)
{
System.out.print(ints[i]);
if(i!=n-1)
System.out.print(" ");
}
System.out.print("\n"+count+"\n");
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
17,
41,
13,
41,
13,
17,
11,
1,
0,
13,
17,
13,
1,
40,
13,
30,
30,
0,
13,
17,
11,
1,
0,
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,
0,
13,
17,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
17,
41,
13,
41,
13,
11,
1,
0,
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,
0,
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,
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
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
13,
15
],
[
8,
16
],
[
16,
17
],
[
8,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
23,
24
],
[
23,
25
],
[
21,
26
],
[
21,
27
],
[
27,
28
],
[
28,
29
],
[
21,
30
],
[
31,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
31,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
39,
40
],
[
39,
41
],
[
35,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
44,
46
],
[
35,
47
],
[
47,
48
],
[
48,
49
],
[
35,
50
],
[
51,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
52,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
62,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
62,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
77,
83
],
[
62,
84
],
[
84,
85
],
[
84,
86
],
[
62,
87
],
[
87,
88
],
[
8,
89
],
[
89,
90
],
[
6,
91
],
[
91,
92
],
[
6,
93
],
[
93,
94
],
[
4,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
97,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
104,
105
],
[
97,
106
],
[
106,
107
],
[
106,
108
],
[
97,
110
],
[
110,
111
],
[
97,
112
],
[
112,
113
],
[
97,
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
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
132,
133
],
[
97,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
136,
139
],
[
97,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
140,
145
],
[
145,
146
],
[
145,
147
],
[
140,
148
],
[
148,
149
],
[
149,
150
],
[
140,
151
],
[
152,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
152,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
163,
168
],
[
168,
169
],
[
168,
170
],
[
97,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
97,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
176,
181
],
[
97,
182
],
[
182,
183
],
[
183,
184
],
[
95,
185
],
[
185,
186
]
] | [
"import java.util.Scanner;\n\n class Main{\n\t\npublic static int bubbleSort(int A[],int N){\n int i,j,r=0,temp;\n boolean flag=true;\n for(i=0;flag;i++){\n \tflag=false;\n for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}\n}\n return r;\n}\n \npublic static void main(String[] args){\n \n\t\t Scanner sc= new Scanner(System.in);\n\t int N=sc.nextInt();\n int A[]=new int[100];\n \n int i,j;\n for(i=0;i<N;i++){\n \t A[i] = sc.nextInt();\n }\n\t \n int loop = bubbleSort(A,N);\n for(i=0;i<N;i++){\n \t if(i>0)\n \t System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\n System.out.println(loop);\n sc.close();\n}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n\t\npublic static int bubbleSort(int A[],int N){\n int i,j,r=0,temp;\n boolean flag=true;\n for(i=0;flag;i++){\n \tflag=false;\n for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}\n}\n return r;\n}\n \npublic static void main(String[] args){\n \n\t\t Scanner sc= new Scanner(System.in);\n\t int N=sc.nextInt();\n int A[]=new int[100];\n \n int i,j;\n for(i=0;i<N;i++){\n \t A[i] = sc.nextInt();\n }\n\t \n int loop = bubbleSort(A,N);\n for(i=0;i<N;i++){\n \t if(i>0)\n \t System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\n System.out.println(loop);\n sc.close();\n}\n}",
"Main",
"public static int bubbleSort(int A[],int N){\n int i,j,r=0,temp;\n boolean flag=true;\n for(i=0;flag;i++){\n \tflag=false;\n for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}\n}\n return r;\n}",
"bubbleSort",
"{\n int i,j,r=0,temp;\n boolean flag=true;\n for(i=0;flag;i++){\n \tflag=false;\n for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}\n}\n return r;\n}",
"int i",
"i",
"j",
"j",
"r=0",
"r",
"0",
"temp;",
"temp",
"boolean flag=true;",
"flag",
"true",
"for(i=0;flag;i++){\n \tflag=false;\n for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}\n}",
"i=0;",
"i=0",
"i",
"0",
"flag",
"i++",
"i++",
"i",
"{\n \tflag=false;\n for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}\n}",
"{\n \tflag=false;\n for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}\n}",
"flag=false",
"flag",
"false",
"for(j=N-1;j>=i+1;j--){\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}",
"j=N-1;",
"j=N-1",
"j",
"N-1",
"N",
"1",
"j>=i+1",
"j",
"i+1",
"i",
"1",
"j--",
"j--",
"j",
"{\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}",
"{\n \tif(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }\n}",
"if(A[j]<A[j-1]){\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }",
"A[j]<A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n \t\ttemp=A[j];\n \t\tA[j]=A[j-1];\n \t\tA[j-1]=temp;\n flag=true;\n r++; \t\n }",
"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",
"r++",
"r",
"return r;",
"r",
"int A[]",
"A",
"int N",
"N",
"public static void main(String[] args){\n \n\t\t Scanner sc= new Scanner(System.in);\n\t int N=sc.nextInt();\n int A[]=new int[100];\n \n int i,j;\n for(i=0;i<N;i++){\n \t A[i] = sc.nextInt();\n }\n\t \n int loop = bubbleSort(A,N);\n for(i=0;i<N;i++){\n \t if(i>0)\n \t System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\n System.out.println(loop);\n sc.close();\n}",
"main",
"{\n \n\t\t Scanner sc= new Scanner(System.in);\n\t int N=sc.nextInt();\n int A[]=new int[100];\n \n int i,j;\n for(i=0;i<N;i++){\n \t A[i] = sc.nextInt();\n }\n\t \n int loop = bubbleSort(A,N);\n for(i=0;i<N;i++){\n \t if(i>0)\n \t System.out.print(\" \");\n System.out.print(A[i]);\n }\n System.out.println();\n System.out.println(loop);\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[100];",
"A",
"new int[100]",
"100",
"int i",
"i",
"j;",
"j",
"for(i=0;i<N;i++){\n \t A[i] = sc.nextInt();\n }",
"i=0;",
"i=0",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \t A[i] = sc.nextInt();\n }",
"{\n \t A[i] = sc.nextInt();\n }",
"A[i] = sc.nextInt()",
"A[i]",
"A",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int loop = bubbleSort(A,N);",
"loop",
"bubbleSort(A,N)",
"bubbleSort",
"A",
"N",
"for(i=0;i<N;i++){\n \t if(i>0)\n \t System.out.print(\" \");\n System.out.print(A[i]);\n }",
"i=0;",
"i=0",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n \t if(i>0)\n \t System.out.print(\" \");\n System.out.print(A[i]);\n }",
"{\n \t if(i>0)\n \t System.out.print(\" \");\n System.out.print(A[i]);\n }",
"if(i>0)\n \t 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",
"System.out.println(loop)",
"System.out.println",
"System.out",
"System",
"System.out",
"loop",
"sc.close()",
"sc.close",
"sc",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static int bubbleSort(int A[],int N){
int i,j,r=0,temp;
boolean flag=true;
for(i=0;flag;i++){
flag=false;
for(j=N-1;j>=i+1;j--){
if(A[j]<A[j-1]){
temp=A[j];
A[j]=A[j-1];
A[j-1]=temp;
flag=true;
r++;
}
}
}
return r;
}
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int N=sc.nextInt();
int A[]=new int[100];
int i,j;
for(i=0;i<N;i++){
A[i] = sc.nextInt();
}
int loop = bubbleSort(A,N);
for(i=0;i<N;i++){
if(i>0)
System.out.print(" ");
System.out.print(A[i]);
}
System.out.println();
System.out.println(loop);
sc.close();
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
4,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
4,
18,
13,
4,
18,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
4,
18,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
4,
18,
13,
13,
41,
13,
4,
18,
13,
2,
13,
17,
14,
2,
13,
13,
30,
4,
18,
13,
13,
13,
4,
18,
13,
2,
13,
17,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
4,
18,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
166,
5
],
[
166,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
6,
11
],
[
11,
12
],
[
166,
13
],
[
13,
14
],
[
13,
15
],
[
15,
16
],
[
16,
17
],
[
16,
18
],
[
15,
19
],
[
19,
20
],
[
19,
21
],
[
21,
22
],
[
22,
23
],
[
21,
24
],
[
24,
25
],
[
25,
26
],
[
15,
27
],
[
27,
28
],
[
27,
29
],
[
15,
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
],
[
43,
46
],
[
46,
47
],
[
47,
48
],
[
15,
49
],
[
49,
50
],
[
50,
51
],
[
15,
52
],
[
52,
53
],
[
52,
54
],
[
15,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
55,
65
],
[
65,
66
],
[
66,
67
],
[
55,
68
],
[
69,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
75,
76
],
[
76,
77
],
[
74,
78
],
[
70,
79
],
[
79,
80
],
[
79,
81
],
[
70,
82
],
[
82,
83
],
[
83,
84
],
[
70,
85
],
[
86,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
86,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
95,
98
],
[
98,
99
],
[
98,
100
],
[
86,
101
],
[
101,
102
],
[
102,
103
],
[
102,
104
],
[
101,
105
],
[
105,
106
],
[
106,
107
],
[
107,
108
],
[
106,
109
],
[
106,
110
],
[
105,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
114,
116
],
[
111,
117
],
[
105,
118
],
[
118,
119
],
[
15,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
120,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
128,
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
],
[
134,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
150,
151
],
[
151,
152
],
[
150,
153
],
[
15,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
15,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"import java.util.*;\n\npublic class Main {\n public static void main(String[] args) {\n aldl_1_2_a();\n }\n\n static void aldl_1_2_a() {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n ArrayList<Integer> data = new ArrayList<Integer>();\n for (int i = 0; i < n; i++) {\n data.add(sc.nextInt());\n }\n sc.close();\n int count = 0;\n for (int i = 0; i < data.size(); i++) {\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }\n for (int i = 0; i < data.size(); i++) {\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\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 aldl_1_2_a();\n }\n\n static void aldl_1_2_a() {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n ArrayList<Integer> data = new ArrayList<Integer>();\n for (int i = 0; i < n; i++) {\n data.add(sc.nextInt());\n }\n sc.close();\n int count = 0;\n for (int i = 0; i < data.size(); i++) {\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }\n for (int i = 0; i < data.size(); i++) {\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) {\n aldl_1_2_a();\n }",
"main",
"{\n aldl_1_2_a();\n }",
"aldl_1_2_a()",
"aldl_1_2_a",
"String[] args",
"args",
"static void aldl_1_2_a() {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n ArrayList<Integer> data = new ArrayList<Integer>();\n for (int i = 0; i < n; i++) {\n data.add(sc.nextInt());\n }\n sc.close();\n int count = 0;\n for (int i = 0; i < data.size(); i++) {\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }\n for (int i = 0; i < data.size(); i++) {\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\n }\n System.out.println();\n System.out.println(count);\n }",
"aldl_1_2_a",
"{\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n ArrayList<Integer> data = new ArrayList<Integer>();\n for (int i = 0; i < n; i++) {\n data.add(sc.nextInt());\n }\n sc.close();\n int count = 0;\n for (int i = 0; i < data.size(); i++) {\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }\n for (int i = 0; i < data.size(); i++) {\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\n }\n System.out.println();\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = Integer.parseInt(sc.next());",
"n",
"Integer.parseInt(sc.next())",
"Integer.parseInt",
"Integer",
"sc.next()",
"sc.next",
"sc",
"ArrayList<Integer> data = new ArrayList<Integer>();",
"data",
"new ArrayList<Integer>()",
"for (int i = 0; i < n; i++) {\n data.add(sc.nextInt());\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n data.add(sc.nextInt());\n }",
"{\n data.add(sc.nextInt());\n }",
"data.add(sc.nextInt())",
"data.add",
"data",
"sc.nextInt()",
"sc.nextInt",
"sc",
"sc.close()",
"sc.close",
"sc",
"int count = 0;",
"count",
"0",
"for (int i = 0; i < data.size(); i++) {\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < data.size()",
"i",
"data.size()",
"data.size",
"data",
"i++",
"i++",
"i",
"{\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }",
"{\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }",
"for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }",
"int j = data.size() - 1;",
"int j = data.size() - 1;",
"j",
"data.size() - 1",
"data.size()",
"data.size",
"data",
"1",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }",
"{\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }",
"int dataJ = data.get(j);",
"dataJ",
"data.get(j)",
"data.get",
"data",
"j",
"int dataJ1 = data.get(j - 1);",
"dataJ1",
"data.get(j - 1)",
"data.get",
"data",
"j - 1",
"j",
"1",
"if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }",
"dataJ < dataJ1",
"dataJ",
"dataJ1",
"{\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }",
"data.set(j, dataJ1)",
"data.set",
"data",
"j",
"dataJ1",
"data.set(j - 1, dataJ)",
"data.set",
"data",
"j - 1",
"j",
"1",
"dataJ",
"count++",
"count",
"for (int i = 0; i < data.size(); i++) {\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < data.size()",
"i",
"data.size()",
"data.size",
"data",
"i++",
"i++",
"i",
"{\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\n }",
"{\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\n }",
"if (i > 0)\n System.out.print(\" \");",
"i > 0",
"i",
"0",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.print(data.get(i))",
"System.out.print",
"System.out",
"System",
"System.out",
"data.get(i)",
"data.get",
"data",
"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",
"public class Main {\n public static void main(String[] args) {\n aldl_1_2_a();\n }\n\n static void aldl_1_2_a() {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n ArrayList<Integer> data = new ArrayList<Integer>();\n for (int i = 0; i < n; i++) {\n data.add(sc.nextInt());\n }\n sc.close();\n int count = 0;\n for (int i = 0; i < data.size(); i++) {\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }\n for (int i = 0; i < data.size(); i++) {\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\n }\n System.out.println();\n System.out.println(count);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n aldl_1_2_a();\n }\n\n static void aldl_1_2_a() {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n ArrayList<Integer> data = new ArrayList<Integer>();\n for (int i = 0; i < n; i++) {\n data.add(sc.nextInt());\n }\n sc.close();\n int count = 0;\n for (int i = 0; i < data.size(); i++) {\n for (int j = data.size() - 1; j > i; j--) {\n int dataJ = data.get(j);\n int dataJ1 = data.get(j - 1);\n if (dataJ < dataJ1) {\n data.set(j, dataJ1);\n data.set(j - 1, dataJ);\n count++;\n }\n }\n }\n for (int i = 0; i < data.size(); i++) {\n if (i > 0)\n System.out.print(\" \");\n System.out.print(data.get(i));\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) {
aldl_1_2_a();
}
static void aldl_1_2_a() {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
ArrayList<Integer> data = new ArrayList<Integer>();
for (int i = 0; i < n; i++) {
data.add(sc.nextInt());
}
sc.close();
int count = 0;
for (int i = 0; i < data.size(); i++) {
for (int j = data.size() - 1; j > i; j--) {
int dataJ = data.get(j);
int dataJ1 = data.get(j - 1);
if (dataJ < dataJ1) {
data.set(j, dataJ1);
data.set(j - 1, dataJ);
count++;
}
}
}
for (int i = 0; i < data.size(); i++) {
if (i > 0)
System.out.print(" ");
System.out.print(data.get(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,
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,
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,
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,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
17,
4,
18,
13,
17,
4,
18,
13,
18,
13,
13,
4,
18,
4,
18,
13,
17,
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
],
[
186,
11
],
[
186,
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
],
[
186,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
73
],
[
73,
74
],
[
69,
75
],
[
75,
76
],
[
75,
77
],
[
69,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
82,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
90,
92
],
[
86,
93
],
[
93,
94
],
[
93,
95
],
[
86,
96
],
[
96,
97
],
[
97,
98
],
[
86,
99
],
[
100,
100
],
[
100,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
105,
106
],
[
105,
107
],
[
102,
108
],
[
108,
109
],
[
108,
110
],
[
101,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
119,
125
],
[
125,
126
],
[
125,
127
],
[
111,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
128,
132
],
[
111,
133
],
[
133,
134
],
[
133,
135
],
[
111,
136
],
[
136,
137
],
[
69,
138
],
[
138,
139
],
[
138,
140
],
[
69,
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
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
159,
160
],
[
158,
161
],
[
153,
162
],
[
162,
163
],
[
163,
164
],
[
162,
165
],
[
165,
166
],
[
165,
167
],
[
69,
168
],
[
168,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
170,
173
],
[
168,
174
],
[
69,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
67,
181
],
[
181,
182
],
[
67,
183
],
[
183,
184
],
[
0,
185
],
[
185,
186
],
[
185,
187
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\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 int n = Integer.parseInt(br.readLine());\n int[] a = new int[n];\n String[] t = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(t[i]);\n }\n\n babbleSort(a, n);\n }\n\n public static void babbleSort(int[] a, int n){\n int flag = 1;\n int temp, count = 0;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for(int j = 0; j < n; j++){\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }\n sb.append(\"\\n\").append(count);\n System.out.println(sb);\n }\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\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 int[] a = new int[n];\n String[] t = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(t[i]);\n }\n\n babbleSort(a, n);\n }\n\n public static void babbleSort(int[] a, int n){\n int flag = 1;\n int temp, count = 0;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for(int j = 0; j < n; j++){\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }\n sb.append(\"\\n\").append(count);\n System.out.println(sb);\n }\n\n}",
"Main",
"public static void main(String[] args)throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] a = new int[n];\n String[] t = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(t[i]);\n }\n\n babbleSort(a, n);\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n int[] a = new int[n];\n String[] t = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(t[i]);\n }\n\n babbleSort(a, 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",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"String[] t = br.readLine().split(\" \");",
"t",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(t[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = Integer.parseInt(t[i]);\n }",
"{\n a[i] = Integer.parseInt(t[i]);\n }",
"a[i] = Integer.parseInt(t[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(t[i])",
"Integer.parseInt",
"Integer",
"t[i]",
"t",
"i",
"babbleSort(a, n)",
"babbleSort",
"a",
"n",
"String[] args",
"args",
"public static void babbleSort(int[] a, int n){\n int flag = 1;\n int temp, count = 0;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for(int j = 0; j < n; j++){\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }\n sb.append(\"\\n\").append(count);\n System.out.println(sb);\n }",
"babbleSort",
"{\n int flag = 1;\n int temp, count = 0;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for(int j = 0; j < n; j++){\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }\n sb.append(\"\\n\").append(count);\n System.out.println(sb);\n }",
"int flag = 1;",
"flag",
"1",
"int temp",
"temp",
"count = 0;",
"count",
"0",
"while(flag == 1){\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }",
"flag == 1",
"flag",
"1",
"{\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }",
"flag = 0",
"flag",
"0",
"for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\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 temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }",
"{\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }",
"if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }",
"a[i-1] > a[i]",
"a[i-1]",
"a",
"i-1",
"i",
"1",
"a[i]",
"a",
"i",
"{\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }",
"temp = a[i-1]",
"temp",
"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] = temp",
"a[i]",
"a",
"i",
"temp",
"flag = 1",
"flag",
"1",
"count++",
"count",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for(int j = 0; j < n; j++){\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < n",
"j",
"n",
"j++",
"j++",
"j",
"{\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }",
"{\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }",
"if(j != 0) sb.append(\" \");",
"j != 0",
"j",
"0",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"sb.append(a[j])",
"sb.append",
"sb",
"a[j]",
"a",
"j",
"sb.append(\"\\n\").append(count)",
"sb.append(\"\\n\").append",
"sb.append(\"\\n\")",
"sb.append",
"sb",
"\"\\n\"",
"count",
"System.out.println(sb)",
"System.out.println",
"System.out",
"System",
"System.out",
"sb",
"int[] a",
"a",
"int 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 int n = Integer.parseInt(br.readLine());\n int[] a = new int[n];\n String[] t = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(t[i]);\n }\n\n babbleSort(a, n);\n }\n\n public static void babbleSort(int[] a, int n){\n int flag = 1;\n int temp, count = 0;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for(int j = 0; j < n; j++){\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }\n sb.append(\"\\n\").append(count);\n System.out.println(sb);\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 int n = Integer.parseInt(br.readLine());\n int[] a = new int[n];\n String[] t = br.readLine().split(\" \");\n for(int i = 0; i < n; i++){\n a[i] = Integer.parseInt(t[i]);\n }\n\n babbleSort(a, n);\n }\n\n public static void babbleSort(int[] a, int n){\n int flag = 1;\n int temp, count = 0;\n while(flag == 1){\n flag = 0;\n for(int i = n - 1; i > 0; i--){\n if(a[i-1] > a[i]){\n temp = a[i-1];\n a[i-1] = a[i];\n a[i] = temp;\n flag = 1;\n count++;\n }\n }\n }\n StringBuilder sb = new StringBuilder();\n for(int j = 0; j < n; j++){\n if(j != 0) sb.append(\" \");\n sb.append(a[j]);\n }\n sb.append(\"\\n\").append(count);\n System.out.println(sb);\n }\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());
int[] a = new int[n];
String[] t = br.readLine().split(" ");
for(int i = 0; i < n; i++){
a[i] = Integer.parseInt(t[i]);
}
babbleSort(a, n);
}
public static void babbleSort(int[] a, int n){
int flag = 1;
int temp, count = 0;
while(flag == 1){
flag = 0;
for(int i = n - 1; i > 0; i--){
if(a[i-1] > a[i]){
temp = a[i-1];
a[i-1] = a[i];
a[i] = temp;
flag = 1;
count++;
}
}
}
StringBuilder sb = new StringBuilder();
for(int j = 0; j < n; j++){
if(j != 0) sb.append(" ");
sb.append(a[j]);
}
sb.append("\n").append(count);
System.out.println(sb);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
20,
41,
13,
17,
12,
13,
30,
41,
13,
20,
41,
13,
17,
42,
2,
2,
0,
13,
4,
18,
13,
17,
40,
4,
18,
13,
30,
41,
13,
4,
18,
13,
13,
41,
13,
20,
13,
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,
4,
13,
13,
4,
13,
13,
4,
18,
13,
13,
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,
40,
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,
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,
4,
13,
13,
13,
2,
13,
17,
23,
13,
12,
13,
30,
11,
1,
41,
13,
17,
2,
13,
2,
18,
13,
13,
17,
1,
40,
13,
30,
4,
18,
13,
2,
18,
13,
13,
17,
4,
18,
13,
18,
13,
2,
18,
13,
13,
17,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
9,
11
],
[
7,
12
],
[
12,
13
],
[
12,
14
],
[
7,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
17,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
31
],
[
26,
32
],
[
25,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
24,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
37,
44
],
[
44,
45
],
[
44,
46
],
[
37,
48
],
[
48,
49
],
[
48,
50
],
[
37,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
56,
58
],
[
51,
59
],
[
59,
60
],
[
60,
61
],
[
51,
62
],
[
62,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
68,
69
],
[
67,
70
],
[
70,
71
],
[
71,
72
],
[
37,
73
],
[
73,
74
],
[
73,
75
],
[
37,
76
],
[
76,
77
],
[
76,
78
],
[
37,
79
],
[
79,
80
],
[
80,
81
],
[
79,
82
],
[
37,
83
],
[
83,
84
],
[
84,
85
],
[
15,
86
],
[
86,
87
],
[
7,
88
],
[
88,
89
],
[
88,
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
],
[
90,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
90,
108
],
[
108,
109
],
[
88,
110
],
[
110,
111
],
[
88,
112
],
[
112,
113
],
[
88,
114
],
[
114,
115
],
[
7,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
119,
131
],
[
131,
132
],
[
132,
133
],
[
119,
134
],
[
135,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
136,
145
],
[
145,
146
],
[
145,
147
],
[
136,
148
],
[
148,
149
],
[
149,
150
],
[
136,
151
],
[
152,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
153,
163
],
[
163,
164
],
[
163,
165
],
[
163,
166
],
[
163,
167
],
[
167,
168
],
[
167,
169
],
[
116,
170
],
[
170,
171
],
[
7,
172
],
[
172,
173
],
[
172,
174
],
[
174,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
183,
184
],
[
183,
185
],
[
182,
186
],
[
175,
187
],
[
187,
188
],
[
188,
189
],
[
175,
190
],
[
190,
191
],
[
191,
192
],
[
192,
193
],
[
191,
194
],
[
194,
195
],
[
195,
196
],
[
195,
197
],
[
194,
198
],
[
174,
199
],
[
199,
200
],
[
200,
201
],
[
199,
202
],
[
202,
203
],
[
202,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
204,
208
],
[
172,
209
],
[
209,
210
]
] | [
"import java.io.*;\nimport java.util.StringTokenizer;\n\nclass Main{\n\nstatic final PrintWriter out=new PrintWriter(System.out);\nstatic int ans=0;\n\npublic static void main(String[] args) throws IOException{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());\nBubbleSort(a);\ngetValue(a);\nout.println(ans);\nout.flush();\n}\n}\n\nprivate static void swap(int[] a,int s,int t){\nint tmp=a[s]; a[s]=a[t]; a[t]=tmp; ans++;\n}\n\nprivate static void BubbleSort(int[] a){\nfor(int i=0;i<a.length-1;i++){\nfor(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}\n}\n}\n\nprivate static void getValue(int[] a){\nfor(int i=0;i<a.length-1;i++) out.print(a[i]+\" \");\nout.println(a[a.length-1]);\n}\n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.StringTokenizer;",
"StringTokenizer",
"java.util",
"class Main{\n\nstatic final PrintWriter out=new PrintWriter(System.out);\nstatic int ans=0;\n\npublic static void main(String[] args) throws IOException{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());\nBubbleSort(a);\ngetValue(a);\nout.println(ans);\nout.flush();\n}\n}\n\nprivate static void swap(int[] a,int s,int t){\nint tmp=a[s]; a[s]=a[t]; a[t]=tmp; ans++;\n}\n\nprivate static void BubbleSort(int[] a){\nfor(int i=0;i<a.length-1;i++){\nfor(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}\n}\n}\n\nprivate static void getValue(int[] a){\nfor(int i=0;i<a.length-1;i++) out.print(a[i]+\" \");\nout.println(a[a.length-1]);\n}\n}",
"Main",
"static final PrintWriter out=new PrintWriter(System.out);",
"out",
"new PrintWriter(System.out)",
"static int ans=0;",
"ans",
"0",
"public static void main(String[] args) throws IOException{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());\nBubbleSort(a);\ngetValue(a);\nout.println(ans);\nout.flush();\n}\n}",
"main",
"{\nBufferedReader br=new BufferedReader(new InputStreamReader(System.in));\nString line=\"\";\nwhile((line=br.readLine())!=null&&!line.isEmpty()){\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());\nBubbleSort(a);\ngetValue(a);\nout.println(ans);\nout.flush();\n}\n}",
"BufferedReader br=new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"String line=\"\";",
"line",
"\"\"",
"while((line=br.readLine())!=null&&!line.isEmpty()){\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());\nBubbleSort(a);\ngetValue(a);\nout.println(ans);\nout.flush();\n}",
"(line=br.readLine())!=null&&!line.isEmpty()",
"(line=br.readLine())!=null",
"(line=br.readLine())",
"line",
"br.readLine()",
"br.readLine",
"br",
"null",
"!line.isEmpty()",
"line.isEmpty()",
"line.isEmpty",
"line",
"{\nint n=Integer.parseInt(line);\nint[] a=new int[n];\nStringTokenizer st=new StringTokenizer(br.readLine());\nfor(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());\nBubbleSort(a);\ngetValue(a);\nout.println(ans);\nout.flush();\n}",
"int n=Integer.parseInt(line);",
"n",
"Integer.parseInt(line)",
"Integer.parseInt",
"Integer",
"line",
"int[] a=new int[n];",
"a",
"new int[n]",
"n",
"StringTokenizer st=new StringTokenizer(br.readLine());",
"st",
"new StringTokenizer(br.readLine())",
"for(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"a[i]=Integer.parseInt(st.nextToken());",
"a[i]=Integer.parseInt(st.nextToken())",
"a[i]",
"a",
"i",
"Integer.parseInt(st.nextToken())",
"Integer.parseInt",
"Integer",
"st.nextToken()",
"st.nextToken",
"st",
"BubbleSort(a)",
"BubbleSort",
"a",
"getValue(a)",
"getValue",
"a",
"out.println(ans)",
"out.println",
"out",
"ans",
"out.flush()",
"out.flush",
"out",
"String[] args",
"args",
"private static void swap(int[] a,int s,int t){\nint tmp=a[s]; a[s]=a[t]; a[t]=tmp; ans++;\n}",
"swap",
"{\nint tmp=a[s]; a[s]=a[t]; a[t]=tmp; ans++;\n}",
"int tmp=a[s];",
"tmp",
"a[s]",
"a",
"s",
"a[s]=a[t]",
"a[s]",
"a",
"s",
"a[t]",
"a",
"t",
"a[t]=tmp",
"a[t]",
"a",
"t",
"tmp",
"ans++",
"ans",
"int[] a",
"a",
"int s",
"s",
"int t",
"t",
"private static void BubbleSort(int[] a){\nfor(int i=0;i<a.length-1;i++){\nfor(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}\n}\n}",
"BubbleSort",
"{\nfor(int i=0;i<a.length-1;i++){\nfor(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}\n}\n}",
"for(int i=0;i<a.length-1;i++){\nfor(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}\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",
"{\nfor(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}\n}",
"{\nfor(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}\n}",
"for(int j=a.length-1;j>i;j--){\nif(a[j]<a[j-1]) swap(a,j,j-1);\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",
"{\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}",
"{\nif(a[j]<a[j-1]) swap(a,j,j-1);\n}",
"if(a[j]<a[j-1]) swap(a,j,j-1);",
"a[j]<a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"swap(a,j,j-1)",
"swap",
"a",
"j",
"j-1",
"j",
"1",
"int[] a",
"a",
"private static void getValue(int[] a){\nfor(int i=0;i<a.length-1;i++) out.print(a[i]+\" \");\nout.println(a[a.length-1]);\n}",
"getValue",
"{\nfor(int i=0;i<a.length-1;i++) out.print(a[i]+\" \");\nout.println(a[a.length-1]);\n}",
"for(int i=0;i<a.length-1;i++) 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",
"out.print(a[i]+\" \");",
"out.print(a[i]+\" \")",
"out.print",
"out",
"a[i]+\" \"",
"a[i]",
"a",
"i",
"\" \"",
"out.println(a[a.length-1])",
"out.println",
"out",
"a[a.length-1]",
"a",
"a.length-1",
"a.length",
"a",
"a.length",
"1",
"int[] a",
"a"
] | import java.io.*;
import java.util.StringTokenizer;
class Main{
static final PrintWriter out=new PrintWriter(System.out);
static int ans=0;
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line);
int[] a=new int[n];
StringTokenizer st=new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) a[i]=Integer.parseInt(st.nextToken());
BubbleSort(a);
getValue(a);
out.println(ans);
out.flush();
}
}
private static void swap(int[] a,int s,int t){
int tmp=a[s]; a[s]=a[t]; a[t]=tmp; ans++;
}
private static void BubbleSort(int[] a){
for(int i=0;i<a.length-1;i++){
for(int j=a.length-1;j>i;j--){
if(a[j]<a[j-1]) swap(a,j,j-1);
}
}
}
private static void getValue(int[] a){
for(int i=0;i<a.length-1;i++) out.print(a[i]+" ");
out.println(a[a.length-1]);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
41,
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,
0,
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,
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,
13,
41,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
13,
0,
18,
13,
2,
13,
17,
13,
40,
13,
29,
13,
23,
13,
12,
13,
30,
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,
23,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
9,
10
],
[
7,
11
],
[
11,
12
],
[
7,
13
],
[
13,
14
],
[
7,
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
],
[
52,
53
],
[
52,
54
],
[
17,
55
],
[
55,
56
],
[
55,
57
],
[
17,
58
],
[
58,
59
],
[
59,
60
],
[
60,
61
],
[
60,
62
],
[
58,
63
],
[
15,
64
],
[
64,
65
],
[
7,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
74,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
76,
80
],
[
69,
81
],
[
81,
82
],
[
82,
83
],
[
69,
84
],
[
85,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
90,
91
],
[
91,
92
],
[
91,
93
],
[
90,
94
],
[
86,
95
],
[
95,
96
],
[
95,
97
],
[
86,
98
],
[
98,
99
],
[
99,
100
],
[
86,
101
],
[
102,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
104,
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
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
113,
126
],
[
126,
127
],
[
127,
128
],
[
127,
129
],
[
126,
130
],
[
113,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
113,
138
],
[
138,
139
],
[
68,
140
],
[
140,
141
],
[
66,
142
],
[
142,
143
],
[
7,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
149,
150
],
[
149,
151
],
[
147,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
147,
159
],
[
159,
160
],
[
160,
161
],
[
147,
162
],
[
163,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
163,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
169,
174
],
[
174,
175
],
[
174,
176
],
[
146,
177
],
[
177,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
177,
182
],
[
182,
183
],
[
182,
184
],
[
184,
185
],
[
185,
186
],
[
185,
187
],
[
184,
188
],
[
144,
189
],
[
189,
190
]
] | [
"import java.io.*;\nimport java.util.*;\n\n\n\nclass Main{\n //読み込みのテンプレ(stringオブジェクトまで)\n \n static int N;\n static int[] sequence;\n static int count;\n \n public static void main(String[] args) throws IOException{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n \n int[] sequence = new int[N];\n \n for(int i=0;i<N;i++){\n sequence[i]=scanner.nextInt();\n }\n \n sequence = doBubblesort(sequence);\n showResult(sequence);\n System.out.println(count);\n }\n \n \n public static int[] doBubblesort(int[] sequence){\n for(int i=0;i<sequence.length-1;i++){\n for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }\n }\n \n return sequence;\n }\n \n \n public static void showResult(int[] sequence){\n for(int i =0;i<sequence.length-1;i++){\n int number = sequence[i];\n System.out.print(number + \" \");\n }\n \n System.out.println(sequence[sequence.length-1]);\n }\n \n}",
"import java.io.*;",
"io.*",
"java",
"import java.util.*;",
"util.*",
"java",
"class Main{\n //読み込みのテンプレ(stringオブジェクトまで)\n \n static int N;\n static int[] sequence;\n static int count;\n \n public static void main(String[] args) throws IOException{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n \n int[] sequence = new int[N];\n \n for(int i=0;i<N;i++){\n sequence[i]=scanner.nextInt();\n }\n \n sequence = doBubblesort(sequence);\n showResult(sequence);\n System.out.println(count);\n }\n \n \n public static int[] doBubblesort(int[] sequence){\n for(int i=0;i<sequence.length-1;i++){\n for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }\n }\n \n return sequence;\n }\n \n \n public static void showResult(int[] sequence){\n for(int i =0;i<sequence.length-1;i++){\n int number = sequence[i];\n System.out.print(number + \" \");\n }\n \n System.out.println(sequence[sequence.length-1]);\n }\n \n}",
"Main",
"static int N;",
"N",
"static int[] sequence;",
"sequence",
"static int count;",
"count",
"public static void main(String[] args) throws IOException{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n \n int[] sequence = new int[N];\n \n for(int i=0;i<N;i++){\n sequence[i]=scanner.nextInt();\n }\n \n sequence = doBubblesort(sequence);\n showResult(sequence);\n System.out.println(count);\n }",
"main",
"{\n Scanner scanner = new Scanner(System.in);\n int N = scanner.nextInt();\n \n int[] sequence = new int[N];\n \n for(int i=0;i<N;i++){\n sequence[i]=scanner.nextInt();\n }\n \n sequence = doBubblesort(sequence);\n showResult(sequence);\n System.out.println(count);\n }",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int N = scanner.nextInt();",
"N",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] sequence = new int[N];",
"sequence",
"new int[N]",
"N",
"for(int i=0;i<N;i++){\n sequence[i]=scanner.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n sequence[i]=scanner.nextInt();\n }",
"{\n sequence[i]=scanner.nextInt();\n }",
"sequence[i]=scanner.nextInt()",
"sequence[i]",
"sequence",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"sequence = doBubblesort(sequence)",
"sequence",
"doBubblesort(sequence)",
"doBubblesort",
"sequence",
"showResult(sequence)",
"showResult",
"sequence",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int[] doBubblesort(int[] sequence){\n for(int i=0;i<sequence.length-1;i++){\n for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }\n }\n \n return sequence;\n }",
"doBubblesort",
"{\n for(int i=0;i<sequence.length-1;i++){\n for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }\n }\n \n return sequence;\n }",
"for(int i=0;i<sequence.length-1;i++){\n for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<sequence.length-1",
"i",
"sequence.length-1",
"sequence.length",
"sequence",
"sequence.length",
"1",
"i++",
"i++",
"i",
"{\n for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }\n }",
"{\n for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }\n }",
"for(int j=sequence.length-1;j>i;j--){\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }",
"int j=sequence.length-1;",
"int j=sequence.length-1;",
"j",
"sequence.length-1",
"sequence.length",
"sequence",
"sequence.length",
"1",
"j>i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }",
"{\n if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }\n }",
"if(sequence[j] < sequence[j-1]){\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }",
"sequence[j] < sequence[j-1]",
"sequence[j]",
"sequence",
"j",
"sequence[j-1]",
"sequence",
"j-1",
"j",
"1",
"{\n int x = sequence[j];\n int y = sequence[j-1];\n sequence[j] = y;\n sequence[j-1]= x;\n count++;\n }",
"int x = sequence[j];",
"x",
"sequence[j]",
"sequence",
"j",
"int y = sequence[j-1];",
"y",
"sequence[j-1]",
"sequence",
"j-1",
"j",
"1",
"sequence[j] = y",
"sequence[j]",
"sequence",
"j",
"y",
"sequence[j-1]= x",
"sequence[j-1]",
"sequence",
"j-1",
"j",
"1",
"x",
"count++",
"count",
"return sequence;",
"sequence",
"int[] sequence",
"sequence",
"public static void showResult(int[] sequence){\n for(int i =0;i<sequence.length-1;i++){\n int number = sequence[i];\n System.out.print(number + \" \");\n }\n \n System.out.println(sequence[sequence.length-1]);\n }",
"showResult",
"{\n for(int i =0;i<sequence.length-1;i++){\n int number = sequence[i];\n System.out.print(number + \" \");\n }\n \n System.out.println(sequence[sequence.length-1]);\n }",
"for(int i =0;i<sequence.length-1;i++){\n int number = sequence[i];\n System.out.print(number + \" \");\n }",
"int i =0;",
"int i =0;",
"i",
"0",
"i<sequence.length-1",
"i",
"sequence.length-1",
"sequence.length",
"sequence",
"sequence.length",
"1",
"i++",
"i++",
"i",
"{\n int number = sequence[i];\n System.out.print(number + \" \");\n }",
"{\n int number = sequence[i];\n System.out.print(number + \" \");\n }",
"int number = sequence[i];",
"number",
"sequence[i]",
"sequence",
"i",
"System.out.print(number + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"number + \" \"",
"number",
"\" \"",
"System.out.println(sequence[sequence.length-1])",
"System.out.println",
"System.out",
"System",
"System.out",
"sequence[sequence.length-1]",
"sequence",
"sequence.length-1",
"sequence.length",
"sequence",
"sequence.length",
"1",
"int[] sequence",
"sequence"
] | import java.io.*;
import java.util.*;
class Main{
//読み込みのテンプレ(stringオブジェクトまで)
static int N;
static int[] sequence;
static int count;
public static void main(String[] args) throws IOException{
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int[] sequence = new int[N];
for(int i=0;i<N;i++){
sequence[i]=scanner.nextInt();
}
sequence = doBubblesort(sequence);
showResult(sequence);
System.out.println(count);
}
public static int[] doBubblesort(int[] sequence){
for(int i=0;i<sequence.length-1;i++){
for(int j=sequence.length-1;j>i;j--){
if(sequence[j] < sequence[j-1]){
int x = sequence[j];
int y = sequence[j-1];
sequence[j] = y;
sequence[j-1]= x;
count++;
}
}
}
return sequence;
}
public static void showResult(int[] sequence){
for(int i =0;i<sequence.length-1;i++){
int number = sequence[i];
System.out.print(number + " ");
}
System.out.println(sequence[sequence.length-1]);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
41,
13,
41,
13,
17,
41,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
0,
13,
4,
18,
13,
13,
0,
13,
20,
13,
0,
13,
4,
18,
13,
0,
13,
20,
42,
4,
18,
13,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
40,
13,
4,
13,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
17,
41,
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,
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,
13,
18,
13,
2,
13,
17,
0,
18,
13,
13,
13,
0,
18,
13,
2,
13,
17,
13,
40,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
0,
13,
2,
2,
13,
18,
13,
13,
17,
0,
13,
2,
13,
18,
13,
2,
13,
17,
4,
18,
18,
13,
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
],
[
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
],
[
17,
26
],
[
26,
27
],
[
17,
28
],
[
28,
29
],
[
28,
30
],
[
17,
31
],
[
31,
32
],
[
31,
33
],
[
17,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
34,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
44,
45
],
[
45,
46
],
[
41,
47
],
[
47,
48
],
[
47,
49
],
[
49,
50
],
[
50,
51
],
[
49,
52
],
[
41,
53
],
[
53,
54
],
[
53,
55
],
[
41,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
60,
61
],
[
41,
62
],
[
62,
63
],
[
62,
64
],
[
41,
65
],
[
65,
66
],
[
66,
67
],
[
67,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
70,
74
],
[
74,
75
],
[
75,
76
],
[
74,
77
],
[
77,
78
],
[
78,
79
],
[
69,
80
],
[
80,
81
],
[
41,
82
],
[
82,
83
],
[
82,
84
],
[
15,
85
],
[
85,
86
],
[
13,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
92,
93
],
[
92,
94
],
[
89,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
89,
100
],
[
100,
101
],
[
100,
102
],
[
89,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
108,
110
],
[
110,
111
],
[
110,
112
],
[
103,
113
],
[
113,
114
],
[
114,
115
],
[
103,
116
],
[
117,
117
],
[
117,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
122,
123
],
[
122,
124
],
[
118,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
118,
130
],
[
130,
131
],
[
131,
132
],
[
118,
133
],
[
134,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
136,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
135,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
148,
149
],
[
148,
150
],
[
145,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
145,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
158,
162
],
[
145,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
166,
168
],
[
163,
169
],
[
145,
170
],
[
170,
171
],
[
89,
172
],
[
172,
173
],
[
172,
174
],
[
89,
175
],
[
175,
176
],
[
176,
177
],
[
177,
178
],
[
177,
179
],
[
175,
180
],
[
180,
181
],
[
180,
182
],
[
182,
183
],
[
182,
184
],
[
175,
185
],
[
185,
186
],
[
186,
187
],
[
175,
188
],
[
189,
189
],
[
189,
190
],
[
190,
191
],
[
190,
192
],
[
193,
193
],
[
193,
194
],
[
193,
195
],
[
195,
196
],
[
195,
197
],
[
193,
198
],
[
89,
199
],
[
199,
200
],
[
199,
201
],
[
201,
202
],
[
201,
203
],
[
203,
204
],
[
203,
205
],
[
205,
206
],
[
205,
207
],
[
89,
208
],
[
208,
209
],
[
209,
210
],
[
210,
211
],
[
210,
212
],
[
208,
213
],
[
89,
214
],
[
214,
215
],
[
215,
216
],
[
216,
217
],
[
216,
218
],
[
214,
219
],
[
87,
220
],
[
220,
221
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\nimport java.util.StringTokenizer;\n\nclass Main{\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\t\tString str=\"\";\n\t\tStringTokenizer stk;\n\t\tint[] arrays;\n\t\tint youso=0;\n\t\tint counter=0;\n\t\ttry {\n\t\t\tstr=bfr.readLine();\n\t\t\tyouso=Integer.parseInt(str);\n\t\t\tarrays=new int[youso];\n\n\t\t\tstr=bfr.readLine();\n\t\t\tstk=new StringTokenizer(str,\" \");\n\n\t\t\twhile(stk.hasMoreTokens()) {\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t\tBubble(arrays);\n\n\t\t} catch (IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\tstatic void Bubble(int[] a) {\n\t\tint tmp1,tmp2=0;\n\t\tint ookisa=a.length;\n\t\tint kaisu=0;\n\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tfor(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString moji=\"\";\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tmoji=moji+a[i]+\" \";\n\t\t}\n\t\tmoji=moji+a[ookisa-1];\n\t\tSystem.out.println(moji);\n\t\tSystem.out.println(kaisu);\n\n\n\t}\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",
"class Main{\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\t\tString str=\"\";\n\t\tStringTokenizer stk;\n\t\tint[] arrays;\n\t\tint youso=0;\n\t\tint counter=0;\n\t\ttry {\n\t\t\tstr=bfr.readLine();\n\t\t\tyouso=Integer.parseInt(str);\n\t\t\tarrays=new int[youso];\n\n\t\t\tstr=bfr.readLine();\n\t\t\tstk=new StringTokenizer(str,\" \");\n\n\t\t\twhile(stk.hasMoreTokens()) {\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t\tBubble(arrays);\n\n\t\t} catch (IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n\n\tstatic void Bubble(int[] a) {\n\t\tint tmp1,tmp2=0;\n\t\tint ookisa=a.length;\n\t\tint kaisu=0;\n\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tfor(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString moji=\"\";\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tmoji=moji+a[i]+\" \";\n\t\t}\n\t\tmoji=moji+a[ookisa-1];\n\t\tSystem.out.println(moji);\n\t\tSystem.out.println(kaisu);\n\n\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\t\tString str=\"\";\n\t\tStringTokenizer stk;\n\t\tint[] arrays;\n\t\tint youso=0;\n\t\tint counter=0;\n\t\ttry {\n\t\t\tstr=bfr.readLine();\n\t\t\tyouso=Integer.parseInt(str);\n\t\t\tarrays=new int[youso];\n\n\t\t\tstr=bfr.readLine();\n\t\t\tstk=new StringTokenizer(str,\" \");\n\n\t\t\twhile(stk.hasMoreTokens()) {\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t\tBubble(arrays);\n\n\t\t} catch (IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"main",
"{\n\n\t\tBufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));\n\t\tString str=\"\";\n\t\tStringTokenizer stk;\n\t\tint[] arrays;\n\t\tint youso=0;\n\t\tint counter=0;\n\t\ttry {\n\t\t\tstr=bfr.readLine();\n\t\t\tyouso=Integer.parseInt(str);\n\t\t\tarrays=new int[youso];\n\n\t\t\tstr=bfr.readLine();\n\t\t\tstk=new StringTokenizer(str,\" \");\n\n\t\t\twhile(stk.hasMoreTokens()) {\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t\tBubble(arrays);\n\n\t\t} catch (IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));",
"bfr",
"new BufferedReader(new InputStreamReader(System.in))",
"String str=\"\";",
"str",
"\"\"",
"StringTokenizer stk;",
"stk",
"int[] arrays;",
"arrays",
"int youso=0;",
"youso",
"0",
"int counter=0;",
"counter",
"0",
"try {\n\t\t\tstr=bfr.readLine();\n\t\t\tyouso=Integer.parseInt(str);\n\t\t\tarrays=new int[youso];\n\n\t\t\tstr=bfr.readLine();\n\t\t\tstk=new StringTokenizer(str,\" \");\n\n\t\t\twhile(stk.hasMoreTokens()) {\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t\tBubble(arrays);\n\n\t\t} catch (IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}",
"catch (IOException e) {\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}",
"IOException e",
"{\n\t\t\t// TODO 自動生成された catch ブロック\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\tstr=bfr.readLine();\n\t\t\tyouso=Integer.parseInt(str);\n\t\t\tarrays=new int[youso];\n\n\t\t\tstr=bfr.readLine();\n\t\t\tstk=new StringTokenizer(str,\" \");\n\n\t\t\twhile(stk.hasMoreTokens()) {\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}\n\t\t\tBubble(arrays);\n\n\t\t}",
"str=bfr.readLine()",
"str",
"bfr.readLine()",
"bfr.readLine",
"bfr",
"youso=Integer.parseInt(str)",
"youso",
"Integer.parseInt(str)",
"Integer.parseInt",
"Integer",
"str",
"arrays=new int[youso]",
"arrays",
"new int[youso]",
"youso",
"str=bfr.readLine()",
"str",
"bfr.readLine()",
"bfr.readLine",
"bfr",
"stk=new StringTokenizer(str,\" \")",
"stk",
"new StringTokenizer(str,\" \")",
"while(stk.hasMoreTokens()) {\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}",
"stk.hasMoreTokens()",
"stk.hasMoreTokens",
"stk",
"{\n\t\t\t\tarrays[counter]=Integer.parseInt(stk.nextToken());\n\t\t\t\tcounter++;\n\t\t\t}",
"arrays[counter]=Integer.parseInt(stk.nextToken())",
"arrays[counter]",
"arrays",
"counter",
"Integer.parseInt(stk.nextToken())",
"Integer.parseInt",
"Integer",
"stk.nextToken()",
"stk.nextToken",
"stk",
"counter++",
"counter",
"Bubble(arrays)",
"Bubble",
"arrays",
"String[] args",
"args",
"static void Bubble(int[] a) {\n\t\tint tmp1,tmp2=0;\n\t\tint ookisa=a.length;\n\t\tint kaisu=0;\n\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tfor(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString moji=\"\";\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tmoji=moji+a[i]+\" \";\n\t\t}\n\t\tmoji=moji+a[ookisa-1];\n\t\tSystem.out.println(moji);\n\t\tSystem.out.println(kaisu);\n\n\n\t}",
"Bubble",
"{\n\t\tint tmp1,tmp2=0;\n\t\tint ookisa=a.length;\n\t\tint kaisu=0;\n\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tfor(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString moji=\"\";\n\t\tfor(int i=0; i<ookisa-1; i++) {\n\t\t\tmoji=moji+a[i]+\" \";\n\t\t}\n\t\tmoji=moji+a[ookisa-1];\n\t\tSystem.out.println(moji);\n\t\tSystem.out.println(kaisu);\n\n\n\t}",
"int tmp1",
"tmp1",
"tmp2=0;",
"tmp2",
"0",
"int ookisa=a.length;",
"ookisa",
"a.length",
"a",
"a.length",
"int kaisu=0;",
"kaisu",
"0",
"for(int i=0; i<ookisa-1; i++) {\n\t\t\tfor(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ookisa-1",
"i",
"ookisa-1",
"ookisa",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tfor(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j=ookisa-1; j>=i+1; j--) {\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}",
"int j=ookisa-1;",
"int j=ookisa-1;",
"j",
"ookisa-1",
"ookisa",
"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\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}\n\t\t\t}",
"if(a[j]<a[j-1]) {\n\t\t\t\t\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\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\ttmp1=a[j];\n\t\t\t\t\ttmp2=a[j-1];\n\t\t\t\t\ta[j]=tmp2;\n\t\t\t\t\ta[j-1]=tmp1;\n\t\t\t\t\tkaisu++;\n\t\t\t\t}",
"tmp1=a[j]",
"tmp1",
"a[j]",
"a",
"j",
"tmp2=a[j-1]",
"tmp2",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j]=tmp2",
"a[j]",
"a",
"j",
"tmp2",
"a[j-1]=tmp1",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"tmp1",
"kaisu++",
"kaisu",
"String moji=\"\";",
"moji",
"\"\"",
"for(int i=0; i<ookisa-1; i++) {\n\t\t\tmoji=moji+a[i]+\" \";\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<ookisa-1",
"i",
"ookisa-1",
"ookisa",
"1",
"i++",
"i++",
"i",
"{\n\t\t\tmoji=moji+a[i]+\" \";\n\t\t}",
"{\n\t\t\tmoji=moji+a[i]+\" \";\n\t\t}",
"moji=moji+a[i]+\" \"",
"moji",
"moji+a[i]+\" \"",
"moji+a[i]+\" \"",
"moji",
"a[i]",
"a",
"i",
"\" \"",
"moji=moji+a[ookisa-1]",
"moji",
"moji+a[ookisa-1]",
"moji",
"a[ookisa-1]",
"a",
"ookisa-1",
"ookisa",
"1",
"System.out.println(moji)",
"System.out.println",
"System.out",
"System",
"System.out",
"moji",
"System.out.println(kaisu)",
"System.out.println",
"System.out",
"System",
"System.out",
"kaisu",
"int[] a",
"a"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Main{
public static void main(String[] args) {
BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
String str="";
StringTokenizer stk;
int[] arrays;
int youso=0;
int counter=0;
try {
str=bfr.readLine();
youso=Integer.parseInt(str);
arrays=new int[youso];
str=bfr.readLine();
stk=new StringTokenizer(str," ");
while(stk.hasMoreTokens()) {
arrays[counter]=Integer.parseInt(stk.nextToken());
counter++;
}
Bubble(arrays);
} catch (IOException e) {
// TODO 自動生成された catch ブロック
e.printStackTrace();
}
}
static void Bubble(int[] a) {
int tmp1,tmp2=0;
int ookisa=a.length;
int kaisu=0;
for(int i=0; i<ookisa-1; i++) {
for(int j=ookisa-1; j>=i+1; j--) {
if(a[j]<a[j-1]) {
tmp1=a[j];
tmp2=a[j-1];
a[j]=tmp2;
a[j-1]=tmp1;
kaisu++;
}
}
}
String moji="";
for(int i=0; i<ookisa-1; i++) {
moji=moji+a[i]+" ";
}
moji=moji+a[ookisa-1];
System.out.println(moji);
System.out.println(kaisu);
}
}
|
[
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,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
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,
41,
13,
4,
18,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
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
],
[
157,
5
],
[
157,
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
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
8,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
30,
38
],
[
38,
39
],
[
39,
40
],
[
30,
41
],
[
42,
42
],
[
42,
43
],
[
43,
44
],
[
44,
45
],
[
44,
46
],
[
43,
47
],
[
47,
48
],
[
48,
49
],
[
47,
50
],
[
50,
51
],
[
51,
52
],
[
8,
53
],
[
53,
54
],
[
53,
55
],
[
8,
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
],
[
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
],
[
87,
111
],
[
111,
112
],
[
111,
113
],
[
8,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
116,
119
],
[
119,
120
],
[
119,
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
],
[
135,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
139,
141
],
[
8,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
8,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
6,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner std = new Scanner(System.in);\n\t\tint n = Integer.parseInt(std.next());\n\t\tint line[] = new int[n];\n\t\tint temp = 0;\n\t\tint exchange = 0;\n\n\t\tfor(int i=0; i<n; i++){\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString outsd = Integer.toString(line[0]);\n\t\tfor(int i=1; i<n; i++){\n\t\t\toutsd += \" \"+line[i];\n\t\t}\n\t\tSystem.out.println(outsd);\n\t\tSystem.out.println(exchange);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner std = new Scanner(System.in);\n\t\tint n = Integer.parseInt(std.next());\n\t\tint line[] = new int[n];\n\t\tint temp = 0;\n\t\tint exchange = 0;\n\n\t\tfor(int i=0; i<n; i++){\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString outsd = Integer.toString(line[0]);\n\t\tfor(int i=1; i<n; i++){\n\t\t\toutsd += \" \"+line[i];\n\t\t}\n\t\tSystem.out.println(outsd);\n\t\tSystem.out.println(exchange);\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner std = new Scanner(System.in);\n\t\tint n = Integer.parseInt(std.next());\n\t\tint line[] = new int[n];\n\t\tint temp = 0;\n\t\tint exchange = 0;\n\n\t\tfor(int i=0; i<n; i++){\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString outsd = Integer.toString(line[0]);\n\t\tfor(int i=1; i<n; i++){\n\t\t\toutsd += \" \"+line[i];\n\t\t}\n\t\tSystem.out.println(outsd);\n\t\tSystem.out.println(exchange);\n\t}",
"main",
"{\n\t\tScanner std = new Scanner(System.in);\n\t\tint n = Integer.parseInt(std.next());\n\t\tint line[] = new int[n];\n\t\tint temp = 0;\n\t\tint exchange = 0;\n\n\t\tfor(int i=0; i<n; i++){\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString outsd = Integer.toString(line[0]);\n\t\tfor(int i=1; i<n; i++){\n\t\t\toutsd += \" \"+line[i];\n\t\t}\n\t\tSystem.out.println(outsd);\n\t\tSystem.out.println(exchange);\n\t}",
"Scanner std = new Scanner(System.in);",
"std",
"new Scanner(System.in)",
"int n = Integer.parseInt(std.next());",
"n",
"Integer.parseInt(std.next())",
"Integer.parseInt",
"Integer",
"std.next()",
"std.next",
"std",
"int line[] = new int[n];",
"line",
"new int[n]",
"n",
"int temp = 0;",
"temp",
"0",
"int exchange = 0;",
"exchange",
"0",
"for(int i=0; i<n; i++){\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}",
"{\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}",
"line[i] = Integer.parseInt(std.next())",
"line[i]",
"line",
"i",
"Integer.parseInt(std.next())",
"Integer.parseInt",
"Integer",
"std.next()",
"std.next",
"std",
"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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}",
"if (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"line[j] < line[j-1]",
"line[j]",
"line",
"j",
"line[j-1]",
"line",
"j-1",
"j",
"1",
"{\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"temp = line[j]",
"temp",
"line[j]",
"line",
"j",
"line[j] = line[j-1]",
"line[j]",
"line",
"j",
"line[j-1]",
"line",
"j-1",
"j",
"1",
"line[j-1] = temp",
"line[j-1]",
"line",
"j-1",
"j",
"1",
"temp",
"exchange++",
"exchange",
"flag = true",
"flag",
"true",
"String outsd = Integer.toString(line[0]);",
"outsd",
"Integer.toString(line[0])",
"Integer.toString",
"Integer",
"line[0]",
"line",
"0",
"for(int i=1; i<n; i++){\n\t\t\toutsd += \" \"+line[i];\n\t\t}",
"int i=1;",
"int i=1;",
"i",
"1",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\toutsd += \" \"+line[i];\n\t\t}",
"{\n\t\t\toutsd += \" \"+line[i];\n\t\t}",
"outsd += \" \"+line[i]",
"outsd",
"\" \"+line[i]",
"\" \"",
"line[i]",
"line",
"i",
"System.out.println(outsd)",
"System.out.println",
"System.out",
"System",
"System.out",
"outsd",
"System.out.println(exchange)",
"System.out.println",
"System.out",
"System",
"System.out",
"exchange",
"String[] args",
"args",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner std = new Scanner(System.in);\n\t\tint n = Integer.parseInt(std.next());\n\t\tint line[] = new int[n];\n\t\tint temp = 0;\n\t\tint exchange = 0;\n\n\t\tfor(int i=0; i<n; i++){\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString outsd = Integer.toString(line[0]);\n\t\tfor(int i=1; i<n; i++){\n\t\t\toutsd += \" \"+line[i];\n\t\t}\n\t\tSystem.out.println(outsd);\n\t\tSystem.out.println(exchange);\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner std = new Scanner(System.in);\n\t\tint n = Integer.parseInt(std.next());\n\t\tint line[] = new int[n];\n\t\tint temp = 0;\n\t\tint exchange = 0;\n\n\t\tfor(int i=0; i<n; i++){\n\t\t\tline[i] = Integer.parseInt(std.next());\n\t\t}\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 (line[j] < line[j-1]){\n\t\t\t\t\ttemp = line[j]; line[j] = line[j-1]; line[j-1] = temp;\n\t\t\t\t\texchange++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tString outsd = Integer.toString(line[0]);\n\t\tfor(int i=1; i<n; i++){\n\t\t\toutsd += \" \"+line[i];\n\t\t}\n\t\tSystem.out.println(outsd);\n\t\tSystem.out.println(exchange);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner std = new Scanner(System.in);
int n = Integer.parseInt(std.next());
int line[] = new int[n];
int temp = 0;
int exchange = 0;
for(int i=0; i<n; i++){
line[i] = Integer.parseInt(std.next());
}
boolean flag = true;
while (flag){
flag = false;
for(int j=(n-1); j>0; j--){
if (line[j] < line[j-1]){
temp = line[j]; line[j] = line[j-1]; line[j-1] = temp;
exchange++;
flag = true;
}
}
}
String outsd = Integer.toString(line[0]);
for(int i=1; i<n; i++){
outsd += " "+line[i];
}
System.out.println(outsd);
System.out.println(exchange);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
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,
3,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
23,
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,
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,
40,
13,
0,
13,
17,
4,
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
],
[
188,
11
],
[
188,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
16,
17
],
[
17,
18
],
[
17,
19
],
[
15,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
22,
24
],
[
15,
25
],
[
25,
26
],
[
26,
27
],
[
15,
28
],
[
29,
29
],
[
29,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
32,
34
],
[
30,
35
],
[
35,
36
],
[
35,
37
],
[
29,
38
],
[
38,
39
],
[
39,
40
],
[
39,
41
],
[
41,
42
],
[
42,
43
],
[
42,
44
],
[
41,
45
],
[
38,
46
],
[
46,
47
],
[
29,
48
],
[
48,
49
],
[
49,
50
],
[
50,
51
],
[
50,
52
],
[
48,
53
],
[
14,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
12,
59
],
[
59,
60
],
[
188,
61
],
[
61,
62
],
[
61,
63
],
[
63,
64
],
[
64,
65
],
[
64,
66
],
[
63,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
70,
71
],
[
69,
72
],
[
72,
73
],
[
73,
74
],
[
63,
75
],
[
75,
76
],
[
75,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
77,
82
],
[
63,
83
],
[
83,
84
],
[
83,
85
],
[
63,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
87,
95
],
[
95,
96
],
[
96,
97
],
[
87,
98
],
[
99,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
105,
106
],
[
104,
107
],
[
107,
108
],
[
107,
109
],
[
63,
110
],
[
110,
111
],
[
110,
112
],
[
63,
113
],
[
113,
114
],
[
113,
115
],
[
63,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
124,
131
],
[
131,
132
],
[
131,
133
],
[
124,
134
],
[
134,
135
],
[
135,
136
],
[
124,
137
],
[
138,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
140,
144
],
[
144,
145
],
[
144,
146
],
[
146,
147
],
[
146,
148
],
[
139,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
152,
153
],
[
152,
154
],
[
154,
155
],
[
154,
156
],
[
149,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
160,
161
],
[
160,
162
],
[
157,
163
],
[
163,
164
],
[
163,
165
],
[
149,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
149,
171
],
[
171,
172
],
[
149,
173
],
[
173,
174
],
[
173,
175
],
[
63,
176
],
[
176,
177
],
[
176,
178
],
[
63,
179
],
[
179,
180
],
[
180,
181
],
[
181,
182
],
[
181,
183
],
[
179,
184
],
[
61,
185
],
[
185,
186
],
[
0,
187
],
[
187,
188
],
[
187,
189
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static void printArray(int[] intArray){\n\t\tfor (int i = 0; i < intArray.length; i++){\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint progNumLength = Integer.parseInt(br.readLine());\n\n\t\tString[] progNum = br.readLine().split(\" \");\n\n\t\tint[] progNumResult = new int[progNumLength];\n\n\t\tfor(int i = 0; i < progNumLength; i++) {\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}\n\n\t\tint sortCount = 0;\n\t\tint sortFlag = 1;\n\n\t\twhile(sortFlag == 1) {\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(progNumResult);\n\t\tSystem.out.println(sortCount);\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 printArray(int[] intArray){\n\t\tfor (int i = 0; i < intArray.length; i++){\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint progNumLength = Integer.parseInt(br.readLine());\n\n\t\tString[] progNum = br.readLine().split(\" \");\n\n\t\tint[] progNumResult = new int[progNumLength];\n\n\t\tfor(int i = 0; i < progNumLength; i++) {\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}\n\n\t\tint sortCount = 0;\n\t\tint sortFlag = 1;\n\n\t\twhile(sortFlag == 1) {\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(progNumResult);\n\t\tSystem.out.println(sortCount);\n\t}\n}",
"Main",
"public static void printArray(int[] intArray){\n\t\tfor (int i = 0; i < intArray.length; i++){\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}",
"printArray",
"{\n\t\tfor (int i = 0; i < intArray.length; i++){\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}",
"for (int i = 0; i < intArray.length; i++){\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < intArray.length",
"i",
"intArray.length",
"intArray",
"intArray.length",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}",
"{\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}",
"System.out.print(intArray[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"intArray[i]",
"intArray",
"i",
"if (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}",
"i == intArray.length - 1",
"i",
"intArray.length - 1",
"intArray.length",
"intArray",
"intArray.length",
"1",
"{\n\t\t\t\tbreak;\n\t\t\t}",
"break;",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"System.out.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"int[] intArray",
"intArray",
"public static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint progNumLength = Integer.parseInt(br.readLine());\n\n\t\tString[] progNum = br.readLine().split(\" \");\n\n\t\tint[] progNumResult = new int[progNumLength];\n\n\t\tfor(int i = 0; i < progNumLength; i++) {\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}\n\n\t\tint sortCount = 0;\n\t\tint sortFlag = 1;\n\n\t\twhile(sortFlag == 1) {\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(progNumResult);\n\t\tSystem.out.println(sortCount);\n\t}",
"main",
"{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint progNumLength = Integer.parseInt(br.readLine());\n\n\t\tString[] progNum = br.readLine().split(\" \");\n\n\t\tint[] progNumResult = new int[progNumLength];\n\n\t\tfor(int i = 0; i < progNumLength; i++) {\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}\n\n\t\tint sortCount = 0;\n\t\tint sortFlag = 1;\n\n\t\twhile(sortFlag == 1) {\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(progNumResult);\n\t\tSystem.out.println(sortCount);\n\t}",
"BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"int progNumLength = Integer.parseInt(br.readLine());",
"progNumLength",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] progNum = br.readLine().split(\" \");",
"progNum",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] progNumResult = new int[progNumLength];",
"progNumResult",
"new int[progNumLength]",
"progNumLength",
"for(int i = 0; i < progNumLength; i++) {\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < progNumLength",
"i",
"progNumLength",
"i++",
"i++",
"i",
"{\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}",
"{\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}",
"progNumResult[i] = Integer.parseInt(progNum[i])",
"progNumResult[i]",
"progNumResult",
"i",
"Integer.parseInt(progNum[i])",
"Integer.parseInt",
"Integer",
"progNum[i]",
"progNum",
"i",
"int sortCount = 0;",
"sortCount",
"0",
"int sortFlag = 1;",
"sortFlag",
"1",
"while(sortFlag == 1) {\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"sortFlag == 1",
"sortFlag",
"1",
"{\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"sortFlag = 0",
"sortFlag",
"0",
"for(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}",
"int i = progNumLength - 1;",
"int i = progNumLength - 1;",
"i",
"progNumLength - 1",
"progNumLength",
"1",
"i > 0",
"i",
"0",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}",
"if(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}",
"progNumResult[i] < progNumResult[i - 1]",
"progNumResult[i]",
"progNumResult",
"i",
"progNumResult[i - 1]",
"progNumResult",
"i - 1",
"i",
"1",
"{\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}",
"int tmp = progNumResult[i - 1];",
"tmp",
"progNumResult[i - 1]",
"progNumResult",
"i - 1",
"i",
"1",
"progNumResult[i - 1] = progNumResult[i]",
"progNumResult[i - 1]",
"progNumResult",
"i - 1",
"i",
"1",
"progNumResult[i]",
"progNumResult",
"i",
"progNumResult[i] = tmp",
"progNumResult[i]",
"progNumResult",
"i",
"tmp",
"sortCount++",
"sortCount",
"sortFlag = 1",
"sortFlag",
"1",
"printArray(progNumResult)",
"printArray",
"progNumResult",
"System.out.println(sortCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"sortCount",
"String[] args",
"args",
"public class Main {\n\n\tpublic static void printArray(int[] intArray){\n\t\tfor (int i = 0; i < intArray.length; i++){\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint progNumLength = Integer.parseInt(br.readLine());\n\n\t\tString[] progNum = br.readLine().split(\" \");\n\n\t\tint[] progNumResult = new int[progNumLength];\n\n\t\tfor(int i = 0; i < progNumLength; i++) {\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}\n\n\t\tint sortCount = 0;\n\t\tint sortFlag = 1;\n\n\t\twhile(sortFlag == 1) {\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(progNumResult);\n\t\tSystem.out.println(sortCount);\n\t}\n}",
"public class Main {\n\n\tpublic static void printArray(int[] intArray){\n\t\tfor (int i = 0; i < intArray.length; i++){\n\t\t\tSystem.out.print(intArray[i]);\n\n\t\t\tif (i == intArray.length - 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tSystem.out.print(\" \");\n\t\t}\n\t\tSystem.out.println();\n\t}\n\n\tpublic static void main(String[] args) throws NumberFormatException, IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\tint progNumLength = Integer.parseInt(br.readLine());\n\n\t\tString[] progNum = br.readLine().split(\" \");\n\n\t\tint[] progNumResult = new int[progNumLength];\n\n\t\tfor(int i = 0; i < progNumLength; i++) {\n\t\t\tprogNumResult[i] = Integer.parseInt(progNum[i]);\n\t\t}\n\n\t\tint sortCount = 0;\n\t\tint sortFlag = 1;\n\n\t\twhile(sortFlag == 1) {\n\t\t\tsortFlag = 0;\n\n\t\t\tfor(int i = progNumLength - 1; i > 0; i--) {\n\t\t\t\tif(progNumResult[i] < progNumResult[i - 1]) {\n\t\t\t\t\tint tmp = progNumResult[i - 1];\n\t\t\t\t\tprogNumResult[i - 1] = progNumResult[i];\n\t\t\t\t\tprogNumResult[i] = tmp;\n\t\t\t\t\tsortCount++;\n\t\t\t\t\tsortFlag = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprintArray(progNumResult);\n\t\tSystem.out.println(sortCount);\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void printArray(int[] intArray){
for (int i = 0; i < intArray.length; i++){
System.out.print(intArray[i]);
if (i == intArray.length - 1){
break;
}
System.out.print(" ");
}
System.out.println();
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int progNumLength = Integer.parseInt(br.readLine());
String[] progNum = br.readLine().split(" ");
int[] progNumResult = new int[progNumLength];
for(int i = 0; i < progNumLength; i++) {
progNumResult[i] = Integer.parseInt(progNum[i]);
}
int sortCount = 0;
int sortFlag = 1;
while(sortFlag == 1) {
sortFlag = 0;
for(int i = progNumLength - 1; i > 0; i--) {
if(progNumResult[i] < progNumResult[i - 1]) {
int tmp = progNumResult[i - 1];
progNumResult[i - 1] = progNumResult[i];
progNumResult[i] = tmp;
sortCount++;
sortFlag = 1;
}
}
}
printArray(progNumResult);
System.out.println(sortCount);
}
} |
[
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,
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,
29,
13,
23,
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
],
[
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
],
[
172,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
97,
99
],
[
96,
100
],
[
100,
101
],
[
100,
102
],
[
96,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
105,
107
],
[
103,
108
],
[
108,
109
],
[
108,
110
],
[
103,
111
],
[
111,
112
],
[
112,
113
],
[
103,
114
],
[
115,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
116,
123
],
[
123,
124
],
[
123,
125
],
[
116,
126
],
[
126,
127
],
[
127,
128
],
[
116,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
132,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
131,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
141,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
141,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
156,
162
],
[
141,
163
],
[
163,
164
],
[
96,
165
],
[
165,
166
],
[
94,
167
],
[
167,
168
],
[
94,
169
],
[
169,
170
],
[
0,
171
],
[
171,
172
],
[
171,
173
]
] | [
"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\tint count = scanner.nextInt();\n\t\tint[] sortList = new int[count];\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}\n\t\tint anser = bubbleSort(sortList, count);\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(anser);\n\t}\n\n\tprivate static int bubbleSort(int[] sortList, int count){\n\t\tint exchange_count = 0;\n\t\tint temp = 0;\n\t\tfor(int j = 0; j < count; j++){\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn exchange_count;\n\t}\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\tint count = scanner.nextInt();\n\t\tint[] sortList = new int[count];\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}\n\t\tint anser = bubbleSort(sortList, count);\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(anser);\n\t}\n\n\tprivate static int bubbleSort(int[] sortList, int count){\n\t\tint exchange_count = 0;\n\t\tint temp = 0;\n\t\tfor(int j = 0; j < count; j++){\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn exchange_count;\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint count = scanner.nextInt();\n\t\tint[] sortList = new int[count];\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}\n\t\tint anser = bubbleSort(sortList, count);\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(anser);\n\t}",
"main",
"{\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint count = scanner.nextInt();\n\t\tint[] sortList = new int[count];\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}\n\t\tint anser = bubbleSort(sortList, count);\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(anser);\n\t}",
"Scanner scanner = new Scanner(System.in);",
"scanner",
"new Scanner(System.in)",
"int count = scanner.nextInt();",
"count",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int[] sortList = new int[count];",
"sortList",
"new int[count]",
"count",
"for(int i = 0; i < count; i++){\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}",
"{\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}",
"sortList[i] = scanner.nextInt()",
"sortList[i]",
"sortList",
"i",
"scanner.nextInt()",
"scanner.nextInt",
"scanner",
"int anser = bubbleSort(sortList, count);",
"anser",
"bubbleSort(sortList, count)",
"bubbleSort",
"sortList",
"count",
"for(int i = 0; i < count; i++){\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < count",
"i",
"count",
"i++",
"i++",
"i",
"{\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}",
"if(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}",
"i != count - 1",
"i",
"count - 1",
"count",
"1",
"{\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}",
"System.out.print(sortList[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"sortList[i] + \" \"",
"sortList[i]",
"sortList",
"i",
"\" \"",
"{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}",
"System.out.println(sortList[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"sortList[i]",
"sortList",
"i",
"System.out.println(anser)",
"System.out.println",
"System.out",
"System",
"System.out",
"anser",
"String[] args",
"args",
"private static int bubbleSort(int[] sortList, int count){\n\t\tint exchange_count = 0;\n\t\tint temp = 0;\n\t\tfor(int j = 0; j < count; j++){\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn exchange_count;\n\t}",
"bubbleSort",
"{\n\t\tint exchange_count = 0;\n\t\tint temp = 0;\n\t\tfor(int j = 0; j < count; j++){\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn exchange_count;\n\t}",
"int exchange_count = 0;",
"exchange_count",
"0",
"int temp = 0;",
"temp",
"0",
"for(int j = 0; j < count; j++){\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"int j = 0;",
"int j = 0;",
"j",
"0",
"j < count",
"j",
"count",
"j++",
"j++",
"j",
"{\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}",
"int i = count - 1;",
"int i = count - 1;",
"i",
"count - 1",
"count",
"1",
"i > j",
"i",
"j",
"i--",
"i--",
"i",
"{\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}",
"if(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}",
"sortList[i] < sortList[i - 1]",
"sortList[i]",
"sortList",
"i",
"sortList[i - 1]",
"sortList",
"i - 1",
"i",
"1",
"{\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}",
"temp = sortList[i]",
"temp",
"sortList[i]",
"sortList",
"i",
"sortList[i] = sortList[i - 1]",
"sortList[i]",
"sortList",
"i",
"sortList[i - 1]",
"sortList",
"i - 1",
"i",
"1",
"sortList[i - 1] = temp",
"sortList[i - 1]",
"sortList",
"i - 1",
"i",
"1",
"temp",
"exchange_count++",
"exchange_count",
"return exchange_count;",
"exchange_count",
"int[] sortList",
"sortList",
"int count",
"count",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint count = scanner.nextInt();\n\t\tint[] sortList = new int[count];\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}\n\t\tint anser = bubbleSort(sortList, count);\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(anser);\n\t}\n\n\tprivate static int bubbleSort(int[] sortList, int count){\n\t\tint exchange_count = 0;\n\t\tint temp = 0;\n\t\tfor(int j = 0; j < count; j++){\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn exchange_count;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args){\n\t\tScanner scanner = new Scanner(System.in);\n\t\tint count = scanner.nextInt();\n\t\tint[] sortList = new int[count];\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tsortList[i] = scanner.nextInt();\n\t\t}\n\t\tint anser = bubbleSort(sortList, count);\n\t\tfor(int i = 0; i < count; i++){\n\t\t\tif(i != count - 1){\n\t\t\t\tSystem.out.print(sortList[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(sortList[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(anser);\n\t}\n\n\tprivate static int bubbleSort(int[] sortList, int count){\n\t\tint exchange_count = 0;\n\t\tint temp = 0;\n\t\tfor(int j = 0; j < count; j++){\n\t\t\tfor(int i = count - 1; i > j; i--){\n\t\t\t\tif(sortList[i] < sortList[i - 1]){\n\t\t\t\t\ttemp = sortList[i];\n\t\t\t\t\tsortList[i] = sortList[i - 1];\n\t\t\t\t\tsortList[i - 1] = temp;\n\t\t\t\t\texchange_count++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn exchange_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 count = scanner.nextInt();
int[] sortList = new int[count];
for(int i = 0; i < count; i++){
sortList[i] = scanner.nextInt();
}
int anser = bubbleSort(sortList, count);
for(int i = 0; i < count; i++){
if(i != count - 1){
System.out.print(sortList[i] + " ");
}else{
System.out.println(sortList[i]);
}
}
System.out.println(anser);
}
private static int bubbleSort(int[] sortList, int count){
int exchange_count = 0;
int temp = 0;
for(int j = 0; j < count; j++){
for(int i = count - 1; i > j; i--){
if(sortList[i] < sortList[i - 1]){
temp = sortList[i];
sortList[i] = sortList[i - 1];
sortList[i - 1] = temp;
exchange_count++;
}
}
}
return exchange_count;
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
41,
13,
20,
0,
13,
4,
18,
13,
0,
13,
20,
13,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
4,
18,
13,
0,
13,
17,
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,
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,
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,
30,
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
],
[
167,
5
],
[
167,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
8,
11
],
[
11,
12
],
[
8,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
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
],
[
8,
55
],
[
55,
56
],
[
55,
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
],
[
85,
86
],
[
85,
87
],
[
82,
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
],
[
8,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
118,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
130,
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
],
[
8,
152
],
[
152,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
152,
157
],
[
8,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
158,
163
],
[
6,
164
],
[
164,
165
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tint n, i, j, num[], count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tnum = new int[n];\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\t\ti = 1;\n\t\twhile (i != 0) {\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (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\t}\n\t\t}\n\t\tSystem.out.print(\"\\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\tint n, i, j, num[], count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tnum = new int[n];\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\t\ti = 1;\n\t\twhile (i != 0) {\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (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\t}\n\t\t}\n\t\tSystem.out.print(\"\\n\");\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tint n, i, j, num[], count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tnum = new int[n];\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\t\ti = 1;\n\t\twhile (i != 0) {\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (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\t}\n\t\t}\n\t\tSystem.out.print(\"\\n\");\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tint n, i, j, num[], count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tnum = new int[n];\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\t\ti = 1;\n\t\twhile (i != 0) {\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (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\t}\n\t\t}\n\t\tSystem.out.print(\"\\n\");\n\t\tSystem.out.println(count);\n\t}",
"int n",
"n",
"i",
"i",
"j",
"j",
"num[]",
"num",
"count = 0;",
"count",
"0",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"num = new int[n]",
"num",
"new int[n]",
"n",
"for (i = 0; i < n; ++i) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}",
"i = 0;",
"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",
"sc.close()",
"sc.close",
"sc",
"i = 1",
"i",
"1",
"while (i != 0) {\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"i != 0",
"i",
"0",
"{\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"i = 0",
"i",
"0",
"for (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}",
"j = n - 1;",
"j = n - 1",
"j",
"n - 1",
"n",
"1",
"j > 0",
"j",
"0",
"--j",
"--j",
"j",
"{\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\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 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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}",
"if (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\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 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\ti = 1;\n\t\t\t\t\t++count;\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",
"i = 1",
"i",
"1",
"++count",
"count",
"for (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\t}\n\t\t}",
"i = 0;",
"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\t}\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\t}\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(\" \");\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.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",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tint n, i, j, num[], count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tnum = new int[n];\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\t\ti = 1;\n\t\twhile (i != 0) {\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (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\t}\n\t\t}\n\t\tSystem.out.print(\"\\n\");\n\t\tSystem.out.println(count);\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tint n, i, j, num[], count = 0;\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = sc.nextInt();\n\t\tnum = new int[n];\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tnum[i] = sc.nextInt();\n\t\t}\n\t\tsc.close();\n\t\ti = 1;\n\t\twhile (i != 0) {\n\t\t\ti = 0;\n\t\t\tfor (j = n - 1; j > 0; --j) {\n\t\t\t\tif (num[j - 1] > num[j]) {\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\ti = 1;\n\t\t\t\t\t++count;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (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\t}\n\t\t}\n\t\tSystem.out.print(\"\\n\");\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n, i, j, num[], count = 0;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
num = new int[n];
for (i = 0; i < n; ++i) {
num[i] = sc.nextInt();
}
sc.close();
i = 1;
while (i != 0) {
i = 0;
for (j = n - 1; j > 0; --j) {
if (num[j - 1] > num[j]) {
int tmp = num[j];
num[j] = num[j - 1];
num[j - 1] = tmp;
i = 1;
++count;
}
}
}
for (i = 0; i < n; ++i) {
System.out.print(num[i]);
if (i != n - 1) {
System.out.print(" ");
}
}
System.out.print("\n");
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,
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,
41,
13,
20,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
30,
4,
18,
13,
17,
4,
18,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
41,
13,
41,
13,
41,
13,
2,
18,
13,
13,
17,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
11,
1,
0,
13,
13,
2,
13,
13,
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,
40,
13,
29,
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
],
[
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
],
[
57,
58
],
[
57,
59
],
[
8,
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
],
[
76,
79
],
[
79,
80
],
[
79,
81
],
[
75,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
82,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
89,
92
],
[
8,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
93,
98
],
[
98,
99
],
[
99,
100
],
[
8,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
6,
107
],
[
107,
108
],
[
4,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
112,
113
],
[
111,
114
],
[
114,
115
],
[
111,
116
],
[
116,
117
],
[
111,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
111,
125
],
[
125,
126
],
[
125,
127
],
[
111,
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
],
[
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
],
[
156,
157
],
[
156,
158
],
[
158,
159
],
[
158,
160
],
[
155,
161
],
[
161,
162
],
[
161,
163
],
[
154,
164
],
[
164,
165
],
[
165,
166
],
[
165,
167
],
[
167,
168
],
[
167,
169
],
[
169,
170
],
[
169,
171
],
[
164,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
175,
176
],
[
175,
177
],
[
172,
178
],
[
178,
179
],
[
178,
180
],
[
164,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
181,
185
],
[
164,
186
],
[
186,
187
],
[
111,
188
],
[
188,
189
],
[
109,
190
],
[
190,
191
]
] | [
"import java.io.*;\n\nclass Main {\n public static void main (String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] element = br.readLine().split(\" \");\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(element[i]);\n }\n \n int count = bubbleSort(a);\n\n StringBuilder output = new StringBuilder(\"\");\n for (int i = 0; i < n; i++) {\n output.append(a[i]);\n if (i != n-1) {\n output.append(\" \");\n }\n }\n System.out.println(output.toString());\n System.out.println(count);\n }\n\n public static int bubbleSort (int[] a) {\n int i, j, temp;\n int n = a.length - 1;\n int count = 0;\n for (i = 0; i < n; i++) {\n for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }\n }\n return count;\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main {\n public static void main (String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] element = br.readLine().split(\" \");\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(element[i]);\n }\n \n int count = bubbleSort(a);\n\n StringBuilder output = new StringBuilder(\"\");\n for (int i = 0; i < n; i++) {\n output.append(a[i]);\n if (i != n-1) {\n output.append(\" \");\n }\n }\n System.out.println(output.toString());\n System.out.println(count);\n }\n\n public static int bubbleSort (int[] a) {\n int i, j, temp;\n int n = a.length - 1;\n int count = 0;\n for (i = 0; i < n; i++) {\n for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }\n }\n return count;\n }\n}",
"Main",
"public static void main (String[] args) throws Exception {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n int n = Integer.parseInt(br.readLine());\n String[] element = br.readLine().split(\" \");\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(element[i]);\n }\n \n int count = bubbleSort(a);\n\n StringBuilder output = new StringBuilder(\"\");\n for (int i = 0; i < n; i++) {\n output.append(a[i]);\n if (i != n-1) {\n output.append(\" \");\n }\n }\n System.out.println(output.toString());\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[] element = br.readLine().split(\" \");\n int[] a = new int[n];\n for (int i = 0; i < n; i++) {\n a[i] = Integer.parseInt(element[i]);\n }\n \n int count = bubbleSort(a);\n\n StringBuilder output = new StringBuilder(\"\");\n for (int i = 0; i < n; i++) {\n output.append(a[i]);\n if (i != n-1) {\n output.append(\" \");\n }\n }\n System.out.println(output.toString());\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[] element = br.readLine().split(\" \");",
"element",
"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++) {\n a[i] = Integer.parseInt(element[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n a[i] = Integer.parseInt(element[i]);\n }",
"{\n a[i] = Integer.parseInt(element[i]);\n }",
"a[i] = Integer.parseInt(element[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(element[i])",
"Integer.parseInt",
"Integer",
"element[i]",
"element",
"i",
"int count = bubbleSort(a);",
"count",
"bubbleSort(a)",
"bubbleSort",
"a",
"StringBuilder output = new StringBuilder(\"\");",
"output",
"new StringBuilder(\"\")",
"for (int i = 0; i < n; i++) {\n output.append(a[i]);\n if (i != n-1) {\n output.append(\" \");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n output.append(a[i]);\n if (i != n-1) {\n output.append(\" \");\n }\n }",
"{\n output.append(a[i]);\n if (i != n-1) {\n output.append(\" \");\n }\n }",
"output.append(a[i])",
"output.append",
"output",
"a[i]",
"a",
"i",
"if (i != n-1) {\n output.append(\" \");\n }",
"i != n-1",
"i",
"n-1",
"n",
"1",
"{\n output.append(\" \");\n }",
"output.append(\" \")",
"output.append",
"output",
"\" \"",
"System.out.println(output.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"output.toString()",
"output.toString",
"output",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public static int bubbleSort (int[] a) {\n int i, j, temp;\n int n = a.length - 1;\n int count = 0;\n for (i = 0; i < n; i++) {\n for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }\n }\n return count;\n }",
"bubbleSort",
"{\n int i, j, temp;\n int n = a.length - 1;\n int count = 0;\n for (i = 0; i < n; i++) {\n for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }\n }\n return count;\n }",
"int i",
"i",
"j",
"j",
"temp;",
"temp",
"int n = a.length - 1;",
"n",
"a.length - 1",
"a.length",
"a",
"a.length",
"1",
"int count = 0;",
"count",
"0",
"for (i = 0; i < n; i++) {\n for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }\n }",
"i = 0;",
"i = 0",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }\n }",
"{\n for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }\n }",
"for (j = n; j > i; j--) {\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }",
"j = n;",
"j = n",
"j",
"n",
"j > i",
"j",
"i",
"j--",
"j--",
"j",
"{\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }",
"{\n if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }\n }",
"if (a[j-1] > a[j]) {\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }",
"a[j-1] > a[j]",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j]",
"a",
"j",
"{\n temp = a[j-1];\n a[j-1] = a[j];\n a[j] = temp;\n count++;\n }",
"temp = a[j-1]",
"temp",
"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] = temp",
"a[j]",
"a",
"j",
"temp",
"count++",
"count",
"return count;",
"count",
"int[] a",
"a"
] | import java.io.*;
class Main {
public static void main (String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] element = br.readLine().split(" ");
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = Integer.parseInt(element[i]);
}
int count = bubbleSort(a);
StringBuilder output = new StringBuilder("");
for (int i = 0; i < n; i++) {
output.append(a[i]);
if (i != n-1) {
output.append(" ");
}
}
System.out.println(output.toString());
System.out.println(count);
}
public static int bubbleSort (int[] a) {
int i, j, temp;
int n = a.length - 1;
int count = 0;
for (i = 0; i < n; i++) {
for (j = n; j > i; j--) {
if (a[j-1] > a[j]) {
temp = a[j-1];
a[j-1] = a[j];
a[j] = temp;
count++;
}
}
}
return count;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
41,
13,
17,
12,
13,
30,
41,
13,
20,
38,
5,
13,
30,
4,
18,
13,
5,
13,
30,
4,
18,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
14,
2,
13,
17,
30,
4,
18,
18,
13,
13,
4,
18,
13,
4,
18,
18,
13,
13,
17,
29,
41,
13,
4,
18,
4,
18,
13,
17,
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,
18,
13,
13,
41,
13,
17,
41,
13,
11,
1,
41,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
11,
1,
41,
13,
2,
13,
17,
2,
13,
2,
13,
17,
1,
40,
13,
30,
30,
14,
2,
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,
41,
13,
20,
4,
18,
13,
4,
18,
13,
18,
13,
17,
11,
1,
41,
13,
17,
2,
13,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
4,
18,
13,
17,
4,
18,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
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
],
[
230,
11
],
[
230,
12
],
[
12,
13
],
[
12,
14
],
[
230,
15
],
[
15,
16
],
[
15,
17
],
[
230,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
21,
23
],
[
20,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
24,
31
],
[
31,
32
],
[
31,
33
],
[
33,
34
],
[
34,
35
],
[
35,
36
],
[
24,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
40,
41
],
[
41,
42
],
[
40,
43
],
[
43,
44
],
[
44,
45
],
[
37,
46
],
[
46,
47
],
[
47,
48
],
[
47,
49
],
[
46,
50
],
[
50,
51
],
[
51,
52
],
[
52,
53
],
[
53,
54
],
[
53,
55
],
[
51,
56
],
[
56,
57
],
[
57,
58
],
[
50,
59
],
[
59,
60
],
[
60,
61
],
[
61,
62
],
[
61,
63
],
[
59,
64
],
[
50,
65
],
[
37,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
68,
73
],
[
37,
74
],
[
74,
75
],
[
74,
76
],
[
37,
78
],
[
78,
79
],
[
79,
80
],
[
80,
81
],
[
80,
82
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
85,
86
],
[
85,
87
],
[
78,
88
],
[
88,
89
],
[
89,
90
],
[
78,
91
],
[
92,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
93,
97
],
[
97,
98
],
[
98,
99
],
[
97,
100
],
[
100,
101
],
[
100,
102
],
[
37,
103
],
[
103,
104
],
[
103,
105
],
[
37,
106
],
[
106,
107
],
[
37,
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
],
[
127,
128
],
[
127,
129
],
[
123,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
123,
135
],
[
135,
136
],
[
136,
137
],
[
123,
138
],
[
139,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
140,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
155,
156
],
[
155,
157
],
[
150,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
158,
164
],
[
164,
165
],
[
164,
166
],
[
150,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
167,
171
],
[
150,
172
],
[
172,
173
],
[
37,
174
],
[
174,
175
],
[
174,
176
],
[
37,
177
],
[
177,
178
],
[
178,
179
],
[
177,
180
],
[
180,
181
],
[
181,
182
],
[
180,
183
],
[
183,
184
],
[
183,
185
],
[
37,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
188,
190
],
[
186,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
193,
195
],
[
186,
196
],
[
196,
197
],
[
197,
198
],
[
186,
199
],
[
200,
200
],
[
200,
201
],
[
201,
202
],
[
202,
203
],
[
203,
204
],
[
204,
205
],
[
203,
206
],
[
201,
207
],
[
207,
208
],
[
208,
209
],
[
207,
210
],
[
210,
211
],
[
210,
212
],
[
37,
213
],
[
213,
214
],
[
214,
215
],
[
215,
216
],
[
215,
217
],
[
213,
218
],
[
218,
219
],
[
219,
220
],
[
37,
221
],
[
221,
222
],
[
222,
223
],
[
223,
224
],
[
223,
225
],
[
221,
226
],
[
18,
227
],
[
227,
228
],
[
0,
229
],
[
229,
230
],
[
229,
231
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\npublic class Main {\n\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\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\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"Main",
"public static final int BIG_NUM = 2000000000;",
"BIG_NUM",
"2000000000",
"public static final int MOD = 1000000007;",
"MOD",
"1000000007",
"public static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}",
"main",
"{\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\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\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t}",
"NumberFormatException e",
"{\n\t\t\te.printStackTrace();\n\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"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\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t}",
"int N = Integer.parseInt(br.readLine());",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"if(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"N == 1",
"N",
"1",
"{\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}",
"System.out.println(br.readLine())",
"System.out.println",
"System.out",
"System",
"System.out",
"br.readLine()",
"br.readLine",
"br",
"System.out.println(0)",
"System.out.println",
"System.out",
"System",
"System.out",
"0",
"return;",
"String tmp_str[] = br.readLine().split(\"\\\\s+\");",
"tmp_str",
"br.readLine().split(\"\\\\s+\")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\"\\\\s+\"",
"int array[] = new int[N];",
"array",
"new int[N]",
"N",
"for(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < tmp_str.length",
"i",
"tmp_str.length",
"tmp_str",
"tmp_str.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}",
"{\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}",
"array[i] = Integer.parseInt(tmp_str[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(tmp_str[i])",
"Integer.parseInt",
"Integer",
"tmp_str[i]",
"tmp_str",
"i",
"int swap_count = 0",
"swap_count",
"0",
"work;",
"work",
"for(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\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\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}",
"for(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}",
"int k = N-1;",
"int k = N-1;",
"k",
"N-1",
"N",
"1",
"k >= i+1",
"k",
"i+1",
"i",
"1",
"k--",
"k--",
"k",
"{\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}",
"{\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}",
"if(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}",
"array[k] < array[k-1]",
"array[k]",
"array",
"k",
"array[k-1]",
"array",
"k-1",
"k",
"1",
"{\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}",
"work = array[k-1]",
"work",
"array[k-1]",
"array",
"k-1",
"k",
"1",
"array[k-1] = array[k]",
"array[k-1]",
"array",
"k-1",
"k",
"1",
"array[k]",
"array",
"k",
"array[k] = work",
"array[k]",
"array",
"k",
"work",
"swap_count++",
"swap_count",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"sb.append(Integer.toBinaryString(array[0]))",
"sb.append",
"sb",
"Integer.toBinaryString(array[0])",
"Integer.toBinaryString",
"Integer",
"array[0]",
"array",
"0",
"for(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}",
"{\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}",
"sb.append(\" \").append(Integer.toString(array[i]))",
"sb.append(\" \").append",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"Integer.toString(array[i])",
"Integer.toString",
"Integer",
"array[i]",
"array",
"i",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"System.out.println(swap_count)",
"System.out.println",
"System.out",
"System",
"System.out",
"swap_count",
"String[] args",
"args",
"public class Main {\n\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"public class Main {\n\n\tpublic static final int BIG_NUM = 2000000000;\n\tpublic static final int MOD = 1000000007;\n\n\tpublic static void main(String[] args) {\n\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n\t\ttry {\n\t\t\tint N = Integer.parseInt(br.readLine());\n\t\t\tif(N == 1){\n\t\t\t\tSystem.out.println(br.readLine());\n\t\t\t\tSystem.out.println(0);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tString tmp_str[] = br.readLine().split(\"\\\\s+\");\n\t\t\tint array[] = new int[N];\n\n\t\t\tfor(int i = 0; i < tmp_str.length; i++){\n\t\t\t\tarray[i] = Integer.parseInt(tmp_str[i]);\n\t\t\t}\n\n\t\t\tint swap_count = 0,work;\n\n\t\t\tfor(int i = 0; i < N-1; i++){\n\t\t\t\tfor(int k = N-1; k >= i+1; k--){\n\t\t\t\t\tif(array[k] < array[k-1]){\n\t\t\t\t\t\twork = array[k-1];\n\t\t\t\t\t\tarray[k-1] = array[k];\n\t\t\t\t\t\tarray[k] = work;\n\t\t\t\t\t\tswap_count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tStringBuilder sb = new StringBuilder();\n\t\t\tsb.append(Integer.toBinaryString(array[0]));\n\t\t\tfor(int i = 1; i < array.length; i++){\n\t\t\t\tsb.append(\" \").append(Integer.toString(array[i]));\n\t\t\t}\n\t\t\tSystem.out.println(sb.toString());\n\t\t\tSystem.out.println(swap_count);\n\n\t\t} catch (NumberFormatException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static final int BIG_NUM = 2000000000;
public static final int MOD = 1000000007;
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
int N = Integer.parseInt(br.readLine());
if(N == 1){
System.out.println(br.readLine());
System.out.println(0);
return;
}
String tmp_str[] = br.readLine().split("\\s+");
int array[] = new int[N];
for(int i = 0; i < tmp_str.length; i++){
array[i] = Integer.parseInt(tmp_str[i]);
}
int swap_count = 0,work;
for(int i = 0; i < N-1; i++){
for(int k = N-1; k >= i+1; k--){
if(array[k] < array[k-1]){
work = array[k-1];
array[k-1] = array[k];
array[k] = work;
swap_count++;
}
}
}
StringBuilder sb = new StringBuilder();
sb.append(Integer.toBinaryString(array[0]));
for(int i = 1; i < array.length; i++){
sb.append(" ").append(Integer.toString(array[i]));
}
System.out.println(sb.toString());
System.out.println(swap_count);
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
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,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
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,
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,
28,
13,
13,
30,
4,
18,
13,
2,
13,
17,
4,
18,
13,
4,
18,
13,
17,
4,
18,
18,
13,
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
],
[
183,
11
],
[
183,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
22,
23
],
[
23,
24
],
[
22,
25
],
[
25,
26
],
[
26,
27
],
[
14,
28
],
[
28,
29
],
[
28,
30
],
[
14,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
34,
39
],
[
14,
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
],
[
14,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
14,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
68,
73
],
[
12,
74
],
[
74,
75
],
[
183,
76
],
[
76,
77
],
[
76,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
82,
84
],
[
78,
85
],
[
85,
86
],
[
78,
87
],
[
87,
88
],
[
88,
89
],
[
89,
90
],
[
89,
91
],
[
87,
92
],
[
92,
93
],
[
92,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
94,
98
],
[
87,
99
],
[
99,
100
],
[
100,
101
],
[
87,
102
],
[
103,
103
],
[
103,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
108,
112
],
[
104,
113
],
[
113,
114
],
[
113,
115
],
[
104,
116
],
[
116,
117
],
[
117,
118
],
[
104,
119
],
[
120,
120
],
[
120,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
122,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
121,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
134,
136
],
[
131,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
137,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
131,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
149,
150
],
[
149,
151
],
[
146,
152
],
[
131,
153
],
[
153,
154
],
[
78,
155
],
[
155,
156
],
[
155,
157
],
[
155,
158
],
[
158,
159
],
[
159,
160
],
[
160,
161
],
[
159,
162
],
[
162,
163
],
[
162,
164
],
[
78,
165
],
[
165,
166
],
[
166,
167
],
[
165,
168
],
[
168,
169
],
[
169,
170
],
[
168,
171
],
[
78,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
172,
177
],
[
78,
178
],
[
178,
179
],
[
76,
180
],
[
180,
181
],
[
0,
182
],
[
182,
183
],
[
182,
184
]
] | [
"import java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.lang.StringBuilder;\n\n/*Question\n/??????????????????????????????????????¨?????????????????????Bubble???????°´??¢???????????£???????????????????????????????´??????????????????????????????????????????????????¬???????????????¢?????´???????????§??°????????????????????????????????????\n/1 bubbleSort(A, N) // N ??????????´?????????? 0-????????????????????? A\n/2 flag = 1 // ????????£??\\????´?????????¨??????\n/3 while flag\n/4 flag = 0\n/5 for j ??? N-1 ?????? 1 ?????§\n/6 if A[j] < A[j-1]\n/7 A[j] ??¨ A[j-1] ?????????\n/8 flag = 1\n/??°??? A ??????????????????????????????????????§?????????????????????????????????????????°?????????????????????????????????????????????????????????????????§????????????????´???????????????°?????±???????????????????????? \n*/\n\n/*Input\n/??\\??????????????????????????°?????????????????¨?????´??° N ???????????????????????????????????????N ????????´??°????????????????????§?????????????????????\n*/\n\npublic class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\t\t//???????????°????¢??????¨\n\t\tint k;\n\t\t/*??\\???\n\t\t/??????????´???°?????\\???????¬??????°????????\\???\n\t\t*/\n\t\tint n = Integer.parseInt(sc.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] st = sc.readLine().split(\" \");\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = Integer.parseInt(st[i]);\n\t\t}\n\t\t/*??°??????Bubble???????????????\n\t\t/????????????????????§?????????????????????\n\t\t/??????????????£??????????????§??????\n\t\t*/\n\t\tk = Bubble(a);\n\t\tSystem.out.println(k);\n\t}\n\n\t/*Bubble????????????\n\t/???????????????????????????\n\t@return int\n\t*/\n\n\tpublic static int Bubble(int[] a) {\n\t\t//????????¨\n\t\tStringBuilder br = new StringBuilder();\n\t\t//?????°???????????????\n\t\tint s = 0;\n\t\t//????????????????????????????????\\????????¨\n\t\tint t;\n\t\tfor (int i = 0;i < a.length-1;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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//??????\n\t\tfor (int n:a)\n\t\t\tbr.append(n+\" \");\n\t\tbr.deleteCharAt(br.lastIndexOf(\" \"));\n\t\tSystem.out.println(br);\n\t\treturn s;\n\t}\n}",
"import java.io.BufferedReader;",
"BufferedReader",
"java.io",
"import java.io.InputStreamReader;",
"InputStreamReader",
"java.io",
"import java.lang.StringBuilder;",
"StringBuilder",
"java.lang",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\t\t//???????????°????¢??????¨\n\t\tint k;\n\t\t/*??\\???\n\t\t/??????????´???°?????\\???????¬??????°????????\\???\n\t\t*/\n\t\tint n = Integer.parseInt(sc.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] st = sc.readLine().split(\" \");\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = Integer.parseInt(st[i]);\n\t\t}\n\t\t/*??°??????Bubble???????????????\n\t\t/????????????????????§?????????????????????\n\t\t/??????????????£??????????????§??????\n\t\t*/\n\t\tk = Bubble(a);\n\t\tSystem.out.println(k);\n\t}\n\n\t/*Bubble????????????\n\t/???????????????????????????\n\t@return int\n\t*/\n\n\tpublic static int Bubble(int[] a) {\n\t\t//????????¨\n\t\tStringBuilder br = new StringBuilder();\n\t\t//?????°???????????????\n\t\tint s = 0;\n\t\t//????????????????????????????????\\????????¨\n\t\tint t;\n\t\tfor (int i = 0;i < a.length-1;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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//??????\n\t\tfor (int n:a)\n\t\t\tbr.append(n+\" \");\n\t\tbr.deleteCharAt(br.lastIndexOf(\" \"));\n\t\tSystem.out.println(br);\n\t\treturn s;\n\t}\n}",
"Main",
"public static void main(String[] args) throws Exception {\n\t\tBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\t\t//???????????°????¢??????¨\n\t\tint k;\n\t\t/*??\\???\n\t\t/??????????´???°?????\\???????¬??????°????????\\???\n\t\t*/\n\t\tint n = Integer.parseInt(sc.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] st = sc.readLine().split(\" \");\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = Integer.parseInt(st[i]);\n\t\t}\n\t\t/*??°??????Bubble???????????????\n\t\t/????????????????????§?????????????????????\n\t\t/??????????????£??????????????§??????\n\t\t*/\n\t\tk = Bubble(a);\n\t\tSystem.out.println(k);\n\t}",
"main",
"{\n\t\tBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\t\t//???????????°????¢??????¨\n\t\tint k;\n\t\t/*??\\???\n\t\t/??????????´???°?????\\???????¬??????°????????\\???\n\t\t*/\n\t\tint n = Integer.parseInt(sc.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] st = sc.readLine().split(\" \");\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = Integer.parseInt(st[i]);\n\t\t}\n\t\t/*??°??????Bubble???????????????\n\t\t/????????????????????§?????????????????????\n\t\t/??????????????£??????????????§??????\n\t\t*/\n\t\tk = Bubble(a);\n\t\tSystem.out.println(k);\n\t}",
"BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));",
"sc",
"new BufferedReader(new InputStreamReader(System.in))",
"int k;",
"k",
"int n = Integer.parseInt(sc.readLine());",
"n",
"Integer.parseInt(sc.readLine())",
"Integer.parseInt",
"Integer",
"sc.readLine()",
"sc.readLine",
"sc",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"String[] st = sc.readLine().split(\" \");",
"st",
"sc.readLine().split(\" \")",
"sc.readLine().split",
"sc.readLine()",
"sc.readLine",
"sc",
"\" \"",
"for(int i = 0;i < n;i++){\n\t\t\ta[i] = Integer.parseInt(st[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(st[i]);\n\t\t}",
"{\n\t\t\ta[i] = Integer.parseInt(st[i]);\n\t\t}",
"a[i] = Integer.parseInt(st[i])",
"a[i]",
"a",
"i",
"Integer.parseInt(st[i])",
"Integer.parseInt",
"Integer",
"st[i]",
"st",
"i",
"k = Bubble(a)",
"k",
"Bubble(a)",
"Bubble",
"a",
"System.out.println(k)",
"System.out.println",
"System.out",
"System",
"System.out",
"k",
"String[] args",
"args",
"public static int Bubble(int[] a) {\n\t\t//????????¨\n\t\tStringBuilder br = new StringBuilder();\n\t\t//?????°???????????????\n\t\tint s = 0;\n\t\t//????????????????????????????????\\????????¨\n\t\tint t;\n\t\tfor (int i = 0;i < a.length-1;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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//??????\n\t\tfor (int n:a)\n\t\t\tbr.append(n+\" \");\n\t\tbr.deleteCharAt(br.lastIndexOf(\" \"));\n\t\tSystem.out.println(br);\n\t\treturn s;\n\t}",
"Bubble",
"{\n\t\t//????????¨\n\t\tStringBuilder br = new StringBuilder();\n\t\t//?????°???????????????\n\t\tint s = 0;\n\t\t//????????????????????????????????\\????????¨\n\t\tint t;\n\t\tfor (int i = 0;i < a.length-1;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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//??????\n\t\tfor (int n:a)\n\t\t\tbr.append(n+\" \");\n\t\tbr.deleteCharAt(br.lastIndexOf(\" \"));\n\t\tSystem.out.println(br);\n\t\treturn s;\n\t}",
"StringBuilder br = new StringBuilder();",
"br",
"new StringBuilder()",
"int s = 0;",
"s",
"0",
"int t;",
"t",
"for (int i = 0;i < a.length-1;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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\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\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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\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\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\ts++;\n\t\t\t\t}\n\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",
"{\n\t\t\t\tif (a[j] < a[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\ts++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (a[j] < a[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\ts++;\n\t\t\t\t}\n\t\t\t}",
"if (a[j] < a[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\ts++;\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\ts++;\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",
"s++",
"s",
"for (int n:a)\n\t\t\tbr.append(n+\" \");",
"int n",
"a",
"br.append(n+\" \");",
"br.append(n+\" \")",
"br.append",
"br",
"n+\" \"",
"n",
"\" \"",
"br.deleteCharAt(br.lastIndexOf(\" \"))",
"br.deleteCharAt",
"br",
"br.lastIndexOf(\" \")",
"br.lastIndexOf",
"br",
"\" \"",
"System.out.println(br)",
"System.out.println",
"System.out",
"System",
"System.out",
"br",
"return s;",
"s",
"int[] a",
"a",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\t\t//???????????°????¢??????¨\n\t\tint k;\n\t\t/*??\\???\n\t\t/??????????´???°?????\\???????¬??????°????????\\???\n\t\t*/\n\t\tint n = Integer.parseInt(sc.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] st = sc.readLine().split(\" \");\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = Integer.parseInt(st[i]);\n\t\t}\n\t\t/*??°??????Bubble???????????????\n\t\t/????????????????????§?????????????????????\n\t\t/??????????????£??????????????§??????\n\t\t*/\n\t\tk = Bubble(a);\n\t\tSystem.out.println(k);\n\t}\n\n\t/*Bubble????????????\n\t/???????????????????????????\n\t@return int\n\t*/\n\n\tpublic static int Bubble(int[] a) {\n\t\t//????????¨\n\t\tStringBuilder br = new StringBuilder();\n\t\t//?????°???????????????\n\t\tint s = 0;\n\t\t//????????????????????????????????\\????????¨\n\t\tint t;\n\t\tfor (int i = 0;i < a.length-1;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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//??????\n\t\tfor (int n:a)\n\t\t\tbr.append(n+\" \");\n\t\tbr.deleteCharAt(br.lastIndexOf(\" \"));\n\t\tSystem.out.println(br);\n\t\treturn s;\n\t}\n}",
"public class Main {\n\tpublic static void main(String[] args) throws Exception {\n\t\tBufferedReader sc = new BufferedReader(new InputStreamReader(System.in));\n\t\t//???????????°????¢??????¨\n\t\tint k;\n\t\t/*??\\???\n\t\t/??????????´???°?????\\???????¬??????°????????\\???\n\t\t*/\n\t\tint n = Integer.parseInt(sc.readLine());\n\t\tint[] a = new int[n];\n\t\tString[] st = sc.readLine().split(\" \");\n\t\tfor(int i = 0;i < n;i++){\n\t\t\ta[i] = Integer.parseInt(st[i]);\n\t\t}\n\t\t/*??°??????Bubble???????????????\n\t\t/????????????????????§?????????????????????\n\t\t/??????????????£??????????????§??????\n\t\t*/\n\t\tk = Bubble(a);\n\t\tSystem.out.println(k);\n\t}\n\n\t/*Bubble????????????\n\t/???????????????????????????\n\t@return int\n\t*/\n\n\tpublic static int Bubble(int[] a) {\n\t\t//????????¨\n\t\tStringBuilder br = new StringBuilder();\n\t\t//?????°???????????????\n\t\tint s = 0;\n\t\t//????????????????????????????????\\????????¨\n\t\tint t;\n\t\tfor (int i = 0;i < a.length-1;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\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\ts++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//??????\n\t\tfor (int n:a)\n\t\t\tbr.append(n+\" \");\n\t\tbr.deleteCharAt(br.lastIndexOf(\" \"));\n\t\tSystem.out.println(br);\n\t\treturn s;\n\t}\n}",
"Main"
] | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuilder;
/*Question
/??????????????????????????????????????¨?????????????????????Bubble???????°´??¢???????????£???????????????????????????????´??????????????????????????????????????????????????¬???????????????¢?????´???????????§??°????????????????????????????????????
/1 bubbleSort(A, N) // N ??????????´?????????? 0-????????????????????? A
/2 flag = 1 // ????????£??\????´?????????¨??????
/3 while flag
/4 flag = 0
/5 for j ??? N-1 ?????? 1 ?????§
/6 if A[j] < A[j-1]
/7 A[j] ??¨ A[j-1] ?????????
/8 flag = 1
/??°??? A ??????????????????????????????????????§?????????????????????????????????????????°?????????????????????????????????????????????????????????????????§????????????????´???????????????°?????±????????????????????????
*/
/*Input
/??\??????????????????????????°?????????????????¨?????´??° N ???????????????????????????????????????N ????????´??°????????????????????§?????????????????????
*/
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
//???????????°????¢??????¨
int k;
/*??\???
/??????????´???°?????\???????¬??????°????????\???
*/
int n = Integer.parseInt(sc.readLine());
int[] a = new int[n];
String[] st = sc.readLine().split(" ");
for(int i = 0;i < n;i++){
a[i] = Integer.parseInt(st[i]);
}
/*??°??????Bubble???????????????
/????????????????????§?????????????????????
/??????????????£??????????????§??????
*/
k = Bubble(a);
System.out.println(k);
}
/*Bubble????????????
/???????????????????????????
@return int
*/
public static int Bubble(int[] a) {
//????????¨
StringBuilder br = new StringBuilder();
//?????°???????????????
int s = 0;
//????????????????????????????????\????????¨
int t;
for (int i = 0;i < a.length-1;i++) {
for (int j = a.length-1;j > i;j--) {
if (a[j] < a[j-1]){
t = a[j];
a[j] = a[j-1];
a[j-1] = t;
s++;
}
}
}
//??????
for (int n:a)
br.append(n+" ");
br.deleteCharAt(br.lastIndexOf(" "));
System.out.println(br);
return s;
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
41,
13,
17,
12,
13,
30,
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,
14,
2,
13,
2,
13,
17,
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,
12,
13,
30,
41,
13,
20,
0,
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,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
152,
8
],
[
152,
9
],
[
9,
10
],
[
9,
11
],
[
152,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
19,
20
],
[
20,
21
],
[
20,
22
],
[
18,
23
],
[
23,
24
],
[
23,
25
],
[
18,
26
],
[
26,
27
],
[
27,
28
],
[
18,
29
],
[
30,
30
],
[
30,
31
],
[
31,
32
],
[
32,
33
],
[
33,
34
],
[
33,
35
],
[
35,
36
],
[
35,
37
],
[
31,
38
],
[
38,
39
],
[
38,
40
],
[
31,
41
],
[
41,
42
],
[
42,
43
],
[
31,
44
],
[
45,
45
],
[
45,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
47,
51
],
[
51,
52
],
[
51,
53
],
[
53,
54
],
[
53,
55
],
[
46,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
59,
60
],
[
59,
61
],
[
56,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
66,
68
],
[
68,
69
],
[
68,
70
],
[
56,
71
],
[
71,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
71,
77
],
[
56,
78
],
[
78,
79
],
[
30,
80
],
[
80,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
80,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
91,
92
],
[
92,
93
],
[
92,
94
],
[
91,
95
],
[
80,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
98,
100
],
[
96,
101
],
[
101,
102
],
[
101,
103
],
[
14,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
12,
110
],
[
110,
111
],
[
152,
112
],
[
112,
113
],
[
112,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
114,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
121,
122
],
[
114,
123
],
[
123,
124
],
[
123,
125
],
[
114,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
129,
131
],
[
127,
132
],
[
132,
133
],
[
132,
134
],
[
127,
135
],
[
135,
136
],
[
136,
137
],
[
127,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
143,
144
],
[
144,
145
],
[
114,
146
],
[
146,
147
],
[
146,
148
],
[
112,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
] | [
"import java.util.*;\nimport java.io.*;\npublic class Main {\n\tstatic int n = 0;\n\t\n\tpublic static void bubble_sort(int[] a) {\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t\t\n\t\t// print swapCount on a new line\n\t\tSystem.out.println(swapCount);\n\t}\n\t\n\tpublic static void main (String args[]) {\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = 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\tbubble_sort(a);\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"import java.io.*;",
"io.*",
"java",
"public class Main {\n\tstatic int n = 0;\n\t\n\tpublic static void bubble_sort(int[] a) {\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t\t\n\t\t// print swapCount on a new line\n\t\tSystem.out.println(swapCount);\n\t}\n\t\n\tpublic static void main (String args[]) {\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = 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\tbubble_sort(a);\n\t}\n}",
"Main",
"static int n = 0;",
"n",
"0",
"public static void bubble_sort(int[] a) {\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t\t\n\t\t// print swapCount on a new line\n\t\tSystem.out.println(swapCount);\n\t}",
"bubble_sort",
"{\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t\t\n\t\t// print swapCount on a new line\n\t\tSystem.out.println(swapCount);\n\t}",
"int swapCount = 0;",
"swapCount",
"0",
"for (int i = 0; i < n; i++) {\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\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\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\n\t\t}",
"{\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif (a[j] < a[j-1]) {\n\t\t\t\t\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}",
"if (a[j] < a[j-1]) {\n\t\t\t\t\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\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",
"swapCount++",
"swapCount",
"if (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);",
"i < n-1",
"i",
"n-1",
"n",
"1",
"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(swapCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapCount",
"int[] a",
"a",
"public static void main (String args[]) {\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = 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\tbubble_sort(a);\n\t}",
"main",
"{\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = 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\tbubble_sort(a);\n\t}",
"@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] a = new int[n];",
"a",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) \n\t\t\ta[i] = sc.nextInt();",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"a[i] = sc.nextInt();",
"a[i] = sc.nextInt()",
"a[i]",
"a",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"bubble_sort(a)",
"bubble_sort",
"a",
"String args[]",
"args",
"public class Main {\n\tstatic int n = 0;\n\t\n\tpublic static void bubble_sort(int[] a) {\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t\t\n\t\t// print swapCount on a new line\n\t\tSystem.out.println(swapCount);\n\t}\n\t\n\tpublic static void main (String args[]) {\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = 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\tbubble_sort(a);\n\t}\n}",
"public class Main {\n\tstatic int n = 0;\n\t\n\tpublic static void bubble_sort(int[] a) {\n\t\tint swapCount = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\t\n\t\t\t// search for unsorted pairs from the back\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\t\n\t\t\t\t\t// swap 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\t\n\t\t\t\t\t// increase swapCount\n\t\t\t\t\tswapCount++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// print sorted elements\n\t\t\tif (i < n-1) System.out.print(a[i] + \" \"); \n\t\t\telse\n\t\t\t\tSystem.out.println(a[i]);\n\t\t}\n\t\t\n\t\t// print swapCount on a new line\n\t\tSystem.out.println(swapCount);\n\t}\n\t\n\tpublic static void main (String args[]) {\n\t\t@SuppressWarnings(\"resource\")\n\t\tScanner sc = new Scanner(System.in);\n\t\tn = 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\tbubble_sort(a);\n\t}\n}",
"Main"
] | import java.util.*;
import java.io.*;
public class Main {
static int n = 0;
public static void bubble_sort(int[] a) {
int swapCount = 0;
for (int i = 0; i < n; i++) {
// search for unsorted pairs from the back
for (int j = n-1; j > i; j--) {
if (a[j] < a[j-1]) {
// swap a[j], a[j-1]
int tmp = a[j];
a[j] = a[j-1];
a[j-1] = tmp;
// increase swapCount
swapCount++;
}
}
// print sorted elements
if (i < n-1) System.out.print(a[i] + " ");
else
System.out.println(a[i]);
}
// print swapCount on a new line
System.out.println(swapCount);
}
public static void main (String args[]) {
@SuppressWarnings("resource")
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = sc.nextInt();
bubble_sort(a);
}
} |
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
17,
41,
13,
17,
41,
13,
41,
13,
20,
0,
18,
13,
17,
4,
18,
13,
11,
1,
0,
13,
17,
2,
13,
18,
13,
17,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
0,
13,
18,
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,
0,
13,
17,
2,
13,
18,
13,
17,
1,
40,
13,
30,
30,
14,
2,
13,
18,
13,
17,
30,
4,
18,
18,
13,
13,
2,
2,
18,
13,
13,
17,
13,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
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,
13
],
[
13,
14
],
[
8,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
8,
25
],
[
25,
26
],
[
25,
27
],
[
8,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
28,
32
],
[
32,
33
],
[
33,
34
],
[
8,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
35,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
42,
44
],
[
35,
45
],
[
45,
46
],
[
46,
47
],
[
35,
48
],
[
49,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
8,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
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
],
[
8,
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
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
132,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
145,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
145,
150
],
[
132,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
156,
160
],
[
6,
161
],
[
161,
162
]
] | [
"import java.util.Scanner;\nclass Main{\n public static void main(String[] args){\n\tint array[] = new int[101];\n\tint i,j,count=0,flag=1,temp;\n\n\tScanner scan = new Scanner(System.in);\n\tarray[0] = scan.nextInt();\n\n\tfor(i=1;i<=array[0];i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\twhile(flag!=0){\n\t flag=0;\n\t for(j=array[0];j>1;j--){\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }\n\t}\n\tfor(i=1;i<=array[0];i++){\n\t if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");\n\t}\n }\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n public static void main(String[] args){\n\tint array[] = new int[101];\n\tint i,j,count=0,flag=1,temp;\n\n\tScanner scan = new Scanner(System.in);\n\tarray[0] = scan.nextInt();\n\n\tfor(i=1;i<=array[0];i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\twhile(flag!=0){\n\t flag=0;\n\t for(j=array[0];j>1;j--){\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }\n\t}\n\tfor(i=1;i<=array[0];i++){\n\t if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");\n\t}\n }\n}",
"Main",
"public static void main(String[] args){\n\tint array[] = new int[101];\n\tint i,j,count=0,flag=1,temp;\n\n\tScanner scan = new Scanner(System.in);\n\tarray[0] = scan.nextInt();\n\n\tfor(i=1;i<=array[0];i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\twhile(flag!=0){\n\t flag=0;\n\t for(j=array[0];j>1;j--){\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }\n\t}\n\tfor(i=1;i<=array[0];i++){\n\t if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");\n\t}\n }",
"main",
"{\n\tint array[] = new int[101];\n\tint i,j,count=0,flag=1,temp;\n\n\tScanner scan = new Scanner(System.in);\n\tarray[0] = scan.nextInt();\n\n\tfor(i=1;i<=array[0];i++){\n\t array[i] = scan.nextInt();\n\t}\n\t\n\twhile(flag!=0){\n\t flag=0;\n\t for(j=array[0];j>1;j--){\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }\n\t}\n\tfor(i=1;i<=array[0];i++){\n\t if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");\n\t}\n }",
"int array[] = new int[101];",
"array",
"new int[101]",
"101",
"int i",
"i",
"j",
"j",
"count=0",
"count",
"0",
"flag=1",
"flag",
"1",
"temp;",
"temp",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"array[0] = scan.nextInt()",
"array[0]",
"array",
"0",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(i=1;i<=array[0];i++){\n\t array[i] = scan.nextInt();\n\t}",
"i=1;",
"i=1",
"i",
"1",
"i<=array[0]",
"i",
"array[0]",
"array",
"0",
"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",
"while(flag!=0){\n\t flag=0;\n\t for(j=array[0];j>1;j--){\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }\n\t}",
"flag!=0",
"flag",
"0",
"{\n\t flag=0;\n\t for(j=array[0];j>1;j--){\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }\n\t}",
"flag=0",
"flag",
"0",
"for(j=array[0];j>1;j--){\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }",
"j=array[0];",
"j=array[0]",
"j",
"array[0]",
"array",
"0",
"j>1",
"j",
"1",
"j--",
"j--",
"j",
"{\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }",
"{\n\t\tif(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}\n\t }",
"if(array[j] < array[j-1]){\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}",
"array[j] < array[j-1]",
"array[j]",
"array",
"j",
"array[j-1]",
"array",
"j-1",
"j",
"1",
"{\n\t\t temp = array[j];\n\t\t array[j] = array[j-1];\n\t\t array[j-1] = temp;\n\t\t flag = 1;\n\t\t count++;\n\t\t}",
"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",
"flag = 1",
"flag",
"1",
"count++",
"count",
"for(i=1;i<=array[0];i++){\n\t if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");\n\t}",
"i=1;",
"i=1",
"i",
"1",
"i<=array[0]",
"i",
"array[0]",
"array",
"0",
"i++",
"i++",
"i",
"{\n\t if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");\n\t}",
"{\n\t if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");\n\t}",
"if(i==array[0]){System.out.println(array[i]+\"\\n\"+count);}\n\t else System.out.print(array[i]+\" \");",
"i==array[0]",
"i",
"array[0]",
"array",
"0",
"{System.out.println(array[i]+\"\\n\"+count);}",
"System.out.println(array[i]+\"\\n\"+count)",
"System.out.println",
"System.out",
"System",
"System.out",
"array[i]+\"\\n\"+count",
"array[i]+\"\\n\"+count",
"array[i]",
"array",
"i",
"\"\\n\"",
"count",
"System.out.print(array[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"array[i]+\" \"",
"array[i]",
"array",
"i",
"\" \"",
"String[] args",
"args"
] | import java.util.Scanner;
class Main{
public static void main(String[] args){
int array[] = new int[101];
int i,j,count=0,flag=1,temp;
Scanner scan = new Scanner(System.in);
array[0] = scan.nextInt();
for(i=1;i<=array[0];i++){
array[i] = scan.nextInt();
}
while(flag!=0){
flag=0;
for(j=array[0];j>1;j--){
if(array[j] < array[j-1]){
temp = array[j];
array[j] = array[j-1];
array[j-1] = temp;
flag = 1;
count++;
}
}
}
for(i=1;i<=array[0];i++){
if(i==array[0]){System.out.println(array[i]+"\n"+count);}
else System.out.print(array[i]+" ");
}
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
23,
13,
23,
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,
2,
13,
17,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
13,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
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,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
171,
5
],
[
171,
6
],
[
6,
7
],
[
6,
8
],
[
8,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
11,
13
],
[
8,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
20,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
24,
26
],
[
26,
27
],
[
26,
28
],
[
23,
29
],
[
6,
30
],
[
30,
31
],
[
6,
32
],
[
32,
33
],
[
171,
34
],
[
34,
35
],
[
34,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
40,
42
],
[
42,
43
],
[
43,
44
],
[
36,
45
],
[
45,
46
],
[
45,
47
],
[
36,
49
],
[
49,
50
],
[
49,
51
],
[
36,
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
],
[
66,
68
],
[
65,
69
],
[
69,
70
],
[
70,
71
],
[
36,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
72,
80
],
[
80,
81
],
[
81,
82
],
[
72,
83
],
[
84,
84
],
[
84,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
85,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
92,
96
],
[
85,
97
],
[
97,
98
],
[
98,
99
],
[
85,
100
],
[
101,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
104,
105
],
[
104,
106
],
[
103,
107
],
[
107,
108
],
[
107,
109
],
[
109,
110
],
[
109,
111
],
[
102,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
113,
116
],
[
112,
117
],
[
117,
118
],
[
36,
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
],
[
132,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
132,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
36,
154
],
[
154,
155
],
[
155,
156
],
[
156,
157
],
[
156,
158
],
[
36,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
36,
165
],
[
165,
166
],
[
166,
167
],
[
34,
168
],
[
168,
169
],
[
0,
170
],
[
170,
171
],
[
170,
172
]
] | [
"import java.util.Scanner;\npublic class Main {\n\tstatic void swap(int[] data,int x){\n\t\tint tmp=data[x];\n\t\tdata[x]=data[x-1];\n\t\tdata[x-1]=tmp;\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint N=scan.nextInt();\n\t\tint data[]=new int[N];\n\t\tint count=0;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tdata[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t\t\n\t}\n\t\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tstatic void swap(int[] data,int x){\n\t\tint tmp=data[x];\n\t\tdata[x]=data[x-1];\n\t\tdata[x-1]=tmp;\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint N=scan.nextInt();\n\t\tint data[]=new int[N];\n\t\tint count=0;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tdata[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t\t\n\t}\n\t\n}",
"Main",
"static void swap(int[] data,int x){\n\t\tint tmp=data[x];\n\t\tdata[x]=data[x-1];\n\t\tdata[x-1]=tmp;\n\t}",
"swap",
"{\n\t\tint tmp=data[x];\n\t\tdata[x]=data[x-1];\n\t\tdata[x-1]=tmp;\n\t}",
"int tmp=data[x];",
"tmp",
"data[x]",
"data",
"x",
"data[x]=data[x-1]",
"data[x]",
"data",
"x",
"data[x-1]",
"data",
"x-1",
"x",
"1",
"data[x-1]=tmp",
"data[x-1]",
"data",
"x-1",
"x",
"1",
"tmp",
"int[] data",
"data",
"int x",
"x",
"public static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint N=scan.nextInt();\n\t\tint data[]=new int[N];\n\t\tint count=0;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tdata[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t\t\n\t}",
"main",
"{\n\t\tScanner scan=new Scanner(System.in);\n\t\tint N=scan.nextInt();\n\t\tint data[]=new int[N];\n\t\tint count=0;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tdata[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t\t\n\t}",
"Scanner scan=new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int N=scan.nextInt();",
"N",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int data[]=new int[N];",
"data",
"new int[N]",
"N",
"int count=0;",
"count",
"0",
"for(int i=0;i<N;i++){\n\t\t\tdata[i]=scan.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"{\n\t\t\tdata[i]=scan.nextInt();\n\t\t}",
"{\n\t\t\tdata[i]=scan.nextInt();\n\t\t}",
"data[i]=scan.nextInt()",
"data[i]",
"data",
"i",
"scan.nextInt()",
"scan.nextInt",
"scan",
"for(int i=0;i<N;i++){\n\t\t\tfor(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"for(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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",
"i+1<=j",
"i+1",
"i",
"1",
"j",
"j--",
"j--",
"j",
"{\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}",
"if(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"data[j]<data[j-1]",
"data[j]",
"data",
"j",
"data[j-1]",
"data",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tswap(data,j);\n\t\t\t\t\tcount++;\n\t\t\t\t}",
"swap(data,j)",
"swap",
"data",
"j",
"count++",
"count",
"for(int i=0;i<N;i++){\n\t\t\tif(i==0) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[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(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}",
"{\n\t\t\tif(i==0) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}",
"if(i==0) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);",
"i==0",
"i",
"0",
"System.out.print(data[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"data[i]",
"data",
"i",
"System.out.print(\" \"+data[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"+data[i]",
"\" \"",
"data[i]",
"data",
"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",
"scan.close()",
"scan.close",
"scan",
"String[] args",
"args",
"public class Main {\n\tstatic void swap(int[] data,int x){\n\t\tint tmp=data[x];\n\t\tdata[x]=data[x-1];\n\t\tdata[x-1]=tmp;\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint N=scan.nextInt();\n\t\tint data[]=new int[N];\n\t\tint count=0;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tdata[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t\t\n\t}\n\t\n}",
"public class Main {\n\tstatic void swap(int[] data,int x){\n\t\tint tmp=data[x];\n\t\tdata[x]=data[x-1];\n\t\tdata[x-1]=tmp;\n\t}\n\tpublic static void main(String[] args){\n\t\tScanner scan=new Scanner(System.in);\n\t\tint N=scan.nextInt();\n\t\tint data[]=new int[N];\n\t\tint count=0;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tdata[i]=scan.nextInt();\n\t\t}\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=N-1;i+1<=j;j--){\n\t\t\t\tif(data[j]<data[j-1]){\n\t\t\t\t\tswap(data,j);\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) System.out.print(data[i]);\n\t\t\telse System.out.print(\" \"+data[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t\tscan.close();\n\t\t\n\t}\n\t\n}",
"Main"
] | import java.util.Scanner;
public class Main {
static void swap(int[] data,int x){
int tmp=data[x];
data[x]=data[x-1];
data[x-1]=tmp;
}
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int N=scan.nextInt();
int data[]=new int[N];
int count=0;
for(int i=0;i<N;i++){
data[i]=scan.nextInt();
}
for(int i=0;i<N;i++){
for(int j=N-1;i+1<=j;j--){
if(data[j]<data[j-1]){
swap(data,j);
count++;
}
}
}
for(int i=0;i<N;i++){
if(i==0) System.out.print(data[i]);
else System.out.print(" "+data[i]);
}
System.out.println();
System.out.println(count);
scan.close();
}
} |
[
7,
15,
13,
17,
6,
13,
41,
13,
20,
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,
18,
13,
13,
1,
40,
13,
30,
30,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
18,
13,
13,
17,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
23,
13,
12,
13,
30,
41,
13,
4,
18,
13,
4,
18,
13,
41,
13,
4,
18,
4,
18,
13,
17,
41,
13,
20,
13,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
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,
14,
2,
18,
13,
13,
18,
13,
2,
13,
17,
30,
4,
13,
13,
13,
2,
13,
17,
40,
13,
4,
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
],
[
14,
16
],
[
11,
17
],
[
17,
18
],
[
18,
19
],
[
18,
20
],
[
17,
21
],
[
21,
22
],
[
21,
23
],
[
11,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
24,
28
],
[
9,
29
],
[
29,
30
],
[
9,
31
],
[
31,
32
],
[
9,
33
],
[
33,
34
],
[
4,
35
],
[
35,
36
],
[
35,
37
],
[
37,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
38,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
38,
48
],
[
48,
49
],
[
49,
50
],
[
38,
51
],
[
52,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
55,
56
],
[
55,
57
],
[
53,
58
],
[
58,
59
],
[
58,
60
],
[
52,
61
],
[
61,
62
],
[
62,
63
],
[
62,
64
],
[
64,
65
],
[
65,
66
],
[
65,
67
],
[
64,
68
],
[
61,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
37,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
77,
79
],
[
35,
80
],
[
80,
81
],
[
4,
82
],
[
82,
83
],
[
82,
84
],
[
84,
85
],
[
85,
86
],
[
85,
87
],
[
87,
88
],
[
88,
89
],
[
87,
90
],
[
90,
91
],
[
91,
92
],
[
84,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
95,
100
],
[
84,
101
],
[
101,
102
],
[
101,
103
],
[
84,
105
],
[
105,
106
],
[
105,
107
],
[
84,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
108,
113
],
[
113,
114
],
[
113,
115
],
[
108,
116
],
[
116,
117
],
[
117,
118
],
[
108,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
120,
124
],
[
124,
125
],
[
125,
126
],
[
124,
127
],
[
127,
128
],
[
127,
129
],
[
84,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
130,
135
],
[
135,
136
],
[
135,
137
],
[
130,
138
],
[
138,
139
],
[
139,
140
],
[
130,
141
],
[
142,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
143,
150
],
[
150,
151
],
[
150,
152
],
[
143,
153
],
[
153,
154
],
[
154,
155
],
[
143,
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
],
[
168,
171
],
[
168,
172
],
[
172,
173
],
[
172,
174
],
[
167,
175
],
[
175,
176
],
[
84,
177
],
[
177,
178
],
[
177,
179
],
[
84,
180
],
[
180,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
180,
185
],
[
82,
186
],
[
186,
187
]
] | [
"import java.io.*;\n\nclass Main{\n private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n private static void swap(int[] A, int i, int j){\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }\n\n private static void printArray(int[] A){\n for(int i=0; i<A.length; i++){\n System.out.print(A[i]);\n if(i!=A.length-1)\n System.out.print(\" \");\n }\n System.out.println();\n }\n\n public static void main(String[] args) throws IOException{\n int N = Integer.parseInt(br.readLine());\n String[] iline = br.readLine().split(\" \");\n int[] A = new int[N];\n int count = 0;\n for(int i=0; i<N; i++)\n A[i] = Integer.parseInt(iline[i]);\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 swap(A, j, j-1);\n count++;\n }\n }\n printArray(A);\n System.out.println(count);\n }\n}",
"import java.io.*;",
"io.*",
"java",
"class Main{\n private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n private static void swap(int[] A, int i, int j){\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }\n\n private static void printArray(int[] A){\n for(int i=0; i<A.length; i++){\n System.out.print(A[i]);\n if(i!=A.length-1)\n System.out.print(\" \");\n }\n System.out.println();\n }\n\n public static void main(String[] args) throws IOException{\n int N = Integer.parseInt(br.readLine());\n String[] iline = br.readLine().split(\" \");\n int[] A = new int[N];\n int count = 0;\n for(int i=0; i<N; i++)\n A[i] = Integer.parseInt(iline[i]);\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 swap(A, j, j-1);\n count++;\n }\n }\n printArray(A);\n System.out.println(count);\n }\n}",
"Main",
"private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));",
"br",
"new BufferedReader(new InputStreamReader(System.in))",
"private static void swap(int[] A, int i, int j){\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }",
"swap",
"{\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }",
"int tmp = A[i];",
"tmp",
"A[i]",
"A",
"i",
"A[i] = A[j]",
"A[i]",
"A",
"i",
"A[j]",
"A",
"j",
"A[j] = tmp",
"A[j]",
"A",
"j",
"tmp",
"int[] A",
"A",
"int i",
"i",
"int j",
"j",
"private static void printArray(int[] A){\n for(int i=0; i<A.length; i++){\n System.out.print(A[i]);\n if(i!=A.length-1)\n System.out.print(\" \");\n }\n System.out.println();\n }",
"printArray",
"{\n for(int i=0; i<A.length; i++){\n System.out.print(A[i]);\n if(i!=A.length-1)\n System.out.print(\" \");\n }\n System.out.println();\n }",
"for(int i=0; i<A.length; i++){\n System.out.print(A[i]);\n if(i!=A.length-1)\n System.out.print(\" \");\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<A.length",
"i",
"A.length",
"A",
"A.length",
"i++",
"i++",
"i",
"{\n System.out.print(A[i]);\n if(i!=A.length-1)\n System.out.print(\" \");\n }",
"{\n System.out.print(A[i]);\n if(i!=A.length-1)\n System.out.print(\" \");\n }",
"System.out.print(A[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[i]",
"A",
"i",
"if(i!=A.length-1)\n System.out.print(\" \");",
"i!=A.length-1",
"i",
"A.length-1",
"A.length",
"A",
"A.length",
"1",
"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",
"public static void main(String[] args) throws IOException{\n int N = Integer.parseInt(br.readLine());\n String[] iline = br.readLine().split(\" \");\n int[] A = new int[N];\n int count = 0;\n for(int i=0; i<N; i++)\n A[i] = Integer.parseInt(iline[i]);\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 swap(A, j, j-1);\n count++;\n }\n }\n printArray(A);\n System.out.println(count);\n }",
"main",
"{\n int N = Integer.parseInt(br.readLine());\n String[] iline = br.readLine().split(\" \");\n int[] A = new int[N];\n int count = 0;\n for(int i=0; i<N; i++)\n A[i] = Integer.parseInt(iline[i]);\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 swap(A, j, j-1);\n count++;\n }\n }\n printArray(A);\n System.out.println(count);\n }",
"int N = Integer.parseInt(br.readLine());",
"N",
"Integer.parseInt(br.readLine())",
"Integer.parseInt",
"Integer",
"br.readLine()",
"br.readLine",
"br",
"String[] iline = br.readLine().split(\" \");",
"iline",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] A = new int[N];",
"A",
"new int[N]",
"N",
"int count = 0;",
"count",
"0",
"for(int i=0; i<N; i++)\n A[i] = Integer.parseInt(iline[i]);",
"int i=0;",
"int i=0;",
"i",
"0",
"i<N",
"i",
"N",
"i++",
"i++",
"i",
"A[i] = Integer.parseInt(iline[i]);",
"A[i] = Integer.parseInt(iline[i])",
"A[i]",
"A",
"i",
"Integer.parseInt(iline[i])",
"Integer.parseInt",
"Integer",
"iline[i]",
"iline",
"i",
"for(int i=0; i<N; i++){\n for(int j=N-1; j>i; j--)\n if(A[j]<A[j-1]){\n swap(A, j, j-1);\n count++;\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 swap(A, j, j-1);\n count++;\n }\n }",
"{\n for(int j=N-1; j>i; j--)\n if(A[j]<A[j-1]){\n swap(A, j, j-1);\n count++;\n }\n }",
"for(int j=N-1; j>i; j--)\n if(A[j]<A[j-1]){\n swap(A, j, j-1);\n count++;\n }",
"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 swap(A, j, j-1);\n count++;\n }",
"if(A[j]<A[j-1]){\n swap(A, j, j-1);\n count++;\n }",
"A[j]<A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n swap(A, j, j-1);\n count++;\n }",
"swap(A, j, j-1)",
"swap",
"A",
"j",
"j-1",
"j",
"1",
"count++",
"count",
"printArray(A)",
"printArray",
"A",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args"
] | import java.io.*;
class Main{
private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static void swap(int[] A, int i, int j){
int tmp = A[i];
A[i] = A[j];
A[j] = tmp;
}
private static void printArray(int[] A){
for(int i=0; i<A.length; i++){
System.out.print(A[i]);
if(i!=A.length-1)
System.out.print(" ");
}
System.out.println();
}
public static void main(String[] args) throws IOException{
int N = Integer.parseInt(br.readLine());
String[] iline = br.readLine().split(" ");
int[] A = new int[N];
int count = 0;
for(int i=0; i<N; i++)
A[i] = Integer.parseInt(iline[i]);
for(int i=0; i<N; i++){
for(int j=N-1; j>i; j--)
if(A[j]<A[j-1]){
swap(A, j, j-1);
count++;
}
}
printArray(A);
System.out.println(count);
}
} |
[
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,
4,
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,
13,
23,
13,
12,
13,
30,
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,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
166,
5
],
[
166,
6
],
[
6,
7
],
[
6,
8
],
[
166,
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
],
[
61,
63
],
[
63,
64
],
[
63,
65
],
[
60,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
67,
72
],
[
72,
73
],
[
72,
74
],
[
60,
75
],
[
75,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
76,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
81,
85
],
[
11,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
9,
92
],
[
92,
93
],
[
166,
94
],
[
94,
95
],
[
94,
96
],
[
96,
97
],
[
97,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
97,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
104,
106
],
[
97,
107
],
[
107,
108
],
[
108,
109
],
[
97,
110
],
[
111,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
114,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
116,
120
],
[
112,
121
],
[
121,
122
],
[
121,
123
],
[
112,
124
],
[
124,
125
],
[
125,
126
],
[
112,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
149,
150
],
[
149,
151
],
[
151,
152
],
[
151,
153
],
[
139,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
157,
158
],
[
157,
159
],
[
154,
160
],
[
139,
161
],
[
161,
162
],
[
94,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"import java.util.*;\n\npublic class Main {\n\tstatic int swap=0;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tif(i==N-1){\n\t\t\t\tSystem.out.println(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(swap);\n\t}\n\t\n\tstatic void BubbleSort(int[] a){\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tstatic int swap=0;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tif(i==N-1){\n\t\t\t\tSystem.out.println(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(swap);\n\t}\n\t\n\tstatic void BubbleSort(int[] a){\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"static int swap=0;",
"swap",
"0",
"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\t\tfor(int i=0;i<N;i++){\n\t\t\tif(i==N-1){\n\t\t\t\tSystem.out.println(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(swap);\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\t\tfor(int i=0;i<N;i++){\n\t\t\tif(i==N-1){\n\t\t\t\tSystem.out.println(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(swap);\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)",
"BubbleSort",
"A",
"for(int i=0;i<N;i++){\n\t\t\tif(i==N-1){\n\t\t\t\tSystem.out.println(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.println(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.println(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.println(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.println(A[i]);\n\t\t\t}",
"System.out.println(A[i])",
"System.out.println",
"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(swap)",
"System.out.println",
"System.out",
"System",
"System.out",
"swap",
"String[] args",
"args",
"static void BubbleSort(int[] a){\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"BubbleSort",
"{\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}",
"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 t=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\tswap++;\n\t\t\t\t}\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\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"{\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\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 t=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\tswap++;\n\t\t\t\t}\n\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",
"{\n\t\t\t\tif(a[j]<a[j-1]){\n\t\t\t\t\tint t=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\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\tint t=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\tswap++;\n\t\t\t\t}\n\t\t\t}",
"if(a[j]<a[j-1]){\n\t\t\t\t\tint t=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\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\tint t=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\tswap++;\n\t\t\t\t}",
"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",
"swap++",
"swap",
"int[] a",
"a",
"public class Main {\n\tstatic int swap=0;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tif(i==N-1){\n\t\t\t\tSystem.out.println(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(swap);\n\t}\n\t\n\tstatic void BubbleSort(int[] a){\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main {\n\tstatic int swap=0;\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\t\tfor(int i=0;i<N;i++){\n\t\t\tif(i==N-1){\n\t\t\t\tSystem.out.println(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(swap);\n\t}\n\t\n\tstatic void BubbleSort(int[] a){\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 t=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\tswap++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}",
"Main"
] | import java.util.*;
public class Main {
static int swap=0;
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);
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(swap);
}
static void BubbleSort(int[] a){
for(int i=0;i<a.length;i++){
for(int j=a.length-1;j>i;j--){
if(a[j]<a[j-1]){
int t=a[j];
a[j]=a[j-1];
a[j-1]=t;
swap++;
}
}
}
}
} |
[
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,
41,
13,
17,
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,
0,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
18,
13,
13,
14,
2,
13,
2,
13,
17,
4,
18,
18,
13,
13,
2,
18,
13,
13,
17,
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
],
[
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
],
[
8,
45
],
[
45,
46
],
[
45,
47
],
[
8,
48
],
[
48,
49
],
[
48,
50
],
[
8,
51
],
[
51,
52
],
[
52,
53
],
[
52,
54
],
[
51,
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
],
[
106,
108
],
[
84,
109
],
[
109,
110
],
[
109,
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
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
125,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
124,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
142,
143
],
[
142,
144
],
[
139,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
147,
149
],
[
145,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
8,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
155,
160
],
[
8,
161
],
[
161,
162
],
[
162,
163
],
[
163,
164
],
[
163,
165
],
[
161,
166
],
[
6,
167
],
[
167,
168
]
] | [
"import java.util.Scanner;\nclass Main{\n public static void main(String[]arge){\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 flag,hozon,count=0;\n flag=1;\n while(flag==1){\n flag = 0;\n for(int j=n-1; j>0; j--){\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n } \n \n }\n for(int k=0; k<n; k++){\n \n if(k==n-1)System.out.print(A[k]); \n if(k!=n-1)System.out.print(A[k]+\" \"); \n }\n System.out.println(\"\");\n System.out.println(count); \n }\n} ",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n public static void main(String[]arge){\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 flag,hozon,count=0;\n flag=1;\n while(flag==1){\n flag = 0;\n for(int j=n-1; j>0; j--){\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n } \n \n }\n for(int k=0; k<n; k++){\n \n if(k==n-1)System.out.print(A[k]); \n if(k!=n-1)System.out.print(A[k]+\" \"); \n }\n System.out.println(\"\");\n System.out.println(count); \n }\n}",
"Main",
"public static void main(String[]arge){\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 flag,hozon,count=0;\n flag=1;\n while(flag==1){\n flag = 0;\n for(int j=n-1; j>0; j--){\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n } \n \n }\n for(int k=0; k<n; k++){\n \n if(k==n-1)System.out.print(A[k]); \n if(k!=n-1)System.out.print(A[k]+\" \"); \n }\n System.out.println(\"\");\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 flag,hozon,count=0;\n flag=1;\n while(flag==1){\n flag = 0;\n for(int j=n-1; j>0; j--){\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n } \n \n }\n for(int k=0; k<n; k++){\n \n if(k==n-1)System.out.print(A[k]); \n if(k!=n-1)System.out.print(A[k]+\" \"); \n }\n System.out.println(\"\");\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 flag",
"flag",
"hozon",
"hozon",
"count=0;",
"count",
"0",
"flag=1",
"flag",
"1",
"while(flag==1){\n flag = 0;\n for(int j=n-1; j>0; j--){\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n } \n \n }",
"flag==1",
"flag",
"1",
"{\n flag = 0;\n for(int j=n-1; j>0; j--){\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n } \n \n }",
"flag = 0",
"flag",
"0",
"for(int j=n-1; j>0; j--){\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\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 hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n }",
"{\n if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }\n \n }",
"if(A[j]<A[j-1]){\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }",
"A[j]<A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n hozon=A[j];\n A[j]=A[j-1];\n A[j-1]=hozon;\n flag=1;\n count+=1;\n }",
"hozon=A[j]",
"hozon",
"A[j]",
"A",
"j",
"A[j]=A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"A[j-1]=hozon",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"hozon",
"flag=1",
"flag",
"1",
"count+=1",
"count",
"1",
"for(int k=0; k<n; k++){\n \n if(k==n-1)System.out.print(A[k]); \n if(k!=n-1)System.out.print(A[k]+\" \"); \n }",
"int k=0;",
"int k=0;",
"k",
"0",
"k<n",
"k",
"n",
"k++",
"k++",
"k",
"{\n \n if(k==n-1)System.out.print(A[k]); \n if(k!=n-1)System.out.print(A[k]+\" \"); \n }",
"{\n \n if(k==n-1)System.out.print(A[k]); \n if(k!=n-1)System.out.print(A[k]+\" \"); \n }",
"if(k==n-1)System.out.print(A[k]);",
"k==n-1",
"k",
"n-1",
"n",
"1",
"System.out.print(A[k])",
"System.out.print",
"System.out",
"System",
"System.out",
"A[k]",
"A",
"k",
"if(k!=n-1)System.out.print(A[k]+\" \");",
"k!=n-1",
"k",
"n-1",
"n",
"1",
"System.out.print(A[k]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"A[k]+\" \"",
"A[k]",
"A",
"k",
"\" \"",
"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[]arge",
"arge"
] | import java.util.Scanner;
class Main{
public static void main(String[]arge){
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 flag,hozon,count=0;
flag=1;
while(flag==1){
flag = 0;
for(int j=n-1; j>0; j--){
if(A[j]<A[j-1]){
hozon=A[j];
A[j]=A[j-1];
A[j-1]=hozon;
flag=1;
count+=1;
}
}
}
for(int k=0; k<n; k++){
if(k==n-1)System.out.print(A[k]);
if(k!=n-1)System.out.print(A[k]+" ");
}
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,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
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,
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,
0,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
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
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
8,
17
],
[
17,
18
],
[
17,
19
],
[
8,
21
],
[
21,
22
],
[
8,
23
],
[
23,
24
],
[
24,
25
],
[
25,
26
],
[
25,
27
],
[
23,
28
],
[
28,
29
],
[
28,
30
],
[
23,
31
],
[
31,
32
],
[
32,
33
],
[
23,
34
],
[
35,
35
],
[
35,
36
],
[
36,
37
],
[
37,
38
],
[
37,
39
],
[
36,
40
],
[
40,
41
],
[
41,
42
],
[
8,
43
],
[
43,
44
],
[
43,
45
],
[
45,
46
],
[
45,
47
],
[
45,
48
],
[
8,
49
],
[
49,
50
],
[
50,
51
],
[
51,
52
],
[
51,
53
],
[
49,
54
],
[
54,
55
],
[
54,
56
],
[
49,
57
],
[
57,
58
],
[
58,
59
],
[
49,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
62,
68
],
[
68,
69
],
[
69,
70
],
[
70,
71
],
[
71,
72
],
[
71,
73
],
[
69,
74
],
[
74,
75
],
[
75,
76
],
[
75,
77
],
[
74,
78
],
[
62,
79
],
[
79,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
80,
85
],
[
85,
86
],
[
85,
87
],
[
8,
88
],
[
88,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
88,
93
],
[
6,
94
],
[
94,
95
],
[
4,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
98,
101
],
[
101,
102
],
[
101,
103
],
[
98,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
104,
114
],
[
114,
115
],
[
115,
116
],
[
104,
117
],
[
118,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
123,
124
],
[
123,
125
],
[
119,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
119,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
135,
141
],
[
141,
142
],
[
141,
143
],
[
134,
144
],
[
144,
145
],
[
145,
146
],
[
145,
147
],
[
147,
148
],
[
147,
149
],
[
144,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
150,
154
],
[
154,
155
],
[
154,
156
],
[
156,
157
],
[
156,
158
],
[
144,
159
],
[
159,
160
],
[
160,
161
],
[
160,
162
],
[
162,
163
],
[
162,
164
],
[
159,
165
],
[
144,
166
],
[
166,
167
],
[
98,
168
],
[
168,
169
],
[
96,
170
],
[
170,
171
],
[
96,
172
],
[
172,
173
]
] | [
"import java.util.Scanner;\nclass Main {\n public static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint input = scan.nextInt();\n\t\tint[] num = new int[input];\n\t\tint count;\n\t\t\n\t\tfor(int c = 0; c < input; c++){\n\t\t\tnum[c] = scan.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(num, input);\n\t\t\n\t\tfor(int i = 0; i < input; i++){\n\t\t\tif(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tstatic int bubbleSort(int data[], int n){\n\t\tint temp;\n\t\tint c = 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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn c;\n\t}\n \n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main {\n public static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint input = scan.nextInt();\n\t\tint[] num = new int[input];\n\t\tint count;\n\t\t\n\t\tfor(int c = 0; c < input; c++){\n\t\t\tnum[c] = scan.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(num, input);\n\t\t\n\t\tfor(int i = 0; i < input; i++){\n\t\t\tif(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n\t\n\tstatic int bubbleSort(int data[], int n){\n\t\tint temp;\n\t\tint c = 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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn c;\n\t}\n \n}",
"Main",
"public static void main(String[] args){\n\t\tScanner scan = new Scanner(System.in);\n\t\tint input = scan.nextInt();\n\t\tint[] num = new int[input];\n\t\tint count;\n\t\t\n\t\tfor(int c = 0; c < input; c++){\n\t\t\tnum[c] = scan.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(num, input);\n\t\t\n\t\tfor(int i = 0; i < input; i++){\n\t\t\tif(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\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 input = scan.nextInt();\n\t\tint[] num = new int[input];\n\t\tint count;\n\t\t\n\t\tfor(int c = 0; c < input; c++){\n\t\t\tnum[c] = scan.nextInt();\n\t\t}\n\t\t\n\t\tcount = bubbleSort(num, input);\n\t\t\n\t\tfor(int i = 0; i < input; i++){\n\t\t\tif(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\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 input = scan.nextInt();",
"input",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int[] num = new int[input];",
"num",
"new int[input]",
"input",
"int count;",
"count",
"for(int c = 0; c < input; c++){\n\t\t\tnum[c] = scan.nextInt();\n\t\t}",
"int c = 0;",
"int c = 0;",
"c",
"0",
"c < input",
"c",
"input",
"c++",
"c++",
"c",
"{\n\t\t\tnum[c] = scan.nextInt();\n\t\t}",
"{\n\t\t\tnum[c] = scan.nextInt();\n\t\t}",
"num[c] = scan.nextInt()",
"num[c]",
"num",
"c",
"scan.nextInt()",
"scan.nextInt",
"scan",
"count = bubbleSort(num, input)",
"count",
"bubbleSort(num, input)",
"bubbleSort",
"num",
"input",
"for(int i = 0; i < input; i++){\n\t\t\tif(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < input",
"i",
"input",
"i++",
"i++",
"i",
"{\n\t\t\tif(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\t\t}\n\t\t}",
"{\n\t\t\tif(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\t\t}\n\t\t}",
"if(i != input - 1){\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}else{\n\t\t\t\tSystem.out.println(num[i]);\n\t\t\t}",
"i != input - 1",
"i",
"input - 1",
"input",
"1",
"{\n\t\t\t\tSystem.out.print(num[i] + \" \");\n\t\t\t}",
"System.out.print(num[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"num[i] + \" \"",
"num[i]",
"num",
"i",
"\" \"",
"{\n\t\t\t\tSystem.out.println(num[i]);\n\t\t\t}",
"System.out.println(num[i])",
"System.out.println",
"System.out",
"System",
"System.out",
"num[i]",
"num",
"i",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"static int bubbleSort(int data[], int n){\n\t\tint temp;\n\t\tint c = 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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn c;\n\t}",
"bubbleSort",
"{\n\t\tint temp;\n\t\tint c = 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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn c;\n\t}",
"int temp;",
"temp",
"int c = 0;",
"c",
"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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\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(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}",
"{\n\t\t\t\tif(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}\n\t\t\t}",
"if(data[j - 1] > data[j]){\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}",
"data[j - 1] > data[j]",
"data[j - 1]",
"data",
"j - 1",
"j",
"1",
"data[j]",
"data",
"j",
"{\n\t\t\t\t\ttemp = data[j];\n\t\t\t\t\tdata[j] = data[j - 1];\n\t\t\t\t\tdata[j - 1] = temp;\n\t\t\t\t\tc++;\n\t\t\t\t}",
"temp = data[j]",
"temp",
"data[j]",
"data",
"j",
"data[j] = data[j - 1]",
"data[j]",
"data",
"j",
"data[j - 1]",
"data",
"j - 1",
"j",
"1",
"data[j - 1] = temp",
"data[j - 1]",
"data",
"j - 1",
"j",
"1",
"temp",
"c++",
"c",
"return c;",
"c",
"int data[]",
"data",
"int n",
"n"
] | import java.util.Scanner;
class Main {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int input = scan.nextInt();
int[] num = new int[input];
int count;
for(int c = 0; c < input; c++){
num[c] = scan.nextInt();
}
count = bubbleSort(num, input);
for(int i = 0; i < input; i++){
if(i != input - 1){
System.out.print(num[i] + " ");
}else{
System.out.println(num[i]);
}
}
System.out.println(count);
}
static int bubbleSort(int data[], int n){
int temp;
int c = 0;
for(int i = 0; i < n - 1; i++){
for(int j = n - 1; j > i; j--){
if(data[j - 1] > data[j]){
temp = data[j];
data[j] = data[j - 1];
data[j - 1] = temp;
c++;
}
}
}
return c;
}
} |
[
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,
17,
30,
14,
2,
13,
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,
17,
4,
18,
18,
13,
13,
13,
3,
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,
2,
13,
17,
0,
18,
13,
2,
13,
17,
18,
13,
13,
0,
18,
13,
13,
13,
40,
13,
40,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
153,
5
],
[
153,
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
],
[
51,
52
],
[
51,
53
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
57,
58
],
[
57,
59
],
[
55,
60
],
[
60,
61
],
[
60,
62
],
[
54,
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
],
[
76,
81
],
[
81,
82
],
[
81,
83
],
[
83,
84
],
[
83,
85
],
[
54,
86
],
[
86,
87
],
[
87,
88
],
[
88,
89
],
[
88,
90
],
[
86,
91
],
[
54,
92
],
[
92,
93
],
[
93,
94
],
[
94,
95
],
[
94,
96
],
[
92,
97
],
[
54,
98
],
[
49,
99
],
[
99,
100
],
[
100,
101
],
[
101,
102
],
[
101,
103
],
[
103,
104
],
[
103,
105
],
[
99,
106
],
[
106,
107
],
[
106,
108
],
[
99,
109
],
[
109,
110
],
[
110,
111
],
[
99,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
118,
119
],
[
118,
120
],
[
115,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
127,
128
],
[
127,
129
],
[
129,
130
],
[
129,
131
],
[
124,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
135,
136
],
[
135,
137
],
[
132,
138
],
[
138,
139
],
[
138,
140
],
[
124,
141
],
[
141,
142
],
[
142,
143
],
[
142,
144
],
[
141,
145
],
[
124,
146
],
[
146,
147
],
[
49,
148
],
[
148,
149
],
[
6,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n\tpublic static void main(String[] args){\n\t\t//データ読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\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 s = 1;\n\t\tint counter = 0;\n\t\t\n\t\twhile (true){\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\t}\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main{\n\tpublic static void main(String[] args){\n\t\t//データ読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\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 s = 1;\n\t\tint counter = 0;\n\t\t\n\t\twhile (true){\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args){\n\t\t//データ読み込み\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\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 s = 1;\n\t\tint counter = 0;\n\t\t\n\t\twhile (true){\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\t}\n\t}",
"main",
"{\n\t\t//データ読み込み\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\t\n\t\tint s = 1;\n\t\tint counter = 0;\n\t\t\n\t\twhile (true){\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\t}\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 s = 1;",
"s",
"1",
"int counter = 0;",
"counter",
"0",
"while (true){\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\t}",
"true",
"{\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\t}",
"if (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}",
"s == n",
"s",
"n",
"{\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\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\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}",
"{\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}",
"System.out.print(\" \" + a[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \" + a[i]",
"\" \"",
"a[i]",
"a",
"i",
"System.out.print(\"\\n\")",
"System.out.print",
"System.out",
"System",
"System.out",
"\"\\n\"",
"System.out.println(counter)",
"System.out.println",
"System.out",
"System",
"System.out",
"counter",
"break;",
"for(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}",
"int i = n - 1;",
"int i = n - 1;",
"i",
"n - 1",
"n",
"1",
"i >= s",
"i",
"s",
"i--",
"i--",
"i",
"{\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}",
"{\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}",
"if(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}",
"a[i - 1] > a[i]",
"a[i - 1]",
"a",
"i - 1",
"i",
"1",
"a[i]",
"a",
"i",
"{\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}",
"int temp = a[i - 1];",
"temp",
"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] = temp",
"a[i]",
"a",
"i",
"temp",
"counter++",
"counter",
"s++",
"s",
"String[] args",
"args",
"public class Main{\n\tpublic static void main(String[] args){\n\t\t//データ読み込み\n\t\tScanner sc = new Scanner(System.in);\n\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\t\n\t\tint s = 1;\n\t\tint counter = 0;\n\t\t\n\t\twhile (true){\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\t}\n\t}\n}",
"public class Main{\n\tpublic static void main(String[] args){\n\t\t//データ読み込み\n\t\tScanner sc = new Scanner(System.in);\n\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\t\n\t\tint s = 1;\n\t\tint counter = 0;\n\t\t\n\t\twhile (true){\n\t\t\tif (s == n){\n\t\t\t\tSystem.out.print(a[0]);\n\t\t\t\t\n\t\t\t\tfor(int i = 1; i < n; i++){\n\t\t\t\t\tSystem.out.print(\" \" + a[i]);\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\tSystem.out.println(counter);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tfor(int i = n - 1; i >= s; i--){\n\t\t\t\t//左の要素の方が大きかった時には、swap\n\t\t\t\tif(a[i - 1] > a[i]){\n\t\t\t\t\tint temp = a[i - 1];\n\t\t\t\t\ta[i - 1] = a[i];\n\t\t\t\t\ta[i] = temp;\n\t\t\t\t\tcounter++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\ts++;\n\t\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();
}
int s = 1;
int counter = 0;
while (true){
if (s == n){
System.out.print(a[0]);
for(int i = 1; i < n; i++){
System.out.print(" " + a[i]);
}
System.out.print("\n");
System.out.println(counter);
break;
}
for(int i = n - 1; i >= s; i--){
//左の要素の方が大きかった時には、swap
if(a[i - 1] > a[i]){
int temp = a[i - 1];
a[i - 1] = a[i];
a[i] = temp;
counter++;
}
}
s++;
}
}
}
|
[
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,
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,
4,
18,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
152,
5
],
[
152,
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
],
[
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
],
[
8,
146
],
[
146,
147
],
[
147,
148
],
[
6,
149
],
[
149,
150
],
[
0,
151
],
[
151,
152
],
[
151,
153
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String [] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint [] a = new int [N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tint konkansize = 0;\n\t\t//??????????????????\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\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\tSystem.out.println(konkansize);\n\t\tsc.close();\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String [] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint [] a = new int [N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tint konkansize = 0;\n\t\t//??????????????????\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\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\tSystem.out.println(konkansize);\n\t\tsc.close();\n\t}\n}",
"Main",
"public static void main(String [] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint [] a = new int [N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tint konkansize = 0;\n\t\t//??????????????????\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\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\tSystem.out.println(konkansize);\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\tint konkansize = 0;\n\t\t//??????????????????\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\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\tSystem.out.println(konkansize);\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",
"int konkansize = 0;",
"konkansize",
"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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\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\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\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\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\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\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}",
"int ste = a[j];",
"ste",
"a[j]",
"a",
"j",
"a[j] = a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"a[j-1] = ste",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"ste",
"konkansize++",
"konkansize",
"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(konkansize)",
"System.out.println",
"System.out",
"System",
"System.out",
"konkansize",
"sc.close()",
"sc.close",
"sc",
"String [] args",
"args",
"public class Main {\n\tpublic static void main(String [] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint [] a = new int [N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tint konkansize = 0;\n\t\t//??????????????????\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\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\tSystem.out.println(konkansize);\n\t\tsc.close();\n\t}\n}",
"public class Main {\n\tpublic static void main(String [] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint [] a = new int [N];\n\t\tfor(int i=0; i<N; i++){\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\t\tint konkansize = 0;\n\t\t//??????????????????\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(a[j] < a[j-1]){\n\t\t\t\t\tint ste = a[j];\n\t\t\t\t\ta[j] = a[j-1];\n\t\t\t\t\ta[j-1] = ste; \n\t\t\t\t\tkonkansize++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\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\tSystem.out.println(konkansize);\n\t\tsc.close();\n\t}\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int [] a = new int [N];
for(int i=0; i<N; i++){
a[i] = sc.nextInt();
}
int konkansize = 0;
//??????????????????
boolean flag = true;
while(flag){
flag = false;
for(int j=N-1; j>0; j--){
if(a[j] < a[j-1]){
int ste = a[j];
a[j] = a[j-1];
a[j-1] = ste;
konkansize++;
flag = true;
}
}
}
for(int i=0; i<N-1; i++){
System.out.print(a[i] + " ");
}
System.out.println(a[N-1]);
System.out.println(konkansize);
sc.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
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,
13,
23,
13,
12,
13,
30,
41,
13,
17,
11,
1,
41,
13,
2,
18,
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,
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,
29,
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,
4,
18,
18,
13,
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
],
[
187,
8
],
[
187,
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
],
[
11,
49
],
[
49,
50
],
[
49,
51
],
[
49,
52
],
[
9,
53
],
[
53,
54
],
[
187,
55
],
[
55,
56
],
[
55,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
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
],
[
78,
83
],
[
83,
84
],
[
83,
85
],
[
78,
86
],
[
86,
87
],
[
87,
88
],
[
78,
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
],
[
57,
125
],
[
125,
126
],
[
55,
127
],
[
127,
128
],
[
187,
129
],
[
129,
130
],
[
129,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
132,
137
],
[
137,
138
],
[
137,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
139,
143
],
[
132,
144
],
[
144,
145
],
[
145,
146
],
[
132,
147
],
[
148,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
149,
154
],
[
154,
155
],
[
155,
156
],
[
155,
157
],
[
154,
158
],
[
131,
159
],
[
159,
160
],
[
160,
161
],
[
161,
162
],
[
161,
163
],
[
159,
164
],
[
164,
165
],
[
164,
166
],
[
166,
167
],
[
167,
168
],
[
167,
169
],
[
166,
170
],
[
131,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
131,
176
],
[
176,
177
],
[
177,
178
],
[
178,
179
],
[
178,
180
],
[
176,
181
],
[
129,
182
],
[
182,
183
],
[
129,
184
],
[
184,
185
],
[
0,
186
],
[
186,
187
],
[
186,
188
]
] | [
"import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //整数の数\n int[] x = new int[n];\n for (int i=0; i<n; i++) { //整数を読み込む\n x[i] = sc.nextInt();\n }\n int count = bubbleSort(x);\n out(x,count);\n }\n /**\n * バブルソート\n */\n public static int bubbleSort(int[] x) {\n int count = 0;\n for(int i=x.length-1; i>0; i--) {\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }\n return count;\n }\n /**\n * 出力\n */\n public static void out(int[] x, int count) {\n for (int i=0; i<x.length-1; i++) {\n System.out.print(x[i]+\" \");\n }\n System.out.print(x[x.length-1]);\n System.out.println();\n System.out.println(count);\n }\n}\n",
"import java.util.Arrays;",
"Arrays",
"java.util",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //整数の数\n int[] x = new int[n];\n for (int i=0; i<n; i++) { //整数を読み込む\n x[i] = sc.nextInt();\n }\n int count = bubbleSort(x);\n out(x,count);\n }\n /**\n * バブルソート\n */\n public static int bubbleSort(int[] x) {\n int count = 0;\n for(int i=x.length-1; i>0; i--) {\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }\n return count;\n }\n /**\n * 出力\n */\n public static void out(int[] x, int count) {\n for (int i=0; i<x.length-1; i++) {\n System.out.print(x[i]+\" \");\n }\n System.out.print(x[x.length-1]);\n System.out.println();\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[] x = new int[n];\n for (int i=0; i<n; i++) { //整数を読み込む\n x[i] = sc.nextInt();\n }\n int count = bubbleSort(x);\n out(x,count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //整数の数\n int[] x = new int[n];\n for (int i=0; i<n; i++) { //整数を読み込む\n x[i] = sc.nextInt();\n }\n int count = bubbleSort(x);\n out(x,count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] x = new int[n];",
"x",
"new int[n]",
"n",
"for (int i=0; i<n; i++) { //整数を読み込む\n x[i] = sc.nextInt();\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{ //整数を読み込む\n x[i] = sc.nextInt();\n }",
"{ //整数を読み込む\n x[i] = sc.nextInt();\n }",
"x[i] = sc.nextInt()",
"x[i]",
"x",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = bubbleSort(x);",
"count",
"bubbleSort(x)",
"bubbleSort",
"x",
"out(x,count)",
"out",
"x",
"count",
"String[] args",
"args",
"/**\n * バブルソート\n */\n public static int bubbleSort(int[] x) {\n int count = 0;\n for(int i=x.length-1; i>0; i--) {\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }\n return count;\n }",
"bubbleSort",
"{\n int count = 0;\n for(int i=x.length-1; i>0; i--) {\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }\n return count;\n }",
"int count = 0;",
"count",
"0",
"for(int i=x.length-1; i>0; i--) {\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }",
"int i=x.length-1;",
"int i=x.length-1;",
"i",
"x.length-1",
"x.length",
"x",
"x.length",
"1",
"i>0",
"i",
"0",
"i--",
"i--",
"i",
"{\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }",
"{\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }",
"for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }",
"int j=0;",
"int j=0;",
"j",
"0",
"j<i",
"j",
"i",
"j++",
"j++",
"j",
"{\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }",
"{\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }",
"if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }",
"x[j]>x[j+1]",
"x[j]",
"x",
"j",
"x[j+1]",
"x",
"j+1",
"j",
"1",
"{\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }",
"int a = x[j];",
"a",
"x[j]",
"x",
"j",
"x[j] = x[j+1]",
"x[j]",
"x",
"j",
"x[j+1]",
"x",
"j+1",
"j",
"1",
"x[j+1] = a",
"x[j+1]",
"x",
"j+1",
"j",
"1",
"a",
"count++",
"count",
"return count;",
"count",
"int[] x",
"x",
"/**\n * 出力\n */\n public static void out(int[] x, int count) {\n for (int i=0; i<x.length-1; i++) {\n System.out.print(x[i]+\" \");\n }\n System.out.print(x[x.length-1]);\n System.out.println();\n System.out.println(count);\n }",
"out",
"{\n for (int i=0; i<x.length-1; i++) {\n System.out.print(x[i]+\" \");\n }\n System.out.print(x[x.length-1]);\n System.out.println();\n System.out.println(count);\n }",
"for (int i=0; i<x.length-1; i++) {\n System.out.print(x[i]+\" \");\n }",
"int i=0;",
"int i=0;",
"i",
"0",
"i<x.length-1",
"i",
"x.length-1",
"x.length",
"x",
"x.length",
"1",
"i++",
"i++",
"i",
"{\n System.out.print(x[i]+\" \");\n }",
"{\n System.out.print(x[i]+\" \");\n }",
"System.out.print(x[i]+\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"x[i]+\" \"",
"x[i]",
"x",
"i",
"\" \"",
"System.out.print(x[x.length-1])",
"System.out.print",
"System.out",
"System",
"System.out",
"x[x.length-1]",
"x",
"x.length-1",
"x.length",
"x",
"x.length",
"1",
"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[] x",
"x",
"int count",
"count",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt(); //整数の数\n int[] x = new int[n];\n for (int i=0; i<n; i++) { //整数を読み込む\n x[i] = sc.nextInt();\n }\n int count = bubbleSort(x);\n out(x,count);\n }\n /**\n * バブルソート\n */\n public static int bubbleSort(int[] x) {\n int count = 0;\n for(int i=x.length-1; i>0; i--) {\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }\n return count;\n }\n /**\n * 出力\n */\n public static void out(int[] x, int count) {\n for (int i=0; i<x.length-1; i++) {\n System.out.print(x[i]+\" \");\n }\n System.out.print(x[x.length-1]);\n System.out.println();\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[] x = new int[n];\n for (int i=0; i<n; i++) { //整数を読み込む\n x[i] = sc.nextInt();\n }\n int count = bubbleSort(x);\n out(x,count);\n }\n /**\n * バブルソート\n */\n public static int bubbleSort(int[] x) {\n int count = 0;\n for(int i=x.length-1; i>0; i--) {\n for (int j=0; j<i; j++) {\n if(x[j]>x[j+1]){\n int a = x[j];\n x[j] = x[j+1];\n x[j+1] = a;\n count++;\n }\n }\n }\n return count;\n }\n /**\n * 出力\n */\n public static void out(int[] x, int count) {\n for (int i=0; i<x.length-1; i++) {\n System.out.print(x[i]+\" \");\n }\n System.out.print(x[x.length-1]);\n System.out.println();\n System.out.println(count);\n }\n}",
"Main"
] | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(); //整数の数
int[] x = new int[n];
for (int i=0; i<n; i++) { //整数を読み込む
x[i] = sc.nextInt();
}
int count = bubbleSort(x);
out(x,count);
}
/**
* バブルソート
*/
public static int bubbleSort(int[] x) {
int count = 0;
for(int i=x.length-1; i>0; i--) {
for (int j=0; j<i; j++) {
if(x[j]>x[j+1]){
int a = x[j];
x[j] = x[j+1];
x[j+1] = a;
count++;
}
}
}
return count;
}
/**
* 出力
*/
public static void out(int[] x, int count) {
for (int i=0; i<x.length-1; i++) {
System.out.print(x[i]+" ");
}
System.out.print(x[x.length-1]);
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,
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,
41,
13,
17,
41,
13,
17,
42,
2,
13,
17,
30,
0,
13,
17,
11,
1,
41,
13,
2,
13,
17,
2,
17,
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,
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,
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
],
[
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
],
[
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
],
[
14,
63
],
[
63,
64
],
[
63,
65
],
[
14,
66
],
[
66,
67
],
[
66,
68
],
[
14,
69
],
[
69,
70
],
[
70,
71
],
[
70,
72
],
[
69,
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
],
[
102,
126
],
[
126,
127
],
[
126,
128
],
[
14,
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
],
[
141,
150
],
[
150,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
150,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
150,
163
],
[
163,
164
],
[
164,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
14,
169
],
[
169,
170
],
[
170,
171
],
[
171,
172
],
[
171,
173
],
[
169,
174
],
[
12,
175
],
[
175,
176
]
] | [
"import java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStreamReader;\n\nclass Main{\n public static void main(String args[]) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt( br.readLine() );\n String[] string= br.readLine().split(\" \");\n int [] Progression = new int[n];\n\n\n for(int i = 0; i < n ; i++){\n Progression[i] = Integer.parseInt(string[i] );\n }\n\n int tmp;\n int flag = 1;\n int count = 0;\n\n while(flag == 1){\n\n \tflag = 0;\n\t for(int j = n - 1; 0 < j; j--){\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }\n\n }\n\n for(int k = 0;k < n; k++){\n\n\t System.out.print( Progression[k] );\n\t if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }\n\n }\n\n System.out.println(count);\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",
"class Main{\n public static void main(String args[]) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt( br.readLine() );\n String[] string= br.readLine().split(\" \");\n int [] Progression = new int[n];\n\n\n for(int i = 0; i < n ; i++){\n Progression[i] = Integer.parseInt(string[i] );\n }\n\n int tmp;\n int flag = 1;\n int count = 0;\n\n while(flag == 1){\n\n \tflag = 0;\n\t for(int j = n - 1; 0 < j; j--){\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }\n\n }\n\n for(int k = 0;k < n; k++){\n\n\t System.out.print( Progression[k] );\n\t if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }\n\n }\n\n System.out.println(count);\n\n\n }\n}",
"Main",
"public static void main(String args[]) throws IOException{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt( br.readLine() );\n String[] string= br.readLine().split(\" \");\n int [] Progression = new int[n];\n\n\n for(int i = 0; i < n ; i++){\n Progression[i] = Integer.parseInt(string[i] );\n }\n\n int tmp;\n int flag = 1;\n int count = 0;\n\n while(flag == 1){\n\n \tflag = 0;\n\t for(int j = n - 1; 0 < j; j--){\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }\n\n }\n\n for(int k = 0;k < n; k++){\n\n\t System.out.print( Progression[k] );\n\t if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }\n\n }\n\n System.out.println(count);\n\n\n }",
"main",
"{\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n int n = Integer.parseInt( br.readLine() );\n String[] string= br.readLine().split(\" \");\n int [] Progression = new int[n];\n\n\n for(int i = 0; i < n ; i++){\n Progression[i] = Integer.parseInt(string[i] );\n }\n\n int tmp;\n int flag = 1;\n int count = 0;\n\n while(flag == 1){\n\n \tflag = 0;\n\t for(int j = n - 1; 0 < j; j--){\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }\n\n }\n\n for(int k = 0;k < n; k++){\n\n\t System.out.print( Progression[k] );\n\t if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }\n\n }\n\n System.out.println(count);\n\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[] string= br.readLine().split(\" \");",
"string",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int [] Progression = new int[n];",
"Progression",
"new int[n]",
"n",
"for(int i = 0; i < n ; i++){\n Progression[i] = Integer.parseInt(string[i] );\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n Progression[i] = Integer.parseInt(string[i] );\n }",
"{\n Progression[i] = Integer.parseInt(string[i] );\n }",
"Progression[i] = Integer.parseInt(string[i] )",
"Progression[i]",
"Progression",
"i",
"Integer.parseInt(string[i] )",
"Integer.parseInt",
"Integer",
"string[i]",
"string",
"i",
"int tmp;",
"tmp",
"int flag = 1;",
"flag",
"1",
"int count = 0;",
"count",
"0",
"while(flag == 1){\n\n \tflag = 0;\n\t for(int j = n - 1; 0 < j; j--){\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }\n\n }",
"flag == 1",
"flag",
"1",
"{\n\n \tflag = 0;\n\t for(int j = n - 1; 0 < j; j--){\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }\n\n }",
"flag = 0",
"flag",
"0",
"for(int j = n - 1; 0 < j; j--){\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }",
"int j = n - 1;",
"int j = n - 1;",
"j",
"n - 1",
"n",
"1",
"0 < j",
"0",
"j",
"j--",
"j--",
"j",
"{\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }",
"{\n\n\t\t if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }\n\t }",
"if( Progression[j] < Progression[j - 1] ){\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }",
"Progression[j] < Progression[j - 1]",
"Progression[j]",
"Progression",
"j",
"Progression[j - 1]",
"Progression",
"j - 1",
"j",
"1",
"{\n\t\t\t tmp = Progression[j];\n\t\t\t Progression[j] = Progression[j-1];\n\t\t\t Progression[j-1] = tmp;\n\t\t\t count++;\n\t\t\t flag = 1;\n\t\t }",
"tmp = Progression[j]",
"tmp",
"Progression[j]",
"Progression",
"j",
"Progression[j] = Progression[j-1]",
"Progression[j]",
"Progression",
"j",
"Progression[j-1]",
"Progression",
"j-1",
"j",
"1",
"Progression[j-1] = tmp",
"Progression[j-1]",
"Progression",
"j-1",
"j",
"1",
"tmp",
"count++",
"count",
"flag = 1",
"flag",
"1",
"for(int k = 0;k < n; k++){\n\n\t System.out.print( Progression[k] );\n\t if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }\n\n }",
"int k = 0;",
"int k = 0;",
"k",
"0",
"k < n",
"k",
"n",
"k++",
"k++",
"k",
"{\n\n\t System.out.print( Progression[k] );\n\t if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }\n\n }",
"{\n\n\t System.out.print( Progression[k] );\n\t if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }\n\n }",
"System.out.print( Progression[k] )",
"System.out.print",
"System.out",
"System",
"System.out",
"Progression[k]",
"Progression",
"k",
"if(k < n-1){\n\t\t System.out.print(\" \");\n\t }else{\n\t\t System.out.println();\n\t }",
"k < n-1",
"k",
"n-1",
"n",
"1",
"{\n\t\t System.out.print(\" \");\n\t }",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"{\n\t\t System.out.println();\n\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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt( br.readLine() );
String[] string= br.readLine().split(" ");
int [] Progression = new int[n];
for(int i = 0; i < n ; i++){
Progression[i] = Integer.parseInt(string[i] );
}
int tmp;
int flag = 1;
int count = 0;
while(flag == 1){
flag = 0;
for(int j = n - 1; 0 < j; j--){
if( Progression[j] < Progression[j - 1] ){
tmp = Progression[j];
Progression[j] = Progression[j-1];
Progression[j-1] = tmp;
count++;
flag = 1;
}
}
}
for(int k = 0;k < n; k++){
System.out.print( Progression[k] );
if(k < n-1){
System.out.print(" ");
}else{
System.out.println();
}
}
System.out.println(count);
}
} |
[
7,
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,
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,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
40,
13,
0,
13,
17,
40,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
4,
18,
13,
2,
8,
2,
13,
17,
17,
17,
18,
13,
13,
4,
18,
13,
4,
18,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
153,
8
],
[
153,
9
],
[
9,
10
],
[
9,
11
],
[
153,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
14,
20
],
[
20,
21
],
[
20,
22
],
[
14,
24
],
[
24,
25
],
[
25,
26
],
[
26,
27
],
[
26,
28
],
[
24,
29
],
[
29,
30
],
[
29,
31
],
[
24,
32
],
[
32,
33
],
[
33,
34
],
[
24,
35
],
[
36,
36
],
[
36,
37
],
[
37,
38
],
[
38,
39
],
[
38,
40
],
[
37,
41
],
[
41,
42
],
[
42,
43
],
[
14,
44
],
[
44,
45
],
[
44,
46
],
[
14,
47
],
[
47,
48
],
[
47,
49
],
[
14,
50
],
[
50,
51
],
[
50,
52
],
[
14,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
53,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
61,
68
],
[
68,
69
],
[
68,
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
],
[
88,
112
],
[
112,
113
],
[
112,
114
],
[
57,
115
],
[
115,
116
],
[
14,
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
],
[
130,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
134,
139
],
[
133,
140
],
[
140,
141
],
[
140,
142
],
[
14,
143
],
[
143,
144
],
[
144,
145
],
[
14,
146
],
[
146,
147
],
[
147,
148
],
[
146,
149
],
[
12,
150
],
[
150,
151
],
[
0,
152
],
[
152,
153
],
[
152,
154
]
] | [
"import java.util.*;\nimport static java.lang.System.*;\n\npublic class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tar[i] = sc.nextInt();\n\t\t}\n\t\tboolean F = true;\n\t\tint j = 0;\n\t\tint times = 0;\n\t\twhile (F==true) {\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tfor (int x=0; x<n; x++) {\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}\n\t\tout.println();\n\t\tout.println(times);\n\t}\n}\n",
"import java.util.*;",
"util.*",
"java",
"import static java.lang.System.*;",
"import static java.lang.System.*;",
"import static java.lang.System.*;",
"public class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tar[i] = sc.nextInt();\n\t\t}\n\t\tboolean F = true;\n\t\tint j = 0;\n\t\tint times = 0;\n\t\twhile (F==true) {\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tfor (int x=0; x<n; x++) {\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}\n\t\tout.println();\n\t\tout.println(times);\n\t}\n}",
"Main",
"static Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"public static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tar[i] = sc.nextInt();\n\t\t}\n\t\tboolean F = true;\n\t\tint j = 0;\n\t\tint times = 0;\n\t\twhile (F==true) {\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tfor (int x=0; x<n; x++) {\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}\n\t\tout.println();\n\t\tout.println(times);\n\t}",
"main",
"{\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tar[i] = sc.nextInt();\n\t\t}\n\t\tboolean F = true;\n\t\tint j = 0;\n\t\tint times = 0;\n\t\twhile (F==true) {\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tfor (int x=0; x<n; x++) {\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}\n\t\tout.println();\n\t\tout.println(times);\n\t}",
"int n = sc.nextInt();",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] ar = new int[n];",
"ar",
"new int[n]",
"n",
"for (int i=0; i<n; i++) {\n\t\t\tar[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tar[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tar[i] = sc.nextInt();\n\t\t}",
"ar[i] = sc.nextInt()",
"ar[i]",
"ar",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"boolean F = true;",
"F",
"true",
"int j = 0;",
"j",
"0",
"int times = 0;",
"times",
"0",
"while (F==true) {\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}",
"F==true",
"F",
"true",
"{\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}",
"F = false",
"F",
"false",
"for (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = 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>=j+1",
"i",
"j+1",
"j",
"1",
"i--",
"i--",
"i",
"{\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"{\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}",
"if (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}",
"ar[i] < ar[i-1]",
"ar[i]",
"ar",
"i",
"ar[i-1]",
"ar",
"i-1",
"i",
"1",
"{\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}",
"int temp = ar[i];",
"temp",
"ar[i]",
"ar",
"i",
"ar[i] = ar[i-1]",
"ar[i]",
"ar",
"i",
"ar[i-1]",
"ar",
"i-1",
"i",
"1",
"ar[i-1] = temp",
"ar[i-1]",
"ar",
"i-1",
"i",
"1",
"temp",
"times++",
"times",
"F = true",
"F",
"true",
"j++",
"j",
"for (int x=0; x<n; x++) {\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}",
"int x=0;",
"int x=0;",
"x",
"0",
"x<n",
"x",
"n",
"x++",
"x++",
"x",
"{\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}",
"{\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}",
"out.print((x==0?\"\":\" \")+ar[x])",
"out.print",
"out",
"(x==0?\"\":\" \")+ar[x]",
"(x==0?\"\":\" \")",
"x==0",
"x",
"0",
"\"\"",
"\" \"",
"ar[x]",
"ar",
"x",
"out.println()",
"out.println",
"out",
"out.println(times)",
"out.println",
"out",
"times",
"String[] args",
"args",
"public class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tar[i] = sc.nextInt();\n\t\t}\n\t\tboolean F = true;\n\t\tint j = 0;\n\t\tint times = 0;\n\t\twhile (F==true) {\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tfor (int x=0; x<n; x++) {\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}\n\t\tout.println();\n\t\tout.println(times);\n\t}\n}",
"public class Main {\n\tstatic Scanner sc = new Scanner(System.in);\n\tpublic static void main(String[] args) {\n\t\tint n = sc.nextInt();\n\t\tint[] ar = new int[n];\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tar[i] = sc.nextInt();\n\t\t}\n\t\tboolean F = true;\n\t\tint j = 0;\n\t\tint times = 0;\n\t\twhile (F==true) {\n\t\t\tF = false;\n\t\t\tfor (int i=n-1; i>=j+1; i--) {\n\t\t\t\tif (ar[i] < ar[i-1]) {\n\t\t\t\t\tint temp = ar[i];\n\t\t\t\t\tar[i] = ar[i-1];\n\t\t\t\t\tar[i-1] = temp;\n\t\t\t\t\ttimes++;\n\t\t\t\t\tF = true;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tj++;\n\t\t}\n\t\tfor (int x=0; x<n; x++) {\n\t\t\tout.print((x==0?\"\":\" \")+ar[x]);\n\t\t}\n\t\tout.println();\n\t\tout.println(times);\n\t}\n}",
"Main"
] | import java.util.*;
import static java.lang.System.*;
public class Main {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
int[] ar = new int[n];
for (int i=0; i<n; i++) {
ar[i] = sc.nextInt();
}
boolean F = true;
int j = 0;
int times = 0;
while (F==true) {
F = false;
for (int i=n-1; i>=j+1; i--) {
if (ar[i] < ar[i-1]) {
int temp = ar[i];
ar[i] = ar[i-1];
ar[i-1] = temp;
times++;
F = true;
}
}
j++;
}
for (int x=0; x<n; x++) {
out.print((x==0?"":" ")+ar[x]);
}
out.println();
out.println(times);
}
}
|
[
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,
40,
13,
0,
13,
17,
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,
4,
18,
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
],
[
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
],
[
78,
102
],
[
102,
103
],
[
102,
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
],
[
119,
121
],
[
118,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
117,
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
],
[
8,
142
],
[
142,
143
],
[
143,
144
],
[
144,
145
],
[
144,
146
],
[
142,
147
],
[
8,
148
],
[
148,
149
],
[
149,
150
],
[
6,
151
],
[
151,
152
],
[
0,
153
],
[
153,
154
],
[
153,
155
]
] | [
"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\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\n\t\tboolean flg = true;\n\n\t\tint count = 0;\n\t\twhile (flg) {\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\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.println();\n\t\tSystem.out.println(count);\n\n\t\tsc.close();\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\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\n\t\tboolean flg = true;\n\n\t\tint count = 0;\n\t\twhile (flg) {\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\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.println();\n\t\tSystem.out.println(count);\n\n\t\tsc.close();\n\t}\n\n}",
"Main",
"public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\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\n\t\tboolean flg = true;\n\n\t\tint count = 0;\n\t\twhile (flg) {\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\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.println();\n\t\tSystem.out.println(count);\n\n\t\tsc.close();\n\t}",
"main",
"{\n\t\tScanner sc = new Scanner(System.in);\n\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\n\t\tboolean flg = true;\n\n\t\tint count = 0;\n\t\twhile (flg) {\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\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.println();\n\t\tSystem.out.println(count);\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",
"boolean flg = true;",
"flg",
"true",
"int count = 0;",
"count",
"0",
"while (flg) {\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flg",
"{\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"flg = false",
"flg",
"false",
"for (int j=N-1; j>0; 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\tcount++;\n\t\t\t\t\tflg = 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 (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\tcount++;\n\t\t\t\t\tflg = 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\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\tcount++;\n\t\t\t\t\tflg = true;\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\tcount++;\n\t\t\t\t\tflg = 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\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\tcount++;\n\t\t\t\t\tflg = true;\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",
"count++",
"count",
"flg = true",
"flg",
"true",
"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.println()",
"System.out.println",
"System.out",
"System",
"System.out",
"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\tScanner sc = new Scanner(System.in);\n\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\n\t\tboolean flg = true;\n\n\t\tint count = 0;\n\t\twhile (flg) {\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\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.println();\n\t\tSystem.out.println(count);\n\n\t\tsc.close();\n\t}\n\n}",
"public class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\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\n\t\tboolean flg = true;\n\n\t\tint count = 0;\n\t\twhile (flg) {\n\t\t\tflg = false;\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 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\tcount++;\n\t\t\t\t\tflg = true;\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.println();\n\t\tSystem.out.println(count);\n\n\t\tsc.close();\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[] A = new int[N];
for (int i=0; i<N; i++) {
A[i] = sc.nextInt();
}
boolean flg = true;
int count = 0;
while (flg) {
flg = false;
for (int j=N-1; j>0; j--) {
if (A[j]<A[j-1]) {
int tmp = A[j];
A[j] = A[j-1];
A[j-1] = tmp;
count++;
flg = true;
}
}
}
for (int i=0; i<N; i++) {
if (i!=0) {
System.out.print(" ");
}
System.out.print(A[i]);
}
System.out.println();
System.out.println(count);
sc.close();
}
} |
[
7,
15,
13,
17,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
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,
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,
6,
13,
41,
13,
18,
13,
13,
41,
13,
20,
17,
41,
13,
17,
41,
13,
17,
12,
13,
30,
14,
2,
13,
13,
30,
29,
17,
30,
0,
13,
17,
38,
5,
13,
30,
4,
18,
13,
30,
0,
13,
4,
18,
13,
13,
14,
2,
13,
17,
30,
29,
17,
29,
17,
12,
13,
30,
14,
4,
13,
30,
29,
18,
13,
40,
13,
30,
29,
40,
17,
12,
13,
30,
29,
2,
2,
17,
13,
2,
13,
17,
23,
13,
12,
13,
30,
42,
2,
4,
13,
40,
4,
13,
18,
13,
13,
30,
40,
13,
29,
4,
13,
12,
13,
30,
14,
40,
4,
13,
30,
37,
20,
41,
13,
20,
41,
13,
4,
13,
42,
4,
13,
13,
30,
4,
18,
13,
13,
0,
13,
4,
13,
29,
4,
18,
13,
12,
13,
30,
14,
40,
4,
13,
30,
37,
20,
41,
13,
17,
41,
13,
17,
41,
13,
4,
13,
14,
2,
13,
17,
30,
0,
13,
17,
0,
13,
4,
13,
14,
2,
2,
13,
17,
2,
17,
13,
30,
37,
20,
42,
17,
30,
14,
2,
2,
17,
13,
2,
13,
17,
30,
0,
13,
17,
0,
13,
2,
13,
17,
14,
2,
2,
13,
40,
17,
40,
4,
13,
13,
30,
29,
8,
13,
40,
13,
13,
30,
37,
20,
0,
13,
4,
13,
12,
13,
30,
41,
13,
4,
13,
14,
2,
2,
13,
18,
13,
13,
2,
18,
13,
13,
13,
30,
37,
20,
29,
13,
12,
13,
30,
29,
4,
18,
13,
4,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
4,
5
],
[
4,
6
],
[
0,
7
],
[
7,
8
],
[
7,
9
],
[
0,
10
],
[
416,
11
],
[
416,
12
],
[
12,
13
],
[
12,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
20,
21
],
[
21,
22
],
[
14,
23
],
[
23,
24
],
[
23,
25
],
[
14,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
14,
47
],
[
47,
48
],
[
47,
49
],
[
14,
50
],
[
50,
51
],
[
50,
52
],
[
14,
53
],
[
53,
54
],
[
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
],
[
106,
108
],
[
84,
109
],
[
109,
110
],
[
14,
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
],
[
141,
142
],
[
141,
143
],
[
139,
144
],
[
132,
145
],
[
145,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
14,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
12,
157
],
[
157,
158
],
[
0,
159
],
[
159,
160
],
[
159,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
159,
166
],
[
166,
167
],
[
166,
168
],
[
159,
170
],
[
170,
171
],
[
170,
172
],
[
159,
173
],
[
173,
174
],
[
173,
175
],
[
159,
176
],
[
176,
177
],
[
176,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
179,
183
],
[
183,
184
],
[
184,
185
],
[
179,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
186,
190
],
[
190,
191
],
[
191,
192
],
[
191,
193
],
[
193,
194
],
[
194,
195
],
[
195,
196
],
[
190,
197
],
[
197,
198
],
[
198,
199
],
[
198,
200
],
[
200,
201
],
[
201,
202
],
[
200,
203
],
[
186,
204
],
[
204,
205
],
[
205,
206
],
[
205,
207
],
[
204,
208
],
[
208,
209
],
[
209,
210
],
[
178,
211
],
[
211,
212
],
[
159,
213
],
[
213,
214
],
[
213,
215
],
[
215,
216
],
[
216,
217
],
[
217,
218
],
[
216,
219
],
[
219,
220
],
[
220,
221
],
[
221,
222
],
[
221,
223
],
[
223,
224
],
[
216,
225
],
[
225,
226
],
[
226,
227
],
[
227,
228
],
[
159,
229
],
[
229,
230
],
[
229,
231
],
[
231,
232
],
[
232,
233
],
[
233,
234
],
[
234,
235
],
[
234,
236
],
[
233,
237
],
[
237,
238
],
[
237,
239
],
[
229,
240
],
[
240,
241
],
[
159,
242
],
[
242,
243
],
[
242,
244
],
[
244,
245
],
[
245,
246
],
[
246,
247
],
[
247,
248
],
[
246,
249
],
[
249,
250
],
[
250,
251
],
[
250,
252
],
[
252,
253
],
[
252,
254
],
[
245,
255
],
[
255,
256
],
[
256,
257
],
[
244,
258
],
[
258,
259
],
[
259,
260
],
[
159,
261
],
[
261,
262
],
[
261,
263
],
[
263,
264
],
[
264,
265
],
[
265,
266
],
[
266,
267
],
[
264,
268
],
[
268,
269
],
[
269,
270
],
[
263,
271
],
[
271,
272
],
[
271,
273
],
[
263,
274
],
[
274,
275
],
[
274,
276
],
[
276,
277
],
[
263,
278
],
[
278,
279
],
[
279,
280
],
[
279,
281
],
[
278,
282
],
[
282,
283
],
[
283,
284
],
[
284,
285
],
[
283,
286
],
[
282,
287
],
[
287,
288
],
[
287,
289
],
[
289,
290
],
[
263,
291
],
[
291,
292
],
[
292,
293
],
[
293,
294
],
[
159,
295
],
[
295,
296
],
[
295,
297
],
[
297,
298
],
[
298,
299
],
[
299,
300
],
[
300,
301
],
[
298,
302
],
[
302,
303
],
[
303,
304
],
[
297,
305
],
[
305,
306
],
[
305,
307
],
[
297,
308
],
[
308,
309
],
[
308,
310
],
[
297,
311
],
[
311,
312
],
[
311,
313
],
[
313,
314
],
[
297,
315
],
[
315,
316
],
[
316,
317
],
[
316,
318
],
[
315,
319
],
[
319,
320
],
[
320,
321
],
[
320,
322
],
[
319,
323
],
[
323,
324
],
[
323,
325
],
[
325,
326
],
[
297,
327
],
[
327,
328
],
[
328,
329
],
[
329,
330
],
[
329,
331
],
[
328,
332
],
[
332,
333
],
[
332,
334
],
[
327,
335
],
[
335,
336
],
[
336,
337
],
[
297,
338
],
[
338,
339
],
[
338,
340
],
[
340,
341
],
[
341,
342
],
[
342,
343
],
[
343,
344
],
[
343,
345
],
[
342,
346
],
[
346,
347
],
[
346,
348
],
[
341,
349
],
[
349,
350
],
[
350,
351
],
[
350,
352
],
[
349,
353
],
[
353,
354
],
[
353,
355
],
[
355,
356
],
[
355,
357
],
[
341,
358
],
[
358,
359
],
[
359,
360
],
[
360,
361
],
[
360,
362
],
[
362,
363
],
[
359,
364
],
[
364,
365
],
[
365,
366
],
[
365,
367
],
[
358,
368
],
[
368,
369
],
[
369,
370
],
[
370,
371
],
[
370,
372
],
[
372,
373
],
[
370,
374
],
[
358,
375
],
[
375,
376
],
[
376,
377
],
[
340,
378
],
[
378,
379
],
[
378,
380
],
[
380,
381
],
[
159,
382
],
[
382,
383
],
[
382,
384
],
[
384,
385
],
[
385,
386
],
[
385,
387
],
[
387,
388
],
[
384,
389
],
[
389,
390
],
[
390,
391
],
[
391,
392
],
[
391,
393
],
[
393,
394
],
[
393,
395
],
[
390,
396
],
[
396,
397
],
[
397,
398
],
[
397,
399
],
[
396,
400
],
[
389,
401
],
[
401,
402
],
[
402,
403
],
[
384,
404
],
[
404,
405
],
[
159,
406
],
[
406,
407
],
[
406,
408
],
[
408,
409
],
[
409,
410
],
[
410,
411
],
[
411,
412
],
[
410,
413
],
[
413,
414
],
[
0,
415
],
[
415,
416
],
[
415,
417
]
] | [
"import java.io.IOException;\nimport java.io.InputStream;\nimport java.util.*;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\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\tboolean flag = true;\n\t\tint count = 0;\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[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\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} else {\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}\n\n\nclass FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int readByte() {\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}\n\tpublic String next() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic long nextLong() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\treturn (int) nl;\n\t}\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}\n",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.io.InputStream;",
"InputStream",
"java.io",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\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\tboolean flag = true;\n\t\tint count = 0;\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[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\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} else {\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main",
"public static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\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\tboolean flag = true;\n\t\tint count = 0;\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[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\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} else {\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"main",
"{\n\t\tFastScanner sc = new FastScanner();\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\tboolean flag = true;\n\t\tint count = 0;\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[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\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} else {\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}",
"FastScanner sc = new FastScanner();",
"sc",
"new FastScanner()",
"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",
"boolean flag = true;",
"flag",
"true",
"int count = 0;",
"count",
"0",
"while (flag) {\n\t\t\tflag = false;\n\t\t\tfor (int i = n - 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 = n - 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 = n - 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 = n - 1;",
"int i = n - 1;",
"i",
"n - 1",
"n",
"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",
"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} else {\n\t\t\t\tSystem.out.println();\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} else {\n\t\t\t\tSystem.out.println();\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} else {\n\t\t\t\tSystem.out.println();\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} else {\n\t\t\t\tSystem.out.println();\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.println();\n\t\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",
"class FastScanner {\n\tprivate final InputStream in = System.in;\n\tprivate final byte[] buffer = new byte[1024];\n\tprivate int ptr = 0;\n\tprivate int buflen = 0;\n\tprivate boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\tprivate int readByte() {\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}\n\tprivate static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}\n\tpublic boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}\n\tpublic String next() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}\n\tpublic long nextLong() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}\n\tpublic int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\treturn (int) nl;\n\t}\n\tpublic double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}\n}",
"FastScanner",
"private final InputStream in = System.in;",
"in",
"System.in",
"System",
"System.in",
"private final byte[] buffer = new byte[1024];",
"buffer",
"new byte[1024]",
"1024",
"private int ptr = 0;",
"ptr",
"0",
"private int buflen = 0;",
"buflen",
"0",
"private boolean hasNextByte() {\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"hasNextByte",
"{\n\t\tif (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}",
"if (ptr < buflen) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr < buflen",
"ptr",
"buflen",
"{\n\t\t\treturn true;\n\t\t}",
"return true;",
"true",
"{\n\t\t\tptr = 0;\n\t\t\ttry {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t\tif (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}",
"ptr = 0",
"ptr",
"0",
"try {\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t} catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"catch (IOException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"IOException e",
"{\n\t\t\t\te.printStackTrace();\n\t\t\t}",
"e.printStackTrace()",
"e.printStackTrace",
"e",
"{\n\t\t\t\tbuflen = in.read(buffer);\n\t\t\t}",
"buflen = in.read(buffer)",
"buflen",
"in.read(buffer)",
"in.read",
"in",
"buffer",
"if (buflen <= 0) {\n\t\t\t\treturn false;\n\t\t\t}",
"buflen <= 0",
"buflen",
"0",
"{\n\t\t\t\treturn false;\n\t\t\t}",
"return false;",
"false",
"return true;",
"true",
"private int readByte() {\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}",
"readByte",
"{\n\t\tif (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}\n\t}",
"if (hasNextByte()) {\n\t\t\treturn buffer[ptr++];\n\t\t} else {\n\t\t\treturn -1;\n\t\t}",
"hasNextByte()",
"hasNextByte",
"{\n\t\t\treturn buffer[ptr++];\n\t\t}",
"return buffer[ptr++];",
"buffer[ptr++]",
"buffer",
"ptr++",
"ptr",
"{\n\t\t\treturn -1;\n\t\t}",
"return -1;",
"-1",
"1",
"private static boolean isPrintableChar(int c) {\n\t\treturn 33 <= c && c <= 126;\n\t}",
"isPrintableChar",
"{\n\t\treturn 33 <= c && c <= 126;\n\t}",
"return 33 <= c && c <= 126;",
"33 <= c && c <= 126",
"33 <= c",
"33",
"c",
"c <= 126",
"c",
"126",
"int c",
"c",
"public boolean hasNext() {\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}",
"hasNext",
"{\n\t\twhile (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}\n\t\treturn hasNextByte();\n\t}",
"while (hasNextByte() && !isPrintableChar(buffer[ptr])) {\n\t\t\tptr++;\n\t\t}",
"hasNextByte() && !isPrintableChar(buffer[ptr])",
"hasNextByte()",
"hasNextByte",
"!isPrintableChar(buffer[ptr])",
"isPrintableChar(buffer[ptr])",
"isPrintableChar",
"buffer[ptr]",
"buffer",
"ptr",
"{\n\t\t\tptr++;\n\t\t}",
"ptr++",
"ptr",
"return hasNextByte();",
"hasNextByte()",
"hasNextByte",
"public String next() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"next",
"{\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tStringBuilder sb = new StringBuilder();\n\t\tint b = readByte();\n\t\twhile (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}\n\t\treturn sb.toString();\n\t}",
"if (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n\t\t\tthrow new NoSuchElementException();\n\t\t}",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"while (isPrintableChar(b)) {\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\tsb.appendCodePoint(b);\n\t\t\tb = readByte();\n\t\t}",
"sb.appendCodePoint(b)",
"sb.appendCodePoint",
"sb",
"b",
"b = readByte()",
"b",
"readByte()",
"readByte",
"return sb.toString();",
"sb.toString()",
"sb.toString",
"sb",
"public long nextLong() {\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"nextLong",
"{\n\t\tif (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t\tlong n = 0;\n\t\tboolean minus = false;\n\t\tint b = readByte();\n\t\tif (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}\n\t\tif (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\twhile (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}\n\t}",
"if (!hasNext()) {\n\t\t\tthrow new NoSuchElementException();\n\t\t}",
"!hasNext()",
"hasNext()",
"hasNext",
"{\n\t\t\tthrow new NoSuchElementException();\n\t\t}",
"throw new NoSuchElementException();",
"new NoSuchElementException()",
"long n = 0;",
"n",
"0",
"boolean minus = false;",
"minus",
"false",
"int b = readByte();",
"b",
"readByte()",
"readByte",
"if (b == '-') {\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"b == '-'",
"b",
"'-'",
"{\n\t\t\tminus = true;\n\t\t\tb = readByte();\n\t\t}",
"minus = true",
"minus",
"true",
"b = readByte()",
"b",
"readByte()",
"readByte",
"if (b < '0' || '9' < b) {\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"b < '0' || '9' < b",
"b < '0'",
"b",
"'0'",
"'9' < b",
"'9'",
"b",
"{\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"while (true) {\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"true",
"{\n\t\t\tif ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}\n\t\t\tb = readByte();\n\t\t}",
"if ('0' <= b && b <= '9') {\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t} else if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"'0' <= b && b <= '9'",
"'0' <= b",
"'0'",
"b",
"b <= '9'",
"b",
"'9'",
"{\n\t\t\t\tn *= 10;\n\t\t\t\tn += b - '0';\n\t\t\t}",
"n *= 10",
"n",
"10",
"n += b - '0'",
"n",
"b - '0'",
"b",
"'0'",
"if (b == -1 || !isPrintableChar(b)) {\n\t\t\t\treturn minus ? -n : n;\n\t\t\t} else {\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"b == -1 || !isPrintableChar(b)",
"b == -1",
"b",
"-1",
"1",
"!isPrintableChar(b)",
"isPrintableChar(b)",
"isPrintableChar",
"b",
"{\n\t\t\t\treturn minus ? -n : n;\n\t\t\t}",
"return minus ? -n : n;",
"minus ? -n : n",
"minus",
"-n",
"n",
"n",
"{\n\t\t\t\tthrow new NumberFormatException();\n\t\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"b = readByte()",
"b",
"readByte()",
"readByte",
"public int nextInt() {\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\treturn (int) nl;\n\t}",
"nextInt",
"{\n\t\tlong nl = nextLong();\n\t\tif (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {\n\t\t\tthrow new NumberFormatException();\n\t\t}\n\t\treturn (int) nl;\n\t}",
"long nl = nextLong();",
"nl",
"nextLong()",
"nextLong",
"if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl",
"nl < Integer.MIN_VALUE",
"nl",
"Integer.MIN_VALUE",
"Integer",
"Integer.MIN_VALUE",
"Integer.MAX_VALUE < nl",
"Integer.MAX_VALUE",
"Integer",
"Integer.MAX_VALUE",
"nl",
"{\n\t\t\tthrow new NumberFormatException();\n\t\t}",
"throw new NumberFormatException();",
"new NumberFormatException()",
"return (int) nl;",
"(int) nl",
"public double nextDouble() {\n\t\treturn Double.parseDouble(next());\n\t}",
"nextDouble",
"{\n\t\treturn Double.parseDouble(next());\n\t}",
"return Double.parseDouble(next());",
"Double.parseDouble(next())",
"Double.parseDouble",
"Double",
"next()",
"next",
"public class Main {\n\tpublic static void main(String[] args) {\n\t\tFastScanner sc = new FastScanner();\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\tboolean flag = true;\n\t\tint count = 0;\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[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\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} else {\n\t\t\t\tSystem.out.println();\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) {\n\t\tFastScanner sc = new FastScanner();\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\tboolean flag = true;\n\t\tint count = 0;\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[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\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} else {\n\t\t\t\tSystem.out.println();\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(count);\n\t}\n}",
"Main"
] | import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
boolean flag = true;
int count = 0;
while (flag) {
flag = false;
for (int i = n - 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++;
}
}
}
for (int i = 0; i < n; i++) {
System.out.print(a[i]);
if (i < n - 1) {
System.out.print(" ");
} else {
System.out.println();
}
}
System.out.println(count);
}
}
class FastScanner {
private final InputStream in = System.in;
private final byte[] buffer = new byte[1024];
private int ptr = 0;
private int buflen = 0;
private boolean hasNextByte() {
if (ptr < buflen) {
return true;
} else {
ptr = 0;
try {
buflen = in.read(buffer);
} catch (IOException e) {
e.printStackTrace();
}
if (buflen <= 0) {
return false;
}
}
return true;
}
private int readByte() {
if (hasNextByte()) {
return buffer[ptr++];
} else {
return -1;
}
}
private static boolean isPrintableChar(int c) {
return 33 <= c && c <= 126;
}
public boolean hasNext() {
while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
ptr++;
}
return hasNextByte();
}
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
StringBuilder sb = new StringBuilder();
int b = readByte();
while (isPrintableChar(b)) {
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
public long nextLong() {
if (!hasNext()) {
throw new NoSuchElementException();
}
long n = 0;
boolean minus = false;
int b = readByte();
if (b == '-') {
minus = true;
b = readByte();
}
if (b < '0' || '9' < b) {
throw new NumberFormatException();
}
while (true) {
if ('0' <= b && b <= '9') {
n *= 10;
n += b - '0';
} else if (b == -1 || !isPrintableChar(b)) {
return minus ? -n : n;
} else {
throw new NumberFormatException();
}
b = readByte();
}
}
public int nextInt() {
long nl = nextLong();
if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
throw new NumberFormatException();
}
return (int) nl;
}
public double nextDouble() {
return Double.parseDouble(next());
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
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,
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,
0,
13,
17,
40,
13,
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,
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
],
[
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
],
[
47,
53
],
[
53,
54
],
[
54,
55
],
[
47,
56
],
[
57,
57
],
[
57,
58
],
[
58,
59
],
[
58,
60
],
[
57,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
65,
66
],
[
65,
67
],
[
61,
68
],
[
68,
69
],
[
68,
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
],
[
110,
112
],
[
88,
113
],
[
113,
114
],
[
8,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
117,
119
],
[
115,
120
],
[
120,
121
],
[
120,
122
],
[
8,
123
],
[
123,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
123,
128
],
[
128,
129
],
[
128,
130
],
[
123,
131
],
[
131,
132
],
[
132,
133
],
[
123,
134
],
[
135,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
143,
144
],
[
143,
145
],
[
8,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
151,
152
],
[
151,
153
],
[
6,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n int count = 0;\n boolean flag = true;\n for(int i = 0; flag; i++){\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < num; i++){\n System.out.print(\" \" + array[i]);\n }\n System.out.println(\"\\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 int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n int count = 0;\n boolean flag = true;\n for(int i = 0; flag; i++){\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < num; i++){\n System.out.print(\" \" + array[i]);\n }\n System.out.println(\"\\n\" + count);\n \n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n int count = 0;\n boolean flag = true;\n for(int i = 0; flag; i++){\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < num; i++){\n System.out.print(\" \" + array[i]);\n }\n System.out.println(\"\\n\" + count);\n \n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n int count = 0;\n boolean flag = true;\n for(int i = 0; flag; i++){\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < num; i++){\n System.out.print(\" \" + array[i]);\n }\n System.out.println(\"\\n\" + count);\n \n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = sc.nextInt();",
"num",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] array = new int[num];",
"array",
"new int[num]",
"num",
"for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n array[i] = sc.nextInt();\n }",
"{\n array[i] = sc.nextInt();\n }",
"array[i] = sc.nextInt()",
"array[i]",
"array",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int count = 0;",
"count",
"0",
"boolean flag = true;",
"flag",
"true",
"for(int i = 0; flag; i++){\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"flag",
"i++",
"i++",
"i",
"{\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }",
"{\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }",
"flag = false",
"flag",
"false",
"for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }",
"int j = num - 1;",
"int j = num - 1;",
"j",
"num - 1",
"num",
"1",
"j >= i + 1",
"j",
"i + 1",
"i",
"1",
"j--",
"j--",
"j",
"{\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }",
"{\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }",
"if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }",
"array[j - 1] > array[j]",
"array[j - 1]",
"array",
"j - 1",
"j",
"1",
"array[j]",
"array",
"j",
"{\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }",
"int temp = array[j - 1];",
"temp",
"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] = temp",
"array[j]",
"array",
"j",
"temp",
"flag = true",
"flag",
"true",
"count++",
"count",
"System.out.print(array[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"array[0]",
"array",
"0",
"for(int i = 1; i < num; i++){\n System.out.print(\" \" + array[i]);\n }",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < num",
"i",
"num",
"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(\"\\n\" + count)",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\\n\" + count",
"\"\\n\"",
"count",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n int count = 0;\n boolean flag = true;\n for(int i = 0; flag; i++){\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < num; i++){\n System.out.print(\" \" + array[i]);\n }\n System.out.println(\"\\n\" + count);\n \n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int num = sc.nextInt();\n int[] array = new int[num];\n for(int i = 0; i < num; i++){\n array[i] = sc.nextInt();\n }\n int count = 0;\n boolean flag = true;\n for(int i = 0; flag; i++){\n flag = false;\n for(int j = num - 1; j >= i + 1; j--){\n if(array[j - 1] > array[j]){\n int temp = array[j - 1];\n array[j - 1] = array[j];\n array[j] = temp;\n flag = true;\n count++;\n }\n }\n }\n System.out.print(array[0]);\n for(int i = 1; i < num; i++){\n System.out.print(\" \" + array[i]);\n }\n System.out.println(\"\\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 num = sc.nextInt();
int[] array = new int[num];
for(int i = 0; i < num; i++){
array[i] = sc.nextInt();
}
int count = 0;
boolean flag = true;
for(int i = 0; flag; i++){
flag = false;
for(int j = num - 1; j >= i + 1; j--){
if(array[j - 1] > array[j]){
int temp = array[j - 1];
array[j - 1] = array[j];
array[j] = temp;
flag = true;
count++;
}
}
}
System.out.print(array[0]);
for(int i = 1; i < num; i++){
System.out.print(" " + array[i]);
}
System.out.println("\n" + count);
}
}
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
20,
17,
41,
13,
41,
13,
41,
13,
41,
13,
41,
13,
17,
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,
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,
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
],
[
167,
5
],
[
167,
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
],
[
8,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
30,
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
],
[
8,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
52,
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
],
[
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
],
[
101,
102
],
[
101,
103
],
[
100,
104
],
[
104,
105
],
[
104,
106
],
[
106,
107
],
[
106,
108
],
[
94,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
112,
113
],
[
112,
114
],
[
109,
115
],
[
94,
116
],
[
116,
117
],
[
8,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
118,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
131,
135
],
[
135,
136
],
[
136,
137
],
[
137,
138
],
[
137,
139
],
[
135,
140
],
[
140,
141
],
[
140,
142
],
[
131,
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
],
[
0,
166
],
[
166,
167
],
[
166,
168
]
] | [
"import java.util.Scanner;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int[] a=new int[101];\n int i,t,j,n,co=0;\n n = sc.nextInt();\n for(i=0;i<n;i++){\n a[i] = sc.nextInt();\n }\n for(i=n-1;i>0;i--){\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }\n\n for(i=0;i<n;i++){\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }\n System.out.println();\n System.out.println(co);\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[] a=new int[101];\n int i,t,j,n,co=0;\n n = sc.nextInt();\n for(i=0;i<n;i++){\n a[i] = sc.nextInt();\n }\n for(i=n-1;i>0;i--){\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }\n\n for(i=0;i<n;i++){\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }\n System.out.println();\n System.out.println(co);\n }\n}",
"Main",
"public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int[] a=new int[101];\n int i,t,j,n,co=0;\n n = sc.nextInt();\n for(i=0;i<n;i++){\n a[i] = sc.nextInt();\n }\n for(i=n-1;i>0;i--){\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }\n\n for(i=0;i<n;i++){\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }\n System.out.println();\n System.out.println(co);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n int[] a=new int[101];\n int i,t,j,n,co=0;\n n = sc.nextInt();\n for(i=0;i<n;i++){\n a[i] = sc.nextInt();\n }\n for(i=n-1;i>0;i--){\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }\n\n for(i=0;i<n;i++){\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }\n System.out.println();\n System.out.println(co);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int[] a=new int[101];",
"a",
"new int[101]",
"101",
"int i",
"i",
"t",
"t",
"j",
"j",
"n",
"n",
"co=0;",
"co",
"0",
"n = sc.nextInt()",
"n",
"sc.nextInt()",
"sc.nextInt",
"sc",
"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",
"for(i=n-1;i>0;i--){\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\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(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }",
"{\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }",
"for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\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(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }",
"{\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }",
"if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }",
"a[j]<a[j-1]",
"a[j]",
"a",
"j",
"a[j-1]",
"a",
"j-1",
"j",
"1",
"{\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }",
"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",
"co++",
"co",
"for(i=0;i<n;i++){\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }",
"i=0;",
"i=0",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }",
"{\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }",
"if(i==0)System.out.print(a[i]);\n else System.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(co)",
"System.out.println",
"System.out",
"System",
"System.out",
"co",
"String[] args",
"args",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int[] a=new int[101];\n int i,t,j,n,co=0;\n n = sc.nextInt();\n for(i=0;i<n;i++){\n a[i] = sc.nextInt();\n }\n for(i=n-1;i>0;i--){\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }\n\n for(i=0;i<n;i++){\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }\n System.out.println();\n System.out.println(co);\n }\n}",
"public class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n int[] a=new int[101];\n int i,t,j,n,co=0;\n n = sc.nextInt();\n for(i=0;i<n;i++){\n a[i] = sc.nextInt();\n }\n for(i=n-1;i>0;i--){\n for(j=n-1;j>=n-i;j--){\n if(a[j]<a[j-1]){\n t=a[j];\n a[j]=a[j-1];\n a[j-1]=t;\n co++;\n }\n\n }\n }\n\n for(i=0;i<n;i++){\n if(i==0)System.out.print(a[i]);\n else System.out.print(\" \"+a[i]);\n }\n System.out.println();\n System.out.println(co);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int[] a=new int[101];
int i,t,j,n,co=0;
n = sc.nextInt();
for(i=0;i<n;i++){
a[i] = sc.nextInt();
}
for(i=n-1;i>0;i--){
for(j=n-1;j>=n-i;j--){
if(a[j]<a[j-1]){
t=a[j];
a[j]=a[j-1];
a[j-1]=t;
co++;
}
}
}
for(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(co);
}
}
|
[
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,
40,
13,
0,
13,
17,
41,
13,
20,
28,
13,
13,
30,
30,
4,
18,
13,
13,
4,
18,
13,
17,
4,
18,
18,
13,
13,
4,
18,
4,
18,
13,
4,
18,
18,
13,
13,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
140,
5
],
[
140,
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
],
[
78,
102
],
[
102,
103
],
[
102,
104
],
[
8,
105
],
[
105,
106
],
[
105,
107
],
[
8,
108
],
[
108,
109
],
[
108,
110
],
[
108,
111
],
[
112,
112
],
[
112,
113
],
[
113,
114
],
[
114,
115
],
[
113,
116
],
[
112,
117
],
[
117,
118
],
[
118,
119
],
[
117,
120
],
[
8,
121
],
[
121,
122
],
[
122,
123
],
[
123,
124
],
[
123,
125
],
[
121,
126
],
[
126,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
8,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
6,
137
],
[
137,
138
],
[
0,
139
],
[
139,
140
],
[
139,
141
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = 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\tboolean flag = true;\n\t\tint cnt = 0;\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 = 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\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i : a) {\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\n\t\tSystem.out.println(cnt);\n\t}\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tpublic static void main(String args[]) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] a = 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\tboolean flag = true;\n\t\tint cnt = 0;\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 = 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\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i : a) {\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\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\tint n = sc.nextInt();\n\t\tint[] a = 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\tboolean flag = true;\n\t\tint cnt = 0;\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 = 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\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i : a) {\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\n\t\tSystem.out.println(cnt);\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\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\ta[i] = sc.nextInt();\n\t\t}\n\n\t\tboolean flag = true;\n\t\tint cnt = 0;\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 = 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\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i : a) {\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\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",
"boolean flag = true;",
"flag",
"true",
"int cnt = 0;",
"cnt",
"0",
"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 = 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\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 >= 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\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 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];\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\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 >= 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];\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\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\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\tflag = true;\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\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\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\tflag = true;\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",
"flag = true",
"flag",
"true",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (int i : a) {\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}",
"int i",
"a",
"{\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}",
"{\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}",
"sb.append(i)",
"sb.append",
"sb",
"i",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"System.out.println(sb.toString().trim())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString().trim()",
"sb.toString().trim",
"sb.toString()",
"sb.toString",
"sb",
"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\tint n = sc.nextInt();\n\t\tint[] a = 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\tboolean flag = true;\n\t\tint cnt = 0;\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 = 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\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i : a) {\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\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\tint n = sc.nextInt();\n\t\tint[] a = 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\tboolean flag = true;\n\t\tint cnt = 0;\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 = 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\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i : a) {\n\t\t\tsb.append(i);\n\t\t\tsb.append(\" \");\n\t\t}\n\n\t\tSystem.out.println(sb.toString().trim());\n\t\tSystem.out.println(cnt);\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
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;
while (flag) {
flag = false;
for (int j = n - 1; j >= 1; j--) {
if (a[j] < a[j - 1]) {
int tmp = a[j];
a[j] = a[j - 1];
a[j - 1] = tmp;
cnt++;
flag = true;
}
}
}
StringBuilder sb = new StringBuilder();
for (int i : a) {
sb.append(i);
sb.append(" ");
}
System.out.println(sb.toString().trim());
System.out.println(cnt);
}
} |
[
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,
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,
29,
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,
30,
4,
18,
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
],
[
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
],
[
87,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
93
],
[
93,
94
],
[
94,
95
],
[
95,
96
],
[
95,
97
],
[
97,
98
],
[
97,
99
],
[
93,
100
],
[
100,
101
],
[
100,
102
],
[
93,
103
],
[
103,
104
],
[
104,
105
],
[
93,
106
],
[
107,
107
],
[
107,
108
],
[
108,
109
],
[
109,
110
],
[
110,
111
],
[
110,
112
],
[
109,
113
],
[
113,
114
],
[
113,
115
],
[
115,
116
],
[
115,
117
],
[
108,
118
],
[
118,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
118,
124
],
[
124,
125
],
[
125,
126
],
[
125,
127
],
[
124,
128
],
[
128,
129
],
[
128,
130
],
[
130,
131
],
[
130,
132
],
[
118,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
133,
139
],
[
118,
140
],
[
140,
141
],
[
118,
142
],
[
142,
143
],
[
142,
144
],
[
80,
145
],
[
145,
146
],
[
78,
147
],
[
147,
148
],
[
78,
149
],
[
149,
150
],
[
202,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
154,
155
],
[
154,
156
],
[
153,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
162,
163
],
[
162,
164
],
[
164,
165
],
[
164,
166
],
[
157,
167
],
[
167,
168
],
[
168,
169
],
[
157,
170
],
[
171,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
172,
175
],
[
175,
176
],
[
175,
177
],
[
171,
178
],
[
178,
179
],
[
179,
180
],
[
179,
181
],
[
181,
182
],
[
182,
183
],
[
182,
184
],
[
181,
185
],
[
178,
186
],
[
186,
187
],
[
187,
188
],
[
188,
189
],
[
187,
190
],
[
153,
191
],
[
191,
192
],
[
192,
193
],
[
193,
194
],
[
193,
195
],
[
191,
196
],
[
196,
197
],
[
197,
198
],
[
151,
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 IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\tint[] inputData = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}\n\t\tint swapCnt = bubbleSort(inputData, n);\n\t\tprintArray(inputData);\n\t\tSystem.out.println(swapCnt);\n\n\t}\n\n\tpublic static int bubbleSort(int[] A, int N) {\n\t\tint swapCnt = 0;\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[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\tswapCnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn swapCnt;\n\t}\n\n\tpublic static void printArray(int[] target) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < target.length; i++) {\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\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 IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\tint[] inputData = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}\n\t\tint swapCnt = bubbleSort(inputData, n);\n\t\tprintArray(inputData);\n\t\tSystem.out.println(swapCnt);\n\n\t}\n\n\tpublic static int bubbleSort(int[] A, int N) {\n\t\tint swapCnt = 0;\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[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\tswapCnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn swapCnt;\n\t}\n\n\tpublic static void printArray(int[] target) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < target.length; i++) {\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}\n}",
"Main",
"public static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\tint[] inputData = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}\n\t\tint swapCnt = bubbleSort(inputData, n);\n\t\tprintArray(inputData);\n\t\tSystem.out.println(swapCnt);\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[] strs = br.readLine().split(\" \");\n\t\tint[] inputData = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}\n\t\tint swapCnt = bubbleSort(inputData, n);\n\t\tprintArray(inputData);\n\t\tSystem.out.println(swapCnt);\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[] strs = br.readLine().split(\" \");",
"strs",
"br.readLine().split(\" \")",
"br.readLine().split",
"br.readLine()",
"br.readLine",
"br",
"\" \"",
"int[] inputData = new int[n];",
"inputData",
"new int[n]",
"n",
"for (int i = 0; i < n; i++) {\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}",
"{\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}",
"inputData[i] = Integer.parseInt(strs[i])",
"inputData[i]",
"inputData",
"i",
"Integer.parseInt(strs[i])",
"Integer.parseInt",
"Integer",
"strs[i]",
"strs",
"i",
"int swapCnt = bubbleSort(inputData, n);",
"swapCnt",
"bubbleSort(inputData, n)",
"bubbleSort",
"inputData",
"n",
"printArray(inputData)",
"printArray",
"inputData",
"System.out.println(swapCnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"swapCnt",
"String[] args",
"args",
"public static int bubbleSort(int[] A, int N) {\n\t\tint swapCnt = 0;\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[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\tswapCnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn swapCnt;\n\t}",
"bubbleSort",
"{\n\t\tint swapCnt = 0;\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[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\tswapCnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn swapCnt;\n\t}",
"int swapCnt = 0;",
"swapCnt",
"0",
"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[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\tswapCnt++;\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 > 0; 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\tswapCnt++;\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 > 0; 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\tswapCnt++;\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 > 0",
"i",
"0",
"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\tswapCnt++;\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 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\tswapCnt++;\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 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\tswapCnt++;\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 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\tswapCnt++;\n\t\t\t\t\tflag = true;\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",
"swapCnt++",
"swapCnt",
"flag = true",
"flag",
"true",
"return swapCnt;",
"swapCnt",
"int[] A",
"A",
"int N",
"N",
"public static void printArray(int[] target) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < target.length; i++) {\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}",
"printArray",
"{\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < target.length; i++) {\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}",
"StringBuilder sb = new StringBuilder();",
"sb",
"new StringBuilder()",
"for (int i = 0; i < target.length; i++) {\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < target.length",
"i",
"target.length",
"target",
"target.length",
"i++",
"i++",
"i",
"{\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}",
"{\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}",
"sb.append(target[i])",
"sb.append",
"sb",
"target[i]",
"target",
"i",
"if (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}",
"i < target.length - 1",
"i",
"target.length - 1",
"target.length",
"target",
"target.length",
"1",
"{\n\t\t\t\tsb.append(\" \");\n\t\t\t}",
"sb.append(\" \")",
"sb.append",
"sb",
"\" \"",
"System.out.println(sb.toString())",
"System.out.println",
"System.out",
"System",
"System.out",
"sb.toString()",
"sb.toString",
"sb",
"int[] target",
"target",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\tint[] inputData = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}\n\t\tint swapCnt = bubbleSort(inputData, n);\n\t\tprintArray(inputData);\n\t\tSystem.out.println(swapCnt);\n\n\t}\n\n\tpublic static int bubbleSort(int[] A, int N) {\n\t\tint swapCnt = 0;\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[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\tswapCnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn swapCnt;\n\t}\n\n\tpublic static void printArray(int[] target) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < target.length; i++) {\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\n\t}\n}",
"public class Main {\n\n\tpublic static void main(String[] args) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\tString[] strs = br.readLine().split(\" \");\n\t\tint[] inputData = new int[n];\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tinputData[i] = Integer.parseInt(strs[i]);\n\t\t}\n\t\tint swapCnt = bubbleSort(inputData, n);\n\t\tprintArray(inputData);\n\t\tSystem.out.println(swapCnt);\n\n\t}\n\n\tpublic static int bubbleSort(int[] A, int N) {\n\t\tint swapCnt = 0;\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[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\tswapCnt++;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn swapCnt;\n\t}\n\n\tpublic static void printArray(int[] target) {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i < target.length; i++) {\n\t\t\tsb.append(target[i]);\n\t\t\tif (i < target.length - 1) {\n\t\t\t\tsb.append(\" \");\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(sb.toString());\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 IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
String[] strs = br.readLine().split(" ");
int[] inputData = new int[n];
for (int i = 0; i < n; i++) {
inputData[i] = Integer.parseInt(strs[i]);
}
int swapCnt = bubbleSort(inputData, n);
printArray(inputData);
System.out.println(swapCnt);
}
public static int bubbleSort(int[] A, int N) {
int swapCnt = 0;
boolean flag = true;
while (flag) {
flag = false;
for (int i = N - 1; i > 0; i--) {
if (A[i] < A[i - 1] ) {
int temp = A[i];
A[i] = A[i - 1];
A[i - 1] = temp;
swapCnt++;
flag = true;
}
}
}
return swapCnt;
}
public static void printArray(int[] target) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < target.length; i++) {
sb.append(target[i]);
if (i < target.length - 1) {
sb.append(" ");
}
}
System.out.println(sb.toString());
}
} |
[
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,
4,
13,
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,
17,
4,
18,
18,
13,
13,
18,
13,
13,
4,
18,
18,
13,
13,
4,
18,
18,
13,
13,
13,
23,
13,
12,
13,
30,
41,
13,
18,
13,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
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,
40,
13,
41,
13,
18,
13,
13,
0,
18,
13,
13,
18,
13,
2,
13,
17,
0,
18,
13,
2,
13,
17,
13,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
166,
5
],
[
166,
6
],
[
6,
7
],
[
6,
8
],
[
166,
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
],
[
54,
55
],
[
54,
56
],
[
47,
57
],
[
57,
58
],
[
58,
59
],
[
47,
60
],
[
61,
61
],
[
61,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
68,
70
],
[
66,
71
],
[
61,
72
],
[
72,
73
],
[
73,
74
],
[
74,
75
],
[
74,
76
],
[
72,
77
],
[
77,
78
],
[
77,
79
],
[
11,
80
],
[
80,
81
],
[
81,
82
],
[
82,
83
],
[
82,
84
],
[
11,
85
],
[
85,
86
],
[
86,
87
],
[
87,
88
],
[
87,
89
],
[
85,
90
],
[
9,
91
],
[
91,
92
],
[
166,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
98,
100
],
[
95,
101
],
[
101,
102
],
[
102,
103
],
[
103,
104
],
[
103,
105
],
[
101,
106
],
[
106,
107
],
[
106,
108
],
[
101,
109
],
[
109,
110
],
[
110,
111
],
[
101,
112
],
[
113,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
116,
117
],
[
116,
118
],
[
114,
119
],
[
119,
120
],
[
119,
121
],
[
121,
122
],
[
121,
123
],
[
114,
124
],
[
124,
125
],
[
125,
126
],
[
114,
127
],
[
128,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
131,
132
],
[
131,
133
],
[
130,
134
],
[
134,
135
],
[
134,
136
],
[
136,
137
],
[
136,
138
],
[
129,
139
],
[
139,
140
],
[
140,
141
],
[
139,
142
],
[
142,
143
],
[
142,
144
],
[
144,
145
],
[
144,
146
],
[
139,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
147,
151
],
[
151,
152
],
[
151,
153
],
[
153,
154
],
[
153,
155
],
[
139,
156
],
[
156,
157
],
[
157,
158
],
[
157,
159
],
[
159,
160
],
[
159,
161
],
[
156,
162
],
[
93,
163
],
[
163,
164
],
[
0,
165
],
[
165,
166
],
[
165,
167
]
] | [
"import java.util.*;\npublic class Main{\n\tstatic int count = 0 ;\n\tpublic static void main(String args[]){\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] nums =new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(nums);\n\t\tfor(int i=0;i<nums.length;i++){\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void bubbleSort(int[] A){\n\t\tint N = A.length;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}\n\t}\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main{\n\tstatic int count = 0 ;\n\tpublic static void main(String args[]){\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] nums =new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(nums);\n\t\tfor(int i=0;i<nums.length;i++){\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void bubbleSort(int[] A){\n\t\tint N = A.length;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}\n\t}\n}",
"Main",
"static int count = 0 ;",
"count",
"0",
"public static void main(String args[]){\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] nums =new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(nums);\n\t\tfor(int i=0;i<nums.length;i++){\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[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[] nums =new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(nums);\n\t\tfor(int i=0;i<nums.length;i++){\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[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[] nums =new int[n];",
"nums",
"new int[n]",
"n",
"for(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"{\n\t\t\tnums[i] = sc.nextInt();\n\t\t}",
"nums[i] = sc.nextInt()",
"nums[i]",
"nums",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"bubbleSort(nums)",
"bubbleSort",
"nums",
"for(int i=0;i<nums.length;i++){\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[i]);\n\t\t}",
"int i=0;",
"int i=0;",
"i",
"0",
"i<nums.length",
"i",
"nums.length",
"nums",
"nums.length",
"i++",
"i++",
"i",
"{\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[i]);\n\t\t}",
"{\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[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(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",
"String args[]",
"args",
"public static void bubbleSort(int[] A){\n\t\tint N = A.length;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}\n\t}",
"bubbleSort",
"{\n\t\tint N = A.length;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}\n\t}",
"int N = A.length;",
"N",
"A.length",
"A",
"A.length",
"for(int i=0;i<N;i++){\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\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=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}",
"{\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}",
"for(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}",
"int j=1;",
"int j=1;",
"j",
"1",
"j<N-i",
"j",
"N-i",
"N",
"i",
"j++",
"j++",
"j",
"{\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}",
"{\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}",
"if(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}",
"A[j]<A[j-1]",
"A[j]",
"A",
"j",
"A[j-1]",
"A",
"j-1",
"j",
"1",
"{\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}",
"count++",
"count",
"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",
"int[] A",
"A",
"public class Main{\n\tstatic int count = 0 ;\n\tpublic static void main(String args[]){\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] nums =new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(nums);\n\t\tfor(int i=0;i<nums.length;i++){\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void bubbleSort(int[] A){\n\t\tint N = A.length;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}\n\t}\n}",
"public class Main{\n\tstatic int count = 0 ;\n\tpublic static void main(String args[]){\n\t\tScanner sc =new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] nums =new int[n];\n\t\tfor(int i=0;i<n;i++){\n\t\t\tnums[i] = sc.nextInt();\n\t\t}\n\t\tbubbleSort(nums);\n\t\tfor(int i=0;i<nums.length;i++){\n\t\t\tif(i>0) System.out.print(\" \");\n\t\t\tSystem.out.print(nums[i]);\n\t\t}\n\t\tSystem.out.println();\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void bubbleSort(int[] A){\n\t\tint N = A.length;\n\t\tfor(int i=0;i<N;i++){\n\t\t\tfor(int j=1;j<N-i;j++){\n\t\t\t\tif(A[j]<A[j-1]){\n\t\t\t\t\tcount++;\n\t\t\t\t\tint t = 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}\n\t\t\t}\n\t\t}\n\t}\n}",
"Main"
] | import java.util.*;
public class Main{
static int count = 0 ;
public static void main(String args[]){
Scanner sc =new Scanner(System.in);
int n = sc.nextInt();
int[] nums =new int[n];
for(int i=0;i<n;i++){
nums[i] = sc.nextInt();
}
bubbleSort(nums);
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);
}
public static void bubbleSort(int[] A){
int N = A.length;
for(int i=0;i<N;i++){
for(int j=1;j<N-i;j++){
if(A[j]<A[j-1]){
count++;
int t = A[j];
A[j] = A[j-1];
A[j-1] = t;
}
}
}
}
} |
[
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,
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,
13,
1,
40,
13,
30,
4,
18,
18,
13,
13,
2,
18,
13,
13,
8,
2,
13,
2,
13,
17,
17,
17,
4,
18,
18,
13,
13,
13,
12,
13,
30,
4,
18,
20,
23,
13,
10,
6,
13
] | [
[
0,
1
],
[
1,
2
],
[
1,
3
],
[
0,
4
],
[
148,
5
],
[
148,
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
],
[
46,
48
],
[
48,
49
],
[
49,
50
],
[
49,
51
],
[
48,
52
],
[
52,
53
],
[
53,
54
],
[
54,
55
],
[
54,
56
],
[
56,
57
],
[
56,
58
],
[
52,
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
],
[
68,
72
],
[
72,
73
],
[
72,
74
],
[
74,
75
],
[
74,
76
],
[
67,
77
],
[
77,
78
],
[
78,
79
],
[
78,
80
],
[
80,
81
],
[
80,
82
],
[
77,
83
],
[
83,
84
],
[
84,
85
],
[
84,
86
],
[
83,
87
],
[
87,
88
],
[
87,
89
],
[
89,
90
],
[
89,
91
],
[
77,
92
],
[
92,
93
],
[
93,
94
],
[
93,
95
],
[
95,
96
],
[
95,
97
],
[
92,
98
],
[
77,
99
],
[
99,
100
],
[
99,
101
],
[
77,
102
],
[
102,
103
],
[
8,
104
],
[
104,
105
],
[
105,
106
],
[
106,
107
],
[
106,
108
],
[
104,
109
],
[
109,
110
],
[
109,
111
],
[
104,
112
],
[
112,
113
],
[
113,
114
],
[
104,
115
],
[
115,
116
],
[
116,
117
],
[
117,
118
],
[
118,
119
],
[
118,
120
],
[
116,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
121,
125
],
[
125,
126
],
[
126,
127
],
[
126,
128
],
[
128,
129
],
[
128,
130
],
[
125,
131
],
[
125,
132
],
[
8,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
133,
138
],
[
148,
139
],
[
139,
140
],
[
139,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
139,
145
],
[
145,
146
],
[
0,
147
],
[
147,
148
],
[
147,
149
]
] | [
"import java.util.Scanner;\n\npublic class Main {\n\tvoid run() {\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\tboolean reverseElement = true;\n\t\tint count = 0;\n\t\twhile (reverseElement) {\n\t\t\treverseElement = 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 = 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\treverseElement = 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\tSystem.out.print(a[i] + (i != n - 1 ? \" \":\"\\n\"));\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}\n",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n\tvoid run() {\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\tboolean reverseElement = true;\n\t\tint count = 0;\n\t\twhile (reverseElement) {\n\t\t\treverseElement = 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 = 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\treverseElement = 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\tSystem.out.print(a[i] + (i != n - 1 ? \" \":\"\\n\"));\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main",
"void run() {\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\tboolean reverseElement = true;\n\t\tint count = 0;\n\t\twhile (reverseElement) {\n\t\t\treverseElement = 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 = 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\treverseElement = 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\tSystem.out.print(a[i] + (i != n - 1 ? \" \":\"\\n\"));\n\t\tSystem.out.println(count);\n\t}",
"run",
"{\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\tboolean reverseElement = true;\n\t\tint count = 0;\n\t\twhile (reverseElement) {\n\t\t\treverseElement = 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 = 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\treverseElement = 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\tSystem.out.print(a[i] + (i != n - 1 ? \" \":\"\\n\"));\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();",
"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",
"boolean reverseElement = true;",
"reverseElement",
"true",
"int count = 0;",
"count",
"0",
"while (reverseElement) {\n\t\t\treverseElement = 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 = 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\treverseElement = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"reverseElement",
"{\n\t\t\treverseElement = 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 = 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\treverseElement = true;\n\t\t\t\t\tcount++;\n\t\t\t\t}\n\t\t\t}\n\t\t}",
"reverseElement = false",
"reverseElement",
"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 = 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\treverseElement = 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 >= 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];\n\t\t\t\t\ta[j] = a[j - 1];\n\t\t\t\t\ta[j - 1] = tmp;\n\t\t\t\t\treverseElement = 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\treverseElement = 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\treverseElement = 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\treverseElement = 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",
"reverseElement = true",
"reverseElement",
"true",
"count++",
"count",
"for (int i = 0; i < n; i++)\n\t\t\tSystem.out.print(a[i] + (i != n - 1 ? \" \":\"\\n\"));",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"System.out.print(a[i] + (i != n - 1 ? \" \":\"\\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\"",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"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\tvoid run() {\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\tboolean reverseElement = true;\n\t\tint count = 0;\n\t\twhile (reverseElement) {\n\t\t\treverseElement = 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 = 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\treverseElement = 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\tSystem.out.print(a[i] + (i != n - 1 ? \" \":\"\\n\"));\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"public class Main {\n\tvoid run() {\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\tboolean reverseElement = true;\n\t\tint count = 0;\n\t\twhile (reverseElement) {\n\t\t\treverseElement = 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 = 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\treverseElement = 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\tSystem.out.print(a[i] + (i != n - 1 ? \" \":\"\\n\"));\n\t\tSystem.out.println(count);\n\t}\n\tpublic static void main(String[] args) {\n\t\tnew Main().run();\n\t}\n}",
"Main"
] | import java.util.Scanner;
public class Main {
void run() {
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 reverseElement = true;
int count = 0;
while (reverseElement) {
reverseElement = false;
for (int j = n - 1; j >= 1; j--) {
if (a[j] < a[j - 1]) {
int tmp = a[j];
a[j] = a[j - 1];
a[j - 1] = tmp;
reverseElement = true;
count++;
}
}
}
for (int i = 0; i < n; i++)
System.out.print(a[i] + (i != n - 1 ? " ":"\n"));
System.out.println(count);
}
public static void main(String[] args) {
new Main().run();
}
}
|
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
17,
41,
13,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
17,
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,
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,
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
],
[
155,
8
],
[
155,
9
],
[
9,
10
],
[
9,
11
],
[
11,
12
],
[
12,
13
],
[
12,
14
],
[
11,
15
],
[
15,
16
],
[
15,
17
],
[
17,
18
],
[
18,
19
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
28,
29
],
[
29,
30
],
[
29,
31
],
[
27,
32
],
[
32,
33
],
[
32,
34
],
[
27,
35
],
[
35,
36
],
[
36,
37
],
[
27,
38
],
[
39,
39
],
[
39,
40
],
[
40,
41
],
[
41,
42
],
[
41,
43
],
[
40,
44
],
[
44,
45
],
[
45,
46
],
[
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
],
[
58,
68
],
[
68,
69
],
[
69,
70
],
[
58,
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
],
[
11,
110
],
[
110,
111
],
[
111,
112
],
[
112,
113
],
[
112,
114
],
[
110,
115
],
[
115,
116
],
[
115,
117
],
[
11,
118
],
[
118,
119
],
[
119,
120
],
[
120,
121
],
[
120,
122
],
[
118,
123
],
[
123,
124
],
[
123,
125
],
[
118,
126
],
[
126,
127
],
[
127,
128
],
[
118,
129
],
[
130,
130
],
[
130,
131
],
[
131,
132
],
[
132,
133
],
[
133,
134
],
[
133,
135
],
[
131,
136
],
[
136,
137
],
[
136,
138
],
[
138,
139
],
[
138,
140
],
[
11,
141
],
[
141,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
11,
146
],
[
146,
147
],
[
147,
148
],
[
148,
149
],
[
148,
150
],
[
146,
151
],
[
9,
152
],
[
152,
153
],
[
0,
154
],
[
154,
155
],
[
154,
156
]
] | [
"import java.util.Scanner;\nimport java.util.*;\npublic class Main {\n public static void main(String[] args) {\n\tScanner stdin = new Scanner(System.in);\n\tint n = stdin.nextInt();\n\tint[] num = new int[100];\n\tint cnt = 0;\n\n\tfor ( int i = 0; i < n; i++ ){\n\t num[i] = stdin.nextInt();\n\t}\n\n\tint flag = 1;\n\twhile ( flag == 1 ){\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.print(num[0]);\n\tfor ( int i = 1; i < n; i++ ){\n\t System.out.print(\" \" + num[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(cnt);\n\n }\n}",
"import java.util.Scanner;",
"Scanner",
"java.util",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n public static void main(String[] args) {\n\tScanner stdin = new Scanner(System.in);\n\tint n = stdin.nextInt();\n\tint[] num = new int[100];\n\tint cnt = 0;\n\n\tfor ( int i = 0; i < n; i++ ){\n\t num[i] = stdin.nextInt();\n\t}\n\n\tint flag = 1;\n\twhile ( flag == 1 ){\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.print(num[0]);\n\tfor ( int i = 1; i < n; i++ ){\n\t System.out.print(\" \" + num[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(cnt);\n\n }\n}",
"Main",
"public static void main(String[] args) {\n\tScanner stdin = new Scanner(System.in);\n\tint n = stdin.nextInt();\n\tint[] num = new int[100];\n\tint cnt = 0;\n\n\tfor ( int i = 0; i < n; i++ ){\n\t num[i] = stdin.nextInt();\n\t}\n\n\tint flag = 1;\n\twhile ( flag == 1 ){\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.print(num[0]);\n\tfor ( int i = 1; i < n; i++ ){\n\t System.out.print(\" \" + num[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(cnt);\n\n }",
"main",
"{\n\tScanner stdin = new Scanner(System.in);\n\tint n = stdin.nextInt();\n\tint[] num = new int[100];\n\tint cnt = 0;\n\n\tfor ( int i = 0; i < n; i++ ){\n\t num[i] = stdin.nextInt();\n\t}\n\n\tint flag = 1;\n\twhile ( flag == 1 ){\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.print(num[0]);\n\tfor ( int i = 1; i < n; i++ ){\n\t System.out.print(\" \" + num[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(cnt);\n\n }",
"Scanner stdin = new Scanner(System.in);",
"stdin",
"new Scanner(System.in)",
"int n = stdin.nextInt();",
"n",
"stdin.nextInt()",
"stdin.nextInt",
"stdin",
"int[] num = new int[100];",
"num",
"new int[100]",
"100",
"int cnt = 0;",
"cnt",
"0",
"for ( int i = 0; i < n; i++ ){\n\t num[i] = stdin.nextInt();\n\t}",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t num[i] = stdin.nextInt();\n\t}",
"{\n\t num[i] = stdin.nextInt();\n\t}",
"num[i] = stdin.nextInt()",
"num[i]",
"num",
"i",
"stdin.nextInt()",
"stdin.nextInt",
"stdin",
"int flag = 1;",
"flag",
"1",
"while ( flag == 1 ){\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}",
"flag == 1",
"flag",
"1",
"{\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}",
"flag = 0",
"flag",
"0",
"for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\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 ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }",
"{\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }",
"if ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}",
"num[j] < num[j-1]",
"num[j]",
"num",
"j",
"num[j-1]",
"num",
"j-1",
"j",
"1",
"{\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\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",
"flag = 1",
"flag",
"1",
"cnt++",
"cnt",
"System.out.print(num[0])",
"System.out.print",
"System.out",
"System",
"System.out",
"num[0]",
"num",
"0",
"for ( int i = 1; i < n; i++ ){\n\t System.out.print(\" \" + num[i]);\n\t}",
"int i = 1;",
"int i = 1;",
"i",
"1",
"i < n",
"i",
"n",
"i++",
"i++",
"i",
"{\n\t System.out.print(\" \" + num[i]);\n\t}",
"{\n\t System.out.print(\" \" + num[i]);\n\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(cnt)",
"System.out.println",
"System.out",
"System",
"System.out",
"cnt",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n\tScanner stdin = new Scanner(System.in);\n\tint n = stdin.nextInt();\n\tint[] num = new int[100];\n\tint cnt = 0;\n\n\tfor ( int i = 0; i < n; i++ ){\n\t num[i] = stdin.nextInt();\n\t}\n\n\tint flag = 1;\n\twhile ( flag == 1 ){\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.print(num[0]);\n\tfor ( int i = 1; i < n; i++ ){\n\t System.out.print(\" \" + num[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(cnt);\n\n }\n}",
"public class Main {\n public static void main(String[] args) {\n\tScanner stdin = new Scanner(System.in);\n\tint n = stdin.nextInt();\n\tint[] num = new int[100];\n\tint cnt = 0;\n\n\tfor ( int i = 0; i < n; i++ ){\n\t num[i] = stdin.nextInt();\n\t}\n\n\tint flag = 1;\n\twhile ( flag == 1 ){\n\t flag = 0;\n\t for ( int j = n-1; j > 0; j-- ){\n\t\tif ( num[j] < num[j-1] ){\n\t\t int tmp = num[j];\n\t\t num[j] = num[j-1];\n\t\t num[j-1] = tmp;\n\t\t flag = 1;\n\t\t cnt++;\n\t\t}\n\t }\n\t}\n\n\tSystem.out.print(num[0]);\n\tfor ( int i = 1; i < n; i++ ){\n\t System.out.print(\" \" + num[i]);\n\t}\n\tSystem.out.println();\n\tSystem.out.println(cnt);\n\n }\n}",
"Main"
] | import java.util.Scanner;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int n = stdin.nextInt();
int[] num = new int[100];
int cnt = 0;
for ( int i = 0; i < n; i++ ){
num[i] = stdin.nextInt();
}
int flag = 1;
while ( flag == 1 ){
flag = 0;
for ( int j = n-1; j > 0; j-- ){
if ( num[j] < num[j-1] ){
int tmp = num[j];
num[j] = num[j-1];
num[j-1] = tmp;
flag = 1;
cnt++;
}
}
}
System.out.print(num[0]);
for ( int i = 1; i < n; i++ ){
System.out.print(" " + num[i]);
}
System.out.println();
System.out.println(cnt);
}
} |
[
7,
15,
13,
17,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
41,
13,
17,
41,
13,
40,
17,
41,
13,
17,
41,
13,
17,
11,
1,
0,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
0,
18,
13,
13,
4,
18,
13,
0,
13,
17,
41,
13,
2,
18,
13,
13,
17,
41,
13,
2,
13,
17,
42,
2,
13,
17,
30,
14,
2,
18,
13,
2,
13,
13,
18,
13,
2,
13,
13,
30,
0,
13,
18,
13,
2,
13,
13,
0,
18,
13,
2,
13,
13,
18,
13,
2,
13,
13,
0,
18,
13,
2,
13,
13,
13,
0,
13,
17,
0,
13,
17,
14,
2,
13,
2,
13,
13,
30,
0,
13,
17,
14,
2,
13,
2,
18,
13,
13,
17,
30,
3,
0,
13,
17,
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,
30,
4,
18,
18,
13,
13,
17,
4,
18,
18,
13,
13,
13,
30,
4,
18,
18,
13,
13,
17,
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
],
[
11,
20
],
[
20,
21
],
[
20,
22
],
[
11,
24
],
[
24,
25
],
[
24,
26
],
[
11,
27
],
[
27,
28
],
[
27,
29
],
[
29,
30
],
[
11,
31
],
[
31,
32
],
[
31,
33
],
[
11,
34
],
[
34,
35
],
[
34,
36
],
[
11,
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
],
[
11,
57
],
[
57,
58
],
[
57,
59
],
[
11,
60
],
[
60,
61
],
[
60,
62
],
[
62,
63
],
[
63,
64
],
[
63,
65
],
[
62,
66
],
[
11,
67
],
[
67,
68
],
[
67,
69
],
[
69,
70
],
[
69,
71
],
[
11,
72
],
[
72,
73
],
[
73,
74
],
[
73,
75
],
[
72,
76
],
[
76,
77
],
[
77,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
81,
82
],
[
81,
83
],
[
78,
84
],
[
84,
85
],
[
84,
86
],
[
86,
87
],
[
86,
88
],
[
77,
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
],
[
105,
106
],
[
105,
107
],
[
89,
108
],
[
108,
109
],
[
109,
110
],
[
109,
111
],
[
111,
112
],
[
111,
113
],
[
108,
114
],
[
89,
115
],
[
115,
116
],
[
115,
117
],
[
76,
118
],
[
118,
119
],
[
118,
120
],
[
76,
121
],
[
121,
122
],
[
122,
123
],
[
122,
124
],
[
124,
125
],
[
124,
126
],
[
121,
127
],
[
127,
128
],
[
128,
129
],
[
128,
130
],
[
127,
131
],
[
131,
132
],
[
132,
133
],
[
132,
134
],
[
134,
135
],
[
135,
136
],
[
135,
137
],
[
134,
138
],
[
131,
139
],
[
139,
140
],
[
127,
141
],
[
141,
142
],
[
141,
143
],
[
11,
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
],
[
159,
160
],
[
159,
161
],
[
157,
162
],
[
162,
163
],
[
162,
164
],
[
156,
165
],
[
165,
166
],
[
166,
167
],
[
166,
168
],
[
168,
169
],
[
168,
170
],
[
165,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
174,
175
],
[
174,
176
],
[
172,
177
],
[
171,
178
],
[
178,
179
],
[
179,
180
],
[
180,
181
],
[
180,
182
],
[
178,
183
],
[
165,
184
],
[
184,
185
],
[
185,
186
],
[
186,
187
],
[
187,
188
],
[
187,
189
],
[
185,
190
],
[
9,
191
],
[
191,
192
]
] | [
"import java.io.IOException;\nimport java.util.Scanner;\nclass Main{\n\tpublic static void main(String[] args)throws NumberFormatException, IOException{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint times = scan.nextInt();\n\t\tint num[] =new int[times];\n\t\tint temp = 0; \n\t\tint finir = -1;\n\t\tint irekae = 0;\n\t\tint i = 0;\n\t\tfor(i=0;i<times;i++){\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\t\ti = 0;\n\t\tint bot = num.length-1;\n\t\tint pre = bot-1;\n\t\twhile (times != 1){\n\t\t\tif(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}\n\t\t\t\n\t\t\ti += 1;\n\t\t\t\n\t\t\tif(finir == pre-i){//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<times;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n}",
"import java.io.IOException;",
"IOException",
"java.io",
"import java.util.Scanner;",
"Scanner",
"java.util",
"class Main{\n\tpublic static void main(String[] args)throws NumberFormatException, IOException{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint times = scan.nextInt();\n\t\tint num[] =new int[times];\n\t\tint temp = 0; \n\t\tint finir = -1;\n\t\tint irekae = 0;\n\t\tint i = 0;\n\t\tfor(i=0;i<times;i++){\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\t\ti = 0;\n\t\tint bot = num.length-1;\n\t\tint pre = bot-1;\n\t\twhile (times != 1){\n\t\t\tif(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}\n\t\t\t\n\t\t\ti += 1;\n\t\t\t\n\t\t\tif(finir == pre-i){//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<times;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\t\n\t\t}\n\t}\n}",
"Main",
"public static void main(String[] args)throws NumberFormatException, IOException{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint times = scan.nextInt();\n\t\tint num[] =new int[times];\n\t\tint temp = 0; \n\t\tint finir = -1;\n\t\tint irekae = 0;\n\t\tint i = 0;\n\t\tfor(i=0;i<times;i++){\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\t\ti = 0;\n\t\tint bot = num.length-1;\n\t\tint pre = bot-1;\n\t\twhile (times != 1){\n\t\t\tif(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}\n\t\t\t\n\t\t\ti += 1;\n\t\t\t\n\t\t\tif(finir == pre-i){//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<times;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\t\n\t\t}\n\t}",
"main",
"{\n//\t\tSystem.out.println(\" \");\n\t\tScanner scan = new Scanner(System.in);\n\t\tint times = scan.nextInt();\n\t\tint num[] =new int[times];\n\t\tint temp = 0; \n\t\tint finir = -1;\n\t\tint irekae = 0;\n\t\tint i = 0;\n\t\tfor(i=0;i<times;i++){\n\t\t\tnum[i] = scan.nextInt();\n\t\t}\n\t\ti = 0;\n\t\tint bot = num.length-1;\n\t\tint pre = bot-1;\n\t\twhile (times != 1){\n\t\t\tif(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}\n\t\t\t\n\t\t\ti += 1;\n\t\t\t\n\t\t\tif(finir == pre-i){//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t\tfor(i=0;i<times;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\t\n\t\t}\n\t}",
"Scanner scan = new Scanner(System.in);",
"scan",
"new Scanner(System.in)",
"int times = scan.nextInt();",
"times",
"scan.nextInt()",
"scan.nextInt",
"scan",
"int num[] =new int[times];",
"num",
"new int[times]",
"times",
"int temp = 0;",
"temp",
"0",
"int finir = -1;",
"finir",
"-1",
"1",
"int irekae = 0;",
"irekae",
"0",
"int i = 0;",
"i",
"0",
"for(i=0;i<times;i++){\n\t\t\tnum[i] = scan.nextInt();\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<times",
"i",
"times",
"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",
"i = 0",
"i",
"0",
"int bot = num.length-1;",
"bot",
"num.length-1",
"num.length",
"num",
"num.length",
"1",
"int pre = bot-1;",
"pre",
"bot-1",
"bot",
"1",
"while (times != 1){\n\t\t\tif(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}\n\t\t\t\n\t\t\ti += 1;\n\t\t\t\n\t\t\tif(finir == pre-i){//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}",
"times != 1",
"times",
"1",
"{\n\t\t\tif(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}\n\t\t\t\n\t\t\ti += 1;\n\t\t\t\n\t\t\tif(finir == pre-i){//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}",
"if(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}",
"num[pre - i] > num[bot -i]",
"num[pre - i]",
"num",
"pre - i",
"pre",
"i",
"num[bot -i]",
"num",
"bot -i",
"bot",
"i",
"{//???????°?2????????????????°?????????\\????????????\n//\t\t\t\tSystem.out.println(\"irekae\"+num[pre-i]+\" \"+num[bot-i]);\n\t\t\t\ttemp = num[bot-i];\n\t\t\t\tnum[bot-i] = num[pre-i];\n\t\t\t\tnum[pre-i] = temp;\n\t\t\t\tirekae += 1;\n\t\t\t}",
"temp = num[bot-i]",
"temp",
"num[bot-i]",
"num",
"bot-i",
"bot",
"i",
"num[bot-i] = num[pre-i]",
"num[bot-i]",
"num",
"bot-i",
"bot",
"i",
"num[pre-i]",
"num",
"pre-i",
"pre",
"i",
"num[pre-i] = temp",
"num[pre-i]",
"num",
"pre-i",
"pre",
"i",
"temp",
"irekae += 1",
"irekae",
"1",
"i += 1",
"i",
"1",
"if(finir == pre-i){//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}",
"finir == pre-i",
"finir",
"pre-i",
"pre",
"i",
"{//???-1????????????????????\\?????????????°??????????\n\t\t\t\tfinir += 1;\n//\t\t\t\tSystem.out.println(\"finir \"+finir);\n\t\t\t\tif(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti = 0;\n\t\t\t}",
"finir += 1",
"finir",
"1",
"if(finir == num.length-2){\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"finir == num.length-2",
"finir",
"num.length-2",
"num.length",
"num",
"num.length",
"2",
"{\n\t\t\t\t\tbreak;\n\t\t\t\t}",
"break;",
"i = 0",
"i",
"0",
"for(i=0;i<times;i++){\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\t\n\t\t}",
"i=0;",
"i=0",
"i",
"0",
"i<times",
"i",
"times",
"i++",
"i++",
"i",
"{\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\t\n\t\t}",
"{\n\t\t\tSystem.out.print(num[i]);\n\t\t\tif(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}\n\t\t\t\n\t\t}",
"System.out.print(num[i])",
"System.out.print",
"System.out",
"System",
"System.out",
"num[i]",
"num",
"i",
"if(i == times-1){\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"i == times-1",
"i",
"times-1",
"times",
"1",
"{\n\t\t\t\tSystem.out.println(\"\");\n\t\t\t\tSystem.out.println(irekae);\n\t\t\t}",
"System.out.println(\"\")",
"System.out.println",
"System.out",
"System",
"System.out",
"\"\"",
"System.out.println(irekae)",
"System.out.println",
"System.out",
"System",
"System.out",
"irekae",
"{\n\t\t\t\tSystem.out.print(\" \");\n\t\t\t}",
"System.out.print(\" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"\" \"",
"String[] args",
"args"
] | import java.io.IOException;
import java.util.Scanner;
class Main{
public static void main(String[] args)throws NumberFormatException, IOException{
// System.out.println(" ");
Scanner scan = new Scanner(System.in);
int times = scan.nextInt();
int num[] =new int[times];
int temp = 0;
int finir = -1;
int irekae = 0;
int i = 0;
for(i=0;i<times;i++){
num[i] = scan.nextInt();
}
i = 0;
int bot = num.length-1;
int pre = bot-1;
while (times != 1){
if(num[pre - i] > num[bot -i]){//???????°?2????????????????°?????????\????????????
// System.out.println("irekae"+num[pre-i]+" "+num[bot-i]);
temp = num[bot-i];
num[bot-i] = num[pre-i];
num[pre-i] = temp;
irekae += 1;
}
i += 1;
if(finir == pre-i){//???-1????????????????????\?????????????°??????????
finir += 1;
// System.out.println("finir "+finir);
if(finir == num.length-2){
break;
}
i = 0;
}
}
for(i=0;i<times;i++){
System.out.print(num[i]);
if(i == times-1){
System.out.println("");
System.out.println(irekae);
}
else{
System.out.print(" ");
}
}
}
} |
[
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,
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,
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,
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
],
[
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
],
[
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
],
[
61,
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
],
[
92,
116
],
[
116,
117
],
[
116,
118
],
[
8,
119
],
[
119,
120
],
[
120,
121
],
[
121,
122
],
[
121,
123
],
[
119,
124
],
[
124,
125
],
[
124,
126
],
[
126,
127
],
[
126,
128
],
[
119,
129
],
[
129,
130
],
[
130,
131
],
[
119,
132
],
[
133,
133
],
[
133,
134
],
[
134,
135
],
[
135,
136
],
[
136,
137
],
[
136,
138
],
[
134,
139
],
[
139,
140
],
[
139,
141
],
[
133,
142
],
[
142,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
145,
149
],
[
142,
150
],
[
150,
151
],
[
151,
152
],
[
152,
153
],
[
153,
154
],
[
153,
155
],
[
151,
156
],
[
8,
157
],
[
157,
158
],
[
158,
159
],
[
159,
160
],
[
159,
161
],
[
8,
162
],
[
162,
163
],
[
163,
164
],
[
164,
165
],
[
164,
166
],
[
162,
167
],
[
6,
168
],
[
168,
169
],
[
0,
170
],
[
170,
171
],
[
170,
172
]
] | [
"\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int num = Integer.parseInt(sc.nextLine());\n\n String[] a = sc.nextLine().split(\" \");\n int[] array = new int[num];\n for (int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(a[i]);\n }\n\n int changeCount = 0;\n\n boolean loopFlg = true;\n while (loopFlg) {\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }\n \n for (int i = 0; i < array.length; i++) {\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }\n System.out.println();\n\n System.out.println(changeCount);\n }\n}\n\n/**\n1 bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A\n2 flag = 1 // 逆の隣接要素が存在する\n3 while flag\n4 flag = 0\n5 for j が N-1 から 1 まで\n6 if A[j] < A[j-1]\n7 A[j] と A[j-1] を交換\n8 flag = 1\n\n入力例 1\n5\n5 3 2 4 1\n出力例 1\n1 2 3 4 5\n8\n */",
"import java.util.Scanner;",
"Scanner",
"java.util",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int num = Integer.parseInt(sc.nextLine());\n\n String[] a = sc.nextLine().split(\" \");\n int[] array = new int[num];\n for (int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(a[i]);\n }\n\n int changeCount = 0;\n\n boolean loopFlg = true;\n while (loopFlg) {\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }\n \n for (int i = 0; i < array.length; i++) {\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }\n System.out.println();\n\n System.out.println(changeCount);\n }\n}",
"Main",
"public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int num = Integer.parseInt(sc.nextLine());\n\n String[] a = sc.nextLine().split(\" \");\n int[] array = new int[num];\n for (int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(a[i]);\n }\n\n int changeCount = 0;\n\n boolean loopFlg = true;\n while (loopFlg) {\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }\n \n for (int i = 0; i < array.length; i++) {\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }\n System.out.println();\n\n System.out.println(changeCount);\n }",
"main",
"{\n\n Scanner sc = new Scanner(System.in);\n int num = Integer.parseInt(sc.nextLine());\n\n String[] a = sc.nextLine().split(\" \");\n int[] array = new int[num];\n for (int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(a[i]);\n }\n\n int changeCount = 0;\n\n boolean loopFlg = true;\n while (loopFlg) {\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }\n \n for (int i = 0; i < array.length; i++) {\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }\n System.out.println();\n\n System.out.println(changeCount);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int num = Integer.parseInt(sc.nextLine());",
"num",
"Integer.parseInt(sc.nextLine())",
"Integer.parseInt",
"Integer",
"sc.nextLine()",
"sc.nextLine",
"sc",
"String[] a = sc.nextLine().split(\" \");",
"a",
"sc.nextLine().split(\" \")",
"sc.nextLine().split",
"sc.nextLine()",
"sc.nextLine",
"sc",
"\" \"",
"int[] array = new int[num];",
"array",
"new int[num]",
"num",
"for (int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(a[i]);\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < num",
"i",
"num",
"i++",
"i++",
"i",
"{\n array[i] = Integer.parseInt(a[i]);\n }",
"{\n array[i] = Integer.parseInt(a[i]);\n }",
"array[i] = Integer.parseInt(a[i])",
"array[i]",
"array",
"i",
"Integer.parseInt(a[i])",
"Integer.parseInt",
"Integer",
"a[i]",
"a",
"i",
"int changeCount = 0;",
"changeCount",
"0",
"boolean loopFlg = true;",
"loopFlg",
"true",
"while (loopFlg) {\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }",
"loopFlg",
"{\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }",
"loopFlg = false",
"loopFlg",
"false",
"for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }",
"int i = num - 1;",
"int i = num - 1;",
"i",
"num - 1",
"num",
"1",
"i >= 1",
"i",
"1",
"i--",
"i--",
"i",
"{\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }",
"{\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }",
"if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }",
"array[i] < array[i-1]",
"array[i]",
"array",
"i",
"array[i-1]",
"array",
"i-1",
"i",
"1",
"{\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }",
"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",
"changeCount++",
"changeCount",
"loopFlg = true",
"loopFlg",
"true",
"for (int i = 0; i < array.length; i++) {\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < array.length",
"i",
"array.length",
"array",
"array.length",
"i++",
"i++",
"i",
"{\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }",
"{\n System.out.print(array[i]);\n if (i!=array.length-1) {\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!=array.length-1) {\n System.out.print(\" \");\n }",
"i!=array.length-1",
"i",
"array.length-1",
"array.length",
"array",
"array.length",
"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(changeCount)",
"System.out.println",
"System.out",
"System",
"System.out",
"changeCount",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int num = Integer.parseInt(sc.nextLine());\n\n String[] a = sc.nextLine().split(\" \");\n int[] array = new int[num];\n for (int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(a[i]);\n }\n\n int changeCount = 0;\n\n boolean loopFlg = true;\n while (loopFlg) {\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }\n \n for (int i = 0; i < array.length; i++) {\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }\n System.out.println();\n\n System.out.println(changeCount);\n }\n}",
"public class Main {\n public static void main(String[] args) {\n\n Scanner sc = new Scanner(System.in);\n int num = Integer.parseInt(sc.nextLine());\n\n String[] a = sc.nextLine().split(\" \");\n int[] array = new int[num];\n for (int i = 0; i < num; i++) {\n array[i] = Integer.parseInt(a[i]);\n }\n\n int changeCount = 0;\n\n boolean loopFlg = true;\n while (loopFlg) {\n loopFlg = false;\n for (int i = num - 1; i >= 1; i--) {\n if (array[i] < array[i-1]) {\n int tmp = array[i];\n array[i] = array[i-1];\n array[i-1] = tmp;\n changeCount++;\n loopFlg = true;\n }\n }\n \n }\n \n for (int i = 0; i < array.length; i++) {\n System.out.print(array[i]);\n if (i!=array.length-1) {\n System.out.print(\" \");\n }\n }\n System.out.println();\n\n System.out.println(changeCount);\n }\n}",
"Main"
] |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = Integer.parseInt(sc.nextLine());
String[] a = sc.nextLine().split(" ");
int[] array = new int[num];
for (int i = 0; i < num; i++) {
array[i] = Integer.parseInt(a[i]);
}
int changeCount = 0;
boolean loopFlg = true;
while (loopFlg) {
loopFlg = 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;
changeCount++;
loopFlg = true;
}
}
}
for (int i = 0; i < array.length; i++) {
System.out.print(array[i]);
if (i!=array.length-1) {
System.out.print(" ");
}
}
System.out.println();
System.out.println(changeCount);
}
}
/**
1 bubbleSort(A, N) // N 個の要素を含む 0-オリジンの配列 A
2 flag = 1 // 逆の隣接要素が存在する
3 while flag
4 flag = 0
5 for j が N-1 から 1 まで
6 if A[j] < A[j-1]
7 A[j] と A[j-1] を交換
8 flag = 1
入力例 1
5
5 3 2 4 1
出力例 1
1 2 3 4 5
8
*/
|
[
7,
15,
13,
17,
6,
13,
12,
13,
30,
41,
13,
20,
41,
13,
17,
41,
13,
4,
18,
13,
41,
13,
0,
13,
20,
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,
41,
13,
13,
11,
1,
41,
13,
2,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
30,
0,
13,
13,
14,
2,
13,
13,
30,
41,
13,
18,
13,
13,
0,
18,
13,
13,
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
],
[
157,
5
],
[
157,
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
],
[
27,
28
],
[
28,
29
],
[
28,
30
],
[
26,
31
],
[
31,
32
],
[
31,
33
],
[
26,
34
],
[
34,
35
],
[
35,
36
],
[
26,
37
],
[
38,
38
],
[
38,
39
],
[
39,
40
],
[
40,
41
],
[
40,
42
],
[
39,
43
],
[
43,
44
],
[
44,
45
],
[
8,
46
],
[
46,
47
],
[
47,
48
],
[
48,
49
],
[
48,
50
],
[
46,
51
],
[
51,
52
],
[
51,
53
],
[
46,
54
],
[
54,
55
],
[
55,
56
],
[
46,
57
],
[
58,
58
],
[
58,
59
],
[
59,
60
],
[
59,
61
],
[
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
],
[
77,
85
],
[
85,
86
],
[
86,
87
],
[
86,
88
],
[
58,
89
],
[
89,
90
],
[
90,
91
],
[
90,
92
],
[
89,
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
],
[
93,
106
],
[
106,
107
],
[
107,
108
],
[
107,
109
],
[
106,
110
],
[
93,
111
],
[
111,
112
],
[
8,
113
],
[
113,
114
],
[
114,
115
],
[
115,
116
],
[
115,
117
],
[
113,
118
],
[
118,
119
],
[
118,
120
],
[
120,
121
],
[
120,
122
],
[
113,
123
],
[
123,
124
],
[
124,
125
],
[
113,
126
],
[
127,
127
],
[
127,
128
],
[
128,
129
],
[
129,
130
],
[
130,
131
],
[
130,
132
],
[
128,
133
],
[
133,
134
],
[
134,
135
],
[
134,
136
],
[
133,
137
],
[
8,
138
],
[
138,
139
],
[
139,
140
],
[
140,
141
],
[
140,
142
],
[
138,
143
],
[
143,
144
],
[
143,
145
],
[
145,
146
],
[
145,
147
],
[
8,
148
],
[
148,
149
],
[
149,
150
],
[
150,
151
],
[
150,
152
],
[
148,
153
],
[
6,
154
],
[
154,
155
],
[
0,
156
],
[
156,
157
],
[
156,
158
]
] | [
"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 count = 0;\n int N = sc.nextInt();\n int[] x;\n x = new int[100];\n\n for (int i = 0; i < N; i++) {\n x[i] = sc.nextInt();\n }\n\n for (int i = 0; i < N; i++) {\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }\n\n for (int i = 0; i < N - 1; i++) {\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N - 1]);\n System.out.println(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\n int count = 0;\n int N = sc.nextInt();\n int[] x;\n x = new int[100];\n\n for (int i = 0; i < N; i++) {\n x[i] = sc.nextInt();\n }\n\n for (int i = 0; i < N; i++) {\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }\n\n for (int i = 0; i < N - 1; i++) {\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N - 1]);\n System.out.println(count);\n }\n}",
"Main",
"public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int N = sc.nextInt();\n int[] x;\n x = new int[100];\n\n for (int i = 0; i < N; i++) {\n x[i] = sc.nextInt();\n }\n\n for (int i = 0; i < N; i++) {\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }\n\n for (int i = 0; i < N - 1; i++) {\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N - 1]);\n System.out.println(count);\n }",
"main",
"{\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int N = sc.nextInt();\n int[] x;\n x = new int[100];\n\n for (int i = 0; i < N; i++) {\n x[i] = sc.nextInt();\n }\n\n for (int i = 0; i < N; i++) {\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }\n\n for (int i = 0; i < N - 1; i++) {\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N - 1]);\n System.out.println(count);\n }",
"Scanner sc = new Scanner(System.in);",
"sc",
"new Scanner(System.in)",
"int count = 0;",
"count",
"0",
"int N = sc.nextInt();",
"N",
"sc.nextInt()",
"sc.nextInt",
"sc",
"int[] x;",
"x",
"x = new int[100]",
"x",
"new int[100]",
"100",
"for (int i = 0; i < N; i++) {\n x[i] = sc.nextInt();\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n x[i] = sc.nextInt();\n }",
"{\n x[i] = sc.nextInt();\n }",
"x[i] = sc.nextInt()",
"x[i]",
"x",
"i",
"sc.nextInt()",
"sc.nextInt",
"sc",
"for (int i = 0; i < N; i++) {\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }",
"{\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }",
"int minj = i;",
"minj",
"i",
"for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }",
"int j = i+1;",
"int j = i+1;",
"j",
"i+1",
"i",
"1",
"j < N",
"j",
"N",
"j++",
"j++",
"j",
"{\n if (x[minj] > x[j]) {\n minj = j;\n }\n }",
"{\n if (x[minj] > x[j]) {\n minj = j;\n }\n }",
"if (x[minj] > x[j]) {\n minj = j;\n }",
"x[minj] > x[j]",
"x[minj]",
"x",
"minj",
"x[j]",
"x",
"j",
"{\n minj = j;\n }",
"minj = j",
"minj",
"j",
"if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }",
"minj != i",
"minj",
"i",
"{\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }",
"int temp = x[i];",
"temp",
"x[i]",
"x",
"i",
"x[i] = x[minj]",
"x[i]",
"x",
"i",
"x[minj]",
"x",
"minj",
"x[minj] = temp",
"x[minj]",
"x",
"minj",
"temp",
"count++",
"count",
"for (int i = 0; i < N - 1; i++) {\n System.out.print(x[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(x[i] + \" \");\n }",
"{\n System.out.print(x[i] + \" \");\n }",
"System.out.print(x[i] + \" \")",
"System.out.print",
"System.out",
"System",
"System.out",
"x[i] + \" \"",
"x[i]",
"x",
"i",
"\" \"",
"System.out.println(x[N - 1])",
"System.out.println",
"System.out",
"System",
"System.out",
"x[N - 1]",
"x",
"N - 1",
"N",
"1",
"System.out.println(count)",
"System.out.println",
"System.out",
"System",
"System.out",
"count",
"String[] args",
"args",
"public class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n\n int count = 0;\n int N = sc.nextInt();\n int[] x;\n x = new int[100];\n\n for (int i = 0; i < N; i++) {\n x[i] = sc.nextInt();\n }\n\n for (int i = 0; i < N; i++) {\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }\n\n for (int i = 0; i < N - 1; i++) {\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N - 1]);\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\n int count = 0;\n int N = sc.nextInt();\n int[] x;\n x = new int[100];\n\n for (int i = 0; i < N; i++) {\n x[i] = sc.nextInt();\n }\n\n for (int i = 0; i < N; i++) {\n int minj = i;\n for (int j = i+1; j < N; j++) {\n if (x[minj] > x[j]) {\n minj = j;\n }\n }\n\n if (minj != i) {\n int temp = x[i];\n x[i] = x[minj];\n x[minj] = temp;\n count++;\n }\n }\n\n for (int i = 0; i < N - 1; i++) {\n System.out.print(x[i] + \" \");\n }\n System.out.println(x[N - 1]);\n System.out.println(count);\n }\n}",
"Main"
] | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = 0;
int N = sc.nextInt();
int[] x;
x = new int[100];
for (int i = 0; i < N; i++) {
x[i] = sc.nextInt();
}
for (int i = 0; i < N; i++) {
int minj = i;
for (int j = i+1; j < N; j++) {
if (x[minj] > x[j]) {
minj = j;
}
}
if (minj != i) {
int temp = x[i];
x[i] = x[minj];
x[minj] = temp;
count++;
}
}
for (int i = 0; i < N - 1; i++) {
System.out.print(x[i] + " ");
}
System.out.println(x[N - 1]);
System.out.println(count);
}
}
|
[
7,
15,
13,
17,
6,
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,
17,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
30,
41,
13,
13,
11,
1,
41,
13,
13,
2,
13,
13,
1,
40,
13,
30,
30,
14,
2,
18,
13,
13,
18,
13,
13,
0,
13,
13,
14,
2,
13,
13,
30,
4,
13,
13,
13,
13,
40,
13,
29,
13,
23,
13,
23,
13,
12,
13,
30,
41,
13,
20,
41,
13,
4,
18,
13,
41,
13,
20,
13,
11,
1,
41,
13,
17,
2,
13,
13,
1,
40,
13,
30,
0,
18,
13,
13,
4,
18,
13,
41,
13,
4,
13,
13,
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,
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
],
[
11,
12
],
[
11,
13
],
[
8,
14
],
[
14,
15
],
[
15,
16
],
[
15,
17
],
[
14,
18
],
[
18,
19
],
[
18,
20
],
[
8,
21
],
[
21,
22
],
[
22,
23
],
[
22,
24
],
[
21,
25
],
[
6,
26
],
[
26,
27
],
[
6,
28
],
[
28,
29
],
[
6,
30
],
[
30,
31
],
[
180,
32
],
[
32,
33
],
[
32,
34
],
[
34,
35
],
[
35,
36
],
[
35,
37
],
[
34,
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
],
[
50,
54
],
[
54,
55
],
[
55,
56
],
[
56,
57
],
[
56,
58
],
[
54,
59
],
[
59,
60
],
[
59,
61
],
[
54,
62
],
[
62,
63
],
[
63,
64
],
[
54,
65
],
[
66,
66
],
[
66,
67
],
[
67,
68
],
[
68,
69
],
[
69,
70
],
[
69,
71
],
[
68,
72
],
[
72,
73
],
[
72,
74
],
[
67,
75
],
[
75,
76
],
[
75,
77
],
[
50,
78
],
[
78,
79
],
[
79,
80
],
[
79,
81
],
[
78,
82
],
[
82,
83
],
[
83,
84
],
[
83,
85
],
[
83,
86
],
[
83,
87
],
[
82,
88
],
[
88,
89
],
[
34,
90
],
[
90,
91
],
[
32,
92
],
[
92,
93
],
[
32,
94
],
[
94,
95
],
[
180,
96
],
[
96,
97
],
[
96,
98
],
[
98,
99
],
[
99,
100
],
[
99,
101
],
[
98,
102
],
[
102,
103
],
[
102,
104
],
[
104,
105
],
[
105,
106
],
[
98,
107
],
[
107,
108
],
[
107,
109
],
[
98,
111
],
[
111,
112
],
[
112,
113
],
[
113,
114
],
[
113,
115
],
[
111,
116
],
[
116,
117
],
[
116,
118
],
[
111,
119
],
[
119,
120
],
[
120,
121
],
[
111,
122
],
[
122,
123
],
[
123,
124
],
[
124,
125
],
[
124,
126
],
[
123,
127
],
[
127,
128
],
[
128,
129
],
[
98,
130
],
[
130,
131
],
[
130,
132
],
[
132,
133
],
[
132,
134
],
[
132,
135
],
[
98,
136
],
[
136,
137
],
[
137,
138
],
[
138,
139
],
[
138,
140
],
[
136,
141
],
[
141,
142
],
[
141,
143
],
[
98,
144
],
[
144,
145
],
[
145,
146
],
[
146,
147
],
[
146,
148
],
[
144,
149
],
[
149,
150
],
[
149,
151
],
[
144,
152
],
[
152,
153
],
[
153,
154
],
[
144,
155
],
[
155,
156
],
[
156,
157
],
[
157,
158
],
[
158,
159
],
[
158,
160
],
[
156,
161
],
[
161,
162
],
[
161,
163
],
[
163,
164
],
[
163,
165
],
[
98,
166
],
[
166,
167
],
[
167,
168
],
[
168,
169
],
[
168,
170
],
[
98,
171
],
[
171,
172
],
[
172,
173
],
[
173,
174
],
[
173,
175
],
[
171,
176
],
[
96,
177
],
[
177,
178
],
[
0,
179
],
[
179,
180
],
[
179,
181
]
] | [
"import java.util.*;\n\npublic class Main {\n static void swap(int[] A, int i, int j) {\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }\n\n static int selectionSort(int[] A, int N) {\n int count = 0;\n for(int i = 0; i < N; i++) {\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n } \n return count;\n }\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++) a[i] = sc.nextInt();\n\n int c = selectionSort(a, 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(c);\n }\n}",
"import java.util.*;",
"util.*",
"java",
"public class Main {\n static void swap(int[] A, int i, int j) {\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }\n\n static int selectionSort(int[] A, int N) {\n int count = 0;\n for(int i = 0; i < N; i++) {\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n } \n return count;\n }\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++) a[i] = sc.nextInt();\n\n int c = selectionSort(a, 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(c);\n }\n}",
"Main",
"static void swap(int[] A, int i, int j) {\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }",
"swap",
"{\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }",
"int tmp = A[i];",
"tmp",
"A[i]",
"A",
"i",
"A[i] = A[j]",
"A[i]",
"A",
"i",
"A[j]",
"A",
"j",
"A[j] = tmp",
"A[j]",
"A",
"j",
"tmp",
"int[] A",
"A",
"int i",
"i",
"int j",
"j",
"static int selectionSort(int[] A, int N) {\n int count = 0;\n for(int i = 0; i < N; i++) {\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n } \n return count;\n }",
"selectionSort",
"{\n int count = 0;\n for(int i = 0; i < N; i++) {\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n } \n return count;\n }",
"int count = 0;",
"count",
"0",
"for(int i = 0; i < N; i++) {\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n }",
"int i = 0;",
"int i = 0;",
"i",
"0",
"i < N",
"i",
"N",
"i++",
"i++",
"i",
"{\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n }",
"{\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n }",
"int minj = i;",
"minj",
"i",
"for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }",
"int j = i;",
"int j = i;",
"j",
"i",
"j < N",
"j",
"N",
"j++",
"j++",
"j",
"{\n if(A[j] < A[minj]) minj = j;\n }",
"{\n if(A[j] < A[minj]) minj = j;\n }",
"if(A[j] < A[minj]) minj = j;",
"A[j] < A[minj]",
"A[j]",
"A",
"j",
"A[minj]",
"A",
"minj",
"minj = j",
"minj",
"j",
"if(i != minj) {\n swap(A, i, minj);\n count++;\n }",
"i != minj",
"i",
"minj",
"{\n swap(A, i, minj);\n count++;\n }",
"swap(A, i, minj)",
"swap",
"A",
"i",
"minj",
"count++",
"count",
"return count;",
"count",
"int[] A",
"A",
"int 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++) a[i] = sc.nextInt();\n\n int c = selectionSort(a, 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(c);\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++) a[i] = sc.nextInt();\n\n int c = selectionSort(a, 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(c);\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++) 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 c = selectionSort(a, n);",
"c",
"selectionSort(a, n)",
"selectionSort",
"a",
"n",
"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(c)",
"System.out.println",
"System.out",
"System",
"System.out",
"c",
"String[] args",
"args",
"public class Main {\n static void swap(int[] A, int i, int j) {\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }\n\n static int selectionSort(int[] A, int N) {\n int count = 0;\n for(int i = 0; i < N; i++) {\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n } \n return count;\n }\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++) a[i] = sc.nextInt();\n\n int c = selectionSort(a, 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(c);\n }\n}",
"public class Main {\n static void swap(int[] A, int i, int j) {\n int tmp = A[i];\n A[i] = A[j];\n A[j] = tmp;\n }\n\n static int selectionSort(int[] A, int N) {\n int count = 0;\n for(int i = 0; i < N; i++) {\n int minj = i;\n for(int j = i; j < N; j++) {\n if(A[j] < A[minj]) minj = j;\n }\n if(i != minj) {\n swap(A, i, minj);\n count++;\n }\n } \n return count;\n }\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++) a[i] = sc.nextInt();\n\n int c = selectionSort(a, 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(c);\n }\n}",
"Main"
] | import java.util.*;
public class Main {
static void swap(int[] A, int i, int j) {
int tmp = A[i];
A[i] = A[j];
A[j] = tmp;
}
static int selectionSort(int[] A, int N) {
int count = 0;
for(int i = 0; i < N; i++) {
int minj = i;
for(int j = i; j < N; j++) {
if(A[j] < A[minj]) minj = j;
}
if(i != minj) {
swap(A, i, minj);
count++;
}
}
return count;
}
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 c = selectionSort(a, n);
System.out.print(a[0]);
for(int i = 1; i < n; i++) System.out.print(" " + a[i]);
System.out.println();
System.out.println(c);
}
}
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.