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 | ff8fb3ce9a9b2869232e44c361e22969 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | // ▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂
// ♚⭃ Author: 18jad ⥷♚
// ☬ Time: 30-03-2022 19:36:54 ☬
// ▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂▂
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int t = cin.nextInt();
w... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 0357b580f3c03001efed9ed32d685405 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
public class Square_Count{
public static void main(String args[]){
Scanner obj = new Scanner(System.in);
int t = obj.nextInt() ;
long s, n;
for( int i = 0; i < t; i ++){
n = obj.nextLong();
s = obj.nextLong();
... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 2486c655623258db17139858435c5ff1 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.io.*;
import java.util.*;
public class SquareCounting {
public static PrintWriter out;
public static void main(String[] args)throws IOException{
Scanner sc=new Scanner();
out=new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0) {
long n=sc.nextLon... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 4feea87fc7be6141b733f4d402adcd17 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes |
import java.io.*;
import java.util.*;
public class GPL implements Runnable {
public static void main(String[] args) {
new Thread(new GPL()).run();
}
BufferedReader br;
StringTokenizer in;
PrintWriter out;
public String nextToken() throws IOException {
while (i... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 3b8307a7fbba988a565478f9b23d1221 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import com.sun.jmx.remote.internal.ArrayQueue;
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBu... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 1780d7b583b6fb9cca8dc434bb1a71a1 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class pre1 {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new In... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 7e2ff10b71485ad9f31c50bc4b96146b | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
import java.io.*;
public class Test {
static HashSet <String>[] likes;
static HashSet <String>[] dislikes;
static HashSet <String> Ingredients;
static int[] numLikes;
static int [] numDislikes;
static int n;
public static int lengthOfLongestSubstring(String s) {
HashMap <Cha... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 98d2dbc1ea2463a77fde54d80ffd4a4d | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.Scanner;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
import java.io.*;
/*... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 0647acdbe0d38868db5909a83915e3e5 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.io.*;
import java.util.*;
public class Sqr_Counting {
public static void main(String args[]){
FScanner in = new FScanner();
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
while(t-->0) {
int n=in.nextInt();
long s=in.nextLong();
out.println(s/(long)(n*(lon... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | b43e8860e83343071bdd055c16a10798 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | //package ritz;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class C{
public static int binarySearch(int a[], int high, int low, int x)
{
int mid = (high+low)/2;
if(low<=high) {
if(a[mid]==x)
return mid;
if(a[mi... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 911f42d0524d30006d9935172d0bab94 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | /* package whatever; // 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 Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | c434a4a754e5fc04218a3c55f07ec744 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class solution {
static final Random random = new Random();
static void sort(int arr[]) {
int n = arr.length;
for(int i = 0; i < n; i++) {
int j = random.nextInt(n),temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
Arrays.sort(arr);
}
// Use ... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 223c531ce6af673df407f73b26f4a4c2 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.io.*;
import java.util.*;
public class solve{
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(
new FileReader("input.txt"));
PrintStream out = new PrintStream(new FileOutputStream("output.txt"));
System.setOut(ou... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | d7f4af2733c3c12c1454f806014847ff | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
import javax.swing.text.StyledEditorKit;
import java.io.*;
public class Main{
public static void solve(Scanner sc)
{
long n,s;
n=sc.nextLong();
s=sc.nextLong();
System.out.println(s/(n*n));
}
public static void main(String args[]){... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 6348849a692cbd76b73b0b467b78a375 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.Scanner;
public class Main {
public static Scanner sc;
public static void work() {
long n = sc.nextLong();
long s = sc.nextLong();
long ans = s/(n*n);
System.out.println(ans);
}
public static void main(String args[]) {
sc = new Scanner(System.in);
int t = sc.nextInt();
... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | ce0b2be41f5fa16df7f8c4e49dc931c7 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.Scanner;
public class Square_Counting {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0) {
long n = sc.nextLong();
long k = sc.nextLong();
long sq = n*n;
long ans = k/sq;
System.out.println(ans);
... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 4b21d4fbc69d3e051c9940b6562043d4 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | // package NK96;
import java.awt.*;
import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputRe... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 72aa74c5b22cf5e983d250a4a0b2d448 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.awt.image.RescaleOp;
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.Collection;
import java.util.Collections;
import java.util... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | cea026f4e4c9087b9b7c18c4ccd1b4c4 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class A_Square_Counting
{
static int M = 1_000_000_007;
static final PrintWriter out =new PrintWriter(System.out);
static final FastReader fs = new FastReader();
static boolean prime[];
public static void main (String[] args... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 8 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | daa5d6a24ff0c53ab477e14f965bfbc5 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
public class file
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
long n=sc.nextLong();
long s=sc.nextLong();
n=n*n;
System.out.println... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 889ea24a06c277c1e84efd8ec56f5d71 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util. Scanner;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner (System.in);
int t=sc.nextInt();
for(int e=0; e<t; e++)
{ long n=sc.nextLong(); long s=sc.nextLong();
// 8 integeri s=0
if(n==0) { if(s==0){ System.out.println(1);}
else{System.out.... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | bb6a3b3ca44e3199675e2dd15cdd7cd8 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.Scanner;
import java.util.*;
public class T {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t= in.nextInt();
while (t-- > 0){
long n = in.nextInt();
long sum = in.nextLong();
n *= n;
... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 918114d12317edf5aa60ae0de4038876 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
import static java.lang.System.*;
import static java.util.Arrays.*;
import static java.util.stream.IntStream.iterate;
public class Te... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 848803529e1c1b1358825c61a1b63946 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes |
//https://codeforces.com/problemset/problem/1646/A
import java.util.Scanner;
public class Square_Counting {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testcase = sc.nextInt();
while (testcase-- != 0) {
long n = sc.nextLong(), s = ... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 1d0b794e512cde62bbaae692eac4cba3 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
public class cp {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
long n=sc.nextLong();
long s=sc.nextLong();
long x=n;
if(s==0){
System.... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 19a39ada9b653e0be8893167e742cb4e | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner sc =new Scanner(System.in);
int tc = sc.nextInt();
while(tc-- > 0){
long n = sc.nextLong();
long s = sc.nextLong();
long sq = n*n;
long no = s/sq;
... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 225e06dcd568f5005d2742e7e68ad292 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
long n,s;
while (t-- > 0) {
n=sc.nextLong();
s=sc.nextLong();
if(n>s) System.out.println(0);
... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 90abc10e8aa73ed446c2b36ab62bb5f4 | train_110.jsonl | 1646408100 | Luis has a sequence of $$$n+1$$$ integers $$$a_1, a_2, \ldots, a_{n+1}$$$. For each $$$i = 1, 2, \ldots, n+1$$$ it is guaranteed that $$$0\leq a_i < n$$$, or $$$a_i=n^2$$$. He has calculated the sum of all the elements of the sequence, and called this value $$$s$$$. Luis has lost his sequence, but he remembers the v... | 256 megabytes | import java.util.*;
import java.util.function.*;
import java.io.*;
// you can compare with output.txt and expected out
public class Round774A {
MyPrintWriter out;
MyScanner in;
// final static long FIXED_RANDOM;
// static {
// FIXED_RANDOM = System.currentTimeMillis();
// }
final static String IMPO... | Java | ["4\n\n7 0\n\n1 1\n\n2 12\n\n3 12"] | 1 second | ["0\n1\n3\n1"] | NoteIn the first test case, we have $$$s=0$$$ so all numbers are equal to $$$0$$$ and there isn't any number equal to $$$49$$$.In the second test case, we have $$$s=1$$$. There are two possible sequences: $$$[0, 1]$$$ or $$$[1, 0]$$$. In both cases, the number $$$1$$$ appears just once. In the third test case, we have ... | Java 17 | standard input | [
"math"
] | 7226a7d2700ee52f52d417f404c42ab7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$n$$$ and $$$s$$$ ($$$1\le n< 10^6$$$, $$$0\le s \le 10^{18}$$$). It is guaranteed that the ... | 800 | For each test case, print one integer — the number of elements in the sequence which are equal to $$$n^2$$$. | standard output | |
PASSED | 5652d015c5575434d8f988d60feb0dec | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static class Pair implements Comparable < Pair > {
int d;
int i;
Pair(int d, int i) {
this.d = d;
this.i = i;
}
public int compareTo(Pair o) {
if (this.d == o.d)
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 7afdd7180ce3d1842ef00176bfc4e620 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | /*
Rating: 1461
Date: 29-03-2022
Time: 19-18-50
Author: Kartik Papney
Linkedin: https://www.linkedin.com/in/kartik-papney-4951161a6/
Leetcode: https://leetcode.com/kartikpapney/
Codechef: https://www.codechef.com/users/kartikpapney
*/
import java.util.*;
import java.io.BufferedRe... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 7bd2a602c01241cc5c326a525916fdd9 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef {
/*
* Aim 1: Do 200 DP codeforces problems
* Aim 2: Beat Sparsh in ratings before 2 june.
*
*/
static long fans[] = new long[200001];
static long inv[] = new long[200001];
static long mod = 1000000007;
st... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | dccedfe3357ada9e94c26d6021c0c773 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef {
/*
* Aim 1: Do 200 DP codeforces problems
* Aim 2: Beat Sparsh in ratings before 2 june.
*
*/
static int min;
public static void main(String[] args) throws java.lang.Exception {
FastReader in = new Fa... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | b578b6e96077baf4f1b134f66806a6dd | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Main {
///
// Two theorams are used to find ncrp
// Lucas theoram and the fermit theoram
// a^p-1=1(modp) exam... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | c28c72c9526681b17e30f51669e07b07 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | /*
Goal: Become better in CP!
Key: Consistency and Discipline
Desire: SDE @ Google USA
Motto: Do what i Love <=> Love what i do
If you don't use your brain 100%, it deteriorates gradually
*/
import java.util.*;
import java.io.*;
import java.math.*;
public class Solution {
static StringBuffe... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | b653e72f4b00a28a69288d4e53423b28 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 01c21adb28ebd91e03110243369cea9c | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
List<Long> list = new ArrayList<>();
long fact = 6, num = 4;
while(fact <= (long)1e12) {
l... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 5e1e23436d33b6682b017a1188a1366b | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args) {
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
List<Long> list=new ArrayList<>();
long fact = 6, num = 4;
while(fact <= (long)1e12) {
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 6624c655ecba7b3d6e02d916a30d2223 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import javax.sql.rowset.spi.SyncResolver;
import java.io.*;
import java.nio.channels.NonReadableChannelException;
import java.text.DateFormatSymbols;
public class Solution {
static int a[];
static FastScanner fs = null;
public static void main(String[] args) {
fs ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 2d342ba9db119b232ddc60512a9e3528 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class c731 {
pu... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 13377488b610ea9aac698c4fbda51658 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
// cd C:\Users\Lenovo\Desktop\New
//ArrayList<Integer> a=new ArrayList<>();
//List<Integer> lis=new ArrayList<>();
//StringBuilder ans = new StringBuilder();
//HashMap<Integer,Integer> map=new HashMap<>();
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 6234b9eb1f424bba08d83a42d228240b | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static final Long[] fac = {6L, 24L, 120L, 720L, 5040L, 40320L, 362880L, 3628800L, 39916800L, 479001600L, 6227020800L, 87178291200L};
private static Long[] facSum = new Long[1 << fac.length];
private static void solve(long x){
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 5d7c8066a2ae72221778c85e03c8d5a7 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.uti... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 7a620826dc5b7ff260b3694685f80d83 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class FactorialsAndPowersOfTwo {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamRead... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 3ec00103bb12adc2343d09b297f46ea6 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class C_Factorials_and_Powers_of_Two{
public static long fact[];
public static int max=15;
static Data f[]=new Data[(1<<15)];
public static void solve(long num){
int max_bit=0;
while(fact[max_bit]<=num){
max_bit++;
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | f3d83d9f8559b4f145e5462471feab34 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Random;
import java.ut... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | bcf5729e96b087a6a8d70125e248c466 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static long cr[][]=new long[1001][1001];
//static double EPS = 1e-7;
static long mod=1000000007;
static long val=0;
public static void main(String[] args)
{
FScanner sc = new FScanner();
//Arrays.fill(prime, true);
//sieve();
//n... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 9e8f4ca4b11d4c706d3237c0aeb6b90c | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class codeMaster {
static long[] fac;
public static void tryAll(int i, long rem, HashSet<Pair> comb, Stack<Integer> tmp){
if(i >= fac.length){
comb.add(new Pair(rem, tmp.size()));
return;
}
if(rem - fac[i] >=... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 89253937689846d4fa59a916c2278cee | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C_Factorials_and_Powers_of_Two
{
static int ans= Integer.MAX_VALUE;
public static void main(String[] args) {
MyScanner s = new MyScanner();
int t = s.nextInt();
ArrayList<Long> factorials = new ArrayList<>();
ArrayList<L... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 8041a020f695428781969584961cd43a | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
public class C {
/**
* Template @author William Fiset... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 50c5a481e9a37d49a2bca80aa3e9d3a3 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = (long) 1e9 + 7;
static long inf = (long) 1e16;
static int n, l, k;
static TreeSet<Integer>[] ad, ad1, ad2;
static ArrayList<int[]>[] quer;
static int[][] remove, add;
static ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 0472a28b3e40424bc52ea1e143ee167f | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static Long [] arr ;
static long n ;
static int min ;
public static void solve(int idx, int cnt, long sum){
if(idx == arr.length){
long x = n-sum ;
min = Math.min(min, cnt+Long.bitCount(x)) ;
return ;
}
if(sum+arr[id... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 915a1e3a45a0e0e0a3ecfcced25ca134 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static Long [] arr ;
static long n ;
static int min ;
public static void solve(int idx, int msk, long sum){
if(idx == arr.length){
long x = n-sum ;
min = Math.min(min, Integer.bitCount(msk)+Long.bitCount(x)) ;
return ;
}
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 977b006f810d02cab26db3fc6a096253 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Ac {
static int MOD = 998244353;
static int MAX = (int)1e8;
static Random rand = new Random();
static FastReader in = new FastReader();
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | c6aa3944785d8ae516fc6efcf4bc58e0 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Ac {
static int MOD = 998244353;
static int MAX = (int)1e8;
static Random rand = new Random();
static FastReader in = new FastReader();
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 1bb403ed971c0c04973f560746166c81 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Practice1 {
public static void main(String args[])
{
FastReader input=new FastReader();
PrintWriter out=new PrintWriter(System.out);
int T=1;
while(T-->0)
{
long[] fact = new long[12];
f... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 672d22f9003f977cbffa7ec67387c3b7 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
static final int INF = 0x3f3f3f3f;
static final long LNF = 0x3f3f3f3f3f3f3f3fL;
public static void main(String[] args) throws IOException {
initReader();
int m=nextInt();
long[]f=new long[2... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | a55509090e47a600f0cc813d96be0c1e | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import static java.lang.Math.*;
import java.io.*;
public class S {
public static int surv = 0;
public static long f[];
public static void main(String args[])throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | e45316b6164810b124197c97b698fad5 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
public class Main {
static long setBitCount(long n){
long c=0;
while(n>0){
n=n&(n-1);
c++;
}
return c;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
long n=sc.nextLong();
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 16909285607f297deb83198aa183e6f2 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | c5ffbab6deee3b4175f89e3849339353 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Program {
public static void println(String str) {
System.out.println(str);
}
public static void println(int str) {
System.out.println(str);
}
public static void print(String str) {
System.out.print(str);
}
publi... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | b0beb96186253b1274e9de7ce332de47 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class C {
static class Pair
{
int f;int s; //
Pair(){}
Pair(int f,int s){ this.f=f;this.s=s;}
}
static class Fast {
BufferedReader br;
StringTokenizer st;
public Fast() {
br = new Bu... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | b13f3248d2991e3a9c175629256ea39a | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
static Scanner scn = new Scanner(System.in);
static StringBuilder sb = new StringBuilder();
public static void main(String[] ScoobyDoobyDo) {
long[] fact = new long[16];
fact[0] = 1L; fact[1] = 1L;
for(in... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 4d3942a4c648fa6c47901e992db689b1 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | // package CF.CF774;
import java.io.*;
import java.util.*;
import java.math.*;
/**
* @Author: merickbao
* @Created_Time: 2022-03-05 20:29
* @Description:
*/
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outp... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | dcc325f5645f859d5e97fbcba8ee8847 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | // package CF.CF774;
import java.io.*;
import java.util.*;
import java.math.*;
/**
* @Author: merickbao
* @Created_Time: 2022-03-05 20:29
* @Description:
*/
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outp... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | e2e3e2b5607fb5a1abafcfc8cc136cfc | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class FactorialsandPowerofTwo{
public static void main(String[] args) {
FastReader fr = new FastReader();
PrintWriter out = new PrintWriter(System.out);
Scanner sc= new Scanner (System.in);
//Code From Here----
in... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 8032b3e0325f9a2f39eb00aeaa99c10e | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
// import java.lang.*;
// import java.math.*;
public class Main {
static FastReader sc=new FastReader();
static PrintWriter out=new PrintWriter(System.out);
static long mod=1000000007;
// static long mod=998244353;
static int MAX=Integer.MAX_VALUE;
static int M... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 42ef34068874a1ca87b9d62d6fa56a46 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | //package codeforces.round774div2;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class C {
static InputReader in;
static PrintWriter out;
public static void main(String[] args) {
//initReaderPrinter(true);
initReaderPrinter(false);
solve(in.nextInt(... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 76c71d12726c356b981c99af73075a7b | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | //package codeforces.round774div2;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class C {
static InputReader in;
static PrintWriter out;
public static void main(String[] args) {
//initReaderPrinter(true);
initReaderPrinter(false);
solve(in.nextInt(... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | c06efc4aa8321fa917e13a4728a301f9 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | /*
* Everything is Hard
* Before Easy
* Jai Mata Dii
*/
import java.util.*;
import java.io.*;
public class Main {
static class FastReader{ BufferedReader br;StringTokenizer st;public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}String next(){while (st == null || !st.h... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 8b62c5005b2d9f6885d68cb52a3758f3 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | /* || श्री राम समर्थ ||
|| जय जय रघुवीर समर्थ ||
*/
import java.io.*;
import java.util.*;
import static java.util.Arrays.sort;
public class CodeforcesTemp {
static Reader scan = new Reader();
static FastPrinter ou... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 31c2ca99afdc411902cecb1380e75a24 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static PrintWriter pw;
static long[] fac, invfac;
static long mod = (int) 1e9 + 7;
static Stack<Integer> st;
static boolean vis[];
// int MAXN = (int) 2e5 + 2; // if n =1e5 ,MAXN = 2*n+2
// facc(MAXN);
// invfacc(MA... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 93802b6e21032c43735e7b82e3d181ee | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static PrintWriter pw;
static int dp[][];
static int mod = (int) 1e9 + 7;
static int n;
static HashSet<Long> hSet;
static long arr[];
static long target;
public static void main(String[] args) throws IOException, InterruptedException {
Scanner sc = n... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | ac5ed986f06edab060b5b22739b6f4ec | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A { //
public static void main(String[] args) throws IOException {
long[] fac = new long[16];
fac[0] = 1;
for (int i = 1; i < fac.length; i++) fac[i] = fac[i - 1] * i;
long[] sub = new long[1 << (fac.length - 1)];
int[] cn... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | b39dcdaeec6763df8ebf6659c3358d44 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.security.KeyStore.Entry;
import java.util.*;
public class Odd_Selection {
static InputStreamReader r = new InputStreamReader(System.in);
static BufferedReader br = new BufferedReader(r);
static PrintWriter p = new PrintWriter(System.out);
static int n;
sta... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | fc9db32a03230c08c0585082fb81dfbb | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main
{
public static int howmany(long value)
{
String s = Long.toBinaryString(value);
// System.out.println(s);
int count = 0;
for (int i ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 925816d6db9a967a63e3f8664a30c793 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static long[] arr;
static TreeSet<String> tSet;
static PrintWriter pw;
public static int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
public static int lcm(int a, int b) {
return a * b / gcd(a, b);
}
public static long fac(long i) ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 329314fd324d7e23ee58884ef7d2b8a3 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
public class Main {
static int MAXN = (int) 1e5+5;
static long[] pNum = new long[MAXN];
static int p = 0;
static int ans = 100;
public static int get2K(long n){
int ret = 0;
while (n != 0) {
if ((n & 1) == 1) ret++;
n >>= 1;
}
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 0a4c446ab6d6f8cce3e69e791fc64db3 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | //package brute_force;
import java.io.*;
import java.util.*;
public class factorials_and_powers_of_two {
static long n;
static long fact[];
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = sc.nextInt();
fac... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | e3315ec1b0e690bb76afcc8ba5f91ee6 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class factorials {
public static void main(String[] args)throws IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(Syst... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 1cd64bea3640021278c5726ddab28ca9 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C1646 {
static FastScanner sc = new FastScanner(System.in);
static FastPrintStream out = new FastPrintStream(System.out);
static final ArrayList<Long> facts = new ArrayList<>();
static final TreeSet<Long> pows = new TreeSet<>();
static ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 48f9bef7f24a6978d73317fa105bb669 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class FactorialsAndPowersOfTwo {
public static PrintWriter out;
public static void main(String[] args)throws IOException{
Scanner sc=new Scanner();
out=new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0) {
long n=... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | dc07cd3fa37cc8344215feff1d0015be | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import javax.management.Query;
import java.io.*;
public class Try {
// static int n,k;
//// static String t,s;
// static long[]memo;
static long[] arr;
public static void main(String[] args) throws Exception {
Scanner sc=new Scanner(System.in);
arr=new lo... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | d568e63423d3c14775963e1ac96cad1a | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C { // factorials and powers of 2
static long [] fac;
static long n ;
public static void main(String[] args) throws IOException {
// Scanner sc = new Scanner(new FileReader("input.in"));
// PrintWriter pw = new PrintWriter(new... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 8b698aff6ebd12eeeb6e7100ade4b1a6 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class FactorialsAndPowersOfTwo {
static TreeSet<Long> tm = new TreeSet<>();
static ArrayList<Long> arr;
static long factorial(int n){
if(n == 0)
return 1;
return n * factorial(n-1);
}
public static void main(String[... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 72aebee8f77ada5631336ad87cdc299a | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class factorials_and_powers_of_two {
static long n;
static long fact[];
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = sc.nextInt();
fact = new l... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | c12ba8034e82c2806e5ce1807618568a | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
public class Main {
static long fact[] = {1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800L,87178291200L,1307674368000L};
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-- ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | e912bf9f461aecb2c4a79a554e1203f7 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Vector;
/**
* Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
*/
public class Main... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | bad5125eefff215bea56d0984ff6479f | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
//import java.math.BigInteger;
public class code{
public static class Pair{
int a;
int b;
Pair(int i,int j){
a=i;
b=j;
}
}
public static int GCD(int a, int b)
{
if (b == 0)
return a;
return GCD(b, a % b);
}... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | d8ce18ee81b414878eeedca189802e14 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
static long[] inv = new long[20];
static void init() {
// 全局变量初始化
inv[0] = inv[1] = 1;
for(int i = 2; i <= 15; i++) {
inv[i] = inv[i - 1] * i;
}
}
public static void main... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 1e7b2a2c690228525e929e758125ecb4 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class FactorialsAndPowersOfTwo {
public static PrintWriter out;
private static Scanner sc;
private static final long MOD = 1000000007;
public FactorialsAndPowersOfTwo(){
out = new PrintWriter(new BufferedOutputStream(System.out));
sc = new Scanner(System.in);
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 297645dd0cb17fa6a22bb4c3569e5a09 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
public class FactorialsAndPowersOfTwo {
public static PrintWriter out;
private static Scanner sc;
private static final long MOD = 1000000007;
public FactorialsAndPowersOfTwo(){
out = new PrintWriter(new BufferedOutputStream(System.out));
sc = new Scanner(System.in);
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 7eb025e12db708913fbf43fd242324be | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
//import java.text.DecimalFormat;
import java.util.*;
public class Codeforces {
static long mod = 1000000007 ;
public static void main(String[] args) throws Exception {
PrintWri... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 97c419686ef872a3246ebcfaa60c2957 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class F {
static class Reader {
BufferedReader br;
StringTokenizer st;
public Reader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (s... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 6995d3be71c541b9fc0184f7bca9901b | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int t = cin.nextInt();
Solution solution = new Solution();
for (int i = 0; i < t; i++) {
System.out.println(solution.func(cin.nextLong()))... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 87d012fba99bb3c4360a0a94e3d2463a | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.lang.*;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
pu... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | fde179bd29ce0157432172d67953c639 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.*;
import java.util.*;
public final class C {
static List<Long> facts;
public static void main(String[] args) {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
facts = new ArrayList<>();
facts.add((long)1);
... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 7962e5d719a2933ba229234c76ccfa83 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
static List<Long> fact = new ArrayList<>();
static {
long x = 1;
for (int i = 1 ; i < ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 2cf2a8491fca3449d40d065ec9367d2d | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
import java.util.StringTokenizer;
/*
Long.bitCount(n);
some factorials to ... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | 2db3fbbc2c57fdf8fbe1d1ce3ec7b85a | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | //package kg.my_algorithms.Codeforces;
import java.util.*;
import java.io.*;
// If you know the reason for your existence, then act on it.
// "मैं दर्शक नहीं हूँ" -> I am not a spectator
public class Solution {
private static final FastReader fr = new FastReader();
private s... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output | |
PASSED | afaa568e6adb4cf8a163008609a46a60 | train_110.jsonl | 1646408100 | A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1\cdot 2\cdot \ldots \cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are ... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
long n = sc.nextLong();
List<Long> list = new ArrayList<>();
for (long x = 1, y = 2; x <... | Java | ["4\n\n7\n\n11\n\n240\n\n17179869184"] | 3 seconds | ["2\n3\n4\n1"] | NoteIn the first test case, $$$7$$$ can be represented as $$$7=1+6$$$, where $$$1$$$ and $$$6$$$ are powerful numbers. Because $$$7$$$ is not a powerful number, we know that the minimum possible value of $$$k$$$ in this case is $$$k=2$$$.In the second test case, a possible way to represent $$$11$$$ as the sum of three ... | Java 8 | standard input | [
"bitmasks",
"brute force",
"constructive algorithms",
"dp",
"math"
] | ff0b041d54755984df3706aae78d8ff2 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. A test case consists of only one line, containing one integer $$$n$$$ ($$$1\le n\le 10^{12}$$$). | 1,500 | For each test case print the answer on a separate line. If $$$n$$$ can not be represented as the sum of distinct powerful numbers, print $$$-1$$$. Otherwise, print a single positive integer — the minimum possible value of $$$k$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.