File size: 327,388 Bytes
6b35a81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] list) {\n        if (list == null || list.length == 0) {\n            throw new IllegalArgumentException(\"list must not be null or empty\");\n        }\n        int max = list[0];\n        for (int v : list) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_new(String nums) {\n        try {\n            return Integer.parseInt(nums);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + nums);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int s, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) s / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String value) {\n        if (value == null) {\n            return null;\n        }\n        return new StringBuilder(value).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int input, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) input / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int s) {\n        if (s < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= s; i++) {\n            if (s % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] value) {\n        if (value == null || value.length == 0) {\n            throw new IllegalArgumentException(\"value must not be null or empty\");\n        }\n        int max = value[0];\n        for (int v : value) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String n) {\n        try {\n            return Integer.parseInt(n);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + n);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int value, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) value / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] str) {\n        if (str == null || str.length == 0) {\n            throw new IllegalArgumentException(\"str must not be null or empty\");\n        }\n        int max = str[0];\n        for (int v : str) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] value) {\n        if (value == null || value.length == 0) {\n            throw new IllegalArgumentException(\"value must not be null or empty\");\n        }\n        int max = value[0];\n        for (int v : value) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String n) {\n        if (n == null) {\n            return null;\n        }\n        return new StringBuilder(n).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int str, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) str / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String arr) {\n        if (arr == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : arr.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] arr) {\n        if (arr == null || arr.length == 0) {\n            throw new IllegalArgumentException(\"arr must not be null or empty\");\n        }\n        int max = arr[0];\n        for (int v : arr) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int n) {\n        if (n < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= n; i++) {\n            if (n % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> text, List<Integer> arr) {\n        if (text == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(text.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < arr.size()) {\n            if (text.get(i) <= arr.get(j)) {\n                text.add(text.get(i++));\n            } else {\n                text.add(arr.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            text.add(text.get(i++));\n        }\n        while (j < arr.size()) {\n            text.add(arr.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String input) {\n        try {\n            return Integer.parseInt(input);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + input);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int text) {\n        if (text < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= text; i++) {\n            if (text % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String n) {\n        try {\n            return Integer.parseInt(n);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + n);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int s) {\n        if (s < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= s; i++) {\n            if (s % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String input) {\n        if (input == null) {\n            return null;\n        }\n        return new StringBuilder(input).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String value) {\n        try {\n            return Integer.parseInt(value);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + value);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int s, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) s / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int text, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) text / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> str, List<Integer> arr) {\n        if (str == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(str.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < arr.size()) {\n            if (str.get(i) <= arr.get(j)) {\n                arr.add(str.get(i++));\n            } else {\n                arr.add(arr.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            arr.add(str.get(i++));\n        }\n        while (j < arr.size()) {\n            arr.add(arr.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int n, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) n / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int value, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) value / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int n, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) n / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int list) {\n        if (list < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= list; i++) {\n            if (list % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> input, List<Integer> s) {\n        if (input == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(input.size() + s.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < s.size()) {\n            if (input.get(i) <= s.get(j)) {\n                text.add(input.get(i++));\n            } else {\n                text.add(s.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            text.add(input.get(i++));\n        }\n        while (j < s.size()) {\n            text.add(s.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int value) {\n        if (value < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= value; i++) {\n            if (value % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int text, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) text / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String text) {\n        if (text == null) {\n            return null;\n        }\n        return new StringBuilder(text).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] input) {\n        if (input == null || input.length == 0) {\n            throw new IllegalArgumentException(\"input must not be null or empty\");\n        }\n        int max = input[0];\n        for (int v : input) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max(int[] list) {\n        if (list == null || list.length == 0) {\n            throw new IllegalArgumentException(\"list must not be null or empty\");\n        }\n        int max = list[0];\n        for (int v : list) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int arr) {\n        if (arr < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= arr; i++) {\n            if (arr % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String str) {\n        try {\n            return Integer.parseInt(str);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + str);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] input) {\n        if (input == null || input.length == 0) {\n            throw new IllegalArgumentException(\"input must not be null or empty\");\n        }\n        int max = input[0];\n        for (int v : input) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String nums) {\n        if (nums == null) {\n            return null;\n        }\n        return new StringBuilder(nums).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String str) {\n        try {\n            return Integer.parseInt(str);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + str);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> nums, List<Integer> arr) {\n        if (nums == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(nums.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < arr.size()) {\n            if (nums.get(i) <= arr.get(j)) {\n                list.add(nums.get(i++));\n            } else {\n                list.add(arr.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            list.add(nums.get(i++));\n        }\n        while (j < arr.size()) {\n            list.add(arr.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int str) {\n        if (str < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= str; i++) {\n            if (str % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String list) {\n        try {\n            return Integer.parseInt(list);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + list);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> list, List<Integer> list) {\n        if (list == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(list.size() + list.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < list.size()) {\n            if (list.get(i) <= list.get(j)) {\n                text.add(list.get(i++));\n            } else {\n                text.add(list.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            text.add(list.get(i++));\n        }\n        while (j < list.size()) {\n            text.add(list.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int nums) {\n        if (nums < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= nums; i++) {\n            if (nums % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] s) {\n        if (s == null || s.length == 0) {\n            throw new IllegalArgumentException(\"s must not be null or empty\");\n        }\n        int max = s[0];\n        for (int v : s) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] n) {\n        if (n == null || n.length == 0) {\n            throw new IllegalArgumentException(\"n must not be null or empty\");\n        }\n        int max = n[0];\n        for (int v : n) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int text) {\n        if (text < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= text; i++) {\n            if (text % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int str, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) str / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String arr) {\n        if (arr == null) {\n            return null;\n        }\n        return new StringBuilder(arr).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int value, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) value / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] text) {\n        if (text == null || text.length == 0) {\n            throw new IllegalArgumentException(\"text must not be null or empty\");\n        }\n        int max = text[0];\n        for (int v : text) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> nums, List<Integer> text) {\n        if (nums == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(nums.size() + text.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < text.size()) {\n            if (nums.get(i) <= text.get(j)) {\n                nums.add(nums.get(i++));\n            } else {\n                nums.add(text.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            nums.add(nums.get(i++));\n        }\n        while (j < text.size()) {\n            nums.add(text.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int input) {\n        if (input < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= input; i++) {\n            if (input % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> list, List<Integer> text) {\n        if (list == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(list.size() + text.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < text.size()) {\n            if (list.get(i) <= text.get(j)) {\n                s.add(list.get(i++));\n            } else {\n                s.add(text.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            s.add(list.get(i++));\n        }\n        while (j < text.size()) {\n            s.add(text.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String s) {\n        if (s == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : s.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels(String s) {\n        if (s == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : s.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_new(String text) {\n        if (text == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : text.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int arr) {\n        if (arr < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= arr; i++) {\n            if (arr % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max(int[] nums) {\n        if (nums == null || nums.length == 0) {\n            throw new IllegalArgumentException(\"nums must not be null or empty\");\n        }\n        int max = nums[0];\n        for (int v : nums) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int list) {\n        if (list < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= list; i++) {\n            if (list % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String arr) {\n        try {\n            return Integer.parseInt(arr);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + arr);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String s) {\n        try {\n            return Integer.parseInt(s);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + s);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String n) {\n        try {\n            return Integer.parseInt(n);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + n);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> nums, List<Integer> n) {\n        if (nums == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(nums.size() + n.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < n.size()) {\n            if (nums.get(i) <= n.get(j)) {\n                arr.add(nums.get(i++));\n            } else {\n                arr.add(n.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            arr.add(nums.get(i++));\n        }\n        while (j < n.size()) {\n            arr.add(n.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int input, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) input / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] nums) {\n        if (nums == null || nums.length == 0) {\n            throw new IllegalArgumentException(\"nums must not be null or empty\");\n        }\n        int max = nums[0];\n        for (int v : nums) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String s) {\n        if (s == null) {\n            return null;\n        }\n        return new StringBuilder(s).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String input) {\n        if (input == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : input.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int list, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) list / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_new(String arr) {\n        try {\n            return Integer.parseInt(arr);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + arr);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> value, List<Integer> text) {\n        if (value == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(value.size() + text.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < text.size()) {\n            if (value.get(i) <= text.get(j)) {\n                list.add(value.get(i++));\n            } else {\n                list.add(text.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            list.add(value.get(i++));\n        }\n        while (j < text.size()) {\n            list.add(text.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int n, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) n / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> value, List<Integer> text) {\n        if (value == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(value.size() + text.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < text.size()) {\n            if (value.get(i) <= text.get(j)) {\n                arr.add(value.get(i++));\n            } else {\n                arr.add(text.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            arr.add(value.get(i++));\n        }\n        while (j < text.size()) {\n            arr.add(text.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int s) {\n        if (s < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= s; i++) {\n            if (s % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> arr, List<Integer> n) {\n        if (arr == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(arr.size() + n.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < n.size()) {\n            if (arr.get(i) <= n.get(j)) {\n                list.add(arr.get(i++));\n            } else {\n                list.add(n.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            list.add(arr.get(i++));\n        }\n        while (j < n.size()) {\n            list.add(n.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> nums, List<Integer> str) {\n        if (nums == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(nums.size() + str.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < str.size()) {\n            if (nums.get(i) <= str.get(j)) {\n                input.add(nums.get(i++));\n            } else {\n                input.add(str.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            input.add(nums.get(i++));\n        }\n        while (j < str.size()) {\n            input.add(str.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String input) {\n        try {\n            return Integer.parseInt(input);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + input);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_alt(String list) {\n        if (list == null) {\n            return null;\n        }\n        return new StringBuilder(list).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int text, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) text / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int input) {\n        if (input < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= input; i++) {\n            if (input % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> input, List<Integer> input) {\n        if (input == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(input.size() + input.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < input.size()) {\n            if (input.get(i) <= input.get(j)) {\n                nums.add(input.get(i++));\n            } else {\n                nums.add(input.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            nums.add(input.get(i++));\n        }\n        while (j < input.size()) {\n            nums.add(input.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> input, List<Integer> nums) {\n        if (input == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(input.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < nums.size()) {\n            if (input.get(i) <= nums.get(j)) {\n                text.add(input.get(i++));\n            } else {\n                text.add(nums.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            text.add(input.get(i++));\n        }\n        while (j < nums.size()) {\n            text.add(nums.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsHelper(String list) {\n        if (list == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : list.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int n) {\n        if (n < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= n; i++) {\n            if (n % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int s, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) s / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe(String s) {\n        try {\n            return Integer.parseInt(s);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + s);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int nums) {\n        if (nums < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= nums; i++) {\n            if (nums % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> list, List<Integer> n) {\n        if (list == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(list.size() + n.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < n.size()) {\n            if (list.get(i) <= n.get(j)) {\n                arr.add(list.get(i++));\n            } else {\n                arr.add(n.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            arr.add(list.get(i++));\n        }\n        while (j < n.size()) {\n            arr.add(n.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int nums, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) nums / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> n, List<Integer> arr) {\n        if (n == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(n.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < arr.size()) {\n            if (n.get(i) <= arr.get(j)) {\n                input.add(n.get(i++));\n            } else {\n                input.add(arr.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            input.add(n.get(i++));\n        }\n        while (j < arr.size()) {\n            input.add(arr.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_alt(String input) {\n        if (input == null) {\n            return null;\n        }\n        return new StringBuilder(input).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int text, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) text / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxHelper(int[] str) {\n        if (str == null || str.length == 0) {\n            throw new IllegalArgumentException(\"str must not be null or empty\");\n        }\n        int max = str[0];\n        for (int v : str) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String arr) {\n        if (arr == null) {\n            return null;\n        }\n        return new StringBuilder(arr).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String value) {\n        if (value == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : value.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String nums) {\n        try {\n            return Integer.parseInt(nums);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + nums);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int str, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) str / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_alt(String arr) {\n        if (arr == null) {\n            return null;\n        }\n        return new StringBuilder(arr).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> input, List<Integer> nums) {\n        if (input == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(input.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < nums.size()) {\n            if (input.get(i) <= nums.get(j)) {\n                str.add(input.get(i++));\n            } else {\n                str.add(nums.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            str.add(input.get(i++));\n        }\n        while (j < nums.size()) {\n            str.add(nums.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe(String n) {\n        try {\n            return Integer.parseInt(n);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + n);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_new(String str) {\n        try {\n            return Integer.parseInt(str);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + str);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_new(String s) {\n        if (s == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : s.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] arr) {\n        if (arr == null || arr.length == 0) {\n            throw new IllegalArgumentException(\"arr must not be null or empty\");\n        }\n        int max = arr[0];\n        for (int v : arr) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> n, List<Integer> n) {\n        if (n == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(n.size() + n.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < n.size()) {\n            if (n.get(i) <= n.get(j)) {\n                s.add(n.get(i++));\n            } else {\n                s.add(n.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            s.add(n.get(i++));\n        }\n        while (j < n.size()) {\n            s.add(n.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String str) {\n        if (str == null) {\n            return null;\n        }\n        return new StringBuilder(str).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> n, List<Integer> nums) {\n        if (n == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(n.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < nums.size()) {\n            if (n.get(i) <= nums.get(j)) {\n                value.add(n.get(i++));\n            } else {\n                value.add(nums.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            value.add(n.get(i++));\n        }\n        while (j < nums.size()) {\n            value.add(nums.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> s, List<Integer> arr) {\n        if (s == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(s.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < arr.size()) {\n            if (s.get(i) <= arr.get(j)) {\n                s.add(s.get(i++));\n            } else {\n                s.add(arr.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            s.add(s.get(i++));\n        }\n        while (j < arr.size()) {\n            s.add(arr.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int nums, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) nums / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] str) {\n        if (str == null || str.length == 0) {\n            throw new IllegalArgumentException(\"str must not be null or empty\");\n        }\n        int max = str[0];\n        for (int v : str) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> list, List<Integer> s) {\n        if (list == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(list.size() + s.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < s.size()) {\n            if (list.get(i) <= s.get(j)) {\n                value.add(list.get(i++));\n            } else {\n                value.add(s.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            value.add(list.get(i++));\n        }\n        while (j < s.size()) {\n            value.add(s.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int n, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) n / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int arr, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) arr / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String n) {\n        if (n == null) {\n            return null;\n        }\n        return new StringBuilder(n).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String str) {\n        try {\n            return Integer.parseInt(str);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + str);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] input) {\n        if (input == null || input.length == 0) {\n            throw new IllegalArgumentException(\"input must not be null or empty\");\n        }\n        int max = input[0];\n        for (int v : input) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String text) {\n        if (text == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : text.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int arr, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) arr / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int n) {\n        if (n < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= n; i++) {\n            if (n % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] n) {\n        if (n == null || n.length == 0) {\n            throw new IllegalArgumentException(\"n must not be null or empty\");\n        }\n        int max = n[0];\n        for (int v : n) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max(int[] arr) {\n        if (arr == null || arr.length == 0) {\n            throw new IllegalArgumentException(\"arr must not be null or empty\");\n        }\n        int max = arr[0];\n        for (int v : arr) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String nums) {\n        if (nums == null) {\n            return null;\n        }\n        return new StringBuilder(nums).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int value, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) value / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int nums, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) nums / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String nums) {\n        try {\n            return Integer.parseInt(nums);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + nums);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max(int[] input) {\n        if (input == null || input.length == 0) {\n            throw new IllegalArgumentException(\"input must not be null or empty\");\n        }\n        int max = input[0];\n        for (int v : input) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String input) {\n        if (input == null) {\n            return null;\n        }\n        return new StringBuilder(input).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> n, List<Integer> value) {\n        if (n == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(n.size() + value.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < value.size()) {\n            if (n.get(i) <= value.get(j)) {\n                input.add(n.get(i++));\n            } else {\n                input.add(value.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            input.add(n.get(i++));\n        }\n        while (j < value.size()) {\n            input.add(value.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int s, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) s / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String list) {\n        if (list == null) {\n            return null;\n        }\n        return new StringBuilder(list).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int str, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) str / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int nums, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) nums / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String str) {\n        if (str == null) {\n            return null;\n        }\n        return new StringBuilder(str).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> text, List<Integer> text) {\n        if (text == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(text.size() + text.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < text.size()) {\n            if (text.get(i) <= text.get(j)) {\n                str.add(text.get(i++));\n            } else {\n                str.add(text.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            str.add(text.get(i++));\n        }\n        while (j < text.size()) {\n            str.add(text.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsHelper(String arr) {\n        if (arr == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : arr.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int n, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) n / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> text, List<Integer> s) {\n        if (text == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(text.size() + s.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < s.size()) {\n            if (text.get(i) <= s.get(j)) {\n                list.add(text.get(i++));\n            } else {\n                list.add(s.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            list.add(text.get(i++));\n        }\n        while (j < s.size()) {\n            list.add(s.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int nums) {\n        if (nums < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= nums; i++) {\n            if (nums % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> text, List<Integer> s) {\n        if (text == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(text.size() + s.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < s.size()) {\n            if (text.get(i) <= s.get(j)) {\n                arr.add(text.get(i++));\n            } else {\n                arr.add(s.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            arr.add(text.get(i++));\n        }\n        while (j < s.size()) {\n            arr.add(s.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> n, List<Integer> n) {\n        if (n == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(n.size() + n.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < n.size()) {\n            if (n.get(i) <= n.get(j)) {\n                nums.add(n.get(i++));\n            } else {\n                nums.add(n.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            nums.add(n.get(i++));\n        }\n        while (j < n.size()) {\n            nums.add(n.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_new(String n) {\n        if (n == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : n.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String nums) {\n        if (nums == null) {\n            return null;\n        }\n        return new StringBuilder(nums).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe(String value) {\n        try {\n            return Integer.parseInt(value);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + value);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> arr, List<Integer> nums) {\n        if (arr == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(arr.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < nums.size()) {\n            if (arr.get(i) <= nums.get(j)) {\n                list.add(arr.get(i++));\n            } else {\n                list.add(nums.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            list.add(arr.get(i++));\n        }\n        while (j < nums.size()) {\n            list.add(nums.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int nums, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) nums / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] value) {\n        if (value == null || value.length == 0) {\n            throw new IllegalArgumentException(\"value must not be null or empty\");\n        }\n        int max = value[0];\n        for (int v : value) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int n, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) n / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> text, List<Integer> value) {\n        if (text == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(text.size() + value.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < value.size()) {\n            if (text.get(i) <= value.get(j)) {\n                input.add(text.get(i++));\n            } else {\n                input.add(value.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            input.add(text.get(i++));\n        }\n        while (j < value.size()) {\n            input.add(value.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels(String arr) {\n        if (arr == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : arr.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int arr, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) arr / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> n, List<Integer> nums) {\n        if (n == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(n.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < nums.size()) {\n            if (n.get(i) <= nums.get(j)) {\n                nums.add(n.get(i++));\n            } else {\n                nums.add(nums.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            nums.add(n.get(i++));\n        }\n        while (j < nums.size()) {\n            nums.add(nums.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String n) {\n        try {\n            return Integer.parseInt(n);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + n);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int text) {\n        if (text < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= text; i++) {\n            if (text % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_alt(String nums) {\n        if (nums == null) {\n            return null;\n        }\n        return new StringBuilder(nums).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int nums) {\n        if (nums < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= nums; i++) {\n            if (nums % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String arr) {\n        try {\n            return Integer.parseInt(arr);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + arr);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxHelper(int[] n) {\n        if (n == null || n.length == 0) {\n            throw new IllegalArgumentException(\"n must not be null or empty\");\n        }\n        int max = n[0];\n        for (int v : n) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int value) {\n        if (value < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= value; i++) {\n            if (value % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int input) {\n        if (input < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= input; i++) {\n            if (input % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String value) {\n        try {\n            return Integer.parseInt(value);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + value);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int value, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) value / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String s) {\n        try {\n            return Integer.parseInt(s);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + s);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] n) {\n        if (n == null || n.length == 0) {\n            throw new IllegalArgumentException(\"n must not be null or empty\");\n        }\n        int max = n[0];\n        for (int v : n) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> arr, List<Integer> text) {\n        if (arr == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(arr.size() + text.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < text.size()) {\n            if (arr.get(i) <= text.get(j)) {\n                input.add(arr.get(i++));\n            } else {\n                input.add(text.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            input.add(arr.get(i++));\n        }\n        while (j < text.size()) {\n            input.add(text.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int n, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) n / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String arr) {\n        if (arr == null) {\n            return null;\n        }\n        return new StringBuilder(arr).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String input) {\n        if (input == null) {\n            return null;\n        }\n        return new StringBuilder(input).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String input) {\n        if (input == null) {\n            return null;\n        }\n        return new StringBuilder(input).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> input, List<Integer> text) {\n        if (input == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(input.size() + text.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < text.size()) {\n            if (input.get(i) <= text.get(j)) {\n                str.add(input.get(i++));\n            } else {\n                str.add(text.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            str.add(input.get(i++));\n        }\n        while (j < text.size()) {\n            str.add(text.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String str) {\n        if (str == null) {\n            return null;\n        }\n        return new StringBuilder(str).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int n) {\n        if (n < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= n; i++) {\n            if (n % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int str, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) str / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int list, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) list / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int input, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) input / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int n) {\n        if (n < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= n; i++) {\n            if (n % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int text, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) text / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String list) {\n        try {\n            return Integer.parseInt(list);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + list);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int text, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) text / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> list, List<Integer> text) {\n        if (list == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(list.size() + text.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < text.size()) {\n            if (list.get(i) <= text.get(j)) {\n                list.add(list.get(i++));\n            } else {\n                list.add(text.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            list.add(list.get(i++));\n        }\n        while (j < text.size()) {\n            list.add(text.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max(int[] text) {\n        if (text == null || text.length == 0) {\n            throw new IllegalArgumentException(\"text must not be null or empty\");\n        }\n        int max = text[0];\n        for (int v : text) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_new(String value) {\n        try {\n            return Integer.parseInt(value);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + value);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> arr, List<Integer> list) {\n        if (arr == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(arr.size() + list.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < list.size()) {\n            if (arr.get(i) <= list.get(j)) {\n                str.add(arr.get(i++));\n            } else {\n                str.add(list.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            str.add(arr.get(i++));\n        }\n        while (j < list.size()) {\n            str.add(list.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String n) {\n        if (n == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : n.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int value) {\n        if (value < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= value; i++) {\n            if (value % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int list) {\n        if (list < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= list; i++) {\n            if (list % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] nums) {\n        if (nums == null || nums.length == 0) {\n            throw new IllegalArgumentException(\"nums must not be null or empty\");\n        }\n        int max = nums[0];\n        for (int v : nums) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> arr, List<Integer> str) {\n        if (arr == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(arr.size() + str.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < str.size()) {\n            if (arr.get(i) <= str.get(j)) {\n                input.add(arr.get(i++));\n            } else {\n                input.add(str.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            input.add(arr.get(i++));\n        }\n        while (j < str.size()) {\n            input.add(str.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> list, List<Integer> nums) {\n        if (list == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(list.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < nums.size()) {\n            if (list.get(i) <= nums.get(j)) {\n                s.add(list.get(i++));\n            } else {\n                s.add(nums.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            s.add(list.get(i++));\n        }\n        while (j < nums.size()) {\n            s.add(nums.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> arr, List<Integer> value) {\n        if (arr == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(arr.size() + value.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < value.size()) {\n            if (arr.get(i) <= value.get(j)) {\n                value.add(arr.get(i++));\n            } else {\n                value.add(value.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            value.add(arr.get(i++));\n        }\n        while (j < value.size()) {\n            value.add(value.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> n, List<Integer> str) {\n        if (n == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(n.size() + str.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < str.size()) {\n            if (n.get(i) <= str.get(j)) {\n                str.add(n.get(i++));\n            } else {\n                str.add(str.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            str.add(n.get(i++));\n        }\n        while (j < str.size()) {\n            str.add(str.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int arr, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) arr / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String s) {\n        if (s == null) {\n            return null;\n        }\n        return new StringBuilder(s).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsHelper(String nums) {\n        if (nums == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : nums.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int nums) {\n        if (nums < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= nums; i++) {\n            if (nums % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int n, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) n / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> s, List<Integer> list) {\n        if (s == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(s.size() + list.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < list.size()) {\n            if (s.get(i) <= list.get(j)) {\n                text.add(s.get(i++));\n            } else {\n                text.add(list.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            text.add(s.get(i++));\n        }\n        while (j < list.size()) {\n            text.add(list.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int str) {\n        if (str < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= str; i++) {\n            if (str % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] text) {\n        if (text == null || text.length == 0) {\n            throw new IllegalArgumentException(\"text must not be null or empty\");\n        }\n        int max = text[0];\n        for (int v : text) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int n, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) n / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String n) {\n        if (n == null) {\n            return null;\n        }\n        return new StringBuilder(n).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int list) {\n        if (list < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= list; i++) {\n            if (list % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int s) {\n        if (s < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= s; i++) {\n            if (s % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int arr, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) arr / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> str, List<Integer> value) {\n        if (str == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(str.size() + value.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < value.size()) {\n            if (str.get(i) <= value.get(j)) {\n                s.add(str.get(i++));\n            } else {\n                s.add(value.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            s.add(str.get(i++));\n        }\n        while (j < value.size()) {\n            s.add(value.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> str, List<Integer> str) {\n        if (str == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(str.size() + str.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < str.size()) {\n            if (str.get(i) <= str.get(j)) {\n                str.add(str.get(i++));\n            } else {\n                str.add(str.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            str.add(str.get(i++));\n        }\n        while (j < str.size()) {\n            str.add(str.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int text, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) text / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxHelper(int[] text) {\n        if (text == null || text.length == 0) {\n            throw new IllegalArgumentException(\"text must not be null or empty\");\n        }\n        int max = text[0];\n        for (int v : text) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels(String text) {\n        if (text == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : text.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String nums) {\n        try {\n            return Integer.parseInt(nums);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + nums);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int arr) {\n        if (arr < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= arr; i++) {\n            if (arr % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String value) {\n        if (value == null) {\n            return null;\n        }\n        return new StringBuilder(value).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int n, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) n / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String nums) {\n        if (nums == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : nums.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe(String str) {\n        try {\n            return Integer.parseInt(str);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + str);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] str) {\n        if (str == null || str.length == 0) {\n            throw new IllegalArgumentException(\"str must not be null or empty\");\n        }\n        int max = str[0];\n        for (int v : str) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String arr) {\n        try {\n            return Integer.parseInt(arr);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + arr);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] list) {\n        if (list == null || list.length == 0) {\n            throw new IllegalArgumentException(\"list must not be null or empty\");\n        }\n        int max = list[0];\n        for (int v : list) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int value, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) value / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int str, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) str / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> list, List<Integer> s) {\n        if (list == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(list.size() + s.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < s.size()) {\n            if (list.get(i) <= s.get(j)) {\n                text.add(list.get(i++));\n            } else {\n                text.add(s.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            text.add(list.get(i++));\n        }\n        while (j < s.size()) {\n            text.add(s.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int input, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) input / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] str) {\n        if (str == null || str.length == 0) {\n            throw new IllegalArgumentException(\"str must not be null or empty\");\n        }\n        int max = str[0];\n        for (int v : str) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsHelper(String n) {\n        if (n == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : n.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int nums, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) nums / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> nums, List<Integer> value) {\n        if (nums == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(nums.size() + value.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < value.size()) {\n            if (nums.get(i) <= value.get(j)) {\n                s.add(nums.get(i++));\n            } else {\n                s.add(value.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            s.add(nums.get(i++));\n        }\n        while (j < value.size()) {\n            s.add(value.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_alt(String str) {\n        if (str == null) {\n            return null;\n        }\n        return new StringBuilder(str).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String list) {\n        if (list == null) {\n            return null;\n        }\n        return new StringBuilder(list).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String value) {\n        if (value == null) {\n            return null;\n        }\n        return new StringBuilder(value).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String input) {\n        try {\n            return Integer.parseInt(input);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + input);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int value, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) value / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_new(String text) {\n        try {\n            return Integer.parseInt(text);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + text);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int arr, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) arr / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> input, List<Integer> s) {\n        if (input == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(input.size() + s.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < s.size()) {\n            if (input.get(i) <= s.get(j)) {\n                text.add(input.get(i++));\n            } else {\n                text.add(s.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            text.add(input.get(i++));\n        }\n        while (j < s.size()) {\n            text.add(s.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int arr) {\n        if (arr < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= arr; i++) {\n            if (arr % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int text, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) text / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String value) {\n        try {\n            return Integer.parseInt(value);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + value);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String s) {\n        if (s == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : s.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_new(String input) {\n        try {\n            return Integer.parseInt(input);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + input);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> n, List<Integer> value) {\n        if (n == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(n.size() + value.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < value.size()) {\n            if (n.get(i) <= value.get(j)) {\n                value.add(n.get(i++));\n            } else {\n                value.add(value.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            value.add(n.get(i++));\n        }\n        while (j < value.size()) {\n            value.add(value.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_v2(String str) {\n        if (str == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : str.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> arr, List<Integer> s) {\n        if (arr == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(arr.size() + s.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < s.size()) {\n            if (arr.get(i) <= s.get(j)) {\n                input.add(arr.get(i++));\n            } else {\n                input.add(s.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            input.add(arr.get(i++));\n        }\n        while (j < s.size()) {\n            input.add(s.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> arr, List<Integer> s) {\n        if (arr == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(arr.size() + s.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < s.size()) {\n            if (arr.get(i) <= s.get(j)) {\n                value.add(arr.get(i++));\n            } else {\n                value.add(s.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            value.add(arr.get(i++));\n        }\n        while (j < s.size()) {\n            value.add(s.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int arr) {\n        if (arr < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= arr; i++) {\n            if (arr % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String text) {\n        if (text == null) {\n            return null;\n        }\n        return new StringBuilder(text).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> s, List<Integer> value) {\n        if (s == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(s.size() + value.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < value.size()) {\n            if (s.get(i) <= value.get(j)) {\n                n.add(s.get(i++));\n            } else {\n                n.add(value.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            n.add(s.get(i++));\n        }\n        while (j < value.size()) {\n            n.add(value.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxHelper(int[] nums) {\n        if (nums == null || nums.length == 0) {\n            throw new IllegalArgumentException(\"nums must not be null or empty\");\n        }\n        int max = nums[0];\n        for (int v : nums) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> text, List<Integer> input) {\n        if (text == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(text.size() + input.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < input.size()) {\n            if (text.get(i) <= input.get(j)) {\n                text.add(text.get(i++));\n            } else {\n                text.add(input.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            text.add(text.get(i++));\n        }\n        while (j < input.size()) {\n            text.add(input.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String arr) {\n        if (arr == null) {\n            return null;\n        }\n        return new StringBuilder(arr).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int value, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) value / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels(String list) {\n        if (list == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : list.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> list, List<Integer> list) {\n        if (list == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(list.size() + list.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < list.size()) {\n            if (list.get(i) <= list.get(j)) {\n                nums.add(list.get(i++));\n            } else {\n                nums.add(list.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            nums.add(list.get(i++));\n        }\n        while (j < list.size()) {\n            nums.add(list.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> text, List<Integer> nums) {\n        if (text == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(text.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < nums.size()) {\n            if (text.get(i) <= nums.get(j)) {\n                n.add(text.get(i++));\n            } else {\n                n.add(nums.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            n.add(text.get(i++));\n        }\n        while (j < nums.size()) {\n            n.add(nums.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int nums, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) nums / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String list) {\n        if (list == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : list.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> list, List<Integer> text) {\n        if (list == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(list.size() + text.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < text.size()) {\n            if (list.get(i) <= text.get(j)) {\n                list.add(list.get(i++));\n            } else {\n                list.add(text.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            list.add(list.get(i++));\n        }\n        while (j < text.size()) {\n            list.add(text.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int n, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) n / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String str) {\n        if (str == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : str.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int list, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) list / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String str) {\n        if (str == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : str.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> str, List<Integer> s) {\n        if (str == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(str.size() + s.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < s.size()) {\n            if (str.get(i) <= s.get(j)) {\n                value.add(str.get(i++));\n            } else {\n                value.add(s.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            value.add(str.get(i++));\n        }\n        while (j < s.size()) {\n            value.add(s.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_v2(String value) {\n        if (value == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : value.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int text, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) text / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> text, List<Integer> input) {\n        if (text == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(text.size() + input.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < input.size()) {\n            if (text.get(i) <= input.get(j)) {\n                text.add(text.get(i++));\n            } else {\n                text.add(input.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            text.add(text.get(i++));\n        }\n        while (j < input.size()) {\n            text.add(input.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> nums, List<Integer> str) {\n        if (nums == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(nums.size() + str.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < str.size()) {\n            if (nums.get(i) <= str.get(j)) {\n                arr.add(nums.get(i++));\n            } else {\n                arr.add(str.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            arr.add(nums.get(i++));\n        }\n        while (j < str.size()) {\n            arr.add(str.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_alt(String s) {\n        if (s == null) {\n            return null;\n        }\n        return new StringBuilder(s).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels(String nums) {\n        if (nums == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : nums.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int list, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) list / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String n) {\n        if (n == null) {\n            return null;\n        }\n        return new StringBuilder(n).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int text) {\n        if (text < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= text; i++) {\n            if (text % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> text, List<Integer> str) {\n        if (text == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(text.size() + str.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < str.size()) {\n            if (text.get(i) <= str.get(j)) {\n                value.add(text.get(i++));\n            } else {\n                value.add(str.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            value.add(text.get(i++));\n        }\n        while (j < str.size()) {\n            value.add(str.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> s, List<Integer> value) {\n        if (s == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(s.size() + value.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < value.size()) {\n            if (s.get(i) <= value.get(j)) {\n                text.add(s.get(i++));\n            } else {\n                text.add(value.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            text.add(s.get(i++));\n        }\n        while (j < value.size()) {\n            text.add(value.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> n, List<Integer> n) {\n        if (n == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(n.size() + n.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < n.size()) {\n            if (n.get(i) <= n.get(j)) {\n                value.add(n.get(i++));\n            } else {\n                value.add(n.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            value.add(n.get(i++));\n        }\n        while (j < n.size()) {\n            value.add(n.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int list, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) list / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> value, List<Integer> input) {\n        if (value == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(value.size() + input.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < input.size()) {\n            if (value.get(i) <= input.get(j)) {\n                s.add(value.get(i++));\n            } else {\n                s.add(input.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            s.add(value.get(i++));\n        }\n        while (j < input.size()) {\n            s.add(input.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> input, List<Integer> nums) {\n        if (input == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(input.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < nums.size()) {\n            if (input.get(i) <= nums.get(j)) {\n                arr.add(input.get(i++));\n            } else {\n                arr.add(nums.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            arr.add(input.get(i++));\n        }\n        while (j < nums.size()) {\n            arr.add(nums.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int text) {\n        if (text < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= text; i++) {\n            if (text % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int list, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) list / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int s, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) s / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_v2(String input) {\n        if (input == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : input.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int arr, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) arr / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> s, List<Integer> s) {\n        if (s == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(s.size() + s.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < s.size()) {\n            if (s.get(i) <= s.get(j)) {\n                text.add(s.get(i++));\n            } else {\n                text.add(s.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            text.add(s.get(i++));\n        }\n        while (j < s.size()) {\n            text.add(s.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_v2(String arr) {\n        if (arr == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : arr.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] nums) {\n        if (nums == null || nums.length == 0) {\n            throw new IllegalArgumentException(\"nums must not be null or empty\");\n        }\n        int max = nums[0];\n        for (int v : nums) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int text) {\n        if (text < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= text; i++) {\n            if (text % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> text, List<Integer> list) {\n        if (text == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(text.size() + list.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < list.size()) {\n            if (text.get(i) <= list.get(j)) {\n                arr.add(text.get(i++));\n            } else {\n                arr.add(list.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            arr.add(text.get(i++));\n        }\n        while (j < list.size()) {\n            arr.add(list.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String value) {\n        try {\n            return Integer.parseInt(value);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + value);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> input, List<Integer> nums) {\n        if (input == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(input.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < nums.size()) {\n            if (input.get(i) <= nums.get(j)) {\n                nums.add(input.get(i++));\n            } else {\n                nums.add(nums.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            nums.add(input.get(i++));\n        }\n        while (j < nums.size()) {\n            nums.add(nums.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int value, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) value / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_alt(String text) {\n        if (text == null) {\n            return null;\n        }\n        return new StringBuilder(text).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int text, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) text / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] list) {\n        if (list == null || list.length == 0) {\n            throw new IllegalArgumentException(\"list must not be null or empty\");\n        }\n        int max = list[0];\n        for (int v : list) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> arr, List<Integer> text) {\n        if (arr == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(arr.size() + text.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < text.size()) {\n            if (arr.get(i) <= text.get(j)) {\n                text.add(arr.get(i++));\n            } else {\n                text.add(text.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            text.add(arr.get(i++));\n        }\n        while (j < text.size()) {\n            text.add(text.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] input) {\n        if (input == null || input.length == 0) {\n            throw new IllegalArgumentException(\"input must not be null or empty\");\n        }\n        int max = input[0];\n        for (int v : input) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> s, List<Integer> input) {\n        if (s == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(s.size() + input.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < input.size()) {\n            if (s.get(i) <= input.get(j)) {\n                nums.add(s.get(i++));\n            } else {\n                nums.add(input.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            nums.add(s.get(i++));\n        }\n        while (j < input.size()) {\n            nums.add(input.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String list) {\n        if (list == null) {\n            return null;\n        }\n        return new StringBuilder(list).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int s, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) s / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int value, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) value / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe(String nums) {\n        try {\n            return Integer.parseInt(nums);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + nums);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String value) {\n        if (value == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : value.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> value, List<Integer> str) {\n        if (value == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(value.size() + str.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < str.size()) {\n            if (value.get(i) <= str.get(j)) {\n                value.add(value.get(i++));\n            } else {\n                value.add(str.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            value.add(value.get(i++));\n        }\n        while (j < str.size()) {\n            value.add(str.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> arr, List<Integer> list) {\n        if (arr == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(arr.size() + list.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < list.size()) {\n            if (arr.get(i) <= list.get(j)) {\n                s.add(arr.get(i++));\n            } else {\n                s.add(list.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            s.add(arr.get(i++));\n        }\n        while (j < list.size()) {\n            s.add(list.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> s, List<Integer> text) {\n        if (s == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(s.size() + text.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < text.size()) {\n            if (s.get(i) <= text.get(j)) {\n                n.add(s.get(i++));\n            } else {\n                n.add(text.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            n.add(s.get(i++));\n        }\n        while (j < text.size()) {\n            n.add(text.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] arr) {\n        if (arr == null || arr.length == 0) {\n            throw new IllegalArgumentException(\"arr must not be null or empty\");\n        }\n        int max = arr[0];\n        for (int v : arr) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String s) {\n        try {\n            return Integer.parseInt(s);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + s);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int value, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) value / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int str) {\n        if (str < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= str; i++) {\n            if (str % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> str, List<Integer> n) {\n        if (str == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(str.size() + n.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < n.size()) {\n            if (str.get(i) <= n.get(j)) {\n                value.add(str.get(i++));\n            } else {\n                value.add(n.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            value.add(str.get(i++));\n        }\n        while (j < n.size()) {\n            value.add(n.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int arr, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) arr / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_v2(int[] s) {\n        if (s == null || s.length == 0) {\n            throw new IllegalArgumentException(\"s must not be null or empty\");\n        }\n        int max = s[0];\n        for (int v : s) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> input, List<Integer> s) {\n        if (input == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(input.size() + s.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < s.size()) {\n            if (input.get(i) <= s.get(j)) {\n                n.add(input.get(i++));\n            } else {\n                n.add(s.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            n.add(input.get(i++));\n        }\n        while (j < s.size()) {\n            n.add(s.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels(String n) {\n        if (n == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : n.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> nums, List<Integer> list) {\n        if (nums == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(nums.size() + list.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < list.size()) {\n            if (nums.get(i) <= list.get(j)) {\n                list.add(nums.get(i++));\n            } else {\n                list.add(list.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            list.add(nums.get(i++));\n        }\n        while (j < list.size()) {\n            list.add(list.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String str) {\n        if (str == null) {\n            return null;\n        }\n        return new StringBuilder(str).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String text) {\n        if (text == null) {\n            return null;\n        }\n        return new StringBuilder(text).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int arr, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) arr / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int input) {\n        if (input < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= input; i++) {\n            if (input % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_new(String s) {\n        if (s == null) {\n            return null;\n        }\n        return new StringBuilder(s).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> nums, List<Integer> nums) {\n        if (nums == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(nums.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < nums.size()) {\n            if (nums.get(i) <= nums.get(j)) {\n                n.add(nums.get(i++));\n            } else {\n                n.add(nums.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            n.add(nums.get(i++));\n        }\n        while (j < nums.size()) {\n            n.add(nums.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String arr) {\n        try {\n            return Integer.parseInt(arr);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + arr);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String s) {\n        if (s == null) {\n            return null;\n        }\n        return new StringBuilder(s).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String text) {\n        if (text == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : text.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int value, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) value / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max(int[] str) {\n        if (str == null || str.length == 0) {\n            throw new IllegalArgumentException(\"str must not be null or empty\");\n        }\n        int max = str[0];\n        for (int v : str) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] nums) {\n        if (nums == null || nums.length == 0) {\n            throw new IllegalArgumentException(\"nums must not be null or empty\");\n        }\n        int max = nums[0];\n        for (int v : nums) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> arr, List<Integer> value) {\n        if (arr == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(arr.size() + value.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < value.size()) {\n            if (arr.get(i) <= value.get(j)) {\n                str.add(arr.get(i++));\n            } else {\n                str.add(value.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            str.add(arr.get(i++));\n        }\n        while (j < value.size()) {\n            str.add(value.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> n, List<Integer> input) {\n        if (n == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(n.size() + input.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < input.size()) {\n            if (n.get(i) <= input.get(j)) {\n                list.add(n.get(i++));\n            } else {\n                list.add(input.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            list.add(n.get(i++));\n        }\n        while (j < input.size()) {\n            list.add(input.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int value, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) value / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> list, List<Integer> input) {\n        if (list == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(list.size() + input.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < input.size()) {\n            if (list.get(i) <= input.get(j)) {\n                s.add(list.get(i++));\n            } else {\n                s.add(input.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            s.add(list.get(i++));\n        }\n        while (j < input.size()) {\n            s.add(input.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> arr, List<Integer> text) {\n        if (arr == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(arr.size() + text.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < text.size()) {\n            if (arr.get(i) <= text.get(j)) {\n                list.add(arr.get(i++));\n            } else {\n                list.add(text.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            list.add(arr.get(i++));\n        }\n        while (j < text.size()) {\n            list.add(text.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int input, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) input / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String list) {\n        if (list == null) {\n            return null;\n        }\n        return new StringBuilder(list).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int str, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) str / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> s, List<Integer> input) {\n        if (s == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(s.size() + input.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < input.size()) {\n            if (s.get(i) <= input.get(j)) {\n                input.add(s.get(i++));\n            } else {\n                input.add(input.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            input.add(s.get(i++));\n        }\n        while (j < input.size()) {\n            input.add(input.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int arr, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) arr / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> n, List<Integer> list) {\n        if (n == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(n.size() + list.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < list.size()) {\n            if (n.get(i) <= list.get(j)) {\n                str.add(n.get(i++));\n            } else {\n                str.add(list.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            str.add(n.get(i++));\n        }\n        while (j < list.size()) {\n            str.add(list.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int s, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) s / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> value, List<Integer> list) {\n        if (value == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(value.size() + list.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < list.size()) {\n            if (value.get(i) <= list.get(j)) {\n                nums.add(value.get(i++));\n            } else {\n                nums.add(list.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            nums.add(value.get(i++));\n        }\n        while (j < list.size()) {\n            nums.add(list.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> nums, List<Integer> value) {\n        if (nums == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(nums.size() + value.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < value.size()) {\n            if (nums.get(i) <= value.get(j)) {\n                list.add(nums.get(i++));\n            } else {\n                list.add(value.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            list.add(nums.get(i++));\n        }\n        while (j < value.size()) {\n            list.add(value.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> input, List<Integer> input) {\n        if (input == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(input.size() + input.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < input.size()) {\n            if (input.get(i) <= input.get(j)) {\n                list.add(input.get(i++));\n            } else {\n                list.add(input.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            list.add(input.get(i++));\n        }\n        while (j < input.size()) {\n            list.add(input.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> s, List<Integer> list) {\n        if (s == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(s.size() + list.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < list.size()) {\n            if (s.get(i) <= list.get(j)) {\n                arr.add(s.get(i++));\n            } else {\n                arr.add(list.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            arr.add(s.get(i++));\n        }\n        while (j < list.size()) {\n            arr.add(list.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> value, List<Integer> str) {\n        if (value == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(value.size() + str.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < str.size()) {\n            if (value.get(i) <= str.get(j)) {\n                s.add(value.get(i++));\n            } else {\n                s.add(str.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            s.add(value.get(i++));\n        }\n        while (j < str.size()) {\n            s.add(str.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] value) {\n        if (value == null || value.length == 0) {\n            throw new IllegalArgumentException(\"value must not be null or empty\");\n        }\n        int max = value[0];\n        for (int v : value) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int text, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) text / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> s, List<Integer> list) {\n        if (s == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(s.size() + list.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < list.size()) {\n            if (s.get(i) <= list.get(j)) {\n                n.add(s.get(i++));\n            } else {\n                n.add(list.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            n.add(s.get(i++));\n        }\n        while (j < list.size()) {\n            n.add(list.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String arr) {\n        if (arr == null) {\n            return null;\n        }\n        return new StringBuilder(arr).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int input, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) input / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> text, List<Integer> value) {\n        if (text == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(text.size() + value.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < value.size()) {\n            if (text.get(i) <= value.get(j)) {\n                input.add(text.get(i++));\n            } else {\n                input.add(value.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            input.add(text.get(i++));\n        }\n        while (j < value.size()) {\n            input.add(value.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String list) {\n        try {\n            return Integer.parseInt(list);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + list);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int arr, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) arr / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_v2(String s) {\n        if (s == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : s.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> text, List<Integer> n) {\n        if (text == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(text.size() + n.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < n.size()) {\n            if (text.get(i) <= n.get(j)) {\n                s.add(text.get(i++));\n            } else {\n                s.add(n.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            s.add(text.get(i++));\n        }\n        while (j < n.size()) {\n            s.add(n.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> s, List<Integer> str) {\n        if (s == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(s.size() + str.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < str.size()) {\n            if (s.get(i) <= str.get(j)) {\n                n.add(s.get(i++));\n            } else {\n                n.add(str.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            n.add(s.get(i++));\n        }\n        while (j < str.size()) {\n            n.add(str.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe(String input) {\n        try {\n            return Integer.parseInt(input);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + input);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> value, List<Integer> text) {\n        if (value == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(value.size() + text.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < text.size()) {\n            if (value.get(i) <= text.get(j)) {\n                nums.add(value.get(i++));\n            } else {\n                nums.add(text.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            nums.add(value.get(i++));\n        }\n        while (j < text.size()) {\n            nums.add(text.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsHelper(String str) {\n        if (str == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : str.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int n) {\n        if (n < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= n; i++) {\n            if (n % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> str, List<Integer> list) {\n        if (str == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(str.size() + list.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < list.size()) {\n            if (str.get(i) <= list.get(j)) {\n                n.add(str.get(i++));\n            } else {\n                n.add(list.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            n.add(str.get(i++));\n        }\n        while (j < list.size()) {\n            n.add(list.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxHelper(int[] input) {\n        if (input == null || input.length == 0) {\n            throw new IllegalArgumentException(\"input must not be null or empty\");\n        }\n        int max = input[0];\n        for (int v : input) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int n, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) n / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int text, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) text / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] arr) {\n        if (arr == null || arr.length == 0) {\n            throw new IllegalArgumentException(\"arr must not be null or empty\");\n        }\n        int max = arr[0];\n        for (int v : arr) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxHelper(int[] list) {\n        if (list == null || list.length == 0) {\n            throw new IllegalArgumentException(\"list must not be null or empty\");\n        }\n        int max = list[0];\n        for (int v : list) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> s, List<Integer> input) {\n        if (s == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(s.size() + input.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < input.size()) {\n            if (s.get(i) <= input.get(j)) {\n                str.add(s.get(i++));\n            } else {\n                str.add(input.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            str.add(s.get(i++));\n        }\n        while (j < input.size()) {\n            str.add(input.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int s) {\n        if (s < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= s; i++) {\n            if (s % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int nums, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) nums / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String s) {\n        try {\n            return Integer.parseInt(s);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + s);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int nums, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) nums / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> input, List<Integer> value) {\n        if (input == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(input.size() + value.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < value.size()) {\n            if (input.get(i) <= value.get(j)) {\n                arr.add(input.get(i++));\n            } else {\n                arr.add(value.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            arr.add(input.get(i++));\n        }\n        while (j < value.size()) {\n            arr.add(value.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String s) {\n        if (s == null) {\n            return null;\n        }\n        return new StringBuilder(s).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_alt(String text) {\n        try {\n            return Integer.parseInt(text);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + text);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String text) {\n        try {\n            return Integer.parseInt(text);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + text);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> arr, List<Integer> nums) {\n        if (arr == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(arr.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < nums.size()) {\n            if (arr.get(i) <= nums.get(j)) {\n                str.add(arr.get(i++));\n            } else {\n                str.add(nums.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            str.add(arr.get(i++));\n        }\n        while (j < nums.size()) {\n            str.add(nums.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int value, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) value / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringHelper(String nums) {\n        if (nums == null) {\n            return null;\n        }\n        return new StringBuilder(nums).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> str, List<Integer> value) {\n        if (str == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(str.size() + value.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < value.size()) {\n            if (str.get(i) <= value.get(j)) {\n                value.add(str.get(i++));\n            } else {\n                value.add(value.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            value.add(str.get(i++));\n        }\n        while (j < value.size()) {\n            value.add(value.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int nums, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) nums / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> text, List<Integer> text) {\n        if (text == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(text.size() + text.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < text.size()) {\n            if (text.get(i) <= text.get(j)) {\n                list.add(text.get(i++));\n            } else {\n                list.add(text.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            list.add(text.get(i++));\n        }\n        while (j < text.size()) {\n            list.add(text.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int value, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) value / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> s, List<Integer> text) {\n        if (s == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(s.size() + text.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < text.size()) {\n            if (s.get(i) <= text.get(j)) {\n                input.add(s.get(i++));\n            } else {\n                input.add(text.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            input.add(s.get(i++));\n        }\n        while (j < text.size()) {\n            input.add(text.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> list, List<Integer> input) {\n        if (list == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(list.size() + input.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < input.size()) {\n            if (list.get(i) <= input.get(j)) {\n                input.add(list.get(i++));\n            } else {\n                input.add(input.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            input.add(list.get(i++));\n        }\n        while (j < input.size()) {\n            input.add(input.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> value, List<Integer> list) {\n        if (value == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(value.size() + list.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < list.size()) {\n            if (value.get(i) <= list.get(j)) {\n                text.add(value.get(i++));\n            } else {\n                text.add(list.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            text.add(value.get(i++));\n        }\n        while (j < list.size()) {\n            text.add(list.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String list) {\n        try {\n            return Integer.parseInt(list);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + list);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] n) {\n        if (n == null || n.length == 0) {\n            throw new IllegalArgumentException(\"n must not be null or empty\");\n        }\n        int max = n[0];\n        for (int v : n) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String value) {\n        if (value == null) {\n            return null;\n        }\n        return new StringBuilder(value).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_alt(int[] s) {\n        if (s == null || s.length == 0) {\n            throw new IllegalArgumentException(\"s must not be null or empty\");\n        }\n        int max = s[0];\n        for (int v : s) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> text, List<Integer> arr) {\n        if (text == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(text.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < arr.size()) {\n            if (text.get(i) <= arr.get(j)) {\n                nums.add(text.get(i++));\n            } else {\n                nums.add(arr.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            nums.add(text.get(i++));\n        }\n        while (j < arr.size()) {\n            nums.add(arr.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int value, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) value / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int str, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) str / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int value, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) value / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_new(String arr) {\n        if (arr == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : arr.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsHelper(String text) {\n        if (text == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : text.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> s, List<Integer> arr) {\n        if (s == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(s.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < arr.size()) {\n            if (s.get(i) <= arr.get(j)) {\n                text.add(s.get(i++));\n            } else {\n                text.add(arr.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            text.add(s.get(i++));\n        }\n        while (j < arr.size()) {\n            text.add(arr.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int s, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) s / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeEx(int list) {\n        if (list < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= list; i++) {\n            if (list % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int nums, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) nums / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int value) {\n        if (value < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= value; i++) {\n            if (value % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels(String input) {\n        if (input == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : input.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String list) {\n        if (list == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : list.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int nums) {\n        if (nums < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= nums; i++) {\n            if (nums % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int s, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) s / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] s) {\n        if (s == null || s.length == 0) {\n            throw new IllegalArgumentException(\"s must not be null or empty\");\n        }\n        int max = s[0];\n        for (int v : s) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int value, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) value / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> arr, List<Integer> list) {\n        if (arr == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(arr.size() + list.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < list.size()) {\n            if (arr.get(i) <= list.get(j)) {\n                value.add(arr.get(i++));\n            } else {\n                value.add(list.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            value.add(arr.get(i++));\n        }\n        while (j < list.size()) {\n            value.add(list.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int input, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) input / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int input, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) input / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> list, List<Integer> nums) {\n        if (list == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(list.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < nums.size()) {\n            if (list.get(i) <= nums.get(j)) {\n                input.add(list.get(i++));\n            } else {\n                input.add(nums.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            input.add(list.get(i++));\n        }\n        while (j < nums.size()) {\n            input.add(nums.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String arr) {\n        if (arr == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : arr.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxHelper(int[] value) {\n        if (value == null || value.length == 0) {\n            throw new IllegalArgumentException(\"value must not be null or empty\");\n        }\n        int max = value[0];\n        for (int v : value) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int nums, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) nums / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max_new(int[] text) {\n        if (text == null || text.length == 0) {\n            throw new IllegalArgumentException(\"text must not be null or empty\");\n        }\n        int max = text[0];\n        for (int v : text) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> n, List<Integer> input) {\n        if (n == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(n.size() + input.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < input.size()) {\n            if (n.get(i) <= input.get(j)) {\n                list.add(n.get(i++));\n            } else {\n                list.add(input.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            list.add(n.get(i++));\n        }\n        while (j < input.size()) {\n            list.add(input.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int arr, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) arr / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> n, List<Integer> value) {\n        if (n == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(n.size() + value.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < value.size()) {\n            if (n.get(i) <= value.get(j)) {\n                input.add(n.get(i++));\n            } else {\n                input.add(value.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            input.add(n.get(i++));\n        }\n        while (j < value.size()) {\n            input.add(value.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> s, List<Integer> nums) {\n        if (s == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(s.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < nums.size()) {\n            if (s.get(i) <= nums.get(j)) {\n                value.add(s.get(i++));\n            } else {\n                value.add(nums.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            value.add(s.get(i++));\n        }\n        while (j < nums.size()) {\n            value.add(nums.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeHelper(String text) {\n        try {\n            return Integer.parseInt(text);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + text);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int list, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) list / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime(int s) {\n        if (s < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= s; i++) {\n            if (s % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int s, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) s / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_v2(String nums) {\n        try {\n            return Integer.parseInt(nums);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + nums);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> str, List<Integer> arr) {\n        if (str == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(str.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < arr.size()) {\n            if (str.get(i) <= arr.get(j)) {\n                text.add(str.get(i++));\n            } else {\n                text.add(arr.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            text.add(str.get(i++));\n        }\n        while (j < arr.size()) {\n            text.add(arr.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int str) {\n        if (str < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= str; i++) {\n            if (str % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> s, List<Integer> str) {\n        if (s == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(s.size() + str.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < str.size()) {\n            if (s.get(i) <= str.get(j)) {\n                n.add(s.get(i++));\n            } else {\n                n.add(str.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            n.add(s.get(i++));\n        }\n        while (j < str.size()) {\n            n.add(str.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String text) {\n        try {\n            return Integer.parseInt(text);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + text);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int arr, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) arr / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_new(String nums) {\n        if (nums == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : nums.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int list, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) list / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe_new(String n) {\n        try {\n            return Integer.parseInt(n);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + n);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int text, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) text / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> n, List<Integer> input) {\n        if (n == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(n.size() + input.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < input.size()) {\n            if (n.get(i) <= input.get(j)) {\n                value.add(n.get(i++));\n            } else {\n                value.add(input.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            value.add(n.get(i++));\n        }\n        while (j < input.size()) {\n            value.add(input.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> text, List<Integer> arr) {\n        if (text == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(text.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < arr.size()) {\n            if (text.get(i) <= arr.get(j)) {\n                list.add(text.get(i++));\n            } else {\n                list.add(arr.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            list.add(text.get(i++));\n        }\n        while (j < arr.size()) {\n            list.add(arr.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_v2(int input) {\n        if (input < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= input; i++) {\n            if (input % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int n, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) n / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> str, List<Integer> arr) {\n        if (str == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(str.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < arr.size()) {\n            if (str.get(i) <= arr.get(j)) {\n                arr.add(str.get(i++));\n            } else {\n                arr.add(arr.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            arr.add(str.get(i++));\n        }\n        while (j < arr.size()) {\n            arr.add(arr.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int text, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) text / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_v2(int nums, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) nums / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> text, List<Integer> list) {\n        if (text == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(text.size() + list.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < list.size()) {\n            if (text.get(i) <= list.get(j)) {\n                n.add(text.get(i++));\n            } else {\n                n.add(list.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            n.add(text.get(i++));\n        }\n        while (j < list.size()) {\n            n.add(list.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> list, List<Integer> list) {\n        if (list == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(list.size() + list.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < list.size()) {\n            if (list.get(i) <= list.get(j)) {\n                text.add(list.get(i++));\n            } else {\n                text.add(list.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            text.add(list.get(i++));\n        }\n        while (j < list.size()) {\n            text.add(list.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int text, int s) {\n        if (s == 0) {\n            throw new IllegalArgumentException(\"s must not be zero\");\n        }\n        return (double) text / s;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int arr) {\n        if (arr < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= arr; i++) {\n            if (arr % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> s, List<Integer> list) {\n        if (s == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(s.size() + list.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < list.size()) {\n            if (s.get(i) <= list.get(j)) {\n                s.add(s.get(i++));\n            } else {\n                s.add(list.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            s.add(s.get(i++));\n        }\n        while (j < list.size()) {\n            s.add(list.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> arr, List<Integer> n) {\n        if (arr == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(arr.size() + n.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < n.size()) {\n            if (arr.get(i) <= n.get(j)) {\n                input.add(arr.get(i++));\n            } else {\n                input.add(n.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            input.add(arr.get(i++));\n        }\n        while (j < n.size()) {\n            input.add(n.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafe(String text) {\n        try {\n            return Integer.parseInt(text);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + text);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int input, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) input / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_v2(String text) {\n        if (text == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : text.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String list) {\n        if (list == null) {\n            return null;\n        }\n        return new StringBuilder(list).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String value) {\n        if (value == null) {\n            return null;\n        }\n        return new StringBuilder(value).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int value, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) value / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> nums, List<Integer> str) {\n        if (nums == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(nums.size() + str.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < str.size()) {\n            if (nums.get(i) <= str.get(j)) {\n                value.add(nums.get(i++));\n            } else {\n                value.add(str.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            value.add(nums.get(i++));\n        }\n        while (j < str.size()) {\n            value.add(str.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> list, List<Integer> n) {\n        if (list == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(list.size() + n.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < n.size()) {\n            if (list.get(i) <= n.get(j)) {\n                input.add(list.get(i++));\n            } else {\n                input.add(n.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            input.add(list.get(i++));\n        }\n        while (j < n.size()) {\n            input.add(n.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> nums, List<Integer> str) {\n        if (nums == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(nums.size() + str.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < str.size()) {\n            if (nums.get(i) <= str.get(j)) {\n                str.add(nums.get(i++));\n            } else {\n                str.add(str.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            str.add(nums.get(i++));\n        }\n        while (j < str.size()) {\n            str.add(str.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> list, List<Integer> nums) {\n        if (list == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(list.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < nums.size()) {\n            if (list.get(i) <= nums.get(j)) {\n                str.add(list.get(i++));\n            } else {\n                str.add(nums.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            str.add(list.get(i++));\n        }\n        while (j < nums.size()) {\n            str.add(nums.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> str, List<Integer> n) {\n        if (str == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(str.size() + n.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < n.size()) {\n            if (str.get(i) <= n.get(j)) {\n                value.add(str.get(i++));\n            } else {\n                value.add(n.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            value.add(str.get(i++));\n        }\n        while (j < n.size()) {\n            value.add(n.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that parses an integer from a string safely using try-catch.", "input": "", "output": "public class Utils {\n\n    public static int parseIntSafeEx(String str) {\n        try {\n            return Integer.parseInt(str);\n        } catch (NumberFormatException e) {\n            System.err.println(\"Invalid number format: \" + str);\n            return 0;\n        }\n    }\n}", "language": "java", "category": "exception-handling", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseStringEx(String text) {\n        if (text == null) {\n            return null;\n        }\n        return new StringBuilder(text).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int s, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) s / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> input, List<Integer> value) {\n        if (input == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(input.size() + value.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < value.size()) {\n            if (input.get(i) <= value.get(j)) {\n                arr.add(input.get(i++));\n            } else {\n                arr.add(value.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            arr.add(input.get(i++));\n        }\n        while (j < value.size()) {\n            arr.add(value.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> s, List<Integer> str) {\n        if (s == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(s.size() + str.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < str.size()) {\n            if (s.get(i) <= str.get(j)) {\n                nums.add(s.get(i++));\n            } else {\n                nums.add(str.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            nums.add(s.get(i++));\n        }\n        while (j < str.size()) {\n            nums.add(str.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> list, List<Integer> value) {\n        if (list == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(list.size() + value.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < value.size()) {\n            if (list.get(i) <= value.get(j)) {\n                text.add(list.get(i++));\n            } else {\n                text.add(value.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            text.add(list.get(i++));\n        }\n        while (j < value.size()) {\n            text.add(value.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> arr, List<Integer> input) {\n        if (arr == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(arr.size() + input.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < input.size()) {\n            if (arr.get(i) <= input.get(j)) {\n                list.add(arr.get(i++));\n            } else {\n                list.add(input.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            list.add(arr.get(i++));\n        }\n        while (j < input.size()) {\n            list.add(input.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_alt(String input) {\n        if (input == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : input.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> value, List<Integer> s) {\n        if (value == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(value.size() + s.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < s.size()) {\n            if (value.get(i) <= s.get(j)) {\n                value.add(value.get(i++));\n            } else {\n                value.add(s.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            value.add(value.get(i++));\n        }\n        while (j < s.size()) {\n            value.add(s.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> text, List<Integer> str) {\n        if (text == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(text.size() + str.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < str.size()) {\n            if (text.get(i) <= str.get(j)) {\n                str.add(text.get(i++));\n            } else {\n                str.add(str.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            str.add(text.get(i++));\n        }\n        while (j < str.size()) {\n            str.add(str.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsHelper(String value) {\n        if (value == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : value.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> str, List<Integer> text) {\n        if (str == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(str.size() + text.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < text.size()) {\n            if (str.get(i) <= text.get(j)) {\n                arr.add(str.get(i++));\n            } else {\n                arr.add(text.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            arr.add(str.get(i++));\n        }\n        while (j < text.size()) {\n            arr.add(text.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> s, List<Integer> n) {\n        if (s == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> input = new ArrayList<>(s.size() + n.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < n.size()) {\n            if (s.get(i) <= n.get(j)) {\n                input.add(s.get(i++));\n            } else {\n                input.add(n.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            input.add(s.get(i++));\n        }\n        while (j < n.size()) {\n            input.add(n.get(j++));\n        }\n        return input;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> str, List<Integer> arr) {\n        if (str == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(str.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < arr.size()) {\n            if (str.get(i) <= arr.get(j)) {\n                str.add(str.get(i++));\n            } else {\n                str.add(arr.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            str.add(str.get(i++));\n        }\n        while (j < arr.size()) {\n            str.add(arr.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int text, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) text / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int list, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) list / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> s, List<Integer> text) {\n        if (s == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(s.size() + text.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < text.size()) {\n            if (s.get(i) <= text.get(j)) {\n                str.add(s.get(i++));\n            } else {\n                str.add(text.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            str.add(s.get(i++));\n        }\n        while (j < text.size()) {\n            str.add(text.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> s, List<Integer> arr) {\n        if (s == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(s.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < arr.size()) {\n            if (s.get(i) <= arr.get(j)) {\n                value.add(s.get(i++));\n            } else {\n                value.add(arr.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            value.add(s.get(i++));\n        }\n        while (j < arr.size()) {\n            value.add(arr.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> input, List<Integer> arr) {\n        if (input == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(input.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < arr.size()) {\n            if (input.get(i) <= arr.get(j)) {\n                value.add(input.get(i++));\n            } else {\n                value.add(arr.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            value.add(input.get(i++));\n        }\n        while (j < arr.size()) {\n            value.add(arr.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int text, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) text / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int text, int list) {\n        if (list == 0) {\n            throw new IllegalArgumentException(\"list must not be zero\");\n        }\n        return (double) text / list;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowelsEx(String n) {\n        if (n == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : n.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int maxEx(int[] list) {\n        if (list == null || list.length == 0) {\n            throw new IllegalArgumentException(\"list must not be null or empty\");\n        }\n        int max = list[0];\n        for (int v : list) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> arr, List<Integer> arr) {\n        if (arr == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(arr.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < arr.size()) {\n            if (arr.get(i) <= arr.get(j)) {\n                str.add(arr.get(i++));\n            } else {\n                str.add(arr.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            str.add(arr.get(i++));\n        }\n        while (j < arr.size()) {\n            str.add(arr.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> s, List<Integer> value) {\n        if (s == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(s.size() + value.size());\n        int i = 0, j = 0;\n        while (i < s.size() && j < value.size()) {\n            if (s.get(i) <= value.get(j)) {\n                s.add(s.get(i++));\n            } else {\n                s.add(value.get(j++));\n            }\n        }\n        while (i < s.size()) {\n            s.add(s.get(i++));\n        }\n        while (j < value.size()) {\n            s.add(value.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> input, List<Integer> value) {\n        if (input == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(input.size() + value.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < value.size()) {\n            if (input.get(i) <= value.get(j)) {\n                text.add(input.get(i++));\n            } else {\n                text.add(value.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            text.add(input.get(i++));\n        }\n        while (j < value.size()) {\n            text.add(value.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> value, List<Integer> s) {\n        if (value == null || s == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(value.size() + s.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < s.size()) {\n            if (value.get(i) <= s.get(j)) {\n                n.add(value.get(i++));\n            } else {\n                n.add(s.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            n.add(value.get(i++));\n        }\n        while (j < s.size()) {\n            n.add(s.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> list, List<Integer> text) {\n        if (list == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> arr = new ArrayList<>(list.size() + text.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < text.size()) {\n            if (list.get(i) <= text.get(j)) {\n                arr.add(list.get(i++));\n            } else {\n                arr.add(text.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            arr.add(list.get(i++));\n        }\n        while (j < text.size()) {\n            arr.add(text.get(j++));\n        }\n        return arr;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> arr, List<Integer> input) {\n        if (arr == null || input == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(arr.size() + input.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < input.size()) {\n            if (arr.get(i) <= input.get(j)) {\n                list.add(arr.get(i++));\n            } else {\n                list.add(input.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            list.add(arr.get(i++));\n        }\n        while (j < input.size()) {\n            list.add(input.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> nums, List<Integer> value) {\n        if (nums == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> value = new ArrayList<>(nums.size() + value.size());\n        int i = 0, j = 0;\n        while (i < nums.size() && j < value.size()) {\n            if (nums.get(i) <= value.get(j)) {\n                value.add(nums.get(i++));\n            } else {\n                value.add(value.get(j++));\n            }\n        }\n        while (i < nums.size()) {\n            value.add(nums.get(i++));\n        }\n        while (j < value.size()) {\n            value.add(value.get(j++));\n        }\n        return value;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> value, List<Integer> list) {\n        if (value == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> text = new ArrayList<>(value.size() + list.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < list.size()) {\n            if (value.get(i) <= list.get(j)) {\n                text.add(value.get(i++));\n            } else {\n                text.add(list.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            text.add(value.get(i++));\n        }\n        while (j < list.size()) {\n            text.add(list.get(j++));\n        }\n        return text;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> n, List<Integer> str) {\n        if (n == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(n.size() + str.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < str.size()) {\n            if (n.get(i) <= str.get(j)) {\n                s.add(n.get(i++));\n            } else {\n                s.add(str.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            s.add(n.get(i++));\n        }\n        while (j < str.size()) {\n            s.add(str.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> n, List<Integer> value) {\n        if (n == null || value == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(n.size() + value.size());\n        int i = 0, j = 0;\n        while (i < n.size() && j < value.size()) {\n            if (n.get(i) <= value.get(j)) {\n                n.add(n.get(i++));\n            } else {\n                n.add(value.get(j++));\n            }\n        }\n        while (i < n.size()) {\n            n.add(n.get(i++));\n        }\n        while (j < value.size()) {\n            n.add(value.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int input, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) input / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int n, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) n / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString(String nums) {\n        if (nums == null) {\n            return null;\n        }\n        return new StringBuilder(nums).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideEx(int list, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) list / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_alt(int s, int nums) {\n        if (nums == 0) {\n            throw new IllegalArgumentException(\"nums must not be zero\");\n        }\n        return (double) s / nums;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_new(String value) {\n        if (value == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : value.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int str, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) str / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> arr, List<Integer> str) {\n        if (arr == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(arr.size() + str.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < str.size()) {\n            if (arr.get(i) <= str.get(j)) {\n                s.add(arr.get(i++));\n            } else {\n                s.add(str.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            s.add(arr.get(i++));\n        }\n        while (j < str.size()) {\n            s.add(str.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> text, List<Integer> n) {\n        if (text == null || n == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(text.size() + n.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < n.size()) {\n            if (text.get(i) <= n.get(j)) {\n                str.add(text.get(i++));\n            } else {\n                str.add(n.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            str.add(text.get(i++));\n        }\n        while (j < n.size()) {\n            str.add(n.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedHelper(List<Integer> arr, List<Integer> list) {\n        if (arr == null || list == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(arr.size() + list.size());\n        int i = 0, j = 0;\n        while (i < arr.size() && j < list.size()) {\n            if (arr.get(i) <= list.get(j)) {\n                str.add(arr.get(i++));\n            } else {\n                str.add(list.get(j++));\n            }\n        }\n        while (i < arr.size()) {\n            str.add(arr.get(i++));\n        }\n        while (j < list.size()) {\n            str.add(list.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Complete the following Java method so it returns the maximum value in an array.", "input": "", "output": "public class ArrayUtils {\n\n    public static int max(int[] n) {\n        if (n == null || n.length == 0) {\n            throw new IllegalArgumentException(\"n must not be null or empty\");\n        }\n        int max = n[0];\n        for (int v : n) {\n            if (v > max) {\n                max = v;\n            }\n        }\n        return max;\n    }\n}", "language": "java", "category": "completion", "difficulty": "easy"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String text) {\n        if (text == null) {\n            return null;\n        }\n        return new StringBuilder(text).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int value, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) value / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_new(int value) {\n        if (value < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= value; i++) {\n            if (value % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int str, int str) {\n        if (str == 0) {\n            throw new IllegalArgumentException(\"str must not be zero\");\n        }\n        return (double) str / str;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that counts the number of vowels in a string.", "input": "", "output": "public class StringUtils {\n\n    public static int countVowels_v2(String n) {\n        if (n == null) {\n            return 0;\n        }\n        int count = 0;\n        for (char c : n.toLowerCase().toCharArray()) {\n            if (\"aeiou\".indexOf(c) >= 0) {\n                count++;\n            }\n        }\n        return count;\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int input, int n) {\n        if (n == 0) {\n            throw new IllegalArgumentException(\"n must not be zero\");\n        }\n        return (double) input / n;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> str, List<Integer> arr) {\n        if (str == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(str.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < arr.size()) {\n            if (str.get(i) <= arr.get(j)) {\n                n.add(str.get(i++));\n            } else {\n                n.add(arr.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            n.add(str.get(i++));\n        }\n        while (j < arr.size()) {\n            n.add(arr.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> input, List<Integer> text) {\n        if (input == null || text == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> s = new ArrayList<>(input.size() + text.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < text.size()) {\n            if (input.get(i) <= text.get(j)) {\n                s.add(input.get(i++));\n            } else {\n                s.add(text.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            s.add(input.get(i++));\n        }\n        while (j < text.size()) {\n            s.add(text.get(j++));\n        }\n        return s;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_v2(List<Integer> list, List<Integer> arr) {\n        if (list == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> n = new ArrayList<>(list.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < list.size() && j < arr.size()) {\n            if (list.get(i) <= arr.get(j)) {\n                n.add(list.get(i++));\n            } else {\n                n.add(arr.get(j++));\n            }\n        }\n        while (i < list.size()) {\n            n.add(list.get(i++));\n        }\n        while (j < arr.size()) {\n            n.add(arr.get(j++));\n        }\n        return n;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int nums, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) nums / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrimeHelper(int str) {\n        if (str < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= str; i++) {\n            if (str % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that checks whether a number is prime.", "input": "", "output": "public class MathUtils {\n\n    public static boolean isPrime_alt(int list) {\n        if (list < 2) {\n            return false;\n        }\n        for (int i = 2; i * i <= list; i++) {\n            if (list % i == 0) {\n                return false;\n            }\n        }\n        return true;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int str, int input) {\n        if (input == 0) {\n            throw new IllegalArgumentException(\"input must not be zero\");\n        }\n        return (double) str / input;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSortedEx(List<Integer> value, List<Integer> nums) {\n        if (value == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> list = new ArrayList<>(value.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < value.size() && j < nums.size()) {\n            if (value.get(i) <= nums.get(j)) {\n                list.add(value.get(i++));\n            } else {\n                list.add(nums.get(j++));\n            }\n        }\n        while (i < value.size()) {\n            list.add(value.get(i++));\n        }\n        while (j < nums.size()) {\n            list.add(nums.get(j++));\n        }\n        return list;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that reverses a string.", "input": "", "output": "public class StringUtils {\n\n    public static String reverseString_v2(String n) {\n        if (n == null) {\n            return null;\n        }\n        return new StringBuilder(n).reverse().toString();\n    }\n}", "language": "java", "category": "function", "difficulty": "easy"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide(int arr, int text) {\n        if (text == 0) {\n            throw new IllegalArgumentException(\"text must not be zero\");\n        }\n        return (double) arr / text;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> input, List<Integer> nums) {\n        if (input == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(input.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < input.size() && j < nums.size()) {\n            if (input.get(i) <= nums.get(j)) {\n                nums.add(input.get(i++));\n            } else {\n                nums.add(nums.get(j++));\n            }\n        }\n        while (i < input.size()) {\n            nums.add(input.get(i++));\n        }\n        while (j < nums.size()) {\n            nums.add(nums.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted(List<Integer> str, List<Integer> str) {\n        if (str == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(str.size() + str.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < str.size()) {\n            if (str.get(i) <= str.get(j)) {\n                nums.add(str.get(i++));\n            } else {\n                nums.add(str.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            nums.add(str.get(i++));\n        }\n        while (j < str.size()) {\n            nums.add(str.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divideHelper(int list, int arr) {\n        if (arr == 0) {\n            throw new IllegalArgumentException(\"arr must not be zero\");\n        }\n        return (double) list / arr;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> str, List<Integer> nums) {\n        if (str == null || nums == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> str = new ArrayList<>(str.size() + nums.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < nums.size()) {\n            if (str.get(i) <= nums.get(j)) {\n                str.add(str.get(i++));\n            } else {\n                str.add(nums.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            str.add(str.get(i++));\n        }\n        while (j < nums.size()) {\n            str.add(nums.get(j++));\n        }\n        return str;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_new(List<Integer> str, List<Integer> arr) {\n        if (str == null || arr == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(str.size() + arr.size());\n        int i = 0, j = 0;\n        while (i < str.size() && j < arr.size()) {\n            if (str.get(i) <= arr.get(j)) {\n                nums.add(str.get(i++));\n            } else {\n                nums.add(arr.get(j++));\n            }\n        }\n        while (i < str.size()) {\n            nums.add(str.get(i++));\n        }\n        while (j < arr.size()) {\n            nums.add(arr.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}
{"instruction": "Fix the following Java method so it avoids division by zero.", "input": "", "output": "public class MathUtils {\n\n    public static double divide_new(int input, int value) {\n        if (value == 0) {\n            throw new IllegalArgumentException(\"value must not be zero\");\n        }\n        return (double) input / value;\n    }\n}", "language": "java", "category": "bug-fix", "difficulty": "easy"}
{"instruction": "Write a Java method that merges two sorted lists of integers into a new sorted list.", "input": "", "output": "import java.util.ArrayList;\nimport java.util.List;\n\npublic class CollectionUtils {\n\n    public static List<Integer> mergeSorted_alt(List<Integer> text, List<Integer> str) {\n        if (text == null || str == null) {\n            throw new IllegalArgumentException(\"lists must not be null\");\n        }\n        List<Integer> nums = new ArrayList<>(text.size() + str.size());\n        int i = 0, j = 0;\n        while (i < text.size() && j < str.size()) {\n            if (text.get(i) <= str.get(j)) {\n                nums.add(text.get(i++));\n            } else {\n                nums.add(str.get(j++));\n            }\n        }\n        while (i < text.size()) {\n            nums.add(text.get(i++));\n        }\n        while (j < str.size()) {\n            nums.add(str.get(j++));\n        }\n        return nums;\n    }\n}", "language": "java", "category": "function", "difficulty": "medium"}