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 | 869195903902bef0673bca2a3e403b16 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Jeel Vaishnav
*/
public cl... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | e5a215f09dc3f6b78b3e896efaedf949 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.util.*;
public class d {
static boolean debug = false;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int numT = in.nextInt();
for(int t=0; t<numT; t++) {
long a = in.nextLong();
long m = in.nextLong();
long gcd = gcd(a, m);
if(deb... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | a6fa6a21f7b8ebc8ebffe77807f773df | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | //package educational.round81;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
for(int ... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 96a3af074bb1515ab946d2d431cfddec | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 41dea25ce96d96fb7d7c8f5fa15e76a8 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class EducationalRound81D {
public static void solve() {
int... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 1fe8d47c1b231aa31432dace9ffcd585 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.StringTokenizer;
public class EducationalRound81D {
public static void solve() {
int... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | d8bb87bd4a411844f412163d1ed3a71a | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
//import java.math.*;
//import java.awt.Point;
public class Main {
//static final long MOD = 998244353L;
//static final long INF = -1000000000000000007L;
static final long MOD = 1000000007L;
//static final int INF = 1000000007;
public static void main(String[] args) {
... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 68b3e9320b23c6b63d58c5f4ac26ed7e | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;
public class ROUGH{
public static class FastReader {
BufferedReader br;
StringTokenizer root;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (r... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 805efc243755ed4bb3039021cbef0036 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static Parser parser = new Parser();
public static void main(String[] args) throws IOException {
int T = parser.parseInt();
for(int i = 0; i < T; i++){
long a = parser.parseLong();
long m = parser.parseLong();... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 963fc8da7b13af823f8fd5a12adeaab0 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static final Integer[] PRIMES = primesTo(100000);
public static void solveCase(FastIO io, int testCase) {
long N = io.nextLong();
long M = io.nextLong();
long g = gcd(N, M);
long b = M / g;
Long[] factors = new HashSet... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 7049dacc8014ed88450cb3730c5f6b2d | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static final Integer[] PRIMES = primesTo(100000);
public static void solveCase(FastIO io, int testCase) {
long N = io.nextLong();
long M = io.nextLong();
long g = gcd(N, M);
long a = N / g;
long b = M / g;
HashSet<Lo... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | f17cf9ca57f84ce10a496ddda808478b | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static final Integer[] PRIMES = primesTo(100000);
public static void solveCase(FastIO io, int testCase) {
long N = io.nextLong();
long M = io.nextLong();
long g = gcd(N, M);
long b = M / g;
Long[] factors = new HashSet... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 8686b9f741bce02d2d7a51e38de18950 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static final Integer[] PRIMES = primesTo(100000);
public static void solveCase(FastIO io, int testCase) {
long N = io.nextLong();
long M = io.nextLong();
long g = gcd(N, M);
long a = N / g;
long b = M / g;
HashSet<Lo... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 18425c4df77def37807e0d11fd0bcdf7 | train_002.jsonl | 1580308500 | You are given two integers $$$a$$$ and $$$m$$$. Calculate the number of integers $$$x$$$ such that $$$0 \le x < m$$$ and $$$\gcd(a, m) = \gcd(a + x, m)$$$.Note: $$$\gcd(a, b)$$$ is the greatest common divisor of $$$a$$$ and $$$b$$$. | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static final Integer[] PRIMES = primesTo(100000);
public static void solveCase(FastIO io, int testCase) {
long N = io.nextLong();
long M = io.nextLong();
long g = gcd(N, M);
long a = N / g;
long b = M / g;
HashSet<Lo... | Java | ["3\n4 9\n5 10\n42 9999999967"] | 2 seconds | ["6\n1\n9999999966"] | NoteIn the first test case appropriate $$$x$$$-s are $$$[0, 1, 3, 4, 6, 7]$$$.In the second test case the only appropriate $$$x$$$ is $$$0$$$. | Java 8 | standard input | [
"number theory",
"math"
] | adcd813d4c45337bbd8bb0abfa2f0e00 | The first line contains the single integer $$$T$$$ ($$$1 \le T \le 50$$$) — the number of test cases. Next $$$T$$$ lines contain test cases — one per line. Each line contains two integers $$$a$$$ and $$$m$$$ ($$$1 \le a < m \le 10^{10}$$$). | 1,800 | Print $$$T$$$ integers — one per test case. For each test case print the number of appropriate $$$x$$$-s. | standard output | |
PASSED | 5941015e8043b11c8850abc4c8772159 | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] map = new int[101];
for(int i = 0; i<n;i++){
int x = in.nextInt();
map[x]++;
}
int count = 0;
int pair =0;
for(int i=1; i<=100; i++){... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 018eda1d1f6456b4b47be97e43c838a1 | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.io.InputStrea... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 2a4beaff9b78bb7924c9ade8d78514b2 | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 256 megabytes | import java.util.Scanner;
public class B_Canvas_Frames {
public static void main(String[] args){
Scanner input=new Scanner(System.in);
int n=input.nextInt();
int[][] sticks=new int[100][2];
int i,number;
for(i=0;i<100;i++){
sticks[i][0]=i+1;
sticks[i][1]=0;
}
for(i=0;i<n;i++){
number=input.next... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 428726ab33c0f56849433ef3deccb5d3 | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 256 megabytes |
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class CanvasFrames {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
//READ----------------------------------------------------
int n = sc.next... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 082f95c4fd339e4b1f664565b30447af | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 256 megabytes | import java.util.Scanner;
import java.util.HashMap;
import java.util.Map.Entry;
public class CanvasFrames
{
public static void main(String []args)
{
Scanner s = new Scanner(System.in);
int n = s.nextInt();
HashMap<Integer,Integer> sticks = new HashMap<Integer,Integer>();
while(n-- > 0)
{
int tm... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 1cf04bd0966a96a4dac38ea36e7e9c48 | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 256 megabytes | import java.util.*;
public class canvas {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[100];
for (int i = 0; i < 100; i++)
a[i] = 0;
for (int i = 0; i < n; i++) {
int x = in.nextInt();
... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 2d060d6999498650f97ef87a41d8db08 | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 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;
public class Haha{
public static void main(String[] args) throws IOException{
BufferedReader s = new BufferedReader(new ... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 036c4ed58d586c6a5ff64ba6f746cb71 | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 256 megabytes | import java.io.BufferedInputStream;
import java.util.Collections.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | af0b294c98e76c62a468a049c91a765c | train_002.jsonl | 1320858000 | Nicholas, a painter is going to paint several new canvases. Nicholas is sure that the canvases will turn out so great that each one will need framing and being hung on the wall. Frames are what Nicholas decided to begin with. Nicholas has n sticks whose lengths equal a1, a2, ... an. Nicholas does not want to break the ... | 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 Main
{
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static int nextIn... | Java | ["5\n2 4 3 2 3", "13\n2 2 4 4 4 4 6 6 6 7 7 9 9", "4\n3 3 3 5"] | 1 second | ["1", "3", "0"] | null | Java 7 | standard input | [
"implementation"
] | f9b56b3fddcd5db0d0671714df3f8646 | The first line contains an integer n (1 ≤ n ≤ 100) — the number of sticks. The second line contains n space-separated integers. The i-th integer equals the length of the i-th stick ai (1 ≤ ai ≤ 100). | 1,000 | Print the single number — the maximum number of frames Nicholas can make for his future canvases. | standard output | |
PASSED | 2946a323cc8ae0ddf191cae7ef0cb2eb | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.Scanner;
public class Main {
static final double EPSILON = 1e-6;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int[] a = readArray(sc, n);
int[] b = readArray(sc, n);
System.out.println(solve(a, b, m));
sc.c... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | eb32d8b15a54c0272d550d2e1ed31234 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class Study{
public static double help(int n,int m,int up[],int down[]) {
double pywt=m;
int i=0;
while(i+1<n) {
if(up[i]-1<=0 || down[i+1]-1<=0|| up[n-1]-1<=0||down[0]-1<=0)
return -1;
pywt=pywt*up[i]/(up[i]-1);
pywt=pywt*down[i+1]/(down[i+1]-1);
i++;
}
pywt... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | c704d72ca84ace5c7270f84e0d9fd053 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main{
static InputStream is;
static PrintWriter out;
static String INPUT = "";
private static byte[] inbuf = new ... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | fe7e0fbadb028d724ecd23f63a16c890 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
ArrayList<Integer> arra=new ArrayList<Integer>();
ArrayList<Integer> arrb=new ArrayList<Integer>();
boolean c... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 0389be8159134f242794f875f791e783 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n;
n=sc.nextInt();
int m;
m=sc.nextInt();
double start=m;//有效重量
for(int i=0;i<2*n;i++) {
int br=sc.nextInt();//
if(br==1){
Syste... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | baa7d03e2d77d4a4bde5cda7ebf499f7 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class ProblemA
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int M = sc.nextInt();
int[] takeOffCosts = new int[N+1];
int[] landingCosts = new int[N+1];
for(int i = 1; i <= N; i++)
{
takeOffCosts[i] = sc.nextInt();
... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 935795ff272a0aa84c408c18b32c8c3b | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.io.File;
import java.util.Scanner;
import java.util.StringTokenizer;
public class p013 {
public static void main(String args[]) throws Exception {
// StringTokenizer stok = new StringTokenizer(new Scanner(new File("C:/Users/Arunkumar/Downloads/input.txt")).useDelimiter("\\A").next());
StringTokenizer ... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 0bd4276811924b51b4011c044cbe562e | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | //package contests.CF1010;
import java.io.*;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
int m = sc.nextInt(... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 947a01e5904faa175c883c37557fda8a | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
@SuppressWarnings("unchecked")
public class P1010A {
final static double EPS = 1e-6;
int n;
double m, a [], b [];
double calc(double t, double ab) {
return (t - (m + t) / ab);
}
double calc(double t) {
for (int... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 06281cb9ffe611a9f1aff15e0518da2b | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.Scanner;
public class CF1010A {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int planetsNumber = scanner.nextInt();
double payloadWeight = scanner.nextInt();
double[] lifted = new double[planetsNumber];
double[] lande... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 8fb4ddd3bbc38d7ded7a9bf11c1b11a6 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class rckt {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n;
n=in.nextInt();
int m;
m=in.nextInt();
int[] toffw=new int[n];
int[] landw=new int[n];
int[] process=new int[2*n];
double start=m;
for(int i=0;i<2*n;i++) {
int br=in.nextIn... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | fb6bde19ff222e9f185d8b5c0b45835f | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class rckt {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n;
n=in.nextInt();
int m;
m=in.nextInt();
//int[] toffw=new int[n];
//int[] landw=new int[n];
//int[] process=new int[2*n];
double start=m;
for(int i=0;i<2*n;i++) {
int br=in.... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | f353a95da4a21bbdeaac63694ca82ec6 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | import java.util.*;
public class rckt {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n;
n=in.nextInt();
int m;
m=in.nextInt();
int[] toffw=new int[n];
int[] landw=new int[n];
int[] process=new int[2*n];
double start=m;
for(int i=0;i<2*n;i++) {
int br=in.nextIn... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 3ac5916a7eeb0680c08343f7ca9cb2c5 | train_002.jsonl | 1532617500 | Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{ int i,j;
BufferedReader br=new Buffere... | Java | ["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"] | 1 second | ["10.0000000000", "-1", "85.4800000000"] | NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma... | Java 8 | standard input | [
"binary search",
"math"
] | d9bd63e03bf51ed87ba73cd15e8ce58d | The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe... | 1,500 | If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider... | standard output | |
PASSED | 6948adcecac6ec9255994453b5c047b1 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Task {
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(Str... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | e665256d183aa588ffac736586a9735a | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;
public class Solution {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = ne... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 18faad0ff83618aaeb8c45d691e85885 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | /*
*
* @Author Ajudiya_13(Bhargav Girdharbhai Ajudiya)
* Dhirubhai Ambani Institute of Information And Communication Technology
*
*/
import java.util.*;
import java.io.*;
import java.lang.*;
public class Code75
{
public static void addInMap(HashMap<Integer,Integer> map, int key){
if(map.containsKey... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | cd2626cb290ad9939c5bd35f78f3dec1 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
/**
* User :- sudhakar
* Date :- 13/06/20
* Time :- 11:16 AM
*/
public class PhoenixAndBeauty {
private static final Reader r = new Reader();
static final int MOD = 1000000007, MAXN = 10000... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | e4a472c69f5cb3f45d8fcd4ca8f1f7ea | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
public static void main(String ars[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw=new PrintWriter(System.out);
int t=Integer.parseInt(br.readLine());
for(int x=0... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 3f6148df36f61ede0f8c348781a8621c | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class tr1 {
static PrintWriter out;
static StringBuilder sb;
static int n, m, k;
static long mod = 998244353;
static Boolean[][][] memo;
static String s;
static HashSet<Integer> nodes;
static ArrayList<Integer>[] ad;
static boolean[] vi... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | c2aaf9c16fd18129ec84baa81df03c18 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Drogon {
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
int t=sc.nextInt();
while (t-->0){
int n=sc.nextInt(),k=sc.nextInt();
TreeSet<Integer> s=new TreeSet<>();
... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 44a607cc1459e6fa06dda28225e83657 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.*;
import java.util.*;
public class pbe {
public static void main (String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0) {
int n = s.nextInt();
int k = s.nextInt();
int arr[] = new int[n];
Set<I... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 959011837cfa2f541b8ad0c32322ba37 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
public class question2 {
public static void solve() {
int t = s.nextInt();
while (t-- > 0) {
in... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 1363cac49fd6b819d6d6796148b12b33 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
public class question2 {
public static void solve() {
int t = s.nextInt();
while (t-- > 0) {
in... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 5382c033bd9d34d9ee5568cc15f13972 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Solution
{
public static void main(String [] args)
{
Scanner s=new Scanner(System.in);
int T=s.nextInt();
while(T-->0)
{
int N=s.nextInt();
int K=s.nextInt();
int B[]=new int[N];
List<Integer>L=new ArrayList<Integer>();
List... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 47f472e9f9cc5826292abbb46b6340d5 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes |
import java.net.Inet4Address;
import java.util.*;
import java.io.*;
public class Main {
static FastReader in=new FastReader();
static long mod=1000000007L;
public static void main(String args[]) throws IOException {
int t=in.nextInt();
StringBuilder res=new StringBuilder();
loop:... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 7fcc47a1d059256d35d7eb120ef760b9 | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Scanner;
public class B1348 {
public static void main(String[] args) throws IOException{
Scanner scanner = new Scanner(System.in);
BufferedWriter log = new B... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | adcefa2679ed2326e87d03508e581ccb | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/**
* Author : joney_000[developer.jaswant@gmail.com]
* Algorithm : Extended Euclid Algo: find 3 things X, Y, GCD(A, B) Such that X * A + Y * B = GCD(A, B)
* Time : O(MAX(A, B)) Space : O(MAX(A, B))
* Platform : Codeforce... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | a34fd0a1fa01673d005987079fcece5f | train_002.jsonl | 1588343700 | Phoenix loves beautiful arrays. An array is beautiful if all its subarrays of length $$$k$$$ have the same sum. A subarray of an array is any sequence of consecutive elements.Phoenix currently has an array $$$a$$$ of length $$$n$$$. He wants to insert some number of integers, possibly zero, into his array such that it ... | 256 megabytes | import java.awt.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class b {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for(int ie=0;ie<t;ie++) {
int n=s.nextInt();
int[] arr=new int[n];
int k=s.nextInt(... | Java | ["4\n4 2\n1 2 2 1\n4 3\n1 2 2 1\n3 2\n1 2 3\n4 4\n4 3 4 2"] | 2 seconds | ["5\n1 2 1 2 1\n4\n1 2 2 1\n-1\n7\n4 3 2 1 4 3 2"] | NoteIn the first test case, we can make array $$$a$$$ beautiful by inserting the integer $$$1$$$ at index $$$3$$$ (in between the two existing $$$2$$$s). Now, all subarrays of length $$$k=2$$$ have the same sum $$$3$$$. There exists many other possible solutions, for example: $$$2, 1, 2, 1, 2, 1$$$ $$$1, 2, 1, 2, 1,... | Java 8 | standard input | [
"data structures",
"constructive algorithms",
"sortings",
"greedy"
] | 80d4b2d01215b12ebd89b8ee2d1ac6ed | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \le t \le 50$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$). The second line of each test case contains $$$n$$$ space-separated integers (... | 1,400 | For each test case, if it is impossible to create a beautiful array, print -1. Otherwise, print two lines. The first line should contain the length of the beautiful array $$$m$$$ ($$$n \le m \le 10^4$$$). You don't need to minimize $$$m$$$. The second line should contain $$$m$$$ space-separated integers ($$$1 \le b_i \... | standard output | |
PASSED | 8424435b6efe2d4eb4c75be905740dcc | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter ... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 21c5bdcc0dd83fbed8b38dbaa08e21aa | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter ... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b4613487c47bec37ed4ac68bf82c4ca2 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | /** https://codeforces.com/problemset/problem/165/C
* idea: two pointer
*/
import java.util.Scanner;
import java.util.ArrayList;
public class AnotherProblemString {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
String str = sc.next(... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | d3bb9b5b68657ad4bdd40a83eb5d9570 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.*;
import java.io.*;
public class Ana {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int k = sc.nextInt();
String s = sc.next();
int[] cnt = new int[s.length() + 1];
cnt[0] = 1;
int sum = ... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 05c8c23fd5b15c6d97b67398d8b05aa6 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.*;
import java.io.*;
public class Ana {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int k = sc.nextInt();
String s = sc.next();
int[] cnt = new int[s.length() + 1];
cnt[0] = 1;
int sum = ... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 21bd607cbdff417c314049447a1e1cb0 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{ static PrintWriter out=new PrintWriter(System.out);static FastScanner in = new FastScanner(System.in);static class FastScanner {BufferedReader br;StringTokenizer stok;FastScanner(InputStream is) {br = new BufferedReader(new InputStr... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 5b6494db1e5476ae696957133ae8b9aa | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.HashMap;
public class Prac {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int k=sc.nextInt();
String s=sc.next();
int n=s.length();
int i,j=0,o... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | f502fdb435fcda2d021d80b6a366ab67 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.*;
public class Solution165C{
public static void main(String args[]){
Scanner in=new Scanner(System.in);
int k=Integer.parseInt(in.nextLine());
String s=in.nextLine();
int count=0;
int n=s.length();
if(k>0){
long[] freq=new long[n+1];
... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 2611eb302d73df9fcf1364faa4e8eb39 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class Flab {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int k = Integer.parseInt(in.nextLine());
Str... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | a8ff17e8e57666d56c12d7c6f00fc1e0 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
// some one elses implementation :(
public class Plun {
static int cannot;
static int floors;
static long[][] dp;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 55e752ac663750be01be0bf3ff6cf7f2 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.Scanner;
public class AnotherProblemonStrings {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
sc.nextLine();
String s = sc.nextLine();
int n = s.length();
int[] a = new int[n + 2];
int ones = 0;
// dummy 1 at lef... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b18ae669d896c8b7701e1dd83111b354 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.*;
public class Strings165C {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int k = Integer.parseInt(br.readLine().trim());
char[] cs = br.readLine().toCharArray();
long[] count = ... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | a15ebcd01f5c0e7ff49337568fef05f8 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 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.StringTokenizer;
public class A {
public static void main(String[] args) throws NumberFormatException, IOException {
Scanner sc = new Scanner();
Pr... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 3da8861ac3bee494ced880e02f63cc99 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.*;
import java.io.*;
public class a
{
public static void main(String[] args) throws IOException
{
new a();
}
public a() throws IOException
{
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int k = in.nextInt();
char[] s = in.next().toCharArra... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 2b4b026c427e39e298d94aad7db206ba | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Iterator;
... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 9f4575b7d94646473614808336850137 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | //package C165;
/**
*
* @author Abdulrahman Mobarak
*/
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
public class Main {
public static void main(String[] args) throws IOExce... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 92f0e5aa9383a6901bfcd35155afd0cf | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class cb {
InputStream is;
PrintWriter out;
static long mod=(long)(1e7+9);
void solve()
{
int k=ni();
char ch[]=ns().toCharArray();int n=ch.length;
long a[]=new long[n];
for(int i=0;i<n;i++)
{
if(i==0)
{
if... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 1327e74dde073af91bc2025f47296c51 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.LinkedList;
import java.util.Scanner;
public class Main {
private static long getResult(LinkedList<Integer> list) {
int pos1 = list.pollFirst() , pos2 = list.pollLast();
long value1 = list.peekFirst() - pos1;
long value2 = pos2 - list.peekLast();
list.addFirst(pos1);
list.addLast(pos2... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | d4c1dbaf8e3f1094eebe7765f63f8538 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class ANOS {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6b376395ec802230ad56339efe0e9e21 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution
{
public static void main(String ag[])
{
Scanner sc=new Scanner(System.in);
int i,j,k;
int K=sc.nextInt();
char A[]=sc.next().toCharArray();
int N=A.length;
HashMap<Integer,Long> map=new HashMap<>();
... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 7ae55ae889b9f9a4a80ae11284912076 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes |
import java.util.Scanner;
public class AnotherProblemOnStrings {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int k = sc.nextInt();
String s = sc.next();
long ways [] = new long[1000010];
int count =0;
long res = 0;
ways[0]... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b4ccc6b4f58e87ff81f9fd54756138f1 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static ... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | bc7fbf2d8e25242ba65107ab02bd2a03 | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Strings165C {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
i... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | a386b73c05a3ce2149c5aaced6ac2f4a | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.Math.*;
public class MainA {
public static int mod = 20000;
public static long[] val;
public static long[] arr;
static int max = (int) 1e9 + 7;
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = ... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 4b0ebd71107cd4d7ac1b9445b1c0e4ec | train_002.jsonl | 1331911800 | A string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can be read starting from some position in string w. For example, string "010" has six substrings: "0", "1", "0", "01", "10", "010". Two substrings are considered different if their posi... | 256 megabytes | /**
* Alipay.com Inc. Copyright (c) 2004-2020 All Rights Reserved.
*/
import java.util.Scanner;
/**
* Codeforces Round #112 (Div. 2)
* http://codeforces.com/contest/165/problem/C
*
* @author linwanying
* @version $Id: AnotherProblemOnStrings.java, v 0.1 2020年02月29日 1:38 PM linwanying Exp $
*/
public class Ano... | Java | ["1\n1010", "2\n01010", "100\n01010"] | 2 seconds | ["6", "4", "0"] | NoteIn the first sample the sought substrings are: "1", "1", "10", "01", "10", "010".In the second sample the sought substrings are: "101", "0101", "1010", "01010". | Java 8 | standard input | [
"dp",
"two pointers",
"math",
"binary search",
"brute force",
"strings"
] | adc43f273dd9b3f1c58b052a34732a50 | The first line contains the single integer k (0 ≤ k ≤ 106). The second line contains a non-empty binary string s. The length of s does not exceed 106 characters. | 1,600 | Print the single number — the number of substrings of the given string, containing exactly k characters "1". Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 982850d644a4264b1cbc774548ec3692 | train_002.jsonl | 1403191800 | Andrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — the probability that this friend will come up with a problem if Andrey asks him.Help Andrey choose p... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.MathContext;
public class Main {
static class Scan {
private byte[] buf=new byte[1024];
private int index;
private InputStream in;
private int total;
public Scan()
{
in=Sys... | Java | ["4\n0.1 0.2 0.3 0.8", "2\n0.1 0.2"] | 2 seconds | ["0.800000000000", "0.260000000000"] | NoteIn the first sample the best strategy for Andrey is to ask only one of his friends, the most reliable one.In the second sample the best strategy for Andrey is to ask all of his friends to come up with a problem. Then the probability that he will get exactly one problem is 0.1·0.8 + 0.9·0.2 = 0.26. | Java 11 | standard input | [
"dp",
"greedy",
"probabilities",
"math",
"sortings"
] | b4ac594755951e84001dfd610d420eb5 | The first line contains a single integer n (1 ≤ n ≤ 100) — the number of Andrey's friends. The second line contains n real numbers pi (0.0 ≤ pi ≤ 1.0) — the probability that the i-th friend can come up with a problem. The probabilities are given with at most 6 digits after decimal point. | 1,800 | Print a single real number — the probability that Andrey won't get upset at the optimal choice of friends. The answer will be considered valid if it differs from the correct one by at most 10 - 9. | standard output | |
PASSED | dccb96737c7311f09a7f0fa27311d455 | train_002.jsonl | 1403191800 | Andrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends — the probability that this friend will come up with a problem if Andrey asks him.Help Andrey choose p... | 256 megabytes |
// Imports
import java.util.*;
import java.io.*;
public class D443 {
/**
* @param args the command line arguments
* @throws IOException, FileNotFoundException
*/
public static void main(String[] args) throws IOException, FileNotFoundException {
// TODO UNCOMMENT WHEN ALGORITH... | Java | ["4\n0.1 0.2 0.3 0.8", "2\n0.1 0.2"] | 2 seconds | ["0.800000000000", "0.260000000000"] | NoteIn the first sample the best strategy for Andrey is to ask only one of his friends, the most reliable one.In the second sample the best strategy for Andrey is to ask all of his friends to come up with a problem. Then the probability that he will get exactly one problem is 0.1·0.8 + 0.9·0.2 = 0.26. | Java 11 | standard input | [
"dp",
"greedy",
"probabilities",
"math",
"sortings"
] | b4ac594755951e84001dfd610d420eb5 | The first line contains a single integer n (1 ≤ n ≤ 100) — the number of Andrey's friends. The second line contains n real numbers pi (0.0 ≤ pi ≤ 1.0) — the probability that the i-th friend can come up with a problem. The probabilities are given with at most 6 digits after decimal point. | 1,800 | Print a single real number — the probability that Andrey won't get upset at the optimal choice of friends. The answer will be considered valid if it differs from the correct one by at most 10 - 9. | standard output | |
PASSED | 257258d4ba8faffed23990e13ac8ede6 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
long X;
long[] pxor;
long[] s;
void run() throws Exception{
int N = nextInt();
s = new long[N + 1];
for (int i = 1; i <= N; i++){
s[i] = nextLong();
}
pxor = new long[N + 1];
... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 3863307db186b8bd56284b3b032c3dc9 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int len=(int)Integer.parseInt(in.nextLine());
long[] s=new long[len+1];
String[] value=(String[])in.nextLine().split(" ");
for(int i=1;i<=len;i++){
s[i]=Long.pa... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 531c2706cea7427cc4e77e8fa0704182 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int len=(int)Integer.parseInt(in.nextLine());
long[] s=new long[len+1];
String[] value=(String[])in.nextLine().split(" ");
for(int i=1;i<=len;i++){
s[i]=Long.pa... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 3f0f7654430914542928d80e1f9788e1 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int len=(int)Integer.parseInt(in.nextLine());
long[] s=new long[len+1];
long[] pxor=new long[len+1];
String[] value=(String[])in.nextLine().split(" ");
for(int i... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 0fe8bdb79dfd79b87718ac17c5e3a6b7 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int len=(int)Integer.parseInt(in.nextLine());
long[] s=new long[len+1];
String[] value=(String[])in.nextLine().split(" ");
for(int i=1;i<=len;i++){
s[i]=Long.pa... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 61afb1768f6e6c77134480e9cddd3e05 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int len=(int)Integer.parseInt(in.nextLine());
long[] s=new long[len+1];
long[] pxor=new long[len+1];
String[] value=(String[])in.nextLine().split(" ");
for(int i... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | d8b884a00e7eb0b7156cd5d8afbdbb8e | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import static java.util.Arrays.* ;
import static java.lang.Math.* ;
import java.util.*;
import java.io.*;
public class Main
{
void main() throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int N = sc.nextInt() ;
long [] a = new lo... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | ed64dbf6551da4eb50aaa295f0fd1d00 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import static java.util.Arrays.* ;
import static java.lang.Math.* ;
import java.util.*;
import java.io.*;
public class Main
{
void main() throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int N = sc.nextInt() ;
long [] a = new lo... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 7b096c6de77e5f656588693ddc3f78b7 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import static java.util.Arrays.* ;
import static java.lang.Math.* ;
import java.util.*;
import java.io.*;
public class Main
{
void main() throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int N = sc.nextInt() ;
long [] a = new lo... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | dbcb258e37865897298b89e30af541bc | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
public static int count = 1;
public static void insert(TrieNode[] Nodes, long x){
int k=0;
for(int i=40;i >=0; i--){
int id = ((1L<<i)&x) ==0 ?0:1;
if(Nodes[k].next[id] == -1){
Nodes[count] = new TrieNode();
Nodes[k].next[id] =count+... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 653ac364aaf127afb549d88ed758887c | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | // package practice.E;
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CF282E {
static int trie[][];
static int nxt = 0;
static final int MX = 41*100000 + 10;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 15e5d464d7c28840a419fbd53f453460 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | //package practice.E;
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class CF282E {
static int trie[][];
static int nxt = 0;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWri... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 2ce1d017498875440b5bf5c9103872ae | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
long[] a = new long[n];
long xor = 0;... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | b189ebffd0935e10e7311731f4474642 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
public class E282
{
static class Scanner
{
BufferedReader br;
StringTokenizer tk=new StringTokenizer("");
... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 021c935cb0529abaaa89ff0c13d17728 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.security.KeyStore.Entry;
import java.util.*;
public class CODEFORCES {
private InputStream is;
private PrintWriter out;
int next[][] = new int[5000000][2];
int id = 0;
void insert(long a) {
int now = 0;
for (int i = 39; i >= 0; i--) {
int c = (int) ((a & ... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 2f12b6da65a90941c6acaec2f26d3742 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | //package wap;
import java.util.Scanner;
public class Sausage {
public static treeNode root = new treeNode();
public static int height = 41;
public static void main(String[] args){
// treeNode[] nodes = new treeNode[64*100000];
Scanner scanner= new Scanner(System.in);
while(scanner.hasNext()){
int n = sca... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | b3da06f4c0b6026da1b9a12fab5e5146 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.io.*;
import java.util.*;
//I am fading.......
//read the question correctly (is y a vowel? what are the exact constraints?)
//look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
//always declare multidimensional arrays as [2][n] not [n][2]
//it can lead to upto 2-3x diff in runtime
public class Mai... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | f0c19f564a4a10aefd8a9c7f41b120b9 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 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 E {
public static void main(String[] args) throws NumberFormatException, IOException {
Scanner sc = new Scanner();
Prin... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 3bdee8481f7df8efd33e0a7eb1a79e8b | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/**
* Created by wangxiaoyi on 16/5/22.
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader input = new Buf... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 9feb9294f27dd83e3e563fd94439b2c9 | train_002.jsonl | 1363188600 | The Bitlandians are quite weird people. They have their own problems and their own solutions. They have their own thoughts and their own beliefs, they have their own values and their own merits. They have their own dishes and their own sausages!In Bitland a sausage is an array of integers! A sausage's deliciousness is ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by wangxiaoyi on 16/5/22.
*/
public class Main {
private static long base[];
public static void main(String[] args) throws IOException {
base = new long[64];
for (int i = 0; i < 64; ... | Java | ["2\n1 2", "3\n1 2 3", "2\n1000 1000"] | 2 seconds | ["3", "3", "1000"] | null | Java 8 | standard input | [
"data structures",
"bitmasks",
"trees"
] | 02588d1e94595cb406d92bb6e170ded6 | The first line contains an integer n (1 ≤ n ≤ 105). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 1012) — Mr. Bitkoch's sausage. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier. | 2,200 | Print a single integer — the maximum pleasure BitHaval and BitAryo can get from the dinner. | standard output | |
PASSED | 2b5ab1cbc9c739e394f2a2f85cb4cbda | train_002.jsonl | 1546007700 | You are given a range of positive integers from $$$l$$$ to $$$r$$$.Find such a pair of integers $$$(x, y)$$$ that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$.If there are multiple answers, print any of them.You are also asked to answer $$$T$$$ independent queries. | 256 megabytes | import java.io.*;
import java.util.*;
public class findDiv {
public static void main (String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseInt(br.readLine());
for(int i=0;i<t;i++) {
S... | Java | ["3\n1 10\n3 14\n1 10"] | 2 seconds | ["1 7\n3 9\n5 10"] | null | Java 8 | standard input | [
"implementation",
"greedy",
"math"
] | a9cd97046e27d799c894d8514e90a377 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 1000$$$) — the number of queries. Each of the next $$$T$$$ lines contains two integers $$$l$$$ and $$$r$$$ ($$$1 \le l \le r \le 998244353$$$) — inclusive borders of the range. It is guaranteed that testset only includes queries, which have at least one s... | 800 | Print $$$T$$$ lines, each line should contain the answer — two integers $$$x$$$ and $$$y$$$ such that $$$l \le x, y \le r$$$, $$$x \ne y$$$ and $$$x$$$ divides $$$y$$$. The answer in the $$$i$$$-th line should correspond to the $$$i$$$-th query from the input. If there are multiple answers, print any of them. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.