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 | 2b165dcdb912e84405c2f9a4b8dcd831 | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.util.Scanner;
import java.util.Stack;
import java.util.TreeMap;
public class prob {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
TreeMap<Integer, Integer> minus = new TreeMap<>();
TreeMap<Integer, Integer> plus =... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | ad5fef396dae740bb3a90e36a24061dc | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | //Code by Sounak, IIEST
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Arrays;
public class Test1{
public static void main(String args[])throws IOException{
FastReader sc = new FastReader();
StringBuilder sb = new StringBuilder();
HashMap<Integer , Integer> arr = ... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | 7d943df7a6ba4fdf4177fe4d00dcb8b3 | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.util.*;
public class HelloWorld{
public static void main(String []args){
Scanner s=new Scanner(System.in);
int n=s.nextInt();
String[] arr=new String[n];
for(int i=0;i<n;i++){
arr[i]=s.next();
}
int[] count=new int[n];
... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | aeb51092641e3c1b469df1689f6ff33e | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class OOP {
static int ans;
public static void main(String[] args) throws Exception {
FastIO io = new FastIO(System.in);
int n = io.nextInt();
... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | acb4a4ee2f61efc2ab7fa76f87c8d1c6 | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.DataInputStream;
import java... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | a1ab9d9adbddac98680baed1882aa65f | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.*;
public class C {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int N = scanner.nextInt();
int[] cnt = new int[1000010];
... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | 4eb75358d42ef10f4a05787e6df18a71 | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Parenthesis {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n = in.nextInt();
int correct = 0;
int[] l = new int[500001];
int[] r = new int[500001];
for (... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | da6330852fcac1731d5b3ebe19033129 | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Ta... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | 5fb8095eaf9e144cc7b51f903a9d9c9d | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.util.*;
import javax.lang.model.util.ElementScanner6;
import java.io.*;
public class Main{
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader inp = new InputReader(... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | c68e5e24046704c7ccb76043a259739d | train_001.jsonl | 1546613100 | One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences.A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it's possible to obtain a correct arithmetic expression by inserting cha... | 256 megabytes | import java.util.*;
public class YaP {
public static void main(String args[]){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int c[] = new int[1000001];
int a[] = new int[n];
for(int i=0;i<n;i++){
char ch[] = s.next().toCharArray();
in... | Java | ["7\n)())\n)\n((\n((\n(\n)\n)", "4\n(\n((\n(((\n(())", "2\n(())\n()"] | 2 seconds | ["2", "0", "1"] | NoteIn the first example, it's optimal to construct two pairs: "(( )())" and "( )". | Java 8 | standard input | [
"implementation",
"greedy"
] | 2cfb08b2269dbf5417c1758def4c035f | The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of bracket sequences. Each of the following $$$n$$$ lines contains one bracket sequence — a non-empty string which consists only of characters "(" and ")". The sum of lengths of all bracket sequences in the input is at most $$$5 \cdot 1... | 1,400 | Print a single integer — the maximum number of pairs which can be made, adhering to the conditions in the statement. | standard output | |
PASSED | 1926c31428e89480d626ccd3dc064c84 | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
String s[]=bu.readLine().split(" ");
int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]),c=I... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | ee66e0c225d90dfa4dcae95e87ade70e | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static long sx = 0, sy = 0, mod = (long) (1e9 + 7);
static ArrayList<Integer>[] a;
static HashMap<Integer, Integer> hm = new HashMap<>();
static Integer[][][][] dp;
static long[] far;
static int[] fa;
public static PrintWriter out = new PrintWriter(Sy... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | 2cebe56c2bf603ee65cf2e129fb8d69f | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class E_capitalReach {
static int partition(int arr[], int low, int high, int[] bad3)
{
int pivot = arr[high];
int i = (low-1); // index of smaller element
for (int j=low; j<high; j++)
{
// If curre... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | 424f893abe7abdd808ba4ec7b20ffea6 | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes |
// Imports
import java.util.*;
import java.io.*;
public class E999 {
/**
* @param args the command line arguments
* @throws IOException, FileNotFoundException
*/
public static void main(String[] args) throws IOException, FileNotFoundException {
// TODO UNCOMMENT WHEN ALGO... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | 6219867645a3bad69833cb06e0ad62c2 | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
import java.io.OutputStream... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | e1d3acae25ed19e5c50b141794ee731f | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.io.BufferedReader;
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.StringTokenizer;
import javafx.util.Pair;
public class Solve6 {... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | 0438607c5a20fa23daea99d73e91e65b | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.util.*;
import java.io.*;
import java.io.File;
import java.util.AbstractSet;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class Hello {
static int []visit = new int[10000];
static int n;
static int m;
static int s;
static ArrayList<Integer> e[] = new ArrayList[10000... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | 4680e3adae39366e0f52ddbffd8886e9 | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Sta... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | efa1145b2db6605118e5c82229b839f4 | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.util.*;
import java.io.*;
public class E490 {
static ArrayList<Integer> [] adj;
static ArrayList<Integer> [] rev;
static int [] post;
static int c;
static int [] scc;
static boolean [] vis;
static HashSet<Integer> bad = new HashSet<>();
public static void main(String[] args)... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | fcf401ee509b5c151cb52d9602cb8e14 | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.util.*;
public class Main
{
static Stack<Integer> st=new Stack<>();
static ArrayList<Integer> edge[];
static boolean pres;
static ArrayList<ArrayList<Integer>> components=new ArrayList<>();
static int vc=0;
static ArrayList<Integer> topo=new ArrayList<>();
public static void dfs(... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | 6023b00e2a48e24f9d80479b839d189a | train_001.jsonl | 1529591700 | There are $$$n$$$ cities and $$$m$$$ roads in Berland. Each road connects a pair of cities. The roads in Berland are one-way.What is the minimum number of new roads that need to be built to make all the cities reachable from the capital?New roads will also be one-way. | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
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.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.u... | Java | ["9 9 1\n1 2\n1 3\n2 3\n1 5\n5 6\n6 1\n1 8\n9 8\n7 1", "5 4 5\n1 2\n2 3\n3 4\n4 1"] | 2 seconds | ["3", "1"] | NoteThe first example is illustrated by the following: For example, you can add roads ($$$6, 4$$$), ($$$7, 9$$$), ($$$1, 7$$$) to make all the cities reachable from $$$s = 1$$$.The second example is illustrated by the following: In this example, you can add any one of the roads ($$$5, 1$$$), ($$$5, 2$$$), ($$$5, 3$$$... | Java 11 | standard input | [
"dfs and similar",
"greedy",
"graphs"
] | c02922c33eb816eea872b4d8a3c1dc0e | The first line of input consists of three integers $$$n$$$, $$$m$$$ and $$$s$$$ ($$$1 \le n \le 5000, 0 \le m \le 5000, 1 \le s \le n$$$) — the number of cities, the number of roads and the index of the capital. Cities are indexed from $$$1$$$ to $$$n$$$. The following $$$m$$$ lines contain roads: road $$$i$$$ is given... | 2,000 | Print one integer — the minimum number of extra roads needed to make all the cities reachable from city $$$s$$$. If all the cities are already reachable from $$$s$$$, print 0. | standard output | |
PASSED | 65e45c64471d142d9fe51097ee221901 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.util.Scanner;
public class B349{
public static void main(String[] agrs){
int v;
Scanner f= new Scanner(System.in);
int[] a = new int[1010000];
int[] cn= new int[10];
v=f.nextInt();
for(int i=1;i<10;i++)cn[i]=f.nextInt();
int u=9;
for(int i=8;i>0;i--)
if (cn[i]<cn[u])u=i;
int n=v/cn[u];
fo... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 8251fac4294b70b759822178780d96f0 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | //package Codeforces.Div2B_202.Code1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/*
* some cheeky quote
*/
public class Main
{
FastScanner in;
PrintWriter out;
public void solve() throws IOE... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | bb31f8b00d80b597058b319e81f5adaf | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class ColorTheFence {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
int v = Integer.parseInt(f.readLine());
int[] a = new int[9];
StringTokenizer st = ... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 0abb6b29618ed0aedfbca54fcbeeca52 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class ColorTheFence {
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
PrintWrite... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 3b01ebf26e3b892091fd32bd2ee161a7 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using ... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 78707e30be80d0ab22bdaa3ee45d8491 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
boolean eof;
public static void main(String[] args) throws IOException {
new Main().run();
}
public String nextToken() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (Exception e) {
eof = true;
return "-1"... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | a3eabb39b97b59a3fcc9f9b2cbf018a2 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class B349 {
public static void main(String[] args) throws IOException {
InputReader in... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 797a1d72d54f3e5da70aa3a7dea48525 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
/**
*
* @author sousnake
*/
public class B {
public static void... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 541992ae44e313e13edc7fe2a54b9ef8 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes |
import java.util.*;
import java.util.LinkedList;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class tmp {
public static void main(String [] args) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 8fb8b7e309f533e2511b8afbe810d44e | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public sta... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | a11f49a57a99606d9305cb8bdd3ac5f3 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class B {
public static void main(String[] args) throws FileNotFoundException {
Scanner scan = new Scanner(System.in);
int v = scan.nextInt();
int[] weights = new int[10];
int[] chosen = new int[10];
fo... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 52fae33c5847118c3e155e3646dfdde4 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class B {
public static void main(String[] args) throws FileNotFoundException {
Scanner scan = new Scanner(System.in);
int v = scan.nextInt();
int[] weights = new int[10];
int[] chosen = new int[10];
in... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 95f0c51369a663e0972100b98d76fc48 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.util.Scanner;
/**
* Ashesh Vidyut (Drift King) *
*/
public class B {
public static void main(String[] args) {
try {
InputReader in = new InputReader(System.in);
BufferedWriter out =... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 064d49cf2b5d46009d4f1aefb4a9c79a | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | afacbb3416dfd8cf0b01f2acd844f0fc | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class ColorTheFence {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
int V = sc.nextInt();
int[] costs = new int[... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | aebf64cc97695addb1e4b9ff4fb5c72d | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.util.Scanner;
/*
* Round 202 - Div2
* B
*
*/
public class R202_B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int liters = sc.nextInt();
int[] costs = new int[10];
for (int i = 1; i <= 9; i++) {
costs[i] = sc.nextInt();
}
StringBuilder number =... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 13cbf42a0bff2cfd5fc7be98b46265d9 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.*;
import java.util.*;
public final class color_fence
{
static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out=new PrintWriter(System.out);
public static void main(String args[]) throws Exception
{
int v=sc.nextInt(),n=10,min=Inte... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | e81860de32041ee7fd70e619edb484d0 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Nova
*/
public class Main {... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 356cb3bb450108ae5f096255727d9a69 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int l = sc.nextInt();
int[] digits = new int[9];
for (int i = 0; i < 9; i++) {
digits[i] = sc.nextInt();
}
int min = digits[8];
int mindigit = 9;
for (int i = 8; i >= 0; i--) {
... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 1e11d410f5e403c6a0500dd1024dbbf9 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B9_ColorTheFence {
public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
int[] nn = new ... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | ce0fa6b547240d7f5b168cd1cec1b99c | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.util.*;
import java.io.*;
public class B {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int v = sc.nextInt();
int[] num = new int[10];
int min = Integer.MAX_VALUE;
for(int i=1;i<10;i++){
num[i] = sc.nextInt()... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | db4712c375cc6edf553625258ffe44d8 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
// Solution is at the bottom of code
public class B implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | ff2184c756f5b3850e11e4446932c728 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Arrays;
public class Main{
static int t[],a[];
public static void main(String []args){
Scanner s=new Scanner(System.in);
PrintWriter pr=new PrintWriter(System.out);
int v=s.nextInt(),t,num[]=new int[9],array[];
Pair []a=new Pair[9];
for(... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | fd8d926957612aabad52284ca4126370 | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Iterator;
import java.util.StringTokenizer;
/**
* @author artyom
*/
public class ColorTheFence implements Runnable {
private BufferedReader in;
private PrintStream out;
private... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | ac61a91c8f8c61f954656033e1b03e0a | train_001.jsonl | 1380295800 | Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has. Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requ... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Main implements Runnable {
public void solve() throws IOException {
StringBuilder sb = new StringBuilder("");
int avail = nextInt();
int[] ten = new int[10];
int can = 0;
int id = -1;
for (int i = 1; i < 10; i++) {... | Java | ["5\n5 4 3 2 1 2 3 4 5", "2\n9 11 1 12 5 8 9 10 6", "0\n1 1 1 1 1 1 1 1 1"] | 2 seconds | ["55555", "33", "-1"] | null | Java 7 | standard input | [
"dp",
"implementation",
"greedy",
"data structures"
] | ace9fbabc2eda81b4e4adf4f2d5ad402 | The first line contains a positive integer v (0 ≤ v ≤ 106). The second line contains nine positive integers a1, a2, ..., a9 (1 ≤ ai ≤ 105). | 1,700 | Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1. | standard output | |
PASSED | 88711900e3e89133d19b2c0ef68d9d97 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes |
import java.io.*;
import java.lang.String;
import java.util.*;
public class Main {
private static int BinarySearch(int a[], int low, int high, int target) {
if (low > high)
return -1;
int mid = low + (high - low) / 2;
if (a[mid] == target)
return mid;
if (... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 8e933582568df183a6f585e510a25eb6 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class A472
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
if(n % 3 == 0)
System.out.println(6 + " " + (n-6));
else if(n % 3 == 1)
System.out.println(4 + " " + (n-4... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | c68febeeaba7c955f15cfa203ff2b5a7 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class tutorial
{
boolean prime(int x)
{
int i,c=0;
for(i=2;i<=x/2;i++)
{
if(x%i==0)
c++;
}
if(c==0)
return false;
else
return true;
}
public static void main(String args[])
{
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 16174eeb975c5ff0bffc902064f96d75 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class cards
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
long n;
n=in.nextLong();
if(n%2!=0)
{
System.out.println("9 "+(n-9));
System.exit(0);
}
else if(n%2==0)
{
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | aabfb190f893ea61669106040dd5b3fb | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class design_tut_learn_from_math {
static boolean isPrime(int num)
{
for(int i=2; i<num; i++)
{
if(num%i==0)
{
return false;
}
}
return true;
}
public static void main(String[] args) th... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | acc717c273ce57ea240cfceb0e700c5a | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Solution{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int number = scan.nextInt();
for(int i=2;i<number;i++){
if((!isPrime(i))&&(!isPrime(number-i))){
System.out.pri... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 64d74ed3d991973cc636bfcf2a5889df | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Nonprimes {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
boolean[] primes = new boolean[num + 1];
for(int i = 2; i*i <= num; i++) {
if(primes[i] == false) {
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | db869379d4682c7ed6b854741e1b02f2 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int target = scan.nextInt();
if (target % 2 == 0)
System.out.println(4 + " " + (target - 4));
else
System.out.println(9 + " " + (targ... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 633d6aa35f56ba93282fc1950566e803 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
import java.io.*;
public class LearnFromMath {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer inputLine = new StringTokenizer(br.readLine());
int n = Integer.parseInt(inp... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | f73f1d1fb0be7d8f221fcd2cb485a816 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class LearnFromMath {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
if (n % 2 == 0 ) System.out.println(n-8 + " " + 8);
else System.out.println(n-9 + " " + 9);
}
}
| Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 14cad34d2ee3cf910e2f74cd1ac09430 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class Present {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
if(n % 2 == 0) {
System.out.println(8+" "+(n-8));
}
else {
System.out.println(9+" "+(n-9));
}
}
} | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 909aedcd20469746f68cdbefbcc06a31 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class MathLearn
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
sc.close();
for (int i = 1; i <= num/2; i++)
{
if (!isPrime(i) && !isPrime(num - i))
{
System.out.println(i + " " + (num - i));
break;
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | adecf2c547ca03ab72d892c815ea4454 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
// Problem 472A
public class LearnFromMath{
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int n = sc.nextInt();
boolean[] primes = new boolean[100... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 0cefe54c1241c78c80a8b9d722720830 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
import java.util.BitSet;
public class intInput {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
BitSet primes = new BitSet();
for(int i = 2; i*i < 1000000; i++){
if(primes.get(i) == false) {
for (int j = i +... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | b75d68a1c24b3e1500794108ae4172fe | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | // Codeforces 472A
import java.util.Scanner;
public class CF472A {
static final Scanner SC = new Scanner(System.in);
public static void main(String[] args) {
int n = SC.nextInt();
int[] compositeAddends = getCompositeAddends(n); // Two composite addends of n
out(compositeAddends);
}... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 44a095086dea06d229026f0d8b1332a9 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
System.out.println((n % 2 == 0) ? n - 4 + " " + 4 : n - 9 + " " + 9);
}
}
| Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | be926d4933af66fe39c333c81de54c82 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int first = n / 2;
int second = n / 2;
if(n % 2 != 0){
first++;
}
while(!isComposite(firs... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 6679e3b24cc41c687e66712855c476ad | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
// QAQAQYSYIOIWIN
// outputCopy
// 4
// inputCopy
// QAQQQZZYNOIWIN
// outputCopy
// 3
public class Main
{
static PrintWriter out;
static class FastReader{
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 48af7db93e84a941ca89b92737fdc32c | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class learnFromMath{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a,b;
if(n%2==0)
{
if(composite(n/2))
{
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 57e3f96ef8dd5f0825598b23fb0a30b8 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class learnFromMath{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a,b;
if(n%2==0)
{
if(composite(n/2))
{
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 52d6608cd74937f568880f55084eb93a | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class Main {
static final int NO_OF_CHARS = 256;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// write your code here
long n = scanner.nextLong();
long a = n / 2, b = a;
boolean comA = false, comB = false... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 1b2bc74ebb635a9daf1c200c00a06010 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String args[]){
Scanner in=new Scanner(System.in);
int n=in.nextInt();
if(n%2==0)
System.out.println("8 "+(n-8));
else System.out.println("9 "+(n-9));
}
} | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 83ff58dadae5b62a7db43164e4b8bf4d | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import com.sun.source.tree.Tree;
import java.lang.reflect.Array;
import java.util.*;
import java.lang.*;
import java.util.regex.Pattern;
public class Example {
public static int Max(int[] p)
{
int Max=0;
int j=0;
for(int i=0;i<p.length;i++)
{
if(p[i]>Max)
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | eef67d347d05c74b105bb03e9d4dee74 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class arr {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
if (n % 2 == 0) {
System.out.println((n-4) + " " + 4);
} else {
if (isPrime(n)) {
System.out.println(... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 9c343924cef1d6800c0bf4a697285b40 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class arr {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
if (n % 2 == 0) {
System.out.println((n-4) + " " + 4);
} else {
if (isPrime(n)) {
System.out.println(... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 2223f18c3aa5020178cdace72a601824 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
if(n%2==0){
System.out.printf("%d %d",(n-4),4);
}else{
System.out.printf("%d %d",(n-9),9);
}
}
} | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 93de4dd1a7c18b8005ace2000ea7987c | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
if(x%2==0)
System.out.print("4 "+(x-4));
else System.out.print("9 "+(x-9));
}
}
| Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | b55da64180b542d975b2fed0fc0302c7 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 49db1d7db62e282814cf1c70890ca1d6 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class math {
static boolean[] arr = new boolean[10000001];
public static void sieve(){
arr[0] = true;
arr[1] =true;
for (int i = 2; i*i<arr.length; i++) {
for (int j = i*i; j<arr.length; j+=i) {
if (arr[j]==false) {
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 22d23eea98db6348901adec1866c5c4d | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class math {
public static void main(String[] args) {
int i ;
Scanner scan = new Scanner(System.in);
i = scan .nextInt();
if (i%2==0) {
System.out.println((i-4)+" "+4);
} else {
System.out.println((i-9)+" "+9);
}
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | ba235961415867d0eeae7c8e9e8c592b | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | //package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long x = scanner.nextInt();
if(x%2==0){
System.out.print(8 + " ");
System.out.print(x-8);
}else {
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 693bed943c0958946c96f20f6b15b1de | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes |
public class DesignTutorialLearnFromMath {
public static void main(String[] args) {
int n = new java.util.Scanner(System.in).nextInt();
if (n%2 == 0) {
System.out.println(n-8 + " " + 8);
}
else {
System.out.println(n-9 + " " + 9);
}
}... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | d7eb37e8680502f8a5b9bca5cac78dc3 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | public class Main{
public static void main(String shy[]){
java.util.Scanner sc = new java.util.Scanner(System.in);
int num = sc.nextInt();
if(num % 2 == 0){
System.out.println( "4 " + (num - 4));
}
else
System.out.println((num - 9) + " 9");
}
} | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 9f74a63e685e542ecf63315295bfcb0c | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
import java.io.*;
public class DTLearnFromMath
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
int num = in.nextInt();
if(num % 2 == 0)
{
int x = num/2;
if(x % 2 == 0)
{
System.out.printl... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | eb95e79330671d266dd2662ec7d75d25 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class Test {
static boolean isPrime(long n) {
if(n == 2 || n == 3)
return true;
if(n < 2 || n % 2 == 0 || n % 3 == 0)
return false;
for(long i = 5; i * i <= n; i += 6)
if(n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
public static void main(String[... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 4d7619fe6dbdeda10a9626b78a76b587 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int tgt = in.nextInt();
if ((tgt % 2) == 0) {
int a = tgt -8;
System.out.println("8 " + a);
} else {
int b = tgt-9;
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | da65fdd76b54686e6c46ec161240b499 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
public class A472 {
public static void main(String[] args) {
Scanner i = new Scanner(System.in);
int n1 = i.nextInt();
if (n1 % 2 == 0) {
System.out.println(4 + " " + (n1 - 4));
} else {
System.out.println(9 + " " + (n1 - 9));
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 03554045b13bfb5becec4cf3cacb39e0 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.*;
import java.io.*;
import java.util.stream.*;
public class Main{
private static BufferedReader in;
private static BufferedWriter out;
public static void main(String[] args) throws IOException {
open();
StringTokenizer st;
StringBuilder sb;
int n = readInt();
int half = n / ... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | a3a8a9011c44a8ba7e37d6eb74cdf912 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes | import java.util.Scanner;
public class DesignTutorialLearnfromMath_472A {
Scanner sc = new Scanner(System.in);
void LearnMath() {
int n = sc.nextInt();
// x + y = n
if(n % 2 == 0) {
System.out.print("4 ");
System.out.println((n - 4));
}else {
System.out.print((n - 9));
System.out.print(" 9");
... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 5b6140b59b3bac1dee379b4a952bc9cb | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes |
import java.util.Scanner;
public class MyClass {
@SuppressWarnings("resource")
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
if(((a&1)==0)) {
System.out.println("4 " +(a-4));
return;
}
System.out.println("9 " +(a-9));
sc.close();
}
}
// ... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | 5b279b0fd21805d4ca513f14a9625e03 | train_001.jsonl | 1411918500 | One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.For example, there is a statement called the "Goldbach's conjecture". It says: "each even number no less than four can be expressed as the sum of two pr... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MyClass {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a=Integer.parseInt(br.readLine()... | Java | ["12", "15", "23", "1000000"] | 1 second | ["4 8", "6 9", "8 15", "500000 500000"] | NoteIn the first example, 12 = 4 + 8 and both 4, 8 are composite numbers. You can output "6 6" or "8 4" as well.In the second example, 15 = 6 + 9. Note that you can't output "1 14" because 1 is not a composite number. | Java 11 | standard input | [
"number theory",
"math"
] | 3ea971165088fae130d866180c6c868b | The only line contains an integer n (12 ≤ n ≤ 106). | 800 | Output two composite integers x and y (1 < x, y < n) such that x + y = n. If there are multiple solutions, you can output any of them. | standard output | |
PASSED | ee59df2e136d49c6f24c2fa2bffc71df | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.util.*;
import java.math.*;
public class Main{
static boolean graph[][] = new boolean[710][710];
static BigInteger dp[][] = new BigInteger[710][3];
public static void dfs(int N, int p, int x){ // System.out.println(N + " " + p + " " + x);
int i,j;
int c[] = new in... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | 99070e1d2afa5b07d7d32fa0c2ddc4e6 | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(ou... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | c881b19db9d33cce2008fa3e6d0ee4b1 | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
static int n;
static ArrayList<Integer> neigh[];
static int siz[];
static BigInteger dp[][];
static BigInteger best[];
private static void Calc(int v, int p)
{
siz[v] = 1;
dp[v][0] = BigInteg... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | 3323b65e04b285aa079f1ef6eef63307 | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(output... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | 2e8a9e4032ece8ff5089c25f0a652611 | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(output... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | bfda90351e4eea649155b66fd817c10d | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Cf23e {
static int n;
static BigInteger[][] dp = new BigInteger[710][710];
static int[][] adj = new int[710][710];
static int[] dg = new int[710];
static int[] sm = new int[710];
public static void dfs(int u, int p) {
... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | 61581e244e9072bbd450350065a65b69 | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Cf23e {
static int n;
static BigInteger[][] dp = new BigInteger[710][710];
static int[][] adj = new int[710][710];
static int[] dg = new int[710];
static int[] sm = new int[710];
public static void dfs(int u, int p) {
... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | 8deebcfb539f189166d680315f54c1eb | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Cf23e {
static int n;
static BigInteger[][] dp = new BigInteger[710][710];
static int[][] adj = new int[710][710];
static int[] dg = new int[710];
static int[] sm = new int[710];
public static void dfs(int u, int p) {
... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | ba7ff32efb1bedcf340b7d645f6c05f0 | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main{
static int N = 705;
static int sum[] = new int[N];
static int sz[][] = new int[N][N];
static BigInteger dp[][] = new BigInteger[N][N];
static int n;
static void dfs(int u, int fa) {
s... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | d058ab39aac7c823b09d9e8af889b6af | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.math.BigInteger;
import java.util.Scanner;
public class Main {
static final int MAX = 710;
static final int MAX_NODE_IN_COMPONENT = 710;
static int n;
static int graph[][] = new int[MAX][MAX];
static int size[] = new int[MAX];
static int child_count[] = new int[MAX];
static BigInteger f[][] = new... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | a91ebd9d7a0237fab516c68fed01fde8 | train_001.jsonl | 1278687600 | Recently Bob invented a new game with a tree (we should remind you, that a tree is a connected graph without cycles): he deletes any (possibly, zero) amount of edges of the tree, and counts the product of sizes of the connected components left after the deletion. Your task is to find out the maximum number that Bob can... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class Main {
static class Node extends ArrayList<Node> {
int sum;
BigInteger []ans;
void dfs(Node father) {
sum = 1;
... | Java | ["5\n1 2\n2 3\n3 4\n4 5", "8\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n6 8", "3\n1 2\n1 3"] | 2 seconds | ["6", "18", "3"] | null | Java 7 | standard input | [
"dp"
] | 8dbf81e0d2815382cec6488efd877b70 | The first input line contains integer number n (1 ≤ n ≤ 700) — amount of vertices in the tree. The following n - 1 lines contain the description of the edges. Each line contains the pair of vertices' indexes, joined by an edge, ai, bi (1 ≤ ai, bi ≤ n). It's guaranteed that the graph described in the input is a tree. | 2,500 | Output the only number — the maximum product of sizes of the connected components, that Bob can get after deleting some of the tree's edges. | standard output | |
PASSED | 5fa047bf2762214956de1c45b279a5af | train_001.jsonl | 1580826900 | There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$... | 256 megabytes | import java.util.*;
import java.io.*;
public class CodeForces
{
public static void main(String[] args)throws IOException
{
Scanner sc=new Scanner(System.in);
//Scanner sc=new Scanner(new File("ip.txt"));
int tc,n,l1,l2,min,i;
String s;
tc=sc.nextInt();
while(tc-->0)
{
n=sc.nextInt();
s=sc.... | Java | ["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"] | 1 second | ["1 2\n1 4\n3 4\n-1"] | null | Java 8 | standard input | [
"data structures",
"implementation"
] | 1fc1d5ee79aaf823b246db5471ba7836 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path.... | 1,500 | For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum... | standard output | |
PASSED | aa773886913a22f9999c8156d416d231 | train_001.jsonl | 1580826900 | There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelpe... | Java | ["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"] | 1 second | ["1 2\n1 4\n3 4\n-1"] | null | Java 8 | standard input | [
"data structures",
"implementation"
] | 1fc1d5ee79aaf823b246db5471ba7836 | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the length of the robot's path.... | 1,500 | For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ — endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.