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 | 87a589c795545ddffd88f8876e49e31a | 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 cf2 {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i++){
a[i]=sc.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 | 9816cfd070f69e6010481cbf7bf48ae3 | 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 |
// Java is like Alzheimer's, it starts off slow, but eventually, your memory is gone.
import java.io.*;
import java.util.*;
public class Aqueous {
static MyScanner sc = new MyScanner();
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
int t = sc.nextI... | 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 | b26aefb06c265f3bf9028e5609f8910c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class TaskA {
static void solve(FastScanner fs) {
int n = fs.nextInt();
int a[] = takeArrayInput(fs, n);
int res = 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 | cebf4e61a8a521effc886195ef125b57 | 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.ArrayList;
import java.util.List;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
for (int i = 0; i < n; i++) {
test(sc);
}
... | 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 | a1262922efae06d0c6310c7fef78c1e7 | 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.lang.*;
import java.io.FileReader;
import java.io.IOException;
import java.math.BigInteger;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.*;
impo... | Java | ["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 | d5b61132923eb18c4b11e1c7a97f40df | 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 PA{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int i = 0; i<t; i++)
{
int n = in.nextInt();
int[] arr = new int[n];
for (int j = 0; j<n; j+... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 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 | 41ab798ad97c71567086c7b4afb5bbe0 | 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 cf772a {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
f... | 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 | e4e71c786d985513689a7f5e32519154 | 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 BufferedReader br;
static StringBuilder sb = new StringBuilder();
static int index;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
sb = new StringBuilder();
int t... | Java | ["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 | cad6b7b60a14159525d5117c5790f408 | 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 q1 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(br.readLine());
while (t-- > 0) {
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 | bcbf1d339bc446d1ed919f04383e3e1d | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.io.PrintWriter;
import java.io.OutputStream;
public class Solution{
public static void main(String[] args){
FastReader sc=ne... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 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 | a52633457e6fe16112749e9f34d34305 | 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.io.*;
import java.util.*;
//
public class Example {
static BufferedWriter bw;
static {
bw = new BufferedWriter(new OutputStreamWriter(System.out));
}
static class FastReader {
BufferedReader br;
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 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 | bc513e75f96fad17736794ee7dc2b801 | 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.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamW... | 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 | 2fbf20c5825feecdd29af2ebe2eb4f64 | 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.*;
// Compiler version JDK 11.0.2
public class Dcoder
{
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];
for(int i=0;i<n;i++)
arr[i]=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 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 | 88153d20bfff8647da1a0d0312ad97c4 | 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) {
Scanner sc=new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int ans=0;
int[] arr=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 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 | 197e9636bbecf9cb050890b96cc33ee0 | 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 in = new Scanner(System.in);
for(int t= in.nextInt();t>0;t--)
{
int n = in.nextInt();
int a = in.nextInt();
for (int i =1;i<n;i++)
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 | 1f636b0b2b1747bef383dd6ebfb12f82 | 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 PrintWriter pw = new PrintWriter(System.out);
static Scanner sc = new Scanner(System.in);
static class Scanner {
StringTokenizer st;
BufferedReader br;
public Scanner(InputStream s) {
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 | 6fe77f5fd21cce1e23c55eab57c6740d | 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_Min_Or_Sum{
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();
}
... | 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 | c759b20b11d740a9dbed0c3995a257e6 | 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 Main{
//見なくていいよ ここから------------------------------------------
static class InputIterator{
ArrayList<String> inputLine = new ArrayList<>(1024);
int index = 0; int max; String read;
InputIterator(){
try{
BufferedReader br = 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 | 9be8d0e5bc7ee1f1d9b4c66ba85c0517 | 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 fareeda.ragab.random;
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 input = new BufferedReader(new InputSt... | 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 | 76a41d53f9a2e1a12d7f7aa9fee5299c | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner 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 | 3e465a936519fc1a6a1c5fad70b428b0 | 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 | //Utilities
import java.io.*;
import java.util.*;
public class a {
static int t;
static int n;
static int[] a;
static int res;
public static void main(String[] args) throws IOException {
t = in.iscan();
while (t-- > 0) {
n = in.iscan(); a = new int[n];
res = 0;
for (int i = 0; i < 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 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 | 756e295a5614a18c4dfd626bdc872fe6 | 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 sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0)
{
int n = sc.nextInt();
long[] a = new long[n];
long ans = 0;
for(int i=0;i<n;i++)
{
a[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 | bdd52e02ad02a42ae9c03773becf3c76 | 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.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
public class One {
static class FastScanner
{
BufferedReader br;
StringTokenizer st;
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 | bfa0d5db4458136ef67f3c30eb267e97 | 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 obj = new Scanner(System.in);
public static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
int len = obj.nextInt();
while (len-- != 0) {
int n=obj.nextInt();
long ans=0;
... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 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 | 942795c3a70b8c83d7def1b78453f28e | 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 | /*
#: 1635A
Difficulty: 800
*/
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class MinOrSum
{
public static void main(String[] args) throws IOException
{
Scanner sc= new Scanne... | 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 | dadac61113ec990061b0f0ae06c79bfa | 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 thisDaMain {
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> al = new ArrayList<>();
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 | 36cd5d68ef50f8b3b709b5e46cdf8b37 | 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.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.security.cert.X509CRL;
import java.util.*;
import java.lang.*;
import java.util.stream.Collector;
import java.util.stream.Co... | Java | ["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 | 3e056e4de2df475cf237bfe5ee553de4 | 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.Arrays;
public class B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int t = Inte... | 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 | fe064e20885549425f16b900d9472b0f | 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 CODE {
public static void main(String[] args) {
try {
System.setIn(new FileInputStream("input.txt"));
System.setOut(new PrintStream(new FileOutputStream("output.txt")));
} catch (Exception e) {
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 | 7d50a3abee479aff974ec49b59fe9135 | 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.reflect.Array;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) {
in = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
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 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 | f1ede1b8ba5b52fb422831c94b7e3849 | 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 Main {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
int t=in.nextInt();
while(t-->0){
int n=in.nextInt();
int[] array=new int[n];
for (int i = 0; i <n; i++) {
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 | 03e1e1f687e9039401b7dfe2288d1065 | 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 |
// Java is like Alzheimer's, it starts off slow, but eventually, your memory is gone.
import java.io.*;
import java.util.*;
public class Aqueous {
static MyScanner sc = new MyScanner();
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
int t = sc.nextI... | 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 | e493ee74af2f8c30e8fcd4206e801703 | 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 MaximalAnd {
static int[] memo;
public static void main(String[] args) throws Exception {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int arr[] = 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 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 | 1dd29f5980a10a7b9ddda8f49b2deeeb | 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.util.stream.*;
public class Sequence {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
scan.nextLine();
StringBuilder result = new StringBuilder();
for(int i = 0; i < t; i++) {
int n = scan.nextInt();
lo... | 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 | a20cdc01525e3ebbfc4dd2999fb1857a | 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 cf1635A {
public static void main(String[] args) {
FastReader sc = new FastReader();
int t = sc.nextInt();
while(t-->0) {
long sol = 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 | bcab9563a3d78a3e140bf2adcb78c787 | 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.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int T = 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 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 | 22a32c21617cc167dae93296e3b8fdec | 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 in=new Scanner(System.in);
int t=in.nextInt();
for(int c=0;c<t;c++)
{
int n=in.nextInt();
int result=0;
int value=0;
for(int i=0;i<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 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 | 41cd71bb248856c266ee0e15331aa7ff | 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 Q1635B {
static int mod = (int) (1e9 + 7);
static void solve() {
int n=i();
long[]arr=new long[n];
for(int i=0;i<n;i++){
arr[i]=l();
}
long val=arr[0];
for(int i=1;i<arr.length;i++){
va... | 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 | 245abc4e151c140c1973cc449af90957 | 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 Question4 {
static boolean multipleTC = true;
final static int Mod = 1000000007;
final static int Mod2 = 998244353;
final double PI = 3.14159265358979323846;
int MAX = 1000000007;
void pre() throws Exception {
}
long[] calMax(List<Long> 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 | 285198e4bdd7f2a2dab84eac4a574e6c | 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 sc=new Scanner(System.in);
int x=sc.nextInt();
outer: while(x-->0)
{
int n=sc.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i++)
a[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 | 23c58fe45ec3193068caf08fdfe0ee73 | 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;
import java.util.Arrays;
import java.util.Collections;
// import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Set;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.strea... | 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 | 56552adfb6573e369acb7fe720cd8a38 | 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 | public class MinOrSum {
private static final java.util.Scanner sc=new java.util.Scanner(System.in);
public void Solve(int test)
{
Integer[] arr;
int ans=0;
while (test>0)
{
int size= sc.nextInt();
arr=new Integer[size];
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 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 | f8412d6ef996bc8f273dc71c39fe08cb | 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 java.util.*;
import java.io.*;
import java.math.*;
public class temp {
// Let's Go!! ------------->
static FastScanner sc;
static PrintWriter out;
public static void main(String[] args) {
sc = new FastScanner();
out = new PrintWriter(System.out);
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 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 | e3fd0e2e2aacdd450dd5805b889ba1aa | 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.StringTokenizer;
public class A {
void solve() throws IOException {
int t = nextInt();
for (int tt = 0; tt < t; ++tt) {
int n = 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 | 17ef33c606f3830d7ea9022c735e0f26 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.Scanner;
public class MinOrSum {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for(int i=0; i<t; i++){
int n = s.nextInt();
int[] nums = new int[n];
int sum = 0;
for... | 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 | bab46f4f533cf637cee5c725c059da64 | 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 java.util.*;
import java.io.*;
import java.math.*;
public class A_Min_Or_Sum {
public static void main(String[] args) {
OutputStream outputStream = System.out;
PrintWriter ou... | 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 | 5acfbc38ee685fbfecd92feb13fa673e | 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 B {
static FastScanner fs = new FastScanner();
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder("");
public static void main(String[] args) {
int t = fs.nextInt();
for (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 | 44fe019e926aa672cf2c5cf27d9b71b4 | 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 void main(String[] args) {
int qwe = in.nextInt();
while (qwe-- > 0) {
int n = in.nextInt();
int sum = 0;
for (int i = 0; i < n; i++) {
sum|=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 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 | 073d35897ab36b3a0244d299d98df5c7 | 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 {
// when can't think of anything -->>
// 1. In sorting questions try to think about all possibilities like sorting from start, end, middle.
// 2. Two pointers, brute force.
// 3. In graph query questions try to solve it reversely or try to proc... | Java | ["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 | de00c07482143193d179d7462bb7a9a6 | 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.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;
public class D {
{
MULTI_TEST = true;
FILE_NAME = "";
NEED_FILE_IO = false;
INF = (long) 1e9;
} // fields
void solve() {
int n = ri();... | 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 | db29fbb9daad7c8c993239d52f81fa7c | 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 JavaApplication {
static BufferedReader in;
static StringTokenizer st;
String getLine() throws IOException {
return in.readLine();
}
String getToken() throws IOException {
if (st == null || !st.hasMoreTokens())
st = new StringTok... | 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 | c13beeb1b11b835294ab908f184d4d7c | 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 FastScanner sc;
static PrintWriter pw;
public static void main(String[] args) throws Exception{
sc = new FastScanner();
pw = new PrintWriter(System.out);
try{
int T = sc.ni();
... | 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 | 57954d161bf1c61f3fd1383a43460830 | 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 final int INF = Integer.MAX_VALUE;
static final int NINF = Integer.MIN_VALUE;
static final long LINF = Long.MAX_VALUE;
static final long LNINF = Long.MIN_VALUE;
static Reader reader;
static Writer writer;
static Pr... | Java | ["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 | 31315966dce7ff7b1f64362cfe6faf6d | 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 Min_Or_Sum
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int test=sc.nextInt();
while(test>0)
{
int n=sc.nextInt();
long arr[]=new long[n];
long brr[]=new long[31];
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 | c6c7e5d6403b3d09f43e643ea1856bd3 | 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 MyScanner sc;
static PrintWriter out;
static {
sc = new MyScanner();
out = new PrintWriter(System.out);
}
public static void solve() {
int n = sc.nextInt();
Integer[] a = new Integer[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 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 | 8c24ea51400246e1bdd0a53392a18a85 | 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 | 858bc81d41fc0456584ec3fdff653d2e | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.io.*;
import java.util.*;
public class codeforces {
static class in {
static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer tokenizer = new StringTokenizer("");
static String next() throws IOException {
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 | 4be1ee411cb3dd37271012dd94439507 | 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 javax.swing.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main extends PrintWriter {
static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));Main() { super(System.out);... | 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 | c71f8400df188ac28a6852a1a5492714 | 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 class FastReader{
BufferedReader br;
StringTokenizer st;
public FastReader(){
br = new BufferedReader(new InputStreamReader(System.in));
}
String next(){
while(st==null || !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 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 | 306c8f16ad391c18fa398382e87dffd8 | 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 HelloWorld{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int temp=0;
int n=sc.nextInt();
int a[]=new int[n];
... | Java | ["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 | 5b6bfc78f9fc4df536c4d32eca3218fc | 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.StringTokenizer;
public class R772A {
public static void main(String[] args) throws IOException {
PrintWriter pw = new PrintWriter(System.out);
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 | 110fa40548a547befab9be4eef2ff4a1 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | //package com.tdorosz._1635;
import java.util.Scanner;
public class MinOrSum {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();
for (int i = 0; i < testCases; i++) {
executeTestCase(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 17 | 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 | 8d52845c55262bda3e5ff7c97eec0343 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | //package com.tdorosz._1635;
import java.util.Scanner;
public class MinOrSum {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();
for (int i = 0; i < testCases; i++) {
executeTestCase(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 17 | 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 | c02f21b094b287aeb19c298bcaf41c15 | 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 cf;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.*;
import java.util.StringTokenizer;
public class cftt {
static class FastScanner {
BufferedReader br=new BufferedReader(ne... | Java | ["4\n3\n1 3 2\n5\n1 2 4 8 16\n2\n6 6\n3\n3 5 6"] | 1 second | ["3\n31\n6\n7"] | NoteIn the first example, you can perform the following operations to obtain the array $$$[1, 0, 2]$$$:1. choose $$$i = 1, j = 2$$$, change $$$a_1 = 1$$$ and $$$a_2 = 2$$$, it's valid since $$$1 | 3 = 1 | 2$$$. The array becomes $$$[1, 2, 2]$$$.2. choose $$$i = 2, j = 3$$$, change $$$a_2 = 0$$$ and $$$a_3 = 2$$$, it's ... | Java 17 | 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 | 1cc6a8d96f87b06be6f90bc71b99e7a9 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ of size $$$n$$$.You can perform the following operation on the array: Choose two different integers $$$i, j$$$ $$$(1 \leq i < j \leq n$$$), replace $$$a_i$$$ with $$$x$$$ and $$$a_j$$$ with $$$y$$$. In order not to break the array, $$$a_i | a_j = x | y$$$ must be held, where $$$|$$$ ... | 256 megabytes | import java.util.Scanner;
public class MinOrSum {
public static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int cases = sc.nextInt();
for(int i = 0; i<cases;i++){
int size = sc.nextInt();
int sum = 0;
for(int j = 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 17 | 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 | 4e8c346d9dce6d19992bf56097120714 | 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 MyClass {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int tc = sc.nextInt();
while(tc-- > 0){
int n = sc.nextInt();
int[] arr =new int[n];
int ans = 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 17 | 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 | 973178d633a8e1efd1e22d0ff6cab228 | 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_Min_Or_Sum{
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();
}
... | 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 17 | 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 | 536e91cf9770eb28f94dde671acde912 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class a {
static int t;
static int n, m;
static int[] type, u, v;
static ArrayList<Edge>[] adj;
static ArrayList<Integer>[] posGraph;
static boolean[] vis, done;
static Stack<Integer> topo;
static char[] ori;
static int[] pos;
static bool... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | be2ffa1beb89c90aebf9f23bd605ef97 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | /*
"Everything in the universe is balanced. Every disappointment
you face in life will be balanced by something good for you!
Keep going, never give up."
Just have Patience + 1...
*/
import java.util.*;
import java.lang.*;
impor... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | ddbb4745d5f333c4a1ce9112ce3fd69a | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | // package c1635;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import j... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 00792218e9d925c937f0bdeaf4fc32de | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | //package com.example.practice.codeforces.sc2200;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.StringTokenizer;
//E. Cars
public class Solution4 {
public static void main (String [] args) thro... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 867a6dacc280f49e4edd05fa9eb6e118 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | //package com.example.practice.codeforces.sc2200;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
//E. Cars
public class Solution4 {
public static void m... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 981d4c298acd2becbe6a4a864d8a6e62 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | //package com.example.practice.codeforces.sc2200;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
//E. Cars
public class Solution4 {
public static void m... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 064da735576a216e552c9d2af0cb869b | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.*;
import java.util.*;
public class Cars {
public static void main(String[] args) {
InputReader reader = new InputReader(System.in);
PrintWriter writer = new PrintWriter(System.out, false);
int N = reader.nextInt();
int M = reader.nextInt();
int[][] e... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 66e9164abe77c019512c6650f6cf5852 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.*;
import java.util.*;
public class E {
static HashMap<Integer, ArrayList<Integer>> map = new HashMap<Integer, ArrayList<Integer>>();
static int[] dir, pos;
static int[][] cons;
static boolean[] vis;
public static void main(String[] args) throws IOException {
... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 3dd27eea7a372b8bdd59782355718823 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.*;
import java.io.*;
public class E {
static IOHandler sc = new IOHandler();
static StringBuilder toPrint = new StringBuilder();
static char [] vals;
static boolean [] visited;
public static void main(String[] args) {
// TODO Auto-generated method stub
solve();
Syst... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 5027fe2390b71c2f7f197ff8d03d193a | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | /*
"Everything in the universe is balanced. Every disappointment
you face in life will be balanced by something good for you!
Keep going, never give up."
Just have Patience + 1...
*/
import java.util.*;
import java.lang.*;
impor... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | e4cfcb3a2227b432e9e1548566bb4650 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | /*
"Everything in the universe is balanced. Every disappointment
you face in life will be balanced by something good for you!
Keep going, never give up."
Just have Patience + 1...
*/
import java.util.*;
import java.lang.*;
impor... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 85faab0c35a7a65ff679fb5c2c11d82f | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
import static java.lang.Math.max;
public class Main {
static final int MOD = (int) (1e9 + 7);
static Scanner sc;
static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
static void dfs(int u, int dir) {
... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | d8b3a86aa2b55c386bb7ac365ff8ec61 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
import static java.lang.Math.max;
public class Main {
static final int MOD = (int) (1e9 + 7);
static FastReader sc;
static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
static void dfs(int u, int dir) {
directi... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 235c5df141ffefb0985a52922d52b1cd | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Random;
import java.io.FileWriter... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 00f07b0124107813aa32ffdf31b02442 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.*;
import java.io.*;
public class Solution
{
private static class FastIO {
private static class FastReader
{
BufferedReader br;
StringTokenizer st;
FastReader()
{
br = new BufferedReader(new InputStreamRe... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 140b450dd4c0fa067bf7596f8bd6d088 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | // coached by rainboy
import java.io.*;
import java.util.*;
public class CF1635E extends PrintWriter {
CF1635E() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1635E o = new CF1635E(); o.main(); o.flush();
}
int[] eo; int[][] ej, et;
void append(int i, int ... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 30a14525753df792323859bac160ed95 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.*;
import java.util.*;
public class Cars {
//io
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(System.out);
static boolean debug = false;
//param
static int N;
static int M;
static Restriction[] r... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | b07608d8d7155a0a15cd6ddad856707a | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.*;
import java.util.*;
import java.util.function.Function;
import java.util.stream.IntStream;
/*
polyakoff
*/
public class Main {
static FastReader in;
static PrintWriter out;
static Random rand = new Random();
static final int oo = (int) 2e9 + 10;
static final long ... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 68246e540bc05266d3e8fadfad413338 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.*;
import java.util.*;
public class Solution {
static int M = 1_000_000_007;
static Random rng = new Random();
private static int[][] testCase(int n, int p, int[][] tij) {
List<Integer>[] adjList = new List[n], directedAdjList = new List[n];
List<Integer> order = ne... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | a35826ec1b56707f175f89276357b5d2 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.Collectors;
public class E {
public static FastScanner s = new FastScanner();
public static PrintWriter out = new PrintWriter(System.out)... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | a323470c1f06eee9cd7ff7baa21628cf | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.io.BufferedReader;
import java.io.InputStream;
/**
* Bu... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 11 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | fa174f7c705c26fc4a5ec0af2d07bc20 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 8 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | bbf8d7e7630a778f20daa4c0e9bcc9c8 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.*;
import java.io.*;
public class cf1635e {
static class Edge {
public int u, v, t;
public Edge(int x, int y, int z) {u = x; v = y; t = z;}
public int get(int a) {
if (a == u) return v;
else return u;
}
}
static boolean[] visited;
static boolean[] d... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 8 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 2e1d4908edabb8b2e45045bc5247fbd2 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run() {
work();
out.flush();
}
long mod=998244353;
long gc... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 8 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 0ea0eba8e70aaa4b8c579a53503a2f06 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.*;
import java.io.*;
public class E_Cars{
public static void solve(){
}
public static void main(String args[])throws IOException{
Reader sc=new Reader();
int n=sc.nextInt();
int m=sc.nextInt();
Graph g=new Graph(n);
for(int i=0;i<m;i++... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 8 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 944b910c2532d56bd47fba88911ea0ab | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.*;
import java.io.*;
public class Omar {
static PrintWriter pw;
static Scanner sc;
static ArrayList<Integer>[] graph;
static Boolean[] colors;
static boolean[] vis;
static boolean checkBipartite(int u, boolean color) {
boolean f = true;
vis[u] = true;
colors[u] = color;
fo... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 8 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 7e4a364c3e23ca355473cb41b0e9b92e | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | /*
Setting up my ambitions
Check 'em one at a time, yeah, I made it
Now it's time for ignition
I'm the start, heat it up
They follow, burning up a chain reaction, oh-oh-oh
Go fire it up, oh, oh, no
Assemble the crowd now, now
Line 'em up on the ground
No leaving anyone behind
*/
import static java.lang.Math... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 8 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | d43691510906902a14cc335bf22d2d88 | train_108.jsonl | 1645367700 | There are $$$n$$$ cars on a coordinate axis $$$OX$$$. Each car is located at an integer point initially and no two cars are located at the same point. Also, each car is oriented either left or right, and they can move at any constant positive speed in that direction at any moment.More formally, we can describe the $$$i... | 512 megabytes | import java.util.*;
import java.io.*;
public class E1635 {
static ArrayList<Integer>[] g1, g2;
static int[] color;
static int n;
public static boolean bipartCheck() {
color = new int[n];
for (int i = 0; i < n; i++) {
if (color[i] != 0)
continue;
... | Java | ["4 4\n1 1 2\n1 2 3\n2 3 4\n2 4 1", "3 3\n1 1 2\n1 2 3\n1 1 3"] | 2 seconds | ["YES\nR 0\nL -3\nR 5\nL 6", "NO"] | null | Java 8 | standard input | [
"2-sat",
"constructive algorithms",
"dfs and similar",
"dsu",
"graphs",
"greedy",
"sortings"
] | 1c03ad9c0aacfbc9e40edc018a2526d3 | The first line contains two integers, $$$n$$$ and $$$m$$$ $$$(2 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq min(2 \cdot 10^5, \frac{n(n-1)}{2})$$$ — the number of cars and the number of restrictions respectively. Each of the next $$$m$$$ lines contains three integers, $$$type$$$, $$$i$$$, and $$$j$$$ $$$(1 \leq type \leq 2... | 2,200 | In the first line, print either "YES" or "NO" (in any case), whether it is possible to restore the orientations and the locations of the cars satisfying the relationships. If the answer is "YES", print $$$n$$$ lines each containing a symbol and an integer: $$$ori_i$$$ and $$$x_i$$$ $$$(ori_i \in \{L, R\}; -10^9 \leq x_... | standard output | |
PASSED | 41c97e14725dade081175cc43dcc5937 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ consisting of $$$n$$$ distinct positive integers.Let's consider an infinite integer set $$$S$$$ which contains all integers $$$x$$$ that satisfy at least one of the following conditions: $$$x = a_i$$$ for some $$$1 \leq i \leq n$$$. $$$x = 2y + 1$$$ and $$$y$$$ is in $$$S$$$. $$$x = 4y$$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet... | Java | ["2 4\n6 1", "4 7\n20 39 5 200", "2 200000\n48763 1000000000"] | 2 seconds | ["9", "14", "448201910"] | NoteIn the first example, the elements smaller than $$$2^4$$$ are $$$\{1, 3, 4, 6, 7, 9, 12, 13, 15\}$$$.In the second example, the elements smaller than $$$2^7$$$ are $$$\{5,11,20,23,39,41,44,47,79,80,83,89,92,95\}$$$. | Java 8 | standard input | [
"bitmasks",
"dp",
"math",
"matrices",
"number theory",
"strings"
] | fbb6d21b757d8d56396af1253ec9e719 | The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 2 \cdot 10^5)$$$. The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ $$$(1 \leq a_i \leq 10^9)$$$. It is guaranteed that all the numbers in $$$a$$$ are distinct. | 1,800 | Print a single integer, the number of elements in $$$S$$$ that are strictly smaller than $$$2^p$$$. Remember to print it modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 2bb67fee8826c29279eeadfd20065934 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ consisting of $$$n$$$ distinct positive integers.Let's consider an infinite integer set $$$S$$$ which contains all integers $$$x$$$ that satisfy at least one of the following conditions: $$$x = a_i$$$ for some $$$1 \leq i \leq n$$$. $$$x = 2y + 1$$$ and $$$y$$$ is in $$$S$$$. $$$x = 4y$$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet... | Java | ["2 4\n6 1", "4 7\n20 39 5 200", "2 200000\n48763 1000000000"] | 2 seconds | ["9", "14", "448201910"] | NoteIn the first example, the elements smaller than $$$2^4$$$ are $$$\{1, 3, 4, 6, 7, 9, 12, 13, 15\}$$$.In the second example, the elements smaller than $$$2^7$$$ are $$$\{5,11,20,23,39,41,44,47,79,80,83,89,92,95\}$$$. | Java 8 | standard input | [
"bitmasks",
"dp",
"math",
"matrices",
"number theory",
"strings"
] | fbb6d21b757d8d56396af1253ec9e719 | The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 2 \cdot 10^5)$$$. The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ $$$(1 \leq a_i \leq 10^9)$$$. It is guaranteed that all the numbers in $$$a$$$ are distinct. | 1,800 | Print a single integer, the number of elements in $$$S$$$ that are strictly smaller than $$$2^p$$$. Remember to print it modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 0f15140e736e4898eb8b84202544017f | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ consisting of $$$n$$$ distinct positive integers.Let's consider an infinite integer set $$$S$$$ which contains all integers $$$x$$$ that satisfy at least one of the following conditions: $$$x = a_i$$$ for some $$$1 \leq i \leq n$$$. $$$x = 2y + 1$$$ and $$$y$$$ is in $$$S$$$. $$$x = 4y$$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet... | Java | ["2 4\n6 1", "4 7\n20 39 5 200", "2 200000\n48763 1000000000"] | 2 seconds | ["9", "14", "448201910"] | NoteIn the first example, the elements smaller than $$$2^4$$$ are $$$\{1, 3, 4, 6, 7, 9, 12, 13, 15\}$$$.In the second example, the elements smaller than $$$2^7$$$ are $$$\{5,11,20,23,39,41,44,47,79,80,83,89,92,95\}$$$. | Java 8 | standard input | [
"bitmasks",
"dp",
"math",
"matrices",
"number theory",
"strings"
] | fbb6d21b757d8d56396af1253ec9e719 | The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 2 \cdot 10^5)$$$. The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ $$$(1 \leq a_i \leq 10^9)$$$. It is guaranteed that all the numbers in $$$a$$$ are distinct. | 1,800 | Print a single integer, the number of elements in $$$S$$$ that are strictly smaller than $$$2^p$$$. Remember to print it modulo $$$10^9 + 7$$$. | standard output | |
PASSED | b447a61de18470fb89119c1cb64ea018 | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ consisting of $$$n$$$ distinct positive integers.Let's consider an infinite integer set $$$S$$$ which contains all integers $$$x$$$ that satisfy at least one of the following conditions: $$$x = a_i$$$ for some $$$1 \leq i \leq n$$$. $$$x = 2y + 1$$$ and $$$y$$$ is in $$$S$$$. $$$x = 4y$$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import j... | Java | ["2 4\n6 1", "4 7\n20 39 5 200", "2 200000\n48763 1000000000"] | 2 seconds | ["9", "14", "448201910"] | NoteIn the first example, the elements smaller than $$$2^4$$$ are $$$\{1, 3, 4, 6, 7, 9, 12, 13, 15\}$$$.In the second example, the elements smaller than $$$2^7$$$ are $$$\{5,11,20,23,39,41,44,47,79,80,83,89,92,95\}$$$. | Java 8 | standard input | [
"bitmasks",
"dp",
"math",
"matrices",
"number theory",
"strings"
] | fbb6d21b757d8d56396af1253ec9e719 | The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 2 \cdot 10^5)$$$. The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ $$$(1 \leq a_i \leq 10^9)$$$. It is guaranteed that all the numbers in $$$a$$$ are distinct. | 1,800 | Print a single integer, the number of elements in $$$S$$$ that are strictly smaller than $$$2^p$$$. Remember to print it modulo $$$10^9 + 7$$$. | standard output | |
PASSED | 142c8b941eeed1f46a6ebcb9bbf488ed | train_108.jsonl | 1645367700 | You are given an array $$$a$$$ consisting of $$$n$$$ distinct positive integers.Let's consider an infinite integer set $$$S$$$ which contains all integers $$$x$$$ that satisfy at least one of the following conditions: $$$x = a_i$$$ for some $$$1 \leq i \leq n$$$. $$$x = 2y + 1$$$ and $$$y$$$ is in $$$S$$$. $$$x = 4y$$$... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
public class Main {
public static void main(String[] args) throws IOException {
in = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["2 4\n6 1", "4 7\n20 39 5 200", "2 200000\n48763 1000000000"] | 2 seconds | ["9", "14", "448201910"] | NoteIn the first example, the elements smaller than $$$2^4$$$ are $$$\{1, 3, 4, 6, 7, 9, 12, 13, 15\}$$$.In the second example, the elements smaller than $$$2^7$$$ are $$$\{5,11,20,23,39,41,44,47,79,80,83,89,92,95\}$$$. | Java 8 | standard input | [
"bitmasks",
"dp",
"math",
"matrices",
"number theory",
"strings"
] | fbb6d21b757d8d56396af1253ec9e719 | The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 2 \cdot 10^5)$$$. The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ $$$(1 \leq a_i \leq 10^9)$$$. It is guaranteed that all the numbers in $$$a$$$ are distinct. | 1,800 | Print a single integer, the number of elements in $$$S$$$ that are strictly smaller than $$$2^p$$$. Remember to print it modulo $$$10^9 + 7$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.