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
a0937c2aead66909473e61fef83be063
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class Yoo { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); int i,j,c; long sum; while(t-->0) { c=0; sum=0; int n=sc.nextInt(); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
822bbef04e3a2a311576eda58a7ceaa8
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class codeforceb { //ArrayList<Integer> arr2=new ArrayList<Integer>(); //ArrayList<Integer> arr1=new ArrayList<Integer>(); //Map<Integer,Integer> hm=new HashMap<Integer,Integer>(); //Set<Integer> st1=new HashSet<Integer>(); static int inf = Integer.MAX_...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c94a246452ad4b00d5977b57188c9c13
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.Math.PI; import static java.lang.Math.min; import static java.lang.System.arraycopy; import static java.lang.System.exit; import static java.util.Arrays.copyOf; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
ca15d4622cf5b9dcba6d9a5ca93b48a9
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); long[] out = new long[t]; for (int i = 0; i < t; i++) { long temp =1 ; int nu...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
2b16656b9a6937b32ac6ff96b8613839
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class A_Divide_and_Multiply{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int testCases = scan.nextInt(); while(testCases-->0){ int length = scan.nextInt(); long[] data = new long[length]; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
d0548466a5e4d0a974e91ddec758adcd
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class ProblemA { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int testsCount = scanner.nextInt(); for (int i=0; i < testsCount; i++) { int arraySize = scanner.nextInt(); long[] array = n...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
a67fa18064c4be435428a7d3c72c3ba2
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main (String[] args){ Scanner in=new Scanner(System.in); int t=in.nextInt(),n; long a[]; long s=0; while(t--!=0){ n=in.nextInt();a=new long[n];s=1; for(int i=0;i<n;i++) a[i]=in.nextLong(); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
f0331c5dad85e49abdbe640aca377610
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class B { void go() { // add code int n = Reader.nextInt(); long[] arr = new long[n]; long ans = 0; long pow = 1; for(int i = 0; i < n; i++) { arr[i] = Reader.nextInt(); while(arr[i] % 2...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
3e8d6550504539d12b5312eaa884da25
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class B { void go() { // add code int n = Reader.nextInt(); long[] arr = new long[n]; long ans = 0; for(int i = 0; i < n; i++) { arr[i] = Reader.nextInt(); } for(int i = 0; i < n; i++) {...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
ff4303189e7315cc9d6c589b26bfb3b7
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class divideandmultiply { public static void main(String[] args) { Scanner scn =new Scanner(System.in); try{ int t = scn.nextInt(); while(t-- > 0){ ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
6444ecdcd31df4d245acc205e8174b4f
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
//package com.company; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { int n; int i; n ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 11
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
3c073fdb55ffcf35d826992ee0bb2ad6
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class Main { static class InputReader { /** * The default size of the InputReader's buffer is 2<sup>16</sup>. */ private static final int DEFAULT_BUFFER_SIZE ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 17
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
5ae244d8b5433d35bb89b393fb546989
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
// package com.company.Codeforces; import java.util.*; import java.lang.*; import java.io.*; public class scratch { public static void solve(){ int n = sc.nextInt(); int [] arr = sc.nextIntArray(n); int k = 0; int max = 0; long sum = 0; for(int i=0...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 17
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
6a1cd74aba961a269d1aaab1043896aa
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class Main { static FastReader in = new FastReader(); static final Random random = new Random(); static long mod = 1000000007L; static HashMap<String, Integer> map = new HashMap<>(); public static void main(String args[]) throws IOException { int t = in.nextInt(); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 17
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
87bc2bd8f1927acaa4e80aea073a4c22
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class Main { static FastReader in = new FastReader(); static final Random random = new Random(); static long mod = 1000000007L; static HashMap<String, Integer> map = new HashMap<>(); public static void main(String args[]) throws IOException { int t = in.nextInt();...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 17
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c88f8c000a42ca3da872da5af24f09c0
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class another { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-- > 0){ int n = sc.nextInt(); long[] array = new ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 17
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
0ed0aca05d4ee813afd53efded5c4345
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class Solution{ public static void main(String args[]) { Scanner s=new Scanner(System.in); int n1=s.nextInt(); while(n1>0) { --n1; int n=s.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) { arr[i]=s.nextInt(); } Arrays.sort(arr); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 17
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c88a99f8a3f4dd551031bcefdaa489a9
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundDeltixAutumn2021A { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final stati...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 17
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
b112a36f34f2d33834a97fb7ce022e2a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.lang.*; import static java.lang.Math.*; // Sachin_2961 submission // public class Codeforces { static void solve() { int n = fs.nInt(); int[]ar = new int[n]; long prd = 1,max = 0; long a...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
2f2cf1c04e4c8a5ff470c864f66fee39
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.FileInputStream; import java.io.IOException; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Main { Scanner in; PrintWriter out; Main() { in = new Scanner(System.in); out = new PrintWriter...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
00c92ed7b06505b0b68f410f1172f3f8
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; /* * * @author Sabirov Jakhongir * */ public class Test { static class Coin{ long value; int cnt; public Coin(long value, int cnt) { this.value = value; this.cnt = cnt; } @Override public String toStri...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
ec9d57dc4ee2a3814259adf4bdb0c2cf
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-->0){ int a = in.nextInt(); long[] arr = new long[a]; for (int i = 0; i < a; i++) { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
5cee5c05f11403c019a95a8658d7b81e
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
//CP- MASS_2701 import java.util.*; import java.io.*; public class A_Divide_and_Multiply { static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<String,Integer>map=new HashMap<>(); public static void main(String args[]) ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
459cbc622996df7dd3b1c317477d5ce3
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class Multiply { 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]; for(int i=0; i<n; i++) { arr[i]=sc.nextLong(); } Ar...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
f8bb4b43bbc579399528a0af55d5b831
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.math.BigInteger; import java.util.*; public class test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-->0){ int n = in.nextInt(); BigInteger arr[] = new BigInteger[n]; int ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
f99e5bedd4a32f1df78ad588a8007610
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class DivideAndMultiply { static long sum(long[] a){ long sum = 0; for(int i=0; i<a.length ;i++) sum += a[i]; return sum; } public static void main(String[] args){ Scanner sc =new Scanner(System.i...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
a452b4959076b94ade1463857a2e3ada
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); long arr[]=new long[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } int i=0; long count=0;long res=0; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
80edc3f7d9b0e3239df089a93e3d749a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class solution { static class FastReader { BufferedReader br; StringTokenizer st; public F...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
693f8ffd6276ade5978ef14825397fc8
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class A3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-- > 0){ ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
0e6db414fcfda8b05e07d18b21eafb7d
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.util.stream.Collectors; import java.io.*; import java.math.*; public class A2 { public static FastScanner sc; public static PrintWriter pw; public static StringBuilder sb; public static int MOD= 1000000007; public static class FastScanner { BufferedReader b...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c2ee731f00b6bbb7a39e238e05b6b7ce
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class A { public static long gcd(long a, long b) { return a == 0 ? b : gcd(b, a % b); } public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter o = new PrintWriter(System.out); int t1 = sc.nextInt()...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
1a4e5adb6d4d313b5a8b7901a293e432
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); long max = 0; long res = 1; long sum = 0; for(int i = 0;i<n;i++){ int x = sc.nextInt(); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
15c2cce12812e1c98d252a64094fd61e
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
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 ans1=0; int k=0; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); if(a[i]%2==0...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
0048765d7501f0e99dde7b3e2eb99406
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class practice{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); long[] arr=new long[n]; for(int i=0;i<n;i++){ arr[i]=sc.nex...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
bf10cb9d8c991266f8f7cbfcb13a1a83
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /* Challenge 1: Pupil to CM in 1year (Dec 2021 - Nov 2022) 🔥 5* Codechef Challenge 2: CM to IM in 1 year (Dec 2022 - Nov 2023) 🔥🔥 6* Codechef Challenge 3: IM to GM in 1 year (Dec 2023 - Nov 2024) 🔥🔥🔥 7* Codechef Goal: Become better ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
0f29ea527ed24e15afe182511b7edd04
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { new C().run(); } BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); class pair { int F, S; pair(int f, int s) { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
db99f1a99ec95735312f91aab7aca151
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class DivideAndMultiply{ public static void main(String[] args) { FastReader fr = new FastReader(); PrintWriter out = new PrintWriter(System.out); Scanner sc= new Scanner (System.in); //Code From Here---- int t =f...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
6adc50c84a5ee8d10012530d154ca48a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class DivideMultiply { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int i = 1; i <= t; i++) { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
d44e1381d8fff3e0fe02597884b540d4
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class A { 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(); long[]...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
8e05cf9ee73d8dc31cbdf0ac0b52817d
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] hi) { FastIO io = new FastIO(); int t = io.nextInt(); while (t --> 0) { int n = io.nextInt(); long[] array = new long[n]; long[] array2 = new long[n]; long[] array3 = new...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
a260e03a401b862f86df03e8b5514413
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; public class Codechef { static ArrayList<Integer> adj[]; // static long ans = 0; static long above = 0; static List<Integer> primes = new ArrayList<>(); static FastReader f = new FastReader(); static int mod = 1000000007; public st...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
e613f108eed189a62be2e3cf0caa0794
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class DivideAndMultiply { /* * Dipraj Howlader * dipraj17@cse.pstu.ac.bd */ public static void main(String[] args) { Scanner iScanner = new Scanner(System.in); int test = iScanner.nextInt(); while (test ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
2af7065001343fcd4792bbbaac2c5066
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); for (int k = 0; k < t; k++) { int n = scn.nextInt(); long[] arr = new long[n]; for (int i = 0; i < n; i++) {...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
dd647208ebb0913512f6678fd7aa6331
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class DivideAndMultiply { public static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int tc = scanner.nextInt(); while (tc-->0){ int size = scanner.n...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
2fd97feab71e77de8cf8a07d36038404
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Pratice{ final long mod = 1000000007; static StringBuilder sb=new StringBuilder(); static boolean ans; static int xn = (int) (2e5 + 10); public static void main(String[] args) throws IOException { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
7de22b6d8a2d8a78f94842306bc9eeef
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Random; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
016a523487c90f320be5bfa5aaae74a4
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.util.stream.IntStream; public class Main { static class Pair implements Comparable<Pair> { int index; long value; Pair(int index, long value) { this.index = index; this.value = value...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
473f1d7dab173b2a3e0a54209eb17d68
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long[]fac=new long[200100]; static long[] two= new long[200100] ; static long mod=(long)1e9+7; static int n,k; static int x=0; static int[][]perm; static int[]pe,aa,a,b,c; static int[]prime=new int[(int)1e5+100]; static TreeSet<Long>...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
3ba8c53eca099d15880a559c77f28b82
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class CodeForces { // For fast input output static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader(new FileReader("input.txt")); ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
15cb65773ebc3aaf059ce210625050de
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class a_b { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-->0) { int n = scan.nextInt(); long[] ar = new long[n]; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
9c692000aa2ce202db28d0ac6ebe61fa
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigDecimal; import java.math.*; public class Main{ public static void main(String[] args) { TaskA solver = new TaskA(); // boolean[]prime=seive(3*100001); int t = in.nextInt(); for (int i = 1; i <= t ; i++...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
3afe2725c5a35f47a74eabb5286e188f
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int t = in.nextInt(); for (int tt = 0; tt < t...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
34c6a44cae8a58ea6bc906046e050d4d
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A_Divide_and_Multiply { public static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new Buffere...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
a08a72157d37151cefed2dfa5a1a5db6
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); Long[] a = new Long[n]; for (...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
f312eaca11ef2b20971872690928c627
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args){ Scanner scn=new Scanner(System.in); int t=scn.nextInt(); while(t-->0){ int n=scn.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++){ ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
3c5fb4c947542b3db49ba347524a82ea
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class DivideAndMultiply{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static void solve() { int n = sc.nextInt(); int arr[] = new int[n]; int max = Integer.MIN_VALUE; int max2 = Integer.MIN_VALUE...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
a26fa08de55f2c1bc635b960a7dfc09f
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class Main { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = Integer.parseInt(in.nextLine()); for (int i = 0; i < t; i++) { int n = Integer.parseInt(in.nextLine()); String array = in.nextLine(); String[] ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
ed1a7e6ab0824bd84ac68340e39c3e84
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class Maximizar_suma{ public static void main(String args[]) { Scanner reader=new Scanner(System.in); int nTimes=0; nTimes=reader.nextInt(); for(int h=0;h<nTimes;h++){ int t=reader.nextInt(); long[] numArray=new long[t]; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
490c04ce25118be793eb361deb94b814
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; public class Main { public static Scanner reader=new Scanner(System.in); public static void main (String[]args) { ArrayList<Long> numbers=new ArrayList<Long>(); int counter=0; int t=0; int casesNum=0; casesNum=reader.nextInt(); reade...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
586b555f33a0763a2a539e76113509db
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // import java.io.*; import java.lang.reflect.Array; import java.util.*; public class CFA { static CFA.Reader sc = new CFA.Reader(); static BufferedWriter bw; static long count = 0; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
0ce28e825a0a08942706766e74d68597
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { int tc = io.nextInt(); for (int i = 0; i < tc; i++) { solve(); } io.close(); } private static void solve() throws Exception { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c84dbb1d800e6682999799fb903351f1
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class DivideAndMultiply { static long sum(long[] a){ long sum = 0; for(int i=0; i<a.length ;i++) sum += a[i]; return sum; } public static void main(S...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
1f97941b02b84f6b188ab3e62de2e61a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class DivideAndMultiply { static long sum(long[] a){ long sum = 0; for(int i=0; i<a.length ;i++) sum += a[i]; return sum; } public static void main(String[] args){ Scanner sc =new Scanner(System.i...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
56c6476642aaf4c8da551f9e9d7572f3
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; public final class A { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Integer> g[]; static l...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
b003d3d02f8a4282ffc4717c2b0bfd8a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import java.util.*; import java.io.*; import java.math.*; public class x1609A { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedReader(new Inp...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
cf9010d7d00a69186cfb086b0eafc497
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class pre1{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
6d87c775f2e78cc342c123803fdf9e99
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java....
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
0516cbca1b949e2fc17dd1682a0aa923
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.List; public class DivideAndMultiply { public static void main(String[] args) throws IOException { Buf...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
4fb0e0d6e023ed885b933a64022aa93c
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.StringReader; import java.lang.reflect.Array; import java.math.BigInteger; import java.text.ParseException; import java.text.SimpleDateFo...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
39f7773882ad8670517694e21deef71b
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; import java.lang.Math; public class DivideandMultiply { public static void main(String args[]) { Scanner s = new Scanner(System.in); int n = s.nextInt(); for(int i = 0; i<n; i++) { int max = 0, k=0; long sum = 0; int arraylength = s.nextInt(); int a[] = new i...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
10909fe334bd94f8e515f64fa599e9d5
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class Divide_Multiply { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
07e7f0a3fce5a5ae6928ebee065cbdd2
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; //code by tishrah_ public class _practise { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
ae0b265e421d1fbdc119b462cef2d796
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; /* * Author : Imtiaz Adar */ public class x1609A { public static void main(String[] args) { FastScanner scan = new Fast...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c2ef231a48bead8ac9595a3a5a867a06
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.*; public class Pentagram { public static void main(String[] args){ Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int tc = sc.nextInt(); while(tc-->0){ ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c6184ca05b2eccf1af48ce76a9c0200c
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class DivideAndMultiply { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-- > 0) { int n = in.nextInt(); long a[] = new long[n]; long sum = 0; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
5350585a9a8573e1d708a354f45f5c85
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class deltix_21_a { public static void main(String args[]){ FScanner in = new FScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); while(t-->0) { int n=in.nextInt(); int a[]=in.readArray(n); long su...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
73ad26d4e2a58daa09b3b811a665e6a8
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.awt.Container; import java.awt.image.SampleModel; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.concurrent.CountDownLatch; import javax.naming....
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
855dc141e5ec027f973f55724dd32589
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class _1609A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); long[] arr; long[]...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
cfd1e26765ac67ee049620ed16a4fd81
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class DivideandMultiply { public static void solve(int n,long[] arr) { Arrays.sort(arr); long[] arr1=new long[arr.length]; arr1=arr.clone(); long[] arr2=new long[arr.length]; arr2=arr.clone(); int oddm=-1; for(int i=n-1;i>=0;i--) { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
fd64da48067606def1d21851a77bf9d9
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner a = new Scanner(System.in); int[] multiple = new int[17]; int[] div = new int[17]; for(int i=1;i<multiple.length;i++) { int count=0; int nu...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
09cc08aae2d9c6b173dc2f4a85f1d2ab
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class A { public static void main(String[] args) { FastScanner sc = new FastScanner(); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt();...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
2dff9aed529008af11a80f349df1b783
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String args[]){ FScanner in = new FScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); while(t-->0) { int n=in.nextInt(); long arr[]=new long[n]; for(int i=0;i<n;i++) arr[i]=in....
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
773bd8a70448f455e921759a0a94c4da
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
//package com.company; import java.io.FileInputStream; import java.io.InputStream; import java.util.*; public class Main { public static class Dsu{ int[] parent; Set<Integer>[] rest; Set<Integer>[] restrictions; Dsu(int n, int[][] restrictions...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
cde3d837b506bb04fc740fda0c2dc5c4
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.*; public class a729 { public static void main(String[] args) { // try { BufferedWriter out...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
0dd168161c4da5cb50220789d800e86a
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.io.InputStreamReader; import java.util.*; import java.util.Collections; import java.util.StringTokenizer; public class Solution{ static FastScanner fs = new FastScanner(); static PrintWriter out = new PrintW...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
4bb4070bb8f94905291c2fd68dddd5a4
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numberOfLines = Integer.parseInt(scanner.nextLine()); for (int i = 0; i < numberOfLines; i++) { int n = scanner.nextInt(); sca...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
9f9802d1c1f11f58c159ab6b4a023d65
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.io.*; public class s1 { public static FastScanner scan; public static PrintWriter out; public static void main(String[] args) throws Exception { scan=new FastScanner(System.in); out=new PrintWriter(System.out); // int T=1; int T=scan.nextInt(); while(T-->0) { ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
6abc89e4d4162fb39da8b9578c34ea96
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
//package codeforce.div2.deltix.Autumn2021; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; impo...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
09065e42fe2e2ca8f8bc265a03c09200
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.beans.DesignMode; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.CompletableFuture.Asyn...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
5b0bf687d03d96531bdd49b7714127fe
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public final class Main { static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static int mod = (int) (1e9 + 7);...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
402eacfcb3ddf0ab1c7a578ac98ea25e
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); long sum ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
b4605853fd9231abe4212e73f152fea5
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class A { static BufferedReader br; static StringTokenizer st; static PrintWriter pw; static String nex...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
268e7cc3b79a743cfebce531a3528dd0
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter pr = new PrintWriter(System.out); static String readLine() throws IOException { return br.readLine(); } static Strin...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
9a53dc840e06aa08bc9dc8a8c629b5f6
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
/** * @author vivek * programming is thinking, not typing */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A { private static void solveTC(int __) { /* For Google */ // ans.append("Case #").append(__).appe...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
c77ded018ecbfb7af5aaab89357ef289
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int tc = 0; tc < t; ++tc) { int n = sc.nextInt(); int[] a = new int[n]; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
868fe21ec54870c866044b05b7e2fe97
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; import java.util.*; import static java.lang.System.out; import static java.lang.Math.*; public class pre267 { static class FastReader { BufferedReader br;...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
437d6fc6575a2e15bc5e3ab21444b2b2
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
// package faltu; import java.util.*; import java.util.Map.Entry; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; public class Main { // *...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
cba79ff96fe88da28968798eeb0e35d1
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.StringTokenizer; public class Divide_and_Multiply { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInput...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
cda4d8c8fcd3058992544d688b6dffd6
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class divMul { public static void main (String[] args) throws java.lang.Exception { try { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=new int[...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output
PASSED
cb8bdf8c75c6eaa8a2798cd732574f90
train_110.jsonl
1638110100
William has array of $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. He can perform the following sequence of operations any number of times: Pick any two items from array $$$a_i$$$ and $$$a_j$$$, where $$$a_i$$$ must be a multiple of $$$2$$$ $$$a_i = \frac{a_i}{2}$$$ $$$a_j = a_j \cdot 2$$$ Help William find the max...
256 megabytes
import java.util.*; public class solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); long arr[]=new long[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } int i=0; long count=0;long res=0; ...
Java
["5\n3\n6 4 2\n5\n1 2 3 4 5\n1\n10\n3\n2 3 4\n15\n8 8 8 8 8 8 8 8 8 8 8 8 8 8 8"]
1 second
["50\n46\n10\n26\n35184372088846"]
NoteIn the first example test case the optimal sequence would be: Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $$$a_2 = \frac{4}{2} = 2$$$ and $$$a_1 = 6 \cdot 2 = 12$$$, making the array look as: [12, 2, 2]. Pick $$$i = 2$$$ and $$$j = 1$$$. After performing a sequence of operations $...
Java 8
standard input
[ "greedy", "implementation", "math", "number theory" ]
f5de1e9b059bddf8f8dd46c18ce12683
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The first line of each test case contains an integer $$$n$$$ $$$(1 \le n \le 15)$$$, the number of elements in William's array. The second line contains $$$n$...
900
For each test case output the maximal sum of array elements after performing an optimal sequence of operations.
standard output