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 | a941748fa20e402b8b28595cb71da9d0 | 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 A1635 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int T = in.nextInt();
for (int t=0; t<T; t++) {
int N = in.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 | 710af846c24c0be89af06f2d7562e629 | 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 amd{
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t-->0) {
int n=s.nextInt();
PriorityQueue<Integer> pq= new PriorityQueue<Integer>();
for(int i=0; i<n;i++) {
int a=s.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 | 00a89192d7a1aab21d8c93c28172c07f | 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.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
try {
Scanner sc=new Scanner... | 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 | 95f963c0b81d940aac53aa199db6c59b | 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.*;
import java.lang.Math;
import java.util.StringTokenizer;
public class seventeen {
public static void main(String[] args){
int a[], b, t;
String str;
... | 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 | df63a1fd398a1910d38e66909acff857 | 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 A1635 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T = in.nextInt();
for (int t=0; t<T; t++) {
int N = in.nextInt();
int answer = 0;
for (int n=0; n<N; 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 | ef98ce0085a65ba640c09db5f0ef52bd | 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) {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int T = in.nextInt();
for (int tt = 0; tt < T; tt++) {
int ... | 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 | b06b25964e2559a708e234ecc74a5034 | 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.StringTokenizer;
public class minorsum {
public static void main (String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st =... | 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 | 4c787b01ea4c5da77855a379e4805671 | 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.*;
import javafx.scene.layout.Priority;
public class Main
{
public static void main(String args[])
{
FastScanner input = new FastScanner();
int tc = input.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 | 38871a97fa006ce16da7030906c9e042 | 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 Code
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0){
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 | 7b17db7711133a71b0da2e91da3a0e49 | 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 final class Main {
//int 2e9 - long 9e18
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)};
static... | 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 | 53ad66f6e16927ad01620d0fac947416 | 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 Main {
static FastReader scan = new FastReader();
// static Scanner scan= new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int n = scan.nextInt();while (n-->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 | 67f3e74662cbfa3d8cdd12cf300e0534 | 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.Desktop;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.sql.Array;
import java.util.ArrayDeque;
import java.util.ArrayList;
import ja... | 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 | 5b8dafd7979a601882fbb05cfdc40917 | 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 MinOrSum {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int numTests = sc.nextInt();
for (int i = 0; i < numTests; i++) {
int n = sc.nextInt();
int sum = 0;
for (int num = 0; num < n; nu... | 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 | 8a836f7540985d3cbe720438601b6433 | 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 {
private static void solve() {
int N = sc.nextInt();
int ans = 0;
for (int i = 0; i < N; i++) {
ans |= sc.nextInt();
}
System.out.println(ans);
}
private static final Scanner sc = new Scanner(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 | 7bd7d8da004e1a73f42f27adc56ddd1b | 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 CodeForcesTest {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int noOfTest = sc.nextInt();
for(int j=0; j<noOfTest; j++) {
int n = sc.nextInt();
int[] a = new int[n];
int ret... | 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 | 45989f420ea5111d5158740a04eda4b7 | 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 Round772DIV2;
import java.io.*;
import java.util.*;
public class A { //MinOrSum
public static void main(String[] args) throws IOException {
// Scanner sc = new Scanner(new FileReader("input.in"));
// PrintWriter pw = new PrintWriter(new FileWriter(""));
Scanner sc = new... | 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 | 56bfe38ee123468d04b626e69c2fff09 | 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 {
public static PrintWriter out;
private static final long MOD = 998244353L;
private static void solve(long[] arr){
long res = 0;
for(long x: arr){
res |= x;
}
out.println(res);
}
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 | cfd51be6ca256910db3579b99caa59b8 | 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 code {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
ArrayList<Integer> a = new ArrayList<>();
for (int 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 | 2588e511f8f6972c16482ca346abe5e0 | 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.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.io.PrintWriter;
public class Template {
public static void main(String[] args){
... | 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 | 41b1d9c7217c98befaadb1947d605245 | 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.*;
public class Main {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
private static int T, n;
private static int[] a;
public static void main(String[] args) 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 | e963bc0a3a6c974ae8e5cb7c4aa63ba7 | 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.image.AreaAveragingScaleFilter;
import java.io.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
public class Pratice {
static final long mod = 1000000007;
static StringBuilder sb = new StringBuilder();
static int xn = (int) (2e5 + 10);
static... | 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 | 59a9ddf1c2168a4ef993649607b6197e | 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.*;
import static java.lang.Math.*;
public class A {
static PrintWriter pw = new PrintWriter(System.out);
static FastReader fr = new FastReader();
public static void main(String[] args) {
int t = fr.nextInt();
while (t-- > 0) {
sol... | 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 | 659415386b0b0f4023ac30fd8c78982a | 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.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;
... | 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 | 123a6b3a6d7382433e0ce098dac192d1 | 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;
public class A1635 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] temp = br.readLine().split(" ");
... | 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 | e25f187a0c4dd71de34c072f9f6c3afd | 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 minorsum
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
int ar[]=new int[n];int a=0;
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 | e0cc634bb68660548a72e54b749f25ae | 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.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.uti... | 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 | f445173519f78862414cec951c5a072c | 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.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
try... | 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 | 4a6bd5770730d29d405fb98ba3b10ea8 | 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 Solution {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer out = new StringBuffer();
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 | 5df872ac88348d06d66d983a32d2c1f1 | 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;
public class MinSum {
public static void main(String[] args) throws IOException
{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int test = Integer.parseInt(bf.readLine());
while(tes... | 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 | dcc3c0f69175a9fa1f2f1bebf62bfb8d | 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.lang.*;
public class BinaryNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
Integer t = sc.nextInt();
for(int i=0;i<t;i++){
Integer n = sc.nextInt();
int [] a= new 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 | 36d8d2e67e02f40eeec2900358eba5a1 | 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 MyCpClass{
public static void main(String []args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int T = Integer.parseInt(br.readLine().... | 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 | 3a92e5550722ece8639be42de6c41e6a | 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 | //CP- MASS_2701
import java.util.*;
import java.io.*;
public class A_Min_Or_Sum {
static FastReader in=new FastReader();
static final Random random=new Random();
static long mod=1000000007L;
static HashMap<String,Integer>map=new HashMap<>();
public static void main(String args[]) throws IO... | 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 | b69045e08df97c116818f5b2a63005e6 | 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 A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n=sc.nextInt();int ans=0;
int a[]=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 | 6b4aa3ff208d2ed977c175e70ba33ab9 | 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.StringTokenizer;
public class Main {
static int N = 2 * 100010;
static AReader scan = new AReader();
static void slove() {
int n = scan.nextInt();
int x = 0;
while(n-->0){
x |= scan... | 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 | 6c0653e61695166d910329fb32276e18 | 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.*;
import java.util.StringTokenizer;
import java.util.Collections;
import java.util.concurrent.CopyOnWriteArrayList;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastRead... | 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 | 11c0f0771dead0dccfeb8785ec721cf9 | 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 Test {
static HashSet <String>[] likes;
static HashSet <String>[] dislikes;
static HashSet <String> Ingredients;
static int[] numLikes;
static int [] numDislikes;
static int n;
public static int lengthOfLongestSubstring(String s) {
HashMap <Cha... | 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 | 2a6b99f28f025ee57f5d56ddb3f8eeb8 | 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.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import jav... | 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 | bc7b3f13ae8e4dfd980f07bea4fbec49 | 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{
public static void main(String[] args) {
Scanner sca = new Scanner(System.in);
int t = sca.nextInt();
while (t-- > 0) {
int n = sca.nextInt(), ans = 0;
for (int i = 1; i <= n; i++) {
int x = sca.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 | 84c88e3e949161b7c63d839262adee77 | 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 class Pair {
int a,b;
public Pair(int a,int b){
this.a = a;
this.b =b;
}
}
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new Pri... | 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 | 3f6642bc91569ad82a23220f8e2293c1 | 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.text.DecimalFormat;
import java.util.*;
public class Codeforces {
static long mod = 1000000007 ;
public static void main(String[] args) throws Exception {
PrintWrite... | 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 | 1710ad54b6b06ba7170361b69b2af309 | 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 | /*
Bissmillah_send
IN SHA ALLAH ACCEPTED
*/
import java.lang.*;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
public class MyClass {
static Scanner in = new Scanner(System.in);
static void solve()
{
int n = in.nextInt();
int[] arr = new int[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 | 8434cbef9c113fe2fb457884f5b3bf6e | 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 long cr[][]=new long[1001][1001];
//static double EPS = 1e-7;
static long mod=1000000007;
static long val=0;
public static void main(String[] args)
{
FScanner sc = new FScanner();
//Arrays.fill(prime, true);
//sieve();
//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 | f88833ba1dae0591d37eed24b555cbc0 | 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();
while(t-->0){
int n= sc.nextInt();
int ans = 0;
for(int i=0;i<n;i++){
ans |= 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 | 89876965e299547be37ed1088562a35e | 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.io.*;
public final class PROBOBAL {
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine()),b=0,n=0,j=0,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 | 062bd91e86afccf1252876649d41f4a3 | 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 | /*
* Created by cravuri on 2/21/22
*/
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 1; t <= T; t++) {
int N = sc.nextInt();
int[] bits = new... | 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 | 6eb4028bf1d3a3db43a9fdf49c6797d8 | 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 {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
... | 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 | 63247330bcb43ae00d5a62e5d23c4a35 | 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 cfrcs {
//
// static boolean prime[] = new boolean[n+1];
// static void sieve(int n)
// {
//
// for(int i=0;i<n;i++)
// prime[i] = true;
//
// for(int p = 2; p*p <=n; p++)
// {
//
... | 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 | 9c594fb10078cec58ad7d86a9f6ddf7f | 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 Main {
public static void main(String[] args) throws Exception {
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int arr[] = sc.nextIntArray(n);
int sum=arr[0];
for(int i=1;i<n;i++) {
sum|=arr[i];
}
pw.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 | fe3abe7bba04f521fa553f7a35dee365 | 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.lang.*;
public class PracticeCodeforces1635A{
public static void main(String []args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine());
while(T-- > 0){
int N = Integer.parseInt(b... | 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 | d5b964ad2dee5ea45cd04d4cdd56582d | 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.math.*;
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.hasMoreTok... | 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 | 453b27e6aa82b807c84eb6f1cf960c14 | 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 habd{
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int tc = sc.nextInt();
while(tc-->0){
int n = 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 | 796cbcb544dd9f612338aaadb3a34e38 | 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 MinOrSum{
public static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintW... | 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 | 4ef9eb1d82fd6eaea57e00cf914d4725 | 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{
static FastReader sc=null;
public static void main(String[] args) {
sc=new FastReader();
int t=sc.nextInt();
for(int tt=0;tt<t;tt++) {
int n=sc.nextInt();
int a[]=sc.readArray(n);
int ans=0;
for(int e:a)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 | 5c2414851a7adf0795fc8deadd7aa003 | 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 Solution {
static FastScanner scr=new FastScanner();
// static Scanner scr=new Scanner(System.in);
static PrintStream out=new PrintStream(System.out);
static StringBuilder sb=new StringBuilder();
static class FastScanner {
BufferedReader br... | 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 | f8884a346f76d87af0fba828f21c076c | 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 MinOrSum{
static long mod = 1000000007L;
static MyScanner sc = new MyScanner();
static void solve(){
int n = sc.nextInt();
int arr[] = sc.readIntArray(n);
int or = arr[0];
for(int i = 1;i<n;i++){
or|... | 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 | e0eb67194b84eb75a7772e0e33498133 | 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 faltu;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Map.Entry;
public class Main {
static long LowerBound(long[] a2, long x) { // x is the target value or key
int l=-1,r=a2.length;
while(l+1<r) {
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 | 547a556def3f9abc927b04206ae6b3c9 | 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) {
new A().run();
}
BufferedReader br;
PrintWriter out;
long mod = (long) (1e9 + 7), inf = (long) (3e18);
class pair {
int F, S;
pair(int f, int 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 | e5cc8988d8d48bfe744eda470a28fb47 | 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.IOException;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.List;
public class MinOrSum {
static InputReader inputReader=new InputReader(System.in);
static Bu... | 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 | df79ed541a542f1edf9b7f273c233e57 | 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 minOrSum {
public static void main(String[]args){
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t>0){
int n=s.nextInt();
int arr[]=new int[n];
int sum=0;
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 11 | 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 | 247b3657cfa9fc3271c082daf9477107 | 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 static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.Math.sqrt;
import static java.lang.Math.pow;
import static java.lang.System.out;
import static java.lang.System.err;
import java.util.*;
import java.io.*;
import java.math.*;
public ... | 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 11 | 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 | 0a2f6d812683490325fc96d4fa9ff122 | 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 Problem_A {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int i = scan.nextInt();
while (i>0){
int n = scan.nextInt();
int[] arr = new int[n];
for (int ele = 0; ele < n; ele... | 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 11 | 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 | 8903997d52a7d1e89f07f005dc15c67e | 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 c5{
static class Pair{
int first;
int last;
public Pair(int first , int last){
this.first = first;
this.last = last;
}
public int getFirst(){
return first;
}... | 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 11 | 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 | 8590886abfcdecfa296b545a1eebf044 | 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 static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.math.BigInteger;
import java.util.Arrays;
import javax.lang.model.util.ElementScanner6;
public class Main {
static fi... | 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 11 | 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 | e3872f07d640c350e1a6e94fe7a8baac | 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.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 | ["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 11 | 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 | a580d655ea846fa79104d67811dabbcf | 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 |
// Working program with FastReader
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class A_Min_Or_Sum {
static class FastReader {
BufferedReader br;
Strin... | 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 11 | 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 | 52463275f22b73cd15c8b07b56e572d6 | 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 Solution {
public static void main(String[] args) throws java.lang.Exception {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int[... | 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 11 | 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 | ebd2940d7b88085c3491c80867041af0 | 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.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
public class coding {
static class Fas... | 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 11 | 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 | c2dc35deb3e47146c5c48685555cc322 | 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 xor
{
public static void main(String args[]) throws Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
int x=0;
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 11 | 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 | 8bd1966cff3d6f6cd00d38e0dbff620c | 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
{
static Scanner sc = new Scanner (System.in);
public static void main(String[] args) {
int test = sc.nextInt();
for ( int i=0; i<test; i++){
int a = sc.nextInt();
long[] arr = new long[a];
long or=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 11 | 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 | 3c49fc264a89f0d37ec3b60a30f54605 | 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 cf772a {
static final int maxn = (int)1e5+100;
static int a[] = new int [maxn];
public static void main(String[] args){
Scanner cin = new Scanner(new InputStreamReader(System.in));
int t = cin.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 11 | 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 | c685fd0b5391a8cb344bd22a8227f30d | 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 Min_Or_Sum {
public static void main(String[] args) {
Scanner str = new Scanner(System.in);
int x = str.nextInt();
for (int i = 0; i < x; i++) {
int z = str.nextInt();
int arr[] = new int[z];
for (int j = 0; j < z... | 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 11 | 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 | ea76bcb4ac378436b09500f469317c37 | 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 CodeforcesRound_772;
import java.util.Scanner;
public class ProblemA {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int it = 0; it < t; it++) {
//input starts here
... | 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 11 | 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 | 11bdac77f55c8011be0e22e461f4ab79 | 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.*;
import java.util.StringTokenizer;
public class Main {
static class FastReader {
StringTokenizer st;
BufferedReader br;
public FastReader()
{
b... | 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 11 | 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 | abae201502a499f951ea7d906f24102a | 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 | /**
* 02/20/22 moring
* https://codeforces.com/contest/1635/problem/0
*/
// package codeforce.cf.div2.r772;
import java.util.*;
import java.io.*;
public class A {
static PrintWriter pw;
/*
[6, 6] -> [0, 6]
[3, 5, 6] -> [3, 5, 4]
*/
void solve1(int n, int[] 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 11 | 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 | 49f9b352fd72dbe73ae5aeabc8b5ad8e | 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.*;
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{
... | 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 11 | 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 | 0c212fb3fede2210b955e79d65514b4d | 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.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.File;
import java.io.FileInputStream;
import java.util.*;
public class Main {
// static final File ip = new File(... | 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 11 | 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 | 780f0d775b365ec9de93f5e434627ad1 | 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 | /*
* Author:- Tanmay
*/
/*
/\_/\
( ._.)
/ >🍔 \>🍔
*/
import java.io.*;
import java.util.*;
public class Main {
static class Pair{
int f,s;
Pair(int f, int s){
this.f = f;
this.s = s;
}
}
static void sort(Pair[] arr) {
Arrays.sort(arr, new Comparator<Pair>() {
@Ov... | 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 11 | 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 | aa604eed32915a565552e4fee119c028 | 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 class JoinSet {
int[] fa;
JoinSet(int n) {
fa = new int[n];
for (int i = 0; i < n; i++) fa[i] = i;
}
int find(int t) {
if (t != fa[t]) fa[t] = find(fa[t]);
retu... | 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 11 | 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 | 082bce8a27ebccb21c5d7c38b265fef4 | 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.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java... | 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 11 | 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 | d67205985bd9f45cf671334c71bc020b | 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 Main {
public static Scanner sc = new Scanner(System.in);
public static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
int t = sc.nextInt();
while( t > 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 11 | 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 | 53b1cc063489b8a5470a6c75a6fffb36 | 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 Main {
public static Scanner sc = new Scanner(System.in);
public static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
int t = sc.nextInt();
while( t > 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 11 | 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 | c79ecdbc810afeac40d2ce8e8d5686e1 | 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.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Sample {
public static int calc(int[] list) {
for (int i = 0; i < list.length; i++) {
for (int j = i + 1; j < list.length; j++) {
list[i] = list[... | 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 11 | 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 | 18ecd7f982ee304c014af6100226110c | 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.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 | ["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 11 | 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 | cb0f44e7d1aed6c5496e9339947824ca | 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.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 | ["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 11 | 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 | 4a62d4c178091750ed96a3995bd7a452 | 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.StringTokenizer;
public class A {
static final int INT_MAX = Integer.MAX_VALUE;
public static void main(String[] args) throws Exception {
FastReader in = 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 11 | 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 | 7e9bcbb9167e3b48ce121354711c8f96 | 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.StringTokenizer;
import java.io.PrintWriter;
public class A {
static final FastReader sc = new FastReader();
static final PrintWriter out = new PrintWriter(System.out);
public static void main(St... | 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 11 | 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 | f4e9ae90bd2949dfeab2b4b097a0063d | 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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
public class A {
static final Reader in = new Reader();
static final PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int t = in.next... | 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 11 | 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 | be42cde0fef7b6964da43ecb61be191c | 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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
public class A {
static final Reader in = new Reader();
static final PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int t = in.next... | 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 11 | 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 | 9ab17bf012ffd16e870ef8575f2f8f31 | 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.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;
/**
*
* @author eslam
*/
public class JavaApplication1081 {
static class FastReader {
Buffered... | 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 11 | 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 | ab1d4d60961a02727e00c0a76b5e45ab | 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.lang.*;
import java.util.*;
public class GFG {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
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 11 | 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 | 9b309943ebd2b2d28ace9643a8770073 | 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 MinOrSum {
public MinOrSum(String[] args) throws Exception {
// TODO Auto-generated constructor stub
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(reader.readLine());
for (int i=0; i<t; 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 11 | 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 | 47fa931fd5c9c70261d926297e895300 | 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 ar[]=new int[n];
int sum=0;
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 11 | 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 | 5e63442493de3767f152fe1b3806c156 | 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();
for(int k=0;k<t;k++){
int n = s.nextInt();
int a = s.nextInt();
for(int i=1; i<n; i++)
{
a|=s.nextInt();
}
Syste... | 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 11 | 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 | f052a647e142c4d71c82047b9d515b45 | 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 quesA{
public static void main(String[] args) throws Exception {
// String[] parts=br.readLine().split(" ");
// int n=Integer.parseInt(parts[0]);
// int k=Integer.parseInt(parts[1]);
BufferedReader br = new 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 11 | 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 | a02711eb09ab6de7ddd87d9db0339278 | 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 minorsum
{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++){
arr[i]=sc.nex... | 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 11 | 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 | 71818764d9826955466b05ca1bbf66af | 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 solve {
static void MinOrSum(){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
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 11 | 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 | 27e553ab0bce45017bd69627d0ea0a2f | 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 {
FastReader sc = new FastReader();
int t = sc.nextInt();
while (t-- > 0) {
int n=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 11 | 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 | 408e893b85c4f7f43554f5b1aecae80a | 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 Mainnn {
// static final File ip = new File("input.txt");
// static final File op = new File("output.txt");
// static {
// try {
// System.setOut(new PrintStream(op));
// System.setIn(new FileInputStream(ip));
// } catch (Exceptio... | 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 11 | 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 | 18634b3ec95bb2d2fac5c3d37042d329 | 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 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 | ["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 11 | 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 | 477280d30eddf6a6730e4bf1d29ab9c5 | 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 qw {
public static void main(String args[]) {
Scanner sc = new Scanner();
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int ar[] = new int[n];
for(int i=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 11 | 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.