exec_outcome stringclasses 1
value | code_uid stringlengths 32 32 | file_name stringclasses 111
values | prob_desc_created_at stringlengths 10 10 | prob_desc_description stringlengths 63 3.8k | prob_desc_memory_limit stringclasses 18
values | source_code stringlengths 117 65.5k | lang_cluster stringclasses 1
value | prob_desc_sample_inputs stringlengths 2 802 | prob_desc_time_limit stringclasses 27
values | prob_desc_sample_outputs stringlengths 2 796 | prob_desc_notes stringlengths 4 3k ⌀ | lang stringclasses 5
values | prob_desc_input_from stringclasses 3
values | tags listlengths 0 11 | src_uid stringlengths 32 32 | prob_desc_input_spec stringlengths 28 2.37k ⌀ | difficulty int64 -1 3.5k ⌀ | prob_desc_output_spec stringlengths 17 1.47k ⌀ | prob_desc_output_to stringclasses 3
values | hidden_unit_tests stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
PASSED | bb0f74d42a400b966c933739a0d173cc | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
for(int t=0;t<T;t++) {
int n = sc.nextInt();
//int x=sc.nextInt();
long a[... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | b2c01db08c90ee1923ad021b91c67c3a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | /*
"Everything in the universe is balanced. Every disappointment
you face in life will be balanced by something good for you!
Keep going, never give up."
Just have Patience + 1...
*/
import java.util.*;
import java.lang.*;
impor... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 20f89e62fd8ae9411ff19fadb725ae44 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter out;
static Kioken sc;
public static void main(String[] args) throws FileNotFoundException {
boolean t = true;
boolean f = false;
if (f) {
out = new PrintWriter("output.txt");
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 718b10e3a45c63eb1bd1d3a5b1e2c54a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Q2 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parse... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | aaa5f9f2b14d83b1952d3a338cd50fd2 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static BufferedReader br;
static StringBuilder sb = new StringBuilder();
static int index;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
sb = new StringBuilder();
int t... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | e305976487f524bc025be3959abc985a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | f644cc581db5ac510f9375978eafc3b5 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.BigInteger;
import java.io.*;
public class Main implements Runnable {
public static void main(String[] args) {
new Thread(null, new Main(), "whatever", 1 << 26).start();
}
//
private FastScanner sc;
private PrintWriter pw... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 5c42a87d9e11c9c999812d2898b2eccf | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | ae03b6733fe431b4f6b3bd31b136153c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.security.cert.X509CRL;
import java.util.*;
import java.lang.*;
import java.util.stream.Collector;
import java.util.stream.Co... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 9bd573757a38098ec0d355b6bc9b3b53 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class MaximalAnd {
static int[] memo;
public static void main(String[] args) throws Exception {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int arr[] = sc.nextIntArray(n);
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | b678237d817a64855ad1b80c4861073a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.util.stream.*;
public class Sequence {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
int j, max;
scan.nextLine();
StringBuilder result = new StringBuilder();
for(int i = 0; i < t; i++) {
int n = scan.ne... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 1ef86f5e65a36ced0d6883c0c7ad4b19 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | //package javaapplication1;
import java.util.Scanner;
public class JavaApplication1 {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int Test;
Test=in.nextInt();
while(Test-->0){
int Number;
Number=in.nextInt();
long [] Array... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 2450e3376d97dc5bfea78247ffe71409 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.util.*;
import java.io.*;
import java.math.*;
public class B_Avoid_Local_Maximums {
public static void main(String[] args) {
OutputStream outputStream = System.out;
Prin... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | bb6758345fd2fa07eb17f2daa72b83e4 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.util.*;
import java.io.*;
import java.math.*;
public class B_Avoid_Local_Maximums {
public static void main(String[] args) {
OutputStream outputStream = System.out;
Prin... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | aebf6889e40241b86d28f9b1c6057687 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
// when can't think of anything -->>
// 1. In sorting questions try to think about all possibilities like sorting from start, end, middle.
// 2. Two pointers, brute force.
// 3. In graph query questions try to solve it reversely or try to proc... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 714c7b2751b4307d55c9eae01e6bcdb6 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
static final int MOD = (int) 1e9 + 7;
static FastScanner fs = new FastScanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int t = fs.nextInt();
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 424159e8db46a4e8e13ccc201d41f296 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static final int INF = Integer.MAX_VALUE;
static final int NINF = Integer.MIN_VALUE;
static final long LINF = Long.MAX_VALUE;
static final long LNINF = Long.MIN_VALUE;
static Reader reader;
static Writer writer;
static Pr... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | c724350b48c53d3437822ca2f786efc7 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
//import java.lang.*;
import java.io.*;
public class Main {
public static void main (String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt(),n,i=0,j,ans;
int[] a;
while(t-- >0){
n=sc.nextInt();
a=new int[n];
for(i=0;i<n;i++) a[i]=sc.nextInt(); ans... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | c4835cd612afc8aec05eb8473d6ae955 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main (String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt(),n,i=0,j,ans;
int[] a;
while(t-- >0){
n=sc.nextInt();
a=new int[n];
for(i=0;i<n;i++) a[i]=sc.nextInt(); ans=0... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | dc4bf970ee88fddb4b0b77276198557f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
public class HelloWorld{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int temp=0;
int n=sc.nextInt();
int a[]=new int[n];
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | af25c12c3416c1aefde2d0f9ea307335 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int tc = 0; tc < t; ++tc) {
int n = sc.nextInt();
int[] a = new int[n];
fo... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 2c809b2f9f5791d272cfe0e76caaf974 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
PrintWriter out = new PrintWriter(System.out);
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer tok = new StringTokenizer("");
String next() throws IOException {
if (!tok.h... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | e35e828fabdc8bb734c647d09d9ea65e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.*;
import java.util.*;
public class AvoidingLocalMaximums {
//io
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(System.out);
static boolean debug = false;
public static void main(String[] args) throws IOExcep... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | e82ed7ce16e5aa629a4d90b3c820c242 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.Scanner;
public class MainClass {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
while (T > 0) {
T--;
int n = scanner.nextInt();
int ans = 0;
int[] a = n... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | f822c3c42a7b1fd1ca5888ed36660db0 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | // import java.lang.reflect.Array;
// import java.math.BigInteger;
// import java.nio.channels.AcceptPendingException;
// import java.nio.charset.IllegalCharsetNameException;
// import java.util.Collections;
// import java.util.logging.SimpleFormatter;
// import java.util.regex.Matcher;
// import java.util.regex... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 57586e3170a7e4a80d3e56f3ef0f54b7 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class A {
static QuickReader fs = new QuickReader();
static PrintWriter out = new... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 596c3b547d7cc0896598ca1aa80e39aa | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class B {
static QuickReader fs = new QuickReader();
static PrintWriter out = new... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 5d1a1d42990c2d3463ad8e7604c37317 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Practice {
static boolean multipleTC = true;
final static int mod = 1000000007;
final static int mod2 = 998244353;
final double E = 2.7182818284590452354;
final double PI = 3.14159265358979323846;
int MAX = 10000005;
void pre() throws Exception {
}
// All ... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 8c6dac471eeee002e55f1fe0db97f402 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | // package div_2_772;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class B{
public static void main(String[] args){
FastReader sc = new FastReader();
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int a[]=sc.fastAr... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 2274e8ea9a986d71ac7b593b0acebb69 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
public class _772 {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
while (t-- >0) {
int n = sc.nextInt(... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 47923dea5f1fff8ebc9cbc2c7a1e6c43 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes |
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
for (int i = 1; i <= T; i++) {
int n = in.nextInt();
long[] arr = new long[n];
for (int j = 0; j < n;... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 06771a369aa086c5ccb480b8b0b3dc6c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
public class CF {
public static void main(String[] args)
{
// write your code here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=0;i<t;i++)
{
int n=sc.nextInt();
int[] a=new int[n];
int ... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 45dd631b88aa7b2d76f92d5c97d7690b | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class TaskB {
static void solve(FastScanner fs) {
int n = fs.nextInt();
int a[] = takeArrayInput(fs, n);
int res = 0;
for(int i = 1; i < n-1; i++) ... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 292880d692babf07a646e3b1d4017903 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class b1635 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | a07dea61f42b39b62344f18eaa6910aa | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Demo{
public static void main(String args[]) throws Exception{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer sc = new StringTokenizer(bf.readLine());
int t = Integer.parseInt(sc.nextToken());... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 5d0ffbb877adb6e4add77ef207bbd58e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int MAX_SIZE = (int) 1e6;
static boolean []prime = new boolean[MAX_SIZE + 1];
static FastReader scn = new FastReader();
static PrintWriter out= new PrintWriter(System.out);
static class Pair{
int x;
int... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | aec5ead4d2c6b2315973787f34227e85 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner go =new Scanner(System.in);
int t = go.nextInt();
while (t-->0){
int n = go.nextInt();
int[] a = new int[n];
int count = 0;
int ch = 0;
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | c49635492eaf1d81afe2b51742373ae7 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
import java.io.*;
/**
* Problem: CodeForces 1635A
*
* @author atulanand
*/
public class Solution {
public static String solve(int[] a) {
int changes = 0;
int[] x = new int[a.length];
for (int i = 1; i + 1 < a.length; i++) {
if (a[i - 1] < a... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | dfb371d0b53c132f29279c890e109ac5 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
public class CF1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int test = 0;test<t;test++){
int n = sc.nextInt();
int[] arr = new int[n];
int[] lms = new int[n];
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | afeaaecb2af82dba45eda42102418f01 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
public class Main {
static class FastReader {
StringTokenizer st;
BufferedReader br;
public FastReader()
{
b... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 3fad711907f5a97718a94d987daca3d1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Solution {
private final static FastReader scan = new FastReader();
static List<Integer> l1 = new ArrayList<>();
public static void main(String[] args) {
int tc =... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 9d64e2029b2964c23c53d3ed39a76612 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
public class avoid
{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t;
t=sc.nextInt();
while(t-->0){
int n;
n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
arr[i]=sc.nextInt();
int c=0;
for(int ... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 71116a4b41bd58cd505f5cc736547d50 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes |
// Java is like Alzheimer's, it starts off slow, but eventually, your memory is gone.
import java.io.*;
import java.util.*;
public class Aqueous {
static MyScanner sc = new MyScanner();
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
in... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 17f48d6c51cc39cbc71b0b1d70ce7c3c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.lang.*;
import java.io.FileReader;
import java.io.IOException;
import java.math.BigInteger;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.*;
impo... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 659b9104b732fa4346f952976098063b | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.*;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.*;
public class Yoo
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new Buffe... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | b67844a2c226bf88144f7877aba0b4fa | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class GFG {
public static void main (String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
long arr[]=new long[n];
for(int i=0;i<n;i++){
arr... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 3f6d45267e32e420632db34b080756d8 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main
{
public static void main(String[] args)
{
CP sc =new CP();
int tt = sc.nextInt();
while (tt-- > 0) {
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 7b24808ab3aab1594252eb17a0bae25f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | /* ROHAN SHARMA */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class A
{
public static final FastScanner sc = new FastScanner();
public static void main (String[] args) throws java.lang.Exception
{
... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | e0e4a35ef7d31facb9763704d1e7c376 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes |
/**Main Snippet */
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
static FastReader sc;
static StringBuilder sb = new StringBuild... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 83d44999dc22a43e0d005ba6ea2d8b41 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.*;
/**
__ __
( _) ( _)
/ / \\ / /\_\_
/ / \\ / / | \ \
/ / \\ / / |\ \ \
/ / , \ , / / /| \ \
/ / |\_ /| / / / \ \_\
/ / |\/ _ '_| \ / / / \ \\
| / |/ 0 \0\ / | | \ ... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | bbb9a7e95c7964ddec54e8acd8ab8242 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int [] nums = new int[2 * 100000 + 1];
for (int caseNum = 0; caseNum < n; caseNum++){
int arrayNum = scanne... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | d471f69e51a95c9344bf380e2df2e102 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
public class AvoidLocalMaximums {
public static void main (String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamRe... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 46e0373decc10b086a6810f0e5b25513 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
public static PrintWriter out;
public static FastReader in;
public static int mod = 1000003;
static class FastReader{
BufferedRead... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | 4507d516a88bab9cb519c2410eada3ac | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.*;
import java.util.*;
public class codeforces {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new Buffer... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | ba486eedf6cddea4716dee8d1bdc8a4f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | import java.io.*;
import java.util.*;
public class AvoidLocalMaximums {
public static void main(String args[])throws IOException
{
int i,j,k,t,n;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
t=Integer.parseInt(br.readLine());
while(t-->0)
{
n=Integer.parseInt(br.readL... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | d3f90dd9551a02819d4380e3bd05fc93 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$. Each element in this array is an integer between $$$1$$$ and $$$10^9$$$.You can perform several operations to this array. During an operation, you can replace an element in the array with any integer between $$$1$$$ and $$$10^9$$$. Output the minimum number of operations ... | 256 megabytes | /*LoudSilence*/
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Solution {
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
static FastScanne... | Java | ["5\n3\n2 1 2\n4\n1 2 3 1\n5\n1 2 1 2 1\n9\n1 2 1 3 2 3 1 2 1\n9\n2 1 3 1 3 1 3 1 3"] | 2 seconds | ["0\n2 1 2\n1\n1 3 3 1\n1\n1 2 2 2 1\n2\n1 2 3 3 2 3 3 2 1\n2\n2 1 3 3 3 1 1 1 3"] | NoteIn the first example, the array contains no local maximum, so we don't need to perform operations.In the second example, we can change $$$a_2$$$ to $$$3$$$, then the array don't have local maximums. | Java 11 | standard input | [
"greedy"
] | 255abf8750541f54d8ff0f1f80e1f8e7 | Each test contains multiple test cases. The first line will contain a single integer $$$t$$$ $$$(1 \leq t \leq 10000)$$$ — the number of test cases. Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ $$$(2 \leq n \leq 2 \cdot 10^5)$$$ — the size of the array $$$a$$$. The ... | 800 | For each test case, first output a line containing a single integer $$$m$$$ — minimum number of operations required. Then ouput a line consist of $$$n$$$ integers — the resulting array after the operations. Note that this array should differ in exactly $$$m$$$ elements from the initial array. If there are multiple answ... | standard output | |
PASSED | b3031d1063db4bba24b2632e442b6a89 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static TreeSet<String> tSet;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t=sc.nextInt();
while(t... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 89dc3cebdbca8a3590d5065299ef552f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.Scanner;
public class MinOrSum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int cases = sc.nextInt();
int sum=0;
while(cases-- > 0)
{
int N = sc.nextInt();
while(N-- >0)
{
sum|=sc.nextInt();
}
System.out.println(sum);
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 88953e81e6c0bd2a335f07d745d4b63f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | //package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class ProblemSolving {
static Scanner scanner = new Scanner(System.in);
static BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 99af5a5cba783d399a0370a54f19c09f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | //package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class ProblemSolving {
static Scanner scanner = new Scanner(System.in);
static BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 8c9cdd7221c9e250651c91ce422d5b9e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{
static int[] num_to_bits = new int[] { 0, 1, 1, 2, 1, 2, 2,
3, 1, 2, 2, 3, 2, 3, 3, 4 };
static int co... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 0ccec42df71fb1866afa8dceeddbef08 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String args[]){
FScanner in = new FScanner();
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
while(t-->0) {
int n=in.nextInt();
long arr[]=new long[n];
for(int i=0;i<n;i++)
arr[i]=in.... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 35df48285670e8e9a4d961c102dde29c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main (String[] args) throws java.lang.Exception
{
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t= sc.nextInt();
while (t-- !... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 01d2f164209ef1d0d4ecc09e85d13c26 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class test {
static int[] dx = {1,-1,0,0,1,1,-1,-1};
static int[] dy = {0,0,1,-1,1,-1,1,-1};
static long e97=1000000007;
public static void main(String args[]) {
Sca... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 5e4393a1639d7ee9c3837d04939b35af | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | // letsgoooooooooooooooooooooooooooooooo
import java.util.*;
import java.io.*;
public class Solution{
static int MOD=1000000007;
static PrintWriter pw;
static FastReader sc;
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastR... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 3f01365ceedc63188e89623974c31bae | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class temp {
public static void main(String[] args) throws IOException {
// File input = new File("input.txt");
// BufferedReader br = new BufferedReader(new FileReader(input));
BufferedReader br = new BufferedReader(new InputStreamR... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 7bd14c0b5fe9a3eeeca122de99df2ec1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import j... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | a30f88b9ceaeed238173e51d069a4487 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
public class Min_Or_Sum
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream di... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 374d4c71a0e93054b7f6bab6f62a8615 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.awt.*;
import java.util.*;
import java.io.*;
// You have that in you, you can do it........
public class Codeforces {
static FScanner sc = new FScanner();
static PrintWriter out = new PrintWriter(System.out);
static final Random random = new Random();
static long mod = 1000000007L;... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 01855efb3def45c11c00bdca2c02a2d1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.sqrt;
import static java.lang.Math.floor;
public class topcoder {
public static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNo... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 4042c2a47f4b8d7190c708200bbbb5fb | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.lang.*;
import java.io.*;
import java.util.*;
public class MinOrSum {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(
new FileReader("input.txt")... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 888ab144dd7d674a7e66722d088f91d0 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for(int m = 0; m < t; m++){
int n = s.nextInt();
long[] temp = new long[n];
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | aa0b764550c1d18c2f7dca613e95b674 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | //package codeforces.vp.vp_div_2_772.A;
import java.util.Scanner;
/**
* https://codeforces.com/contest/1635/problem/A
* */
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0) {
solv... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | b4d63125558124de04df855f5a8388e5 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class MinORSum {
//-----------PrintWriter for faster output---------------------------------
public static PrintWriter out;
//-----------MyScanner class for faster input----------
public static class MyScanner {
BufferedReader... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | dffd5afb5a907e82b7dd2587287c0281 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int c = 0;
public static void sort(int[] arr, int l, int r) {
if (l < r) {
int mid = (r + l) / 2;
sort(arr, l, mid);
sort(arr, mid + 1, r);
merge(arr, l, mid, mid + 1, r);
}
}
public static void merge(int[] arr, int l... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 0f339bdb86a0ea30768da506a38cd49b | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int c = 0;
public static void sort(int[] arr, int l, int r) {
if (l < r) {
int mid = (r + l) / 2;
sort(arr, l, mid);
sort(arr, mid + 1, r);
merge(arr, l, mid, mid + 1, r);
}
}
public static void merge(int[] arr, int l... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 873be2ff524d69f3196b14521c5b214f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner s =new Scanner (System.in);
int t=s.nextInt();
while(t-->0){
int n=s.nextInt();
int a[]=new int[n];
for (int i=0;i<n;i++){
a[i]=s.nextInt(); }
int sum=0;
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 158168391a1aba2d9ee81e8247eb249d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import ... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 051f0cd128289df92c3fa49c11cfb2f6 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Main {
static class Reader
{
BufferedReader... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 222cb0ef570b5f4f3241e675e41e0ab7 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
StringBuilder output = new StringBuilder();
int t = input.nextInt();
while(t > 0) {
int n = input.nextInt();
int[] a = ne... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 4de0eefbd642446e2f799e152f8a1029 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
public class A ... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | e5529a7358131d169de316248625acd8 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author ankur.y
*/
public class Ma... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | aab10c91eec9d83ae8f638e6c4759bbf | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | //package CodeForces;
import java.util.*;
public class Main {
public static void main(String[] arg) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t > 0) {
int n = sc.nextInt();
int[] arr = new int[n];
int ans = 0;
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | f8c265984adab77f69a03de72feef7a9 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class First {
public static void main(String[] args) {
InputStream inputStream = System.in... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 62abfe140bb3291883d8045540f1df3e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
import java.io.*;
// cd C:\Users\Lenovo\Desktop\New
//ArrayList<Integer> a=new ArrayList<>();
//List<Integer> lis=new ArrayList<>();
//StringBuilder ans = new StringBuilder();
//HashMap<Integer,Integer> map=new HashMap<>();
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 8e0192dd499a300a12b89a484f021fa3 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Solution {
static Long MOD = (long) (1e9 + 7);
static long[] sieve;
static long[][] dp;
static long[]dpp;
static long[][] matrix;
static ArrayList<Integer>arr... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 56d36add32a5e4a6b5d73e940a3fd60e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.lang.*;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
pu... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 26638e0a059afa508d755c7a208fcb90 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes |
import java.util.*;
public class Practice {
static int dp[][];
int M = Integer.MIN_VALUE;
int m = Integer.MIN_VALUE;
public static void main(String args[])
{
//--------------start------------
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | d132fc547829c66febab908c25507f88 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class q1 {
static HashSet<Long> hs;
static int[][] dp;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 04f9220a4b30deef1f5ea314da35d919 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int mod = 1000_000_007;
static long mod1 = 998244353;
static boolean memory = true;
static FastScanner f;
static PrintWriter pw;
static double eps = 1e-6;
static int oo = (int) 1e9;
public static void solve() ... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | f035e810778ef01c8ba7b1d40c2f8aeb | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes |
import java.util.*;
import java.io.*;
public class A {
public static void main(String[] args) throws IOException {
FastReader in = new FastReader(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int t = in.nextInt();
for (int tt = 0; tt <... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | bbab71f397cf2c5591687829ba98dc6b | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner();
int t = in.nextInt();
for (int i = 0; i < t; i++) {
int n =... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 02c37310ca45dcf84b01e0e4835c8ae3 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
public class R772A {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 8cb1babad0ee1af29c81aea09c7e2c5a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
public class Solution
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int k=0;k<t;k++)
{
int n=sc.nextInt();
int[] arr=new int[n];
for(int i=0;i<n;i++)
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 3385db14796d2a1e3d6f9de76a59428a | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public final class A_Min_Or_Sum {
//int 2e9 - long 9e18
static PrintWriter out = new PrintWriter(System.out);
static FastReader fs = new FastReader();
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | c5c6cfdf1304aa73e1f956e18ffaee62 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class MinOrSum {
public static void main(String[]args)throws Exception{
Scanner sc=new Scanner(System.in);
PrintWriter pw=new PrintWriter(System.out);
int n=sc.nextInt();
while(n-->0){
int x=sc.nextInt();
String [] list=sc.nextLine().s... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 25c3a4dd9cbcd220b872b3baf527d433 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.util.stream.*;
public class App {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws Except... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | 5e31c53c031aa4d266031cc47d1a83c2 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args){
Scanner scn = new Scanner(System.in);
int cases = scn.nextInt();
while(cases-->0){
int len = scn.nextInt();
int ans = 0;
for(int i =0;i<len;i++){
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | c3c724cb6ea5cd7b11688a7bd5127428 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.*;
public class codeforces {
static Random rn = new Random();
static Scanner sc = new Scanner(System.in);
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) throws IOException {
int test = sc.nextInt();
while (te... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output | |
PASSED | a1c9885216002002d4af85bf48cf685c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int num =in.nextInt();
for ( int c = 1 ;c <= num ;c++ ){
int num2 = in.nextInt();
int sum = 0 ;
for (int c2 = ... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 8 | standard input | [
"bitmasks",
"greedy"
] | 7fca54a73076ddfeb30b921b9e341f26 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \leq t \leq 1000)$$$. Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(2 \leq n \leq 100)$$$ — the size of array $$$a$$$. The second line of each test case contai... | 800 | For each test case, print one number in a line — the minimum possible sum of the array. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.